@bspk/ui 1.3.18 → 1.3.20

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 (107) hide show
  1. package/dist/components/Accordion/AccordionExample.js +1 -1
  2. package/dist/components/Accordion/AccordionExample.js.map +1 -1
  3. package/dist/components/BannerAlert/BannerAlert.js +1 -1
  4. package/dist/components/BannerAlert/BannerAlert.js.map +1 -1
  5. package/dist/components/BannerAlert/banner-alert.css +3 -3
  6. package/dist/components/BannerAlert/banner-alert.css.js +3 -3
  7. package/dist/components/CheckboxOption/CheckboxOption.d.ts +15 -3
  8. package/dist/components/CheckboxOption/CheckboxOption.js +2 -3
  9. package/dist/components/CheckboxOption/CheckboxOption.js.map +1 -1
  10. package/dist/components/Dialog/Dialog.d.ts +17 -7
  11. package/dist/components/Dialog/Dialog.js +19 -11
  12. package/dist/components/Dialog/Dialog.js.map +1 -1
  13. package/dist/components/Dialog/DialogExample.d.ts +2 -2
  14. package/dist/components/Dialog/DialogExample.js +32 -3
  15. package/dist/components/Dialog/DialogExample.js.map +1 -1
  16. package/dist/components/Dialog/dialog.css +74 -4
  17. package/dist/components/Dialog/dialog.css.js +74 -4
  18. package/dist/components/Flex/Flex.d.ts +2 -0
  19. package/dist/components/Flex/Flex.js +1 -0
  20. package/dist/components/Flex/Flex.js.map +1 -1
  21. package/dist/components/ListItem/list-item.css +4 -0
  22. package/dist/components/ListItem/list-item.css.js +4 -0
  23. package/dist/components/Modal/Modal.js +1 -2
  24. package/dist/components/Modal/Modal.js.map +1 -1
  25. package/dist/components/Modal/modal.css +4 -0
  26. package/dist/components/Modal/modal.css.js +4 -0
  27. package/dist/components/PageHeader/PageHeader.d.ts +1 -1
  28. package/dist/components/PageHeader/PageHeader.js +1 -1
  29. package/dist/components/PageHeader/PageHeaderBlockConfigs.d.ts +1 -0
  30. package/dist/components/PageHeader/PageHeaderBlockConfigs.js +32 -0
  31. package/dist/components/PageHeader/PageHeaderBlockConfigs.js.map +1 -0
  32. package/dist/components/PageHeader/PageHeaderExample.d.ts +3 -2
  33. package/dist/components/PageHeader/PageHeaderExample.js +4 -42
  34. package/dist/components/PageHeader/PageHeaderExample.js.map +1 -1
  35. package/dist/components/PageHeader/page-header.css +1 -1
  36. package/dist/components/PageHeader/page-header.css.js +1 -1
  37. package/dist/components/Portal/Portal.d.ts +1 -1
  38. package/dist/components/RadioOption/RadioOption.d.ts +7 -3
  39. package/dist/components/RadioOption/RadioOption.js +2 -3
  40. package/dist/components/RadioOption/RadioOption.js.map +1 -1
  41. package/dist/components/Scrim/Scrim.d.ts +3 -1
  42. package/dist/components/Scrim/Scrim.js +2 -2
  43. package/dist/components/Scrim/Scrim.js.map +1 -1
  44. package/dist/components/Scrim/scrim.css +3 -0
  45. package/dist/components/Scrim/scrim.css.js +3 -0
  46. package/dist/components/Switch/Switch.d.ts +1 -1
  47. package/dist/components/SwitchOption/SwitchOption.d.ts +16 -3
  48. package/dist/components/SwitchOption/SwitchOption.js +3 -4
  49. package/dist/components/SwitchOption/SwitchOption.js.map +1 -1
  50. package/dist/components/Tag/Tag.d.ts +2 -1
  51. package/dist/components/Tag/Tag.js +2 -2
  52. package/dist/components/Tag/Tag.js.map +1 -1
  53. package/dist/styles/base.css +0 -42
  54. package/dist/styles/base.css.js +0 -42
  55. package/dist/types/meta.d.ts +6 -0
  56. package/dist/types/meta.js.map +1 -1
  57. package/dist/utils/blocks.d.ts +32 -0
  58. package/dist/utils/blocks.js +21 -0
  59. package/dist/utils/blocks.js.map +1 -0
  60. package/dist/utils/demo.d.ts +33 -9
  61. package/dist/utils/demo.js +98 -0
  62. package/dist/utils/demo.js.map +1 -1
  63. package/meta.ts +39 -1
  64. package/package.json +1 -3
  65. package/src/components/Accordion/AccordionExample.tsx +1 -1
  66. package/src/components/BannerAlert/BannerAlert.tsx +2 -2
  67. package/src/components/BannerAlert/banner-alert.scss +1 -1
  68. package/src/components/CheckboxOption/CheckboxOption.tsx +26 -14
  69. package/src/components/Dialog/Dialog.tsx +20 -10
  70. package/src/components/Dialog/DialogExample.tsx +104 -6
  71. package/src/components/Dialog/dialog.scss +91 -4
  72. package/src/components/Flex/Flex.tsx +3 -0
  73. package/src/components/ListItem/list-item.scss +4 -0
  74. package/src/components/Modal/Modal.tsx +1 -4
  75. package/src/components/Modal/modal.scss +5 -0
  76. package/src/components/PageHeader/PageHeader.rtl.test.tsx +8 -5
  77. package/src/components/PageHeader/PageHeader.tsx +1 -1
  78. package/src/components/PageHeader/PageHeaderBlockConfigs.tsx +152 -0
  79. package/src/components/PageHeader/PageHeaderExample.tsx +6 -44
  80. package/src/components/PageHeader/page-header.scss +1 -1
  81. package/src/components/Portal/Portal.tsx +1 -1
  82. package/src/components/RadioOption/RadioOption.tsx +16 -8
  83. package/src/components/Scrim/Scrim.tsx +4 -1
  84. package/src/components/Scrim/scrim.scss +4 -0
  85. package/src/components/Switch/Switch.tsx +1 -1
  86. package/src/components/SwitchOption/SwitchOption.tsx +28 -9
  87. package/src/components/Tag/Tag.tsx +9 -2
  88. package/src/styles/base.scss +0 -52
  89. package/src/types/meta.ts +7 -0
  90. package/src/utils/blocks.ts +26 -0
  91. package/src/utils/demo.ts +141 -18
  92. package/dist/components/Drawer/Drawer.d.ts +0 -73
  93. package/dist/components/Drawer/Drawer.js +0 -46
  94. package/dist/components/Drawer/Drawer.js.map +0 -1
  95. package/dist/components/Drawer/DrawerExample.d.ts +0 -5
  96. package/dist/components/Drawer/DrawerExample.js +0 -53
  97. package/dist/components/Drawer/DrawerExample.js.map +0 -1
  98. package/dist/components/Drawer/drawer.css +0 -62
  99. package/dist/components/Drawer/drawer.css.js +0 -67
  100. package/dist/components/Drawer/index.d.ts +0 -1
  101. package/dist/components/Drawer/index.js +0 -2
  102. package/dist/components/Drawer/index.js.map +0 -1
  103. package/src/components/Drawer/Drawer.rtl.test.tsx +0 -27
  104. package/src/components/Drawer/Drawer.tsx +0 -127
  105. package/src/components/Drawer/DrawerExample.tsx +0 -117
  106. package/src/components/Drawer/drawer.scss +0 -74
  107. package/src/components/Drawer/index.tsx +0 -1
@@ -310,58 +310,6 @@ body[data-bspk] {
310
310
  }
311
311
  }
312
312
 
313
- @keyframes fade-in {
314
- 0% {
315
- opacity: 0;
316
- transform: translate(var(--spacing-sizing-01), var(--spacing-sizing-01));
317
- }
318
-
319
- 100% {
320
- opacity: 1;
321
- transform: translate(0, 0);
322
- }
323
- }
324
-
325
- @keyframes placement-left {
326
- 0% {
327
- transform: translateX(-100vw);
328
- }
329
-
330
- 100% {
331
- transform: translateX(0);
332
- }
333
- }
334
-
335
- @keyframes placement-right {
336
- 0% {
337
- transform: translateX(100vw);
338
- }
339
-
340
- 100% {
341
- transform: translateX(0);
342
- }
343
- }
344
-
345
- @keyframes placement-top {
346
- 0% {
347
- transform: translateY(-100vh);
348
- }
349
-
350
- 100% {
351
- transform: translateY(0);
352
- }
353
- }
354
-
355
- @keyframes placement-bottom {
356
- 0% {
357
- transform: translateY(100vh);
358
- }
359
-
360
- 100% {
361
- transform: translateY(0);
362
- }
363
- }
364
-
365
313
  [data-hidden] {
366
314
  display: none !important;
367
315
  }
package/src/types/meta.ts CHANGED
@@ -72,6 +72,12 @@ export type TypeProperty = {
72
72
  arrayType?: string;
73
73
  };
74
74
 
75
+ export type BlockConfig = {
76
+ name: string;
77
+ component: string;
78
+ pattern: string;
79
+ };
80
+
75
81
  export type ComponentMeta = BaseMeta & {
76
82
  slug: string;
77
83
  dependencies: string[];
@@ -83,6 +89,7 @@ export type ComponentMeta = BaseMeta & {
83
89
  };
84
90
  phase: ComponentPhase;
85
91
  generated?: boolean;
92
+ blockConfigs?: BlockConfig[];
86
93
  };
87
94
 
88
95
  export type UtilityMeta = BaseMeta & {
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from 'react';
2
+ import { ExamplePlaceholder } from '-/components/ExamplePlaceholder';
3
+
4
+ export const Slot = ExamplePlaceholder;
5
+
6
+ function BlockExample(props: { name: string; children: ReactNode }) {
7
+ return {
8
+ ...props,
9
+ type: '',
10
+ props: {},
11
+ key: '',
12
+ };
13
+ }
14
+
15
+ BlockExample.Pattern = (props: { children: ReactNode }) => {
16
+ return {
17
+ ...props,
18
+ type: '',
19
+ props: {},
20
+ key: '',
21
+ };
22
+ };
23
+
24
+ BlockExample.Component = BlockExample.Pattern;
25
+
26
+ export { BlockExample };
package/src/utils/demo.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties, isValidElement, ReactNode } from 'react';
2
+
2
3
  import { AlertVariant, DataProps } from '-/types/common';
3
- import { ComponentMeta, TypeProperty } from '-/types/meta';
4
+ import { BlockConfig, ComponentMeta, TypeProperty } from '-/types/meta';
4
5
 
5
6
  export type DemoAction = (message: string, variant?: AlertVariant) => void;
6
7
 
@@ -43,11 +44,13 @@ export type ComponentVariantOverride<Props> = {
43
44
  };
44
45
 
45
46
  export type ComponentPageSection<Props = Record<string, unknown>> = {
46
- title: string;
47
- content: (params: {
47
+ title?: string;
48
+ description?: string;
49
+ content?: (params: {
48
50
  Component?: React.ComponentType<Props>;
49
51
  props: Props;
50
52
  CodeExample: CodeExample;
53
+ CodePlayground: CodePlayground;
51
54
  Syntax: Syntax;
52
55
  }) => React.ReactNode;
53
56
  location?: 'afterDemo' | 'beforeDemo';
@@ -62,7 +65,10 @@ export type ComponentVariantOverrides<Props = Record<string, unknown>, PropName
62
65
  [Key in PropName]?: ComponentVariantOverride<Props> | false;
63
66
  };
64
67
 
65
- export type ComponentExample<Props = Record<string, unknown>, PropName extends keyof Props = keyof Props> = {
68
+ export type ComponentExample<
69
+ Props extends Record<string, unknown> = Record<string, unknown>,
70
+ PropName extends keyof Props = keyof Props,
71
+ > = {
66
72
  /**
67
73
  * The style of the wrapping component.
68
74
  *
@@ -118,6 +124,14 @@ export type ComponentExample<Props = Record<string, unknown>, PropName extends k
118
124
  * @default false
119
125
  */
120
126
  hideDemo?: boolean;
127
+ /**
128
+ * Hide the usage section entirely.
129
+ *
130
+ * @default false
131
+ */
132
+ hideUsage?: boolean;
133
+ /** Block Configs */
134
+ blockConfigs?: BlockConfig[];
121
135
  };
122
136
 
123
137
  export type Syntax = (params: {
@@ -128,20 +142,29 @@ export type Syntax = (params: {
128
142
  }) => React.ReactNode;
129
143
 
130
144
  export type CodeExample = (
131
- params: DataProps & {
132
- containerStyle?: CSSProperties;
133
- children: ReactNode;
134
- accessibility?: boolean;
135
- code?: {
136
- language?: PrettyParser | undefined;
137
- str: string;
138
- };
139
- },
140
- ) => React.ReactNode;
145
+ params: DataProps &
146
+ any & {
147
+ containerStyle?: CSSProperties;
148
+ children: ReactNode;
149
+ accessibility?: boolean;
150
+ code?: {
151
+ language?: PrettyParser | undefined;
152
+ str: string;
153
+ };
154
+ style?: CSSProperties;
155
+ },
156
+ ) => JSX.Element;
157
+
158
+ export type CodePlaygroundProps = {
159
+ defaultCode: string;
160
+ defaultShowCode?: boolean;
161
+ };
162
+
163
+ export type CodePlayground = (params: CodePlaygroundProps) => JSX.Element;
141
164
 
142
165
  export type PrettyParser = 'css' | 'estree' | 'html' | 'scss' | 'typescript';
143
166
 
144
- export type ComponentExampleFn<Props = Record<string, unknown>> = (params: {
167
+ export type ComponentExampleFn<Props extends Record<string, unknown> = Record<string, unknown>> = (params: {
145
168
  setState: DemoSetState<Props>;
146
169
  action: DemoAction;
147
170
  componentsMeta: ComponentMeta[];
@@ -160,11 +183,15 @@ export type Preset<Props> = {
160
183
  /** The props of the component. This is used to set props of the component. These values can't be changed in the UI. */
161
184
  propState: Omit<Props, OnHandlers> & Record<OnHandlers, unknown>;
162
185
  /**
163
- * Hide the demo for this preset.
186
+ * Hide the demo option for this preset.
164
187
  *
165
188
  * @default false
166
189
  */
167
- hideDemo?: boolean;
190
+ hideDemoOption?: boolean;
191
+ /** Hide the playground for this preset. */
192
+ hidePlayground?: boolean;
193
+ /** Preset used for block examples. */
194
+ block?: boolean;
168
195
  };
169
196
 
170
197
  export type DemoPreset<P = Record<string, unknown>> = Preset<P> & {
@@ -174,3 +201,99 @@ export type DemoPreset<P = Record<string, unknown>> = Preset<P> & {
174
201
  export function createUid(prefix: string = 'uid'): string {
175
202
  return `${prefix}-${Math.random().toString(36).substring(2, 9)}`;
176
203
  }
204
+
205
+ export function reactElementToString(element: React.ReactElement): string {
206
+ if (!isReactElement(element)) return '';
207
+ const subComponentName = typeof element.type === 'string' ? element.type : element.type.name || 'Component';
208
+ return componentToString(subComponentName, element.props);
209
+ }
210
+
211
+ export function componentToString<Props extends Record<string, any> = Record<string, any>>(
212
+ componentName: string,
213
+ propState: Props,
214
+ propsMeta?: TypePropertyDemo[],
215
+ ): string {
216
+ const propsString = Object.entries(propState)
217
+ .map(([key, value]) => {
218
+ const propMeta = propsMeta?.find((prop) => prop.name === key);
219
+
220
+ let formattedValue;
221
+ if (typeof value === 'string') {
222
+ formattedValue = `"${value}"`;
223
+ if (propMeta?.type === 'BspkIcon') formattedValue = `{<Svg${value} />}`;
224
+ } else if (typeof value === 'boolean' || typeof value === 'number') {
225
+ formattedValue = `{${value}}`;
226
+ } else if (isReactElement(value)) {
227
+ const subComponentName = typeof value.type === 'string' ? value.type : value.type.name || 'Component';
228
+ formattedValue = `{${componentToString(subComponentName, value.props)}}`;
229
+ } else if (Array.isArray(value)) {
230
+ return ` ${key}={[${value
231
+ .map((item) => (isValidElement(item) ? convertReactToCodeString(item) : '...')) // Simplified for brevity
232
+ .join(', ')}]}`;
233
+ } else if (typeof value === 'object') {
234
+ formattedValue = `{${JSON.stringify(value, null, 2)}}`;
235
+ } else if (value === null) {
236
+ formattedValue = '{null}';
237
+ } else if (value === undefined) {
238
+ return ''; // skip undefined props
239
+ } else {
240
+ formattedValue = `{${value.toString()}}`;
241
+ }
242
+ return ` ${key}=${formattedValue}`;
243
+ })
244
+ .filter(Boolean)
245
+ .join('\n');
246
+
247
+ return `<${componentName}\n${propsString}\n/>`;
248
+ }
249
+
250
+ function isReactElement(value: any): boolean {
251
+ return (
252
+ typeof value === 'object' &&
253
+ value !== null &&
254
+ (value.$$typeof === Symbol.for('react.element') ||
255
+ (value.type && (typeof value.type === 'string' || typeof value.type === 'function')))
256
+ );
257
+ }
258
+
259
+ export function kebabCase(str: string): string {
260
+ return (
261
+ str
262
+ .normalize('NFD') // Normalize to decompose accents
263
+ .replace(/[\u0300-\u036f&()']/g, '') // Remove accents
264
+ // Handle camelCase by inserting hyphens between lowercase and uppercase
265
+ .replace(/([a-zA-Z])([A-Z][a-z])/g, '$1-$2')
266
+ // do it again for the next uppercase letter
267
+ .replace(/([a-zA-Z])([A-Z][a-z])/g, '$1-$2')
268
+ .replace(/[^a-zA-Z0-9]+/g, '-') // Replace non-alphanumeric characters with hyphens
269
+ .replace(/^-+|-+$/g, '') // Trim leading or trailing hyphens
270
+ .replace(/--+/g, '-') // Replace multiple hyphens with a single hyphen
271
+ .toLowerCase()
272
+ ); // Convert to lowercase
273
+ }
274
+
275
+ export function convertReactToCodeString(element: React.ReactElement): string {
276
+ return `<${element.type}${Object.entries(element.props)
277
+ .map(([key, value]) => {
278
+ if (typeof value === 'string') {
279
+ return ` ${key}="${value}"`;
280
+ } else if (typeof value === 'number' || typeof value === 'boolean') {
281
+ return ` ${key}={${value}}`;
282
+ } else if (typeof value === 'function') {
283
+ return ` ${key}={() => {}}`;
284
+ } else if (isValidElement(value)) {
285
+ return ` ${key}={${convertReactToCodeString(value)}}`;
286
+ } else if (Array.isArray(value)) {
287
+ return ` ${key}={[${value
288
+ .map((item) => (isValidElement(item) ? convertReactToCodeString(item) : '...')) // Simplified for brevity
289
+ .join(', ')}]}`;
290
+ } else if (value === null) {
291
+ return ` ${key}={null}`;
292
+ } else if (value === undefined) {
293
+ return ` ${key}={undefined}`;
294
+ } else {
295
+ return ` ${key}={${JSON.stringify(value)}}`;
296
+ }
297
+ })
298
+ .join('')}>${element.props.children ? '...' : ''}</${element.type}>`;
299
+ }
@@ -1,73 +0,0 @@
1
- import './drawer.scss';
2
- import { ReactNode } from 'react';
3
- import { DialogProps } from '-/components/Dialog';
4
- export type DrawerProps = Pick<DialogProps, 'container' | 'disableFocusTrap' | 'id' | 'innerRef' | 'owner'> & {
5
- /** Drawer header. */
6
- header?: string;
7
- /**
8
- * The content of the drawer.
9
- *
10
- * @required
11
- */
12
- children: ReactNode;
13
- /**
14
- * Controls whether the drawer is open.
15
- *
16
- * @default false
17
- */
18
- open?: boolean;
19
- /**
20
- * When true the drawer is temporarily displayed above all other content until closed.
21
- *
22
- * @default true
23
- */
24
- modal?: boolean;
25
- /**
26
- * If true, a close button will be displayed in the drawer header.
27
- *
28
- * @default false
29
- */
30
- closeButton?: boolean;
31
- /**
32
- * The placement of the drawer.
33
- *
34
- * @default right
35
- */
36
- placement?: 'bottom' | 'left' | 'right' | 'top';
37
- /** Optional callback when the drawer requests to close. */
38
- onClose?: () => void;
39
- };
40
- /**
41
- * Drawer component displays a panel that slides in from the edge of the screen. It can be used to show additional
42
- * content or actions without navigating away from the current view.
43
- *
44
- * @example
45
- * import { Button } from '@bspk/ui/Button';
46
- * import { Drawer } from '@bspk/ui/Drawer';
47
- *
48
- * () => {
49
- * const [open, setOpen] = useState(false);
50
- *
51
- * return (
52
- * <div style={{ width: '100%', height: 180 }}>
53
- * <Button label="Toggle Drawer" onClick={() => setOpen(!open)} />
54
- * <Drawer
55
- * closeButton={true}
56
- * header="Example Drawer"
57
- * id="exampleId"
58
- * modal={false}
59
- * onClose={() => setOpen(false)}
60
- * open={open}
61
- * placement="right"
62
- * >
63
- * <ExamplePlaceholder label="Drawer Content" style={{ flexGrow: 1 }} />
64
- * </Drawer>
65
- * </div>
66
- * );
67
- * };
68
- *
69
- * @name Drawer
70
- * @phase Stable
71
- */
72
- export declare function Drawer({ header, children, open, modal, closeButton, placement, onClose, disableFocusTrap, ...dialogProps }: DrawerProps): import("react/jsx-runtime").JSX.Element | null;
73
- /** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import './drawer.css.js';
3
- import { SvgClose } from '@bspk/icons/Close';
4
- import { Button } from '../Button';
5
- import { Dialog } from '../Dialog';
6
- /**
7
- * Drawer component displays a panel that slides in from the edge of the screen. It can be used to show additional
8
- * content or actions without navigating away from the current view.
9
- *
10
- * @example
11
- * import { Button } from '@bspk/ui/Button';
12
- * import { Drawer } from '@bspk/ui/Drawer';
13
- *
14
- * () => {
15
- * const [open, setOpen] = useState(false);
16
- *
17
- * return (
18
- * <div style={{ width: '100%', height: 180 }}>
19
- * <Button label="Toggle Drawer" onClick={() => setOpen(!open)} />
20
- * <Drawer
21
- * closeButton={true}
22
- * header="Example Drawer"
23
- * id="exampleId"
24
- * modal={false}
25
- * onClose={() => setOpen(false)}
26
- * open={open}
27
- * placement="right"
28
- * >
29
- * <ExamplePlaceholder label="Drawer Content" style={{ flexGrow: 1 }} />
30
- * </Drawer>
31
- * </div>
32
- * );
33
- * };
34
- *
35
- * @name Drawer
36
- * @phase Stable
37
- */
38
- export function Drawer({ header, children, open = false, modal = true, closeButton = false, placement = 'right', onClose, disableFocusTrap, ...dialogProps }) {
39
- if (!open)
40
- return null;
41
- const drawerContent = (_jsxs("section", { "aria-modal": modal ? 'true' : undefined, "data-bspk": "drawer", "data-no-portal": modal ? null : true, "data-persistent-placement": modal ? null : placement, role: modal ? 'dialog' : 'complementary', children: [(header || closeButton) && (_jsxs("div", { "data-drawer-close-only": !header, "data-drawer-header": true, children: [header && _jsx("div", { "data-drawer-title": true, children: header }), closeButton && (_jsx(Button, { icon: _jsx(SvgClose, {}), iconOnly: true, label: "close", onClick: onClose, variant: "tertiary" }))] })), children] }));
42
- if (!modal)
43
- return drawerContent;
44
- return (_jsx(Dialog, { ...dialogProps, disableFocusTrap: disableFocusTrap, onClose: onClose || (() => { }), open: open, placement: placement, showScrim: true, widthFull: placement === 'bottom' || placement === 'top', children: drawerContent }));
45
- }
46
- //# sourceMappingURL=Drawer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Drawer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AM,OACC,WAAW,EACf,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAC9B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,IAAI,EACf,SAAS,EAAE,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,KAAK,YAEvD,aAAa,GACT,CACZ,CAAC;AACN,CAAC"}
@@ -1,5 +0,0 @@
1
- import { DrawerProps } from '.';
2
- import { ComponentExampleFn, Preset } from '-/utils/demo';
3
- export declare const presets: Preset<DrawerProps>[];
4
- export declare const DrawerExample: ComponentExampleFn<DrawerProps>;
5
- export declare const Usage: () => import("react/jsx-runtime").JSX.Element;
@@ -1,53 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Drawer } from '.';
4
- import { Button } from '../Button';
5
- import { ExamplePlaceholder } from '../ExamplePlaceholder';
6
- export const presets = [
7
- {
8
- label: 'Left Responsive',
9
- propState: { closeButton: true, modal: false, placement: 'left', children: null },
10
- },
11
- {
12
- label: 'Right Responsive',
13
- propState: { closeButton: true, modal: false, placement: 'right', children: null },
14
- },
15
- ];
16
- export const DrawerExample = ({ action }) => ({
17
- containerStyle: {
18
- height: '300px',
19
- width: '100%',
20
- padding: 0,
21
- overflow: 'hidden', // hides box-shadow of drawer
22
- },
23
- presets,
24
- render: ({ props, preset, setState, Component }) => {
25
- if (!preset)
26
- return null;
27
- const handleOnClose = () => {
28
- action('Drawer closed');
29
- setState({ open: false });
30
- };
31
- const toggleButton = _jsx(Button, { label: "Toggle Drawer", onClick: () => setState({ open: !props.open }) });
32
- switch (preset.label) {
33
- case 'Left Responsive':
34
- return (_jsxs(_Fragment, { children: [_jsx(Drawer, { ...props, onClose: handleOnClose, children: _jsxs("div", { style: { width: '280px' }, children: ["Hello, ", _jsx("br", {}), " I am a ", props.placement, ", responsive drawer!"] }) }), _jsx("div", { style: {
35
- transition: 'margin 0.5s cubic-bezier(0.4, 0, 0.2, 1)',
36
- marginLeft: props.open ? `280px` : 0,
37
- }, children: toggleButton })] }));
38
- case 'Right Responsive':
39
- return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
40
- transition: 'margin 0.5s cubic-bezier(0.4, 0, 0.2, 1)',
41
- marginRight: props.open ? `280px` : 0,
42
- }, children: toggleButton }), _jsx(Drawer, { ...props, onClose: handleOnClose, children: _jsxs("div", { style: { width: '280px' }, children: ["Hello, ", _jsx("br", {}), " I am a ", props.placement, ", responsive drawer!"] }) })] }));
43
- default:
44
- return (_jsxs(_Fragment, { children: [_jsx("div", { style: { display: 'flex', justifyContent: 'center', padding: 'var(--spacing-sizing-04)' }, children: toggleButton }), _jsx(Component, { "data-example-component": true, ...props, closeButton: props.closeButton ?? false, id: "exampleId", modal: props.modal ?? true, onClose: handleOnClose, open: props.open ?? false, placement: props.placement ?? 'right', children: _jsxs("div", { style: {}, children: ["Hello, I am a (", props.placement, ") drawer!"] }) })] }));
45
- }
46
- },
47
- variants: false,
48
- });
49
- export const Usage = () => {
50
- const [open, setOpen] = useState(false);
51
- return (_jsxs("div", { style: { width: '100%', height: 180 }, children: [_jsx(Button, { label: "Toggle Drawer", onClick: () => setOpen(!open) }), _jsx(Drawer, { closeButton: true, header: "Example Drawer", id: "exampleId", modal: false, onClose: () => setOpen(false), open: open, placement: "right", children: _jsx(ExamplePlaceholder, { label: "Drawer Content", style: { flexGrow: 1 } }) })] }));
52
- };
53
- //# sourceMappingURL=DrawerExample.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DrawerExample.js","sourceRoot":"","sources":["../../../src/components/Drawer/DrawerExample.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAe,MAAM,GAAG,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CA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,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACtB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExC,OAAO,CACH,eAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,aACtC,KAAC,MAAM,IAAC,KAAK,EAAC,eAAe,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAI,EAC/D,KAAC,MAAM,IACH,WAAW,EAAE,IAAI,EACjB,MAAM,EAAC,gBAAgB,EACvB,EAAE,EAAC,WAAW,EACd,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAC7B,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,OAAO,YAEjB,KAAC,kBAAkB,IAAC,KAAK,EAAC,gBAAgB,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAI,GAChE,IACP,CACT,CAAC;AACN,CAAC,CAAC"}
@@ -1,62 +0,0 @@
1
- [data-bspk=drawer] {
2
- padding: var(--spacing-sizing-03);
3
- color: var(--foreground-neutral-on-surface);
4
- background: var(--surface-neutral-t1-base);
5
- display: flex;
6
- flex-direction: column;
7
- }
8
- [data-bspk=drawer][data-no-portal] {
9
- box-shadow: var(--drop-shadow-float);
10
- animation-name: var(--box-animation-name);
11
- animation-duration: 0.5s;
12
- animation-iteration-count: 1;
13
- animation-fill-mode: forwards;
14
- }
15
- [data-bspk=drawer][data-no-portal][data-persistent-placement=top] {
16
- --box-animation-name: placement-top;
17
- position: absolute;
18
- top: 0;
19
- width: 100%;
20
- border-bottom-left-radius: var(--radius-lg);
21
- border-bottom-right-radius: var(--radius-lg);
22
- }
23
- [data-bspk=drawer][data-no-portal][data-persistent-placement=right] {
24
- --box-animation-name: placement-right;
25
- position: absolute;
26
- right: 0;
27
- top: 0;
28
- height: 100%;
29
- border-top-left-radius: var(--radius-lg);
30
- border-bottom-left-radius: var(--radius-lg);
31
- }
32
- [data-bspk=drawer][data-no-portal][data-persistent-placement=bottom] {
33
- --box-animation-name: placement-bottom;
34
- position: absolute;
35
- bottom: 0;
36
- width: 100%;
37
- border-top-left-radius: var(--radius-lg);
38
- border-top-right-radius: var(--radius-lg);
39
- }
40
- [data-bspk=drawer][data-no-portal][data-persistent-placement=left] {
41
- --box-animation-name: placement-left;
42
- position: absolute;
43
- left: 0;
44
- height: 100%;
45
- border-top-right-radius: var(--radius-lg);
46
- border-bottom-right-radius: var(--radius-lg);
47
- }
48
- [data-bspk=drawer] [data-drawer-header] {
49
- display: flex;
50
- width: 100%;
51
- justify-content: space-between;
52
- align-items: center;
53
- gap: var(--spacing-sizing-04);
54
- }
55
- [data-bspk=drawer] [data-drawer-header][data-drawer-close-only=true] {
56
- justify-content: flex-end;
57
- }
58
- [data-bspk=drawer] [data-drawer-header] [data-drawer-title] {
59
- font: var(--heading-h4);
60
- }
61
-
62
- /** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
@@ -1,67 +0,0 @@
1
- /** * This file is generated by the build script.
2
- * Do not edit this file directly. */
3
- const style = document.createElement('style');
4
- style.appendChild(document.createTextNode(`[data-bspk=drawer] {
5
- padding: var(--spacing-sizing-03);
6
- color: var(--foreground-neutral-on-surface);
7
- background: var(--surface-neutral-t1-base);
8
- display: flex;
9
- flex-direction: column;
10
- }
11
- [data-bspk=drawer][data-no-portal] {
12
- box-shadow: var(--drop-shadow-float);
13
- animation-name: var(--box-animation-name);
14
- animation-duration: 0.5s;
15
- animation-iteration-count: 1;
16
- animation-fill-mode: forwards;
17
- }
18
- [data-bspk=drawer][data-no-portal][data-persistent-placement=top] {
19
- --box-animation-name: placement-top;
20
- position: absolute;
21
- top: 0;
22
- width: 100%;
23
- border-bottom-left-radius: var(--radius-lg);
24
- border-bottom-right-radius: var(--radius-lg);
25
- }
26
- [data-bspk=drawer][data-no-portal][data-persistent-placement=right] {
27
- --box-animation-name: placement-right;
28
- position: absolute;
29
- right: 0;
30
- top: 0;
31
- height: 100%;
32
- border-top-left-radius: var(--radius-lg);
33
- border-bottom-left-radius: var(--radius-lg);
34
- }
35
- [data-bspk=drawer][data-no-portal][data-persistent-placement=bottom] {
36
- --box-animation-name: placement-bottom;
37
- position: absolute;
38
- bottom: 0;
39
- width: 100%;
40
- border-top-left-radius: var(--radius-lg);
41
- border-top-right-radius: var(--radius-lg);
42
- }
43
- [data-bspk=drawer][data-no-portal][data-persistent-placement=left] {
44
- --box-animation-name: placement-left;
45
- position: absolute;
46
- left: 0;
47
- height: 100%;
48
- border-top-right-radius: var(--radius-lg);
49
- border-bottom-right-radius: var(--radius-lg);
50
- }
51
- [data-bspk=drawer] [data-drawer-header] {
52
- display: flex;
53
- width: 100%;
54
- justify-content: space-between;
55
- align-items: center;
56
- gap: var(--spacing-sizing-04);
57
- }
58
- [data-bspk=drawer] [data-drawer-header][data-drawer-close-only=true] {
59
- justify-content: flex-end;
60
- }
61
- [data-bspk=drawer] [data-drawer-header] [data-drawer-title] {
62
- font: var(--heading-h4);
63
- }
64
-
65
- /** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
66
- `));
67
- document.head.appendChild(style);
@@ -1 +0,0 @@
1
- export * from './Drawer';
@@ -1,2 +0,0 @@
1
- export * from './Drawer';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}