@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
@@ -10,11 +10,19 @@ type SilkePaletteProps = {
10
10
  type: keyof IPalettes;
11
11
  value: string;
12
12
  dark?: string;
13
+ disabled?: boolean;
13
14
  onChange?: (type: string, color: string) => void;
14
15
  onRemove?: (key: string) => void;
15
16
  };
16
17
 
17
- export function SilkePalette({ type, value, dark, onChange, onRemove }: SilkePaletteProps) {
18
+ export function SilkePalette({
19
+ type,
20
+ value,
21
+ disabled,
22
+ dark,
23
+ onChange,
24
+ onRemove,
25
+ }: SilkePaletteProps) {
18
26
  const [tmpDark, setTmpDark] = useState<string | undefined>(dark);
19
27
  const [base, setBase] = useState<string | undefined>(value);
20
28
 
@@ -55,11 +63,12 @@ export function SilkePalette({ type, value, dark, onChange, onRemove }: SilkePal
55
63
  index === 3 || index === 6 ? (
56
64
  <SilkeColorPickerButton
57
65
  key={index}
66
+ disabled={disabled}
58
67
  value={color}
59
68
  onChange={(color) => handleChange(index, color)}
60
69
  >
61
70
  <SilkeBox hAlign="end">
62
- <SilkeButton icon="undo" kind="plain" size="s" onClick={() => handleReset(index)} />
71
+ <SilkeButton icon="undo" kind="ghost" size="s" onClick={() => handleReset(index)} />
63
72
  </SilkeBox>
64
73
  </SilkeColorPickerButton>
65
74
  ) : (
@@ -25,9 +25,10 @@
25
25
  .colorBox {
26
26
  position: relative;
27
27
  overflow: hidden;
28
+ border-radius: var(--border-radius-tiny);
28
29
  padding-top: 80%; // Setting almost square aspect ratio
29
30
  cursor: pointer;
30
- background-color: var(--color-neutral-low-pure);
31
+ background-color: var(--color-neutral-0);
31
32
  &.dragging {
32
33
  cursor: grab;
33
34
  }
@@ -36,7 +37,8 @@
36
37
  .opacitySlider,
37
38
  .thumb,
38
39
  .transparent {
39
- background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIElEQVQ4y2P4TwDcv38fL2YYNWBYGEBIASEwasCwMAAAv7rMLvozJBUAAAAASUVORK5CYII=");
40
+ --transparent-bg: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIElEQVQ4y2P4TwDcv38fL2YYNWBYGEBIASEwasCwMAAAv7rMLvozJBUAAAAASUVORK5CYII=");
41
+ background-image: var(--transparent-bg);
40
42
  background-position: 50% 50%;
41
43
  }
42
44
 
@@ -45,8 +47,8 @@
45
47
  transition: width 0.2s, height 0.2s, box-shadow 0.2s;
46
48
  position: absolute;
47
49
  background: transparent;
48
- border: 1px solid rgba(var(--color-neutral-low-pure-rgb), var(--opacity-level-semiopaque));
49
- box-shadow: 0 0 0 1px rgba(var(--color-neutral-high-pure-rgb), var(--opacity-level-semiopaque));
50
+ border: 1px solid rgba(var(--color-neutral-0-rgb), var(--opacity-level-semiopaque));
51
+ box-shadow: 0 0 0 1px rgba(var(--color-neutral-100-rgb), var(--opacity-level-semiopaque));
50
52
  width: 15px;
51
53
  height: 15px;
52
54
  border-radius: 50%;
@@ -55,12 +57,14 @@
55
57
 
56
58
  .hueSlider,
57
59
  .opacitySlider {
60
+ padding:0 !important;
61
+ border-radius: var(--border-radius-tiny);
58
62
  height: 8px;
59
63
  .handle {
60
- background: var(--color-neutral-high-pure);
64
+ background: var(--color-neutral-100);
61
65
  width: 12px;
62
66
  height: 12px;
63
- transform: translate(0, -2px);
67
+ transform: translate(-6px, 2px);
64
68
  }
65
69
  .track {
66
70
  height: 0;
@@ -11,12 +11,13 @@ import { SilkeCssNumberField } from '../silke-css-number-field';
11
11
 
12
12
  type ColorInfoProps = {
13
13
  rgba: RGBA;
14
+ noTransparency?: boolean;
14
15
  onChange: (color: RGBA) => void;
15
16
  };
16
17
 
17
18
  const rgbLabels = ['r', 'g', 'b'] as (keyof RGBA)[];
18
19
 
19
- export function ColorInfo({ rgba, onChange }: ColorInfoProps) {
20
+ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
20
21
  const [format, setFormat] = useState<string>('HEX');
21
22
  const [tmpHex, setTmpHex] = useState<string | null>(null);
22
23
  const [tmpRgb, setTmpRgb] = useState(rgba);
@@ -45,7 +46,7 @@ export function ColorInfo({ rgba, onChange }: ColorInfoProps) {
45
46
  };
46
47
 
47
48
  const handleHex = useCallback(
48
- (hex) => {
49
+ (hex: string) => {
49
50
  setTmpHex(hex);
50
51
  onChange({ ...rgba, ...hexToRgb(hex.replace('#', '')) });
51
52
  },
@@ -64,8 +65,15 @@ export function ColorInfo({ rgba, onChange }: ColorInfoProps) {
64
65
  ]}
65
66
  renderItem={({ item, selected }) => {
66
67
  return (
67
- <SilkeBox hPad="xs" bgHover="highlight" flex vAlign="center" gap="xs" align="center">
68
- <SilkeText size="small" flex color={selected ? 'primary' : 'secondary'}>
68
+ <SilkeBox
69
+ hPad="xs"
70
+ bgHover="brand-secondary-30"
71
+ flex
72
+ vAlign="center"
73
+ gap="xs"
74
+ align="center"
75
+ >
76
+ <SilkeText size="small" flex color={selected ? 'accent-50' : 'neutral-80'}>
69
77
  {item.label}
70
78
  </SilkeText>
71
79
  </SilkeBox>
@@ -100,6 +108,7 @@ export function ColorInfo({ rgba, onChange }: ColorInfoProps) {
100
108
  ))
101
109
  )}
102
110
  </SilkeBox>
111
+
103
112
  <SilkeBox style={{ width: 40 }}>
104
113
  <SilkeCssNumberField
105
114
  min={0}
@@ -108,6 +117,7 @@ export function ColorInfo({ rgba, onChange }: ColorInfoProps) {
108
117
  onFocus={() => setHasFocus(true)}
109
118
  onBlur={() => setHasFocus(false)}
110
119
  onChange={handleOpacity}
120
+ disabled={noTransparency}
111
121
  />
112
122
  </SilkeBox>
113
123
  </SilkeBox>
@@ -23,20 +23,20 @@ export function SilkeColorPickerButton({
23
23
  anchorOrigin,
24
24
  targetOrigin,
25
25
  size,
26
+ noTransparency,
26
27
  ...rest
27
28
  }: SilkeColorPickerButtonProps) {
28
29
  const context = useButtonContext();
29
30
  const ref = useRef<HTMLButtonElement>(null);
30
31
  const [open, setOpen] = useState(false);
31
32
  const buttonSize = size || context.size || 'l';
32
- const boxSize: BoxSize = buttonSize === 'bleed' ? 'l' : buttonSize;
33
33
 
34
34
  return (
35
35
  <>
36
36
  <SilkeColorSwatchButton
37
37
  {...rest}
38
38
  ref={ref}
39
- size={boxSize}
39
+ size={buttonSize}
40
40
  kind={rest.kind || 'tertiary'}
41
41
  value={value}
42
42
  onClick={() => setOpen(true)}
@@ -50,13 +50,14 @@ export function SilkeColorPickerButton({
50
50
  targetOrigin={targetOrigin || 'top-left'}
51
51
  onRequestClose={() => setOpen(false)}
52
52
  >
53
- <SilkeBox bg="ui-2" pad="s" gap="s" column>
53
+ <SilkeBox bg="neutral-20" pad="s" gap="s" column rounded="small">
54
54
  {children}
55
55
  <SilkeColorPicker
56
56
  value={value}
57
57
  hideSwatches={hideSwatches}
58
58
  hidePalettes={hidePalettes}
59
59
  noVariables={noVariables}
60
+ noTransparency={noTransparency}
60
61
  onChange={onChange}
61
62
  />
62
63
  </SilkeBox>
@@ -26,6 +26,7 @@ export type SilkeColorPickerProps = {
26
26
  hideSwatches?: boolean;
27
27
  hidePalettes?: boolean;
28
28
  noVariables?: boolean;
29
+ noTransparency?: boolean;
29
30
  onChange: (color: string) => void;
30
31
  };
31
32
 
@@ -43,6 +44,7 @@ export function SilkeColorPicker({
43
44
  hidePalettes,
44
45
  hideSwatches,
45
46
  noVariables,
47
+ noTransparency,
46
48
  onChange,
47
49
  }: SilkeColorPickerProps) {
48
50
  const dragging = useRef(false);
@@ -127,10 +129,10 @@ export function SilkeColorPicker({
127
129
 
128
130
  <SilkeBox column flex gap="s">
129
131
  <HueSlider hue={hue} onChange={handleHue} />
130
- <OpacitySlider rgba={rgba} onChange={handleChange} />
132
+ {!noTransparency && <OpacitySlider rgba={rgba} onChange={handleChange} />}
131
133
  </SilkeBox>
132
134
  </SilkeBox>
133
- <ColorInfo rgba={rgba} onChange={handleChange} />
135
+ <ColorInfo rgba={rgba} noTransparency={noTransparency} onChange={handleChange} />
134
136
  {!(hidePalettes && hideSwatches) && (
135
137
  <SilkeSwatches
136
138
  onSelect={handleChange}
@@ -16,17 +16,16 @@ export function OpacitySlider({ rgba, onChange }: OpacitySliderProps) {
16
16
  const { a } = rgba;
17
17
 
18
18
  return (
19
- <SilkeBox className={styles.opacitySlider}>
20
- <SilkeSlider
21
- trackClassName={styles.track}
22
- handleClassName={styles.handle}
23
- style={{
24
- backgroundImage: `linear-gradient(to right, rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, 0), #${hex})`,
25
- }}
26
- defaultValue={0.5}
27
- value={a || a === 0 ? a : 1}
28
- onChange={(a) => onChange({ ...rgba, a })}
29
- />
30
- </SilkeBox>
19
+ <SilkeSlider
20
+ className={styles.opacitySlider}
21
+ trackClassName={styles.track}
22
+ handleClassName={styles.handle}
23
+ style={{
24
+ backgroundImage: `linear-gradient(to right, rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, 0), #${hex}), var(--transparent-bg)`,
25
+ }}
26
+ defaultValue={0.5}
27
+ value={a || a === 0 ? a : 1}
28
+ onChange={(a) => onChange({ ...rgba, a })}
29
+ />
31
30
  );
32
31
  }
@@ -15,17 +15,23 @@ export const SilkeColorSwatchButton = React.forwardRef(
15
15
  ) => {
16
16
  const context = useButtonContext();
17
17
  const buttonSize = rest.size || context.size || 'l';
18
- const size: BoxSize = buttonSize === 'bleed' ? 'l' : buttonSize;
19
18
 
20
19
  const style = { background: value };
21
20
  return (
22
21
  <SilkeButton
23
22
  {...rest}
24
23
  ref={ref}
25
- kind={selected ? 'tertiary' : rest.kind || 'plain'}
24
+ kind={selected ? 'tertiary' : rest.kind || 'ghost'}
26
25
  icon={
27
- <SilkeBox size={size} pad={rest.label ? 's' : 'xs'}>
28
- <div className="transparent-bg fill">
26
+ <SilkeBox size={buttonSize} pad={rest.label ? 's' : 'xs'}>
27
+ <div
28
+ className="transparent-bg fill"
29
+ style={{
30
+ borderRadius: 4,
31
+ border: '1px var(--color-neutral-30) solid',
32
+ overflow: 'hidden',
33
+ }}
34
+ >
29
35
  <div className="fill" style={style} />
30
36
  </div>
31
37
  </SilkeBox>
@@ -57,7 +57,7 @@ export function SilkeSwatches({
57
57
  const handleAdd = () => onVariableAdd && onVariableAdd(selected);
58
58
 
59
59
  return (
60
- <ButtonContext size="s" kind="plain">
60
+ <ButtonContext size="s" kind="ghost">
61
61
  <SilkeBox column gap="s">
62
62
  {!hidePalettes && !hideSwatches && (
63
63
  <SilkeSelectField
@@ -101,7 +101,7 @@ export function SilkeSwatches({
101
101
  />
102
102
  ))}
103
103
  <SilkeButton
104
- kind="plain"
104
+ kind="ghost"
105
105
  disabled={isDefaultSwatch(selected)}
106
106
  icon={selectedSwatch && !isDefaultSwatch(selected) ? 'delete' : 'add'}
107
107
  onClick={selectedSwatch ? handleDelete : handleAdd}
@@ -0,0 +1 @@
1
+ export * from './silke-content-column';
@@ -0,0 +1,7 @@
1
+ # Silke Layout
2
+
3
+ Make layout which
4
+
5
+ ```js
6
+ <SilkeContentColumn>Hello</SilkeContentColumn>
7
+ ```
@@ -0,0 +1,39 @@
1
+ $sidebarWidth: 256px;
2
+ $contentGutter: 40px;
3
+ $cardSpacing: 24px;
4
+ $cardWidth: 256px;
5
+
6
+ .column {
7
+ width: #{$cardWidth * 6 + $cardSpacing * 5};
8
+ margin: 0 auto;
9
+
10
+ &.s {
11
+ width: #{$cardWidth * 4 + $cardSpacing * 3};
12
+ }
13
+
14
+ &.xs {
15
+ width: #{$cardWidth * 2 + $cardSpacing * 1};
16
+ }
17
+ }
18
+
19
+ @for $i from 5 through 2 {
20
+ @media (max-width: #{$cardWidth * ( $i + 1) + $cardSpacing * $i + $contentGutter * 2 + $sidebarWidth}) {
21
+
22
+ @if $i == 5 {
23
+ .column {
24
+ width: #{$cardWidth * 4 + $cardSpacing * 3};
25
+ }
26
+ }@else if i==4{
27
+ .column,
28
+ .column.s {
29
+ width: #{$i * $cardWidth + ($i - 1) * $cardSpacing};
30
+ }
31
+ }@else{
32
+ .column,
33
+ .column.xs,
34
+ .column.s {
35
+ width: #{$i * $cardWidth + ($i - 1) * $cardSpacing};
36
+ }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { BoxProps, SilkeBox } from '../silke-box';
3
+ import styles from './silke-content-column.scss';
4
+
5
+ type SilkeContentColumnProps = { width?: 's' | 'xs' } & BoxProps;
6
+
7
+ export function SilkeContentColumn({ width, className, ...rest }: SilkeContentColumnProps) {
8
+ let cl = styles.column;
9
+
10
+ if (className) cl += ' ' + className;
11
+ if (width) cl += ' ' + styles[width];
12
+
13
+ return <SilkeBox {...rest} className={cl} />;
14
+ }
@@ -2,6 +2,8 @@ import React, { useRef, useState } from 'react';
2
2
  import { SilkeButton, SilkeButtonProps } from '../silke-button';
3
3
  import { usePopoverRequestClose } from '../silke-popover/popover-context';
4
4
  import { SilkeContextMenu, SilkeContextMenuItems } from './silke-context-menu';
5
+ import { SilkeBox } from '../silke-box';
6
+ import styles from './silke-context-menu.scss';
5
7
 
6
8
  export type SilkeContextMenuItemProps = {
7
9
  label: React.ReactNode;
@@ -31,13 +33,15 @@ export const SilkeContextMenuItem = ({
31
33
 
32
34
  const [showSub, setShowSub] = useState(false);
33
35
  return (
34
- <>
36
+ <SilkeBox column hPad="xs">
35
37
  <SilkeButton
36
38
  ref={ref}
37
39
  label={label}
38
- kind={kind === 'danger' ? 'danger' : 'plain'}
40
+ kind={kind === 'danger' ? 'danger' : 'ghost'}
39
41
  size="base"
42
+ hAlign="start"
40
43
  icon={items ? 'right' : icon}
44
+ style={{ padding: 'var(--space-s)' }}
41
45
  onClick={(e) => {
42
46
  if (!items) requestCloseMenu();
43
47
  if (onClick) onClick(e);
@@ -55,6 +59,7 @@ export const SilkeContextMenuItem = ({
55
59
  setShowSub(true);
56
60
  }
57
61
  }}
62
+ className={styles.item}
58
63
  {...rest}
59
64
  />
60
65
  {showSub && items && (
@@ -64,12 +69,12 @@ export const SilkeContextMenuItem = ({
64
69
  anchor={ref}
65
70
  items={items}
66
71
  width={width}
67
- offsetX={1}
72
+ offsetX={3}
68
73
  subMenu={true}
69
74
  targetOrigin="top-left"
70
75
  anchorOrigin="top-right"
71
76
  />
72
77
  )}
73
- </>
78
+ </SilkeBox>
74
79
  );
75
80
  };
@@ -7,21 +7,25 @@ const ref = React.useRef();
7
7
  const ref2 = React.useRef();
8
8
  const items = React.useMemo(
9
9
  () =>
10
- ipsum.list(5, (i) => ({
11
- label: ipsum.name(),
12
- items: ipsum.list(5, (j) => ({
13
- label: ipsum.name(),
14
- onClick: () => console.log(`Item ${i}-${j} click`),
15
- })),
16
- })),
17
- [],
10
+ ipsum.list(5, (i) =>
11
+ i === 2
12
+ ? "divider"
13
+ : {
14
+ label: ipsum.name(),
15
+ items: ipsum.list(5, (j) => ({
16
+ label: ipsum.name(),
17
+ onClick: () => console.log(`Item ${i}-${j} click`),
18
+ })),
19
+ }
20
+ ),
21
+ []
18
22
  );
19
23
  <SilkeBox column gap>
20
- <SilkeBox ref={ref} pad="xxl" bg="layer-accent" align="center">
24
+ <SilkeBox ref={ref} pad="xxl" bg="neutral-20" align="center">
21
25
  <h4>Right click to get context menu</h4>
22
26
  <SilkeContextMenu target={ref} items={items} />
23
27
  </SilkeBox>
24
- <SilkeBox ref={ref2} pad="xxl" bg="layer-accent" align="center">
28
+ <SilkeBox ref={ref2} pad="xxl" bg="neutral-20" align="center">
25
29
  <h4>Click to get context menu</h4>
26
30
  <SilkeContextMenu target={ref2} items={() => items} trigger="click" />
27
31
  </SilkeBox>
@@ -41,9 +45,9 @@ const items = React.useMemo(
41
45
  onClick: () => console.log(`Item ${i}-${j} click`),
42
46
  })),
43
47
  })),
44
- [],
48
+ []
45
49
  );
46
- <SilkeBox ref={ref} pad="xxl" bg="layer-accent" align="center">
50
+ <SilkeBox ref={ref} pad="xxl" bg="neutral-20" align="center">
47
51
  <h4>Anchor</h4>
48
52
  <SilkeContextMenu
49
53
  target={ref}
@@ -0,0 +1,16 @@
1
+ .menu{
2
+ border-radius: var(--border-radius-small);
3
+ overflow: hidden;
4
+ button,a{
5
+ justify-content: space-between !important;
6
+ }
7
+ }
8
+
9
+ .item {
10
+ font-size: 12px;
11
+
12
+ i {
13
+ font-size: 10px;
14
+ color: var(--color-neutral-70);
15
+ }
16
+ }
@@ -1,10 +1,14 @@
1
1
  import { isFunction } from 'lodash';
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
3
  import { SilkeBox } from '../silke-box';
4
+ import { ButtonContext } from '../silke-button';
4
5
  import { SilkePopover, SilkePopoverProps } from '../silke-popover';
5
6
  import { usePopoverRequestClose } from '../silke-popover/popover-context';
6
7
  import { SilkeContextMenuItem, SilkeContextMenuItemProps } from './silke-context-menu-item';
7
8
 
9
+ import { SilkeDivider } from '../silke-divider';
10
+ import styles from './silke-context-menu.scss';
11
+
8
12
  export type SilkeContextMenuItems =
9
13
  | (SilkeContextMenuItemProps | React.ReactElement | 'divider')[]
10
14
  | (() => (SilkeContextMenuItemProps | React.ReactElement | 'divider')[]);
@@ -57,51 +61,70 @@ export function SilkeContextMenu({
57
61
  anchorOrigin="top-left"
58
62
  anchor={anchor || pos}
59
63
  onRequestClose={() => {
64
+ console.log('REQUEST close');
60
65
  if (showContextMenu) setShowContextMenu(false);
61
66
  onRequestClose?.();
62
67
  }}
63
68
  {...rest}
64
69
  focusRef={boxRef}
65
70
  >
66
- {items && (
67
- <SilkeBox
68
- tabIndex={-1}
69
- column
70
- style={{ width, borderRadius: 8 }}
71
- bg="layer-accent"
72
- ref={boxRef}
73
- onKeyDown={(e: React.KeyboardEvent) => {
74
- if (e.key === 'ArrowLeft' && !subMenu) {
75
- e.stopPropagation();
76
- e.preventDefault();
77
- requestCloseSub();
78
- }
79
- if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
80
- e.stopPropagation();
81
- e.preventDefault();
82
- let index = -1;
83
- const buttons = e.currentTarget.querySelectorAll('button');
84
- buttons.forEach((b, i) => {
85
- if (document.activeElement === b) index = i;
86
- });
87
- index += e.key === 'ArrowDown' ? 1 : -1;
88
- if (index >= buttons.length) index = 0;
89
- else if (index < 0) index = buttons.length - 1;
90
- buttons[index].focus();
91
- }
92
- }}
93
- >
94
- {(isFunction(items) ? items() : items)?.map((item, index) => {
95
- return !item ? null : React.isValidElement(item) ? (
96
- item
97
- ) : item === 'divider' ? (
98
- <hr key={index} style={{ margin: '0 4px' }} />
99
- ) : (
100
- <SilkeContextMenuItem key={index} subItem={subMenu} width={width} {...item} />
101
- );
102
- })}
103
- </SilkeBox>
104
- )}
71
+ <ButtonContext size="base">
72
+ {items && (
73
+ <SilkeBox
74
+ tabIndex={-1}
75
+ column
76
+ className={styles.menu}
77
+ style={{ width }}
78
+ bg="neutral-10"
79
+ ref={boxRef}
80
+ shadow="level4"
81
+ onMouseDown={(e: React.MouseEvent) => e.stopPropagation()}
82
+ vPad="xs"
83
+ onKeyDown={(e: React.KeyboardEvent) => {
84
+ if (e.key === 'ArrowLeft' && !subMenu) {
85
+ e.stopPropagation();
86
+ e.preventDefault();
87
+ requestCloseSub();
88
+ }
89
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
90
+ e.stopPropagation();
91
+ e.preventDefault();
92
+ let index = -1;
93
+ const buttons = e.currentTarget.querySelectorAll('button');
94
+ buttons.forEach((b, i) => {
95
+ if (document.activeElement === b) index = i;
96
+ });
97
+ index += e.key === 'ArrowDown' ? 1 : -1;
98
+ if (index >= buttons.length) index = 0;
99
+ else if (index < 0) index = buttons.length - 1;
100
+ buttons[index].focus();
101
+ }
102
+ }}
103
+ >
104
+ {(isFunction(items) ? items() : items)?.map((item, index) => {
105
+ return !item ? null : React.isValidElement(item) ? (
106
+ item
107
+ ) : item === 'divider' ? (
108
+ <SilkeBox vPad="xs" column>
109
+ <SilkeDivider dark />
110
+ </SilkeBox>
111
+ ) : (
112
+ <SilkeContextMenuItem
113
+ key={index}
114
+ subItem={subMenu}
115
+ width={width}
116
+ {...item}
117
+ onClick={(e) => {
118
+ if (showContextMenu) setShowContextMenu(false);
119
+ onRequestClose?.();
120
+ item.onClick?.(e);
121
+ }}
122
+ />
123
+ );
124
+ })}
125
+ </SilkeBox>
126
+ )}
127
+ </ButtonContext>
105
128
  </SilkePopover>
106
129
  );
107
130
  }
@@ -18,6 +18,7 @@ export type SilkeCSSContextType = {
18
18
  */
19
19
  self?: [width: number, height: number];
20
20
  variables: { [variableName: string]: string };
21
+ readonly?: boolean;
21
22
  onVariableAdd?: (color: string) => void;
22
23
  onVariableDelete?: (color: string) => void;
23
24
  };
@@ -1,7 +1,19 @@
1
- @use '../../variables' as *;
1
+ @use "../../variables" as *;
2
+
3
+ .root {
4
+ &:hover, &.openFormat {
5
+ .field + .field:not(:empty) {
6
+ background-color: var(--color-neutral-30);
7
+ color:var(--color-neutral-100);
8
+ }
9
+ }
10
+ }
11
+
2
12
  .field {
3
13
  outline: none;
4
14
  border: none;
15
+ display: flex;
16
+ align-items: center;
5
17
  white-space: nowrap;
6
18
  align-self: center;
7
19
  justify-self: end;
@@ -12,7 +24,10 @@
12
24
  overflow: hidden;
13
25
  & + .field {
14
26
  flex: none;
15
- color: var(--color-neutral-high-spark);
27
+ color: var(--color-neutral-60);
28
+ line-height: 1;
29
+ padding:3px;
30
+ border-radius: var(--border-radius-tiny);
16
31
  }
17
32
  }
18
33
 
@@ -20,7 +35,7 @@
20
35
  cursor: not-allowed;
21
36
  .field {
22
37
  pointer-events: none;
23
- color: var(--color-neutral-low-light);
38
+ color: var(--color-neutral-40);
24
39
  }
25
40
  }
26
41