@bspk/ui 1.3.19 → 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.
- package/dist/components/Accordion/AccordionExample.js +1 -1
- package/dist/components/Accordion/AccordionExample.js.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.js +1 -1
- package/dist/components/BannerAlert/BannerAlert.js.map +1 -1
- package/dist/components/BannerAlert/banner-alert.css +3 -3
- package/dist/components/BannerAlert/banner-alert.css.js +3 -3
- package/dist/components/CheckboxOption/CheckboxOption.d.ts +15 -3
- package/dist/components/CheckboxOption/CheckboxOption.js +2 -3
- package/dist/components/CheckboxOption/CheckboxOption.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +17 -7
- package/dist/components/Dialog/Dialog.js +19 -11
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/DialogExample.d.ts +2 -2
- package/dist/components/Dialog/DialogExample.js +32 -3
- package/dist/components/Dialog/DialogExample.js.map +1 -1
- package/dist/components/Dialog/dialog.css +74 -4
- package/dist/components/Dialog/dialog.css.js +74 -4
- package/dist/components/Flex/Flex.d.ts +2 -0
- package/dist/components/Flex/Flex.js +1 -0
- package/dist/components/Flex/Flex.js.map +1 -1
- package/dist/components/ListItem/list-item.css +4 -0
- package/dist/components/ListItem/list-item.css.js +4 -0
- package/dist/components/Modal/Modal.js +1 -2
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/modal.css +4 -0
- package/dist/components/Modal/modal.css.js +4 -0
- package/dist/components/PageHeader/PageHeader.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader.js +1 -1
- package/dist/components/PageHeader/PageHeaderBlockConfigs.d.ts +1 -0
- package/dist/components/PageHeader/PageHeaderBlockConfigs.js +32 -0
- package/dist/components/PageHeader/PageHeaderBlockConfigs.js.map +1 -0
- package/dist/components/PageHeader/PageHeaderExample.d.ts +3 -2
- package/dist/components/PageHeader/PageHeaderExample.js +4 -42
- package/dist/components/PageHeader/PageHeaderExample.js.map +1 -1
- package/dist/components/PageHeader/page-header.css +1 -1
- package/dist/components/PageHeader/page-header.css.js +1 -1
- package/dist/components/Portal/Portal.d.ts +1 -1
- package/dist/components/RadioOption/RadioOption.d.ts +7 -3
- package/dist/components/RadioOption/RadioOption.js +2 -3
- package/dist/components/RadioOption/RadioOption.js.map +1 -1
- package/dist/components/Scrim/Scrim.d.ts +3 -1
- package/dist/components/Scrim/Scrim.js +2 -2
- package/dist/components/Scrim/Scrim.js.map +1 -1
- package/dist/components/Scrim/scrim.css +3 -0
- package/dist/components/Scrim/scrim.css.js +3 -0
- package/dist/components/SwitchOption/SwitchOption.d.ts +16 -3
- package/dist/components/SwitchOption/SwitchOption.js +3 -4
- package/dist/components/SwitchOption/SwitchOption.js.map +1 -1
- package/dist/components/Tag/Tag.d.ts +2 -1
- package/dist/components/Tag/Tag.js +2 -2
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/styles/base.css +0 -42
- package/dist/styles/base.css.js +0 -42
- package/dist/types/meta.d.ts +6 -0
- package/dist/types/meta.js.map +1 -1
- package/dist/utils/blocks.d.ts +32 -0
- package/dist/utils/blocks.js +21 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/demo.d.ts +33 -9
- package/dist/utils/demo.js +98 -0
- package/dist/utils/demo.js.map +1 -1
- package/meta.ts +39 -1
- package/package.json +1 -3
- package/src/components/Accordion/AccordionExample.tsx +1 -1
- package/src/components/BannerAlert/BannerAlert.tsx +2 -2
- package/src/components/BannerAlert/banner-alert.scss +1 -1
- package/src/components/CheckboxOption/CheckboxOption.tsx +26 -14
- package/src/components/Dialog/Dialog.tsx +20 -10
- package/src/components/Dialog/DialogExample.tsx +104 -6
- package/src/components/Dialog/dialog.scss +91 -4
- package/src/components/Flex/Flex.tsx +3 -0
- package/src/components/ListItem/list-item.scss +4 -0
- package/src/components/Modal/Modal.tsx +1 -4
- package/src/components/Modal/modal.scss +5 -0
- package/src/components/PageHeader/PageHeader.rtl.test.tsx +8 -5
- package/src/components/PageHeader/PageHeader.tsx +1 -1
- package/src/components/PageHeader/PageHeaderBlockConfigs.tsx +152 -0
- package/src/components/PageHeader/PageHeaderExample.tsx +6 -44
- package/src/components/PageHeader/page-header.scss +1 -1
- package/src/components/Portal/Portal.tsx +1 -1
- package/src/components/RadioOption/RadioOption.tsx +16 -8
- package/src/components/Scrim/Scrim.tsx +4 -1
- package/src/components/Scrim/scrim.scss +4 -0
- package/src/components/SwitchOption/SwitchOption.tsx +28 -9
- package/src/components/Tag/Tag.tsx +9 -2
- package/src/styles/base.scss +0 -52
- package/src/types/meta.ts +7 -0
- package/src/utils/blocks.ts +26 -0
- package/src/utils/demo.ts +141 -18
- package/dist/components/Drawer/Drawer.d.ts +0 -73
- package/dist/components/Drawer/Drawer.js +0 -46
- package/dist/components/Drawer/Drawer.js.map +0 -1
- package/dist/components/Drawer/DrawerExample.d.ts +0 -5
- package/dist/components/Drawer/DrawerExample.js +0 -53
- package/dist/components/Drawer/DrawerExample.js.map +0 -1
- package/dist/components/Drawer/drawer.css +0 -62
- package/dist/components/Drawer/drawer.css.js +0 -67
- package/dist/components/Drawer/index.d.ts +0 -1
- package/dist/components/Drawer/index.js +0 -2
- package/dist/components/Drawer/index.js.map +0 -1
- package/src/components/Drawer/Drawer.rtl.test.tsx +0 -27
- package/src/components/Drawer/Drawer.tsx +0 -127
- package/src/components/Drawer/DrawerExample.tsx +0 -117
- package/src/components/Drawer/drawer.scss +0 -74
- package/src/components/Drawer/index.tsx +0 -1
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import './drawer.scss';
|
|
2
|
-
import { SvgClose } from '@bspk/icons/Close';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import { Button } from '-/components/Button';
|
|
5
|
-
import { Dialog, DialogProps } from '-/components/Dialog';
|
|
6
|
-
|
|
7
|
-
export type DrawerProps = Pick<DialogProps, 'container' | 'disableFocusTrap' | 'id' | 'innerRef' | 'owner'> & {
|
|
8
|
-
/** Drawer header. */
|
|
9
|
-
header?: string;
|
|
10
|
-
/**
|
|
11
|
-
* The content of the drawer.
|
|
12
|
-
*
|
|
13
|
-
* @required
|
|
14
|
-
*/
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Controls whether the drawer is open.
|
|
18
|
-
*
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
open?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* When true the drawer is temporarily displayed above all other content until closed.
|
|
24
|
-
*
|
|
25
|
-
* @default true
|
|
26
|
-
*/
|
|
27
|
-
modal?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* If true, a close button will be displayed in the drawer header.
|
|
30
|
-
*
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
closeButton?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* The placement of the drawer.
|
|
36
|
-
*
|
|
37
|
-
* @default right
|
|
38
|
-
*/
|
|
39
|
-
placement?: 'bottom' | 'left' | 'right' | 'top';
|
|
40
|
-
/** Optional callback when the drawer requests to close. */
|
|
41
|
-
onClose?: () => void;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Drawer component displays a panel that slides in from the edge of the screen. It can be used to show additional
|
|
46
|
-
* content or actions without navigating away from the current view.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* import { Button } from '@bspk/ui/Button';
|
|
50
|
-
* import { Drawer } from '@bspk/ui/Drawer';
|
|
51
|
-
*
|
|
52
|
-
* () => {
|
|
53
|
-
* const [open, setOpen] = useState(false);
|
|
54
|
-
*
|
|
55
|
-
* return (
|
|
56
|
-
* <div style={{ width: '100%', height: 180 }}>
|
|
57
|
-
* <Button label="Toggle Drawer" onClick={() => setOpen(!open)} />
|
|
58
|
-
* <Drawer
|
|
59
|
-
* closeButton={true}
|
|
60
|
-
* header="Example Drawer"
|
|
61
|
-
* id="exampleId"
|
|
62
|
-
* modal={false}
|
|
63
|
-
* onClose={() => setOpen(false)}
|
|
64
|
-
* open={open}
|
|
65
|
-
* placement="right"
|
|
66
|
-
* >
|
|
67
|
-
* <ExamplePlaceholder label="Drawer Content" style={{ flexGrow: 1 }} />
|
|
68
|
-
* </Drawer>
|
|
69
|
-
* </div>
|
|
70
|
-
* );
|
|
71
|
-
* };
|
|
72
|
-
*
|
|
73
|
-
* @name Drawer
|
|
74
|
-
* @phase Stable
|
|
75
|
-
*/
|
|
76
|
-
export function Drawer({
|
|
77
|
-
header,
|
|
78
|
-
children,
|
|
79
|
-
open = false,
|
|
80
|
-
modal = true,
|
|
81
|
-
closeButton = false,
|
|
82
|
-
placement = 'right',
|
|
83
|
-
onClose,
|
|
84
|
-
disableFocusTrap,
|
|
85
|
-
...dialogProps
|
|
86
|
-
}: DrawerProps) {
|
|
87
|
-
if (!open) return null;
|
|
88
|
-
|
|
89
|
-
const drawerContent = (
|
|
90
|
-
<section
|
|
91
|
-
aria-modal={modal ? 'true' : undefined}
|
|
92
|
-
data-bspk="drawer"
|
|
93
|
-
data-no-portal={modal ? null : true}
|
|
94
|
-
data-persistent-placement={modal ? null : placement}
|
|
95
|
-
role={modal ? 'dialog' : 'complementary'}
|
|
96
|
-
>
|
|
97
|
-
{(header || closeButton) && (
|
|
98
|
-
<div data-drawer-close-only={!header} data-drawer-header>
|
|
99
|
-
{header && <div data-drawer-title>{header}</div>}
|
|
100
|
-
{closeButton && (
|
|
101
|
-
<Button icon={<SvgClose />} iconOnly label="close" onClick={onClose} variant="tertiary" />
|
|
102
|
-
)}
|
|
103
|
-
</div>
|
|
104
|
-
)}
|
|
105
|
-
|
|
106
|
-
{children}
|
|
107
|
-
</section>
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
if (!modal) return drawerContent;
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<Dialog
|
|
114
|
-
{...dialogProps}
|
|
115
|
-
disableFocusTrap={disableFocusTrap}
|
|
116
|
-
onClose={onClose || (() => {})}
|
|
117
|
-
open={open}
|
|
118
|
-
placement={placement}
|
|
119
|
-
showScrim={true}
|
|
120
|
-
widthFull={placement === 'bottom' || placement === 'top'}
|
|
121
|
-
>
|
|
122
|
-
{drawerContent}
|
|
123
|
-
</Dialog>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { Drawer, DrawerProps } from '.';
|
|
3
|
-
import { Button } from '-/components/Button';
|
|
4
|
-
import { ExamplePlaceholder } from '-/components/ExamplePlaceholder';
|
|
5
|
-
import { ComponentExampleFn, Preset } from '-/utils/demo';
|
|
6
|
-
|
|
7
|
-
export const presets: Preset<DrawerProps>[] = [
|
|
8
|
-
{
|
|
9
|
-
label: 'Left Responsive',
|
|
10
|
-
propState: { closeButton: true, modal: false, placement: 'left', children: null },
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
label: 'Right Responsive',
|
|
14
|
-
propState: { closeButton: true, modal: false, placement: 'right', children: null },
|
|
15
|
-
},
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
export const DrawerExample: ComponentExampleFn<DrawerProps> = ({ action }) => ({
|
|
19
|
-
containerStyle: {
|
|
20
|
-
height: '300px',
|
|
21
|
-
width: '100%',
|
|
22
|
-
padding: 0,
|
|
23
|
-
overflow: 'hidden', // hides box-shadow of drawer
|
|
24
|
-
},
|
|
25
|
-
presets,
|
|
26
|
-
render: ({ props, preset, setState, Component }) => {
|
|
27
|
-
if (!preset) return null;
|
|
28
|
-
const handleOnClose = () => {
|
|
29
|
-
action('Drawer closed');
|
|
30
|
-
setState({ open: false });
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const toggleButton = <Button label="Toggle Drawer" onClick={() => setState({ open: !props.open })} />;
|
|
34
|
-
|
|
35
|
-
switch (preset.label) {
|
|
36
|
-
case 'Left Responsive':
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
<Drawer {...props} onClose={handleOnClose}>
|
|
40
|
-
<div style={{ width: '280px' }}>
|
|
41
|
-
Hello, <br /> I am a {props.placement}, responsive drawer!
|
|
42
|
-
</div>
|
|
43
|
-
</Drawer>
|
|
44
|
-
|
|
45
|
-
<div
|
|
46
|
-
style={{
|
|
47
|
-
transition: 'margin 0.5s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
48
|
-
marginLeft: props.open ? `280px` : 0,
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
{toggleButton}
|
|
52
|
-
</div>
|
|
53
|
-
</>
|
|
54
|
-
);
|
|
55
|
-
case 'Right Responsive':
|
|
56
|
-
return (
|
|
57
|
-
<>
|
|
58
|
-
<div
|
|
59
|
-
style={{
|
|
60
|
-
transition: 'margin 0.5s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
61
|
-
marginRight: props.open ? `280px` : 0,
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
{toggleButton}
|
|
65
|
-
</div>
|
|
66
|
-
<Drawer {...props} onClose={handleOnClose}>
|
|
67
|
-
<div style={{ width: '280px' }}>
|
|
68
|
-
Hello, <br /> I am a {props.placement}, responsive drawer!
|
|
69
|
-
</div>
|
|
70
|
-
</Drawer>
|
|
71
|
-
</>
|
|
72
|
-
);
|
|
73
|
-
default:
|
|
74
|
-
return (
|
|
75
|
-
<>
|
|
76
|
-
<div style={{ display: 'flex', justifyContent: 'center', padding: 'var(--spacing-sizing-04)' }}>
|
|
77
|
-
{toggleButton}
|
|
78
|
-
</div>
|
|
79
|
-
<Component
|
|
80
|
-
data-example-component
|
|
81
|
-
{...props}
|
|
82
|
-
closeButton={props.closeButton ?? false}
|
|
83
|
-
id="exampleId"
|
|
84
|
-
modal={props.modal ?? true}
|
|
85
|
-
onClose={handleOnClose}
|
|
86
|
-
open={props.open ?? false}
|
|
87
|
-
placement={props.placement ?? 'right'}
|
|
88
|
-
>
|
|
89
|
-
<div style={{}}>Hello, I am a ({props.placement}) drawer!</div>
|
|
90
|
-
</Component>
|
|
91
|
-
</>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
variants: false,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
export const Usage = () => {
|
|
99
|
-
const [open, setOpen] = useState(false);
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<div style={{ width: '100%', height: 180 }}>
|
|
103
|
-
<Button label="Toggle Drawer" onClick={() => setOpen(!open)} />
|
|
104
|
-
<Drawer
|
|
105
|
-
closeButton={true}
|
|
106
|
-
header="Example Drawer"
|
|
107
|
-
id="exampleId"
|
|
108
|
-
modal={false}
|
|
109
|
-
onClose={() => setOpen(false)}
|
|
110
|
-
open={open}
|
|
111
|
-
placement="right"
|
|
112
|
-
>
|
|
113
|
-
<ExamplePlaceholder label="Drawer Content" style={{ flexGrow: 1 }} />
|
|
114
|
-
</Drawer>
|
|
115
|
-
</div>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
@@ -1,74 +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-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-persistent-placement='top'] {
|
|
16
|
-
--box-animation-name: placement-top;
|
|
17
|
-
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 0;
|
|
20
|
-
width: 100%;
|
|
21
|
-
border-bottom-left-radius: var(--radius-lg);
|
|
22
|
-
border-bottom-right-radius: var(--radius-lg);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&[data-persistent-placement='right'] {
|
|
26
|
-
--box-animation-name: placement-right;
|
|
27
|
-
|
|
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
|
-
|
|
36
|
-
&[data-persistent-placement='bottom'] {
|
|
37
|
-
--box-animation-name: placement-bottom;
|
|
38
|
-
|
|
39
|
-
position: absolute;
|
|
40
|
-
bottom: 0;
|
|
41
|
-
width: 100%;
|
|
42
|
-
border-top-left-radius: var(--radius-lg);
|
|
43
|
-
border-top-right-radius: var(--radius-lg);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&[data-persistent-placement='left'] {
|
|
47
|
-
--box-animation-name: placement-left;
|
|
48
|
-
|
|
49
|
-
position: absolute;
|
|
50
|
-
left: 0;
|
|
51
|
-
height: 100%;
|
|
52
|
-
border-top-right-radius: var(--radius-lg);
|
|
53
|
-
border-bottom-right-radius: var(--radius-lg);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[data-drawer-header] {
|
|
58
|
-
display: flex;
|
|
59
|
-
width: 100%;
|
|
60
|
-
justify-content: space-between;
|
|
61
|
-
align-items: center;
|
|
62
|
-
gap: var(--spacing-sizing-04);
|
|
63
|
-
|
|
64
|
-
&[data-drawer-close-only='true'] {
|
|
65
|
-
justify-content: flex-end;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
[data-drawer-title] {
|
|
69
|
-
font: var(--heading-h4);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** Copyright 2025 Anywhere Real Estate - CC BY 4.0 */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Drawer';
|