@cocso-ui/react 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/accordion/Accordion.d.ts +15 -0
- package/dist/cjs/accordion/Accordion.js +71 -0
- package/dist/cjs/accordion/Accordion.module.css.js +9 -0
- package/dist/cjs/button/Button.d.ts +23 -0
- package/dist/cjs/button/Button.js +115 -0
- package/dist/cjs/button/Button.module.css.js +9 -0
- package/dist/cjs/checkbox/Checkbox.d.ts +18 -0
- package/dist/cjs/checkbox/Checkbox.js +115 -0
- package/dist/cjs/checkbox/Checkbox.module.css.js +9 -0
- package/dist/cjs/dropdown/Dropdown.d.ts +11 -0
- package/dist/cjs/dropdown/Dropdown.js +55 -0
- package/dist/cjs/dropdown/Dropdown.module.css.js +9 -0
- package/dist/cjs/index.d.ts +19 -0
- package/dist/cjs/index.js +53 -0
- package/dist/cjs/link/Link.d.ts +16 -0
- package/dist/cjs/link/Link.js +35 -0
- package/dist/cjs/link/Link.module.css.js +9 -0
- package/dist/cjs/modal/Modal.d.ts +12 -0
- package/dist/cjs/modal/Modal.js +103 -0
- package/dist/cjs/modal/Modal.module.css.js +9 -0
- package/dist/cjs/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +28 -0
- package/dist/cjs/one-time-password-field/OneTimePasswordField.d.ts +8 -0
- package/dist/cjs/one-time-password-field/OneTimePasswordField.js +52 -0
- package/dist/cjs/one-time-password-field/OneTimePasswordField.module.css.js +9 -0
- package/dist/cjs/pagination/Pagination.d.ts +13 -0
- package/dist/cjs/pagination/Pagination.js +83 -0
- package/dist/cjs/pagination/Pagination.module.css.js +9 -0
- package/dist/cjs/popover/Popover.d.ts +10 -0
- package/dist/cjs/popover/Popover.js +44 -0
- package/dist/cjs/popover/Popover.module.css.js +9 -0
- package/dist/cjs/select/Select.d.ts +12 -0
- package/dist/cjs/select/Select.js +84 -0
- package/dist/cjs/select/Select.module.css.js +9 -0
- package/dist/cjs/spinner/Spinner.d.ts +14 -0
- package/dist/cjs/spinner/Spinner.js +40 -0
- package/dist/cjs/spinner/Spinner.module.css.js +9 -0
- package/dist/cjs/stock-quantity-status/StockQuantityStatus.d.ts +12 -0
- package/dist/cjs/stock-quantity-status/StockQuantityStatus.js +105 -0
- package/dist/cjs/stock-quantity-status/StockQuantityStatus.module.css.js +9 -0
- package/dist/cjs/switch/Switch.d.ts +16 -0
- package/dist/cjs/switch/Switch.js +89 -0
- package/dist/cjs/switch/Switch.module.css.js +9 -0
- package/dist/cjs/tab/Tab.d.ts +10 -0
- package/dist/cjs/tab/Tab.js +64 -0
- package/dist/{token → cjs/token}/color.d.ts +3 -1
- package/dist/cjs/token/color.js +84 -0
- package/dist/{token → cjs/token}/spacing.d.ts +3 -1
- package/dist/cjs/token/spacing.js +29 -0
- package/dist/{token → cjs/token}/typography.d.ts +10 -7
- package/dist/cjs/token/typography.js +50 -0
- package/dist/cjs/typography/Typography.d.ts +33 -0
- package/dist/cjs/typography/Typography.js +90 -0
- package/dist/cjs/typography/Typography.module.css.js +9 -0
- package/dist/esm/accordion/Accordion.d.mts +15 -0
- package/dist/esm/accordion/Accordion.mjs +50 -0
- package/dist/esm/accordion/Accordion.module.css.mjs +3 -0
- package/dist/esm/button/Button.d.mts +23 -0
- package/dist/esm/button/Button.mjs +113 -0
- package/dist/esm/button/Button.module.css.mjs +3 -0
- package/dist/esm/checkbox/Checkbox.d.mts +18 -0
- package/dist/esm/checkbox/Checkbox.mjs +94 -0
- package/dist/esm/checkbox/Checkbox.module.css.mjs +3 -0
- package/dist/esm/dropdown/Dropdown.d.mts +11 -0
- package/dist/esm/dropdown/Dropdown.mjs +34 -0
- package/dist/esm/dropdown/Dropdown.module.css.mjs +3 -0
- package/dist/esm/index.css +1 -0
- package/dist/esm/index.d.mts +19 -0
- package/dist/esm/index.mjs +19 -0
- package/dist/esm/link/Link.d.mts +16 -0
- package/dist/esm/link/Link.mjs +33 -0
- package/dist/esm/link/Link.module.css.mjs +3 -0
- package/dist/esm/modal/Modal.d.mts +12 -0
- package/dist/esm/modal/Modal.mjs +82 -0
- package/dist/esm/modal/Modal.module.css.mjs +3 -0
- package/dist/esm/one-time-password-field/OneTimePasswordField.d.mts +8 -0
- package/dist/esm/one-time-password-field/OneTimePasswordField.mjs +31 -0
- package/dist/esm/one-time-password-field/OneTimePasswordField.module.css.mjs +3 -0
- package/dist/esm/pagination/Pagination.d.mts +13 -0
- package/dist/esm/pagination/Pagination.mjs +81 -0
- package/dist/esm/pagination/Pagination.module.css.mjs +3 -0
- package/dist/esm/popover/Popover.d.mts +10 -0
- package/dist/esm/popover/Popover.mjs +23 -0
- package/dist/esm/popover/Popover.module.css.mjs +3 -0
- package/dist/esm/select/Select.d.mts +12 -0
- package/dist/esm/select/Select.mjs +82 -0
- package/dist/esm/select/Select.module.css.mjs +3 -0
- package/dist/esm/spinner/Spinner.d.mts +14 -0
- package/dist/esm/spinner/Spinner.mjs +38 -0
- package/dist/esm/spinner/Spinner.module.css.mjs +3 -0
- package/dist/esm/stock-quantity-status/StockQuantityStatus.d.mts +12 -0
- package/dist/esm/stock-quantity-status/StockQuantityStatus.mjs +102 -0
- package/dist/esm/stock-quantity-status/StockQuantityStatus.module.css.mjs +3 -0
- package/dist/esm/switch/Switch.d.mts +16 -0
- package/dist/esm/switch/Switch.mjs +68 -0
- package/dist/esm/switch/Switch.module.css.mjs +3 -0
- package/dist/esm/tab/Tab.d.mts +10 -0
- package/dist/esm/tab/Tab.mjs +43 -0
- package/dist/esm/token/color.d.mts +82 -0
- package/dist/esm/token/color.mjs +82 -0
- package/dist/esm/token/spacing.d.mts +27 -0
- package/dist/esm/token/spacing.mjs +27 -0
- package/dist/esm/token/typography.d.mts +47 -0
- package/dist/esm/token/typography.mjs +46 -0
- package/dist/esm/typography/Typography.d.mts +33 -0
- package/dist/esm/typography/Typography.mjs +88 -0
- package/dist/esm/typography/Typography.module.css.mjs +3 -0
- package/package.json +36 -27
- package/dist/accordion/Accordion.d.ts +0 -12
- package/dist/accordion/index.d.ts +0 -1
- package/dist/body/Body.d.ts +0 -11
- package/dist/body/index.d.ts +0 -1
- package/dist/button/Button.d.ts +0 -18
- package/dist/button/index.d.ts +0 -1
- package/dist/checkbox/Checkbox.d.ts +0 -13
- package/dist/checkbox/index.d.ts +0 -1
- package/dist/display/Display.d.ts +0 -11
- package/dist/display/index.d.ts +0 -1
- package/dist/dropdown/Dropdown.d.ts +0 -7
- package/dist/dropdown/index.d.ts +0 -1
- package/dist/heading/Heading.d.ts +0 -10
- package/dist/heading/index.d.ts +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -1
- package/dist/link/Link.d.ts +0 -11
- package/dist/link/index.d.ts +0 -1
- package/dist/modal/Modal.d.ts +0 -8
- package/dist/modal/index.d.ts +0 -1
- package/dist/one-time-password-field/OneTimePasswordField.d.ts +0 -4
- package/dist/one-time-password-field/index.d.ts +0 -1
- package/dist/pagination/Pagination.d.ts +0 -8
- package/dist/pagination/index.d.ts +0 -1
- package/dist/popover/Popover.d.ts +0 -6
- package/dist/popover/index.d.ts +0 -1
- package/dist/select/Select.d.ts +0 -8
- package/dist/select/index.d.ts +0 -1
- package/dist/spinner/Spinner.d.ts +0 -9
- package/dist/spinner/index.d.ts +0 -1
- package/dist/stock-quantity-status/StockQuantityStatus.d.ts +0 -7
- package/dist/stock-quantity-status/index.d.ts +0 -1
- package/dist/switch/Switch.d.ts +0 -11
- package/dist/switch/index.d.ts +0 -1
- package/dist/tab/Tab.d.ts +0 -6
- package/dist/tab/index.d.ts +0 -1
- package/dist/toast/index.d.ts +0 -1
- package/dist/token/index.d.ts +0 -3
- package/dist/typography/Typography.d.ts +0 -9
- package/dist/typography/index.d.ts +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as OneTimePasswordFieldPrimitive from '@radix-ui/react-one-time-password-field';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import styles from './OneTimePasswordField.module.css.mjs';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const OneTimePasswordFieldRoot = /*#__PURE__*/forwardRef(({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}, ref) => {
|
|
11
|
+
return /*#__PURE__*/jsx(OneTimePasswordFieldPrimitive.Root, {
|
|
12
|
+
ref: ref,
|
|
13
|
+
className: clsx(styles.otp, className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
const OneTimePasswordFieldInput = /*#__PURE__*/forwardRef(({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}, ref) => {
|
|
21
|
+
return /*#__PURE__*/jsx(OneTimePasswordFieldPrimitive.Input, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
className: clsx(styles.input, className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const OneTimePasswordField = Object.assign(OneTimePasswordFieldRoot, {
|
|
28
|
+
Input: OneTimePasswordFieldInput
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export { OneTimePasswordField };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PaginationProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
5
|
+
page: number;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
maxVisible?: number;
|
|
8
|
+
onChange: (pageNumber: number) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Pagination: react.ForwardRefExoticComponent<PaginationProps & react.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
|
|
12
|
+
export { Pagination };
|
|
13
|
+
export type { PaginationProps };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import styles from './Pagination.module.css.mjs';
|
|
4
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const Pagination = /*#__PURE__*/forwardRef(({
|
|
7
|
+
className,
|
|
8
|
+
page,
|
|
9
|
+
totalPages,
|
|
10
|
+
maxVisible = 5,
|
|
11
|
+
onChange,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) => {
|
|
14
|
+
const halfVisible = Math.ceil(maxVisible / 2);
|
|
15
|
+
const renderPageButton = pageNumber => /*#__PURE__*/jsx("button", {
|
|
16
|
+
type: "button",
|
|
17
|
+
className: styles.item,
|
|
18
|
+
onClick: () => onChange(pageNumber),
|
|
19
|
+
"data-active": page === pageNumber,
|
|
20
|
+
children: pageNumber
|
|
21
|
+
}, pageNumber);
|
|
22
|
+
return /*#__PURE__*/jsxs("div", {
|
|
23
|
+
ref: ref,
|
|
24
|
+
className: clsx(styles.pagination, className),
|
|
25
|
+
...props,
|
|
26
|
+
children: [totalPages > 1 && /*#__PURE__*/jsx("button", {
|
|
27
|
+
className: styles.arrow,
|
|
28
|
+
type: "button",
|
|
29
|
+
disabled: page === 1,
|
|
30
|
+
onClick: () => page > 1 && onChange(page - 1),
|
|
31
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
width: "24",
|
|
34
|
+
height: "24",
|
|
35
|
+
viewBox: "0 0 24 24",
|
|
36
|
+
fill: "none",
|
|
37
|
+
stroke: "currentColor",
|
|
38
|
+
strokeWidth: "2",
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
strokeLinejoin: "round",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
children: /*#__PURE__*/jsx("path", {
|
|
43
|
+
d: "m15 18-6-6 6-6"
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
}), totalPages <= maxVisible + 2 ? Array(totalPages).fill(0).map((_, index) => renderPageButton(index + 1)) : /*#__PURE__*/jsxs(Fragment, {
|
|
47
|
+
children: [renderPageButton(1), page > 1 + halfVisible && /*#__PURE__*/jsx("span", {
|
|
48
|
+
className: styles.trunc,
|
|
49
|
+
children: "..."
|
|
50
|
+
}), Array(maxVisible).fill(0).map((_, index) => {
|
|
51
|
+
const pageNumber = page - halfVisible + index + 1;
|
|
52
|
+
return pageNumber > 1 && pageNumber < totalPages ? renderPageButton(pageNumber) : '';
|
|
53
|
+
}), page < totalPages - halfVisible && /*#__PURE__*/jsx("span", {
|
|
54
|
+
className: styles.trunc,
|
|
55
|
+
children: "..."
|
|
56
|
+
}), renderPageButton(totalPages)]
|
|
57
|
+
}), totalPages > 1 && /*#__PURE__*/jsx("button", {
|
|
58
|
+
className: styles.arrow,
|
|
59
|
+
type: "button",
|
|
60
|
+
disabled: page === totalPages,
|
|
61
|
+
onClick: () => page < totalPages && onChange(page + 1),
|
|
62
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
+
width: "24",
|
|
65
|
+
height: "24",
|
|
66
|
+
viewBox: "0 0 24 24",
|
|
67
|
+
fill: "none",
|
|
68
|
+
stroke: "currentColor",
|
|
69
|
+
strokeWidth: "2",
|
|
70
|
+
strokeLinecap: "round",
|
|
71
|
+
strokeLinejoin: "round",
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
children: /*#__PURE__*/jsx("path", {
|
|
74
|
+
d: "m9 18 6-6-6-6"
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export { Pagination };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
|
|
4
|
+
declare const Popover: react.FC<PopoverPrimitive.PopoverProps> & {
|
|
5
|
+
Trigger: react.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
Portal: react.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
7
|
+
Content: react.ForwardRefExoticComponent<Omit<Omit<PopoverPrimitive.PopoverContentProps & react.RefAttributes<HTMLDivElement>, "ref">, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { Popover };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import styles from './Popover.module.css.mjs';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const PopoverContent = /*#__PURE__*/forwardRef(({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}, ref) => {
|
|
11
|
+
return /*#__PURE__*/jsx(PopoverPrimitive.Content, {
|
|
12
|
+
ref: ref,
|
|
13
|
+
className: clsx(styles.content, className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
const Popover = Object.assign(PopoverPrimitive.Root, {
|
|
18
|
+
Trigger: PopoverPrimitive.Trigger,
|
|
19
|
+
Portal: PopoverPrimitive.Portal,
|
|
20
|
+
Content: PopoverContent
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { Popover };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
type SelectSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs' | '2xs';
|
|
5
|
+
interface SelectProps extends Omit<ComponentPropsWithoutRef<'select'>, 'size'> {
|
|
6
|
+
size?: SelectSize;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
10
|
+
|
|
11
|
+
export { Select };
|
|
12
|
+
export type { SelectProps };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { KeyboardArrowDownIcon } from '@cocso-ui/react-icons';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { match } from 'ts-pattern';
|
|
5
|
+
import styles from './Select.module.css.mjs';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
import { spacing } from '../token/spacing.mjs';
|
|
8
|
+
|
|
9
|
+
const Select = /*#__PURE__*/forwardRef(({
|
|
10
|
+
className,
|
|
11
|
+
style: _style,
|
|
12
|
+
size = 'md',
|
|
13
|
+
disabled = false,
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => {
|
|
17
|
+
const style = {
|
|
18
|
+
..._style,
|
|
19
|
+
...getStyles(size)
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/jsxs("div", {
|
|
22
|
+
className: styles.wrapper,
|
|
23
|
+
children: [/*#__PURE__*/jsx("select", {
|
|
24
|
+
ref: ref,
|
|
25
|
+
className: clsx(styles.select, className),
|
|
26
|
+
style: style,
|
|
27
|
+
disabled: disabled,
|
|
28
|
+
...props,
|
|
29
|
+
children: children
|
|
30
|
+
}), /*#__PURE__*/jsx("span", {
|
|
31
|
+
className: styles.icon,
|
|
32
|
+
children: /*#__PURE__*/jsx(KeyboardArrowDownIcon, {
|
|
33
|
+
size: 20
|
|
34
|
+
})
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const getStyles = size => match(size).with('2xs', () => ({
|
|
39
|
+
'--cocso-select-min-width': spacing.s11,
|
|
40
|
+
'--cocso-select-height': spacing.s11,
|
|
41
|
+
'--cocso-select-padding-left': spacing.s5,
|
|
42
|
+
'--cocso-select-padding-right': `calc(${spacing.s8} + 16px)`,
|
|
43
|
+
'--cocso-select-font-size': '12px',
|
|
44
|
+
'--cocso-select-border-radius': spacing.s3
|
|
45
|
+
})).with('xs', () => ({
|
|
46
|
+
'--cocso-select-min-width': spacing.s12,
|
|
47
|
+
'--cocso-select-height': spacing.s12,
|
|
48
|
+
'--cocso-select-padding-left': spacing.s6,
|
|
49
|
+
'--cocso-select-padding-right': `calc(${spacing.s7} + 16px)`,
|
|
50
|
+
'--cocso-select-font-size': '14px',
|
|
51
|
+
'--cocso-select-border-radius': spacing.s3
|
|
52
|
+
})).with('sm', () => ({
|
|
53
|
+
'--cocso-select-min-width': spacing.s14,
|
|
54
|
+
'--cocso-select-height': spacing.s14,
|
|
55
|
+
'--cocso-select-padding-left': spacing.s7,
|
|
56
|
+
'--cocso-select-padding-right': `calc(${spacing.s7} + 16px)`,
|
|
57
|
+
'--cocso-select-font-size': '14px',
|
|
58
|
+
'--cocso-select-border-radius': spacing.s3
|
|
59
|
+
})).with('md', () => ({
|
|
60
|
+
'--cocso-select-min-width': spacing.s16,
|
|
61
|
+
'--cocso-select-height': spacing.s16,
|
|
62
|
+
'--cocso-select-padding-left': spacing.s8,
|
|
63
|
+
'--cocso-select-padding-right': `calc(${spacing.s8} + 16px)`,
|
|
64
|
+
'--cocso-select-font-size': '16px',
|
|
65
|
+
'--cocso-select-border-radius': spacing.s4
|
|
66
|
+
})).with('lg', () => ({
|
|
67
|
+
'--cocso-select-min-width': spacing.s17,
|
|
68
|
+
'--cocso-select-height': spacing.s17,
|
|
69
|
+
'--cocso-select-padding-left': spacing.s9,
|
|
70
|
+
'--cocso-select-padding-right': `calc(${spacing.s9} + 16px)`,
|
|
71
|
+
'--cocso-select-font-size': '18px',
|
|
72
|
+
'--cocso-select-border-radius': spacing.s4
|
|
73
|
+
})).with('xl', () => ({
|
|
74
|
+
'--cocso-select-min-width': spacing.s18,
|
|
75
|
+
'--cocso-select-height': spacing.s18,
|
|
76
|
+
'--cocso-select-padding-left': spacing.s10,
|
|
77
|
+
'--cocso-select-padding-right': `calc(${spacing.s10} + 16px)`,
|
|
78
|
+
'--cocso-select-font-size': '18px',
|
|
79
|
+
'--cocso-select-border-radius': spacing.s4
|
|
80
|
+
})).exhaustive();
|
|
81
|
+
|
|
82
|
+
export { Select };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
type SpinnerSize = 'xl' | 'lg' | 'md' | 'sm';
|
|
5
|
+
type SpinnerColor = 'primary' | 'neutral' | 'white';
|
|
6
|
+
interface SpinnerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'size' | 'color'> {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
size?: SpinnerSize;
|
|
9
|
+
color?: SpinnerColor;
|
|
10
|
+
}
|
|
11
|
+
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
|
|
13
|
+
export { Spinner };
|
|
14
|
+
export type { SpinnerColor, SpinnerProps, SpinnerSize };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { match } from 'ts-pattern';
|
|
6
|
+
import styles from './Spinner.module.css.mjs';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
import { colors } from '../token/color.mjs';
|
|
9
|
+
|
|
10
|
+
const Spinner = /*#__PURE__*/forwardRef(({
|
|
11
|
+
asChild,
|
|
12
|
+
className,
|
|
13
|
+
style: _style,
|
|
14
|
+
size = 'md',
|
|
15
|
+
color = 'primary',
|
|
16
|
+
...props
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
19
|
+
const style = {
|
|
20
|
+
..._style,
|
|
21
|
+
'--cocso-spinner-size': getSize(size),
|
|
22
|
+
'--cocso-spinner-border-width': getBorderWidth(size),
|
|
23
|
+
'--cocso-spinner-border-color': getBorderColor(color),
|
|
24
|
+
'--cocso-spinner-bg-color': getBackgroundColor(color)
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/jsx(Comp, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
className: clsx(styles.spinner, className),
|
|
29
|
+
style: style,
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const getSize = size => match(size).with('xl', () => '40px').with('lg', () => '32px').with('md', () => '24px').with('sm', () => '20px').exhaustive();
|
|
34
|
+
const getBorderWidth = size => match(size).with('xl', () => '5px').with('lg', () => '4px').with('md', () => '3px').with('sm', () => '2px').exhaustive();
|
|
35
|
+
const getBorderColor = color => match(color).with('primary', () => colors.primary500).with('neutral', () => colors.neutral600).with('white', () => colors.white).exhaustive();
|
|
36
|
+
const getBackgroundColor = color => match(color).with('primary', () => colors.primary100).with('neutral', () => colors.neutral100).with('white', () => colors.whiteAlpha20).exhaustive();
|
|
37
|
+
|
|
38
|
+
export { Spinner };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
|
|
4
|
+
type QuantityStatus = '보통' | '여유' | '부족';
|
|
5
|
+
interface QuantityStatusProps extends ComponentPropsWithoutRef<'div'> {
|
|
6
|
+
quantity: QuantityStatus;
|
|
7
|
+
}
|
|
8
|
+
declare const StockQuantityStatus: react.ForwardRefExoticComponent<QuantityStatusProps & react.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const getColor: (quantity: QuantityStatus) => string;
|
|
10
|
+
|
|
11
|
+
export { StockQuantityStatus, getColor };
|
|
12
|
+
export type { QuantityStatus, QuantityStatusProps };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { match } from 'ts-pattern';
|
|
4
|
+
import styles from './StockQuantityStatus.module.css.mjs';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { spacing } from '../token/spacing.mjs';
|
|
7
|
+
import { Typography } from '../typography/Typography.mjs';
|
|
8
|
+
import { colors } from '../token/color.mjs';
|
|
9
|
+
|
|
10
|
+
const StockQuantityStatus = /*#__PURE__*/forwardRef(({
|
|
11
|
+
className,
|
|
12
|
+
style: _style,
|
|
13
|
+
quantity,
|
|
14
|
+
...props
|
|
15
|
+
}, ref) => {
|
|
16
|
+
const style = {
|
|
17
|
+
..._style,
|
|
18
|
+
'--cocso-stock-quantity-status-color': getColor(quantity),
|
|
19
|
+
'--cocso-stock-quantity-status-indicator-width': spacing.s9
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/jsxs("div", {
|
|
22
|
+
ref: ref,
|
|
23
|
+
className: clsx(styles.stock, className),
|
|
24
|
+
style: style,
|
|
25
|
+
...props,
|
|
26
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
27
|
+
className: styles.indicator,
|
|
28
|
+
children: quantity === '여유' ? /*#__PURE__*/jsxs("svg", {
|
|
29
|
+
width: "16",
|
|
30
|
+
height: "16",
|
|
31
|
+
viewBox: "0 0 16 16",
|
|
32
|
+
fill: "none",
|
|
33
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
36
|
+
fillRule: "evenodd",
|
|
37
|
+
clipRule: "evenodd",
|
|
38
|
+
d: "M7.06494 13.0754C4.26764 13.0754 1.99999 10.8199 2 8.03765C2.00001 5.25543 4.26766 3 7.06494 3L9.48051 3V6.10011L7.06494 6.10011C5.98906 6.10011 5.11689 6.96758 5.11689 8.03767C5.11688 9.10776 5.98906 9.97524 7.06494 9.97524L9.48051 9.97524V13.0754H7.06494Z",
|
|
39
|
+
fill: "#D9D9D9",
|
|
40
|
+
fillOpacity: "0.85098"
|
|
41
|
+
}), /*#__PURE__*/jsx("path", {
|
|
42
|
+
d: "M9.48051 9.97524L9.48051 6.10011L12.0519 6.10026C13.1278 6.10026 14 6.96774 14 8.03783C14 9.10792 13.1278 9.9754 12.0519 9.9754L9.48051 9.97524Z",
|
|
43
|
+
fill: "#D9D9D9",
|
|
44
|
+
fillOpacity: "0.85098"
|
|
45
|
+
}), /*#__PURE__*/jsx("path", {
|
|
46
|
+
d: "M9.48047 6.10059H7.06543C5.98955 6.10059 5.11719 6.968 5.11719 8.03809C5.11741 9.10782 5.98893 9.97532 7.06445 9.97559H9.48047V13.0752H7.06445C4.35911 13.0749 2.14983 10.9652 2.00781 8.30957V7.76465C2.15041 5.10939 4.36025 3 7.06543 3H9.48047V6.10059ZM12.0518 6.10059C13.1276 6.10059 14 6.968 14 8.03809C13.9999 9.10806 13.1276 9.97559 12.0518 9.97559H9.48047V6.10059H12.0518Z",
|
|
47
|
+
fill: "currentColor"
|
|
48
|
+
})]
|
|
49
|
+
}) : quantity === '보통' ? /*#__PURE__*/jsxs("svg", {
|
|
50
|
+
width: "16",
|
|
51
|
+
height: "16",
|
|
52
|
+
viewBox: "0 0 16 16",
|
|
53
|
+
fill: "none",
|
|
54
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
57
|
+
fillRule: "evenodd",
|
|
58
|
+
clipRule: "evenodd",
|
|
59
|
+
d: "M7.06494 13.0754C4.26764 13.0754 1.99999 10.8199 2 8.03765C2.00001 5.25543 4.26766 3 7.06494 3L9.48051 3V6.10011L7.06494 6.10011C5.98906 6.10011 5.11689 6.96758 5.11689 8.03767C5.11688 9.10776 5.98906 9.97524 7.06494 9.97524L9.48051 9.97524V13.0754H7.06494Z",
|
|
60
|
+
fill: "#D9D9D9",
|
|
61
|
+
fillOpacity: "0.85098"
|
|
62
|
+
}), /*#__PURE__*/jsx("path", {
|
|
63
|
+
d: "M9.48051 9.97524L9.48051 6.10011L12.0519 6.10026C13.1278 6.10026 14 6.96774 14 8.03783C14 9.10792 13.1278 9.9754 12.0519 9.9754L9.48051 9.97524Z",
|
|
64
|
+
fill: "#D9D9D9",
|
|
65
|
+
fillOpacity: "0.85098"
|
|
66
|
+
}), /*#__PURE__*/jsx("path", {
|
|
67
|
+
d: "M9.48145 6.0752V6.10059H7.06641C5.99053 6.10059 5.11817 6.968 5.11816 8.03809C5.11839 9.10782 5.98991 9.97532 7.06543 9.97559H9.48145V13.0752H7.06543C4.35577 13.0749 2.14345 10.9585 2.00781 8.29688V7.77832C2.03849 7.17662 2.17568 6.60303 2.40039 6.0752H9.48145ZM12.0527 6.10059C13.1286 6.10059 14.001 6.968 14.001 8.03809C14.0008 9.10806 13.1285 9.97559 12.0527 9.97559H9.48145V6.10059H12.0527Z",
|
|
68
|
+
fill: "currentColor"
|
|
69
|
+
})]
|
|
70
|
+
}) : /*#__PURE__*/jsxs("svg", {
|
|
71
|
+
width: "16",
|
|
72
|
+
height: "16",
|
|
73
|
+
viewBox: "0 0 16 16",
|
|
74
|
+
fill: "none",
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
78
|
+
fillRule: "evenodd",
|
|
79
|
+
clipRule: "evenodd",
|
|
80
|
+
d: "M7.06494 13.0754C4.26764 13.0754 1.99999 10.8199 2 8.03765C2.00001 5.25543 4.26766 3 7.06494 3L9.48051 3V6.10011L7.06494 6.10011C5.98906 6.10011 5.11689 6.96758 5.11689 8.03767C5.11688 9.10776 5.98906 9.97524 7.06494 9.97524L9.48051 9.97524V13.0754H7.06494Z",
|
|
81
|
+
fill: "#D9D9D9",
|
|
82
|
+
fillOpacity: "0.85098"
|
|
83
|
+
}), /*#__PURE__*/jsx("path", {
|
|
84
|
+
d: "M9.48051 9.97524L9.48051 6.10011L12.0519 6.10026C13.1278 6.10026 14 6.96774 14 8.03783C14 9.10792 13.1278 9.9754 12.0519 9.9754L9.48051 9.97524Z",
|
|
85
|
+
fill: "#D9D9D9",
|
|
86
|
+
fillOpacity: "0.85098"
|
|
87
|
+
}), /*#__PURE__*/jsx("path", {
|
|
88
|
+
d: "M7.04688 9.97461C7.05273 9.97466 7.05859 9.97558 7.06445 9.97559H9.48047V13.0752H7.06445C4.95754 13.075 3.15182 11.7952 2.38867 9.97461H7.04688ZM12.0713 9.97461C12.0648 9.97467 12.0582 9.97559 12.0518 9.97559H9.48047V9.97461H12.0713Z",
|
|
89
|
+
fill: "currentColor"
|
|
90
|
+
})]
|
|
91
|
+
})
|
|
92
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
93
|
+
type: "body",
|
|
94
|
+
size: "sm",
|
|
95
|
+
color: "currentColor",
|
|
96
|
+
children: quantity
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
const getColor = quantity => match(quantity).with('여유', () => colors.primary500).with('보통', () => colors.success400).with('부족', () => colors.danger500).exhaustive();
|
|
101
|
+
|
|
102
|
+
export { StockQuantityStatus, getColor };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
4
|
+
|
|
5
|
+
type SwitchSize = 'lg' | 'md';
|
|
6
|
+
interface SwitchProps extends ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {
|
|
7
|
+
id?: string;
|
|
8
|
+
size?: SwitchSize;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
label?: string;
|
|
11
|
+
position?: 'left' | 'right';
|
|
12
|
+
}
|
|
13
|
+
declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
|
|
15
|
+
export { Switch };
|
|
16
|
+
export type { SwitchProps, SwitchSize };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
2
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { forwardRef, useId } from 'react';
|
|
5
|
+
import { match } from 'ts-pattern';
|
|
6
|
+
import styles from './Switch.module.css.mjs';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
import { colors } from '../token/color.mjs';
|
|
9
|
+
import { Typography } from '../typography/Typography.mjs';
|
|
10
|
+
import { spacing } from '../token/spacing.mjs';
|
|
11
|
+
|
|
12
|
+
const Switch = /*#__PURE__*/forwardRef(({
|
|
13
|
+
id: _id,
|
|
14
|
+
className,
|
|
15
|
+
style: _style,
|
|
16
|
+
size = 'md',
|
|
17
|
+
position = 'right',
|
|
18
|
+
disabled,
|
|
19
|
+
label,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
22
|
+
const generatedId = useId();
|
|
23
|
+
const id = _id ?? generatedId;
|
|
24
|
+
const style = {
|
|
25
|
+
..._style,
|
|
26
|
+
'--cocso-switch-width': getSwitchWidth(size),
|
|
27
|
+
'--cocso-switch-height': getSwitchHeight(size),
|
|
28
|
+
'--cocso-switch-thumb-width': getThumbSize(size),
|
|
29
|
+
'--cocso-switch-thumb-height': getThumbSize(size),
|
|
30
|
+
'--cocso-switch-bg-color': colors.neutral100
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/jsxs(Primitive.div, {
|
|
33
|
+
className: clsx(styles.wrapper, className),
|
|
34
|
+
"aria-disabled": disabled,
|
|
35
|
+
style: style,
|
|
36
|
+
children: [position === 'left' && /*#__PURE__*/jsx(Typography, {
|
|
37
|
+
type: "body",
|
|
38
|
+
size: size,
|
|
39
|
+
asChild: true,
|
|
40
|
+
children: /*#__PURE__*/jsx("label", {
|
|
41
|
+
htmlFor: id,
|
|
42
|
+
children: label
|
|
43
|
+
})
|
|
44
|
+
}), /*#__PURE__*/jsx(SwitchPrimitive.Root, {
|
|
45
|
+
ref: ref,
|
|
46
|
+
className: styles.switch,
|
|
47
|
+
disabled: disabled,
|
|
48
|
+
...props,
|
|
49
|
+
children: /*#__PURE__*/jsx(SwitchPrimitive.Thumb, {
|
|
50
|
+
className: styles.thumb
|
|
51
|
+
})
|
|
52
|
+
}), position === 'right' && /*#__PURE__*/jsx(Typography, {
|
|
53
|
+
type: "body",
|
|
54
|
+
size: size,
|
|
55
|
+
"aria-disabled": disabled,
|
|
56
|
+
asChild: true,
|
|
57
|
+
children: /*#__PURE__*/jsx("label", {
|
|
58
|
+
htmlFor: id,
|
|
59
|
+
children: label
|
|
60
|
+
})
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
const getSwitchWidth = size => match(size).with('lg', () => spacing.s14).with('md', () => spacing.s12).exhaustive();
|
|
65
|
+
const getSwitchHeight = size => match(size).with('lg', () => spacing.s10).with('md', () => spacing.s9).exhaustive();
|
|
66
|
+
const getThumbSize = size => match(size).with('lg', () => spacing.s9).with('md', () => spacing.s8).exhaustive();
|
|
67
|
+
|
|
68
|
+
export { Switch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as TabPrimitive from '@radix-ui/react-tabs';
|
|
3
|
+
|
|
4
|
+
declare const Tab: react.ForwardRefExoticComponent<Omit<TabPrimitive.TabsProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>> & {
|
|
5
|
+
List: react.ForwardRefExoticComponent<Omit<TabPrimitive.TabsListProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
Trigger: react.ForwardRefExoticComponent<Omit<TabPrimitive.TabsTriggerProps & react.RefAttributes<HTMLButtonElement>, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
Content: react.ForwardRefExoticComponent<Omit<TabPrimitive.TabsContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { Tab };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as TabPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const TabPrimitiveRoot = /*#__PURE__*/forwardRef(({
|
|
6
|
+
...props
|
|
7
|
+
}, ref) => {
|
|
8
|
+
return /*#__PURE__*/jsx(TabPrimitive.Root, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
const TabPrimitiveList = /*#__PURE__*/forwardRef(({
|
|
14
|
+
...props
|
|
15
|
+
}, ref) => {
|
|
16
|
+
return /*#__PURE__*/jsx(TabPrimitive.List, {
|
|
17
|
+
ref: ref,
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
const TabPrimitiveTrigger = /*#__PURE__*/forwardRef(({
|
|
22
|
+
...props
|
|
23
|
+
}, ref) => {
|
|
24
|
+
return /*#__PURE__*/jsx(TabPrimitive.Trigger, {
|
|
25
|
+
ref: ref,
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
const TabPrimitiveContent = /*#__PURE__*/forwardRef(({
|
|
30
|
+
...props
|
|
31
|
+
}, ref) => {
|
|
32
|
+
return /*#__PURE__*/jsx(TabPrimitive.Content, {
|
|
33
|
+
ref: ref,
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
const Tab = Object.assign(TabPrimitiveRoot, {
|
|
38
|
+
List: TabPrimitiveList,
|
|
39
|
+
Trigger: TabPrimitiveTrigger,
|
|
40
|
+
Content: TabPrimitiveContent
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { Tab };
|