@vev/silke 1.0.16 → 1.0.17

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 (58) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/chunk-SOFGXMET.js +22 -0
  3. package/dist/{chunk-LAB2YEXC.js.map → chunk-SOFGXMET.js.map} +3 -3
  4. package/dist/index.js +43 -8
  5. package/dist/index.js.LEGAL.txt +6 -10
  6. package/dist/index.js.map +4 -4
  7. package/dist/{silke-code-editor-WEBZ7JXL.js → silke-code-editor-3Y2KM5KB.js} +3 -3
  8. package/dist/styles.css +411 -482
  9. package/package.json +4 -4
  10. package/src/components/silke-autocomplete-field/autocomplete-item.tsx +33 -7
  11. package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +6 -2
  12. package/src/components/silke-autocomplete-field/autocomplete-types.ts +4 -0
  13. package/src/components/silke-autocomplete-field/silke-autocomplete-field.mdx +67 -24
  14. package/src/components/silke-autocomplete-field/silke-autocomplete-field.scss +32 -13
  15. package/src/components/silke-autocomplete-field/silke-autocomplete-field.spec.tsx +24 -109
  16. package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +304 -220
  17. package/src/components/silke-box/silke-box.scss +9 -10
  18. package/src/components/silke-box/silke-box.tsx +9 -0
  19. package/src/components/silke-button/silke-button.scss +3 -3
  20. package/src/components/silke-color-picker/silke-color-info.tsx +2 -18
  21. package/src/components/silke-context-menu/silke-context-menu.tsx +0 -1
  22. package/src/components/silke-css-number-field/silke-css-number-field.mdx +43 -4
  23. package/src/components/silke-css-number-field/silke-css-number-field.scss +47 -14
  24. package/src/components/silke-css-number-field/silke-css-number-field.tsx +114 -186
  25. package/src/components/silke-css-number-field/utils.ts +25 -0
  26. package/src/components/silke-drawer/silke-drawer.tsx +0 -14
  27. package/src/components/silke-form/silke-form.tsx +1 -1
  28. package/src/components/silke-form-schema/fields/array-field.tsx +1 -1
  29. package/src/components/silke-form-schema/fields/utils/generate-title.ts +5 -4
  30. package/src/components/silke-image/silke-image.scss +2 -2
  31. package/src/components/silke-modal/silke-modal.tsx +11 -2
  32. package/src/components/silke-navigation-link/silke-navigation-link.scss +12 -2
  33. package/src/components/silke-navigation-link/silke-navigation-link.tsx +21 -17
  34. package/src/components/silke-notification/silke-notification.scss +1 -1
  35. package/src/components/silke-overflow-menu/silke-overflow-menu.tsx +1 -2
  36. package/src/components/silke-popover/silke-popover.tsx +1 -20
  37. package/src/components/silke-select-field/silke-select-field.mdx +137 -7
  38. package/src/components/silke-select-field/silke-select-field.spec.tsx +44 -126
  39. package/src/components/silke-sortable-list/silke-nested-sortable-item.tsx +17 -2
  40. package/src/components/silke-sortable-list/silke-nested-sortable-list.tsx +6 -2
  41. package/src/components/silke-sortable-list/silke-nested-sortable-utils.ts +6 -0
  42. package/src/components/silke-table/silke-table.tsx +1 -1
  43. package/src/components/silke-tag/silke-tag.tsx +1 -1
  44. package/src/components/silke-text-field/silke-text-field-item.tsx +12 -7
  45. package/src/components/silke-text-field/silke-text-field-outline.tsx +39 -42
  46. package/src/components/silke-text-field/silke-text-field.mdx +73 -6
  47. package/src/components/silke-text-field/silke-text-field.scss +153 -247
  48. package/src/components/silke-text-field/silke-text-field.tsx +4 -3
  49. package/src/components/silke-tooltip/silke-icon-tooltip.tsx +2 -1
  50. package/src/docs/app.tsx +9 -16
  51. package/src/hooks/form/use-form-field.ts +1 -1
  52. package/src/hooks/index.ts +1 -0
  53. package/src/hooks/use-uniq-id.ts +6 -0
  54. package/src/icons.tsx +8 -2
  55. package/dist/chunk-LAB2YEXC.js +0 -22
  56. /package/dist/{chunk-LAB2YEXC.js.LEGAL.txt → chunk-SOFGXMET.js.LEGAL.txt} +0 -0
  57. /package/dist/{silke-code-editor-WEBZ7JXL.js.LEGAL.txt → silke-code-editor-3Y2KM5KB.js.LEGAL.txt} +0 -0
  58. /package/dist/{silke-code-editor-WEBZ7JXL.js.map → silke-code-editor-3Y2KM5KB.js.map} +0 -0
@@ -138,16 +138,6 @@ button.box {
138
138
  padding-right: $size;
139
139
  }
140
140
 
141
- .height-#{$name} {
142
- height: #{$size * 2};
143
- min-height: #{$size * 2};
144
- }
145
-
146
- .width-#{$name} {
147
- width: #{$size * 2};
148
- min-width: #{$size * 2};
149
- }
150
-
151
141
  .gap-#{$name} {
152
142
  gap: $size;
153
143
  }
@@ -165,6 +155,15 @@ button.box {
165
155
  width: $size;
166
156
  min-width: $size;
167
157
  }
158
+
159
+ .minHeight-#{$name} {
160
+ min-height: #{$size};
161
+ }
162
+
163
+ .minWidth-#{$name} {
164
+ min-width: #{$size};
165
+ }
166
+
168
167
  }
169
168
 
170
169
  .overflow-hidden{
@@ -53,6 +53,10 @@ type BaseProps = {
53
53
  height?: BoxSize;
54
54
  /** Width of the box (x2 of the spaceing, example: 'm' = 32px wide) */
55
55
  width?: BoxSize;
56
+ /** Width of the box (x2 of the spaceing, example: 'm' = 32px wide) */
57
+ minHeight?: BoxSize;
58
+ /** Width of the box (x2 of the spaceing, example: 'm' = 32px wide) */
59
+ minWidth?: BoxSize;
56
60
  /** Background color */
57
61
  bg?: SilkeColor;
58
62
  /** Background color on hover */
@@ -190,6 +194,8 @@ function BoxComp(
190
194
  size,
191
195
  width = size,
192
196
  height = size,
197
+ minWidth,
198
+ minHeight,
193
199
  children,
194
200
  color,
195
201
  colorHover,
@@ -240,6 +246,9 @@ function BoxComp(
240
246
  if (width) cl.push(styles['width-' + width]);
241
247
  if (height) cl.push(styles['height-' + height]);
242
248
 
249
+ if (minWidth) cl.push(styles['minWidth-' + minWidth]);
250
+ if (minHeight) cl.push(styles['minHeight-' + minHeight]);
251
+
243
252
  if (color) cl.push('color-' + color);
244
253
  if (colorHover) cl.push('color-hover-' + colorHover);
245
254
  if (bg) cl.push('bg-' + bg);
@@ -148,9 +148,9 @@ body {
148
148
 
149
149
  }
150
150
 
151
- .icon {
152
- font-size: 14px;
153
- }
151
+ // .icon {
152
+ // font-size: 14px;
153
+ // }
154
154
 
155
155
  @each $name, $size in $sizes {
156
156
  .button.#{$name} {
@@ -63,26 +63,10 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
63
63
  { value: 'HEX', label: 'HEX' },
64
64
  { value: 'RGB', label: 'RGB' },
65
65
  ]}
66
- renderItem={({ item, selected }) => {
67
- return (
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'}>
77
- {item.label}
78
- </SilkeText>
79
- </SilkeBox>
80
- );
81
- }}
82
66
  />
83
67
  </SilkeBox>
84
68
 
85
- <SilkeBox style={{ width: 88 }} flex gap="s">
69
+ <SilkeBox style={{ width: 82 }} flex gap="s">
86
70
  {format === 'HEX' ? (
87
71
  <SilkeTextField
88
72
  flex
@@ -109,7 +93,7 @@ export function ColorInfo({ rgba, noTransparency, onChange }: ColorInfoProps) {
109
93
  )}
110
94
  </SilkeBox>
111
95
 
112
- <SilkeBox style={{ width: 52 }}>
96
+ <SilkeBox style={{ width: 62 }}>
113
97
  <SilkeCssNumberField
114
98
  min={0}
115
99
  max={100}
@@ -66,7 +66,6 @@ export function SilkeContextMenu({
66
66
  onRequestClose?.();
67
67
  }}
68
68
  {...rest}
69
- focusRef={boxRef}
70
69
  >
71
70
  <ButtonContext size="base">
72
71
  {items && (
@@ -9,11 +9,50 @@ You can wrap the filed in a css context to enable automatic convertion between f
9
9
  const [value, setValue] = React.useState('20px');
10
10
  const formats = ['px', '%', 'em', 'vh', 'vw']
11
11
 
12
- <SilkeBox column>
12
+ <SilkeBox column gap="s">
13
13
  <h1>{value}</h1>
14
- <SilkeCssNumberField label="Label" value={value} size="small" formats={formats} onChange={setValue} />
15
- <SilkeCssNumberField value={value} label="Label" size="base" formats={formats} onChange={setValue}/>
16
- <SilkeCssNumberField label="Label" value={value} inline formats={formats} onChange={setValue} />
14
+ {["default", "zombie", "ghost"].map((kind) => (
15
+ <SilkeBox gap="s" key={kind} style={{width: 380}}>
16
+ <SilkeCssNumberField kind={kind} label="Label" allowAuto value={value} size="xs" formats={formats} onChange={setValue} />
17
+ <SilkeCssNumberField kind={kind} label="Label" allowAuto value={value} size="s" formats={formats} onChange={setValue} />
18
+ <SilkeCssNumberField kind={kind} value={value} label="Label" formats={formats} onChange={setValue}/>
19
+ <SilkeCssNumberField kind={kind} label="Label" value={value} inline formats={formats} onChange={setValue} />
20
+ </SilkeBox>
21
+ ))}
22
+ </SilkeBox>
23
+ ```
24
+
25
+ ```js
26
+ const [value, setValue] = React.useState('20px');
27
+ const formats = ['px', '%', 'em', 'vh', 'vw']
28
+
29
+ <TextFieldContext inline="label-inside" size="xs">
30
+ <SilkeBox column gap="s">
31
+ <h1>{value}</h1>
32
+ {["default", "zombie", "ghost"].map((kind) => (
33
+ <SilkeBox gap="s" key={kind} style={{width: 256}}>
34
+ <SilkeCssNumberField kind={kind} label="Label" allowAuto value={value} formats={formats} onChange={setValue} />
35
+ <SilkeCssNumberField kind={kind} value={value} label="Label" formats={formats} onChange={setValue}/>
36
+ <SilkeCssNumberField kind={kind} label="Label" value={value} formats={formats} onChange={setValue} />
37
+ </SilkeBox>
38
+ ))}
39
+ </SilkeBox>
40
+ </TextFieldContext>
41
+ ```
42
+
43
+ ### Validation
44
+
45
+ ```js
46
+ const [value, setValue] = React.useState('20%');
47
+ const formats = ['px', '%', 'em', 'vh', 'vw']
48
+
49
+ <SilkeBox column gap="s">
50
+ <h1>{value}</h1>
51
+ {["default", "zombie", "ghost"].map((kind) => (
52
+ <SilkeBox gap="s" key={kind}>
53
+ <SilkeCssNumberField kind={kind} value={value} label="Label" onChange={setValue} min={0} max={100}/>
54
+ </SilkeBox>
55
+ ))}
17
56
  </SilkeBox>
18
57
  ```
19
58
 
@@ -1,12 +1,21 @@
1
1
  @use "../../variables" as *;
2
2
 
3
3
  .root {
4
- &:hover, &.openFormat {
5
- .field + .field:not(:empty) {
6
- background-color: var(--color-neutral-30);
7
- color:var(--color-neutral-100);
4
+ overflow: hidden;
5
+ &:hover,
6
+ &.openFormat {
7
+ .downIcon {
8
+ opacity: 1;
9
+ transform: translateX(0);
8
10
  }
9
11
  }
12
+
13
+ &.openFormat.openFormat{
14
+ --text-field-bg: var(--color-neutral-20);
15
+ --text-field-hover-bg: var(--color-neutral-20);
16
+ --text-field-focus-border-color: transparent;
17
+ }
18
+
10
19
  }
11
20
 
12
21
  .field {
@@ -17,17 +26,25 @@
17
26
  white-space: nowrap;
18
27
  align-self: center;
19
28
  justify-self: end;
20
- min-width: 1ch;
21
- padding: 0 1px;
22
- text-align: right;
23
- flex: 1;
24
29
  overflow: hidden;
25
- & + .field {
26
- flex: none;
27
- color: var(--color-neutral-60);
28
- line-height: 1;
29
- padding:3px;
30
- border-radius: var(--border-radius-tiny);
30
+ min-width: 1px;
31
+
32
+ padding:0 !important;
33
+ // width: auto !important;
34
+ &.hasFormats{
35
+ max-width: calc(100% - 16px);
36
+ }
37
+ flex: none !important;
38
+ text-align: right;
39
+ position: relative;
40
+ }
41
+
42
+ .inputHolder{
43
+ &:first-child{
44
+ padding: 0 4px;
45
+ }
46
+ &:not(:first-child){
47
+ padding:0;
31
48
  }
32
49
  }
33
50
 
@@ -55,3 +72,19 @@
55
72
  width: 100%;
56
73
  cursor: ew-resize;
57
74
  }
75
+
76
+ .downIcon {
77
+ background: transparent;
78
+ outline: none;
79
+ border: none;
80
+ opacity: 0;
81
+ font-size: 0.845em;
82
+ transform: translateX(4px);
83
+ color: var(--text-field-placeholder-color);
84
+ transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
85
+ }
86
+
87
+ .downIcon:hover,
88
+ .openFormat .downIcon {
89
+ color: var(--text-field-color);
90
+ }