@vev/silke 1.0.17 → 1.0.18

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 (47) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +20 -20
  3. package/dist/index.js.map +3 -3
  4. package/dist/silke-code-editor-LBP2WDX3.js +25 -0
  5. package/dist/silke-code-editor-LBP2WDX3.js.map +7 -0
  6. package/dist/styles.css +243 -197
  7. package/package.json +5 -5
  8. package/src/components/silke-autocomplete-field/autocomplete-tags.tsx +2 -2
  9. package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +1 -1
  10. package/src/components/silke-box/silke-box.mdx +2 -1
  11. package/src/components/silke-breadcrumbs/silke-breadcrumb.mdx +5 -1
  12. package/src/components/silke-checkbox/silke-checkbox.mdx +11 -2
  13. package/src/components/silke-color-palettes/silke-color-palette.mdx +2 -2
  14. package/src/components/silke-color-picker/color.ts +12 -0
  15. package/src/components/silke-color-picker/index.ts +1 -0
  16. package/src/components/silke-color-picker/silke-color-picker.mdx +19 -9
  17. package/src/components/silke-color-picker/silke-color-picker.tsx +4 -13
  18. package/src/components/silke-context-menu/silke-context-menu-item.tsx +5 -1
  19. package/src/components/silke-context-menu/silke-context-menu.scss +5 -1
  20. package/src/components/silke-context-menu/silke-context-menu.tsx +4 -1
  21. package/src/components/silke-drawer/silke-drawer.mdx +13 -13
  22. package/src/components/silke-form/silke-form.mdx +15 -3
  23. package/src/components/silke-form-schema/fields/array-field.tsx +1 -1
  24. package/src/components/silke-form-schema/fields/event-field.tsx +1 -1
  25. package/src/components/silke-form-schema/fields/utils/generate-title.ts +9 -2
  26. package/src/components/silke-form-schema/silke-schema-field.tsx +12 -11
  27. package/src/components/silke-form-schema/silke-schema-fields.tsx +2 -2
  28. package/src/components/silke-icon/silke-icon.tsx +3 -1
  29. package/src/components/silke-loader/silke-loader.mdx +3 -4
  30. package/src/components/silke-navigation-link/silke-navigation-link.mdx +6 -1
  31. package/src/components/silke-object-field/silke-object-field.mdx +10 -3
  32. package/src/components/silke-progress-indicator/silke-progress-indicator.mdx +9 -3
  33. package/src/components/silke-radio-button/silke-radio-button.mdx +7 -1
  34. package/src/components/silke-search-field/silke-search-field.mdx +12 -4
  35. package/src/components/silke-tabs/silke-tabs.mdx +2 -2
  36. package/src/components/silke-tag/silke-tag.mdx +51 -13
  37. package/src/components/silke-tag/silke-tag.scss +52 -10
  38. package/src/components/silke-tag/silke-tag.tsx +47 -23
  39. package/src/components/silke-tile/silke-tile.mdx +39 -8
  40. package/src/components/silke-toggle/silke-toggle.mdx +29 -5
  41. package/src/components/silke-toolbar/silke-toolbar.mdx +35 -15
  42. package/src/docs/parser.ts +1 -1
  43. package/src/hooks/hooks.mdx +3 -3
  44. package/src/icons.tsx +2 -0
  45. package/dist/silke-code-editor-3Y2KM5KB.js +0 -25
  46. package/dist/silke-code-editor-3Y2KM5KB.js.map +0 -7
  47. /package/dist/{silke-code-editor-3Y2KM5KB.js.LEGAL.txt → silke-code-editor-LBP2WDX3.js.LEGAL.txt} +0 -0
@@ -7,67 +7,104 @@ $tag-width-max: 150px;
7
7
  $btn-size: $size-xs;
8
8
  $btn-font-size: $font-small;
9
9
 
10
- $kinds: (
10
+
11
+ $colors: (
11
12
  name: "gray",
12
13
  bg: var(--color-neutral-40-rgb),
14
+ outline: var(--color-neutral-40-rgb),
13
15
  color: var(--color-neutral-100),
14
16
  btn-bg-hover: var(--color-neutral-30),
15
17
  ),
16
18
  (
17
19
  name: "sand",
18
20
  bg: var(--color-brand-quaternary-30-rgb),
21
+ outline: var(--color-brand-quaternary-30-rgb),
19
22
  color: var(--color-neutral-0),
20
23
  btn-bg-hover: var(--color-support-primary-20),
21
24
  ),
22
25
  (
23
26
  name: "yellow",
24
27
  bg: var(--color-warning-30-rgb),
28
+ outline: var(--color-warning-30-rgb),
25
29
  color: var(--color-neutral-0),
26
30
  btn-bg-hover: var(--color-warning-20),
27
31
  ),
28
32
  (
29
33
  name: "green",
30
34
  bg: var(--color-success-30-rgb),
35
+ outline: var(--color-success-30-rgb),
31
36
  color: var(--color-neutral-0),
32
37
  btn-bg-hover: var(--color-success-20),
33
38
  ),
34
39
  (
35
40
  name: "red",
36
41
  bg: var(--color-error-30-rgb),
42
+ outline: var(--color-error-30-rgb),
37
43
  color: var(--color-neutral-0),
38
44
  btn-bg-hover: var(--color-error-20),
39
45
  ),
40
46
  (
41
47
  name: "blue",
42
48
  bg: var(--color-support-secondary-30-rgb),
49
+ outline: var(--color-support-secondary-30-rgb),
43
50
  color: var(--color-neutral-0),
44
51
  btn-bg-hover: var(--color-accent-20),
52
+ ),
53
+ (
54
+ name: "brandYellow",
55
+ bg: var(--color-brand-primary-40-rgb),
56
+ outline: var(--color-brand-primary-40-rgb),
57
+ color: var(--color-neutral-0),
58
+ btn-bg-hover: var(--color-brand-primary-50),
59
+ ),
60
+ (
61
+ name: "dark",
62
+ bg: (var(--color-neutral-0-rgb), .64),
63
+ outline: var(--color-neutral-20-rgb),
64
+ color: var(--color-neutral-100),
65
+ btn-bg-hover: var(--color-neutral-20),
45
66
  );
46
67
 
47
68
  .tag {
48
69
  --tag-background: transparent;
49
70
  --tag-color: var(--color-neutral-0);
71
+ --tag-icon-color: var(--color-neutral-0);
50
72
  --tag-button-background: transparent;
51
73
  background-color: rgb(var(--tag-background));
52
- border-radius: math.div($tag-height , 2);
53
74
  height: $tag-height;
54
75
  max-height: $tag-height;
55
76
  min-width: $tag-width-min;
56
77
  max-width: $tag-width-max;
57
78
  font-size: $font-small;
79
+ border-radius: math.div($tag-height , 2);
58
80
  color: var(--tag-color);
59
81
 
60
- @each $kind in $kinds {
61
- &.#{map-get($kind, "name")} {
62
- --tag-button-background: #{map-get($kind, "btn-bg-hover")};
63
- --tag-background: #{map-get($kind, "bg")};
64
- --tag-color: #{map-get($kind, "color")};
82
+
83
+
84
+ @each $color in $colors {
85
+ &.#{map-get($color, "name")} {
86
+ --tag-button-background: #{map-get($color, "btn-bg-hover")};
87
+ --tag-background: #{map-get($color, "bg")};
88
+ --tag-outline: #{map-get($color, "outline")};
89
+ --tag-color: #{map-get($color, "color")};
90
+ --tag-icon-color: #{map-get($color, "bg")};
65
91
  }
66
92
  }
67
93
 
68
- &.outline{
94
+ &.primary{
95
+ --tag-icon-color: var(--color-neutral-0);
96
+ }
97
+
98
+ &.secondary{
69
99
  --tag-color: var(--color-neutral-100);
70
- border: 1px solid rgb(var(--tag-background));
100
+ background-color: rgb(var(--color-neutral-20-rgb), .48);
101
+ border-radius: var(--border-radius-tiny);
102
+ backdrop-filter: blur(8px);
103
+ }
104
+
105
+ &.outlined{
106
+ --tag-color: var(--color-neutral-100);
107
+ border: 1px solid rgb(var(--tag-outline));
71
108
  background-color: rgb(var(--tag-background), .24);
72
109
 
73
110
  }
@@ -108,5 +145,10 @@ $kinds: (
108
145
  }
109
146
 
110
147
  .label {
111
- padding: 0 $space-s;
148
+ padding: 0 $space-xs;
149
+ }
150
+
151
+ .tagIcon{
152
+ font-size: 14px;
153
+ color: rgb(var(--tag-icon-color)) ;
112
154
  }
@@ -3,51 +3,75 @@ import { BoxProps, BoxSpace, SilkeBox } from '../silke-box';
3
3
  import { SilkeText } from '../silke-text';
4
4
  import styles from './silke-tag.scss';
5
5
  import { SilkeIcon, SilkeIcons } from '../silke-icon';
6
+ import { SilkeColor } from '../../silke-theme-provider';
7
+
8
+ export type SilkeTagKind = 'primary' | 'secondary' | 'outlined';
9
+
10
+ export type SilkeTagColor =
11
+ | 'sand'
12
+ | 'yellow'
13
+ | 'green'
14
+ | 'red'
15
+ | 'gray'
16
+ | 'blue'
17
+ | 'brandYellow'
18
+ | 'dark';
6
19
 
7
- export type SilkeTagKind = 'sand' | 'yellow' | 'green' | 'red' | 'gray' | 'blue';
8
20
  export type SilkeTagSize = 'tiny';
9
21
 
10
22
  export type SilkeTagProps = {
11
23
  disabled?: boolean;
12
- label: React.ReactNode;
24
+ label?: React.ReactNode;
13
25
  kind?: SilkeTagKind;
14
26
  size?: SilkeTagSize;
15
- outline?: boolean;
16
27
  icon?: SilkeIcons;
17
28
  innerGap?: BoxSpace;
29
+ iconColor?: SilkeColor;
30
+ color?: SilkeTagColor;
18
31
  /**
19
32
  * Will add a remove button to tag
20
33
  */
21
34
  onRemove?: (e: React.MouseEvent) => void;
22
- } & Omit<BoxProps, 'size'>;
35
+ } & Omit<BoxProps, 'size' | 'color'>;
23
36
 
24
37
  function SilkeTagComp(
25
38
  {
26
39
  className,
27
40
  disabled,
28
- kind,
41
+ kind = 'primary',
29
42
  label,
30
- outline,
31
43
  onRemove,
32
44
  size,
33
45
  icon,
34
46
  innerGap = 'xs',
47
+ color = 'gray',
35
48
  ...rest
36
49
  }: SilkeTagProps,
37
50
  ref: any,
38
51
  ) {
39
- const cl = [styles.tag, disabled ? styles.disabled : styles[kind || 'gray']];
52
+ const cl = [
53
+ styles.tag,
54
+ styles[kind || 'primary'],
55
+ disabled ? styles.disabled : styles[color || 'gray'],
56
+ ];
40
57
  if (className) cl.push(className);
41
- if (outline) cl.push(styles.outline);
42
58
  if (size) cl.push(styles[size]);
43
59
  if (rest?.onClick) cl.push(styles.selectable);
44
60
 
61
+ const iconOnly = !!icon && !label;
62
+
45
63
  return (
46
- <SilkeBox {...(rest as BoxProps)} className={cl.join(' ')} hPad="xs" vAlign="center" ref={ref}>
64
+ <SilkeBox
65
+ {...(rest as BoxProps)}
66
+ className={cl.join(' ')}
67
+ hPad={iconOnly ? 'xxs' : 'xs'}
68
+ vAlign="center"
69
+ ref={ref}
70
+ >
47
71
  <SilkeText overflow flex className={styles.label}>
48
72
  <SilkeBox gap={innerGap} align="center">
49
- {icon && <SilkeIcon icon={icon} />}
50
- <span>{label}</span>
73
+ {icon && <SilkeIcon icon={icon} className={styles.tagIcon} />}
74
+ {label && <span>{label}</span>}
51
75
  </SilkeBox>
52
76
  </SilkeText>
53
77
  {!disabled && onRemove && (
@@ -62,26 +86,26 @@ function SilkeTagComp(
62
86
  export const SilkeTag = React.forwardRef(SilkeTagComp);
63
87
  SilkeBox.displayName = 'SilkeTag';
64
88
 
65
- export const SilkeTagSand = ({ kind, ...rest }: SilkeTagProps) => {
66
- return <SilkeTag {...rest} kind="sand" />;
89
+ export const SilkeTagSand = ({ color, ...rest }: SilkeTagProps) => {
90
+ return <SilkeTag {...rest} color="sand" />;
67
91
  };
68
92
 
69
- export const SilkeTagYellow = ({ kind, ...rest }: SilkeTagProps) => {
70
- return <SilkeTag {...rest} kind="yellow" />;
93
+ export const SilkeTagYellow = ({ color, ...rest }: SilkeTagProps) => {
94
+ return <SilkeTag {...rest} color="yellow" />;
71
95
  };
72
96
 
73
- export const SilkeTagGreen = ({ kind, ...rest }: SilkeTagProps) => {
74
- return <SilkeTag {...rest} kind="green" />;
97
+ export const SilkeTagGreen = ({ color, ...rest }: SilkeTagProps) => {
98
+ return <SilkeTag {...rest} color="green" />;
75
99
  };
76
100
 
77
- export const SilkeTagRed = ({ kind, ...rest }: SilkeTagProps) => {
78
- return <SilkeTag {...rest} kind="red" />;
101
+ export const SilkeTagRed = ({ color, ...rest }: SilkeTagProps) => {
102
+ return <SilkeTag {...rest} color="red" />;
79
103
  };
80
104
 
81
- export const SilkeTagGray = ({ kind, ...rest }: SilkeTagProps) => {
82
- return <SilkeTag {...rest} kind="gray" />;
105
+ export const SilkeTagGray = ({ color, ...rest }: SilkeTagProps) => {
106
+ return <SilkeTag {...rest} color="gray" />;
83
107
  };
84
108
 
85
- export const SilkeTagBlue = ({ kind, ...rest }: SilkeTagProps) => {
86
- return <SilkeTag {...rest} kind="blue" />;
109
+ export const SilkeTagBlue = ({ color, ...rest }: SilkeTagProps) => {
110
+ return <SilkeTag {...rest} color="blue" />;
87
111
  };
@@ -6,10 +6,20 @@
6
6
  <p>Text info in this text</p>
7
7
  </SilkeTile>
8
8
 
9
- <SilkeTile title="Clickable tile" subTitle="With tags" tags={['tags', 'text']} onClick={() => {}}>
9
+ <SilkeTile
10
+ title="Clickable tile"
11
+ subTitle="With tags"
12
+ tags={["tags", "text"]}
13
+ onClick={() => {}}
14
+ >
10
15
  <p>Text info in this text</p>
11
16
  </SilkeTile>
12
- <SilkeTile title="Selected tile" subTitle="Tile Sub Title" selected onClick={() => {}}>
17
+ <SilkeTile
18
+ title="Selected tile"
19
+ subTitle="Tile Sub Title"
20
+ selected
21
+ onClick={() => {}}
22
+ >
13
23
  <p>Text info in this text</p>
14
24
  </SilkeTile>
15
25
  </SilkeBox>
@@ -19,7 +29,10 @@
19
29
 
20
30
  ```js
21
31
  <SilkeBox column gap>
22
- <SilkeTile title="With menu" menu={[{label: "Item 1"}, {label: "Item 2"}]}>
32
+ <SilkeTile
33
+ title="With menu"
34
+ menu={[{ label: "Item 1" }, { label: "Item 2" }]}
35
+ >
23
36
  <p>Text info in this text</p>
24
37
  </SilkeTile>
25
38
  </SilkeBox>
@@ -30,7 +43,12 @@
30
43
  ```js
31
44
  const [firstOpen, setFirstOpen] = React.useState();
32
45
  <SilkeBox column gap>
33
- <SilkeTile title="Tile title" subTitle="Tile Sub Title" expandable onExpand={setFirstOpen}>
46
+ <SilkeTile
47
+ title="Tile title"
48
+ subTitle="Tile Sub Title"
49
+ expandable
50
+ onExpand={setFirstOpen}
51
+ >
34
52
  <h3>This text shows when expanded</h3>
35
53
  {ipsum.p()}
36
54
  </SilkeTile>
@@ -57,7 +75,12 @@ const handleExpand = (expanding) => {
57
75
  setText(null);
58
76
  }
59
77
  };
60
- <SilkeTile title="Tile title" subTitle="Tile Sub Title" expandable onExpand={handleExpand}>
78
+ <SilkeTile
79
+ title="Tile title"
80
+ subTitle="Tile Sub Title"
81
+ expandable
82
+ onExpand={handleExpand}
83
+ >
61
84
  {text}
62
85
  </SilkeTile>;
63
86
  ```
@@ -76,7 +99,7 @@ const handleExpand = (expanding) => {
76
99
  </SilkeTile>
77
100
 
78
101
  <SilkeTile
79
- icon={{ type: 2, value: { url: ipsum.image() }}}
102
+ icon={{ type: 2, value: { url: ipsum.image() } }}
80
103
  subTitle={ipsum.text()}
81
104
  title="Tile with image icon"
82
105
  />
@@ -101,7 +124,11 @@ const [value, setValue] = React.useState(0);
101
124
  <SilkeTileSelect
102
125
  value={value}
103
126
  onChange={setValue}
104
- items={ipsum.list(5, (value) => ({ value, title: ipsum.name(), subTitle: ipsum.name(10) }))}
127
+ items={ipsum.list(5, (value) => ({
128
+ value,
129
+ title: ipsum.name(),
130
+ subTitle: ipsum.name(10),
131
+ }))}
105
132
  />;
106
133
  ```
107
134
 
@@ -113,6 +140,10 @@ const [value, setValue] = React.useState([1]);
113
140
  multiple
114
141
  value={value}
115
142
  onChange={setValue}
116
- items={ipsum.list(5, (value) => ({ value, title: ipsum.name(), subTitle: ipsum.name(10) }))}
143
+ items={ipsum.list(5, (value) => ({
144
+ value,
145
+ title: ipsum.name(),
146
+ subTitle: ipsum.name(10),
147
+ }))}
117
148
  />;
118
149
  ```
@@ -8,10 +8,24 @@ const [agree, setAgree] = React.useState(false);
8
8
 
9
9
  <>
10
10
  <SilkeBox>
11
- <SilkeToggle label="Toggle with label" value={checked} onChange={setChecked} />
11
+ <SilkeToggle
12
+ label="Toggle with label"
13
+ value={checked}
14
+ onChange={setChecked}
15
+ />
12
16
  </SilkeBox>
13
- <SilkeToggle required label="This toggle is required" value={agree} onChange={setAgree} />
14
- <SilkeToggle small label="Tiny toggle, tiny text" value={checked} onChange={setChecked} />
17
+ <SilkeToggle
18
+ required
19
+ label="This toggle is required"
20
+ value={agree}
21
+ onChange={setAgree}
22
+ />
23
+ <SilkeToggle
24
+ small
25
+ label="Tiny toggle, tiny text"
26
+ value={checked}
27
+ onChange={setChecked}
28
+ />
15
29
  </>;
16
30
  ```
17
31
 
@@ -21,7 +35,12 @@ const [agree, setAgree] = React.useState(false);
21
35
  const [checked, setChecked] = React.useState(true);
22
36
 
23
37
  <>
24
- <SilkeToggle disabled label="Toggle with label" value={checked} onChange={setChecked} />
38
+ <SilkeToggle
39
+ disabled
40
+ label="Toggle with label"
41
+ value={checked}
42
+ onChange={setChecked}
43
+ />
25
44
  <SilkeToggle
26
45
  disabled
27
46
  small
@@ -29,7 +48,12 @@ const [checked, setChecked] = React.useState(true);
29
48
  value={checked}
30
49
  onChange={setChecked}
31
50
  />
32
- <SilkeToggle disabled label="Toggle with label (off)" value={!checked} onChange={setChecked} />
51
+ <SilkeToggle
52
+ disabled
53
+ label="Toggle with label (off)"
54
+ value={!checked}
55
+ onChange={setChecked}
56
+ />
33
57
  <SilkeToggle
34
58
  disabled
35
59
  small
@@ -1,29 +1,49 @@
1
1
  # Toolbar
2
2
 
3
3
  ```js
4
- <SilkeToolbar>
5
- <SilkeSearchField label="Search" />
6
- <SilkeSelectField label="Filter" items={[{label: "Apple", value: "apple"}, {label: "Banana", value: "banana"}]} />
7
- <SilkeButton label="New project" kind="primary" />
8
- </SilkeToolbar>
4
+ <SilkeToolbar>
5
+ <SilkeSearchField label="Search" />
6
+ <SilkeSelectField
7
+ label="Filter"
8
+ items={[
9
+ { label: "Apple", value: "apple" },
10
+ { label: "Banana", value: "banana" },
11
+ ]}
12
+ />
13
+ <SilkeButton label="New project" kind="primary" />
14
+ </SilkeToolbar>
9
15
  ```
10
16
 
11
17
  ## Large
18
+
12
19
  ```js
13
- <SilkeToolbar size="l">
14
- <SilkeSearchField label="Search" />
15
- <SilkeSelectField label="Filter" items={[{label: "Apple", value: "apple"}, {label: "Banana", value: "banana"}]} />
16
- <SilkeButton label="New project" kind="primary" />
17
- </SilkeToolbar>
20
+ <SilkeToolbar size="l">
21
+ <SilkeSearchField label="Search" />
22
+ <SilkeSelectField
23
+ label="Filter"
24
+ items={[
25
+ { label: "Apple", value: "apple" },
26
+ { label: "Banana", value: "banana" },
27
+ ]}
28
+ />
29
+ <SilkeButton label="New project" kind="primary" />
30
+ </SilkeToolbar>
18
31
  ```
19
32
 
20
33
  ## Small
21
34
 
22
35
  ## Large
36
+
23
37
  ```js
24
- <SilkeToolbar size="s">
25
- <SilkeSearchField label="Search" />
26
- <SilkeSelectField label="Filter" items={[{label: "Apple", value: "apple"}, {label: "Banana", value: "banana"}]} />
27
- <SilkeButton label="New project" kind="primary" />
28
- </SilkeToolbar>
38
+ <SilkeToolbar size="s">
39
+ <SilkeSearchField label="Search" />
40
+ <SilkeSelectField
41
+ label="Filter"
42
+ items={[
43
+ { label: "Apple", value: "apple" },
44
+ { label: "Banana", value: "banana" },
45
+ ]}
46
+ />
47
+ <SilkeButton label="New project" kind="primary" />
48
+ </SilkeToolbar>
29
49
  ```
@@ -1342,4 +1342,4 @@
1342
1342
 
1343
1343
  // return [...docs, ...filteredComponentDocs];
1344
1344
  // }, []);
1345
- // }
1345
+ // }
@@ -1,9 +1,9 @@
1
1
  # Silke React Hooks
2
2
 
3
3
  ```js
4
- const ref = useHTMLElement('div', {}, document.body);
4
+ const ref = useHTMLElement("div", {}, document.body);
5
5
  return ReactDOM.createPortal(
6
- <h1 style={{ position: 'absolute', top: 200, left: 300 }}>In a portal</h1>,
7
- ref.current,
6
+ <h1 style={{ position: "absolute", top: 200, left: 300 }}>In a portal</h1>,
7
+ ref.current
8
8
  );
9
9
  ```
package/src/icons.tsx CHANGED
@@ -98,6 +98,7 @@ export const SilkeIconDefinitions = {
98
98
  'folder.plus': 'fal fa-folder-plus',
99
99
  folders: 'fal fa-folders',
100
100
  file: 'fal fa-file',
101
+ 'file.download': 'far fa-download',
101
102
 
102
103
  code: 'fal fa-code',
103
104
  'code.version': 'fal fa-code-branch',
@@ -213,6 +214,7 @@ export const SilkeIconDefinitions = {
213
214
  expand: 'fal fa-expand',
214
215
  'request.feature': 'fal fa-messages-question',
215
216
  'custom-component': CustomComponentIcon,
217
+ 'folder-tree': 'fal fa-folder-tree',
216
218
 
217
219
  'project-plan': ProjectPlanRibbon,
218
220
  diamond: 'fa-regular fa-gem',