@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
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { SilkeBox } from '../silke-box';
3
+ import { SilkeTag, SilkeTagProps } from '../silke-tag';
4
+ import { SilkeOverflowMenu, SilkeOverflowMenuItem } from '../silke-overflow-menu';
5
+ import { SilkeText, SilkeTextSmall } from '../silke-text';
6
+ import { SilkeImage } from '../silke-image';
7
+
8
+ import styles from './silke-list-card.scss';
9
+
10
+ export type SilkeListItemsProps = {
11
+ title: string;
12
+ subtitle?: string;
13
+ image?: string;
14
+ tag?: Omit<SilkeTagProps, 'size'>;
15
+ menu?: MenuItems;
16
+ state?: 'hover' | 'focus' | 'disabled' | 'selected' | '';
17
+ };
18
+
19
+ type MenuItems =
20
+ | (SilkeOverflowMenuItem | React.ReactElement | 'divider')[]
21
+ | (() => (SilkeOverflowMenuItem | React.ReactElement | 'divider')[]);
22
+
23
+ export function SilkeListCard({
24
+ title,
25
+ subtitle,
26
+ image,
27
+ tag,
28
+ menu,
29
+ state = '',
30
+ }: SilkeListItemsProps) {
31
+ const tagProps = { ...tag, size: 'tiny' } as SilkeTagProps;
32
+
33
+ console.log('state', state);
34
+
35
+ return (
36
+ <SilkeBox
37
+ pad="m"
38
+ bg="surface-1"
39
+ className={[styles.card, styles[state]].join(' ')}
40
+ tabIndex={0}
41
+ >
42
+ <SilkeBox gap="m">
43
+ {image && (
44
+ <SilkeBox>
45
+ <SilkeImage src={image} aspectRatio="1:1" className={styles.image} />
46
+ </SilkeBox>
47
+ )}
48
+ <SilkeBox column gap="none" style={{ justifyContent: 'center' }}>
49
+ <SilkeText color="neutral-100" size="base">
50
+ {title}
51
+ </SilkeText>
52
+ {subtitle && <SilkeTextSmall color="neutral-70">{subtitle}</SilkeTextSmall>}
53
+ </SilkeBox>
54
+ </SilkeBox>
55
+ <SilkeBox align="center" gap="m">
56
+ {tag?.label && (
57
+ <SilkeBox align="center">
58
+ <SilkeTag {...tagProps} />{' '}
59
+ </SilkeBox>
60
+ )}
61
+ {menu && <SilkeOverflowMenu items={menu} size="s" />}
62
+ </SilkeBox>
63
+ </SilkeBox>
64
+ );
65
+ }
@@ -1 +1,2 @@
1
1
  export * from './silke-loader';
2
+ export * from './silke-loader-overlay';
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { SilkeColor } from '../../silke-theme-provider';
3
+ import { BoxDivProps, SilkeBox } from '../silke-box';
4
+ import { LoaderSVG } from './silke-loader';
5
+ import './silke-loader.scss';
6
+
7
+ interface SilkeLoaderProps extends BoxDivProps {
8
+ loading: boolean;
9
+ message?: string;
10
+ children?: React.ReactNode;
11
+ randomGenerator?: () => string;
12
+ style?: React.CSSProperties;
13
+ bg?: SilkeColor;
14
+ /**
15
+ * Stops the loader animation on the vev logo
16
+ */
17
+ stop?: boolean;
18
+ }
19
+
20
+ export function SilkeLoaderOverlay({
21
+ message,
22
+ loading,
23
+ size,
24
+ stop,
25
+ style,
26
+ children,
27
+ bg,
28
+ randomGenerator,
29
+ ...rest
30
+ }: SilkeLoaderProps) {
31
+ return (
32
+ <>
33
+ {loading && (
34
+ <>
35
+ <SilkeBox column align="center" style={{ zIndex: 999 }} {...rest}>
36
+ <LoaderSVG stop={stop} style={style} />
37
+ {message && <div className="text-fade">{message}</div>}
38
+ {randomGenerator && <div className="text-fade">{randomGenerator()}</div>}
39
+ </SilkeBox>
40
+ <BgOverlay bg={bg} />
41
+ </>
42
+ )}
43
+ {children}
44
+ </>
45
+ );
46
+ }
47
+
48
+ const BgOverlay = ({ bg = 'neutral-0' }: { bg?: SilkeColor }) => {
49
+ return (
50
+ <SilkeBox
51
+ bg={bg}
52
+ style={{
53
+ position: 'absolute',
54
+ width: '100%',
55
+ height: '100%',
56
+ top: 0,
57
+ left: 0,
58
+ opacity: 'var(--opacity-level-semiopaque)',
59
+ zIndex: 998,
60
+ }}
61
+ />
62
+ );
63
+ };
@@ -0,0 +1,112 @@
1
+ @use "sass:math";
2
+
3
+ $animationDuration: 0.8s;
4
+ // Percent duration of fade transition between characters
5
+ $fadeDuration: 0.22;
6
+
7
+ @function pDown($p) {
8
+ @return percentage($p - math.div($fadeDuration, 2));
9
+ }
10
+
11
+ @function pUp($p) {
12
+ @return percentage($p + math.div($fadeDuration, 2));
13
+ }
14
+ :global {
15
+ .loader {
16
+ width: 60px;
17
+ height: 60px;
18
+ path {
19
+ fill: currentColor;
20
+ animation-duration: $animationDuration;
21
+ animation-timing-function: linear;
22
+ animation-iteration-count: infinite;
23
+ }
24
+
25
+ .upSmallE,
26
+ .bigE,
27
+ .downSmallV {
28
+ opacity: 0;
29
+ }
30
+
31
+ .downSmallE,
32
+ .downSmallV {
33
+ animation-direction: reverse;
34
+ }
35
+
36
+ &:not(.stop) {
37
+ .upSmallV,
38
+ .downSmallV {
39
+ animation-name: smallUpV;
40
+ }
41
+ .upSmallE,
42
+ .downSmallE {
43
+ animation-name: smallUpE;
44
+ }
45
+
46
+ .bigV {
47
+ animation-name: bigV;
48
+ }
49
+
50
+ .bigE {
51
+ animation-name: bigE;
52
+ }
53
+ }
54
+
55
+ @keyframes :global(smallUpV) {
56
+ #{pUp(0)} {
57
+ opacity: 1;
58
+ }
59
+ #{pDown(0.66)} {
60
+ opacity: 1;
61
+ }
62
+ #{pUp(0.66)} {
63
+ opacity: 0;
64
+ }
65
+ #{pDown(1)} {
66
+ opacity: 0;
67
+ }
68
+ }
69
+ @keyframes :global(smallUpE) {
70
+ #{pUp(0)} {
71
+ opacity: 0;
72
+ }
73
+ #{pDown(0.66)} {
74
+ opacity: 0;
75
+ }
76
+ #{pUp(0.66)} {
77
+ opacity: 1;
78
+ }
79
+ #{pDown(1)} {
80
+ opacity: 1;
81
+ }
82
+ }
83
+ @keyframes :global(bigE) {
84
+ #{pDown(0.33)} {
85
+ opacity: 0;
86
+ }
87
+ #{pUp(0.33)} {
88
+ opacity: 1;
89
+ }
90
+ #{pDown(0.66)} {
91
+ opacity: 1;
92
+ }
93
+ #{pUp(0.66)} {
94
+ opacity: 0;
95
+ }
96
+ }
97
+ @keyframes :global(bigV) {
98
+ #{pDown(0.33)} {
99
+ opacity: 1;
100
+ }
101
+ #{pUp(0.33)} {
102
+ opacity: 0;
103
+ }
104
+ #{pDown(0.66)} {
105
+ opacity: 0;
106
+ }
107
+ #{pUp(0.66)} {
108
+ opacity: 1;
109
+ }
110
+ }
111
+ }
112
+ }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { BoxDivProps, BoxSize, SilkeBox } from '../silke-box';
3
+ import './silke-loader.scss';
3
4
 
4
5
  interface SilkeLoaderProps extends BoxDivProps {
5
6
  message?: string;
@@ -50,7 +50,7 @@ export function SilkeConfirmationModal({
50
50
  />
51
51
 
52
52
  <SilkeButton
53
- label={confirmLabel}
53
+ label={confirmLabel || 'Confirm'}
54
54
  icon={confirmIcon}
55
55
  kind={confirmKind}
56
56
  onClick={onConfirm}
@@ -55,7 +55,7 @@ const toggleOpen = () => setHide(!hide);
55
55
  <SilkeBox vPad gap vAlign="center">
56
56
  <SilkeImage src={ipsum.image()} avatar="large" />
57
57
  <SilkeBox column>
58
- <SilkeText color="secondary" kind="small">
58
+ <SilkeText color="neutral-80" kind="small">
59
59
  Written by
60
60
  </SilkeText>
61
61
  <SilkeText>{ipsum.name()}</SilkeText>
@@ -5,16 +5,19 @@ $modal-max-width-mobile: 100vh;
5
5
  $modal-max-height: 100vh;
6
6
  $modal-max-height-mobile: 100vh;
7
7
 
8
+ body{
9
+ --modal-overlay-background:rgba(var(--color-black-rgb), var(--opacity-level-semiopaque));
10
+ }
11
+
8
12
  .modal {
9
13
  min-width: $modal-min-width;
10
14
  max-width: $modal-max-width;
11
15
  max-height: $modal-max-height;
12
- border-radius: var(--border-radius-small);
13
16
  & > form{
14
17
  overflow: hidden;
15
18
  }
16
19
 
17
- box-shadow: 0 0 0 10000px rgba(var(--color-neutral-low-pure-rgb), var(--opacity-level-semiopaque));
20
+
18
21
  }
19
22
 
20
23
  @media screen and (max-width: #{$modal-max-width}) {
@@ -26,20 +29,23 @@ $modal-max-height-mobile: 100vh;
26
29
 
27
30
  .modal:focus {
28
31
  outline: none;
29
- box-shadow: 0 0 0 3px var(--color-neutral-high-pure), 0 0 0 10000px rgba(var(--color-neutral-low-pure-rgb), var(--opacity-level-semiopaque));
32
+ box-shadow: 0 0 0 3px var(--color-neutral-100), 0 0 0 10000px rgba(var(--color-neutral-0-rgb), var(--opacity-level-semiopaque));
30
33
  }
31
34
  }
32
35
 
33
36
  .content {
34
37
  flex: 1;
35
- width:calc(100% - #{$space-m * 2});
36
38
  overflow: hidden;
37
- overflow-y: scroll;
39
+ overflow-y: auto;
38
40
  }
39
41
 
40
- .actions{
41
- width: 100%;
42
- button, a {
43
- flex: 1;
44
- }
42
+ .overlay{
43
+ width: 100vw;
44
+ height:100vh;
45
+ inset:0 0 0 0;
46
+ background-color: var(--modal-overlay-background);
45
47
  }
48
+
49
+ .buttons {
50
+ margin-top: 8px;
51
+ }
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes, useRef } from 'react';
2
- import { SilkeBox } from '../silke-box';
2
+ import { BoxSpace, SilkeBox } from '../silke-box';
3
3
  import { SilkeButton, SilkeButtonSet, SilkeButtonSetProps } from '../silke-button';
4
4
  import { SilkeIcon } from '../silke-icon';
5
5
  import { SilkePopover } from '../silke-popover';
@@ -7,55 +7,79 @@ import { SilkeTitle } from '../silke-text';
7
7
  import styles from './silke-modal.scss';
8
8
 
9
9
  export type SilkeModalProps = {
10
- title?: string;
10
+ title?: React.ReactNode;
11
11
  children?: React.ReactNode;
12
12
  hide?: boolean;
13
+ style?: React.CSSProperties;
14
+ pad?: BoxSpace;
15
+ rounded?: boolean | 'tiny' | 'small' | 'medium' | 'full';
13
16
  onBack?: () => void;
14
17
  onClose?: () => void;
18
+ contextId?: string;
15
19
  };
16
20
 
17
- export function SilkeModal({ title, children, onBack, onClose, ...rest }: SilkeModalProps) {
21
+ export function SilkeModal({
22
+ title,
23
+ children,
24
+ style,
25
+ pad,
26
+ rounded,
27
+ onBack,
28
+ onClose,
29
+ contextId = 'silke.modal',
30
+ ...rest
31
+ }: SilkeModalProps) {
18
32
  const modalRef = useRef<HTMLDivElement>(null);
19
33
 
20
34
  return (
21
- <SilkePopover {...rest} contextId="silke.modal" onRequestClose={onClose} focusRef={modalRef}>
22
- <SilkeBox
23
- className={styles.modal}
24
- column
25
- bg="layer"
26
- gap="m"
27
- pad="l"
28
- tabIndex={-1}
29
- ref={modalRef}
30
- aria-modal="true"
31
- role="dialog"
32
- aria-labelledby="modal-title"
33
- scroll
34
- >
35
- {(title || onClose || onBack) && (
36
- <SilkeBox gap="m" vAlign="center">
37
- {onBack && (
38
- <SilkeBox pad="m" onClick={onBack}>
39
- <SilkeIcon icon="left" />
35
+ <>
36
+ {!rest.hide && (
37
+ <SilkePopover>
38
+ <div className={styles.overlay} onMouseDown={onClose} />
39
+ </SilkePopover>
40
+ )}
41
+ <SilkePopover {...rest} contextId={contextId} onRequestClose={onClose} focusRef={modalRef}>
42
+ <SilkeBox
43
+ className={styles.modal}
44
+ column
45
+ bg="neutral-5"
46
+ gap="m"
47
+ pad={pad === undefined ? 'l' : pad}
48
+ tabIndex={-1}
49
+ ref={modalRef}
50
+ aria-modal="true"
51
+ role="dialog"
52
+ aria-labelledby="modal-title"
53
+ style={style}
54
+ rounded={rounded || 'small'}
55
+ shadow="level4"
56
+ scroll
57
+ >
58
+ {(title || onClose || onBack) && (
59
+ <SilkeBox gap="m" vAlign="center">
60
+ {onBack && (
61
+ <SilkeBox pad="m" onClick={onBack}>
62
+ <SilkeIcon icon="left" />
63
+ </SilkeBox>
64
+ )}
65
+ <SilkeBox column gap="xs" flex align={['start', 'center']} id="modal-title">
66
+ {title && <SilkeTitle kind="s">{title}</SilkeTitle>}
40
67
  </SilkeBox>
41
- )}
42
- <SilkeBox column gap="xs" flex align={['start', 'center']} id="modal-title">
43
- {title && <SilkeTitle kind="xs">{title}</SilkeTitle>}
68
+ {onClose && (
69
+ <SilkeButton
70
+ aria-label="Close modal"
71
+ icon="close"
72
+ kind="ghost"
73
+ size="base"
74
+ onClick={onClose}
75
+ />
76
+ )}
44
77
  </SilkeBox>
45
- {onClose && (
46
- <SilkeButton
47
- aria-label="Close modal"
48
- icon="close"
49
- kind="ghost"
50
- size="base"
51
- onClick={onClose}
52
- />
53
- )}
54
- </SilkeBox>
55
- )}
56
- {children}
57
- </SilkeBox>
58
- </SilkePopover>
78
+ )}
79
+ {children}
80
+ </SilkeBox>
81
+ </SilkePopover>
82
+ </>
59
83
  );
60
84
  }
61
85
 
@@ -73,15 +97,9 @@ export function SilkeModalContent({
73
97
  );
74
98
  }
75
99
 
76
- export function SilkeModalActions({
77
- children,
78
- className,
79
- ...rest
80
- }: Omit<SilkeButtonSetProps, 'size'>) {
81
- let cl = styles.actions;
82
- if (className) cl += ' ' + className;
100
+ export function SilkeModalActions({ children, ...rest }: Omit<SilkeButtonSetProps, 'size'>) {
83
101
  return (
84
- <SilkeButtonSet {...rest} className={cl} size="m" gap="m">
102
+ <SilkeButtonSet {...rest} size="m" hAlign="end" className={styles.buttons}>
85
103
  {children}
86
104
  </SilkeButtonSet>
87
105
  );
@@ -1,71 +1,99 @@
1
- @use '../../variables' as *;
1
+ @use "../../variables" as *;
2
+
3
+ body {
4
+ --nav-item-color: var(--color-neutral-80);
5
+ --nav-item-color-hover: var(--color-neutral-90);
6
+ --nav-item-color-pressed: var(--color);
7
+ --nav-item-background-pressed: var(--color);
8
+ }
2
9
  .main {
3
10
  min-height: $size-m;
4
- background: inherit;
5
11
  position: relative;
6
- text-align: left;
7
- padding-right: $space-s;
12
+ margin: 0 $space-l $space-xs;
13
+ padding: 0;
8
14
 
9
- &:hover {
10
- background: var(--color-neutral-low-medium);
15
+ &:last-child {
16
+ margin-bottom: 0;
17
+ }
11
18
 
12
- .rightButtons {
13
- display: unset;
19
+ &.hasRightButtons{
20
+ .link{
21
+ padding-right:40px;
14
22
  }
15
23
  }
16
24
 
17
- &.active {
18
- background: var(--color-neutral-low-medium);
25
+ &:hover {
26
+ .rightButtons {
27
+ display: block;
28
+ }
19
29
  }
20
30
 
21
- &.active .link {
22
- color: var(--color-neutral-high-pure);
31
+ &::before {
32
+ position: absolute;
33
+ content: "";
34
+ display: block;
35
+ height: calc(100% - 24px);
36
+ width: 4px;
37
+ border-radius: var(--border-radius-tiny);
38
+
39
+ margin: 12px 0 12px -12px;
40
+ pointer-events: none;
41
+ transform: translateX(-12px);
42
+ opacity: 1;
43
+ transition: all 0.2s ease-out;
44
+ }
23
45
 
24
- &:before {
25
- border-left: 4px solid var(--color-brand-primary-soft);
46
+ &.active {
47
+ .link {
48
+ background: var(--color-surface-1);
26
49
  }
27
50
 
28
- &:focus-visible:before {
29
- border-left-color: var(--color-neutral-high-pure);
51
+ &::before {
52
+ background: var(--color-accent-30);
53
+ transform: translateX(0);
54
+ opacity: 1;
30
55
  }
31
56
 
32
- & .rightButtons {
33
- display: unset;
57
+ .link {
58
+ color: var(--color-neutral-100);
34
59
  }
35
60
  }
36
- }
37
61
 
38
- .link {
39
- color: var(--color-neutral-high-soft);
40
- padding: 0 0 0 $space-m;
41
- text-align: left;
42
- overflow:hidden;
43
- background-color: transparent;
62
+ .link {
63
+ border-radius: var(--border-radius-small);
64
+ color: var(--nav-item-color);
65
+ text-align: left;
66
+ background-color: transparent;
44
67
 
45
- &:focus {
46
- outline: none;
47
- }
68
+ &:focus {
69
+ outline: none;
70
+ }
48
71
 
49
- &:focus-visible:before {
50
- border: $space-xxs solid var(--color-neutral-high-pure);
72
+ &:focus-visible {
73
+ outline: 1px solid var(--color-neutral-100);
74
+ }
75
+
76
+ &:hover {
77
+ background: var(--color-surface-1);
78
+ color: var(--nav-item-color-hover);
79
+ }
51
80
  }
52
81
 
53
- &:before {
82
+ .rightContent {
83
+ pointer-events: none;
54
84
  position: absolute;
55
- display: block;
56
- top: 0;
57
- left: 0;
58
85
  right: 0;
59
- bottom: 0;
60
- content: "";
61
- pointer-events: none;
86
+ top: 0;
87
+ button, a {
88
+ pointer-events: all;
89
+ }
62
90
  }
63
91
  }
64
92
 
65
- .rightButtons {
66
- display: none;
67
- }
68
-
69
93
  .label {
70
94
  min-width: 0;
71
95
  }
96
+
97
+ .rightButtons {
98
+ display: none;
99
+ }
@@ -10,7 +10,7 @@ import styles from './silke-navigation-link.scss';
10
10
 
11
11
  type SilkeNavigationLinkProps = {
12
12
  active?: boolean;
13
- icon?: IEmojiIcon | SilkeIcons;
13
+ icon?: IEmojiIcon | SilkeIcons | React.ReactElement;
14
14
  label: ReactNode;
15
15
  linkClassName?: string;
16
16
  /**
@@ -31,17 +31,18 @@ export function SilkeNavigationLink({
31
31
  children,
32
32
  link,
33
33
  rightButtons,
34
+ align,
34
35
  ...rest
35
36
  }: SilkeNavigationLinkProps) {
36
37
  const cl = [styles.main];
37
38
 
38
39
  if (className) cl.push(className);
39
40
  if (active) cl.push(styles.active);
40
-
41
+ if (rightButtons) cl.push(styles.hasRightButtons);
41
42
  const linkClass = linkClassName ? [styles.link, linkClassName] : [styles.link];
42
43
 
43
44
  return (
44
- <SilkeBox className={cl.join(' ')} gap="m">
45
+ <SilkeBox className={cl.join(' ')} gap="xxs" tag="div">
45
46
  <SilkeBox
46
47
  {...(typeof link === 'string'
47
48
  ? {
@@ -57,29 +58,40 @@ export function SilkeNavigationLink({
57
58
  className={linkClass.join(' ')}
58
59
  flex
59
60
  vAlign="center"
60
- gap="m"
61
+ gap="s"
61
62
  >
62
- {isString(icon) ? (
63
- <SilkeBox align="center" size="s">
64
- <SilkeIcon icon={icon || 'error'} />
63
+ {icon ? (
64
+ <SilkeBox size="m" align="center" pad="s" style={{ fontSize: 14 }}>
65
+ {React.isValidElement(icon) || isString(icon) ? (
66
+ <SilkeIcon icon={icon || 'error'} />
67
+ ) : (
68
+ <SilkeImage icon={icon} avatar="s" />
69
+ )}
65
70
  </SilkeBox>
66
71
  ) : (
67
- <SilkeImage icon={icon} avatar="s" />
72
+ <SilkeBox width="xs" />
68
73
  )}
69
74
 
70
- <SilkeBox vPad="xs" flex className={styles.label}>
75
+ <SilkeBox flex className={styles.label}>
71
76
  <SilkeText flex overflow>
72
77
  {label || 'just a link'}
73
78
  </SilkeText>
74
79
  </SilkeBox>
75
80
  </SilkeBox>
76
81
  {children || rightButtons ? (
77
- <SilkeBox vAlign="center" gap="xs" onClick={(e: React.MouseEvent) => e.stopPropagation()}>
78
- <ButtonContext size="s" kind="ghost">
82
+ <ButtonContext size="base" kind="ghost">
83
+ <SilkeBox className={styles.rightContent} vAlign="center" height="m" hPad="xs">
79
84
  {children}
80
- <div className={styles.rightButtons}>{rightButtons}</div>
81
- </ButtonContext>
82
- </SilkeBox>
85
+ {rightButtons && (
86
+ <div
87
+ className={styles.rightButtons}
88
+ onClick={(e: React.MouseEvent) => e.stopPropagation()}
89
+ >
90
+ {rightButtons}
91
+ </div>
92
+ )}
93
+ </SilkeBox>
94
+ </ButtonContext>
83
95
  ) : null}
84
96
  </SilkeBox>
85
97
  );