@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
@@ -8,7 +8,6 @@
8
8
  <SilkeText kind="small">small - The quick brown fox jumps</SilkeText>
9
9
  ```
10
10
 
11
-
12
11
  ```js
13
12
  <SilkeTextLarge kind="p">This is a paragraph, SilkeTextLarge</SilkeTextLarge>
14
13
  <SilkeTextSmall kind="p">This is a paragraph, SilkeTextSmall</SilkeTextSmall>
@@ -40,17 +39,15 @@ Titles can also be created with these shorthands. Tag prop specifies HTML tag.
40
39
  <SilkeTitleSmall tag="h4">The quick brown fox jumps, h4 tag</SilkeTitleSmall>
41
40
  ```
42
41
 
43
-
44
-
45
42
  ## Text color
46
43
 
47
44
  ```js
48
45
  <SilkeBox gap column>
49
46
  <SilkeText>Default text color</SilkeText>
50
- <SilkeText color="secondary">Secondary text color</SilkeText>
47
+ <SilkeText color="neutral-80">Secondary text color</SilkeText>
51
48
  <SilkeText color="primary">Primary text color</SilkeText>
52
- <SilkeText color="error">Error text color</SilkeText>
53
- <SilkeText color="disabled">Disabled text color</SilkeText>
49
+ <SilkeText color="error-30">Error text color</SilkeText>
50
+ <SilkeText color="neutral-40">Disabled text color</SilkeText>
54
51
  </SilkeBox>
55
52
  ```
56
53
 
@@ -85,27 +82,27 @@ const [weight, setWeight] = React.useState(null);
85
82
  <SilkeBox gap column>
86
83
  <SilkeBox gap>
87
84
  <SilkeBox>
88
- {[null, 'primary', 'error'].map((c) => (
85
+ {[null, "primary", "error"].map((c) => (
89
86
  <SilkeButton
90
- label={c || 'default'}
91
- kind={color === c ? 'primary' : 'secondary'}
87
+ label={c || "default"}
88
+ kind={color === c ? "primary" : "secondary"}
92
89
  onClick={() => setColor(c)}
93
90
  />
94
91
  ))}
95
92
  </SilkeBox>
96
93
  <SilkeBox>
97
- {[null, 'light', 'strong'].map((c) => (
94
+ {[null, "light", "strong"].map((c) => (
98
95
  <SilkeButton
99
- label={c || 'default'}
100
- kind={color === c ? 'primary' : 'secondary'}
96
+ label={c || "default"}
97
+ kind={color === c ? "primary" : "secondary"}
101
98
  onClick={() => setColor(c)}
102
99
  />
103
100
  ))}
104
101
  </SilkeBox>
105
102
  </SilkeBox>
106
- {['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'small'].map((kind) => (
103
+ {["h1", "h2", "h3", "h4", "h5", "h6", "p", "small"].map((kind) => (
107
104
  <SilkeText key={kind} kind={kind} color={color} weight={weight}>
108
- {kind} Weight:{weight || 'default'} Color:{color || 'default'}
105
+ {kind} Weight:{weight || "default"} Color:{color || "default"}
109
106
  </SilkeText>
110
107
  ))}
111
108
  </SilkeBox>;
@@ -153,16 +150,27 @@ TODO: Review the margin rules for text blocks
153
150
  ```
154
151
 
155
152
  ### Black and white, white and black, big and small
153
+
156
154
  ```js
157
155
  <SilkeBox>
158
156
  <SilkeBox bg="gray10" flex pad column>
159
- <SilkeText color="dark" size="large">Positive applications</SilkeText>
160
- <SilkeText color="dark" size="micro">Micro font size</SilkeText>
161
- <SilkeText color="dark" size="small">Small font size</SilkeText>
162
- <SilkeText color="dark" size="base">Base font size is the default</SilkeText>
163
- <SilkeText color="dark" size="large">Large font size</SilkeText>
157
+ <SilkeText color="dark" size="large">
158
+ Positive applications
159
+ </SilkeText>
160
+ <SilkeText color="dark" size="micro">
161
+ Micro font size
162
+ </SilkeText>
163
+ <SilkeText color="dark" size="small">
164
+ Small font size
165
+ </SilkeText>
166
+ <SilkeText color="dark" size="base">
167
+ Base font size is the default
168
+ </SilkeText>
169
+ <SilkeText color="dark" size="large">
170
+ Large font size
171
+ </SilkeText>
164
172
  </SilkeBox>
165
- <SilkeBox bg="layer" flex pad column>
173
+ <SilkeBox bg="neutral-5" flex pad column>
166
174
  <SilkeText size="large">Negative applications</SilkeText>
167
175
  <SilkeText size="micro">Micro font size</SilkeText>
168
176
  <SilkeText size="small">Small font size</SilkeText>
@@ -1,13 +1,14 @@
1
1
  @use '../../variables' as *;
2
2
  @import "../../../src/styles/core";
3
3
 
4
- $colors: "disabled" rgba(var(--color-neutral-high-pure-rgb), var(--opacity-level-medium)),
5
- "secondary" rgb(var(--color-neutral-high-soft-rgb)),
6
- "error" var(--color-feedback-warning-spark),
7
- "primary" var(--color-brand-primary-soft),
8
- "support-4" var(--color-support-secondary-soft),
9
- "success" var(--color-brand-secondary-bright),
10
- "dark" var(--color-neutral-low-pure);
4
+ // $colors: "disabled" rgba(var(--color-neutral-100-rgb), var(--opacity-level-medium)),
5
+ // "secondary" rgb(var(--color-neutral-80-rgb)),
6
+ // "error" var(--color-error-30),
7
+ // "primary" var(--color-accent-50),
8
+ // "accent" var(--color-accent-50),
9
+ // "support-4" var(--color-support-secondary-50),
10
+ // "success" var(--color-brand-secondary-bright),
11
+ // "dark" var(--color-neutral-0);
11
12
  $weights: "strong" 600, "light" 200;
12
13
 
13
14
  /***
@@ -44,7 +44,7 @@
44
44
  .xs {
45
45
  @extend .headerCommons;
46
46
 
47
- font-size: 19px;
47
+ font-size: 16px;
48
48
  line-height: 24px;
49
49
  letter-spacing: 0.025em;
50
50
  }
@@ -101,7 +101,7 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
101
101
  data-size={`data-input-${mappedSize}`}
102
102
  tag="div"
103
103
  column={!inline}
104
- gap={mappedSize === 'base' || mappedSize === 'large' ? 's' : 'xs'}
104
+ gap={'xs'}
105
105
  vAlign="center"
106
106
  style={width ? { minWidth: width, maxWidth: width, width } : flex ? { flex: 1 } : undefined}
107
107
  className={cl}
@@ -113,7 +113,7 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
113
113
  className={styles.label}
114
114
  tag="label"
115
115
  htmlFor={labelId}
116
- color="secondary"
116
+ color="neutral-100"
117
117
  style={inlineLabelWidth ? { width: `${inlineLabelWidth}px` } : undefined}
118
118
  >
119
119
  {label}
@@ -139,7 +139,7 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
139
139
  {showHelp && (
140
140
  <SilkeBox hAlign="spread" className={styles.help}>
141
141
  {help && (
142
- <SilkeText tag="span" flex color="secondary" id={helpId}>
142
+ <SilkeText tag="span" flex color="neutral-80" id={helpId}>
143
143
  {help}
144
144
  </SilkeText>
145
145
  )}
@@ -152,7 +152,7 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
152
152
  flex
153
153
  tag="small"
154
154
  className={styles.formErrorMessage}
155
- color="error"
155
+ color="error-30"
156
156
  aria-live="polite"
157
157
  role="alert"
158
158
  >
@@ -23,11 +23,17 @@ const [value, setValue] = React.useState("");
23
23
  ))}
24
24
  </SilkeBox>
25
25
  ))}
26
- </SilkeBox>
26
+ </SilkeBox>;
27
27
  ```
28
28
 
29
29
  ```js
30
30
  const [value, setValue] = React.useState("");
31
+ const items = ipsum.list((i) => ({
32
+ value: i,
33
+ label: ipsum.name(),
34
+ disabled: i > 4 && !Math.floor(Math.random() * 3),
35
+ }));
36
+
31
37
  <>
32
38
  <SilkeTextField
33
39
  label="Domain name"
@@ -77,6 +83,21 @@ const [value, setValue] = React.useState("");
77
83
  <SilkeButton label="Button" />
78
84
  </SilkeTextFieldItem>
79
85
  </SilkeTextField>
86
+ <SilkeTextField
87
+ label="Text label"
88
+ placeholder="Placeholder"
89
+ value={value}
90
+ onChange={setValue}
91
+ >
92
+ <SilkeTextFieldItem>
93
+ <SilkeSelectField
94
+ kind="ghost"
95
+ onChange={() => console.log("selected")}
96
+ value={items[1].value}
97
+ items={items}
98
+ />
99
+ </SilkeTextFieldItem>
100
+ </SilkeTextField>
80
101
  </>;
81
102
  ```
82
103
 
@@ -104,26 +125,24 @@ const [value, setValue] = React.useState("");
104
125
  </SilkeBox>
105
126
  ```
106
127
 
107
-
108
128
  ## Disabled
109
129
 
110
130
  ```js
111
-
112
131
  const [value, setValue] = React.useState("john.barnes@liverpool.com");
113
132
 
114
133
  <SilkeBox column gap="l">
115
134
  {["default", "secondary", "ghost"].map((kind) => (
116
- <SilkeTextField
117
- disabled
118
- kind={kind}
119
- flex
120
- value={value}
121
- onChange={setValue}
122
- label={`${kind}`}
123
- placeholder={kind + " "}
124
- />
135
+ <SilkeTextField
136
+ disabled
137
+ kind={kind}
138
+ flex
139
+ value={value}
140
+ onChange={setValue}
141
+ label={`${kind}`}
142
+ placeholder={kind + " "}
143
+ />
125
144
  ))}
126
- </SilkeBox>
145
+ </SilkeBox>;
127
146
  ```
128
147
 
129
148
  ## Autofocus inside popover
@@ -155,4 +174,3 @@ const ref = React.useRef()
155
174
  </SilkeModal>}
156
175
  </div>
157
176
  ```
158
-
@@ -1,12 +1,12 @@
1
1
  @use '../../variables' as *;
2
2
  $kinds: (
3
3
  name: default,
4
- bg: var(--color-neutral-low-medium),
5
- bg-disabled: var(--color-neutral-low-spark),
4
+ bg: var(--color-neutral-20),
5
+ bg-disabled: var(--color-neutral-10),
6
6
  border-width: 1px,
7
- border-color: var(--color-neutral-low-medium),
8
- border-color-hover: var(--color-neutral-low-light),
9
- border-color-focus: var(--color-neutral-high-spark),
7
+ border-color: var(--color-neutral-20),
8
+ border-color-hover: var(--color-neutral-40),
9
+ border-color-focus: var(--color-neutral-60),
10
10
  border-radius: var(--border-radius-small),
11
11
  ),
12
12
  (
@@ -15,9 +15,9 @@ $kinds: (
15
15
  bg-disabled: transparent,
16
16
  bg-hover: transparent,
17
17
  border-width: 0 0 1px 0,
18
- border-color: var(--color-neutral-low-soft),
19
- border-color-hover: var(--color-neutral-high-medium),
20
- border-color-focus: var(--color-neutral-high-light),
18
+ border-color: var(--color-neutral-30),
19
+ border-color-hover: var(--color-neutral-70),
20
+ border-color-focus: var(--color-neutral-90),
21
21
  ),
22
22
  (
23
23
  name: ghost,
@@ -27,11 +27,12 @@ $kinds: (
27
27
  border-width: 0 0 1px 0,
28
28
  border-color: transparent,
29
29
  border-color-hover: transparent,
30
- border-color-focus: var(--color-neutral-high-light),
30
+ border-color-focus: var(--color-neutral-90),
31
31
  );
32
32
 
33
33
  .root {
34
34
  width: 100%;
35
+ min-width: 0;
35
36
  }
36
37
 
37
38
  .field {
@@ -40,41 +41,48 @@ $kinds: (
40
41
 
41
42
  .label,
42
43
  .formErrorMessage {
43
- font-weight: 400;
44
44
  line-height: 1;
45
45
  }
46
46
 
47
+ .formErrorMessage {
48
+ font-weight: 400;
49
+ }
50
+
51
+ .label {
52
+ font-weight: 600;
53
+ }
54
+
47
55
  .error {
48
56
  .border {
49
- border-color: var(--color-feedback-warning-spark);
57
+ border-color: var(--color-error-30);
50
58
  }
51
59
  }
52
60
 
53
61
  .formErrorMessage {
54
- color: var(--color-feedback-warning-spark);
62
+ color: var(--color-error-30);
55
63
  }
56
64
 
57
65
  .help {
58
- color: var(--color-neutral-high-soft);
66
+ color: var(--color-neutral-80);
59
67
  line-height: 1;
60
68
  }
61
69
 
62
70
  .disabled {
63
71
  .label, .help, .input {
64
- color: var(--color-neutral-high-dark);
72
+ color: var(--color-neutral-50);
65
73
  }
66
74
  }
67
75
 
68
76
  .secondary.disabled .border {
69
- border-color: var(--color-neutral-low-soft);
77
+ border-color: var(--color-neutral-30);
70
78
  }
71
79
 
72
80
  .default.disabled .border {
73
- border-color: var(--color-neutral-low-spark);
81
+ border-color: var(--color-neutral-10);
74
82
  }
75
83
 
76
84
  .input {
77
- @include font(16px);
85
+ @include font(14px);
78
86
  flex: 1;
79
87
  background: transparent;
80
88
  outline: none;
@@ -83,13 +91,16 @@ $kinds: (
83
91
  overflow: hidden;
84
92
  padding: 0;
85
93
  resize: none;
86
- color: var(--color-neutral-high-pure);
94
+ color: var(--color-neutral-100);
87
95
  line-height: 1;
88
96
 
89
-
97
+ &::selection {
98
+ background-color: rgba(var(--color-accent-30-rgb), 0.32);
99
+ color: var(--color-neutral-100);
100
+ }
90
101
 
91
102
  &::placeholder {
92
- color: var(--color-neutral-high-spark);
103
+ color: var(--color-neutral-60);
93
104
  }
94
105
  }
95
106
 
@@ -109,7 +120,7 @@ textarea {
109
120
  border: 0 solid currentColor;
110
121
 
111
122
  &:hover {
112
- color: var(--color-neutral-low-soft)
123
+ color: var(--color-neutral-30)
113
124
  }
114
125
  }
115
126
 
@@ -142,7 +153,7 @@ textarea {
142
153
 
143
154
  .input, [contenteditable="true"] {
144
155
  &:focus ~ .border {
145
- color: map-get($kind, var(--color-neutral-high-pure));
156
+ color: map-get($kind, var(--color-neutral-100));
146
157
  }
147
158
  }
148
159
  }
@@ -154,7 +165,7 @@ textarea {
154
165
  }
155
166
 
156
167
  &.error input ~ .border {
157
- color: var(--color-feedback-warning-spark);
168
+ color: var(--color-warning-30);
158
169
  }
159
170
  }
160
171
  }
@@ -237,6 +248,12 @@ textarea.input{
237
248
  padding: 0 8px;
238
249
  }
239
250
  }
251
+ .ghost {
252
+ .field, .border {
253
+ outline: none;
254
+ border: none;
255
+ }
256
+ }
240
257
  }
241
258
 
242
259
  .large {
@@ -265,6 +282,7 @@ textarea.input{
265
282
  .tiny, .small, .base, .large {
266
283
  .inputMultiline {
267
284
  line-height: 1.4;
285
+ overflow-y: auto;
268
286
  }
269
287
  }
270
288
 
@@ -14,6 +14,7 @@ import { FormFieldProps } from '../silke-form';
14
14
  import { SilkeTextFieldItem } from './silke-text-field-item';
15
15
  import { SilkeTextFieldOutline, SilkeTextFieldOutlineProps } from './silke-text-field-outline';
16
16
  import styles from './silke-text-field.scss';
17
+ import { useTextFieldContext } from './text-field-context';
17
18
 
18
19
  type BaseProps<T> = FormFieldProps<T> &
19
20
  SilkeTextFieldOutlineProps & {
@@ -23,6 +24,7 @@ type BaseProps<T> = FormFieldProps<T> &
23
24
  required?: boolean | string;
24
25
  maxLength?: number;
25
26
  minLength?: number;
27
+ type?: string;
26
28
  };
27
29
 
28
30
  type OmitAttrs =
@@ -34,11 +36,14 @@ type OmitAttrs =
34
36
  | 'required'
35
37
  | 'onChange'
36
38
  | 'onFocus'
39
+ | 'readonly'
37
40
  | 'onBlur';
38
41
 
39
- type MultilineProps = { multiline: true | number } & BaseProps<string> &
42
+ type MultilineProps = { multiline: true | number; type?: string } & BaseProps<string> &
40
43
  Omit<HTMLAttributes<HTMLTextAreaElement>, OmitAttrs>;
41
- export type SingleLineProps = { multiline?: undefined | false } & BaseProps<string> &
44
+ export type SingleLineProps = {
45
+ multiline?: undefined | false;
46
+ } & BaseProps<string> &
42
47
  Omit<InputHTMLAttributes<HTMLInputElement>, OmitAttrs>;
43
48
 
44
49
  type SingleLineNumberProps = { multiline?: undefined | false; type: 'number' } & BaseProps<number> &
@@ -78,9 +83,12 @@ export const SilkeTextField = React.forwardRef<HTMLDivElement, SilkeTextFieldPro
78
83
  inline,
79
84
  disabled,
80
85
  inlineLabelWidth,
86
+ readOnly,
81
87
  ...rest
82
88
  } = useFormField(props, validateText);
83
89
 
90
+ const context = useTextFieldContext();
91
+
84
92
  const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement>();
85
93
  const helpId = useMemo(() => {
86
94
  return `help-${generateGuid()}`;
@@ -140,20 +148,20 @@ export const SilkeTextField = React.forwardRef<HTMLDivElement, SilkeTextFieldPro
140
148
  {React.createElement(multiline ? 'textarea' : 'input', {
141
149
  ...rest,
142
150
  disabled,
151
+ readOnly: readOnly || context.readOnly,
143
152
  ref: inputRef,
144
153
  className: multiline ? styles.input + ' ' + styles.inputMultiline : styles.input,
145
154
  placeholder,
146
155
  id: inputId,
147
156
  name,
148
157
  style: inputStyle,
149
- value: value || '',
158
+ value: value ?? '',
150
159
  rows: multiline === true ? 5 : multiline || undefined,
151
160
  autoComplete: autocomplete ? 'on' : 'off',
152
161
  'aria-invalid': !!error,
153
162
  'aria-describedby': help ? helpId : undefined,
154
163
  onChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
155
- if (type === 'number') onChange(parseFloat(event.target.value) || 0);
156
- else onChange(event.target.value);
164
+ onChange(event.target.value);
157
165
  },
158
166
  })}
159
167
  {after}
@@ -1,7 +1,7 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { SilkeTextFieldProps } from './silke-text-field';
3
3
 
4
- type TextFieldContextType = Pick<SilkeTextFieldProps, 'kind' | 'size' | 'inline'>;
4
+ type TextFieldContextType = Pick<SilkeTextFieldProps, 'kind' | 'size' | 'inline' | 'readOnly'>;
5
5
  type TextFieldContextProps = { children: React.ReactNode } & TextFieldContextType;
6
6
 
7
7
  const Context = React.createContext<TextFieldContextType>({});
@@ -0,0 +1 @@
1
+ export * from './silke-theme-editor';
@@ -0,0 +1,165 @@
1
+ import { groupBy, startCase } from 'lodash';
2
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { copyToClipboard } from '../../helpers/copy-to-clipboard';
4
+ import { SilkeColorTheme } from '../../silke-theme-provider';
5
+ import { SilkeBox } from '../silke-box';
6
+ import { SilkeButton } from '../silke-button';
7
+ import { SilkeColorPickerButton } from '../silke-color-picker';
8
+ import { SilkeText, SilkeTitle } from '../silke-text';
9
+ import { SilkeTextField } from '../silke-text-field';
10
+
11
+ type SilkeThemeEditorProps = {
12
+ theme: SilkeColorTheme;
13
+ search?: string;
14
+ onChange: (theme: SilkeColorTheme) => void;
15
+ };
16
+
17
+ export function SilkeThemeEditor({ theme, search, onChange }: SilkeThemeEditorProps) {
18
+ const colors: string[] = useMemo(
19
+ () => [
20
+ 'color-accent-60',
21
+ 'color-accent-50',
22
+ 'color-accent-40',
23
+ 'color-accent-30',
24
+ 'color-accent-20',
25
+ 'color-accent-10',
26
+ 'color-error-60',
27
+ 'color-error-50',
28
+ 'color-error-40',
29
+ 'color-error-30',
30
+ 'color-error-20',
31
+ 'color-error-10',
32
+ 'color-warning-60',
33
+ 'color-warning-50',
34
+ 'color-warning-40',
35
+ 'color-warning-30',
36
+ 'color-warning-20',
37
+ 'color-warning-10',
38
+ 'color-success-60',
39
+ 'color-success-50',
40
+ 'color-success-40',
41
+ 'color-success-30',
42
+ 'color-success-20',
43
+ 'color-success-10',
44
+ 'color-neutral-0',
45
+ 'color-neutral-40',
46
+ 'color-neutral-30',
47
+ 'color-neutral-20',
48
+ 'color-neutral-10',
49
+ 'color-neutral-5',
50
+ 'color-neutral-100',
51
+ 'color-neutral-90',
52
+ 'color-neutral-80',
53
+ 'color-neutral-70',
54
+ 'color-neutral-60',
55
+ 'color-neutral-50',
56
+ 'color-support-secondary-60',
57
+ 'color-support-secondary-50',
58
+ 'color-support-secondary-40',
59
+ 'color-support-secondary-30',
60
+ 'color-support-secondary-20',
61
+ 'color-support-secondary-10',
62
+ 'color-support-primary-60',
63
+ 'color-support-primary-50',
64
+ 'color-support-primary-40',
65
+ 'color-support-primary-30',
66
+ 'color-support-primary-20',
67
+ 'color-support-primary-10',
68
+ 'color-brand-primary-60',
69
+ 'color-brand-primary-bright',
70
+ 'color-brand-primary-30',
71
+ 'color-brand-primary-10',
72
+ 'color-brand-secondary-bright',
73
+ 'color-brand-secondary-30',
74
+ 'color-brand-secondary-10',
75
+ 'color-brand-secondary-60',
76
+ 'color-brand-tertiary-bright',
77
+ 'color-brand-tertiary-60',
78
+ 'color-brand-tertiary-30',
79
+ 'color-brand-tertiary-10',
80
+ 'color-brand-quaternary-60',
81
+ 'color-brand-quaternary-30',
82
+ 'color-brand-quaternary-10',
83
+ ],
84
+ [],
85
+ );
86
+
87
+ const ref = useRef<HTMLDivElement>(null);
88
+ const [currentColors, setCurrentColors] = useState<SilkeColorTheme>({});
89
+ useEffect(() => {
90
+ const el = ref.current;
91
+ if (!el) return;
92
+ const computed = getComputedStyle(el);
93
+ const current: SilkeColorTheme = {};
94
+ for (const color of colors) {
95
+ current[color as keyof SilkeColorTheme] = computed.getPropertyValue('--' + color);
96
+ }
97
+
98
+ setCurrentColors(current);
99
+ }, [colors]);
100
+
101
+ const group = useMemo(() => {
102
+ const filteredColors = search ? colors.filter((c) => c.search(search) !== -1) : colors;
103
+ return groupBy(filteredColors, (color) => color.replace('color-', '').split('-')[0]);
104
+ }, [search, colors]);
105
+
106
+ return (
107
+ <SilkeBox column gap ref={ref} fill flex>
108
+ <SilkeBox hAlign="end">
109
+ <SilkeButton
110
+ size="base"
111
+ label="Copy CSS code"
112
+ onClick={() => {
113
+ let s = '';
114
+ let group = '';
115
+ for (const color of colors) {
116
+ const colorGroup = startCase(color).split(' ').slice(1, -1).join('/');
117
+ if (colorGroup !== group) {
118
+ group = colorGroup;
119
+ s += `\n//${colorGroup}\n`;
120
+ }
121
+ const value =
122
+ theme?.[color as keyof SilkeColorTheme] ||
123
+ currentColors[color as keyof SilkeColorTheme];
124
+ s += `"${color}" ${value},\n`;
125
+ }
126
+
127
+ copyToClipboard(s.slice(0, -2) + ';');
128
+ }}
129
+ />
130
+ </SilkeBox>
131
+ {Object.entries(group).map(([groupName, colors]) => (
132
+ <SilkeBox column gap="s" key={groupName}>
133
+ <SilkeTitle kind="xs">{startCase(groupName)}</SilkeTitle>
134
+ {colors.map((color) => (
135
+ <SilkeBox gap="s" key={color} vAlign="end">
136
+ <SilkeColorPickerButton
137
+ size="m"
138
+ value={
139
+ theme?.[color as keyof SilkeColorTheme] ||
140
+ currentColors[color as keyof SilkeColorTheme] ||
141
+ 'black'
142
+ }
143
+ noVariables
144
+ onChange={(value) => {
145
+ onChange({ ...theme, [color]: value });
146
+ }}
147
+ />
148
+ <SilkeTextField
149
+ label={startCase(color).split(' ').slice(1).join('/')}
150
+ value={
151
+ theme?.[color as keyof SilkeColorTheme] ||
152
+ currentColors[color as keyof SilkeColorTheme] ||
153
+ 'black'
154
+ }
155
+ onChange={(value: string) => {
156
+ onChange({ ...theme, [color]: value });
157
+ }}
158
+ />
159
+ </SilkeBox>
160
+ ))}
161
+ </SilkeBox>
162
+ ))}
163
+ </SilkeBox>
164
+ );
165
+ }