@vev/silke 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/chunk-4MB64AQL.js +22 -0
  3. package/dist/chunk-4MB64AQL.js.LEGAL.txt +8 -0
  4. package/dist/chunk-4MB64AQL.js.map +7 -0
  5. package/dist/index.js +9 -25
  6. package/dist/index.js.LEGAL.txt +6 -9
  7. package/dist/index.js.map +4 -4
  8. package/dist/silke-code-editor-HZRG3D6C.js +23 -0
  9. package/dist/silke-code-editor-HZRG3D6C.js.map +7 -0
  10. package/dist/styles.css +4338 -2599
  11. package/esbuild.config.mjs +2 -1
  12. package/jest.config.js +2 -1
  13. package/package.json +12 -8
  14. package/src/_variables.scss +121 -1
  15. package/src/components/index.ts +6 -0
  16. package/src/components/silke-autocomplete-field/autocomplete-item.tsx +15 -13
  17. package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +14 -7
  18. package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +31 -4
  19. package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +8 -6
  20. package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +64 -23
  21. package/src/components/silke-box/silke-box.scss +21 -47
  22. package/src/components/silke-box/silke-box.tsx +23 -31
  23. package/src/components/silke-breadcrumbs/silke-breadcrumb.scss +3 -3
  24. package/src/components/silke-button/index.ts +3 -1
  25. package/src/components/silke-button/silke-big-button.scss +38 -0
  26. package/src/components/silke-button/silke-big-button.tsx +49 -0
  27. package/src/components/silke-button/silke-button-set.tsx +15 -3
  28. package/src/components/silke-button/silke-button.mdx +41 -19
  29. package/src/components/silke-button/silke-button.scss +97 -90
  30. package/src/components/silke-button/silke-button.tsx +20 -5
  31. package/src/components/silke-button/silke-file-select-button.tsx +86 -0
  32. package/src/components/silke-card/silke-card-grid.tsx +9 -9
  33. package/src/components/silke-card/silke-card.mdx +23 -9
  34. package/src/components/silke-card/silke-card.scss +92 -39
  35. package/src/components/silke-card/silke-card.tsx +50 -27
  36. package/src/components/silke-checkbox/silke-checkbox.scss +39 -17
  37. package/src/components/silke-checkbox/silke-checkbox.tsx +4 -1
  38. package/src/components/silke-code-editor/index.tsx +12 -0
  39. package/src/components/silke-code-editor/silke-code-editor.mdx +97 -0
  40. package/src/components/silke-code-editor/silke-code-editor.tsx +52 -0
  41. package/src/components/silke-code-snippet/silke-code-snippet.scss +2 -10
  42. package/src/components/silke-code-snippet/silke-code-snippet.tsx +10 -3
  43. package/src/components/silke-color-palettes/silke-color-palette.tsx +11 -2
  44. package/src/components/silke-color-picker/color-picker.scss +10 -6
  45. package/src/components/silke-color-picker/silke-color-info.tsx +14 -4
  46. package/src/components/silke-color-picker/silke-color-picker-button.tsx +4 -3
  47. package/src/components/silke-color-picker/silke-color-picker.tsx +4 -2
  48. package/src/components/silke-color-picker/silke-opacity-slider.tsx +11 -12
  49. package/src/components/silke-color-swatches/silke-color-swatch-button.tsx +10 -4
  50. package/src/components/silke-color-swatches/silke-swatches.tsx +2 -2
  51. package/src/components/silke-content-column/index.ts +1 -0
  52. package/src/components/silke-content-column/silke-content-column.mdx +7 -0
  53. package/src/components/silke-content-column/silke-content-column.scss +39 -0
  54. package/src/components/silke-content-column/silke-content-column.tsx +14 -0
  55. package/src/components/silke-context-menu/silke-context-menu-item.tsx +9 -4
  56. package/src/components/silke-context-menu/silke-context-menu.mdx +16 -12
  57. package/src/components/silke-context-menu/silke-context-menu.scss +16 -0
  58. package/src/components/silke-context-menu/silke-context-menu.tsx +62 -39
  59. package/src/components/silke-css-number-field/silke-css-context.tsx +1 -0
  60. package/src/components/silke-css-number-field/silke-css-number-field.scss +18 -3
  61. package/src/components/silke-css-number-field/silke-css-number-field.tsx +32 -13
  62. package/src/components/silke-css-number-field/utils.ts +2 -0
  63. package/src/components/silke-divider/silke-divider.scss +4 -2
  64. package/src/components/silke-drawer/silke-drawer.scss +3 -3
  65. package/src/components/silke-drawer/silke-drawer.tsx +3 -3
  66. package/src/components/silke-form/silke-form.tsx +1 -9
  67. package/src/components/silke-form-schema/fields/array-field-inline.tsx +2 -3
  68. package/src/components/silke-form-schema/fields/array-field-modal.tsx +1 -1
  69. package/src/components/silke-form-schema/fields/array-field.tsx +2 -2
  70. package/src/components/silke-form-schema/fields/event-field.tsx +120 -0
  71. package/src/components/silke-form-schema/fields/icon-field.tsx +1 -1
  72. package/src/components/silke-form-schema/fields/image-field.tsx +1 -1
  73. package/src/components/silke-form-schema/fields/link-field.tsx +8 -1
  74. package/src/components/silke-form-schema/fields/number-field.tsx +24 -8
  75. package/src/components/silke-form-schema/fields/object-field.tsx +1 -1
  76. package/src/components/silke-form-schema/fields/select-field.tsx +9 -2
  77. package/src/components/silke-form-schema/fields/styles.scss +2 -2
  78. package/src/components/silke-form-schema/fields/toggle-field.tsx +14 -13
  79. package/src/components/silke-form-schema/fields/upload-field.tsx +37 -0
  80. package/src/components/silke-form-schema/fields/utils/generate-image.ts +3 -4
  81. package/src/components/silke-form-schema/fields/utils/generate-title.ts +1 -3
  82. package/src/components/silke-form-schema/index.ts +1 -0
  83. package/src/components/silke-form-schema/silke-extended-fields-context.tsx +22 -0
  84. package/src/components/silke-form-schema/silke-schema-field.tsx +19 -6
  85. package/src/components/silke-icon/silke-icon.scss +3 -2
  86. package/src/components/silke-icon/silke-icon.tsx +7 -3
  87. package/src/components/silke-icon/silke-shape.tsx +3 -2
  88. package/src/components/silke-icon-picker/emoji-tab.tsx +2 -2
  89. package/src/components/silke-icon-picker/icons-tab.tsx +1 -1
  90. package/src/components/silke-icon-picker/silke-icon-picker.tsx +1 -1
  91. package/src/components/silke-iframe-portal/index.ts +4 -0
  92. package/src/components/silke-iframe-portal/silke-iframe-context.ts +6 -0
  93. package/src/components/silke-iframe-portal/silke-iframe-css-link.tsx +20 -0
  94. package/src/components/silke-iframe-portal/silke-iframe-portal.mdx +34 -0
  95. package/src/components/silke-iframe-portal/silke-iframe-portal.tsx +77 -0
  96. package/src/components/silke-iframe-portal/silke-iframe-script.tsx +20 -0
  97. package/src/components/silke-link/silke-link.scss +2 -2
  98. package/src/components/silke-link/silke-link.tsx +8 -9
  99. package/src/components/silke-list/silke-list.scss +1 -1
  100. package/src/components/silke-list-card/index.ts +1 -0
  101. package/src/components/silke-list-card/silke-list-card.mdx +50 -0
  102. package/src/components/silke-list-card/silke-list-card.scss +57 -0
  103. package/src/components/silke-list-card/silke-list-card.tsx +65 -0
  104. package/src/components/silke-loader/index.ts +1 -0
  105. package/src/components/silke-loader/silke-loader-overlay.tsx +63 -0
  106. package/src/components/silke-loader/silke-loader.scss +112 -0
  107. package/src/components/silke-loader/silke-loader.tsx +1 -0
  108. package/src/components/silke-modal/silke-confirmation-modal.tsx +1 -1
  109. package/src/components/silke-modal/silke-modal.mdx +1 -1
  110. package/src/components/silke-modal/silke-modal.scss +16 -10
  111. package/src/components/silke-modal/silke-modal.tsx +65 -47
  112. package/src/components/silke-navigation-link/silke-navigation-link.scss +69 -41
  113. package/src/components/silke-navigation-link/silke-navigation-link.tsx +26 -14
  114. package/src/components/silke-notification/confetti.tsx +164 -0
  115. package/src/components/silke-notification/silke-notification.mdx +137 -20
  116. package/src/components/silke-notification/silke-notification.scss +116 -89
  117. package/src/components/silke-notification/silke-notification.tsx +44 -113
  118. package/src/components/silke-object-field/silke-object-field.tsx +1 -1
  119. package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +2 -2
  120. package/src/components/silke-overflow-menu/silke-overflow-menu.scss +12 -4
  121. package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +53 -30
  122. package/src/components/silke-popover/silke-popover.mdx +2 -2
  123. package/src/components/silke-popover/silke-popover.tsx +23 -5
  124. package/src/components/silke-progress-indicator/silke-progress-indicator.scss +5 -5
  125. package/src/components/silke-radio-button/silke-radio-button-group.tsx +1 -1
  126. package/src/components/silke-radio-button/silke-radio-button.scss +24 -9
  127. package/src/components/silke-search-field/silke-search-field.tsx +10 -5
  128. package/src/components/silke-select-field/silke-select-field.mdx +11 -5
  129. package/src/components/silke-skeleton/silke-skeleton.scss +2 -2
  130. package/src/components/silke-slider/range-slider.scss +13 -10
  131. package/src/components/silke-slider/silke-slider.tsx +5 -0
  132. package/src/components/silke-sortable-list/silke-nested-sortable-item.tsx +105 -0
  133. package/src/components/silke-sortable-list/silke-nested-sortable-list.scss +37 -25
  134. package/src/components/silke-sortable-list/silke-nested-sortable-list.tsx +180 -127
  135. package/src/components/silke-sortable-list/silke-nested-sortable-utils.ts +53 -23
  136. package/src/components/silke-sortable-list/silke-sortable-item-wrapper.tsx +1 -1
  137. package/src/components/silke-sortable-list/silke-sortable-list.mdx +12 -16
  138. package/src/components/silke-sortable-list/silke-sortable-list.scss +39 -29
  139. package/src/components/silke-sortable-list/silke-sortable-list.tsx +27 -15
  140. package/src/components/silke-steps/index.ts +1 -0
  141. package/src/components/silke-steps/silke-steps.mdx +60 -0
  142. package/src/components/silke-steps/silke-steps.scss +14 -0
  143. package/src/components/silke-steps/silke-steps.tsx +53 -0
  144. package/src/components/silke-table/silke-table.mdx +44 -13
  145. package/src/components/silke-table/silke-table.scss +19 -9
  146. package/src/components/silke-table/silke-table.tsx +80 -71
  147. package/src/components/silke-table/table-row.tsx +11 -6
  148. package/src/components/silke-tabs/silke-tab.tsx +4 -0
  149. package/src/components/silke-tabs/silke-tabs.scss +18 -15
  150. package/src/components/silke-tabs/silke-tabs.tsx +4 -7
  151. package/src/components/silke-tag/silke-tag.mdx +36 -2
  152. package/src/components/silke-tag/silke-tag.scss +49 -30
  153. package/src/components/silke-tag/silke-tag.tsx +21 -6
  154. package/src/components/silke-text/silke-text-types.ts +2 -1
  155. package/src/components/silke-text/silke-text.mdx +28 -20
  156. package/src/components/silke-text/silke-text.scss +8 -7
  157. package/src/components/silke-text/silke-title.scss +1 -1
  158. package/src/components/silke-text-field/silke-text-field-outline.tsx +4 -4
  159. package/src/components/silke-text-field/silke-text-field.mdx +32 -14
  160. package/src/components/silke-text-field/silke-text-field.scss +41 -23
  161. package/src/components/silke-text-field/silke-text-field.tsx +13 -5
  162. package/src/components/silke-text-field/text-field-context.tsx +1 -1
  163. package/src/components/silke-theme-editor/index.ts +1 -0
  164. package/src/components/silke-theme-editor/silke-theme-editor.tsx +165 -0
  165. package/src/components/silke-tile/silke-tile.scss +13 -18
  166. package/src/components/silke-tile/silke-tile.tsx +11 -17
  167. package/src/components/silke-toggle/silke-toggle.scss +17 -9
  168. package/src/components/silke-toggle/silke-toggle.tsx +1 -1
  169. package/src/components/silke-toolbar/silke-toolbar.scss +1 -1
  170. package/src/components/silke-tooltip/silke-definition-tooltip.tsx +14 -6
  171. package/src/components/silke-tooltip/silke-icon-tooltip.tsx +48 -34
  172. package/src/components/silke-tooltip/silke-interactive-tooltip.tsx +5 -3
  173. package/src/components/silke-tooltip/silke-tooltip.mdx +69 -2
  174. package/src/components/silke-tooltip/silke-tooltip.scss +71 -46
  175. package/src/components/silke-tooltip/silke-tooltip.tsx +142 -52
  176. package/src/components/silke-tooltip/utils.ts +93 -0
  177. package/src/components/silke-upload-field/silke-upload-field.mdx +14 -0
  178. package/src/components/silke-upload-field/silke-upload-field.scss +26 -17
  179. package/src/components/silke-upload-field/silke-upload-field.tsx +37 -14
  180. package/src/docs/app.tsx +118 -25
  181. package/src/docs/components/code-block/code-block.scss +0 -2
  182. package/src/docs/components/code-block/code-block.tsx +17 -9
  183. package/src/hooks/drag-and-drop/use-drag.tsx +5 -1
  184. package/src/hooks/drag-and-drop/use-drop.tsx +5 -4
  185. package/src/icons.tsx +194 -10
  186. package/src/index.mdx +66 -1
  187. package/src/main.tsx +5 -2
  188. package/src/silke-theme-provider.tsx +51 -3
  189. package/src/styles/core.scss +56 -91
  190. package/webpack.docs.ts +1 -3
  191. package/webpack.config.ts +0 -131
@@ -0,0 +1,164 @@
1
+ import { useEffect, useRef } from 'react';
2
+
3
+ const createCanvasConfetti = () => {
4
+ const confetti = document.createElement('canvas');
5
+ confetti.id = 'confetti';
6
+ document.body.appendChild(confetti);
7
+ confetti.style.position = 'fixed';
8
+ confetti.style.left = '0';
9
+ confetti.style.top = '0';
10
+ confetti.style.pointerEvents = 'none';
11
+ return confetti;
12
+ };
13
+
14
+ const useConfetti = (ref: React.RefObject<HTMLBaseElement>) => {
15
+ const requestRef = useRef<any>();
16
+
17
+ useEffect(() => {
18
+ let confetti = document.getElementById('confetti') as HTMLCanvasElement;
19
+ if (!ref) return;
20
+
21
+ const x = ref?.current?.getBoundingClientRect().left;
22
+ const y = ref?.current?.getBoundingClientRect().top;
23
+
24
+ if (!confetti) {
25
+ confetti = createCanvasConfetti();
26
+ }
27
+
28
+ if (!confetti) return;
29
+ confetti.width = document.body.clientWidth;
30
+ confetti.height = document.body.clientHeight;
31
+ confetti.style.zIndex = '99999';
32
+
33
+ // global variables
34
+ const confettiCtx = confetti.getContext('2d');
35
+ if (!confettiCtx) return;
36
+
37
+ const confettiElements: any[] = [];
38
+
39
+ const container = {
40
+ w: confetti.clientWidth,
41
+ h: confetti.clientHeight,
42
+ x: undefined,
43
+ y: undefined,
44
+ };
45
+
46
+ // helper
47
+ const rand = (min: number, max: number) => Math.random() * (max - min) + min;
48
+
49
+ const confettiParams = {
50
+ // number of confetti per "explosion"
51
+ number: 200,
52
+ // min and max size for each rectangle
53
+ size: { x: [5, 20], y: [10, 18] },
54
+ // power of explosion
55
+ initSpeed: 15,
56
+ // defines how fast particles go down after blast-off
57
+ gravity: 0.15,
58
+ // how wide is explosion
59
+ drag: 0.04,
60
+ // how slow particles are falling
61
+ terminalVelocity: 6,
62
+ // how fast particles are rotating around themselves
63
+ flipSpeed: 0.017,
64
+ };
65
+ const colors = [
66
+ { front: '#14CC9E', back: '#0E8C6D' },
67
+ { front: '#F2C53D', back: '#73500B' },
68
+ { front: '#E065C2', back: '#591B3F' },
69
+ { front: '#A63275', back: '#591B3F' },
70
+ { front: '#664E8B', back: '#3d2f53' },
71
+ { front: '#4CA6FF', back: '#200336622f48' },
72
+ { front: '#0E8C6D', back: '#045944' },
73
+ ];
74
+
75
+ function Conf(this: any) {
76
+ this.randomModifier = rand(-1, 1);
77
+ this.colorPair = colors[Math.floor(rand(0, colors.length))];
78
+ this.dimensions = {
79
+ x: rand(confettiParams.size.x[0], confettiParams.size.x[1]),
80
+ y: rand(confettiParams.size.y[0], confettiParams.size.y[1]),
81
+ };
82
+ this.position = {
83
+ x,
84
+ y,
85
+ };
86
+ this.rotation = rand(0, 2 * Math.PI);
87
+ this.scale = { x: 1, y: 1 };
88
+ this.velocity = {
89
+ x: rand(-confettiParams.initSpeed, confettiParams.initSpeed) * 1,
90
+ y: rand(-confettiParams.initSpeed, confettiParams.initSpeed),
91
+ };
92
+ this.flipSpeed = rand(0.2, 1.5) * confettiParams.flipSpeed;
93
+
94
+ if (this.position.y <= container.h) {
95
+ this.velocity.y = -Math.abs(this.velocity.y);
96
+ }
97
+
98
+ this.terminalVelocity = rand(1, 1.5) * confettiParams.terminalVelocity;
99
+
100
+ this.update = function () {
101
+ this.velocity.x *= 0.98;
102
+ this.position.x += this.velocity.x;
103
+
104
+ this.velocity.y += this.randomModifier * confettiParams.drag;
105
+ this.velocity.y += confettiParams.gravity;
106
+ this.velocity.y = Math.min(this.velocity.y, this.terminalVelocity);
107
+ this.position.y += this.velocity.y;
108
+
109
+ this.scale.y = Math.cos((this.position.y + this.randomModifier) * this.flipSpeed);
110
+ this.color = this.scale.y > 0 ? this.colorPair.front : this.colorPair.back;
111
+ };
112
+ }
113
+
114
+ function updateConfetti() {
115
+ if (!confettiCtx) return;
116
+ confettiCtx.clearRect(0, 0, container.w, container.h);
117
+
118
+ confettiElements.forEach((c) => {
119
+ c.update();
120
+ confettiCtx.translate(c.position.x, c.position.y);
121
+ confettiCtx.rotate(c.rotation);
122
+ const width = c.dimensions.x * c.scale.x;
123
+ const height = c.dimensions.y * c.scale.y;
124
+ confettiCtx.fillStyle = c.color;
125
+ confettiCtx.fillRect(-0.5 * width, -0.5 * height, width, height);
126
+ confettiCtx.setTransform(1, 0, 0, 1, 0, 0);
127
+ });
128
+
129
+ confettiElements.forEach((c, idx) => {
130
+ if (
131
+ c.position.y > container.h ||
132
+ c.position.x < -0.5 * (container as any).x ||
133
+ c.position.x > 1.5 * (container as any).x
134
+ ) {
135
+ confettiElements.splice(idx, 1);
136
+ }
137
+ });
138
+
139
+ requestRef.current = window.requestAnimationFrame(updateConfetti);
140
+ }
141
+
142
+ function addConfetti() {
143
+ for (let i = 0; i < confettiParams.number; i++) {
144
+ confettiElements.push(new (Conf as any)());
145
+ }
146
+ }
147
+
148
+ setTimeout(() => {
149
+ addConfetti();
150
+ updateConfetti();
151
+ }, 400);
152
+
153
+ return () => {
154
+ cancelAnimationFrame(requestRef.current);
155
+ try {
156
+ confetti && document.body.removeChild(confetti);
157
+ } catch (e) {
158
+ console.log(e);
159
+ }
160
+ };
161
+ }, [ref]);
162
+ };
163
+
164
+ export default useConfetti;
@@ -2,37 +2,94 @@
2
2
 
3
3
  ## Line notification
4
4
 
5
+ ## Types
6
+
7
+ ```js
8
+ const title = "Warning";
9
+ const subtitle = "Some subitle text here";
10
+
11
+ const types = ["information", "success", "warning", "error"];
12
+
13
+ <SilkeBox gap>
14
+ <SilkeBox column gap>
15
+ {types.map((type, i) => (
16
+ <SilkeNotification
17
+ key={i}
18
+ inline
19
+ kind={type}
20
+ subtitle="Subtitle text here"
21
+ onRemove={() => {}}
22
+ dark
23
+ />
24
+ ))}
25
+ </SilkeBox>
26
+ <SilkeBox column gap>
27
+ {types.map((type, i) => (
28
+ <SilkeNotification
29
+ key={i}
30
+ inline
31
+ kind={type}
32
+ subtitle="Subtitle text here"
33
+ onRemove={() => {}}
34
+ />
35
+ ))}
36
+ </SilkeBox>
37
+ </SilkeBox>;
38
+ ```
39
+
5
40
  ## Testing
6
41
 
7
42
  ```js
8
43
  const [notifications, setNotifications] = React.useState([]);
44
+ const [type, setType] = React.useState("information");
9
45
 
10
46
  const addNotification = () => {
11
- setNotifications(notifications.concat([{ id: notifications.length + 1 }]));
47
+ setNotifications(
48
+ notifications.concat([{ id: notifications.length + 1, kind: type }])
49
+ );
12
50
  };
13
51
 
14
52
  <>
15
53
  <SilkeBox column gap>
16
- <SilkeBox>
54
+ <SilkeNotification
55
+ inline
56
+ subtitle="Subtitle text here. Subtitle text here. Subtitle text here. Subtitle text here. Subtitle text here. Subtitle text here. Subtitle text here"
57
+ onRemove={() => {}}
58
+ />
59
+
60
+ <SilkeBox gap="m">
17
61
  <SilkeButton
18
62
  label="Generate notification"
19
63
  onClick={() => {
20
64
  addNotification();
21
65
  }}
22
66
  />
67
+ <SilkeSelectField
68
+ onChange={setType}
69
+ value={type}
70
+ items={[
71
+ { value: "information" },
72
+ { value: "success" },
73
+ { value: "attention" },
74
+ { value: "error" },
75
+ { value: "warning" },
76
+ { value: "confetti" },
77
+ ]}
78
+ />
23
79
  </SilkeBox>
24
80
  {notifications.map((item) => (
25
81
  <SilkeNotification
26
82
  key={item.id}
27
- kind="warning"
83
+ kind={item.kind || "information"}
28
84
  title="Warning title"
29
85
  subtitle="Some random subtitle"
30
86
  onRemove={() => {
31
- setNotifications(notifications.filter((n) => {
32
- return n.id !== item.id;
33
- }))
87
+ setNotifications(
88
+ notifications.filter((n) => {
89
+ return n.id !== item.id;
90
+ })
91
+ );
34
92
  }}
35
- timestamp
36
93
  />
37
94
  ))}
38
95
  </SilkeBox>
@@ -80,10 +137,28 @@ const subtitle = 'Some subitle text here'
80
137
  <>
81
138
  <SilkeBox column gap>
82
139
  <SilkeNotification kind="success" subtitle="Subtitle text here" />
83
- <SilkeNotification kind="error" subtitle="Subtitle text here" onRemove={() => {}} />
84
- <SilkeNotification kind="success" subtitle="Subtitle text here" onRemove={() => {}} />
85
- <SilkeNotification kind="information" subtitle="Subtitle text here" onRemove={() => {}} />
86
- <SilkeNotification kind="error" subtitle="Subtitle text here" actionLabel="Fix now" onAction={() => {}} onRemove={() => {}} />
140
+ <SilkeNotification
141
+ kind="error"
142
+ subtitle="Subtitle text here"
143
+ onRemove={() => {}}
144
+ />
145
+ <SilkeNotification
146
+ kind="success"
147
+ subtitle="Subtitle text here"
148
+ onRemove={() => {}}
149
+ />
150
+ <SilkeNotification
151
+ kind="information"
152
+ subtitle="Subtitle text here"
153
+ onRemove={() => {}}
154
+ />
155
+ <SilkeNotification
156
+ kind="error"
157
+ subtitle="Subtitle text here"
158
+ actionLabel="Fix now"
159
+ onAction={() => {}}
160
+ onRemove={() => {}}
161
+ />
87
162
  </SilkeBox>
88
163
  </>
89
164
  ```
@@ -93,10 +168,30 @@ const subtitle = 'Some subitle text here'
93
168
  ```js
94
169
  <>
95
170
  <SilkeBox column gap>
96
- <SilkeNotification kind="success" title="With action" actionLabel="Take action" onAction={() => {}} />
97
- <SilkeNotification kind="error" title="With action" actionLabel="Take action" onAction={() => {}} />
98
- <SilkeNotification kind="success" title="With action" actionLabel="Take action" onAction={() => {}} />
99
- <SilkeNotification kind="information" title="With action" actionLabel="Take action" onAction={() => {}} />
171
+ <SilkeNotification
172
+ kind="success"
173
+ title="With action"
174
+ actionLabel="Take action"
175
+ onAction={() => {}}
176
+ />
177
+ <SilkeNotification
178
+ kind="error"
179
+ title="With action"
180
+ actionLabel="Take action"
181
+ onAction={() => {}}
182
+ />
183
+ <SilkeNotification
184
+ kind="success"
185
+ title="With action"
186
+ actionLabel="Take action"
187
+ onAction={() => {}}
188
+ />
189
+ <SilkeNotification
190
+ kind="information"
191
+ title="With action"
192
+ actionLabel="Take action"
193
+ onAction={() => {}}
194
+ />
100
195
  </SilkeBox>
101
196
  </>
102
197
  ```
@@ -106,11 +201,33 @@ const subtitle = 'Some subitle text here'
106
201
  ```js
107
202
  <>
108
203
  <SilkeBox column gap>
109
- <SilkeNotification fluid kind="success" title="Title text here" subtitle="Subtitle text here" />
110
- <SilkeNotification fluid kind="error" title="Title text here" subtitle="Subtitle text here" onRemove={() => {}} />
111
- <SilkeNotification fluid kind="success" title="Title text here" subtitle="Subtitle text here" onRemove={() => {}} />
112
- <SilkeNotification fluid kind="information" title="Title text here" subtitle="Subtitle text here" onRemove={() => {}} />
204
+ <SilkeNotification
205
+ fluid
206
+ kind="success"
207
+ title="Title text here"
208
+ subtitle="Subtitle text here"
209
+ />
210
+ <SilkeNotification
211
+ fluid
212
+ kind="error"
213
+ title="Title text here"
214
+ subtitle="Subtitle text here"
215
+ onRemove={() => {}}
216
+ />
217
+ <SilkeNotification
218
+ fluid
219
+ kind="success"
220
+ title="Title text here"
221
+ subtitle="Subtitle text here"
222
+ onRemove={() => {}}
223
+ />
224
+ <SilkeNotification
225
+ fluid
226
+ kind="information"
227
+ title="Title text here"
228
+ subtitle="Subtitle text here"
229
+ onRemove={() => {}}
230
+ />
113
231
  </SilkeBox>
114
232
  </>
115
233
  ```
116
-
@@ -1,125 +1,152 @@
1
- @use '../../variables' as *;
1
+ @use "../../variables" as *;
2
+
2
3
 
3
4
  .notificationBox {
4
- background: var(--color-neutral-high-pure);
5
- color: var(--color-neutral-low-pure);
5
+ --notification-background: var(--color-neutral-100-rgb);
6
+ --notification-background-opacity: var(--opacity-level-medium);
7
+ --notification-color: var(--color-accent-30);
8
+ filter: var(--shadow-level-1);
9
+ background: linear-gradient(
10
+ 0deg,
11
+ rgba(var(--notification-background), var(--notification-background-opacity)),
12
+ rgba(var(--notification-background), var(--notification-background-opacity))
13
+ ),
14
+ white;
15
+ color: var(--color-neutral-0);
6
16
  max-width: 1024px;
7
- border-left: 4px solid var(--color-brand-secondary-spark);
8
- padding-left: 0.5rem;
9
- margin: 5px 0;
10
17
 
11
- button {
12
- background-color: transparent;
13
- border: none;
14
- outline: none;
15
- padding: 0;
16
- margin: 0;
18
+ &:not(.fluid) {
19
+ width: 384px;
20
+ }
21
+ // Double class to override silke button
22
+ .close.close.close {
23
+ --silke-button-background: transparent;
24
+ --silke-button-background-hover: transparent;
25
+ --silke-button-background-pressed: transparent;
26
+
27
+ --silke-button-color: var(--color-neutral-50);
28
+ --silke-button-color-hover: var(--notification-color);
29
+ --silke-button-color-pressed: var(--notification-color);
30
+
31
+ --silke-button-border: none;
32
+ --silke-button-border-hover: none;
33
+ --silke-button-border-pressed: none;
34
+ --silke-button-border-disabled: none;
35
+
17
36
  display: flex;
37
+ justify-content: center;
38
+ }
39
+
40
+ .action.action.action {
41
+ text-align: left;
42
+ font-weight: bold;
18
43
  justify-content: start;
19
- vertical-align: middle;
44
+ align-items: flex-end;
45
+ padding:0;
46
+ line-height: 18px;
47
+ height:18px;
48
+ min-height:18px;
49
+ --silke-button-background: transparent;
50
+ --silke-button-background-hover: transparent;
51
+ --silke-button-background-pressed: transparent;
52
+
53
+ --silke-button-color: var(--notification-color);
54
+ --silke-button-color-hover: var(--notification-color);
55
+ --silke-button-color-pressed: var(--notification-color);
56
+
57
+ --silke-button-border: none;
58
+ --silke-button-border-hover: none;
59
+ --silke-button-border-pressed: none;
60
+ --silke-button-border-disabled: none;
20
61
  }
21
62
  }
22
63
 
23
- .icon {
24
- padding-left: $space-s;
25
- padding-right: $space-s;
64
+ .content {
65
+ line-height: 18px;
66
+ display: flex;
67
+ justify-content: center;
68
+ }
26
69
 
27
- i {
28
- color: #000 !important;
29
- line-height: $space-l;
30
- cursor: pointer;
31
- }
70
+ .icon {
71
+ color: var(--notification-color);
72
+ font-size: 16px;
32
73
  }
33
74
 
34
- .inline {
35
- padding-top: 1rem;
36
- padding-bottom: 1rem;
75
+ .warning {
76
+ --notification-background: var(--color-warning-60-rgb);
77
+ --notification-color: var(--color-warning-20);
37
78
  }
38
79
 
39
- .box {
40
- width: 384px;
80
+ .error {
81
+ --notification-background: var(--color-error-60-rgb);
82
+ --notification-color: var(--color-error-20);
83
+ }
41
84
 
42
- &.fluid {
43
- width: 100%;
44
- }
85
+ .success {
86
+ --notification-background: var(--color-success-60-rgb);
87
+ --notification-color: var(--color-success-10);
88
+ }
45
89
 
46
- .link {
47
- margin-top: 1rem;
48
- padding-left: 0;
49
- }
50
- button {
51
- padding: 0;
52
- }
90
+ .information {
91
+ --notification-background: var(--color-accent-60-rgb);
92
+ --notification-color: var(--color-accent-30);
53
93
  }
54
94
 
55
- .closeButton:focus-visible {
56
- box-shadow: 0 0 0 2px var(--color-neutral-low-pure);
95
+ .confetti {
96
+ --notification-background: var(--color-success-60-rgb);
97
+ --notification-color: var(--color-success-10);
57
98
  }
58
99
 
59
- .icon {
60
- &:hover {
61
- background: var(--color-neutral-high-pure);
62
- }
100
+ .scale {
101
+ opacity: 0;
102
+ animation: scale 250ms 300ms cubic-bezier(.45,.65,.62,.99) forwards;
103
+ transform-origin: center center;
63
104
  }
64
105
 
65
- .link {
66
- cursor: pointer;
67
- padding-right: $space-s;
68
- padding-left: $space-s;
106
+ .dark {
107
+ color: white;
108
+ --notification-background-opacity: 1;
69
109
 
70
- &:focus-visible {
71
- box-shadow: 0 0 0 2px currentColor;
72
- }
110
+ .close.close.close {
111
+ --silke-button-color: var(--color-neutral-100);
73
112
 
74
- span:hover {
75
- text-decoration: underline;
113
+ &:hover {
114
+ color: rgba(var(--color-neutral-100-rgb), .5)
115
+ }
76
116
  }
77
117
  }
78
118
 
79
- .warning {
80
- border-color: #ECB54F;
81
- background: linear-gradient(0deg, rgba(253, 243, 202, 0.35), rgba(253, 243, 202, 0.35)), #FFFFFF;
82
- i {
83
- color: #ECB54F;
84
- font-size: 18px;
85
- }
86
- .link {
87
- color: var(--color-brand-tertiary-dark);
88
- }
119
+ .dark.information {
120
+ --notification-background: var(--color-support-secondary-10-rgb);
121
+ --notification-color: var(--color-support-secondary-40);
89
122
  }
90
123
 
91
- .error {
92
- border-color: #E6332A;
93
- background: linear-gradient(0deg, rgba(244, 223, 232, 0.35), rgba(244, 223, 232, 0.35)), #FFFFFF;
94
- i {
95
- color: #E6332A;
96
- font-size: 18px;
97
- }
98
- .link {
99
- color: var(--color-brand-tertiary-dark);
100
- }
124
+ .dark.success {
125
+ --notification-background: var(--color-success-10-rgb);
126
+ --notification-color: var(--color-success-40);
101
127
  }
102
128
 
103
- .success {
104
- border-color: var(--color-brand-secondary-spark);
105
- background: linear-gradient(0deg, rgba(222, 237, 229, 0.35), rgba(222, 237, 229, 0.35)), #FFFFFF;
106
- i {
107
- color: var(--color-brand-secondary-spark);
108
- font-size: 18px;
109
- }
110
- .link {
111
- color: var(--color-brand-secondary-dark);
112
- }
129
+ .dark.warning {
130
+ --notification-background: var(--color-warning-10-rgb);
131
+ --notification-color: var(--color-warning-40);
113
132
  }
114
133
 
115
- .information {
116
- border-color: #1885F2;
117
- background: linear-gradient(0deg, rgba(221, 238, 255, 0.35), rgba(221, 238, 255, 0.35)), #FFFFFF;
118
- i {
119
- color: #1885F2;
120
- font-size: 18px;
134
+ .dark.error {
135
+ --notification-background: var(--color-error-10-rgb);
136
+ --notification-color: var(--color-error-30);
137
+ }
138
+
139
+ @keyframes scale {
140
+ 0% {
141
+ opacity: 0;
142
+ transform: scale(0);
121
143
  }
122
- .link {
123
- color: #132A40;
144
+ 70% {
145
+ opacity: 1;
146
+ transform: scale(1.1);
124
147
  }
148
+ 100% {
149
+ opacity: 1;
150
+ transform: scale(1);
151
+ }
125
152
  }