@chotot/clad-ui 2.0.0-next.4 → 2.1.0
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/README.md +7 -9
- package/dist/components/Announcer/Announcer.stories.d.ts.map +1 -1
- package/dist/components/Announcer/Announcer.stories.js +1 -26
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +34 -24
- package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
- package/dist/components/Badge/Badge.stories.js +61 -54
- package/dist/components/Badge/Badge.styles.d.ts +1 -0
- package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
- package/dist/components/Badge/Badge.styles.js +17 -8
- package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts +6 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.js +11 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +7 -25
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -11
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +47 -96
- package/dist/components/Button/Button.d.ts +8 -17
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +5 -3
- package/dist/components/Button/Button.stories.d.ts +78 -4
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Button/Button.stories.js +105 -11
- package/dist/components/Button/Button.styles.d.ts.map +1 -1
- package/dist/components/Button/Button.styles.js +30 -11
- package/dist/components/Button/GhostButton.d.ts +6 -26
- package/dist/components/Button/GhostButton.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.js +4 -4
- package/dist/components/Button/GhostButton.stories.d.ts +80 -2
- package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.stories.js +80 -7
- package/dist/components/Button/GhostButton.styles.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.styles.js +17 -1
- package/dist/components/Button/IconButton.d.ts +1 -2
- package/dist/components/Button/IconButton.d.ts.map +1 -1
- package/dist/components/Button/IconButton.js +2 -7
- package/dist/components/Button/IconButton.stories.d.ts +75 -3
- package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/components/Button/IconButton.stories.js +74 -7
- package/dist/components/Button/constant.d.ts +10 -0
- package/dist/components/Button/constant.d.ts.map +1 -0
- package/dist/components/Button/constant.js +21 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -10
- package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +1 -34
- package/dist/components/Chip/Chip.stories.js +1 -1
- package/dist/components/CurrencyInput/CurrencyInput.stories.js +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +4 -1
- package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.js +5 -0
- package/dist/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.styles.js +27 -3
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +17 -15
- package/dist/components/Input/Input.stories.js +1 -1
- package/dist/components/Pagination/PageItem.d.ts +6 -11
- package/dist/components/Pagination/PageItem.d.ts.map +1 -1
- package/dist/components/Pagination/PageItem.js +11 -5
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -3
- package/dist/components/Pagination/Pagination.stories.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.stories.js +5 -15
- package/dist/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/components/Popover/Popover.stories.js +1 -0
- package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -10
- package/dist/components/RadioButton/RadioButton.stories.d.ts.map +1 -1
- package/dist/components/RadioButton/RadioButton.stories.js +1 -38
- package/dist/components/RowItem/RowItem.d.ts.map +1 -1
- package/dist/components/RowItem/RowItem.js +3 -6
- package/dist/components/RowItem/RowItem.stories.d.ts.map +1 -1
- package/dist/components/RowItem/RowItem.stories.js +1 -2
- package/dist/components/Slider/Slider.stories.js +1 -1
- package/dist/components/Snack/Snack.stories.js +1 -1
- package/dist/components/Tabs/Tab.d.ts +7 -14
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +6 -9
- package/dist/components/Tabs/Tabs.stories.d.ts +3 -3
- package/dist/components/Tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.stories.js +32 -10
- package/dist/components/Tabs/Tabs.styles.js +1 -1
- package/dist/components/TextArea/TextArea.d.ts +1 -1
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextLabel/TextLabel.stories.js +1 -1
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -1
- package/dist/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.stories.js +1 -30
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/patterns/Drawer/Drawer.d.ts +1 -0
- package/dist/patterns/Drawer/Drawer.d.ts.map +1 -1
- package/dist/patterns/Drawer/Drawer.js +7 -16
- package/dist/patterns/Drawer/Drawer.stories.d.ts +6 -0
- package/dist/patterns/Drawer/Drawer.stories.d.ts.map +1 -1
- package/dist/patterns/Drawer/Drawer.stories.js +23 -24
- package/dist/patterns/Drawer/Drawer.styles.d.ts +1 -2
- package/dist/patterns/Drawer/Drawer.styles.d.ts.map +1 -1
- package/dist/patterns/Drawer/Drawer.styles.js +1 -6
- package/dist/patterns/EmptyState/EmptyState.d.ts +1 -1
- package/dist/patterns/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/patterns/EmptyState/EmptyState.js +52 -47
- package/dist/patterns/EmptyState/EmptyState.stories.d.ts +11 -1
- package/dist/patterns/EmptyState/EmptyState.stories.d.ts.map +1 -1
- package/dist/patterns/EmptyState/EmptyState.stories.js +51 -12
- package/dist/patterns/EmptyState/EmptyState.styles.d.ts +3 -15
- package/dist/patterns/EmptyState/EmptyState.styles.d.ts.map +1 -1
- package/dist/patterns/EmptyState/EmptyState.styles.js +23 -40
- package/dist/patterns/InputGroup/InputGroup.d.ts +1 -1
- package/dist/patterns/InputGroup/InputGroup.styles.d.ts.map +1 -1
- package/dist/patterns/InputGroup/InputGroup.styles.js +3 -2
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +1 -1
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.js +4 -0
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.js +1 -1
- package/dist/patterns/Popup/Popup.d.ts +1 -0
- package/dist/patterns/Popup/Popup.d.ts.map +1 -1
- package/dist/patterns/Popup/Popup.js +6 -15
- package/dist/patterns/Popup/Popup.stories.d.ts +6 -0
- package/dist/patterns/Popup/Popup.stories.d.ts.map +1 -1
- package/dist/patterns/Popup/Popup.stories.js +29 -30
- package/dist/patterns/Popup/Popup.styles.d.ts +1 -2
- package/dist/patterns/Popup/Popup.styles.d.ts.map +1 -1
- package/dist/patterns/Popup/Popup.styles.js +1 -6
- package/dist/patterns/RangeInput/RangeInput.d.ts +30 -0
- package/dist/patterns/RangeInput/RangeInput.d.ts.map +1 -0
- package/dist/patterns/RangeInput/RangeInput.js +27 -0
- package/dist/patterns/RangeInput/RangeInput.stories.d.ts +68 -0
- package/dist/patterns/RangeInput/RangeInput.stories.d.ts.map +1 -0
- package/dist/patterns/RangeInput/RangeInput.stories.js +121 -0
- package/dist/patterns/RangeInput/RangeInput.styles.d.ts +5 -0
- package/dist/patterns/RangeInput/RangeInput.styles.d.ts.map +1 -0
- package/dist/patterns/RangeInput/RangeInput.styles.js +32 -0
- package/dist/patterns/SearchInput/SearchInput.d.ts +1 -1
- package/dist/patterns/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/patterns/SearchInput/SearchInput.js +7 -8
- package/dist/patterns/SearchInput/SearchInput.stories.d.ts.map +1 -1
- package/dist/patterns/SearchInput/SearchInput.stories.js +1 -3
- package/dist/patterns/Searchbar/Searchbar.d.ts +28 -0
- package/dist/patterns/Searchbar/Searchbar.d.ts.map +1 -0
- package/dist/patterns/Searchbar/Searchbar.js +37 -0
- package/dist/patterns/Searchbar/Searchbar.stories.d.ts +70 -0
- package/dist/patterns/Searchbar/Searchbar.stories.d.ts.map +1 -0
- package/dist/patterns/Searchbar/Searchbar.stories.js +80 -0
- package/dist/patterns/Searchbar/Searchbar.styles.d.ts +3 -0
- package/dist/patterns/Searchbar/Searchbar.styles.d.ts.map +1 -0
- package/dist/patterns/Searchbar/Searchbar.styles.js +48 -0
- package/dist/patterns/TagCloud/TagCloud.d.ts +1 -1
- package/dist/patterns/TagCloud/TagCloud.stories.d.ts.map +1 -1
- package/dist/patterns/TagCloud/TagCloud.stories.js +1 -5
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/index.d.ts.map +1 -1
- package/dist/patterns/index.js +2 -0
- package/dist/storybook/ColorFoundationList.js +2 -2
- package/dist/theme/chotot.d.ts +57 -52
- package/dist/theme/chotot.d.ts.map +1 -1
- package/dist/theme/chotot.js +18 -13
- package/dist/theme/ct-job.d.ts +56 -51
- package/dist/theme/ct-job.d.ts.map +1 -1
- package/dist/theme/ct-pty.d.ts +56 -51
- package/dist/theme/ct-pty.d.ts.map +1 -1
- package/dist/theme/ct-veh.d.ts +57 -52
- package/dist/theme/ct-veh.d.ts.map +1 -1
- package/dist/theme/ct-veh.js +1 -1
- package/dist/theme/mudah.js +1 -1
- package/dist/typography/HeaderAnnotation.d.ts +19 -0
- package/dist/typography/HeaderAnnotation.d.ts.map +1 -0
- package/dist/typography/HeaderAnnotation.js +15 -0
- package/dist/typography/index.d.ts +2 -0
- package/dist/typography/index.d.ts.map +1 -1
- package/dist/typography/index.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/scrollLock/index.d.ts +7 -0
- package/dist/utils/scrollLock/index.d.ts.map +1 -0
- package/dist/utils/scrollLock/index.js +7 -0
- package/dist/utils/scrollLock/scrollLock.styles.d.ts +6 -0
- package/dist/utils/scrollLock/scrollLock.styles.d.ts.map +1 -0
- package/dist/utils/scrollLock/scrollLock.styles.js +9 -0
- package/dist/utils/scrollLock/useBodyScrollLock.d.ts +10 -0
- package/dist/utils/scrollLock/useBodyScrollLock.d.ts.map +1 -0
- package/dist/utils/scrollLock/useBodyScrollLock.js +41 -0
- package/dist/utils/sx.d.ts +8 -8
- package/dist/utils/types.d.ts +23 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +5 -0
- package/package.json +4 -3
- package/dist/storybook/GuideImage.d.ts +0 -9
- package/dist/storybook/GuideImage.d.ts.map +0 -1
- package/dist/storybook/GuideImage.js +0 -40
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import RangeInput from './RangeInput';
|
|
3
|
+
import { Input } from '../../components';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Patterns/RangeInput',
|
|
6
|
+
component: RangeInput,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `A range input component that groups two related inputs with a separator. Perfect for date ranges, price ranges, or any paired input scenarios.
|
|
12
|
+
|
|
13
|
+
\`🧪 Beta \` [\`🎨 Figma Specs\`](https://www.figma.com/design/CYWl6Rz8BD5Pvv7LRsupYk/Design-System-Handoff?node-id=8873-5334&t=fVzdnRlA1pOFBpL3-4)
|
|
14
|
+
`,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
status: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['default', 'error'],
|
|
22
|
+
description: 'Input group status (useful when implemented with form validation)',
|
|
23
|
+
defaultValue: 'default',
|
|
24
|
+
},
|
|
25
|
+
helptext: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Help text displayed below the input group',
|
|
28
|
+
},
|
|
29
|
+
helptextClassName: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Custom class name for help text styling',
|
|
32
|
+
},
|
|
33
|
+
className: {
|
|
34
|
+
control: 'text',
|
|
35
|
+
description: 'Custom class name for the container',
|
|
36
|
+
},
|
|
37
|
+
separatorComponent: {
|
|
38
|
+
control: false,
|
|
39
|
+
description: 'Custom separator component (defaults to "-")',
|
|
40
|
+
},
|
|
41
|
+
children: {
|
|
42
|
+
control: false,
|
|
43
|
+
description: 'Input components to be grouped',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
args: {
|
|
47
|
+
status: 'default',
|
|
48
|
+
helptext: '',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export default meta;
|
|
52
|
+
export const Overview = {
|
|
53
|
+
render: (args) => {
|
|
54
|
+
const [firstValue, setFirstValue] = useState('');
|
|
55
|
+
const [secondValue, setSecondValue] = useState('');
|
|
56
|
+
return (<RangeInput {...args}>
|
|
57
|
+
<Input label="From" placeholder="Start value" value={firstValue} onChange={(e) => setFirstValue(e.target.value)}/>
|
|
58
|
+
<Input label="To" placeholder="End value" value={secondValue} onChange={(e) => setSecondValue(e.target.value)}/>
|
|
59
|
+
</RangeInput>);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const PriceRange = {
|
|
63
|
+
render: () => {
|
|
64
|
+
const [minPrice, setMinPrice] = useState('');
|
|
65
|
+
const [maxPrice, setMaxPrice] = useState('');
|
|
66
|
+
return (<RangeInput helptext="Enter your budget range">
|
|
67
|
+
<Input label="Min Price" type="number" placeholder="0" value={minPrice} onChange={(e) => setMinPrice(e.target.value)}/>
|
|
68
|
+
<Input label="Max Price" type="number" placeholder="1000" value={maxPrice} onChange={(e) => setMaxPrice(e.target.value)}/>
|
|
69
|
+
</RangeInput>);
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
export const WithLongError = {
|
|
73
|
+
render: () => {
|
|
74
|
+
const [firstValue, setFirstValue] = useState('100');
|
|
75
|
+
const [secondValue, setSecondValue] = useState('50');
|
|
76
|
+
return (<RangeInput status="error" helptext="This is a long error message that should be displayed below the input group. It should wrap to multiple lines if necessary. This is a long error message that should be displayed below the input group. It should wrap to multiple lines if necessary.">
|
|
77
|
+
<Input label="From" value={firstValue} onChange={(e) => setFirstValue(e.target.value)} status="error"/>
|
|
78
|
+
<Input label="To" value={secondValue} onChange={(e) => setSecondValue(e.target.value)} status="error"/>
|
|
79
|
+
</RangeInput>);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
export const CustomSeparator = {
|
|
83
|
+
render: () => {
|
|
84
|
+
const [firstValue, setFirstValue] = useState('');
|
|
85
|
+
const [secondValue, setSecondValue] = useState('');
|
|
86
|
+
return (<RangeInput separatorComponent={<span style={{ fontSize: '18px', fontWeight: 'bold' }}>to</span>} helptext="Custom separator example">
|
|
87
|
+
<Input label="From" value={firstValue} onChange={(e) => setFirstValue(e.target.value)}/>
|
|
88
|
+
<Input label="To" value={secondValue} onChange={(e) => setSecondValue(e.target.value)}/>
|
|
89
|
+
</RangeInput>);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
export const WithoutLabels = {
|
|
93
|
+
render: () => {
|
|
94
|
+
const [firstValue, setFirstValue] = useState('');
|
|
95
|
+
const [secondValue, setSecondValue] = useState('');
|
|
96
|
+
return (<RangeInput helptext="Range inputs without labels">
|
|
97
|
+
<Input placeholder="Minimum value" value={firstValue} onChange={(e) => setFirstValue(e.target.value)}/>
|
|
98
|
+
<Input placeholder="Maximum value" value={secondValue} onChange={(e) => setSecondValue(e.target.value)}/>
|
|
99
|
+
</RangeInput>);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
export const MultipleRanges = {
|
|
103
|
+
render: () => {
|
|
104
|
+
const [firstValue, setFirstValue] = useState('');
|
|
105
|
+
const [secondValue, setSecondValue] = useState('');
|
|
106
|
+
const [thirdValue, setThirdValue] = useState('');
|
|
107
|
+
return (<div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
|
|
108
|
+
<RangeInput helptext="Price range filter">
|
|
109
|
+
<Input label="First Value" value={firstValue} onChange={(e) => setFirstValue(e.target.value)}/>
|
|
110
|
+
<Input label="Second Value" value={secondValue} onChange={(e) => setSecondValue(e.target.value)}/>
|
|
111
|
+
<Input label="Third Value" value={thirdValue} onChange={(e) => setThirdValue(e.target.value)}/>
|
|
112
|
+
</RangeInput>
|
|
113
|
+
</div>);
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
export const Disabled = {
|
|
117
|
+
render: () => (<RangeInput helptext="Disabled range inputs">
|
|
118
|
+
<Input label="From" value="100" disabled/>
|
|
119
|
+
<Input label="To" value="500" disabled/>
|
|
120
|
+
</RangeInput>),
|
|
121
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const containerClass: import("@linaria/core").LinariaClassName;
|
|
2
|
+
export declare const inputWrapperClass: import("@linaria/core").LinariaClassName;
|
|
3
|
+
export declare const separatorClass: import("@linaria/core").LinariaClassName;
|
|
4
|
+
export declare const helptextClass: import("@linaria/core").LinariaClassName;
|
|
5
|
+
//# sourceMappingURL=RangeInput.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeInput.styles.d.ts","sourceRoot":"","sources":["../../../patterns/RangeInput/RangeInput.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,0CAQ1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,0CAQ7B,CAAC;AAEF,eAAO,MAAM,cAAc,0CAK1B,CAAC;AAEF,eAAO,MAAM,aAAa,0CAIzB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { css } from '@linaria/core';
|
|
2
|
+
import theme from '@clad-ui/theme';
|
|
3
|
+
const { space, colors, typo } = theme;
|
|
4
|
+
export const containerClass = css `
|
|
5
|
+
/* Standard highlight for manual testing & verification */
|
|
6
|
+
position: relative;
|
|
7
|
+
outline: 1px solid var(--cladebug);
|
|
8
|
+
outline-offset: 1px;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: ${space.xxs};
|
|
12
|
+
`;
|
|
13
|
+
export const inputWrapperClass = css `
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: ${space.sm};
|
|
17
|
+
|
|
18
|
+
.separator-wrapper {
|
|
19
|
+
display: contents;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const separatorClass = css `
|
|
23
|
+
color: ${colors.textPrimary};
|
|
24
|
+
margin: 0;
|
|
25
|
+
|
|
26
|
+
${typo.label.section}
|
|
27
|
+
`;
|
|
28
|
+
export const helptextClass = css `
|
|
29
|
+
&.error {
|
|
30
|
+
color: ${colors.textError};
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
@@ -89,7 +89,7 @@ export interface SearchInputProps {
|
|
|
89
89
|
*/
|
|
90
90
|
status?: 'default' | 'error';
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* Prompt a helptext below input (useful when implemented with form validation)
|
|
93
93
|
*/
|
|
94
94
|
helptext?: string;
|
|
95
95
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../patterns/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../patterns/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAiBnD,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC;IAC3E,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAGD,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACnF;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;IACzF;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AACD;;;;GAIG;AAEH,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA4M3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -5,7 +5,6 @@ import { useLayer } from 'react-laag';
|
|
|
5
5
|
import theme from '@clad-ui/theme';
|
|
6
6
|
import Search from '../../icons/Search';
|
|
7
7
|
import { cx } from '../../utils';
|
|
8
|
-
import noop from '../../utils/noop';
|
|
9
8
|
import ChevronDownFilled from '../../icons/ChevronDownFilled';
|
|
10
9
|
import normalizeArrowKey from '../../utils/_normalizeArrowKey';
|
|
11
10
|
import { menuClass, optionClass, invertedArrowClass, searchInputWrapperClass, searchDropdownIconClass, Wrapper, } from './SearchInput.styles';
|
|
@@ -129,17 +128,17 @@ allowClear = true, menuMaxHeight = '$sm', showSearchIcon = false, ...inputProps
|
|
|
129
128
|
setHiliIndex(+itemIndex);
|
|
130
129
|
}
|
|
131
130
|
};
|
|
132
|
-
const
|
|
131
|
+
const handleInputFocus = (e) => {
|
|
133
132
|
e.persist();
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
134
|
+
if (variant === 'dropdown') {
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
setMenuOpen(true);
|
|
137
|
+
}, 0);
|
|
136
138
|
}
|
|
137
|
-
setTimeout(() => {
|
|
138
|
-
setMenuOpen(true);
|
|
139
|
-
}, 0);
|
|
140
139
|
};
|
|
141
140
|
return (<Wrapper id={id ? id : ''} role="combobox" onKeyUp={handleKeyUp} onKeyDown={handleKeyDown} tabIndex={0} aria-haspopup="listbox" aria-expanded={showMenu} aria-controls="search-input-listbox" className={cx(variant === 'dropdown' && searchInputWrapperClass)} data-clad="Input Field - Search Bar">
|
|
142
|
-
<Input {...inputProps} allowClear={allowClear} inputRef={textFieldRef} value={textValue} onChange={handleInputChange} onFocus={
|
|
141
|
+
<Input {...inputProps} allowClear={allowClear} inputRef={textFieldRef} value={textValue} onChange={handleInputChange} onFocus={handleInputFocus} icon={!!showSearchIcon && <Search width={20} height={20}/>}/>
|
|
143
142
|
{!!showMenu &&
|
|
144
143
|
renderLayer(<ul id="search-input-listbox" role="listbox" className={menuClass} {...layerProps} style={{
|
|
145
144
|
width: triggerBounds === null || triggerBounds === void 0 ? void 0 : triggerBounds.width, // we want the same width as the input
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.stories.d.ts","sourceRoot":"","sources":["../../../patterns/SearchInput/SearchInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchInput.stories.d.ts","sourceRoot":"","sources":["../../../patterns/SearchInput/SearchInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAWrD,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFvB,CAAC;AAEF,eAAe,kBAAkB,CAAC;AAElC,eAAO,MAAM,QAAQ;mBACJ,GAAG;CA0BnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAsCxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CA8CzB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CAgCtB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;CAiCpB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;CAgCvB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAgC3B,CAAC;AAQF,eAAO,MAAM,MAAM;;;;;;;;;;CA0ElB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;CAgE1B,CAAC;AAuFF,eAAO,MAAM,cAAc;;;;;;;;;CA8B1B,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import theme from '@clad-ui/theme';
|
|
3
3
|
import debounce from 'lodash/debounce';
|
|
4
|
-
import { guideImageClass } from '../../storybook/GuideImage';
|
|
5
4
|
import SearchInput from './SearchInput';
|
|
6
5
|
import Grid from '../../components/Grid/Grid';
|
|
7
6
|
import Col from '../../components/Grid/Col';
|
|
@@ -17,7 +16,7 @@ const searchInputStories = {
|
|
|
17
16
|
component: `Search Input component that carefully takes care of accessibility
|
|
18
17
|
and allow keyboard controls.
|
|
19
18
|
|
|
20
|
-
\`🧪 Revamped in 1.2+ \` [\`🎨 Figma Specs\`](https://www.figma.com/
|
|
19
|
+
\`🧪 Revamped in 1.2+ \` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=865-13593&t=hz8QJLqNrGvTVY8R-4)
|
|
21
20
|
|
|
22
21
|
## How to use
|
|
23
22
|
|
|
@@ -35,7 +34,6 @@ Usage:
|
|
|
35
34
|
Note:
|
|
36
35
|
- z-index of the selections list should be larger then modal z-index, for inside modal use case.
|
|
37
36
|
|
|
38
|
-
<img className="${guideImageClass}" src="./search-input.png" alt="Search Input screenshot" />
|
|
39
37
|
`,
|
|
40
38
|
},
|
|
41
39
|
},
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type HTMLCladUIProps, type ReactRef } from '../../utils/types';
|
|
2
|
+
type ClassNames = {
|
|
3
|
+
container: string;
|
|
4
|
+
input: string;
|
|
5
|
+
actionBtn: string;
|
|
6
|
+
};
|
|
7
|
+
export interface SearchbarProps extends HTMLCladUIProps<'input'> {
|
|
8
|
+
/**
|
|
9
|
+
* Ref to the DOM node.
|
|
10
|
+
*/
|
|
11
|
+
ref?: ReactRef<HTMLInputElement | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Additional classes to be added for customization
|
|
14
|
+
*/
|
|
15
|
+
classNames?: ClassNames;
|
|
16
|
+
/**
|
|
17
|
+
* Allow to remove input content with clear icon
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
allowClear?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Default value
|
|
23
|
+
*/
|
|
24
|
+
defaultValue?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const Searchbar: import("../../utils/types").InternalForwardRefRenderFunction<"input", SearchbarProps>;
|
|
27
|
+
export default Searchbar;
|
|
28
|
+
//# sourceMappingURL=Searchbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Searchbar.d.ts","sourceRoot":"","sources":["../../../patterns/Searchbar/Searchbar.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIpF,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC9D;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACxC;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,SAAS,uFAyDb,CAAC;AAIH,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useRef, useState, useImperativeHandle } from 'react';
|
|
3
|
+
import { cx } from '../../utils';
|
|
4
|
+
import { forwardRef } from '../../utils/types';
|
|
5
|
+
import { Search, CloseFilled } from '../../icons';
|
|
6
|
+
import { actionBtnClass, containerClass } from './Searchbar.styles';
|
|
7
|
+
const Searchbar = forwardRef((props, ref) => {
|
|
8
|
+
const { placeholder = 'Tìm sản phẩm...', value, classNames, onChange, defaultValue = '', allowClear = true, disabled = false, ...rest } = props;
|
|
9
|
+
const [inputValue, setInputValue] = useState(value || defaultValue);
|
|
10
|
+
const internalRef = useRef(null);
|
|
11
|
+
useImperativeHandle(ref, () => internalRef === null || internalRef === void 0 ? void 0 : internalRef.current);
|
|
12
|
+
const onInputChange = (e) => {
|
|
13
|
+
setInputValue(e.target.value);
|
|
14
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
15
|
+
};
|
|
16
|
+
const onClear = () => {
|
|
17
|
+
var _a;
|
|
18
|
+
setInputValue('');
|
|
19
|
+
if (onChange && internalRef.current) {
|
|
20
|
+
const syntheticEvent = {
|
|
21
|
+
target: { value: '' },
|
|
22
|
+
currentTarget: internalRef.current,
|
|
23
|
+
};
|
|
24
|
+
onChange(syntheticEvent);
|
|
25
|
+
}
|
|
26
|
+
(_a = internalRef === null || internalRef === void 0 ? void 0 : internalRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
27
|
+
};
|
|
28
|
+
return (<div className={cx(containerClass, classNames === null || classNames === void 0 ? void 0 : classNames.container)}>
|
|
29
|
+
<Search width={20} height={20}/>
|
|
30
|
+
<input className={classNames === null || classNames === void 0 ? void 0 : classNames.input} value={inputValue} placeholder={placeholder} disabled={disabled} onChange={onInputChange} {...rest} ref={internalRef}/>
|
|
31
|
+
{inputValue && allowClear && !disabled ? (<button type="button" onClick={onClear} className={cx(actionBtnClass, classNames === null || classNames === void 0 ? void 0 : classNames.actionBtn)}>
|
|
32
|
+
<CloseFilled width={24} height={24}/>
|
|
33
|
+
</button>) : null}
|
|
34
|
+
</div>);
|
|
35
|
+
});
|
|
36
|
+
Searchbar.displayName = 'Searchbar';
|
|
37
|
+
export default Searchbar;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const meta: {
|
|
2
|
+
title: string;
|
|
3
|
+
component: import("../../utils/types").InternalForwardRefRenderFunction<"input", import("./Searchbar").SearchbarProps>;
|
|
4
|
+
tags: string[];
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
description: {
|
|
8
|
+
component: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
argTypes: {
|
|
13
|
+
allowClear: {
|
|
14
|
+
control: string;
|
|
15
|
+
description: string;
|
|
16
|
+
defaultValue: boolean;
|
|
17
|
+
};
|
|
18
|
+
classNames: {
|
|
19
|
+
control: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
args: {
|
|
24
|
+
placeholder: string;
|
|
25
|
+
allowClear: boolean;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default meta;
|
|
29
|
+
export declare const Overview: {
|
|
30
|
+
render: (args: any) => JSX.Element;
|
|
31
|
+
};
|
|
32
|
+
export declare const WithInitialValue: {
|
|
33
|
+
render: (args: any) => JSX.Element;
|
|
34
|
+
};
|
|
35
|
+
export declare const CustomPlaceholder: {
|
|
36
|
+
args: {
|
|
37
|
+
placeholder: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare const Disabled: {
|
|
41
|
+
args: {
|
|
42
|
+
disabled: boolean;
|
|
43
|
+
defaultValue: string;
|
|
44
|
+
placeholder: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare const NoClearButton: {
|
|
48
|
+
args: {
|
|
49
|
+
allowClear: boolean;
|
|
50
|
+
defaultValue: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export declare const CustomStyling: {
|
|
54
|
+
args: {
|
|
55
|
+
placeholder: string;
|
|
56
|
+
classNames: {
|
|
57
|
+
container: string;
|
|
58
|
+
input: string;
|
|
59
|
+
actionBtn: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
parameters: {
|
|
63
|
+
docs: {
|
|
64
|
+
description: {
|
|
65
|
+
story: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=Searchbar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Searchbar.stories.d.ts","sourceRoot":"","sources":["../../../patterns/Searchbar/Searchbar.stories.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BT,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,QAAQ;mBACJ,GAAG;CAKnB,CAAC;AAEF,eAAO,MAAM,gBAAgB;mBACZ,GAAG;CAKnB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;CAgBzB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Searchbar from './Searchbar';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Patterns/Searchbar',
|
|
5
|
+
component: Searchbar,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: `A search input component with built-in search icon and optional clear functionality. Perfect for search interfaces and filtering content.
|
|
11
|
+
|
|
12
|
+
\`🧪 Beta \` [\`🎨 Figma Specs\`](https://www.figma.com/design/CYWl6Rz8BD5Pvv7LRsupYk/Design-System-Handoff?node-id=8873-5334&t=fVzdnRlA1pOFBpL3-4)
|
|
13
|
+
`,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
allowClear: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
description: 'Show clear button when input has content',
|
|
21
|
+
defaultValue: true,
|
|
22
|
+
},
|
|
23
|
+
classNames: {
|
|
24
|
+
control: 'object',
|
|
25
|
+
description: 'Custom class names for styling different parts, including container, input, and action button',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
args: {
|
|
29
|
+
placeholder: 'Tìm sản phẩm...',
|
|
30
|
+
allowClear: true,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export default meta;
|
|
34
|
+
export const Overview = {
|
|
35
|
+
render: (args) => {
|
|
36
|
+
const [value, setValue] = useState('');
|
|
37
|
+
return <Searchbar {...args} value={value} onChange={(e) => setValue(e.target.value)}/>;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const WithInitialValue = {
|
|
41
|
+
render: (args) => {
|
|
42
|
+
const [value, setValue] = useState('Initial search term');
|
|
43
|
+
return <Searchbar {...args} value={value} onChange={(e) => setValue(e.target.value)}/>;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const CustomPlaceholder = {
|
|
47
|
+
args: {
|
|
48
|
+
placeholder: 'Search products, brands, categories...',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export const Disabled = {
|
|
52
|
+
args: {
|
|
53
|
+
disabled: true,
|
|
54
|
+
defaultValue: 'Cannot edit this',
|
|
55
|
+
placeholder: 'This input is disabled',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export const NoClearButton = {
|
|
59
|
+
args: {
|
|
60
|
+
allowClear: false,
|
|
61
|
+
defaultValue: 'No clear button available',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export const CustomStyling = {
|
|
65
|
+
args: {
|
|
66
|
+
placeholder: 'Custom styled searchbar',
|
|
67
|
+
classNames: {
|
|
68
|
+
container: 'custom-container',
|
|
69
|
+
input: 'custom-input',
|
|
70
|
+
actionBtn: 'custom-action-btn',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
parameters: {
|
|
74
|
+
docs: {
|
|
75
|
+
description: {
|
|
76
|
+
story: 'Example showing how to apply custom styling using the classNames prop.',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Searchbar.styles.d.ts","sourceRoot":"","sources":["../../../patterns/Searchbar/Searchbar.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,0CA8B1B,CAAC;AAEF,eAAO,MAAM,cAAc,0CAa1B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css } from '@linaria/core';
|
|
2
|
+
import theme from '@clad-ui/theme';
|
|
3
|
+
const { colors, space, typo } = theme;
|
|
4
|
+
export const containerClass = css `
|
|
5
|
+
/* Standard highlight for manual testing & verification */
|
|
6
|
+
position: relative;
|
|
7
|
+
outline: 1px solid var(--cladebug);
|
|
8
|
+
outline-offset: 1px;
|
|
9
|
+
background-color: ${colors.backgroundSecondary};
|
|
10
|
+
padding: ${space.none} ${space.xxs} ${space.none} ${space.sm};
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
color: ${colors.iconTertiary};
|
|
14
|
+
height: 40px;
|
|
15
|
+
border-radius: 20px;
|
|
16
|
+
gap: ${space.xs};
|
|
17
|
+
|
|
18
|
+
input {
|
|
19
|
+
border-width: 0;
|
|
20
|
+
background-color: ${colors.backgroundSecondary};
|
|
21
|
+
flex: 1;
|
|
22
|
+
color: ${colors.textPrimary};
|
|
23
|
+
|
|
24
|
+
${typo.header.caption}
|
|
25
|
+
|
|
26
|
+
&:focus-visible {
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
::placeholder {
|
|
31
|
+
color: ${colors.textTertiary};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
export const actionBtnClass = css `
|
|
36
|
+
width: 40px;
|
|
37
|
+
height: 40px;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
background-color: transparent;
|
|
43
|
+
color: ${colors.iconTertiary};
|
|
44
|
+
|
|
45
|
+
:hover {
|
|
46
|
+
color: ${colors.interactionNeutralHover};
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
@@ -54,7 +54,7 @@ export interface TagCloudProps {
|
|
|
54
54
|
*/
|
|
55
55
|
status?: 'default' | 'error';
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Prompt a helptext below Tag cloud (useful when implemented with validation)
|
|
58
58
|
*/
|
|
59
59
|
helptext?: string;
|
|
60
60
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagCloud.stories.d.ts","sourceRoot":"","sources":["../../../patterns/TagCloud/TagCloud.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TagCloud.stories.d.ts","sourceRoot":"","sources":["../../../patterns/TagCloud/TagCloud.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuBnD,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DpB,CAAC;AAEF,eAAe,eAAe,CAAC;AAE/B,eAAO,MAAM,QAAQ;;CAapB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;CA4CjC,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;CA+B1B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA8BxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA6BxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAmCvB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;CAuC5B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CA+BtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAqCvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA4BxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAoCzB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { css } from '@linaria/core';
|
|
3
|
-
import { guideImageClass } from '../../storybook/GuideImage';
|
|
4
3
|
import TagCloud from './TagCloud';
|
|
5
4
|
const gridClass = css `
|
|
6
5
|
/* stylelint-disable declaration-no-important */
|
|
@@ -29,20 +28,18 @@ const tagCloudStories = {
|
|
|
29
28
|
description: {
|
|
30
29
|
component: `Tag Cloud pattern, including multiple Chip components
|
|
31
30
|
|
|
32
|
-
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/
|
|
31
|
+
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=44-8750&t=hz8QJLqNrGvTVY8R-4)
|
|
33
32
|
|
|
34
33
|
## How to use
|
|
35
34
|
|
|
36
35
|
<div className="${gridClass}">
|
|
37
36
|
<div>
|
|
38
37
|
<h3>Single Selection</h3>
|
|
39
|
-
<img className="${guideImageClass}" src="./tagcloud-singleselection.png" />
|
|
40
38
|
<p>The active state switches among Chips. There is always one (and only one) active Chip at a time.</p>
|
|
41
39
|
</div>
|
|
42
40
|
|
|
43
41
|
<div>
|
|
44
42
|
<h3>Multiple Selection</h3>
|
|
45
|
-
<img className="${guideImageClass}" src="./tagcloud-multiselection.png" />
|
|
46
43
|
<p>Having multiple active Chip is allowed.</p>
|
|
47
44
|
<ul>
|
|
48
45
|
<li>If Tag Cloud is not required, deactivating all Chips is also allowed.</li>
|
|
@@ -53,7 +50,6 @@ const tagCloudStories = {
|
|
|
53
50
|
|
|
54
51
|
### Tag Cloud as Tabs
|
|
55
52
|
Tag Cloud is a form of Tabs, used for page navigation. Default active Chip should be the first Chip.
|
|
56
|
-
<img className="${guideImageClass}" src="./tagcloud-how.png" />
|
|
57
53
|
`,
|
|
58
54
|
},
|
|
59
55
|
},
|
package/dist/patterns/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { default as SearchInput } from './SearchInput/SearchInput';
|
|
|
7
7
|
export { default as InputGroup } from './InputGroup/InputGroup';
|
|
8
8
|
export { default as EmptyState } from './EmptyState/EmptyState';
|
|
9
9
|
export { default as MultiSearchDropdown } from './MultiSearchDropdown/MultiSearchDropdown';
|
|
10
|
+
export { default as Searchbar } from './Searchbar/Searchbar';
|
|
11
|
+
export { default as RangeInput } from './RangeInput/RangeInput';
|
|
10
12
|
export type { LegacyDialogProps } from './LegacyDialog/LegacyDialog';
|
|
11
13
|
export type { LegacyPopupProps } from './LegacyPopup/LegacyPopup';
|
|
12
14
|
export type { PopupProps } from './Popup/Popup';
|
|
@@ -16,4 +18,6 @@ export type { SearchInputProps } from './SearchInput/SearchInput';
|
|
|
16
18
|
export type { InputGroupProps } from './InputGroup/InputGroup';
|
|
17
19
|
export type { EmptyStateProps } from './EmptyState/EmptyState';
|
|
18
20
|
export type { MultiSearchDropdownProps } from './MultiSearchDropdown/MultiSearchDropdown';
|
|
21
|
+
export type { SearchbarProps } from './Searchbar/Searchbar';
|
|
22
|
+
export type { RangeInputProps } from './RangeInput/RangeInput';
|
|
19
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAC3F,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/patterns/index.js
CHANGED
|
@@ -7,3 +7,5 @@ export { default as SearchInput } from './SearchInput/SearchInput';
|
|
|
7
7
|
export { default as InputGroup } from './InputGroup/InputGroup';
|
|
8
8
|
export { default as EmptyState } from './EmptyState/EmptyState';
|
|
9
9
|
export { default as MultiSearchDropdown } from './MultiSearchDropdown/MultiSearchDropdown';
|
|
10
|
+
export { default as Searchbar } from './Searchbar/Searchbar';
|
|
11
|
+
export { default as RangeInput } from './RangeInput/RangeInput';
|
|
@@ -49,8 +49,8 @@ const ColorFoundationList = () => {
|
|
|
49
49
|
const type = getColorClass(colorName, colorTypeList);
|
|
50
50
|
if (type) {
|
|
51
51
|
const colorToken = colorNameDict[colors[colorName]];
|
|
52
|
-
const splitedParts = colorToken.split('_');
|
|
53
|
-
const hex = splitedParts[0];
|
|
52
|
+
const splitedParts = colorToken === null || colorToken === void 0 ? void 0 : colorToken.split('_');
|
|
53
|
+
const hex = splitedParts === null || splitedParts === void 0 ? void 0 : splitedParts[0];
|
|
54
54
|
if (hex) {
|
|
55
55
|
const color = hex.replace(/\d+/g, '');
|
|
56
56
|
const colorWeight = +hex.replace(/\D+/g, '');
|