notice.css 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. /* mixins & extensions */
  2. @keyframes in {
  3. 0% {
  4. opacity: 0;
  5. }
  6. 100% {
  7. opacity: 1;
  8. }
  9. }
  10. @keyframes in-down {
  11. 0% {
  12. opacity: 0;
  13. transform: translate3D(0, -5px, 0);
  14. }
  15. 100% {
  16. opacity: 1;
  17. transform: translate3D(0, 0, 0);
  18. }
  19. }
  20. @keyframes in-up {
  21. 0% {
  22. opacity: 0;
  23. transform: translate3D(0, 5px, 0);
  24. }
  25. 100% {
  26. opacity: 1;
  27. transform: translate3D(0, 0, 0);
  28. }
  29. }
  30. @keyframes in-scale {
  31. 0% {
  32. opacity: 0;
  33. transform: scale3D(0.95, 0.95, 1);
  34. }
  35. 100% {
  36. opacity: 1;
  37. transform: scale3D(1, 1, 1);
  38. }
  39. }
  40. :root {
  41. --calcite-animation-timing: calc(150ms * var(--calcite-internal-duration-factor));
  42. --calcite-internal-duration-factor: var(--calcite-duration-factor, 1);
  43. --calcite-internal-animation-timing-fast: calc(100ms * var(--calcite-internal-duration-factor));
  44. --calcite-internal-animation-timing-medium: calc(200ms * var(--calcite-internal-duration-factor));
  45. --calcite-internal-animation-timing-slow: calc(300ms * var(--calcite-internal-duration-factor));
  46. }
  47. .calcite-animate {
  48. opacity: 0;
  49. animation-fill-mode: both;
  50. animation-duration: var(--calcite-animation-timing);
  51. }
  52. .calcite-animate__in {
  53. animation-name: in;
  54. }
  55. .calcite-animate__in-down {
  56. animation-name: in-down;
  57. }
  58. .calcite-animate__in-up {
  59. animation-name: in-up;
  60. }
  61. .calcite-animate__in-scale {
  62. animation-name: in-scale;
  63. }
  64. /**
  65. * Currently only used in Checkbox.
  66. */
  67. :root {
  68. --calcite-popper-transition: var(--calcite-animation-timing);
  69. }
  70. :host([hidden]) {
  71. display: none;
  72. }
  73. /**
  74. * CSS Custom Properties
  75. *
  76. * These properties can be overridden using the component's tag as selector.
  77. *
  78. * @prop --calcite-notice-width: the width of the notice
  79. */
  80. :host([scale=s]) {
  81. --calcite-notice-spacing-token-small: 0.5rem;
  82. --calcite-notice-spacing-token-large: 0.75rem;
  83. }
  84. :host([scale=s]) .container slot[name=title]::slotted(*), :host([scale=s]) .container *::slotted([slot=title]) {
  85. margin-top: 0.125rem;
  86. margin-bottom: 0.125rem;
  87. font-size: var(--calcite-font-size--1);
  88. line-height: 1.375;
  89. }
  90. :host([scale=s]) .container slot[name=message]::slotted(*), :host([scale=s]) .container *::slotted([slot=message]) {
  91. margin-top: 0.125rem;
  92. margin-bottom: 0.125rem;
  93. font-size: var(--calcite-font-size--2);
  94. line-height: 1.375;
  95. }
  96. :host([scale=s]) ::slotted(calcite-link) {
  97. margin-top: 0.125rem;
  98. margin-bottom: 0.125rem;
  99. font-size: var(--calcite-font-size--2);
  100. line-height: 1.375;
  101. }
  102. :host([scale=s]) .notice-close {
  103. padding: 0.5rem;
  104. }
  105. :host([scale=m]) {
  106. --calcite-notice-spacing-token-small: 0.75rem;
  107. --calcite-notice-spacing-token-large: 1rem;
  108. }
  109. :host([scale=m]) .container slot[name=title]::slotted(*), :host([scale=m]) .container *::slotted([slot=title]) {
  110. margin-top: 0.125rem;
  111. margin-bottom: 0.125rem;
  112. font-size: var(--calcite-font-size-0);
  113. line-height: 1.375;
  114. }
  115. :host([scale=m]) .container slot[name=message]::slotted(*), :host([scale=m]) .container *::slotted([slot=message]) {
  116. margin-top: 0.125rem;
  117. margin-bottom: 0.125rem;
  118. font-size: var(--calcite-font-size--1);
  119. line-height: 1.375;
  120. }
  121. :host([scale=m]) ::slotted(calcite-link) {
  122. margin-top: 0.125rem;
  123. margin-bottom: 0.125rem;
  124. font-size: var(--calcite-font-size--1);
  125. line-height: 1.375;
  126. }
  127. :host([scale=l]) {
  128. --calcite-notice-spacing-token-small: 1rem;
  129. --calcite-notice-spacing-token-large: 1.25rem;
  130. }
  131. :host([scale=l]) .container slot[name=title]::slotted(*), :host([scale=l]) .container *::slotted([slot=title]) {
  132. margin-top: 0.125rem;
  133. margin-bottom: 0.125rem;
  134. font-size: var(--calcite-font-size-1);
  135. line-height: 1.375;
  136. }
  137. :host([scale=l]) .container slot[name=message]::slotted(*), :host([scale=l]) .container *::slotted([slot=message]) {
  138. margin-top: 0.125rem;
  139. margin-bottom: 0.125rem;
  140. font-size: var(--calcite-font-size-0);
  141. line-height: 1.375;
  142. }
  143. :host([scale=l]) ::slotted(calcite-link) {
  144. margin-top: 0.125rem;
  145. margin-bottom: 0.125rem;
  146. font-size: var(--calcite-font-size-0);
  147. line-height: 1.375;
  148. }
  149. :host([width=auto]) {
  150. --calcite-notice-width: auto;
  151. }
  152. :host([width=half]) {
  153. --calcite-notice-width: 50%;
  154. }
  155. :host([width=full]) {
  156. --calcite-notice-width: 100%;
  157. }
  158. :host {
  159. margin-left: auto;
  160. margin-right: auto;
  161. display: none;
  162. max-width: 100%;
  163. align-items: center;
  164. width: var(--calcite-notice-width);
  165. }
  166. .container {
  167. pointer-events: none;
  168. margin-top: 0px;
  169. margin-bottom: 0px;
  170. box-sizing: border-box;
  171. display: none;
  172. width: 100%;
  173. background-color: var(--calcite-ui-foreground-1);
  174. opacity: 0;
  175. max-height: 0;
  176. text-align: start;
  177. transition: var(--calcite-animation-timing);
  178. border-inline-start: 0px solid;
  179. box-shadow: 0 0 0 0 transparent;
  180. }
  181. .notice-close {
  182. outline-offset: 0;
  183. outline-color: transparent;
  184. transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  185. }
  186. .notice-close:focus {
  187. outline: 2px solid var(--calcite-ui-brand);
  188. outline-offset: -2px;
  189. }
  190. :host {
  191. display: flex;
  192. }
  193. :host([active]) .container {
  194. pointer-events: auto;
  195. display: flex;
  196. max-height: 100%;
  197. align-items: center;
  198. border-width: 2px;
  199. opacity: 1;
  200. --tw-shadow: 0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  201. --tw-shadow-colored: 0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);
  202. box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
  203. }
  204. .container slot[name=title]::slotted(*), .container *::slotted([slot=title]) {
  205. margin: 0px;
  206. font-weight: var(--calcite-font-weight-medium);
  207. color: var(--calcite-ui-text-1);
  208. }
  209. .container slot[name=message]::slotted(*), .container *::slotted([slot=message]) {
  210. margin: 0px;
  211. display: inline;
  212. font-weight: var(--calcite-font-weight-normal);
  213. color: var(--calcite-ui-text-2);
  214. margin-inline-end: var(--calcite-notice-spacing-token-small);
  215. }
  216. .notice-content {
  217. box-sizing: border-box;
  218. transition-property: all;
  219. transition-duration: var(--calcite-animation-timing);
  220. transition-timing-function: ease-in-out;
  221. transition-delay: 0s;
  222. padding: var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);
  223. flex: 0 0 auto;
  224. display: flex;
  225. min-width: 0px;
  226. flex-direction: column;
  227. overflow-wrap: break-word;
  228. flex: 1 1 0;
  229. padding-block: var(--calcite-notice-spacing-token-small);
  230. padding-inline: 0 var(--calcite-notice-spacing-token-small);
  231. }
  232. .notice-content:first-of-type:not(:only-child) {
  233. padding-inline-start: var(--calcite-notice-spacing-token-large);
  234. }
  235. .notice-content:only-of-type {
  236. padding: var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);
  237. }
  238. .notice-icon {
  239. display: flex;
  240. align-items: center;
  241. box-sizing: border-box;
  242. transition-property: all;
  243. transition-duration: var(--calcite-animation-timing);
  244. transition-timing-function: ease-in-out;
  245. transition-delay: 0s;
  246. padding: var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);
  247. flex: 0 0 auto;
  248. }
  249. .notice-close {
  250. display: flex;
  251. cursor: pointer;
  252. align-items: center;
  253. align-self: stretch;
  254. border-style: none;
  255. background-color: transparent;
  256. color: var(--calcite-ui-text-3);
  257. outline: 2px solid transparent;
  258. outline-offset: 2px;
  259. box-sizing: border-box;
  260. transition-property: all;
  261. transition-duration: var(--calcite-animation-timing);
  262. transition-timing-function: ease-in-out;
  263. transition-delay: 0s;
  264. padding: var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);
  265. flex: 0 0 auto;
  266. -webkit-appearance: none;
  267. }
  268. .notice-close:hover, .notice-close:focus {
  269. background-color: var(--calcite-ui-foreground-2);
  270. color: var(--calcite-ui-text-1);
  271. }
  272. .notice-close:active {
  273. background-color: var(--calcite-ui-foreground-3);
  274. }
  275. .actions-end {
  276. display: flex;
  277. align-self: stretch;
  278. }
  279. :host([color=blue]) .container {
  280. border-color: var(--calcite-ui-brand);
  281. }
  282. :host([color=blue]) .container .notice-icon {
  283. color: var(--calcite-ui-brand);
  284. }
  285. :host([color=red]) .container {
  286. border-color: var(--calcite-ui-danger);
  287. }
  288. :host([color=red]) .container .notice-icon {
  289. color: var(--calcite-ui-danger);
  290. }
  291. :host([color=yellow]) .container {
  292. border-color: var(--calcite-ui-warning);
  293. }
  294. :host([color=yellow]) .container .notice-icon {
  295. color: var(--calcite-ui-warning);
  296. }
  297. :host([color=green]) .container {
  298. border-color: var(--calcite-ui-success);
  299. }
  300. :host([color=green]) .container .notice-icon {
  301. color: var(--calcite-ui-success);
  302. }