@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
@@ -1,18 +1,18 @@
1
- import React, { useState } from 'react';
2
- import { SilkeIcon, SilkeIcons, SilkeText } from '..';
3
- import { BoxDivProps, BoxSize, SilkeBox } from '../silke-box';
1
+ import React, { useRef } from 'react';
2
+ import { BoxDivProps, SilkeBox } from '../silke-box';
3
+ import { SilkeButton } from '../silke-button';
4
+ import { SilkeIcon, SilkeIcons } from '../silke-icon';
5
+ import { SilkeText } from '../silke-text';
4
6
  import styles from './silke-notification.scss';
7
+ import userConfetti from './confetti';
5
8
 
6
- export type NotificationKind = 'warning' | 'error' | 'success' | 'information';
9
+ export type NotificationKind = 'warning' | 'error' | 'success' | 'information' | 'confetti';
7
10
 
8
11
  export type SilkeNotificationProps = {
9
12
  kind: NotificationKind;
10
- size?: BoxSize;
11
13
  title?: string | React.ReactNode;
12
14
  subtitle?: string | React.ReactNode;
13
15
  icon?: SilkeIcons;
14
- inline?: boolean;
15
- timestamp?: boolean;
16
16
  /**
17
17
  * Will add a remove button to notification
18
18
  */
@@ -23,141 +23,72 @@ export type SilkeNotificationProps = {
23
23
  onAction?: () => void;
24
24
  actionLabel?: string;
25
25
  fluid?: boolean;
26
+ dark?: boolean;
26
27
  } & Omit<BoxDivProps, 'height' | 'width' | 'tag'>;
27
28
 
28
- const iconByKind: Record<NotificationKind, SilkeIcons> = {
29
+ const ICON_KIND: Record<NotificationKind, SilkeIcons> = {
29
30
  warning: 'error.triangle',
30
31
  error: 'ban',
31
32
  success: 'check.circle.outline',
32
33
  information: 'tooltip',
34
+ confetti: '🎉' as SilkeIcons,
33
35
  };
34
36
 
35
- const getIconByKind = (kind: NotificationKind): SilkeIcons => iconByKind[kind];
36
-
37
- const getTimetamp = (date: Date) =>
38
- date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
39
-
40
37
  export function SilkeNotification({
41
- size = 'm',
42
38
  title,
43
39
  subtitle,
44
40
  className,
45
41
  kind,
46
- timestamp,
47
42
  onAction,
48
43
  actionLabel,
49
44
  onRemove,
50
- inline = false,
51
45
  fluid = false,
46
+ dark,
52
47
  ...rest
53
48
  }: SilkeNotificationProps) {
54
49
  const cl: string[] = [styles.notificationBox];
50
+ const iconRef = useRef<HTMLBaseElement>();
51
+
52
+ if (kind === 'confetti') userConfetti(iconRef as any);
55
53
 
56
54
  if (className) cl.push(className);
57
55
  if (kind) cl.push(styles[kind]);
58
- if (fluid && !inline) cl.push(styles.fluid);
59
- cl.push(inline ? styles.inline : styles.box);
60
-
61
- const isBox = !inline;
56
+ if (fluid) cl.push(styles.fluid);
57
+ if (dark) cl.push(styles.dark);
62
58
 
63
59
  return (
64
- <SilkeBox gap pad className={cl.join(' ')} {...rest} hAlign="spread">
65
- <SilkeBox vAlign="center">
66
- <NotificationBody {...{ isBox, title, subtitle, kind, timestamp, onAction, actionLabel }} />
60
+ <SilkeBox rounded="small" className={cl.join(' ')} {...rest}>
61
+ <SilkeBox size="m" align="center" ref={iconRef}>
62
+ <SilkeIcon
63
+ icon={ICON_KIND[kind]}
64
+ className={[styles.icon, kind === 'confetti' && styles.scale].filter(Boolean).join(' ')}
65
+ />
67
66
  </SilkeBox>
68
- <SilkeBox vAlign="start" gap vPad={isBox ? 'xs' : 'xxs'} {...rest}>
69
- {!isBox && <LinkButton onAction={onAction} isBox={isBox} actionLabel={actionLabel} />}
67
+ <SilkeBox flex column vPad="s" gap="xs" className={styles.content} hAlign="start">
68
+ {title && <SilkeText weight="strong">{title}</SilkeText>}
69
+ {subtitle && <SilkeText>{subtitle}</SilkeText>}
70
+ {onAction && (
71
+ <SilkeButton
72
+ className={styles.action}
73
+ kind="ghost"
74
+ size="base"
75
+ label={actionLabel}
76
+ onClick={onAction}
77
+ />
78
+ )}
79
+ {/* <NotificationBody {...{ isBox, title, subtitle, kind, timestamp, onAction, actionLabel }} /> */}
80
+ </SilkeBox>
81
+ <SilkeBox size="m" align="center">
70
82
  {onRemove && (
71
- <SilkeBox tag="button" onClick={onRemove} vAlign="start" className={styles.closeButton}>
72
- <SilkeBox tag="div" className={styles.icon} vAlign="center">
73
- <SilkeIcon icon="close" />
74
- </SilkeBox>
75
- </SilkeBox>
83
+ <SilkeButton
84
+ className={styles.close}
85
+ kind="ghost"
86
+ size="base"
87
+ icon="close"
88
+ onClick={onRemove}
89
+ />
76
90
  )}
77
91
  </SilkeBox>
78
92
  </SilkeBox>
79
93
  );
80
94
  }
81
-
82
- type NotificationBodyProps = {
83
- kind: NotificationKind;
84
- isBox: boolean;
85
- title?: string | React.ReactNode;
86
- subtitle?: string | React.ReactNode;
87
- timestamp?: boolean;
88
- onAction?: () => void;
89
- actionLabel?: string;
90
- };
91
-
92
- function NotificationBody({
93
- isBox,
94
- title,
95
- subtitle,
96
- kind,
97
- timestamp,
98
- onAction,
99
- actionLabel,
100
- }: NotificationBodyProps) {
101
- const [timestampText] = useState(getTimetamp(new Date()));
102
- return (
103
- <>
104
- {isBox ? (
105
- <SilkeBox gap style={{ paddingLeft: 9 }}>
106
- <SilkeBox vAlign="start" vPad="xs">
107
- <SilkeIcon icon={getIconByKind(kind)} className={styles[kind]} />
108
- </SilkeBox>
109
- <SilkeBox column gap="xs" vAlign="start">
110
- {title &&
111
- (typeof title === 'string' ? (
112
- <SilkeText weight="strong">{title}</SilkeText>
113
- ) : (
114
- { title }
115
- ))}
116
- {subtitle &&
117
- (typeof subtitle === 'string' ? <SilkeText>{subtitle}</SilkeText> : { subtitle })}
118
-
119
- <LinkButton isBox={isBox} onAction={onAction} actionLabel={actionLabel} />
120
- {timestamp && (
121
- <SilkeBox style={{ paddingTop: '1rem' }}>
122
- <SilkeText>{timestampText}</SilkeText>
123
- </SilkeBox>
124
- )}
125
- </SilkeBox>
126
- </SilkeBox>
127
- ) : (
128
- <SilkeBox gap style={{ paddingLeft: 9 }}>
129
- <SilkeBox vAlign="center" vPad="xxs">
130
- <SilkeIcon icon={getIconByKind(kind)} className={styles[kind]} />
131
- </SilkeBox>
132
- <SilkeBox gap="m" vAlign="center">
133
- {title && <SilkeText weight="strong">{title}</SilkeText>}
134
- {subtitle && <SilkeText>{subtitle}</SilkeText>}
135
- </SilkeBox>
136
- </SilkeBox>
137
- )}
138
- </>
139
- );
140
- }
141
-
142
- type LinkProps = {
143
- isBox: boolean;
144
- actionLabel?: string;
145
- onAction?: () => void;
146
- };
147
-
148
- function LinkButton({ isBox, onAction, actionLabel }: LinkProps) {
149
- return onAction ? (
150
- <>
151
- {isBox ? (
152
- <SilkeBox tag="button" vAlign="center" gap className={styles.link} onClick={onAction}>
153
- <SilkeText weight="strong">{actionLabel ? actionLabel : 'See more'}</SilkeText>
154
- <SilkeIcon icon="arrow.right" style={{ color: 'black' }} />
155
- </SilkeBox>
156
- ) : (
157
- <SilkeBox tag="button" vAlign="center" onClick={onAction} className={styles.link}>
158
- <SilkeText weight="strong">{actionLabel ? actionLabel : 'Action'}</SilkeText>
159
- </SilkeBox>
160
- )}
161
- </>
162
- ) : null;
163
- }
@@ -31,7 +31,7 @@ export function SilkeObjectField<T>(props: SilkeObjectFieldProps<T>) {
31
31
  onChange,
32
32
  } = useFormField(props, validator);
33
33
  const fieldRefs = useRef<any>({});
34
- const [hasHiddenErrors, setHasHiddenErrors] = useState<boolean>(true);
34
+ const [hasHiddenErrors, setHasHiddenErrors] = useState<boolean>(false);
35
35
  const hiddenErrorRefs = useRef<ErrorMap<T>>({});
36
36
  const [errors, setErrors] = useState<ErrorMap<T>>({});
37
37
 
@@ -1,8 +1,8 @@
1
1
  # Overflow menu
2
2
 
3
3
  ```js
4
- const list = [1, 2, 3].map((i) => ({ label: 'Item 1' }));
5
- list[2].kind = 'danger';
4
+ const list = [1, 2, 3].map((i) => ({ label: "Item 1" }));
5
+ list[2].kind = "danger";
6
6
 
7
7
  <SilkeBox column align="center" fill>
8
8
  <SilkeOverflowMenu items={list} />
@@ -1,28 +1,36 @@
1
1
  @use '../../variables' as *;
2
2
 
3
- $overlay-open-background: var(--color-neutral-low-soft);
3
+ $overlay-open-background: var(--color-neutral-20);
4
4
 
5
5
  .btnOpen {
6
6
  background-color: $overlay-open-background !important;
7
7
  border: none !important;
8
8
 
9
- &:before{
9
+ &::before{
10
10
  display:none !important;
11
11
  }
12
12
  }
13
13
 
14
14
  .menu {
15
+ overflow:hidden;
15
16
  min-width: 160px;
16
17
  background:$overlay-open-background;
18
+ border-radius: var(--border-radius-small);
19
+ filter:var(--shadow-level-4);
17
20
  hr{
18
21
  margin: $space-s 0;
19
- background: var(--color-neutral-high-spark);
22
+ background: var(--color-neutral-60);
20
23
  }
21
24
  &:focus {
22
25
  outline: none;
23
26
  }
24
27
 
25
28
  &:focus-visible {
26
- box-shadow: 0 0 0 4px var(--color-neutral-high-pure);
29
+ box-shadow: 0 0 0 4px var(--color-neutral-100);
30
+ }
31
+
32
+
33
+ button,a{
34
+ justify-content: start !important;
27
35
  }
28
36
  }
@@ -2,7 +2,7 @@ import { generateGuid } from '@vev/utils';
2
2
  import { isBoolean, isFunction } from 'lodash';
3
3
  import React, { useCallback, useMemo, useRef, useState } from 'react';
4
4
  import { SilkeBox } from '../silke-box';
5
- import { SilkeButton, SilkeButtonProps } from '../silke-button';
5
+ import { ButtonContext, SilkeButton, SilkeButtonProps } from '../silke-button';
6
6
  import { SilkePopover, SilkePopoverProps } from '../silke-popover';
7
7
  import styles from './silke-overflow-menu.scss';
8
8
 
@@ -47,7 +47,8 @@ export function SilkeOverflowMenu({
47
47
  }, []);
48
48
 
49
49
  const handleToggleOpen = useCallback(
50
- (e) => {
50
+ (e: any) => {
51
+ e?.stopPropagation();
51
52
  if (onMouseDown) onMouseDown(e);
52
53
  if (isBoolean(externalOpen) && onToggleOpen) {
53
54
  // Handle open/close externally
@@ -66,13 +67,16 @@ export function SilkeOverflowMenu({
66
67
 
67
68
  const boxRef = useRef<HTMLDivElement>(null);
68
69
 
70
+ if (anchorOrigin?.includes('top')) offsetY = (offsetY || 0) - 1;
71
+ else offsetY = (offsetY || 0) + 1;
72
+
69
73
  return (
70
74
  <>
71
75
  <SilkeButton
72
76
  className={isOpen ? styles.btnOpen : undefined}
73
77
  ref={ref}
74
78
  label={label}
75
- kind="plain"
79
+ kind="ghost"
76
80
  icon={icon}
77
81
  id={buttonId}
78
82
  aria-expanded={isOpen}
@@ -99,32 +103,45 @@ export function SilkeOverflowMenu({
99
103
  onRequestClose={handleToggleOpen}
100
104
  focusRef={boxRef}
101
105
  >
102
- {items && (
103
- <SilkeBox
104
- tabIndex={-1}
105
- column
106
- bg="ui-4"
107
- className={styles.menu}
108
- onClick={() => setOpen(false)}
109
- ref={boxRef}
110
- aria-labelledby={buttonId}
111
- >
112
- {(isFunction(items) ? items() : items)?.map((item, index) => {
113
- return React.isValidElement(item) ? (
114
- item
115
- ) : item === 'divider' ? (
116
- <hr key={index} />
117
- ) : (
118
- <SilkeOverflowMenuItem key={index} size={rest.size} {...item} />
119
- );
120
- })}
121
- </SilkeBox>
122
- )}
123
- {children && (
124
- <div ref={boxRef} tabIndex={-1} aria-labelledby={buttonId}>
125
- {children}
126
- </div>
127
- )}
106
+ <ButtonContext size="base">
107
+ {items && (
108
+ <SilkeBox
109
+ tabIndex={-1}
110
+ column
111
+ pad="xs"
112
+ bg="neutral-30"
113
+ shadow="level2"
114
+ className={styles.menu}
115
+ onClick={() => setOpen(false)}
116
+ ref={boxRef}
117
+ aria-labelledby={buttonId}
118
+ >
119
+ {(isFunction(items) ? items() : items)?.map((item, index) => {
120
+ return React.isValidElement(item) ? (
121
+ item
122
+ ) : item === 'divider' ? (
123
+ <hr key={index} />
124
+ ) : (
125
+ <SilkeOverflowMenuItem
126
+ key={index}
127
+ size={rest.size}
128
+ {...item}
129
+ onClick={(e) => {
130
+ e.stopPropagation();
131
+ item.onClick?.(e);
132
+ handleToggleOpen(e);
133
+ }}
134
+ />
135
+ );
136
+ })}
137
+ </SilkeBox>
138
+ )}
139
+ {children && (
140
+ <div ref={boxRef} tabIndex={-1} aria-labelledby={buttonId}>
141
+ {children}
142
+ </div>
143
+ )}
144
+ </ButtonContext>
128
145
  </SilkePopover>
129
146
  )}
130
147
  </>
@@ -137,5 +154,11 @@ export type SilkeOverflowMenuItem = {
137
154
  } & Omit<SilkeButtonProps, 'height' | 'width' | 'align' | 'vAlign' | 'hAlign' | 'kind'>;
138
155
 
139
156
  export const SilkeOverflowMenuItem = ({ label, kind, ...rest }: SilkeOverflowMenuItem) => (
140
- <SilkeButton label={label} kind={kind === 'danger' ? 'danger' : 'plain'} size="m" {...rest} />
157
+ <SilkeButton
158
+ label={label}
159
+ kind={kind === 'danger' ? 'danger' : 'ghost'}
160
+ size="m"
161
+ rounded="small"
162
+ {...rest}
163
+ />
141
164
  );
@@ -5,7 +5,7 @@ const [show, setShow] = React.useState(false);
5
5
  <>
6
6
  <SilkeButton label="Show modal" onClick={() => setShow(true)} />
7
7
  <SilkePopover hide={!show}>
8
- <SilkeBox bg="ui-2" pad column>
8
+ <SilkeBox bg="neutral-20" pad column>
9
9
  <h1> Simple modal example</h1>
10
10
  <SilkeButton label="Close" onClick={() => setShow(false)} />
11
11
  </SilkeBox>
@@ -56,7 +56,7 @@ const ref = React.useRef();
56
56
  targetOrigin={targetOrigin}
57
57
  anchorOrigin={anchorOrigin}
58
58
  >
59
- <SilkeBox bg="ui-2" pad column>
59
+ <SilkeBox bg="neutral-20" pad column>
60
60
  <SilkeBox flex>
61
61
  <AnchorSelect
62
62
  header="TargetOrigin"
@@ -1,7 +1,7 @@
1
1
  import { useKeyUp } from '@vev/utils';
2
2
  import * as focusTrap from 'focus-trap';
3
3
  import { clamp } from 'lodash';
4
- import React, { RefObject, useCallback, useContext, useEffect } from 'react';
4
+ import React, { Ref, RefObject, useCallback, useContext, useEffect, useRef } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import {
7
7
  isInside,
@@ -31,7 +31,15 @@ export type PopoverOrigin =
31
31
  export type PopoverAnchor = React.RefObject<HTMLElement> | [x: number, y: number];
32
32
 
33
33
  const PopoverWrapperContext = React.createContext<React.RefObject<HTMLElement>>({ current: null });
34
-
34
+ export const SilkePopoverContext = ({
35
+ target,
36
+ children,
37
+ }: {
38
+ target: React.RefObject<HTMLElement>;
39
+ children: React.ReactElement;
40
+ }) => {
41
+ return <PopoverWrapperContext.Provider value={target}>{children}</PopoverWrapperContext.Provider>;
42
+ };
35
43
  const OriginMap: Record<string, number> = {
36
44
  top: 0,
37
45
  bottom: 1,
@@ -44,7 +52,7 @@ export interface SilkePopoverProps {
44
52
  /** Element or position to anchor the popover to, if not defined the center of screen is used */
45
53
  anchor?: PopoverAnchor;
46
54
  /** Children to add inside the popover */
47
- children: React.ReactNode;
55
+ children?: React.ReactElement | React.ReactElement[];
48
56
  /**
49
57
  * If popover belongs to a group of popovers,
50
58
  * using contextId will close all other with same id when hide = false on this
@@ -105,12 +113,20 @@ export function SilkePopover({
105
113
  }: SilkePopoverProps) {
106
114
  const targetId = contextId || 'modal';
107
115
  const parentContext = useContext(PopoverWrapperContext);
116
+ const isMountedAndOpenRef = useRef<boolean>(false);
108
117
 
109
118
  const attrs: Record<string, string> = { ...PopoverAttrs, id: targetId };
110
119
  if (shadow) attrs['data-shadow'] = shadow;
111
120
 
112
121
  const targetRef = useHTMLElement('div', attrs, !hide ? document.body : undefined);
113
122
 
123
+ useEffect(() => {
124
+ // Need timeout ensure mouse down is not triggered on the popover right away
125
+ setTimeout(() => {
126
+ isMountedAndOpenRef.current = !hide;
127
+ });
128
+ }, [hide]);
129
+
114
130
  useEffect(() => {
115
131
  if (focusRef) {
116
132
  try {
@@ -164,11 +180,13 @@ export function SilkePopover({
164
180
  useMouseDown((e) => {
165
181
  const el = targetRef.current;
166
182
  const parentPopover = parentContext.current;
167
- if (!el || !onRequestClose) return;
183
+
184
+ if (!el || !onRequestClose || !isMountedAndOpenRef.current) return;
168
185
  // if click inside parent popover then close
169
186
  const isInsideParentPopover = parentPopover && isInside(e, parentPopover);
170
187
  const isInsidePopover = isInsideRole(e, 'popover');
171
188
  const isInDOM = document.contains(e.target as HTMLElement);
189
+
172
190
  // CLose popover if el is DOM and event is not inside element itself or popover, or event is in parent popover
173
191
  if (!isInside(e, el) && isInDOM && (isInsideParentPopover || !isInsidePopover)) {
174
192
  onRequestClose(e);
@@ -181,7 +199,7 @@ export function SilkePopover({
181
199
  }
182
200
  }, [hide, onRequestClose]);
183
201
 
184
- useKeyUp('esc', onEscape, [hide]);
202
+ useKeyUp('Escape', onEscape, [hide]);
185
203
 
186
204
  return createPortal(
187
205
  <PopoverWrapperContext.Provider value={targetRef}>{children}</PopoverWrapperContext.Provider>,
@@ -38,19 +38,19 @@ $step-circle-border-width:1px;
38
38
 
39
39
  .current,
40
40
  .complete {
41
- color: var(--color-brand-primary-soft);
41
+ color: var(--color-accent-30);
42
42
  }
43
43
 
44
44
  .error {
45
- color: var(--color-feedback-warning-spark);
45
+ color: var(--color-error-30);
46
46
  }
47
47
 
48
48
  .disabled {
49
- color: var(--color-neutral-low-soft);
49
+ color: var(--color-neutral-30);
50
50
  pointer-events: none;
51
51
 
52
52
  .label {
53
- color: var(--color-neutral-low-soft);
53
+ color: var(--color-neutral-30);
54
54
  }
55
55
  }
56
56
 
@@ -65,7 +65,7 @@ $step-circle-border-width:1px;
65
65
 
66
66
  .label {
67
67
  white-space: nowrap;
68
- color: var(--color-neutral-high-pure);
68
+ color: var(--color-neutral-100);
69
69
  }
70
70
 
71
71
  .icon {
@@ -52,7 +52,7 @@ export function SilkeRadioButtonGroup({
52
52
  ))}
53
53
  </SilkeBox>
54
54
  {help && (
55
- <Text tag="span" flex color="secondary">
55
+ <Text tag="span" flex color="neutral-80">
56
56
  {help}
57
57
  </Text>
58
58
  )}
@@ -9,11 +9,11 @@ $circleBorderWidth: 1px;
9
9
  cursor: pointer;
10
10
 
11
11
  &.disabled {
12
- color: var(--color-neutral-low-soft);
12
+ color: var(--color-neutral-30);
13
13
  }
14
14
 
15
15
  &.error {
16
- color: var(--color-feedback-warning-spark);
16
+ color: var(--color-warning-30);
17
17
  }
18
18
 
19
19
  /* Hide the browser's default checkbox */
@@ -25,17 +25,32 @@ $circleBorderWidth: 1px;
25
25
 
26
26
  /* When the checkbox is checked, add a blue background */
27
27
 
28
- &:checked ~ .circle:after {
29
- display: block;
28
+ &:checked ~ .circle{
29
+ background-color: var(--color-accent-30);
30
+ &::after {
31
+ display: block;
32
+ }
33
+
30
34
  }
31
- &:not(:checked):focus ~ .circle {
32
- color: var(--color-brand-primary-soft);
35
+ &:not(:checked):focus-visible ~ .circle {
36
+ &::before{
37
+ display: block;
38
+ content: "";
39
+ pointer-events: none;
40
+ position: absolute;
41
+ top:-3px;
42
+ left: -3px;
43
+ width: calc(100% + 6px);
44
+ height: calc(100% + 6px);
45
+ outline: 1px solid var(--color-neutral-30);
46
+ border-radius: 50%;
47
+ }
33
48
  }
34
49
  }
35
50
 
36
51
  &:not(.disabled) {
37
52
  input:checked ~ .circle {
38
- color: var(--color-brand-secondary-bright);
53
+ color: var(--color-accent-30);
39
54
  }
40
55
  }
41
56
  }
@@ -52,7 +67,7 @@ $circleBorderWidth: 1px;
52
67
  border-radius: 50%;
53
68
  border: $circleBorderWidth solid currentColor;
54
69
 
55
- &:after {
70
+ &::after {
56
71
  position: absolute;
57
72
  display: none;
58
73
  content: "";
@@ -63,7 +78,7 @@ $circleBorderWidth: 1px;
63
78
  // left: #{($circleSize - $circleInnerSize) / 2- $circleBorderWidth};
64
79
  width: $circleInnerSize;
65
80
  height: $circleInnerSize;
66
- background: currentColor;
81
+ background: var(--color-neutral-100);
67
82
  border-radius: 50%;
68
83
  }
69
84
  }
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
+ import { SilkeBox } from '../silke-box';
2
3
  import { SilkeButton } from '../silke-button';
3
4
  import { SilkeIcon } from '../silke-icon';
4
5
  import { SilkeTextField, SilkeTextFieldItem, SingleLineProps } from '../silke-text-field';
@@ -6,9 +7,10 @@ import { useTextFieldContext } from '../silke-text-field/text-field-context';
6
7
 
7
8
  type SilkeSearchFieldProps = {
8
9
  search?: string;
9
- } & Omit<SingleLineProps, 'value' | 'kind' | 'label'>;
10
+ onClearButton?: () => void;
11
+ } & Omit<SingleLineProps, 'value' | 'label'>;
10
12
 
11
- export function SilkeSearchField({ search, ...rest }: SilkeSearchFieldProps) {
13
+ export function SilkeSearchField({ search, onClearButton, ...rest }: SilkeSearchFieldProps) {
12
14
  const context = useTextFieldContext();
13
15
  const size = rest.size || context.size || 'l';
14
16
  const [value, setValue] = useState('');
@@ -23,13 +25,16 @@ export function SilkeSearchField({ search, ...rest }: SilkeSearchFieldProps) {
23
25
 
24
26
  const handleClear = () => {
25
27
  setValue('');
28
+ onClearButton?.();
26
29
  if (rest.onChange) rest.onChange('');
27
30
  };
28
31
 
29
32
  return (
30
- <SilkeTextField {...rest} value={value} onChange={handleChange} size={size} kind="ghost" inline>
31
- <SilkeTextFieldItem before size={size}>
32
- <SilkeIcon icon="search" />
33
+ <SilkeTextField kind="ghost" {...rest} value={value} onChange={handleChange} size={size} inline>
34
+ <SilkeTextFieldItem before align="center">
35
+ <SilkeBox size={size} align="center">
36
+ <SilkeIcon icon="search" />
37
+ </SilkeBox>
33
38
  </SilkeTextFieldItem>
34
39
  {value && (
35
40
  <SilkeTextFieldItem>