@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import theme from '@clad-ui/theme';
|
|
2
2
|
import { css } from '@linaria/core';
|
|
3
|
-
const { colors, radii, fontSizes, typo, space } = theme;
|
|
3
|
+
const { colors, radii, fontSizes, typo, sizes, space } = theme;
|
|
4
4
|
const buttonClass = css `
|
|
5
5
|
/* Standard highlight for manual testing & verification */
|
|
6
6
|
outline: 1px solid var(--cladebug);
|
|
@@ -45,10 +45,11 @@ const buttonClass = css `
|
|
|
45
45
|
|
|
46
46
|
/* Sizes */
|
|
47
47
|
&.small {
|
|
48
|
-
|
|
49
|
-
${typo.label.caption}
|
|
50
|
-
padding: ${space.xxxs} ${space.xs};
|
|
48
|
+
padding: ${space.none} ${space.xs};
|
|
51
49
|
border-radius: 6px;
|
|
50
|
+
height: ${sizes.sm};
|
|
51
|
+
|
|
52
|
+
${typo.label.caption}
|
|
52
53
|
|
|
53
54
|
&.icon {
|
|
54
55
|
padding: 3px;
|
|
@@ -61,11 +62,12 @@ const buttonClass = css `
|
|
|
61
62
|
|
|
62
63
|
&,
|
|
63
64
|
&.medium {
|
|
64
|
-
|
|
65
|
-
${
|
|
66
|
-
padding: ${space.xxs} ${space.sm};
|
|
65
|
+
height: ${sizes.lg};
|
|
66
|
+
padding: ${space.none} ${space.sm};
|
|
67
67
|
border-radius: ${radii.md};
|
|
68
68
|
|
|
69
|
+
${typo.label.section}
|
|
70
|
+
|
|
69
71
|
&.icon {
|
|
70
72
|
padding: 5px;
|
|
71
73
|
}
|
|
@@ -76,11 +78,12 @@ const buttonClass = css `
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
&.large {
|
|
79
|
-
|
|
80
|
-
${
|
|
81
|
-
padding: ${space.xs} ${space.md}; /* minus borders */
|
|
81
|
+
height: ${sizes.lxl};
|
|
82
|
+
padding: ${space.none} ${space.md}; /* minus borders 7px - 1px and space.md - 1px */
|
|
82
83
|
border-radius: ${radii.md};
|
|
83
|
-
|
|
84
|
+
|
|
85
|
+
${typo.label.page}
|
|
86
|
+
|
|
84
87
|
&.icon {
|
|
85
88
|
padding: 7px; /* minus border */
|
|
86
89
|
}
|
|
@@ -90,6 +93,22 @@ const buttonClass = css `
|
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
95
|
|
|
96
|
+
&.xlarge {
|
|
97
|
+
height: ${sizes.xl};
|
|
98
|
+
padding: ${space.none} ${space.md}; /* minus borders 7px - 1px and space.md - 1px */
|
|
99
|
+
border-radius: ${radii.md};
|
|
100
|
+
|
|
101
|
+
${typo.label.page}
|
|
102
|
+
|
|
103
|
+
&.icon {
|
|
104
|
+
padding: 11px; /* minus border */
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
& > svg {
|
|
108
|
+
font-size: ${fontSizes.xxl};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
93
112
|
/* SOLID */
|
|
94
113
|
&,
|
|
95
114
|
&.primary {
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface GhostButtonProps extends
|
|
3
|
-
/** null
|
|
4
|
-
* The href attribute specifies the link's destination
|
|
5
|
-
*/
|
|
6
|
-
href?: string;
|
|
7
|
-
/**
|
|
8
|
-
* The target attribute specifies where to open the linked document
|
|
9
|
-
*/
|
|
10
|
-
target?: string;
|
|
1
|
+
import { type HTMLCladUIProps, type ReactRef } from '../../utils/types';
|
|
2
|
+
export interface GhostButtonProps extends HTMLCladUIProps<'a'> {
|
|
11
3
|
/**
|
|
12
4
|
* Different looks of button
|
|
13
5
|
*/
|
|
@@ -27,7 +19,7 @@ export interface GhostButtonProps extends React.AnchorHTMLAttributes<HTMLAnchorE
|
|
|
27
19
|
/**
|
|
28
20
|
* Button's size
|
|
29
21
|
*/
|
|
30
|
-
size?: 'large' | 'medium' | 'small';
|
|
22
|
+
size?: 'xlarge' | 'large' | 'medium' | 'small';
|
|
31
23
|
/**
|
|
32
24
|
* Whether this button is disabled. No events triggered.
|
|
33
25
|
*/
|
|
@@ -36,32 +28,20 @@ export interface GhostButtonProps extends React.AnchorHTMLAttributes<HTMLAnchorE
|
|
|
36
28
|
* Whether this button stretch to fill up container's width
|
|
37
29
|
*/
|
|
38
30
|
stretch?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Element or component to be rendered as
|
|
41
|
-
*/
|
|
42
|
-
as?: React.ElementType;
|
|
43
|
-
/**
|
|
44
|
-
* Children
|
|
45
|
-
*/
|
|
46
|
-
children?: React.ReactNode;
|
|
47
|
-
/**
|
|
48
|
-
* Click event
|
|
49
|
-
*/
|
|
50
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
51
31
|
/**
|
|
52
32
|
* Additional classes to be added for customization
|
|
53
33
|
*/
|
|
54
34
|
className?: string;
|
|
55
35
|
/**
|
|
56
|
-
* Ref
|
|
36
|
+
* Ref to the DOM node.
|
|
57
37
|
*/
|
|
58
|
-
ref?:
|
|
38
|
+
ref?: ReactRef<HTMLAnchorElement | null>;
|
|
59
39
|
}
|
|
60
40
|
/**
|
|
61
41
|
* Renders a standard button element.
|
|
62
42
|
*
|
|
63
43
|
* `✅ Stable`
|
|
64
44
|
*/
|
|
65
|
-
export declare const Button:
|
|
45
|
+
export declare const Button: import("../../utils/types").InternalForwardRefRenderFunction<"a", GhostButtonProps>;
|
|
66
46
|
export default Button;
|
|
67
47
|
//# sourceMappingURL=GhostButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GhostButton.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GhostButton.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEpF,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC,GAAG,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IACtD;;OAEG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AAEH,eAAO,MAAM,MAAM,qFAsCjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { cx } from '../../utils';
|
|
3
3
|
import buttonClass from './GhostButton.styles';
|
|
4
|
+
import { forwardRef } from '../../utils/types';
|
|
4
5
|
/**
|
|
5
6
|
* Renders a standard button element.
|
|
6
7
|
*
|
|
7
8
|
* `✅ Stable`
|
|
8
9
|
*/
|
|
9
10
|
// Why have 'export' here? https://github.com/storybookjs/storybook/issues/9511
|
|
10
|
-
export const Button =
|
|
11
|
+
export const Button = forwardRef((props, ref) => {
|
|
12
|
+
const { as = 'a', children, disabled = false, className, onClick, radius = 'normal', size = 'medium', stretch = false, variant = 'button', weight = 'bold', color = 'link', ...rest } = props;
|
|
11
13
|
const extraClasses = cx(buttonClass, variant === 'button' ? color : 'hyperlink h-' + color, `r-${radius}`, size, `w-${weight}`, `t-${color}`, stretch && 'stretch', disabled && 'disabled', className);
|
|
12
14
|
const attrs = {
|
|
13
15
|
ref,
|
|
14
16
|
className: extraClasses,
|
|
15
|
-
href,
|
|
16
|
-
target,
|
|
17
17
|
disabled: disabled && true,
|
|
18
18
|
onClick: !disabled && onClick ? onClick : undefined,
|
|
19
19
|
'data-clad': 'Ghost Button',
|
|
20
|
-
...
|
|
20
|
+
...rest,
|
|
21
21
|
};
|
|
22
22
|
return React.createElement(as, attrs, children);
|
|
23
23
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
declare const ghostButtonStories: {
|
|
3
2
|
title: string;
|
|
4
|
-
component:
|
|
3
|
+
component: import("../../utils/types").InternalForwardRefRenderFunction<"a", import("./GhostButton").GhostButtonProps>;
|
|
5
4
|
tags: string[];
|
|
6
5
|
parameters: {
|
|
7
6
|
docs: {
|
|
@@ -11,10 +10,88 @@ declare const ghostButtonStories: {
|
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
12
|
argTypes: {
|
|
13
|
+
variant: {
|
|
14
|
+
control: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
options: string[];
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
color: {
|
|
21
|
+
control: {
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
options: string[];
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
radius: {
|
|
28
|
+
control: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
options: string[];
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
weight: {
|
|
35
|
+
control: {
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
38
|
+
options: string[];
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
size: {
|
|
42
|
+
control: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
options: string[];
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
disabled: {
|
|
49
|
+
control: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
stretch: {
|
|
55
|
+
control: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
className: {
|
|
61
|
+
control: {
|
|
62
|
+
type: string;
|
|
63
|
+
};
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
14
66
|
children: {
|
|
15
67
|
control: {
|
|
16
68
|
type: string;
|
|
17
69
|
};
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
as: {
|
|
73
|
+
control: {
|
|
74
|
+
type: string;
|
|
75
|
+
};
|
|
76
|
+
options: string[];
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
79
|
+
href: {
|
|
80
|
+
control: {
|
|
81
|
+
type: string;
|
|
82
|
+
};
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
target: {
|
|
86
|
+
control: {
|
|
87
|
+
type: string;
|
|
88
|
+
};
|
|
89
|
+
options: string[];
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
onClick: {
|
|
93
|
+
action: string;
|
|
94
|
+
description: string;
|
|
18
95
|
};
|
|
19
96
|
};
|
|
20
97
|
};
|
|
@@ -27,5 +104,6 @@ export declare const Overview: {
|
|
|
27
104
|
};
|
|
28
105
|
export declare const ButtonVariant: () => JSX.Element;
|
|
29
106
|
export declare const HyperlinkVariant: () => JSX.Element;
|
|
107
|
+
export declare const ButtonWithNextLink: () => JSX.Element;
|
|
30
108
|
export declare const Disabled: () => JSX.Element;
|
|
31
109
|
//# sourceMappingURL=GhostButton.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GhostButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GhostButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.stories.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EvB,CAAC;AACF,eAAe,kBAAkB,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,mBA8BzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,mBAmC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBAuC9B,CAAC;AAEF,eAAO,MAAM,QAAQ,mBASpB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import GhostButton from './GhostButton';
|
|
3
|
+
import { BUTTON_RADII, BUTTON_SIZES, BUTTON_WEIGHTS, GHOST_BUTTON_VARIANTS, GHOST_BUTTON_COLORS, } from './constant';
|
|
3
4
|
const ghostButtonStories = {
|
|
4
5
|
title: 'Components/Buttons/Ghost Button (Button Link)',
|
|
5
6
|
component: GhostButton,
|
|
@@ -10,16 +11,70 @@ const ghostButtonStories = {
|
|
|
10
11
|
component: `Hypelinks (anchor tags) that appear like buttons. It has the same props list as [Button component](../?path=/docs/components-buttons-button--overview)
|
|
11
12
|
except the \`as\` prop is always \`a\`.
|
|
12
13
|
|
|
13
|
-
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/
|
|
14
|
+
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=41-12614&t=hz8QJLqNrGvTVY8R-4)
|
|
14
15
|
`,
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
argTypes: {
|
|
20
|
+
variant: {
|
|
21
|
+
control: { type: 'select' },
|
|
22
|
+
options: GHOST_BUTTON_VARIANTS,
|
|
23
|
+
description: 'Different looks of button',
|
|
24
|
+
},
|
|
25
|
+
color: {
|
|
26
|
+
control: { type: 'select' },
|
|
27
|
+
options: GHOST_BUTTON_COLORS,
|
|
28
|
+
description: 'Text color',
|
|
29
|
+
},
|
|
30
|
+
radius: {
|
|
31
|
+
control: { type: 'select' },
|
|
32
|
+
options: BUTTON_RADII,
|
|
33
|
+
description: 'Border radius',
|
|
34
|
+
},
|
|
35
|
+
weight: {
|
|
36
|
+
control: { type: 'select' },
|
|
37
|
+
options: BUTTON_WEIGHTS,
|
|
38
|
+
description: 'Font weight of label',
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
control: { type: 'select' },
|
|
42
|
+
options: BUTTON_SIZES,
|
|
43
|
+
description: "Button's size",
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
control: { type: 'boolean' },
|
|
47
|
+
description: 'Whether this button is disabled. No events triggered.',
|
|
48
|
+
},
|
|
49
|
+
stretch: {
|
|
50
|
+
control: { type: 'boolean' },
|
|
51
|
+
description: "Whether this button stretch to fill up container's width",
|
|
52
|
+
},
|
|
53
|
+
className: {
|
|
54
|
+
control: { type: 'text' },
|
|
55
|
+
description: 'Additional classes to be added for customization',
|
|
56
|
+
},
|
|
19
57
|
children: {
|
|
20
|
-
control: {
|
|
21
|
-
|
|
22
|
-
|
|
58
|
+
control: { type: 'text' },
|
|
59
|
+
description: 'Button content/label',
|
|
60
|
+
},
|
|
61
|
+
as: {
|
|
62
|
+
control: { type: 'select' },
|
|
63
|
+
options: ['button', 'a'],
|
|
64
|
+
description: 'HTML element or component to render as',
|
|
65
|
+
},
|
|
66
|
+
href: {
|
|
67
|
+
control: { type: 'text' },
|
|
68
|
+
description: 'URL for the link',
|
|
69
|
+
},
|
|
70
|
+
target: {
|
|
71
|
+
control: { type: 'select' },
|
|
72
|
+
options: ['_blank', '_self', '_parent', '_top'],
|
|
73
|
+
description: 'Where to open the linked document',
|
|
74
|
+
},
|
|
75
|
+
onClick: {
|
|
76
|
+
action: 'clicked',
|
|
77
|
+
description: 'Click event handler',
|
|
23
78
|
},
|
|
24
79
|
},
|
|
25
80
|
};
|
|
@@ -28,7 +83,7 @@ export const Overview = {
|
|
|
28
83
|
render: (args) => <GhostButton href="#" {...args}/>,
|
|
29
84
|
args: { children: 'This is a button link' },
|
|
30
85
|
};
|
|
31
|
-
export const ButtonVariant = (
|
|
86
|
+
export const ButtonVariant = () => (<div>
|
|
32
87
|
<GhostButton href="https://clad-ui.chotot.org/" target="_blank" variant="button" color="link">
|
|
33
88
|
Button Variant
|
|
34
89
|
</GhostButton>
|
|
@@ -42,7 +97,7 @@ export const ButtonVariant = ( /* args */) => (<div>
|
|
|
42
97
|
Button Variant
|
|
43
98
|
</GhostButton>
|
|
44
99
|
</div>);
|
|
45
|
-
export const HyperlinkVariant = (
|
|
100
|
+
export const HyperlinkVariant = () => (<div>
|
|
46
101
|
<GhostButton href="https://clad-ui.chotot.org/" target="_blank" variant="hyperlink" color="link">
|
|
47
102
|
Hyperlink Variant
|
|
48
103
|
</GhostButton>
|
|
@@ -56,7 +111,25 @@ export const HyperlinkVariant = ( /* args */) => (<div>
|
|
|
56
111
|
Hyperlink Variant
|
|
57
112
|
</GhostButton>
|
|
58
113
|
</div>);
|
|
59
|
-
export const
|
|
114
|
+
export const ButtonWithNextLink = () => {
|
|
115
|
+
// replace "a" with NextLink
|
|
116
|
+
const NextLink = 'a';
|
|
117
|
+
return (<div>
|
|
118
|
+
<GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-1" variant="button" color="link">
|
|
119
|
+
Click me 1
|
|
120
|
+
</GhostButton>
|
|
121
|
+
<GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-2" variant="button" color="primary">
|
|
122
|
+
Click me 2
|
|
123
|
+
</GhostButton>
|
|
124
|
+
<GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-3" variant="button" color="secondary">
|
|
125
|
+
Click me 3
|
|
126
|
+
</GhostButton>
|
|
127
|
+
<GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-4" variant="button" color="tertiary">
|
|
128
|
+
Click me 4
|
|
129
|
+
</GhostButton>
|
|
130
|
+
</div>);
|
|
131
|
+
};
|
|
132
|
+
export const Disabled = () => (<div>
|
|
60
133
|
<GhostButton variant="button" href="https://clad-ui.chotot.org/" target="_blank" disabled>
|
|
61
134
|
Disabled Button Variant
|
|
62
135
|
</GhostButton>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GhostButton.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"GhostButton.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CAyLhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import theme from '@clad-ui/theme';
|
|
2
2
|
import { css } from '@linaria/core';
|
|
3
|
-
const { colors, radii, fontSizes, fontWeights, typo } = theme;
|
|
3
|
+
const { colors, radii, fontSizes, fontWeights, typo, sizes, space } = theme;
|
|
4
4
|
const buttonClass = css `
|
|
5
5
|
/* Standard highlight for manual testing & verification */
|
|
6
6
|
outline: 1px solid var(--cladebug);
|
|
@@ -151,6 +151,22 @@ const buttonClass = css `
|
|
|
151
151
|
padding: 9px; /* minus borders */
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
&.xlarge {
|
|
155
|
+
height: ${sizes.xl};
|
|
156
|
+
padding: ${space.none} ${space.md}; /* minus borders 7px - 1px and space.md - 1px */
|
|
157
|
+
border-radius: ${radii.md};
|
|
158
|
+
|
|
159
|
+
${typo.label.page}
|
|
160
|
+
|
|
161
|
+
&.icon {
|
|
162
|
+
padding: 11px; /* minus border */
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
& > svg {
|
|
166
|
+
font-size: ${fontSizes.xxl};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
154
170
|
/* Border radius */
|
|
155
171
|
&.r-normal {
|
|
156
172
|
border-radius: ${radii.sm};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { type ButtonProps } from './Button';
|
|
3
2
|
export interface IconButtonProps extends Omit<ButtonProps, 'stretch' | 'icon'> {
|
|
4
3
|
}
|
|
@@ -7,6 +6,6 @@ export interface IconButtonProps extends Omit<ButtonProps, 'stretch' | 'icon'> {
|
|
|
7
6
|
*
|
|
8
7
|
* `✅ Stable`
|
|
9
8
|
*/
|
|
10
|
-
declare const IconButton:
|
|
9
|
+
declare const IconButton: import("../../utils/types").InternalForwardRefRenderFunction<"button", IconButtonProps>;
|
|
11
10
|
export default IconButton;
|
|
12
11
|
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;CAAG;AAEjF;;;;GAIG;AAEH,QAAA,MAAM,UAAU,yFAEd,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Button from './Button';
|
|
3
|
+
import { forwardRef } from '../../utils/types';
|
|
3
4
|
/**
|
|
4
5
|
* Icons as interactive buttons / links. It has the same props list as [Button component](/docs/components-shapeicon--docs)
|
|
5
6
|
*
|
|
6
7
|
* `✅ Stable`
|
|
7
8
|
*/
|
|
8
|
-
const IconButton =
|
|
9
|
-
const props = { color, variant, radius, size, children, disabled, extraClasses, onClick };
|
|
10
|
-
if (as !== 'a' && as !== 'button') {
|
|
11
|
-
throw new Error(`IconButton must be rendered as <a> or <button>. It is currently rendered as ${as}`);
|
|
12
|
-
}
|
|
13
|
-
return <Button icon as={as} {...props} data-clad="Icon Button" ref={ref}/>;
|
|
14
|
-
});
|
|
9
|
+
const IconButton = forwardRef((props, ref) => (<Button icon ref={ref} data-clad="Icon Button" {...props}/>));
|
|
15
10
|
export default IconButton;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
declare const iconButtonStories: {
|
|
3
2
|
title: string;
|
|
4
|
-
component:
|
|
3
|
+
component: import("../../utils/types").InternalForwardRefRenderFunction<"button", import("./IconButton").IconButtonProps>;
|
|
5
4
|
tags: string[];
|
|
6
5
|
parameters: {
|
|
7
6
|
docs: {
|
|
@@ -11,11 +10,83 @@ declare const iconButtonStories: {
|
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
12
|
argTypes: {
|
|
14
|
-
|
|
13
|
+
variant: {
|
|
14
|
+
control: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
options: import("./Button").ButtonVariant[];
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
color: {
|
|
21
|
+
control: {
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
options: import("./Button").ButtonColor[];
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
radius: {
|
|
28
|
+
control: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
15
31
|
options: string[];
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
weight: {
|
|
16
35
|
control: {
|
|
17
36
|
type: string;
|
|
18
37
|
};
|
|
38
|
+
options: string[];
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
size: {
|
|
42
|
+
control: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
options: string[];
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
width: {
|
|
49
|
+
control: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
options: string[];
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
disabled: {
|
|
56
|
+
control: {
|
|
57
|
+
type: string;
|
|
58
|
+
};
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
extraClasses: {
|
|
62
|
+
control: {
|
|
63
|
+
type: string;
|
|
64
|
+
};
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
isLoading: {
|
|
68
|
+
control: {
|
|
69
|
+
type: string;
|
|
70
|
+
};
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
children: {
|
|
74
|
+
control: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
options: string[];
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
as: {
|
|
81
|
+
control: {
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
options: string[];
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
onClick: {
|
|
88
|
+
action: string;
|
|
89
|
+
description: string;
|
|
19
90
|
};
|
|
20
91
|
};
|
|
21
92
|
};
|
|
@@ -58,4 +129,5 @@ export declare const ExtraClasses: {
|
|
|
58
129
|
};
|
|
59
130
|
};
|
|
60
131
|
};
|
|
132
|
+
export declare const ButtonWithNextLink: () => JSX.Element;
|
|
61
133
|
//# sourceMappingURL=IconButton.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.stories.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CA0BpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAwBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAgCxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBA2C9B,CAAC"}
|