@chotot/clad-ui 1.2.5 → 1.3.1
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 +3 -3
- package/components/Announcer/Announcer.d.ts +9 -4
- package/components/Announcer/Announcer.stories.d.ts +142 -0
- package/components/Announcer/{Announcer.stories.js → Announcer.stories.tsx} +36 -31
- package/components/Announcer/Announcer.styles.d.ts +24 -12
- package/components/Announcer/{Announcer.styles.js → Announcer.styles.ts} +43 -18
- package/components/Announcer/Announcer.tsx +62 -47
- package/components/Badge/Badge.d.ts +4 -2
- package/components/Badge/Badge.stories.d.ts +61 -0
- package/components/Badge/{Badge.stories.js → Badge.stories.tsx} +5 -5
- package/components/Badge/Badge.styles.d.ts +20 -5
- package/components/Badge/{Badge.styles.js → Badge.styles.ts} +14 -1
- package/components/Badge/Badge.tsx +8 -4
- package/components/Box/Box.d.ts +3 -3
- package/components/Box/Box.stories.d.ts +240 -0
- package/components/Box/{Box.stories.js → Box.stories.tsx} +2 -2
- package/components/Box/Box.styles.d.ts +19 -4
- package/components/Box/{Box.styles.js → Box.styles.ts} +17 -4
- package/components/Box/Box.tsx +4 -4
- package/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts +52 -0
- package/components/Breadcrumbs/{Breadcrumbs.stories.js → Breadcrumbs.stories.tsx} +17 -15
- package/components/Breadcrumbs/Breadcrumbs.styles.d.ts +5 -4
- package/components/Breadcrumbs/Breadcrumbs.tsx +2 -2
- package/components/Button/Button.d.ts +21 -6
- package/components/Button/Button.stories.d.ts +103 -0
- package/components/Button/{Button.stories.js → Button.stories.tsx} +5 -1
- package/components/Button/Button.styles.d.ts +1 -1
- package/components/Button/{Button.styles.js → Button.styles.ts} +100 -6
- package/components/Button/Button.tsx +51 -18
- package/components/Button/ButtonLink.d.ts +4 -4
- package/components/Button/ButtonLink.stories.d.ts +30 -0
- package/components/Button/ButtonLink.styles.d.ts +1 -1
- package/components/Button/ButtonLink.tsx +5 -5
- package/components/Button/IconButton.d.ts +3 -29
- package/components/Button/IconButton.stories.d.ts +60 -0
- package/components/Button/{IconButton.stories.js → IconButton.stories.tsx} +27 -0
- package/components/Button/IconButton.tsx +2 -42
- package/components/Checkbox/Checkbox.d.ts +3 -3
- package/components/Checkbox/Checkbox.stories.d.ts +88 -0
- package/components/Checkbox/Checkbox.styles.d.ts +2 -2
- package/components/Checkbox/Checkbox.tsx +3 -6
- package/components/Chip/Chip.d.ts +5 -4
- package/components/Chip/Chip.stories.d.ts +153 -0
- package/components/Chip/{Chip.stories.js → Chip.stories.tsx} +4 -5
- package/components/Chip/Chip.styles.d.ts +11 -8
- package/components/Chip/{Chip.styles.js → Chip.styles.ts} +4 -4
- package/components/Chip/Chip.tsx +19 -12
- package/components/CurrencyInput/CurrencyInput.d.ts +3 -56
- package/components/CurrencyInput/CurrencyInput.stories.d.ts +104 -0
- package/components/CurrencyInput/{CurrencyInput.stories.js → CurrencyInput.stories.tsx} +2 -2
- package/components/CurrencyInput/CurrencyInput.styles.d.ts +16 -10
- package/components/CurrencyInput/{CurrencyInput.styles.js → CurrencyInput.styles.ts} +23 -9
- package/components/CurrencyInput/CurrencyInput.tsx +7 -61
- package/components/Dropdown/Dropdown.d.ts +22 -7
- package/components/Dropdown/Dropdown.stories.d.ts +148 -0
- package/components/Dropdown/{Dropdown.stories.js → Dropdown.stories.tsx} +115 -1
- package/components/Dropdown/Dropdown.styles.d.ts +10 -0
- package/components/Dropdown/Dropdown.styles.ts +42 -0
- package/components/Dropdown/Dropdown.tsx +120 -24
- package/components/Grid/Col.d.ts +2 -2
- package/components/Grid/Col.tsx +6 -3
- package/components/Grid/Grid.styles.d.ts +25 -5
- package/components/Grid/{Grid.styles.js → Grid.styles.ts} +16 -3
- package/components/Grid/aGrid.stories.d.ts +127 -0
- package/components/Grid/bCol.stories.d.ts +74 -0
- package/components/Input/Input.d.ts +14 -10
- package/components/Input/Input.stories.d.ts +226 -0
- package/components/Input/{Input.stories.js → Input.stories.tsx} +20 -16
- package/components/Input/Input.styles.d.ts +22 -11
- package/components/Input/{Input.styles.js → Input.styles.ts} +29 -7
- package/components/Input/Input.tsx +22 -20
- package/components/Popover/Popover.d.ts +44 -0
- package/components/Popover/Popover.stories.d.ts +53 -0
- package/components/Popover/Popover.stories.tsx +133 -0
- package/components/Popover/Popover.tsx +121 -0
- package/components/RadioButton/RadioButton.d.ts +5 -6
- package/components/RadioButton/RadioButton.stories.d.ts +94 -0
- package/components/RadioButton/RadioButton.styles.d.ts +7 -3
- package/components/RadioButton/{RadioButton.styles.js → RadioButton.styles.ts} +1 -1
- package/components/RadioButton/RadioButton.tsx +5 -11
- package/components/RowItem/RowItem.d.ts +27 -9
- package/components/RowItem/RowItem.stories.d.ts +131 -0
- package/components/RowItem/RowItem.stories.tsx +710 -0
- package/components/RowItem/RowItem.styles.d.ts +31 -10
- package/components/RowItem/{RowItem.styles.js → RowItem.styles.ts} +41 -13
- package/components/RowItem/RowItem.tsx +106 -42
- package/components/ShapeIcon/ShapeIcon.d.ts +23 -16
- package/components/ShapeIcon/ShapeIcon.stories.d.ts +91 -0
- package/components/ShapeIcon/{ShapeIcon.stories.js → ShapeIcon.stories.tsx} +21 -8
- package/components/ShapeIcon/ShapeIcon.styles.d.ts +8 -3
- package/components/ShapeIcon/{ShapeIcon.styles.js → ShapeIcon.styles.ts} +6 -3
- package/components/ShapeIcon/ShapeIcon.tsx +25 -21
- package/components/Slider/Slider.d.ts +9 -7
- package/components/Slider/Slider.stories.d.ts +81 -0
- package/components/Slider/{Slider.stories.js → Slider.stories.tsx} +7 -7
- package/components/Slider/Slider.styles.d.ts +15 -11
- package/components/Slider/{Slider.styles.js → Slider.styles.ts} +1 -1
- package/components/Slider/Slider.tsx +21 -16
- package/components/Snack/Snack.d.ts +4 -5
- package/components/Snack/Snack.stories.d.ts +87 -0
- package/components/Snack/Snack.styles.d.ts +9 -8
- package/components/Snack/{Snack.styles.js → Snack.styles.ts} +4 -4
- package/components/Snack/Snack.tsx +14 -11
- package/components/Tabs/Tab.d.ts +6 -6
- package/components/Tabs/Tab.tsx +6 -7
- package/components/Tabs/Tabs.d.ts +7 -4
- package/components/Tabs/Tabs.stories.d.ts +64 -0
- package/components/Tabs/{Tabs.stories.js → Tabs.stories.tsx} +2 -2
- package/components/Tabs/Tabs.styles.d.ts +30 -12
- package/components/Tabs/{Tabs.styles.js → Tabs.styles.ts} +4 -4
- package/components/Tabs/Tabs.tsx +11 -7
- package/components/TextArea/TextArea.d.ts +24 -11
- package/components/TextArea/TextArea.stories.d.ts +151 -0
- package/components/TextArea/{TextArea.stories.js → TextArea.stories.tsx} +5 -96
- package/components/TextArea/TextArea.styles.d.ts +18 -16
- package/components/TextArea/{TextArea.styles.js → TextArea.styles.ts} +39 -19
- package/components/TextArea/TextArea.tsx +85 -31
- package/components/TextLabel/TextLabel.d.ts +35 -0
- package/components/TextLabel/TextLabel.stories.d.ts +40 -0
- package/components/TextLabel/TextLabel.stories.tsx +177 -0
- package/components/TextLabel/TextLabel.styles.d.ts +9 -0
- package/components/TextLabel/TextLabel.styles.ts +24 -0
- package/components/TextLabel/TextLabel.tsx +112 -0
- package/components/ToggleSwitch/ToggleSwitch.d.ts +2 -2
- package/components/ToggleSwitch/ToggleSwitch.stories.d.ts +38 -0
- package/components/ToggleSwitch/ToggleSwitch.styles.d.ts +21 -14
- package/components/ToggleSwitch/{ToggleSwitch.styles.js → ToggleSwitch.styles.ts} +8 -12
- package/components/ToggleSwitch/ToggleSwitch.tsx +12 -6
- package/components/Tooltip/Tooltip.d.ts +9 -3
- package/components/Tooltip/Tooltip.spec.js +5 -3
- package/components/Tooltip/Tooltip.styles.d.ts +7 -8
- package/components/Tooltip/Tooltip.tsx +10 -3
- package/components/index.d.ts +2 -0
- package/components/index.ts +2 -0
- package/icons/PrivateSellerAvatar.d.ts +3 -0
- package/icons/PrivateSellerAvatar.js +3 -0
- package/icons/Sda.d.ts +5 -2
- package/icons/Sda.js +7 -7
- package/icons/VerifiedShop.d.ts +3 -0
- package/icons/VerifiedShop.js +3 -0
- package/package.json +6 -6
- package/patterns/Drawer/Drawer.d.ts +13 -13
- package/patterns/Drawer/Drawer.stories.d.ts +90 -0
- package/patterns/Drawer/{Drawer.stories.js → Drawer.stories.tsx} +25 -0
- package/patterns/Drawer/Drawer.styles.d.ts +30 -26
- package/patterns/Drawer/{Drawer.styles.js → Drawer.styles.ts} +2 -5
- package/patterns/Drawer/Drawer.tsx +20 -41
- package/patterns/EmptyState/EmptyState.d.ts +5 -4
- package/patterns/EmptyState/EmptyState.stories.d.ts +40 -0
- package/patterns/EmptyState/EmptyState.styles.d.ts +10 -10
- package/patterns/EmptyState/{EmptyState.styles.js → EmptyState.styles.ts} +5 -4
- package/patterns/EmptyState/EmptyState.tsx +14 -12
- package/patterns/InputGroup/InputGroup.d.ts +4 -0
- package/patterns/InputGroup/InputGroup.styles.d.ts +5 -4
- package/patterns/InputGroup/InputGroup.tsx +11 -5
- package/patterns/LegacyDialog/DialogMainIcon.d.ts +1 -0
- package/patterns/LegacyDialog/DialogMainIcon.js +51 -0
- package/patterns/LegacyDialog/LegacyDialog.d.ts +3 -3
- package/patterns/LegacyDialog/LegacyDialog.styles.d.ts +8 -10
- package/patterns/LegacyDialog/LegacyDialog.styles.js +1 -46
- package/patterns/LegacyDialog/LegacyDialog.tsx +5 -11
- package/patterns/LegacyPopup/LegacyPopup.d.ts +4 -4
- package/patterns/LegacyPopup/LegacyPopup.styles.d.ts +18 -13
- package/patterns/LegacyPopup/{LegacyPopup.styles.js → LegacyPopup.styles.ts} +3 -1
- package/patterns/LegacyPopup/LegacyPopup.tsx +4 -6
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +20 -17
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.d.ts +125 -0
- package/patterns/MultiSearchDropdown/{MultiSearchDropdown.stories.js → MultiSearchDropdown.stories.tsx} +31 -30
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.styles.d.ts +22 -21
- package/patterns/MultiSearchDropdown/{MultiSearchDropdown.styles.js → MultiSearchDropdown.styles.ts} +1 -7
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.tsx +33 -32
- package/patterns/Popup/Popup.d.ts +8 -7
- package/patterns/Popup/Popup.stories.d.ts +102 -0
- package/patterns/Popup/Popup.styles.d.ts +41 -30
- package/patterns/Popup/{Popup.styles.js → Popup.styles.ts} +26 -33
- package/patterns/Popup/Popup.tsx +14 -33
- package/patterns/SearchInput/SearchInput.d.ts +38 -21
- package/patterns/SearchInput/SearchInput.stories.d.ts +186 -0
- package/patterns/SearchInput/{SearchInput.stories.js → SearchInput.stories.tsx} +78 -45
- package/patterns/SearchInput/SearchInput.styles.d.ts +6 -5
- package/patterns/SearchInput/{SearchInput.styles.js → SearchInput.styles.ts} +7 -4
- package/patterns/SearchInput/SearchInput.tsx +53 -34
- package/patterns/TagCloud/TagCloud.d.ts +19 -6
- package/patterns/TagCloud/TagCloud.stories.d.ts +159 -0
- package/patterns/TagCloud/{TagCloud.stories.js → TagCloud.stories.tsx} +59 -14
- package/patterns/TagCloud/TagCloud.styles.d.ts +12 -8
- package/patterns/TagCloud/{TagCloud.styles.js → TagCloud.styles.ts} +6 -7
- package/patterns/TagCloud/TagCloud.tsx +24 -8
- package/patterns/TagCloud/TagCloudMultiActive.d.ts +6 -4
- package/patterns/TagCloud/TagCloudMultiActive.tsx +5 -5
- package/patterns/TagCloud/TagCloudSingleActive.d.ts +5 -2
- package/patterns/TagCloud/TagCloudSingleActive.tsx +18 -5
- package/patterns/patterns-index.spec.js +1 -1
- package/storybook/GuideImage.d.ts +2 -2
- package/storybook/Swatch.d.ts +2 -2
- package/theme/__snapshots__/chotot.spec.js.snap +2 -2
- package/theme/chotot-color1.d.ts +7 -14
- package/theme/chotot.d.ts +32 -32
- package/theme/chotot.js +4 -4
- package/theme/ct-job.d.ts +6 -14
- package/theme/ct-pty.d.ts +6 -8
- package/theme/mudah.d.ts +14 -13
- package/types.d.ts +0 -9
- package/utils/_simulateChangeEvent.d.ts +18 -3
- package/utils/_simulateChangeEvent.js +13 -6
- package/utils/_simulateChangeEvent.spec.js +1 -1
- package/utils/cx.d.ts +8 -4
- package/utils/cx.js +8 -4
- package/utils/sx.d.ts +12 -4192
- package/components/RowItem/RowItem.stories.js +0 -560
- /package/components/Breadcrumbs/{Breadcrumbs.styles.js → Breadcrumbs.styles.ts} +0 -0
- /package/components/Button/{ButtonLink.stories.js → ButtonLink.stories.tsx} +0 -0
- /package/components/Button/{ButtonLink.styles.js → ButtonLink.styles.ts} +0 -0
- /package/components/Checkbox/{Checkbox.stories.js → Checkbox.stories.tsx} +0 -0
- /package/components/Checkbox/{Checkbox.styles.js → Checkbox.styles.ts} +0 -0
- /package/components/Grid/{aGrid.stories.js → aGrid.stories.tsx} +0 -0
- /package/components/Grid/{bCol.stories.js → bCol.stories.tsx} +0 -0
- /package/components/RadioButton/{RadioButton.stories.js → RadioButton.stories.tsx} +0 -0
- /package/components/Snack/{Snack.stories.js → Snack.stories.tsx} +0 -0
- /package/components/ToggleSwitch/{ToggleSwitch.stories.js → ToggleSwitch.stories.tsx} +0 -0
- /package/patterns/EmptyState/{EmptyState.stories.js → EmptyState.stories.tsx} +0 -0
- /package/patterns/InputGroup/{InputGroup.styles.js → InputGroup.styles.ts} +0 -0
- /package/patterns/Popup/{Popup.stories.js → Popup.stories.tsx} +0 -0
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
export const styledRowCss: import("@linaria/core").LinariaClassName;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export declare const styledRowCss: import("@linaria/core").LinariaClassName;
|
|
2
|
+
export declare const StyledRow: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
padding: string;
|
|
4
|
+
minHeight: string;
|
|
5
|
+
border: {
|
|
6
|
+
top: string;
|
|
7
|
+
bottom: string;
|
|
8
|
+
left: string;
|
|
9
|
+
right: string;
|
|
10
|
+
};
|
|
11
|
+
} & {
|
|
12
|
+
as?: import("react").ElementType;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const StyledIcon: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
15
|
+
as?: import("react").ElementType;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const StyledText: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
18
|
+
as?: import("react").ElementType;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const StyledTopRow: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
21
|
+
inverted: boolean;
|
|
22
|
+
} & {
|
|
23
|
+
as?: import("react").ElementType;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const StyledDescription: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
26
|
+
as?: import("react").ElementType;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const CollapsibleContent: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
29
|
+
isCollapsed: boolean;
|
|
30
|
+
} & {
|
|
31
|
+
as?: import("react").ElementType;
|
|
11
32
|
}>;
|
|
@@ -2,40 +2,43 @@ import { css } from '@linaria/core';
|
|
|
2
2
|
import { styled } from '@linaria/react';
|
|
3
3
|
import theme from '@clad-ui/theme';
|
|
4
4
|
|
|
5
|
-
const { space, fontSizes } = theme;
|
|
5
|
+
const { space, fontSizes, colors, fontWeights, sizes } = theme;
|
|
6
6
|
|
|
7
7
|
export const styledRowCss = css`
|
|
8
8
|
color: inherit;
|
|
9
9
|
text-decoration: inherit;
|
|
10
10
|
width: 100%;
|
|
11
11
|
border-radius: 4px;
|
|
12
|
-
position: relative;
|
|
13
12
|
cursor: pointer;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
align-items: center;
|
|
17
|
-
background-color: ${theme.colors.backgroundPrimary};
|
|
13
|
+
position: relative;
|
|
14
|
+
background-color: ${colors.backgroundPrimary};
|
|
18
15
|
&:hover {
|
|
19
|
-
background-color: ${
|
|
16
|
+
background-color: ${colors.interactionPrimaryHover};
|
|
20
17
|
}
|
|
21
18
|
label {
|
|
22
19
|
margin-bottom: 0;
|
|
23
20
|
}
|
|
24
21
|
`;
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
export const StyledRow = styled.div<{
|
|
24
|
+
padding: string;
|
|
25
|
+
minHeight: string;
|
|
26
|
+
border: {
|
|
27
|
+
top: string;
|
|
28
|
+
bottom: string;
|
|
29
|
+
left: string;
|
|
30
|
+
right: string;
|
|
31
|
+
};
|
|
32
|
+
}>`
|
|
30
33
|
font-size: ${fontSizes.sm};
|
|
31
34
|
padding: ${({ padding }) => padding};
|
|
32
|
-
gap: ${space.sm};
|
|
33
35
|
border-top: ${({ border }) => border.top};
|
|
34
36
|
border-bottom: ${({ border }) => border.bottom};
|
|
35
37
|
border-left: ${({ border }) => border.left};
|
|
36
38
|
border-right: ${({ border }) => border.right};
|
|
37
39
|
display: flex;
|
|
38
|
-
flex-direction:
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: ${space.xs};
|
|
39
42
|
`;
|
|
40
43
|
|
|
41
44
|
export const StyledIcon = styled.div`
|
|
@@ -49,3 +52,28 @@ export const StyledText = styled.div`
|
|
|
49
52
|
overflow: hidden;
|
|
50
53
|
text-overflow: ellipsis;
|
|
51
54
|
`;
|
|
55
|
+
|
|
56
|
+
export const StyledTopRow = styled.div<{
|
|
57
|
+
inverted: boolean;
|
|
58
|
+
}>`
|
|
59
|
+
height: ${sizes.sm};
|
|
60
|
+
display: flex;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
align-items: center;
|
|
63
|
+
flex-direction: ${({ inverted }) => (inverted ? 'row-reverse' : 'row')};
|
|
64
|
+
width: 100%;
|
|
65
|
+
position: relative;
|
|
66
|
+
gap: ${space.sm};
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const StyledDescription = styled.div`
|
|
70
|
+
font-size: ${fontSizes.sm};
|
|
71
|
+
font-weight: ${fontWeights.normal};
|
|
72
|
+
color: ${colors.textSecondary};
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
export const CollapsibleContent = styled.div<{ isCollapsed: boolean }>`
|
|
76
|
+
max-height: ${({ isCollapsed }) => (isCollapsed ? 'auto' : '0')};
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
transition: max-height 0.5s ease;
|
|
79
|
+
`;
|
|
@@ -2,32 +2,43 @@ import * as React from 'react';
|
|
|
2
2
|
import theme from '@clad-ui/theme';
|
|
3
3
|
import Checkbox from '../Checkbox/Checkbox';
|
|
4
4
|
import RadioButton from '../RadioButton/RadioButton';
|
|
5
|
+
import ChevronDown from '../../icons/ChevronDown';
|
|
5
6
|
import ChevronRight from '../../icons/ChevronRight';
|
|
6
|
-
import
|
|
7
|
+
import ChevronUp from '../../icons/ChevronUp';
|
|
7
8
|
import noop from '../../utils/noop';
|
|
8
|
-
import {
|
|
9
|
-
|
|
9
|
+
import {
|
|
10
|
+
styledRowCss,
|
|
11
|
+
StyledIcon,
|
|
12
|
+
StyledText,
|
|
13
|
+
StyledRow,
|
|
14
|
+
StyledTopRow,
|
|
15
|
+
StyledDescription,
|
|
16
|
+
CollapsibleContent,
|
|
17
|
+
} from './RowItem.styles';
|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
export interface RowItemOnChangeEvent {
|
|
20
|
+
value: string;
|
|
21
|
+
checked: boolean;
|
|
22
|
+
}
|
|
13
23
|
|
|
14
|
-
export
|
|
24
|
+
export interface RowItemProps {
|
|
15
25
|
/**
|
|
16
26
|
* Name of the checkbox/radio option.
|
|
17
27
|
*/
|
|
18
28
|
name?: string;
|
|
29
|
+
|
|
19
30
|
/**
|
|
20
31
|
* Row Height.
|
|
21
32
|
*/
|
|
22
|
-
size?: 'lg' | 'md';
|
|
33
|
+
size?: 'sm' | 'lg' | 'md';
|
|
23
34
|
/**
|
|
24
35
|
* Custom Icon for row can be ShapeIcon or SVG Icon
|
|
25
36
|
*/
|
|
26
|
-
icon?:
|
|
37
|
+
icon?: React.ReactNode;
|
|
27
38
|
/**
|
|
28
39
|
* Type of row.
|
|
29
40
|
*/
|
|
30
|
-
type?: 'checkbox' | '
|
|
41
|
+
type?: 'list' | 'radio' | 'checkbox' | 'chevron' | 'accordion';
|
|
31
42
|
/**
|
|
32
43
|
* Type of border.
|
|
33
44
|
*/
|
|
@@ -36,14 +47,18 @@ export type RowItemProps = {
|
|
|
36
47
|
* Content inside.
|
|
37
48
|
*/
|
|
38
49
|
children?: React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* description
|
|
52
|
+
*/
|
|
53
|
+
description?: string;
|
|
39
54
|
/**
|
|
40
55
|
* Callback when user click / tap on the row with Menu Item configuration.
|
|
41
56
|
*/
|
|
42
|
-
onClick?:
|
|
57
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
43
58
|
/**
|
|
44
59
|
* Callback when user change checkbox/radio status return the checked value.
|
|
45
60
|
*/
|
|
46
|
-
onChange?:
|
|
61
|
+
onChange?: (e: RowItemOnChangeEvent) => void;
|
|
47
62
|
/**
|
|
48
63
|
* The Checkbox/Radio value required to manually manipulate checkbox/radio checked status.
|
|
49
64
|
* Empty for Menu Item Row.
|
|
@@ -58,7 +73,19 @@ export type RowItemProps = {
|
|
|
58
73
|
* Empty for Menu Item Row.
|
|
59
74
|
*/
|
|
60
75
|
value?: string;
|
|
61
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Indicates whether the collapsible section is currently collapsed.
|
|
78
|
+
*/
|
|
79
|
+
isCollapsed?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Callback function invoked when the collapse state changes.
|
|
82
|
+
*/
|
|
83
|
+
onCollapseChange?: (isCollapsed: boolean) => void;
|
|
84
|
+
/**
|
|
85
|
+
* The content to be displayed when the collapsible section is expanded.
|
|
86
|
+
*/
|
|
87
|
+
collapsibleContent?: React.ReactNode;
|
|
88
|
+
}
|
|
62
89
|
|
|
63
90
|
const { colors } = theme;
|
|
64
91
|
/**
|
|
@@ -72,16 +99,19 @@ const RowItem: React.FC<RowItemProps> = ({
|
|
|
72
99
|
size = 'md',
|
|
73
100
|
icon,
|
|
74
101
|
border = 'none',
|
|
75
|
-
type = '
|
|
102
|
+
type = 'list',
|
|
76
103
|
inverted = false,
|
|
77
104
|
onClick = noop,
|
|
78
105
|
onChange = noop,
|
|
79
106
|
value,
|
|
80
107
|
checked = false,
|
|
81
108
|
children = 'Default Row',
|
|
109
|
+
description = '',
|
|
110
|
+
collapsibleContent,
|
|
111
|
+
isCollapsed = false,
|
|
112
|
+
onCollapseChange = null,
|
|
82
113
|
}) => {
|
|
83
114
|
const { useEffect, useState } = React;
|
|
84
|
-
|
|
85
115
|
const rowBorder = ((borderType) => {
|
|
86
116
|
let tempBorder = {
|
|
87
117
|
top: '',
|
|
@@ -119,28 +149,38 @@ const RowItem: React.FC<RowItemProps> = ({
|
|
|
119
149
|
}, [checked]);
|
|
120
150
|
|
|
121
151
|
const getSizing = (_size, _type) => {
|
|
122
|
-
const haveIcon = _type === '
|
|
152
|
+
const haveIcon = _type === 'list' ? true : false;
|
|
123
153
|
switch (_size) {
|
|
124
154
|
case 'lg':
|
|
125
155
|
return haveIcon
|
|
126
156
|
? {
|
|
127
|
-
height: '
|
|
157
|
+
height: '48px',
|
|
128
158
|
padding: '12px 16px 12px 16px',
|
|
129
159
|
}
|
|
130
160
|
: {
|
|
131
|
-
height: '
|
|
132
|
-
padding: '
|
|
161
|
+
height: '48px',
|
|
162
|
+
padding: '12px 16px 12px 16px',
|
|
133
163
|
};
|
|
134
164
|
case 'md':
|
|
135
|
-
default:
|
|
136
165
|
return haveIcon
|
|
137
166
|
? {
|
|
138
|
-
height: '
|
|
167
|
+
height: '40px',
|
|
139
168
|
padding: '8px 16px 8px 16px',
|
|
140
169
|
}
|
|
141
170
|
: {
|
|
142
|
-
height: '
|
|
143
|
-
padding: '
|
|
171
|
+
height: '40px',
|
|
172
|
+
padding: '8px 16px 8px 16px',
|
|
173
|
+
};
|
|
174
|
+
case 'sm':
|
|
175
|
+
default:
|
|
176
|
+
return haveIcon
|
|
177
|
+
? {
|
|
178
|
+
height: '32px',
|
|
179
|
+
padding: '4px 16px 4px 16px',
|
|
180
|
+
}
|
|
181
|
+
: {
|
|
182
|
+
height: '32px',
|
|
183
|
+
padding: '4px 16px 4px 16px',
|
|
144
184
|
};
|
|
145
185
|
}
|
|
146
186
|
};
|
|
@@ -149,36 +189,60 @@ const RowItem: React.FC<RowItemProps> = ({
|
|
|
149
189
|
const onRowPrivateClick = (e) => {
|
|
150
190
|
if (!e.target.value) {
|
|
151
191
|
onChange({
|
|
152
|
-
value,
|
|
192
|
+
value: value as string,
|
|
153
193
|
checked: !defaultChecked,
|
|
154
194
|
});
|
|
155
195
|
}
|
|
156
196
|
};
|
|
157
197
|
|
|
198
|
+
const handleClickRowItem = (e) => {
|
|
199
|
+
if (type === 'list') {
|
|
200
|
+
onClick(e);
|
|
201
|
+
} else {
|
|
202
|
+
onRowPrivateClick(e);
|
|
203
|
+
}
|
|
204
|
+
if (onCollapseChange) {
|
|
205
|
+
const newValue = !isCollapsed;
|
|
206
|
+
if (onCollapseChange) {
|
|
207
|
+
onCollapseChange(newValue);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
158
212
|
return (
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
213
|
+
<React.Fragment>
|
|
214
|
+
<StyledRow
|
|
215
|
+
className={styledRowCss}
|
|
216
|
+
minHeight={getSizing(size, type).height}
|
|
217
|
+
padding={getSizing(size, type).padding}
|
|
218
|
+
border={rowBorder}
|
|
219
|
+
onClick={handleClickRowItem}
|
|
220
|
+
>
|
|
221
|
+
<StyledTopRow inverted={inverted}>
|
|
222
|
+
{!!icon && <StyledIcon> {icon}</StyledIcon>}
|
|
223
|
+
<StyledText>{children}</StyledText>
|
|
224
|
+
<StyledIcon>
|
|
225
|
+
{type === 'checkbox' && (
|
|
226
|
+
<Checkbox name={name} checked={defaultChecked} value={value} />
|
|
227
|
+
)}
|
|
228
|
+
{type === 'radio' && (
|
|
229
|
+
<RadioButton name={name} checked={defaultChecked} value={value} />
|
|
230
|
+
)}
|
|
231
|
+
{type === 'chevron' && <ChevronRight width={16} height={16} />}
|
|
232
|
+
{type === 'accordion' && !isCollapsed && <ChevronDown width={16} height={16} />}
|
|
233
|
+
{type === 'accordion' && !!isCollapsed && <ChevronUp width={16} height={16} />}
|
|
234
|
+
</StyledIcon>
|
|
235
|
+
</StyledTopRow>
|
|
236
|
+
{!!description && <StyledDescription>{description}</StyledDescription>}
|
|
237
|
+
</StyledRow>
|
|
238
|
+
{!!isCollapsed && !!collapsibleContent && (
|
|
239
|
+
<CollapsibleContent isCollapsed={isCollapsed}>{collapsibleContent}</CollapsibleContent>
|
|
240
|
+
)}
|
|
241
|
+
</React.Fragment>
|
|
176
242
|
);
|
|
177
243
|
};
|
|
178
244
|
|
|
179
245
|
return renderRowItem();
|
|
180
246
|
};
|
|
181
247
|
|
|
182
|
-
|
|
183
|
-
|
|
184
248
|
export default RowItem;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Storybook will pick up the JSDoc and prop type desription correctly.
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
|
+
import type { Colors, Radii, Sizes } from '@clad-ui/theme';
|
|
12
13
|
/**
|
|
13
14
|
* This component allows icons to have background and decorated shape
|
|
14
15
|
*
|
|
@@ -20,27 +21,33 @@ import * as React from 'react';
|
|
|
20
21
|
* <ShapeIcon radius="circle" bg="positive" color="white"><SvgHeart /><ShapeIcon>
|
|
21
22
|
* ```
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
declare const keyOfRadii: readonly string[];
|
|
25
|
-
declare const keyOfColors: readonly [...string[], "none"];
|
|
26
|
-
type Size = (typeof keyOfSizes)[number];
|
|
27
|
-
type Radius = (typeof keyOfRadii)[number];
|
|
28
|
-
type Color = (typeof keyOfColors)[number];
|
|
29
|
-
export type ShapeIconProps = {
|
|
24
|
+
export interface ShapeIconProps extends React.HTMLAttributes<HTMLElement> {
|
|
30
25
|
/** Element name or Component for the icon wrapper to be render as */
|
|
31
26
|
as?: React.ElementType;
|
|
32
27
|
/**
|
|
33
28
|
* Icon size
|
|
29
|
+
* @default "sm"
|
|
30
|
+
*/
|
|
31
|
+
size?: Sizes;
|
|
32
|
+
/**
|
|
33
|
+
* Border radius
|
|
34
|
+
* @default "circle"
|
|
35
|
+
*/
|
|
36
|
+
radius?: Radii;
|
|
37
|
+
/**
|
|
38
|
+
* Background color, "none" or a theme's color name
|
|
39
|
+
* @default "none"
|
|
40
|
+
*/
|
|
41
|
+
bg?: Colors | 'none';
|
|
42
|
+
/**
|
|
43
|
+
* Icon color, one of theme's color name
|
|
44
|
+
* @default "text"
|
|
45
|
+
*/
|
|
46
|
+
color?: Colors;
|
|
47
|
+
/**
|
|
48
|
+
* The SVG Icon component to be decorated
|
|
34
49
|
*/
|
|
35
|
-
size?: Size;
|
|
36
|
-
/** Border radius */
|
|
37
|
-
radius?: Radius;
|
|
38
|
-
/** Background color, "none" or a theme's color name */
|
|
39
|
-
bg?: Color;
|
|
40
|
-
/** Icon color, one of theme's color name */
|
|
41
|
-
color?: Color;
|
|
42
|
-
/** The SVG Icon component to be decorated */
|
|
43
50
|
children: React.ReactNode;
|
|
44
|
-
}
|
|
51
|
+
}
|
|
45
52
|
declare const ShapeIcon: React.FC<ShapeIconProps>;
|
|
46
53
|
export default ShapeIcon;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Colors, Radii, Sizes } from '@clad-ui/theme';
|
|
3
|
+
declare const shapeIconStories: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<import("./ShapeIcon").ShapeIconProps>;
|
|
6
|
+
tags: string[];
|
|
7
|
+
argTypes: {
|
|
8
|
+
as: {
|
|
9
|
+
options: string[];
|
|
10
|
+
control: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
bg: {
|
|
15
|
+
options: string[];
|
|
16
|
+
control: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
color: {
|
|
21
|
+
options: string[];
|
|
22
|
+
control: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
size: {
|
|
27
|
+
options: string[];
|
|
28
|
+
control: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
radius: {
|
|
33
|
+
options: string[];
|
|
34
|
+
control: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default shapeIconStories;
|
|
41
|
+
export declare const Overview: {
|
|
42
|
+
render: (args: any) => JSX.Element;
|
|
43
|
+
argTypes: {
|
|
44
|
+
children: {
|
|
45
|
+
options: string[];
|
|
46
|
+
control: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
args: {
|
|
52
|
+
children: string;
|
|
53
|
+
as: string;
|
|
54
|
+
color: string;
|
|
55
|
+
bg: string;
|
|
56
|
+
size: string;
|
|
57
|
+
radius: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare const CircleIcons: {
|
|
61
|
+
render: (args: {
|
|
62
|
+
as: React.ElementType;
|
|
63
|
+
bg: Colors;
|
|
64
|
+
color: Colors;
|
|
65
|
+
radius: Radii;
|
|
66
|
+
size: Sizes;
|
|
67
|
+
}) => JSX.Element[];
|
|
68
|
+
args: {
|
|
69
|
+
as: string;
|
|
70
|
+
bg: string;
|
|
71
|
+
color: string;
|
|
72
|
+
radius: string;
|
|
73
|
+
size: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export declare const RoundedIcons: {
|
|
77
|
+
render: (args: {
|
|
78
|
+
as: React.ElementType;
|
|
79
|
+
bg: Colors;
|
|
80
|
+
color: Colors;
|
|
81
|
+
radius: Radii;
|
|
82
|
+
size: Sizes;
|
|
83
|
+
}) => JSX.Element[];
|
|
84
|
+
args: {
|
|
85
|
+
as: string;
|
|
86
|
+
bg: string;
|
|
87
|
+
color: string;
|
|
88
|
+
radius: string;
|
|
89
|
+
size: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import theme from '@clad-ui/theme';
|
|
3
|
-
|
|
3
|
+
import type { Colors, Radii, Sizes } from '@clad-ui/theme';
|
|
4
4
|
import ShapeIcon from './ShapeIcon';
|
|
5
5
|
import * as iconComponents from '../../icons';
|
|
6
6
|
|
|
7
7
|
// get the list of monochrome icon names
|
|
8
8
|
const icons = Object.keys(iconComponents).filter(
|
|
9
|
-
(iconName) => iconComponents[iconName].type === '
|
|
9
|
+
(iconName) => !(iconComponents[iconName].type === 'color') && !iconName.includes('Filled')
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
const shapeIconStories = {
|
|
@@ -61,8 +61,9 @@ export const Overview = {
|
|
|
61
61
|
|
|
62
62
|
argTypes: {
|
|
63
63
|
children: {
|
|
64
|
+
options: icons,
|
|
64
65
|
control: {
|
|
65
|
-
|
|
66
|
+
type: 'select',
|
|
66
67
|
},
|
|
67
68
|
},
|
|
68
69
|
},
|
|
@@ -77,17 +78,29 @@ export const Overview = {
|
|
|
77
78
|
},
|
|
78
79
|
};
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
const AllIconTemplate = (args: {
|
|
82
|
+
as: React.ElementType;
|
|
83
|
+
bg: Colors;
|
|
84
|
+
color: Colors;
|
|
85
|
+
radius: Radii;
|
|
86
|
+
size: Sizes;
|
|
87
|
+
}) =>
|
|
88
|
+
icons.map((iconName) => {
|
|
83
89
|
const Icon = iconComponents[iconName];
|
|
84
90
|
return (
|
|
85
|
-
<ShapeIcon
|
|
91
|
+
<ShapeIcon
|
|
92
|
+
key={iconName}
|
|
93
|
+
style={{ margin: '0.25em' }}
|
|
94
|
+
as={args.as}
|
|
95
|
+
bg={args.bg}
|
|
96
|
+
color={args.color}
|
|
97
|
+
radius={args.radius}
|
|
98
|
+
size={args.size}
|
|
99
|
+
>
|
|
86
100
|
<Icon />
|
|
87
101
|
</ShapeIcon>
|
|
88
102
|
);
|
|
89
103
|
});
|
|
90
|
-
};
|
|
91
104
|
|
|
92
105
|
export const CircleIcons = {
|
|
93
106
|
render: AllIconTemplate,
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
* - font-size to control icon's size
|
|
4
4
|
* - color to control icon's color
|
|
5
5
|
* - StyledComponent has an `as` prop which allows changing the HTML element later so span here is just for generic inline component
|
|
6
|
-
*
|
|
7
|
-
* @type {React.FC<any>}
|
|
8
6
|
*/
|
|
9
|
-
export const StyledComponent:
|
|
7
|
+
export declare const StyledComponent: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
8
|
+
size: string;
|
|
9
|
+
color: string;
|
|
10
|
+
bg: string;
|
|
11
|
+
radius: string;
|
|
12
|
+
} & {
|
|
13
|
+
as?: import("react").ElementType;
|
|
14
|
+
}>;
|
|
@@ -8,10 +8,13 @@ const { sizes, colors, radii } = theme;
|
|
|
8
8
|
* - font-size to control icon's size
|
|
9
9
|
* - color to control icon's color
|
|
10
10
|
* - StyledComponent has an `as` prop which allows changing the HTML element later so span here is just for generic inline component
|
|
11
|
-
*
|
|
12
|
-
* @type {React.FC<any>}
|
|
13
11
|
*/
|
|
14
|
-
export const StyledComponent = styled.span
|
|
12
|
+
export const StyledComponent = styled.span<{
|
|
13
|
+
size: string;
|
|
14
|
+
color: string;
|
|
15
|
+
bg: string;
|
|
16
|
+
radius: string;
|
|
17
|
+
}>`
|
|
15
18
|
display: inline-flex;
|
|
16
19
|
align-items: center;
|
|
17
20
|
justify-content: center;
|