@vev/silke 1.0.28 → 1.0.29

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 (239) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +49 -48
  3. package/dist/silke/src/components/index.d.ts +1 -1
  4. package/dist/silke/src/components/silke-autocomplete-field/autocomplete-item.d.ts +2 -1
  5. package/dist/silke/src/components/silke-autocomplete-field/autocomplete-tags.d.ts +2 -1
  6. package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-field.d.ts +3 -1
  7. package/dist/silke/src/components/silke-autocomplete-field/silke-autocomplete-popup.d.ts +1 -0
  8. package/dist/silke/src/components/silke-box/silke-box.d.ts +3 -2
  9. package/dist/silke/src/components/silke-breadcrumbs/silke-breadcrumb.d.ts +1 -1
  10. package/dist/silke/src/components/silke-button/silke-big-button.d.ts +4 -1
  11. package/dist/silke/src/components/silke-button/silke-button.d.ts +1 -1
  12. package/dist/silke/src/components/silke-button/silke-dropdown-button.d.ts +2 -1
  13. package/dist/silke/src/components/silke-color-picker/color.d.ts +5 -0
  14. package/dist/silke/src/components/silke-color-picker/silke-color-info.d.ts +3 -1
  15. package/dist/silke/src/components/silke-color-swatches/silke-swatches.d.ts +2 -1
  16. package/dist/silke/src/components/silke-conditions-input/index.d.ts +2 -0
  17. package/dist/silke/src/components/silke-conditions-input/silke-conditions-input-options.d.ts +8 -0
  18. package/dist/silke/src/components/silke-conditions-input/silke-conditions-input.d.ts +19 -0
  19. package/dist/silke/src/components/silke-conditions-input/silke-conditions-tag.d.ts +11 -0
  20. package/dist/silke/src/components/silke-conditions-input/types.d.ts +13 -0
  21. package/dist/silke/src/components/silke-conditions-input/utils.d.ts +11 -0
  22. package/dist/silke/src/components/silke-context-menu/silke-context-menu-item.d.ts +1 -1
  23. package/dist/silke/src/components/silke-css-number-field/silke-css-context.d.ts +5 -1
  24. package/dist/silke/src/components/silke-css-number-field/silke-css-number-field.d.ts +3 -1
  25. package/dist/silke/src/components/silke-form/form-types.d.ts +3 -3
  26. package/dist/silke/src/components/silke-form-schema/fields/array-field-inline.d.ts +2 -1
  27. package/dist/silke/src/components/silke-form-schema/fields/array-field-modal.d.ts +3 -2
  28. package/dist/silke/src/components/silke-form-schema/fields/array-field.d.ts +1 -1
  29. package/dist/silke/src/components/silke-form-schema/fields/event-field.d.ts +1 -1
  30. package/dist/silke/src/components/silke-form-schema/fields/icon-field.d.ts +1 -1
  31. package/dist/silke/src/components/silke-form-schema/fields/image-field.d.ts +1 -1
  32. package/dist/silke/src/components/silke-form-schema/fields/layout-field.d.ts +1 -1
  33. package/dist/silke/src/components/silke-form-schema/fields/object-field.d.ts +1 -1
  34. package/dist/silke/src/components/silke-form-schema/fields/string-field.d.ts +1 -1
  35. package/dist/silke/src/components/silke-form-schema/fields/toggle-field.d.ts +1 -1
  36. package/dist/silke/src/components/silke-form-schema/fields/utils/generate-image.d.ts +1 -1
  37. package/dist/silke/src/components/silke-form-schema/fields/utils/generate-title.d.ts +1 -1
  38. package/dist/silke/src/components/silke-form-schema/fields/video-field.d.ts +1 -1
  39. package/dist/silke/src/components/silke-form-schema/silke-form-schema.d.ts +5 -0
  40. package/dist/silke/src/components/silke-form-schema/silke-schema-field.d.ts +3 -1
  41. package/dist/silke/src/components/silke-form-schema/silke-schema-fields.d.ts +2 -0
  42. package/dist/silke/src/components/silke-modal/silke-modal.d.ts +2 -1
  43. package/dist/silke/src/components/silke-notification/silke-notification.d.ts +1 -1
  44. package/dist/silke/src/components/silke-radio-button/silke-radio-button-group.d.ts +1 -1
  45. package/dist/silke/src/components/silke-slider/silke-slider.d.ts +1 -0
  46. package/dist/silke/src/components/silke-sortable-list/silke-nested-sortable-utils.d.ts +1 -0
  47. package/dist/silke/src/components/silke-sortable-list/silke-sortable-item-wrapper.d.ts +2 -1
  48. package/dist/silke/src/components/silke-sortable-list/silke-sortable-list.d.ts +2 -1
  49. package/dist/silke/src/components/silke-table/silke-table.d.ts +2 -1
  50. package/dist/silke/src/components/silke-table/table-row.d.ts +3 -1
  51. package/dist/silke/src/components/silke-table/table-types.d.ts +1 -1
  52. package/dist/silke/src/components/silke-tag/silke-tag.d.ts +1 -1
  53. package/dist/silke/src/components/silke-text-field/silke-text-field-outline.d.ts +3 -1
  54. package/dist/silke/src/components/silke-text-field/text-field-context.d.ts +4 -1
  55. package/dist/silke/src/components/silke-tile/index.d.ts +0 -1
  56. package/dist/silke/src/components/silke-tooltip/silke-definition-tooltip.d.ts +2 -1
  57. package/dist/silke/src/components/silke-tooltip/silke-icon-tooltip.d.ts +2 -1
  58. package/dist/silke/src/components/silke-tooltip/silke-tooltip.d.ts +6 -1
  59. package/dist/silke/src/components/silke-variables-wrapper/silke-variables-wrapper-form.d.ts +4 -3
  60. package/dist/silke/src/components/silke-variables-wrapper/silke-variables-wrapper.d.ts +5 -1
  61. package/dist/silke/src/icons.d.ts +74 -2
  62. package/dist/silke/src/silke-theme-provider.d.ts +1 -1
  63. package/dist/styles.css +1419 -1157
  64. package/dist/utils/src/types/context.d.ts +1 -0
  65. package/dist/utils/src/types/index.d.ts +1 -0
  66. package/dist/utils/src/types/manifest.d.ts +2 -0
  67. package/dist/utils/src/types/qwiker.d.ts +46 -0
  68. package/dist/utils/src/types/vev-plugin.d.ts +12 -0
  69. package/dist/utils/src/types/vev-props.d.ts +23 -2
  70. package/dist/utils/src/types/widget-manifest.d.ts +1 -0
  71. package/dist/utils/src/utils/index.d.ts +1 -0
  72. package/dist/utils/src/utils/variable.d.ts +3 -0
  73. package/package.json +15 -8
  74. package/project.json +21 -0
  75. package/public/index.html +2 -2
  76. package/src/_variables.scss +19 -5
  77. package/src/components/index.ts +1 -1
  78. package/src/components/silke-autocomplete-field/autocomplete-item.tsx +18 -12
  79. package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +3 -0
  80. package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +15 -15
  81. package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +33 -25
  82. package/src/components/silke-autocomplete-field/silke-autocomplete-popup.tsx +40 -20
  83. package/src/components/silke-box/silke-box.mdx +13 -9
  84. package/src/components/silke-box/silke-box.scss +12 -3
  85. package/src/components/silke-box/silke-box.tsx +18 -2
  86. package/src/components/silke-breadcrumbs/silke-breadcrumb.tsx +2 -2
  87. package/src/components/silke-button/silke-big-button.scss +0 -5
  88. package/src/components/silke-button/silke-big-button.tsx +15 -4
  89. package/src/components/silke-button/silke-button.mdx +34 -17
  90. package/src/components/silke-button/silke-button.scss +28 -31
  91. package/src/components/silke-button/silke-button.tsx +2 -2
  92. package/src/components/silke-button/silke-dropdown-button.tsx +7 -3
  93. package/src/components/silke-button/silke-file-select-button.tsx +1 -0
  94. package/src/components/silke-card/silke-card-grid.tsx +1 -1
  95. package/src/components/silke-card/silke-card.mdx +16 -26
  96. package/src/components/silke-card/silke-card.scss +10 -3
  97. package/src/components/silke-card/silke-card.tsx +7 -4
  98. package/src/components/silke-checkbox/silke-checkbox.mdx +2 -11
  99. package/src/components/silke-code-snippet/silke-code-snippet.mdx +27 -22
  100. package/src/components/silke-color-palettes/silke-color-palette.mdx +2 -2
  101. package/src/components/silke-color-picker/color.ts +12 -0
  102. package/src/components/silke-color-picker/silke-color-info.tsx +27 -8
  103. package/src/components/silke-color-picker/silke-color-picker-button.tsx +1 -1
  104. package/src/components/silke-color-picker/silke-color-picker.mdx +9 -13
  105. package/src/components/silke-color-picker/silke-color-picker.tsx +23 -6
  106. package/src/components/silke-color-swatches/silke-color-swatch-button.tsx +1 -1
  107. package/src/components/silke-color-swatches/silke-swatches.tsx +10 -7
  108. package/src/components/silke-conditions-input/index.ts +2 -0
  109. package/src/components/silke-conditions-input/silke-conditions-input-options.tsx +87 -0
  110. package/src/components/silke-conditions-input/silke-conditions-input.mdx +88 -0
  111. package/src/components/silke-conditions-input/silke-conditions-input.scss +29 -0
  112. package/src/components/silke-conditions-input/silke-conditions-input.tsx +290 -0
  113. package/src/components/silke-conditions-input/silke-conditions-tag.tsx +80 -0
  114. package/src/components/silke-conditions-input/types.ts +23 -0
  115. package/src/components/silke-conditions-input/utils.ts +181 -0
  116. package/src/components/silke-content-column/silke-content-column.scss +1 -1
  117. package/src/components/silke-context-menu/silke-context-menu-item.tsx +3 -0
  118. package/src/components/silke-context-menu/silke-context-menu.mdx +4 -4
  119. package/src/components/silke-context-menu/silke-context-menu.scss +9 -7
  120. package/src/components/silke-context-menu/silke-context-menu.tsx +1 -1
  121. package/src/components/silke-css-number-field/silke-css-context.tsx +6 -1
  122. package/src/components/silke-css-number-field/silke-css-number-field.mdx +221 -91
  123. package/src/components/silke-css-number-field/silke-css-number-field.scss +10 -3
  124. package/src/components/silke-css-number-field/silke-css-number-field.tsx +52 -8
  125. package/src/components/silke-css-number-field/utils.ts +2 -1
  126. package/src/components/silke-divider/silke-divider.mdx +1 -2
  127. package/src/components/silke-drawer/silke-drawer.mdx +4 -11
  128. package/src/components/silke-form/form-types.ts +5 -3
  129. package/src/components/silke-form/silke-form.mdx +4 -16
  130. package/src/components/silke-form-schema/fields/array-field-inline.tsx +12 -2
  131. package/src/components/silke-form-schema/fields/array-field-modal.tsx +10 -6
  132. package/src/components/silke-form-schema/fields/array-field.tsx +25 -6
  133. package/src/components/silke-form-schema/fields/event-field.tsx +18 -7
  134. package/src/components/silke-form-schema/fields/icon-field.tsx +21 -3
  135. package/src/components/silke-form-schema/fields/image-field.tsx +21 -3
  136. package/src/components/silke-form-schema/fields/layout-field.tsx +8 -1
  137. package/src/components/silke-form-schema/fields/link-field.tsx +5 -1
  138. package/src/components/silke-form-schema/fields/number-field.tsx +144 -13
  139. package/src/components/silke-form-schema/fields/object-field.tsx +10 -1
  140. package/src/components/silke-form-schema/fields/select-field.tsx +15 -1
  141. package/src/components/silke-form-schema/fields/string-field.tsx +115 -20
  142. package/src/components/silke-form-schema/fields/toggle-field.tsx +14 -2
  143. package/src/components/silke-form-schema/fields/upload-field.tsx +3 -1
  144. package/src/components/silke-form-schema/fields/utils/generate-image.ts +4 -1
  145. package/src/components/silke-form-schema/fields/utils/generate-title.ts +2 -1
  146. package/src/components/silke-form-schema/fields/video-field.tsx +22 -4
  147. package/src/components/silke-form-schema/silke-form-schema.mdx +227 -160
  148. package/src/components/silke-form-schema/silke-form-schema.tsx +5 -0
  149. package/src/components/silke-form-schema/silke-schema-field.tsx +23 -6
  150. package/src/components/silke-form-schema/silke-schema-fields.tsx +3 -1
  151. package/src/components/silke-gradient-picker/silke-gradient-picker.mdx +1 -1
  152. package/src/components/silke-icon/silke-icon.mdx +3 -6
  153. package/src/components/silke-icon/silke-icon.scss +2 -0
  154. package/src/components/silke-icon-picker/silke-icon-picker.tsx +5 -5
  155. package/src/components/silke-iframe-portal/silke-iframe-portal.mdx +6 -15
  156. package/src/components/silke-image/silke-image.mdx +28 -0
  157. package/src/components/silke-image/silke-image.scss +1 -0
  158. package/src/components/silke-link/silke-link.mdx +62 -39
  159. package/src/components/silke-link/silke-link.scss +3 -2
  160. package/src/components/silke-list/silke-list.mdx +12 -10
  161. package/src/components/silke-list-card/silke-list-card.mdx +7 -11
  162. package/src/components/silke-loader/silke-loader.mdx +1 -1
  163. package/src/components/silke-loader/silke-loader.tsx +1 -4
  164. package/src/components/silke-modal/silke-modal.mdx +1 -5
  165. package/src/components/silke-modal/silke-modal.scss +0 -2
  166. package/src/components/silke-modal/silke-modal.tsx +3 -1
  167. package/src/components/silke-navigation-link/silke-navigation-link.mdx +21 -22
  168. package/src/components/silke-navigation-link/silke-navigation-link.scss +2 -2
  169. package/src/components/silke-notification/silke-notification.mdx +35 -67
  170. package/src/components/silke-notification/silke-notification.tsx +2 -1
  171. package/src/components/silke-object-field/silke-object-field.mdx +3 -10
  172. package/src/components/silke-object-field/silke-object-field.tsx +2 -2
  173. package/src/components/silke-overflow-menu/silke-overflow-menu.mdx +2 -2
  174. package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +2 -1
  175. package/src/components/silke-popover/silke-popover.mdx +14 -22
  176. package/src/components/silke-popover/silke-popover.tsx +21 -15
  177. package/src/components/silke-progress-indicator/silke-progress-indicator.mdx +33 -36
  178. package/src/components/silke-radio-button/silke-radio-button-group.tsx +1 -1
  179. package/src/components/silke-radio-button/silke-radio-button.mdx +1 -7
  180. package/src/components/silke-radio-button/silke-radio-button.scss +1 -0
  181. package/src/components/silke-search-field/silke-search-field.mdx +4 -12
  182. package/src/components/silke-select-field/silke-select-field.mdx +10 -10
  183. package/src/components/silke-slider/silke-slider.mdx +59 -22
  184. package/src/components/silke-slider/silke-slider.tsx +23 -10
  185. package/src/components/silke-sortable-list/silke-nested-sortable-item.tsx +3 -3
  186. package/src/components/silke-sortable-list/silke-nested-sortable-utils.ts +1 -0
  187. package/src/components/silke-sortable-list/silke-sortable-item-wrapper.tsx +4 -1
  188. package/src/components/silke-sortable-list/silke-sortable-list.mdx +54 -58
  189. package/src/components/silke-sortable-list/silke-sortable-list.scss +2 -2
  190. package/src/components/silke-sortable-list/silke-sortable-list.tsx +3 -0
  191. package/src/components/silke-table/silke-table.mdx +75 -75
  192. package/src/components/silke-table/silke-table.scss +27 -13
  193. package/src/components/silke-table/silke-table.tsx +13 -3
  194. package/src/components/silke-table/table-row.tsx +6 -1
  195. package/src/components/silke-table/table-types.ts +1 -1
  196. package/src/components/silke-tabs/silke-tabs.mdx +2 -2
  197. package/src/components/silke-tag/silke-tag.mdx +38 -79
  198. package/src/components/silke-tag/silke-tag.scss +12 -5
  199. package/src/components/silke-tag/silke-tag.tsx +1 -0
  200. package/src/components/silke-text/silke-text.mdx +50 -48
  201. package/src/components/silke-text/silke-text.scss +4 -2
  202. package/src/components/silke-text/silke-title.scss +29 -15
  203. package/src/components/silke-text-field/silke-text-field-outline.tsx +9 -1
  204. package/src/components/silke-text-field/silke-text-field.mdx +67 -71
  205. package/src/components/silke-text-field/silke-text-field.scss +4 -3
  206. package/src/components/silke-text-field/silke-text-field.tsx +16 -16
  207. package/src/components/silke-text-field/text-field-context.tsx +7 -2
  208. package/src/components/silke-tile/index.ts +0 -1
  209. package/src/components/silke-tile/silke-tile.mdx +6 -63
  210. package/src/components/silke-tile/silke-tile.tsx +4 -4
  211. package/src/components/silke-toggle/silke-toggle.mdx +5 -29
  212. package/src/components/silke-toggle/silke-toggle.scss +3 -2
  213. package/src/components/silke-toolbar/silke-toolbar.mdx +6 -6
  214. package/src/components/silke-tooltip/silke-definition-tooltip.tsx +3 -0
  215. package/src/components/silke-tooltip/silke-icon-tooltip.tsx +5 -2
  216. package/src/components/silke-tooltip/silke-tooltip.mdx +16 -34
  217. package/src/components/silke-tooltip/silke-tooltip.scss +3 -2
  218. package/src/components/silke-tooltip/silke-tooltip.tsx +15 -4
  219. package/src/components/silke-upload-field/silke-upload-field.tsx +1 -0
  220. package/src/components/silke-variables-wrapper/silke-variables-wrapper-form.tsx +30 -50
  221. package/src/components/silke-variables-wrapper/silke-variables-wrapper.mdx +56 -15
  222. package/src/components/silke-variables-wrapper/silke-variables-wrapper.scss +0 -2
  223. package/src/components/silke-variables-wrapper/silke-variables-wrapper.tsx +107 -44
  224. package/src/docs/data/flux/store.ts +0 -1
  225. package/src/hooks/drag-and-drop/use-drop.tsx +1 -1
  226. package/src/hooks/hooks.mdx +3 -3
  227. package/src/icons.tsx +104 -4
  228. package/src/index.mdx +30 -31
  229. package/src/playground.mdx +58 -47
  230. package/src/silke-theme-provider.tsx +1 -0
  231. package/src/styles/core.scss +10 -14
  232. package/dist/silke/src/components/silke-steps/index.d.ts +0 -1
  233. package/dist/silke/src/components/silke-steps/silke-steps.d.ts +0 -12
  234. package/dist/silke/src/components/silke-tile/silke-tile-select.d.ts +0 -26
  235. package/src/components/silke-steps/index.ts +0 -1
  236. package/src/components/silke-steps/silke-steps.mdx +0 -60
  237. package/src/components/silke-steps/silke-steps.scss +0 -14
  238. package/src/components/silke-steps/silke-steps.tsx +0 -53
  239. package/src/components/silke-tile/silke-tile-select.tsx +0 -100
@@ -31,7 +31,7 @@ export function SilkeCardGrid({
31
31
  export function SilkeSkeletonCard() {
32
32
  return (
33
33
  <SilkeBox column gap="s" className={styles.card}>
34
- <SilkeBox className={styles.imageWrapper} overflow="hidden" column bg="surface-2">
34
+ <SilkeBox className={styles.imageWrapper} column bg="surface-2">
35
35
  <div className={styles.img} />
36
36
  </SilkeBox>
37
37
  <SilkeBox rounded="tiny" gap="m" column flex bg="surface-2" height="s" />
@@ -6,25 +6,25 @@ const [checked, setChecked] = React.useState(1);
6
6
  {ipsum.list(5, (key) => (
7
7
  <SilkeCard
8
8
  key={key}
9
- colorBackdrop={key % 3 === 0 ? "neutral-5" : true}
9
+ colorBackdrop={key % 3 === 0 ? 'neutral-5' : true}
10
10
  title={ipsum.name()}
11
11
  subTitle={ipsum.name(5)}
12
12
  image={ipsum.image()}
13
13
  checked={checked === key}
14
14
  onCheck={(doCheck) => setChecked(doCheck ? key : -1)}
15
15
  tags={[
16
- { label: "This is a tag" },
17
- { label: "This is a tag with a veeeeeeeery long label" },
18
- { label: "This is a tag with a veeeeeeeery long label" },
16
+ { label: 'This is a tag' },
17
+ { label: 'This is a tag with a veeeeeeeery long label' },
18
+ { label: 'This is a tag with a veeeeeeeery long label' },
19
19
  ]}
20
20
  tagsTop={
21
21
  key % 3 === 0
22
- ? [{ label: "Template", size: "tiny" }]
22
+ ? [{ label: 'Template', size: 'tiny' }]
23
23
  : key % 2 === 0
24
- ? [{ icon: "project-plan", color: "yellow", kind: "primary" }]
25
- : []
24
+ ? [{ icon: 'project-plan', color: 'yellow', kind: 'primary' }]
25
+ : []
26
26
  }
27
- menu={[{ label: "Item 1" }, { label: "Item 2" }]}
27
+ menu={[{ label: 'Item 1' }, { label: 'Item 2' }]}
28
28
  />
29
29
  ))}
30
30
  </SilkeCardGrid>;
@@ -47,7 +47,7 @@ const [checked, setChecked] = React.useState(1);
47
47
  ipsum.image(),
48
48
  ipsum.image(),
49
49
  ]}
50
- menu={[{ label: "Item 1" }, { label: "Item 2" }]}
50
+ menu={[{ label: 'Item 1' }, { label: 'Item 2' }]}
51
51
  />
52
52
  ))}
53
53
  </SilkeCardGrid>
@@ -68,10 +68,10 @@ const [checked, setChecked] = React.useState(0);
68
68
  checked={checked === key}
69
69
  tagsTop={
70
70
  key % 3 === 0
71
- ? [{ icon: "tooltip", kind: "primary" }]
71
+ ? [{ icon: 'tooltip', kind: 'primary' }]
72
72
  : key % 2 === 0
73
- ? [{ icon: "project-plan", color: "yellow", kind: "primary" }]
74
- : []
73
+ ? [{ icon: 'project-plan', color: 'yellow', kind: 'primary' }]
74
+ : []
75
75
  }
76
76
  onCheck={(doCheck) => setChecked(doCheck ? key : -1)}
77
77
  />
@@ -90,7 +90,7 @@ const [checked, setChecked] = React.useState(0);
90
90
  subTitle={ipsum.name(5)}
91
91
  image={ipsum.image()}
92
92
  text={ipsum.text()}
93
- onClick={() => console.log("Focused")}
93
+ onClick={() => console.log('Focused')}
94
94
  />
95
95
  ))}
96
96
  </SilkeCardGrid>
@@ -105,7 +105,7 @@ const [selected, setSelected] = React.useState(1);
105
105
  {ipsum.list((key) => (
106
106
  <SilkeCard
107
107
  key={key}
108
- selected={key == selected}
108
+ selected={key === selected}
109
109
  image={ipsum.image()}
110
110
  title={ipsum.name()}
111
111
  subTitle={ipsum.name(5)}
@@ -130,23 +130,13 @@ const [isLoading, setLoading] = React.useState(true);
130
130
 
131
131
  <SilkeCardGrid loading={isLoading}>
132
132
  {ipsum.list(3, (key) => (
133
- <SilkeCard
134
- key={key}
135
- image={ipsum.image()}
136
- title={ipsum.name()}
137
- subTitle={ipsum.name(5)}
138
- />
133
+ <SilkeCard key={key} image={ipsum.image()} title={ipsum.name()} subTitle={ipsum.name(5)} />
139
134
  ))}
140
135
  </SilkeCardGrid>
141
136
 
142
137
  <SilkeCardGrid small loading={isLoading}>
143
138
  {ipsum.list(3, (key) => (
144
- <SilkeCard
145
- key={key}
146
- image={ipsum.image()}
147
- title={ipsum.name()}
148
- subTitle={ipsum.name(5)}
149
- />
139
+ <SilkeCard key={key} image={ipsum.image()} title={ipsum.name()} subTitle={ipsum.name(5)} />
150
140
  ))}
151
141
  </SilkeCardGrid>
152
142
  </SilkeBox>;
@@ -98,6 +98,7 @@ body {
98
98
  .imageWrapper {
99
99
  aspect-ratio: var(--silke-card-aspect-ratio);
100
100
  border-radius: var(--silke-card-border-radius);
101
+ overflow: hidden;
101
102
  img {
102
103
  /** Prevent dragging of image */
103
104
  user-select: none;
@@ -134,14 +135,19 @@ body {
134
135
  }
135
136
 
136
137
  .cardText .title {
137
- font-family: "Aeonik", "Source Sans Pro", sans-serif;
138
+ font-family: "Roboto Flex", sans-serif;
139
+ font-variation-settings: var(--font-variation-settings-brand);
138
140
  line-height: 1;
139
141
  }
140
142
 
143
+ .overflowHidden {
144
+ overflow: hidden;
145
+ }
146
+
141
147
  .grid {
142
148
  --max-columns: 10;
143
149
  --grid-gap: 24px;
144
- --min-card-width: 240px;
150
+ --min-card-width: 228px;
145
151
 
146
152
  display: grid !important;
147
153
  gap: var(--grid-gap);
@@ -165,7 +171,8 @@ body {
165
171
  }
166
172
 
167
173
  .title{
168
- font-family: "Source Sans Pro", sans-serif;
174
+ font-family: "Roboto Flex", sans-serif;
175
+ font-variation-settings: var(--font-variation-settings);
169
176
  font-size: 12px;
170
177
  }
171
178
 
@@ -139,15 +139,18 @@ export const SilkeCard = React.forwardRef(
139
139
  {(tags || customTags) && (
140
140
  <SilkeBox gap="xxs" className={styles.tags}>
141
141
  {customTags}
142
- {tags?.map((tagContent, i) => (
143
- <SilkeTag key={i} kind="secondary" {...tagContent} />
144
- ))}
142
+ {tags?.map((tagContent, i) => <SilkeTag key={i} kind="secondary" {...tagContent} />)}
145
143
  </SilkeBox>
146
144
  )}
147
145
  </SilkeBox>
148
146
  <SilkeBox gap="m" column flex>
149
147
  <SilkeBox vAlign="center">
150
- <SilkeBox flex column overflow="hidden" gap="xs" className={styles.cardText}>
148
+ <SilkeBox
149
+ flex
150
+ column
151
+ gap="xs"
152
+ className={`${styles.cardText} ${styles.overflowHidden}`}
153
+ >
151
154
  <SilkeText size="base" flex overflow className={styles.title}>
152
155
  {title}
153
156
  </SilkeText>
@@ -3,18 +3,9 @@
3
3
  ```js
4
4
  const [checked, setChecked] = React.useState(false);
5
5
  <>
6
- <SilkeCheckbox
7
- label="Checkbox not checked"
8
- value={checked}
9
- onChange={setChecked}
10
- />
6
+ <SilkeCheckbox label="Checkbox not checked" value={checked} onChange={setChecked} />
11
7
  <SilkeCheckbox label="Checkbox checked" value={true} />
12
- <SilkeCheckbox
13
- label="Checkbox disabled"
14
- disabled
15
- value={checked}
16
- onChange={setChecked}
17
- />
8
+ <SilkeCheckbox label="Checkbox disabled" disabled value={checked} onChange={setChecked} />
18
9
  <SilkeCheckbox label="Checkbox checked and disabled" value={true} disabled />
19
10
  <SilkeCheckbox
20
11
  label="Required checkbox with error"
@@ -2,15 +2,9 @@
2
2
 
3
3
  ```js
4
4
  <SilkeBox column gap>
5
- <SilkeCodeSnippet
6
- code={`console.log('hello world');`}
7
- language="javascript"
8
- />
5
+ <SilkeCodeSnippet code={`console.log('hello world');`} language="javascript" />
9
6
 
10
- <SilkeCodeSnippet
11
- code={`console.log('how to copy this?');`}
12
- language="javascript"
13
- />
7
+ <SilkeCodeSnippet code={`console.log('how to copy this?');`} language="javascript" />
14
8
 
15
9
  <SilkeCodeSnippet
16
10
  code={`There is no point in showing line numbers for a single-line example`}
@@ -25,12 +19,12 @@
25
19
  ```js
26
20
  <SilkeCodeSnippet
27
21
  code={[
28
- "{/* This is the code for the above example */}",
29
- "<SilkeCodeSnippet",
22
+ '{/* This is the code for the above example */}',
23
+ '<SilkeCodeSnippet',
30
24
  " code={`console.log('hello world');`}",
31
25
  ' language="javascript"',
32
- "/>",
33
- ].join("\n")}
26
+ '/>',
27
+ ].join('\n')}
34
28
  language="tsx"
35
29
  lineNumbers
36
30
  />
@@ -38,14 +32,25 @@
38
32
 
39
33
  ## With extra buttons
40
34
 
41
- ```js
42
- const [code, setCode] = React.useState('// TODO make SilkeCodeSnippet editable so it can be used in docs')
43
-
44
- <SilkeCodeSnippet
45
- buttons={<>
46
- <SilkeButton label="update" onClick={() => setCode('time: ' + Date.now())} />
47
- <SilkeButton label="random" onClick={() => setCode('key: ' + Math.floor(Math.random() * 100000000000))} />
48
- </>}
49
- code={code}
50
- />
35
+ ```jsx
36
+ () => {
37
+ const [code, setCode] = React.useState(
38
+ '// TODO make SilkeCodeSnippet editable so it can be used in docs',
39
+ );
40
+
41
+ return (
42
+ <SilkeCodeSnippet
43
+ buttons={
44
+ <>
45
+ <SilkeButton label="update" onClick={() => setCode('time: ' + Date.now())} />
46
+ <SilkeButton
47
+ label="random"
48
+ onClick={() => setCode('key: ' + Math.floor(Math.random() * 100000000000))}
49
+ />
50
+ </>
51
+ }
52
+ code={code}
53
+ />
54
+ );
55
+ };
51
56
  ```
@@ -5,8 +5,8 @@
5
5
  ```js
6
6
  const [value, setValue] = React.useState({
7
7
  // primary: 'rgba(0, 150, 136, 1)',
8
- accent: "rgba(233, 30, 99, 1)",
9
- bg: "rgba(250, 250, 250, 1)",
8
+ accent: 'rgba(233, 30, 99, 1)',
9
+ bg: 'rgba(250, 250, 250, 1)',
10
10
  text: false,
11
11
  });
12
12
 
@@ -27,10 +27,22 @@ export function getColorVariableValue(
27
27
  return variables[varName];
28
28
  }
29
29
 
30
+ export function getVariableValueV2(
31
+ color: string,
32
+ variables: { key: string; value?: string }[],
33
+ ): string | undefined {
34
+ const varName = color.trim().replace(/^var\(--vev-(.*)\)$/, '$1');
35
+ return variables.find((v) => v.key === varName)?.value;
36
+ }
37
+
30
38
  export function isColorVariable(color: string): boolean {
31
39
  return !!color && /^var\(/.test(color.trim());
32
40
  }
33
41
 
42
+ export function isVariableV2(color: string): boolean {
43
+ return !!color && color?.startsWith('var(--vev-');
44
+ }
45
+
34
46
  export function rgbaToString(rgba: RGBA | number[] | string): string {
35
47
  if (!rgba) {
36
48
  return '';
@@ -1,23 +1,31 @@
1
1
  import { RGBA } from '@vev/utils';
2
2
  import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { SilkeBox } from '../silke-box';
4
- import { SilkeText } from '../silke-text';
5
4
  import tinycolor from 'tinycolor2';
6
5
  import { SilkeSelectField } from '../silke-select-field';
7
6
  import { SilkeTextField } from '../silke-text-field';
8
- import { hexToRgb } from './color';
7
+ import { hexToRgb, isVariableV2 } from './color';
9
8
  import { clamp, round } from 'lodash';
10
9
  import { SilkeCssNumberField } from '../silke-css-number-field';
10
+ import { SilkeVariablesWrapper } from '../silke-variables-wrapper';
11
11
 
12
12
  type ColorInfoProps = {
13
13
  rgba: RGBA;
14
+ variableKey?: string;
14
15
  noTransparency?: boolean;
15
16
  onChange: (color: RGBA) => void;
17
+ onVariableChange: (key: string) => void;
16
18
  };
17
19
 
18
20
  const rgbLabels = ['r', 'g', 'b'] as (keyof RGBA)[];
19
21
 
20
- export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
22
+ export function ColorInfo({
23
+ rgba,
24
+ variableKey,
25
+ noTransparency,
26
+ onChange,
27
+ onVariableChange,
28
+ }: ColorInfoProps) {
21
29
  const [format, setFormat] = useState<string>('HEX');
22
30
  const [tmpHex, setTmpHex] = useState<string | null>(null);
23
31
  const [tmpRgb, setTmpRgb] = useState(rgba);
@@ -25,6 +33,7 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
25
33
  const [tmpA, setTempA] = useState(
26
34
  (rgba?.a === 0 ? rgba.a : rgba?.a ? Math.round(rgba.a * 100) : 100).toString(),
27
35
  );
36
+ const isVariable = !!variableKey;
28
37
 
29
38
  useEffect(() => {
30
39
  if (!hasFocus) {
@@ -47,6 +56,10 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
47
56
 
48
57
  const handleHex = useCallback(
49
58
  (hex: string) => {
59
+ if (isVariableV2(hex)) {
60
+ onVariableChange(hex);
61
+ return;
62
+ }
50
63
  setTmpHex(hex);
51
64
  onChange({ ...rgba, ...hexToRgb(hex.replace('#', '')) });
52
65
  },
@@ -63,17 +76,23 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
63
76
  { value: 'HEX', label: 'HEX' },
64
77
  { value: 'RGB', label: 'RGB' },
65
78
  ]}
79
+ disabled={isVariable}
66
80
  />
67
81
  </SilkeBox>
68
82
 
69
83
  <SilkeBox style={{ width: 82 }} flex gap="s">
70
84
  {format === 'HEX' ? (
71
- <SilkeTextField
85
+ <SilkeVariablesWrapper
86
+ component={SilkeTextField}
87
+ variableType="color"
72
88
  flex
89
+ fullWidthWrapper
73
90
  value={
74
- typeof tmpHex === 'string'
75
- ? tmpHex.toUpperCase()
76
- : tinycolor(rgba).toHexString().toUpperCase()
91
+ isVariable
92
+ ? variableKey
93
+ : typeof tmpHex === 'string'
94
+ ? tmpHex.toUpperCase()
95
+ : tinycolor(rgba).toHexString().toUpperCase()
77
96
  }
78
97
  onChange={handleHex}
79
98
  onBlur={() => setTmpHex(null)}
@@ -101,7 +120,7 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
101
120
  onFocus={() => setHasFocus(true)}
102
121
  onBlur={() => setHasFocus(false)}
103
122
  onChange={handleOpacity}
104
- disabled={noTransparency}
123
+ disabled={noTransparency || isVariable}
105
124
  />
106
125
  </SilkeBox>
107
126
  </SilkeBox>
@@ -37,7 +37,7 @@ export function SilkeColorPickerButton({
37
37
  {...rest}
38
38
  ref={ref}
39
39
  size={buttonSize}
40
- kind={rest.kind || 'tertiary'}
40
+ kind={rest.kind || 'secondary'}
41
41
  value={value}
42
42
  onClick={() => setOpen(true)}
43
43
  />
@@ -7,15 +7,15 @@ pick color plz
7
7
  ```js
8
8
  const [value, setValue] = React.useState(``);
9
9
  const [variables, setVariabels] = React.useState({
10
- primary: "rgba(0, 150, 136, 1)",
11
- accent: "rgba(233, 30, 99, 1)",
12
- bg: "rgba(250, 250, 250, 1)",
10
+ primary: 'rgba(0, 150, 136, 1)',
11
+ accent: 'rgba(233, 30, 99, 1)',
12
+ bg: 'rgba(250, 250, 250, 1)',
13
13
  text: false,
14
14
  });
15
15
  const handleAddVariable = () => {
16
16
  setVariabels({
17
17
  ...variables,
18
- ["--swatch" + Object.keys(variables).length]: value,
18
+ ['--swatch' + Object.keys(variables).length]: value,
19
19
  });
20
20
  };
21
21
 
@@ -29,15 +29,15 @@ const handleAddVariable = () => {
29
29
  ```js
30
30
  const [value, setValue] = React.useState(`rgba(10, 10, 10, 100`);
31
31
  const [variables, setVariabels] = React.useState({
32
- primary: "rgba(0, 150, 136, 1)",
33
- accent: "rgba(233, 30, 99, 1)",
34
- bg: "rgba(250, 250, 250, 1)",
32
+ primary: 'rgba(0, 150, 136, 1)',
33
+ accent: 'rgba(233, 30, 99, 1)',
34
+ bg: 'rgba(250, 250, 250, 1)',
35
35
  text: false,
36
36
  });
37
37
  const handleAddVariable = () => {
38
38
  setVariabels({
39
39
  ...variables,
40
- ["--swatch" + Object.keys(variables).length]: value,
40
+ ['--swatch' + Object.keys(variables).length]: value,
41
41
  });
42
42
  };
43
43
  <SilkeCSSContext variables={variables} onVariableAdd={handleAddVariable}>
@@ -48,11 +48,7 @@ const handleAddVariable = () => {
48
48
 
49
49
  <SilkeColorPickerButton value={value} size="s" onChange={setValue} />
50
50
 
51
- <SilkeColorPickerButton
52
- value={value}
53
- label="Some random label"
54
- onChange={setValue}
55
- />
51
+ <SilkeColorPickerButton value={value} label="Some random label" onChange={setValue} />
56
52
  </SilkeBox>
57
53
  </SilkeCSSContext>;
58
54
  ```
@@ -8,7 +8,14 @@ import { SilkeSwatches } from '../silke-color-swatches';
8
8
  import { useSilkeCSSContext } from '../silke-css-number-field';
9
9
  import { SilkeModal, SilkeModalActions, SilkeModalContent } from '../silke-modal';
10
10
  import { TextFieldContext } from '../silke-text-field';
11
- import { getColorVariableValue, hsvToRgb, isColorVariable, rgbToHsv } from './color';
11
+ import {
12
+ getColorVariableValue,
13
+ getVariableValueV2,
14
+ hsvToRgb,
15
+ isColorVariable,
16
+ isVariableV2,
17
+ rgbToHsv,
18
+ } from './color';
12
19
  import styles from './color-picker.scss';
13
20
  import { ColorInfo } from './silke-color-info';
14
21
  import { ColorSpace } from './silke-color-space';
@@ -41,8 +48,9 @@ export function SilkeColorPicker({
41
48
  const dragging = useRef(false);
42
49
  const [eyeDropperActive, setEyeDropperActive] = useState(false);
43
50
  const [showEyeDropUnsupported, setShowEyeDropUnsupported] = useState(false);
44
- const { variables } = useSilkeCSSContext();
45
- const isValueVariable = isColorVariable(value);
51
+ const { variables, variablesv2 } = useSilkeCSSContext();
52
+ const isValueVariableV2 = isVariableV2(value);
53
+ const isValueVariable = isColorVariable(value) && !isValueVariableV2;
46
54
 
47
55
  const rgba = React.useMemo(() => {
48
56
  if (!value) {
@@ -51,9 +59,12 @@ export function SilkeColorPicker({
51
59
  if (isValueVariable) {
52
60
  return tinycolor(getColorVariableValue(value, variables)).toRgb();
53
61
  }
62
+ if (isValueVariableV2) {
63
+ return tinycolor(getVariableValueV2(value, variablesv2)).toRgb();
64
+ }
54
65
 
55
66
  return tinycolor(value).toRgb();
56
- }, [value, isValueVariable, variables]);
67
+ }, [value, isValueVariable, isValueVariableV2, variables, variablesv2]);
57
68
 
58
69
  const [hue, setHue] = React.useState(0);
59
70
 
@@ -123,12 +134,18 @@ export function SilkeColorPicker({
123
134
  {!noTransparency && <SilkeOpacitySlider rgba={rgba} onChange={handleChange} />}
124
135
  </SilkeBox>
125
136
  </SilkeBox>
126
- <ColorInfo rgba={rgba} noTransparency={noTransparency} onChange={handleChange} />
137
+ <ColorInfo
138
+ rgba={rgba}
139
+ variableKey={isValueVariableV2 ? value : undefined}
140
+ noTransparency={noTransparency}
141
+ onChange={handleChange}
142
+ onVariableChange={onChange}
143
+ />
127
144
  {!(hidePalettes && hideSwatches) && (
128
145
  <SilkeSwatches
129
146
  onSelect={handleChange}
130
147
  selected={value}
131
- mode={isValueVariable ? 'palettes' : 'swatches'}
148
+ mode={isValueVariable ? 'palettes' : isValueVariableV2 ? 'variables' : 'swatches'}
132
149
  hidePalettes={hidePalettes}
133
150
  hideSwatches={hideSwatches}
134
151
  hideVariables={noVariables}
@@ -21,7 +21,7 @@ export const SilkeColorSwatchButton = React.forwardRef(
21
21
  <SilkeButton
22
22
  {...rest}
23
23
  ref={ref}
24
- kind={selected ? 'tertiary' : rest.kind || 'ghost'}
24
+ kind={selected ? 'secondary' : rest.kind || 'ghost'}
25
25
  icon={
26
26
  <SilkeBox size={buttonSize} pad={rest.label ? 's' : 'xs'}>
27
27
  <div
@@ -11,6 +11,7 @@ import { DEFAULT_SWATCHES, isDefaultSwatch, isGradient, LABEL } from './utils';
11
11
  import { SilkeColorSwatchButton } from './silke-color-swatch-button';
12
12
 
13
13
  export type SilkeSwatchType = 'color' | 'palette' | 'gradient';
14
+ export type ModeType = 'swatches' | 'palettes' | 'variables';
14
15
 
15
16
  interface BaseProps<T extends string> {
16
17
  swatches?: string[];
@@ -20,7 +21,7 @@ interface BaseProps<T extends string> {
20
21
  hideSwatches?: boolean;
21
22
  hideVariables?: boolean;
22
23
  type?: SilkeSwatchType;
23
- mode?: 'swatches' | 'palettes';
24
+ mode?: ModeType;
24
25
  onSelect: (color: T, type: 'color' | 'gradient' | 'variable') => void;
25
26
  }
26
27
 
@@ -44,7 +45,7 @@ export function SilkeSwatches({
44
45
  onVariableAdd,
45
46
  onVariableDelete,
46
47
  } = useSilkeCSSContext();
47
- const [mode, setMode] = useState<'swatches' | 'palettes' | 'variables'>(
48
+ const [mode, setMode] = useState<ModeType>(
48
49
  desiredMode || (hidePalettes ? 'swatches' : hideSwatches ? 'palettes' : 'swatches'),
49
50
  );
50
51
 
@@ -60,7 +61,7 @@ export function SilkeSwatches({
60
61
  const options = [
61
62
  { label: 'Swatches', value: 'swatches' },
62
63
  { label: 'Palettes', value: 'palettes' },
63
- ] as { label: string; value: 'swatches' | 'palettes' | 'variables' }[];
64
+ ] as { label: string; value: ModeType }[];
64
65
  if (colorVariables?.length > 0) options.push({ label: 'Variables', value: 'variables' });
65
66
  return options;
66
67
  }, [colorVariables]);
@@ -111,8 +112,8 @@ export function SilkeSwatches({
111
112
  isGradient(value)
112
113
  ? 'gradient'
113
114
  : value.startsWith('var(')
114
- ? 'variable'
115
- : 'color',
115
+ ? 'variable'
116
+ : 'color',
116
117
  )
117
118
  }
118
119
  />
@@ -144,10 +145,12 @@ export function SilkeSwatches({
144
145
  </SilkeBox>
145
146
  )}
146
147
  {!hideVariables && mode === 'variables' && (
147
- <SilkeBox column gap="xs">
148
+ <SilkeBox column gap="xs" scroll="show" style={{ maxHeight: '250px' }}>
148
149
  {colorVariables.map((v) => (
149
150
  <SilkeBox key={v.key} vAlign="center" hAlign="spread">
150
- <SilkeText tag="small">{v.name}</SilkeText>
151
+ <SilkeText tag="small" overflow>
152
+ {v.name}
153
+ </SilkeText>
151
154
  <SilkeBox hAlign="end">
152
155
  <SilkeColorSwatchButton
153
156
  value={v.value || ''}
@@ -0,0 +1,2 @@
1
+ export * from './silke-conditions-input';
2
+ export * from './types';