@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
@@ -1,22 +1,4 @@
1
1
  @use '../../variables' as *;
2
- $colors: "transparent" transparent,
3
- "background" var(--color-neutral-low-pure),
4
- "layer" var(--color-neutral-low-dark),
5
- "ui-2" var(--color-neutral-low-medium),
6
- "layer-accent" var(--color-neutral-low-medium),
7
- "layer-accent-active" var(--color-neutral-low-soft),
8
- "layer-hover" var(--color-neutral-low-spark),
9
- "ui-4" var(--color-neutral-low-light),
10
- "ui-5" var(--color-neutral-high-spark),
11
- "error" var(--color-feedback-warning-spark),
12
- "highlight" var(--color-brand-secondary-spark),
13
- "gray10" var(--color-neutral-high-pure),
14
- "neutral-high-soft" var(--color-neutral-high-soft),
15
- "neutral-low-soft" var(--color-neutral-low-soft),
16
- "neutral-low-medium" var(--color-neutral-low-medium),
17
- "neutral-low-dark" var(--color-neutral-low-dark),
18
- "neutral-low-spark" var(--color-neutral-low-spark),
19
- "neutral-low-dart" var(--color-neutral-low-dark);
20
2
 
21
3
  .box {
22
4
  &.debug,
@@ -33,7 +15,7 @@ $colors: "transparent" transparent,
33
15
  }
34
16
  }
35
17
 
36
- button.box, input.box{
18
+ button, input{
37
19
  border: none;
38
20
  outline: none;
39
21
  border-radius: 0;
@@ -168,39 +150,31 @@ button.box {
168
150
  }
169
151
  }
170
152
 
171
- @each $name, $color in $colors {
172
- .color-#{$name} {
173
- color: $color;
174
- }
175
-
176
- .colorHover-#{$name}:hover {
177
- color: $color;
178
- }
179
-
180
- .bg-#{$name} {
181
- background-color: $color;
182
- }
183
-
184
- .bgHover-#{$name}:hover {
185
- background-color: $color;
186
- }
153
+ .overflow-hidden{
154
+ overflow: hidden;
155
+ }
156
+ .overflow-scroll-y{
157
+ overflow-y: scroll;
187
158
  }
188
159
 
189
- .aspect169 {
190
- padding-top: 56.25%;
160
+ .rounded-tiny {
161
+ border-radius: var(--border-radius-tiny);
191
162
  }
192
- .aspect43 {
193
- padding-top: 75%;
163
+
164
+ .rounded-small {
165
+ border-radius: var(--border-radius-small);
194
166
  }
195
167
 
196
- .aspect11 {
197
- padding-top: 100%;
168
+ .rounded-medium {
169
+ border-radius: var(--border-radius-medium);
198
170
  }
199
171
 
200
- .aspectBox {
201
- position: absolute;
202
- top: 0;
203
- left: 0;
204
- bottom: 0;
205
- right: 0;
172
+ .rounded-full {
173
+ border-radius: 50%;
206
174
  }
175
+
176
+ @for $i from 1 through 4 {
177
+ .shadow-level#{$i} {
178
+ filter: var(--shadow-level-#{$i});
179
+ }
180
+ }
@@ -8,30 +8,11 @@ import React, {
8
8
  LabelHTMLAttributes,
9
9
  } from 'react';
10
10
  import { Link, LinkProps as RouterLinkProps } from 'react-router-dom';
11
+ import { SilkeColor } from '../../silke-theme-provider';
11
12
  import styles from './silke-box.scss';
12
13
 
13
14
  export type BoxSpace = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl' | 'none' | boolean;
14
15
  export type BoxSize = 'xs' | 's' | 'base' | 'm' | 'l' | 'xl' | 'xxl';
15
- export type BoxColor =
16
- | 'transparent'
17
- | 'background'
18
- | 'layer'
19
- | 'ui-2'
20
- | 'layer-accent'
21
- | 'layer-accent-active'
22
- | 'layer-hover'
23
- | 'ui-4'
24
- | 'ui-5'
25
- | 'error'
26
- | 'gray10'
27
- | 'highlight'
28
- | 'neutral-low-soft'
29
- | 'neutral-low-medium'
30
- | 'neutral-low-dark'
31
- | 'neutral-low-pure'
32
- | 'neutral-low-spark'
33
- | 'neutral-high-soft'
34
- | 'neutral-low-dark';
35
16
 
36
17
  export type BoxAlign = 'center' | 'start' | 'end' | 'spread' | 'space' | boolean;
37
18
 
@@ -73,13 +54,20 @@ type BaseProps = {
73
54
  /** Width of the box (x2 of the spaceing, example: 'm' = 32px wide) */
74
55
  width?: BoxSize;
75
56
  /** Background color */
76
- bg?: BoxColor;
57
+ bg?: SilkeColor;
77
58
  /** Background color on hover */
78
- bgHover?: BoxColor;
59
+ bgHover?: SilkeColor;
79
60
  /** Text color */
80
- color?: BoxColor;
61
+ color?: SilkeColor;
62
+ /** Border radius */
63
+ rounded?: boolean | 'tiny' | 'small' | 'medium' | 'full';
64
+
65
+ shadow?: 'level1' | 'level2' | 'level3' | 'level4';
66
+
67
+ overflow?: 'hidden' | 'scroll-y';
68
+
81
69
  /** Text color on hover */
82
- colorHover?: BoxColor;
70
+ colorHover?: SilkeColor;
83
71
  aspectRatio?: '16:9' | '4:3' | '1:1';
84
72
  /** Flex item */
85
73
  flex?: boolean;
@@ -214,6 +202,9 @@ function BoxComp(
214
202
  className,
215
203
  debug,
216
204
  scroll,
205
+ rounded,
206
+ shadow,
207
+ overflow,
217
208
  ...rest
218
209
  }: BoxProps,
219
210
  ref: any,
@@ -224,11 +215,12 @@ function BoxComp(
224
215
  if (column) cl.push(styles.column);
225
216
  if (flex) cl.push(styles.flex);
226
217
  if (fill) cl.push(styles.fill);
218
+ if (overflow) cl.push(styles['overflow-' + overflow]);
227
219
  if (wrap) cl.push(styles.wrap);
220
+ if (shadow) cl.push(styles['shadow-' + shadow]);
221
+ if (rounded) cl.push(styles[`rounded-${rounded === true ? 'small' : rounded}`]);
228
222
  if (aspectRatio) {
229
- // Moving children into absolute pos box
230
- children = <div className={styles.aspectBox}>{children}</div>;
231
- cl.push(styles['aspect' + aspectRatio.replace(':', '')]);
223
+ rest.style = { ...rest.style, aspectRatio: aspectRatio.replace(':', '/') };
232
224
  }
233
225
 
234
226
  if (pad) {
@@ -244,10 +236,10 @@ function BoxComp(
244
236
  if (width) cl.push(styles['width-' + width]);
245
237
  if (height) cl.push(styles['height-' + height]);
246
238
 
247
- if (color) cl.push(styles['color-' + color]);
248
- if (colorHover) cl.push(styles['colorHover-' + colorHover]);
249
- if (bg) cl.push(styles['bg-' + bg]);
250
- if (bgHover) cl.push(styles['bgHover-' + bgHover]);
239
+ if (color) cl.push('color-' + color);
240
+ if (colorHover) cl.push('color-hover-' + colorHover);
241
+ if (bg) cl.push('bg-' + bg);
242
+ if (bgHover) cl.push('bg-hover-' + bgHover);
251
243
 
252
244
  if (isArray(align)) {
253
245
  [hAlign, vAlign] = align;
@@ -7,16 +7,16 @@
7
7
  user-select: none;
8
8
 
9
9
  a {
10
- color: var(--color-brand-secondary-bright) !important;
10
+ color: var(--color-accent-50) !important;
11
11
  }
12
12
 
13
13
  a:focus {
14
14
  outline: none;
15
- box-shadow: 0 0 0 2px var(--color-neutral-high-pure);
15
+ box-shadow: 0 0 0 2px var(--color-neutral-100);
16
16
  }
17
17
 
18
18
  a:hover {
19
19
  text-decoration: underline;
20
- color: var(--color-brand-quaternary-soft) !important;
20
+ color: var(--color-accent-50) !important;
21
21
  }
22
22
  }
@@ -1,5 +1,7 @@
1
+ export { default as ButtonContext } from './context';
2
+ export * from './silke-big-button';
1
3
  export { SilkeButton } from './silke-button';
2
4
  export type { SilkeButtonKind, SilkeButtonProps, SilkeButtonSize } from './silke-button';
3
5
  export * from './silke-button-set';
4
6
  export * from './silke-confirmation-button';
5
- export { default as ButtonContext } from './context';
7
+ export * from './silke-file-select-button';
@@ -0,0 +1,38 @@
1
+ body {
2
+ }
3
+
4
+
5
+
6
+ .root {
7
+ --button-background: var(--color-neutral-5);
8
+ --button-background-hover: rgba(var(--color-neutral-5-rgb), 0.8);
9
+ --button-background-pressed: rgba(var(--color-neutral-5-rgb), 0.64);
10
+ --button-icon-background: var(--color-neutral-30);
11
+ --button-sub-label-color: var(--color-neutral-80);
12
+ text-align: left;
13
+ border-radius: var(--border-radius-medium) !important;
14
+ background: var(--button-background);
15
+ &:hover {
16
+ background: var(--button-background-hover);
17
+ }
18
+
19
+ &:active {
20
+ background: var(--button-background-pressed);
21
+ }
22
+
23
+ &.accent {
24
+ --button-background: rgba(var(--color-accent-30-rgb), 0.32);
25
+ --button-background-hover: rgba(var(--color-accent-30-rgb), 0.24);
26
+ --button-background-pressed: rgba(var(--color-accent-30-rgb), 0.16);
27
+ --button-icon-background: var(--color-accent-20);
28
+ --button-sub-label-color: var(--color-accent-60);
29
+ }
30
+
31
+ small{
32
+ color: var(--button-sub-label-color);
33
+ }
34
+ }
35
+
36
+ .leftIcon {
37
+ background-color: var(--button-icon-background);
38
+ }
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { BoxButtonProps, SilkeBox } from '../silke-box';
3
+ import { SilkeIcon, SilkeIcons } from '../silke-icon';
4
+ import { SilkeText, SilkeTextSmall, SilkeTitle } from '../silke-text';
5
+ import styles from './silke-big-button.scss';
6
+
7
+ type SilkeBigButtonProps = {
8
+ kind?: 'accent' | 'default';
9
+ label: string;
10
+ subLabel?: string;
11
+ leftIcon?: SilkeIcons | React.ReactElement;
12
+ rightIcon?: SilkeIcons | React.ReactElement;
13
+ children?: React.ReactNode;
14
+ } & BoxButtonProps;
15
+
16
+ export function SilkeBigButton({
17
+ kind,
18
+ label,
19
+ subLabel,
20
+ leftIcon,
21
+ rightIcon,
22
+ children,
23
+ className,
24
+ ...rest
25
+ }: SilkeBigButtonProps) {
26
+ let cl = styles.root;
27
+ if (className) cl += ' ' + className;
28
+ if (kind === 'accent') cl += ' ' + styles.accent;
29
+
30
+ return (
31
+ <SilkeBox pad="l" gap="m" vAlign="center" {...rest} tag="button" className={cl}>
32
+ {leftIcon && (
33
+ <SilkeBox size="m" className={styles.leftIcon} rounded align="center">
34
+ <SilkeIcon icon={leftIcon} />
35
+ </SilkeBox>
36
+ )}
37
+ <SilkeBox column flex gap="xs">
38
+ <SilkeTitle kind="xs">{label}</SilkeTitle>
39
+ <SilkeTextSmall tag="small">{subLabel}</SilkeTextSmall>
40
+ </SilkeBox>
41
+ {children}
42
+ {rightIcon && (
43
+ <SilkeBox size="m" align="center">
44
+ <SilkeIcon icon={rightIcon} />
45
+ </SilkeBox>
46
+ )}
47
+ </SilkeBox>
48
+ );
49
+ }
@@ -12,13 +12,25 @@ export type SilkeButtonSetProps = {
12
12
  children: React.ReactNode;
13
13
  } & Omit<BoxDivProps, 'size'>;
14
14
 
15
- export function SilkeButtonSet({ children, kind, size, className, ...rest }: SilkeButtonSetProps) {
15
+ export function SilkeButtonSet({
16
+ children,
17
+ kind,
18
+ size,
19
+ className,
20
+ gap,
21
+ ...rest
22
+ }: SilkeButtonSetProps) {
16
23
  const context = useButtonContext();
17
24
  return (
18
- <ButtonContext {...context} kind={kind || context.kind} size={size || context.size}>
25
+ <ButtonContext
26
+ {...context}
27
+ gap={gap || 's'}
28
+ kind={kind || context.kind}
29
+ size={size || context.size}
30
+ >
19
31
  <SilkeBox
20
32
  className={[styles.group, className].filter(Boolean).join(' ')}
21
- gap={context.gap}
33
+ gap={gap || context.gap || 'm'}
22
34
  {...rest}
23
35
  >
24
36
  {children}
@@ -16,7 +16,8 @@ Buttons are clickable elements that are used to trigger actions. They communicat
16
16
 
17
17
  ```js
18
18
  <SilkeBox gap column>
19
- <SilkeBox wrap gap align="center">
19
+ <SilkeTitle kind="xs">Standard buttons</SilkeTitle>
20
+ <SilkeBox wrap gap="s">
20
21
  <SilkeButton label="Primary" />
21
22
  <SilkeButton label="Secondary" kind="secondary" />
22
23
  <SilkeButton label="Danger" kind="danger" />
@@ -24,24 +25,43 @@ Buttons are clickable elements that are used to trigger actions. They communicat
24
25
  <SilkeButton label="Ghost" kind="ghost" />
25
26
  </SilkeBox>
26
27
 
27
- <SilkeBox wrap gap align="center">
28
+ <SilkeTitle kind="xs">Icon only</SilkeTitle>
29
+ <SilkeBox wrap gap="s">
28
30
  <SilkeButton icon="add" />
29
31
  <SilkeButton icon="add" kind="secondary" />
30
32
  <SilkeButton icon="add" kind="danger" />
31
33
  <SilkeButton icon="add" kind="tertiary" />
32
34
  <SilkeButton icon="add" kind="ghost" />
33
35
  </SilkeBox>
36
+
37
+ <SilkeTitle kind="xs">Standard buttons with icon</SilkeTitle>
38
+ <SilkeBox wrap gap="s">
39
+ <SilkeButton icon="add" label="Primary" />
40
+ <SilkeButton icon="add" label="Secondary" kind="secondary" />
41
+ <SilkeButton icon="add" label="Danger" kind="danger" />
42
+ <SilkeButton icon="add" label="Tertiary" kind="tertiary" />
43
+ <SilkeButton icon="add" label="Ghost" kind="ghost" />
44
+ </SilkeBox>
45
+
46
+ <SilkeTitle kind="xs">Disabled</SilkeTitle>
47
+ <SilkeBox wrap gap="s">
48
+ <SilkeButton disabled icon="add" label="Primary" />
49
+ <SilkeButton disabled icon="add" label="Secondary" kind="secondary" />
50
+ <SilkeButton disabled icon="add" label="Danger" kind="danger" />
51
+ <SilkeButton disabled icon="add" label="Tertiary" kind="tertiary" />
52
+ <SilkeButton disabled icon="add" label="Ghost" kind="ghost" />
53
+ </SilkeBox>
34
54
  </SilkeBox>
35
55
  ```
36
56
 
37
57
  ## Button sizes
38
58
 
39
59
  ```js
40
- <SilkeBox hAlign gap fill column>
41
- {[undefined, 'default', 'bleed', 'base', 'xs', 's', 'm', 'l', 'xl', 'xxl'].map((size) => (
60
+ <SilkeBox gap fill column>
61
+ {[undefined, "default", "base", "s", "m", "l"].map((size) => (
42
62
  <SilkeBox wrap gap key={size}>
43
- <SilkeButton label={size + ''} size={size} />
44
- <SilkeButton label={size + ''} icon="add" size={size} />
63
+ <SilkeButton label={size + ""} size={size} />
64
+ <SilkeButton label={size + ""} icon="add" size={size} />
45
65
  <SilkeButton icon="add" size={size} />
46
66
  </SilkeBox>
47
67
  ))}
@@ -52,27 +72,17 @@ Buttons are clickable elements that are used to trigger actions. They communicat
52
72
 
53
73
  ```js
54
74
  <SilkeButtonSet>
55
- <SilkeButton label="Primary" />
56
- <SilkeButton label="Secondary" kind="secondary" />
57
- </SilkeButtonSet>
58
- <hr />
59
- <SilkeButtonSet size="bleed">
60
- <SilkeButton label="Primary" icon="check" />
61
75
  <SilkeButton label="Secondary" kind="secondary" />
62
- </SilkeButtonSet>
63
- <hr />
64
- <SilkeButtonSet size="bleed" kind="ghost">
65
- <SilkeButton label="Primary" icon="check" />
66
- <SilkeButton label="Secondary" />
76
+ <SilkeButton flex label="Primary" />
67
77
  </SilkeButtonSet>
68
78
  ```
69
79
 
70
80
  ## Confirmation Button
71
81
 
72
82
  ```js
73
- const handleConfirm = () => console.log('Confirmed');
83
+ const handleConfirm = () => console.log("Confirmed");
74
84
 
75
- <SilkeButtonSet size="bleed">
85
+ <SilkeButtonSet>
76
86
  <SilkeConfirmationButton
77
87
  label="Default confirmation"
78
88
  message="Confirm this"
@@ -81,6 +91,7 @@ const handleConfirm = () => console.log('Confirmed');
81
91
  />
82
92
  <SilkeConfirmationButton
83
93
  kind="danger"
94
+ flex
84
95
  label="Danger confirmation"
85
96
  confirmLabel="Delete"
86
97
  message="Confirm this"
@@ -89,3 +100,14 @@ const handleConfirm = () => console.log('Confirmed');
89
100
  />
90
101
  </SilkeButtonSet>;
91
102
  ```
103
+
104
+ ## Big button
105
+
106
+ ```js
107
+ <SilkeBigButton kind="accent" leftIcon="figma" label="Big button" subLabel="Sub label" rightIcon="add" />
108
+ <SilkeBigButton leftIcon="figma" label="Big button" subLabel="Sub label" rightIcon="add" />
109
+ <SilkeBigButton leftIcon="figma" label="Big button" subLabel="Sub label" rightIcon="add" />
110
+ <SilkeBigButton leftIcon="figma" label="Big button" subLabel="Sub label">
111
+ Custom content
112
+ </SilkeBigButton>
113
+ ```