notice.css 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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. @media (prefers-reduced-motion: reduce) {
  65. :root {
  66. --calcite-internal-duration-factor: 0.01;
  67. }
  68. }
  69. /**
  70. * Currently only used in Checkbox.
  71. */
  72. :root {
  73. --calcite-floating-ui-transition: var(--calcite-animation-timing);
  74. }
  75. :host([hidden]) {
  76. display: none;
  77. }
  78. /**
  79. * CSS Custom Properties
  80. *
  81. * These properties can be overridden using the component's tag as selector.
  82. *
  83. * @prop --calcite-notice-width: The width of the component.
  84. */
  85. :host([scale=s]) {
  86. --calcite-notice-spacing-token-small: 0.5rem;
  87. --calcite-notice-spacing-token-large: 0.75rem;
  88. }
  89. :host([scale=s]) .container slot[name=title]::slotted(*),
  90. :host([scale=s]) .container *::slotted([slot=title]) {
  91. margin-block: 0.125rem;
  92. font-size: var(--calcite-font-size--1);
  93. line-height: 1.375;
  94. }
  95. :host([scale=s]) .container slot[name=message]::slotted(*),
  96. :host([scale=s]) .container *::slotted([slot=message]) {
  97. margin-block: 0.125rem;
  98. font-size: var(--calcite-font-size--2);
  99. line-height: 1.375;
  100. }
  101. :host([scale=s]) ::slotted(calcite-link) {
  102. margin-block: 0.125rem;
  103. font-size: var(--calcite-font-size--2);
  104. line-height: 1.375;
  105. }
  106. :host([scale=s]) .notice-close {
  107. padding: 0.5rem;
  108. }
  109. :host([scale=m]) {
  110. --calcite-notice-spacing-token-small: 0.75rem;
  111. --calcite-notice-spacing-token-large: 1rem;
  112. }
  113. :host([scale=m]) .container slot[name=title]::slotted(*),
  114. :host([scale=m]) .container *::slotted([slot=title]) {
  115. margin-block: 0.125rem;
  116. font-size: var(--calcite-font-size-0);
  117. line-height: 1.375;
  118. }
  119. :host([scale=m]) .container slot[name=message]::slotted(*),
  120. :host([scale=m]) .container *::slotted([slot=message]) {
  121. margin-block: 0.125rem;
  122. font-size: var(--calcite-font-size--1);
  123. line-height: 1.375;
  124. }
  125. :host([scale=m]) ::slotted(calcite-link) {
  126. margin-block: 0.125rem;
  127. font-size: var(--calcite-font-size--1);
  128. line-height: 1.375;
  129. }
  130. :host([scale=l]) {
  131. --calcite-notice-spacing-token-small: 1rem;
  132. --calcite-notice-spacing-token-large: 1.25rem;
  133. }
  134. :host([scale=l]) .container slot[name=title]::slotted(*),
  135. :host([scale=l]) .container *::slotted([slot=title]) {
  136. margin-block: 0.125rem;
  137. font-size: var(--calcite-font-size-1);
  138. line-height: 1.375;
  139. }
  140. :host([scale=l]) .container slot[name=message]::slotted(*),
  141. :host([scale=l]) .container *::slotted([slot=message]) {
  142. margin-block: 0.125rem;
  143. font-size: var(--calcite-font-size-0);
  144. line-height: 1.375;
  145. }
  146. :host([scale=l]) ::slotted(calcite-link) {
  147. margin-block: 0.125rem;
  148. font-size: var(--calcite-font-size-0);
  149. line-height: 1.375;
  150. }
  151. :host([width=auto]) {
  152. --calcite-notice-width: auto;
  153. }
  154. :host([width=half]) {
  155. --calcite-notice-width: 50%;
  156. }
  157. :host([width=full]) {
  158. --calcite-notice-width: 100%;
  159. }
  160. :host {
  161. margin-inline: auto;
  162. display: none;
  163. max-inline-size: 100%;
  164. align-items: center;
  165. inline-size: var(--calcite-notice-width);
  166. }
  167. .container {
  168. pointer-events: none;
  169. margin-block: 0px;
  170. box-sizing: border-box;
  171. display: none;
  172. inline-size: 100%;
  173. background-color: var(--calcite-ui-foreground-1);
  174. opacity: 0;
  175. transition: all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;
  176. max-block-size: 0;
  177. text-align: start;
  178. border-inline-start: 0px solid;
  179. box-shadow: 0 0 0 0 transparent;
  180. }
  181. .notice-close {
  182. outline-color: transparent;
  183. }
  184. .notice-close:focus {
  185. outline: 2px solid var(--calcite-ui-brand);
  186. outline-offset: -2px;
  187. }
  188. :host {
  189. display: flex;
  190. }
  191. :host([open]) .container {
  192. pointer-events: auto;
  193. display: flex;
  194. max-block-size: 100%;
  195. align-items: center;
  196. border-width: 2px;
  197. opacity: 1;
  198. --tw-shadow: 0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  199. --tw-shadow-colored: 0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);
  200. box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
  201. }
  202. .container slot[name=title]::slotted(*),
  203. .container *::slotted([slot=title]) {
  204. margin: 0px;
  205. font-weight: var(--calcite-font-weight-medium);
  206. color: var(--calcite-ui-text-1);
  207. }
  208. .container slot[name=message]::slotted(*),
  209. .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: all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;
  219. padding-inline: var(--calcite-notice-spacing-token-large);
  220. flex: 0 0 auto;
  221. display: flex;
  222. min-inline-size: 0px;
  223. flex-direction: column;
  224. overflow-wrap: break-word;
  225. flex: 1 1 0;
  226. padding-block: var(--calcite-notice-spacing-token-small);
  227. padding-inline: 0 var(--calcite-notice-spacing-token-small);
  228. }
  229. .notice-content:first-of-type:not(:only-child) {
  230. padding-inline-start: var(--calcite-notice-spacing-token-large);
  231. }
  232. .notice-content:only-of-type {
  233. padding-block: var(--calcite-notice-spacing-token-small);
  234. padding-inline: var(--calcite-notice-spacing-token-large);
  235. }
  236. .notice-icon {
  237. display: flex;
  238. align-items: center;
  239. box-sizing: border-box;
  240. transition: all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;
  241. padding-block: var(--calcite-notice-spacing-token-small);
  242. padding-inline: var(--calcite-notice-spacing-token-large);
  243. flex: 0 0 auto;
  244. }
  245. .notice-close {
  246. display: flex;
  247. cursor: pointer;
  248. align-items: center;
  249. align-self: stretch;
  250. border-style: none;
  251. background-color: transparent;
  252. color: var(--calcite-ui-text-3);
  253. outline: 2px solid transparent;
  254. outline-offset: 2px;
  255. box-sizing: border-box;
  256. transition: all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;
  257. padding-block: var(--calcite-notice-spacing-token-small);
  258. padding-inline: var(--calcite-notice-spacing-token-large);
  259. flex: 0 0 auto;
  260. -webkit-appearance: none;
  261. }
  262. .notice-close:hover, .notice-close:focus {
  263. background-color: var(--calcite-ui-foreground-2);
  264. color: var(--calcite-ui-text-1);
  265. }
  266. .notice-close:active {
  267. background-color: var(--calcite-ui-foreground-3);
  268. }
  269. .actions-end {
  270. display: flex;
  271. align-self: stretch;
  272. }
  273. :host([color=blue]) .container {
  274. border-color: var(--calcite-ui-brand);
  275. }
  276. :host([color=blue]) .container .notice-icon {
  277. color: var(--calcite-ui-brand);
  278. }
  279. :host([color=red]) .container {
  280. border-color: var(--calcite-ui-danger);
  281. }
  282. :host([color=red]) .container .notice-icon {
  283. color: var(--calcite-ui-danger);
  284. }
  285. :host([color=yellow]) .container {
  286. border-color: var(--calcite-ui-warning);
  287. }
  288. :host([color=yellow]) .container .notice-icon {
  289. color: var(--calcite-ui-warning);
  290. }
  291. :host([color=green]) .container {
  292. border-color: var(--calcite-ui-success);
  293. }
  294. :host([color=green]) .container .notice-icon {
  295. color: var(--calcite-ui-success);
  296. }