@cocso-ui/react 0.1.9 → 0.1.11
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 +7 -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 +7 -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 +7 -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 +7 -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 +7 -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 +7 -0
- package/dist/esm/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +26 -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 +7 -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 +7 -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 +7 -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 +7 -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 +7 -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 +7 -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 +7 -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 +7 -0
- package/package.json +33 -26
- 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,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var clsx = require('clsx');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var tsPattern = require('ts-pattern');
|
|
6
|
+
var StockQuantityStatus_module = require('./StockQuantityStatus.module.css.js');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var spacing = require('../token/spacing.js');
|
|
9
|
+
var Typography = require('../typography/Typography.js');
|
|
10
|
+
var color = require('../token/color.js');
|
|
11
|
+
|
|
12
|
+
const StockQuantityStatus = /*#__PURE__*/react.forwardRef(({
|
|
13
|
+
className,
|
|
14
|
+
style: _style,
|
|
15
|
+
quantity,
|
|
16
|
+
...props
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const style = {
|
|
19
|
+
..._style,
|
|
20
|
+
'--cocso-stock-quantity-status-color': getColor(quantity),
|
|
21
|
+
'--cocso-stock-quantity-status-indicator-width': spacing.spacing.s9
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
24
|
+
ref: ref,
|
|
25
|
+
className: clsx.clsx(StockQuantityStatus_module.stock, className),
|
|
26
|
+
style: style,
|
|
27
|
+
...props,
|
|
28
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
29
|
+
className: StockQuantityStatus_module.indicator,
|
|
30
|
+
children: quantity === '여유' ? /*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
31
|
+
width: "16",
|
|
32
|
+
height: "16",
|
|
33
|
+
viewBox: "0 0 16 16",
|
|
34
|
+
fill: "none",
|
|
35
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("path", {
|
|
38
|
+
fillRule: "evenodd",
|
|
39
|
+
clipRule: "evenodd",
|
|
40
|
+
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",
|
|
41
|
+
fill: "#D9D9D9",
|
|
42
|
+
fillOpacity: "0.85098"
|
|
43
|
+
}), /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
44
|
+
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",
|
|
45
|
+
fill: "#D9D9D9",
|
|
46
|
+
fillOpacity: "0.85098"
|
|
47
|
+
}), /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
48
|
+
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",
|
|
49
|
+
fill: "currentColor"
|
|
50
|
+
})]
|
|
51
|
+
}) : quantity === '보통' ? /*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
52
|
+
width: "16",
|
|
53
|
+
height: "16",
|
|
54
|
+
viewBox: "0 0 16 16",
|
|
55
|
+
fill: "none",
|
|
56
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("path", {
|
|
59
|
+
fillRule: "evenodd",
|
|
60
|
+
clipRule: "evenodd",
|
|
61
|
+
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",
|
|
62
|
+
fill: "#D9D9D9",
|
|
63
|
+
fillOpacity: "0.85098"
|
|
64
|
+
}), /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
65
|
+
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",
|
|
66
|
+
fill: "#D9D9D9",
|
|
67
|
+
fillOpacity: "0.85098"
|
|
68
|
+
}), /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
69
|
+
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",
|
|
70
|
+
fill: "currentColor"
|
|
71
|
+
})]
|
|
72
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
73
|
+
width: "16",
|
|
74
|
+
height: "16",
|
|
75
|
+
viewBox: "0 0 16 16",
|
|
76
|
+
fill: "none",
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
"aria-hidden": "true",
|
|
79
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("path", {
|
|
80
|
+
fillRule: "evenodd",
|
|
81
|
+
clipRule: "evenodd",
|
|
82
|
+
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",
|
|
83
|
+
fill: "#D9D9D9",
|
|
84
|
+
fillOpacity: "0.85098"
|
|
85
|
+
}), /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
86
|
+
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",
|
|
87
|
+
fill: "#D9D9D9",
|
|
88
|
+
fillOpacity: "0.85098"
|
|
89
|
+
}), /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
90
|
+
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",
|
|
91
|
+
fill: "currentColor"
|
|
92
|
+
})]
|
|
93
|
+
})
|
|
94
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography.Typography, {
|
|
95
|
+
type: "body",
|
|
96
|
+
size: "sm",
|
|
97
|
+
color: "currentColor",
|
|
98
|
+
children: quantity
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
const getColor = quantity => tsPattern.match(quantity).with('여유', () => color.colors.primary500).with('보통', () => color.colors.success400).with('부족', () => color.colors.danger500).exhaustive();
|
|
103
|
+
|
|
104
|
+
exports.StockQuantityStatus = StockQuantityStatus;
|
|
105
|
+
exports.getColor = getColor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var styleInject_es = require('../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js');
|
|
4
|
+
|
|
5
|
+
var css_248z = ".StockQuantityStatus-module_stock__mWbqI{--cocso-stock-quantity-status-color:inherit;align-items:center;color:var(--cocso-stock-quantity-status-color);display:inline-flex;gap:var(--ds-spacing-2)}.StockQuantityStatus-module_indicator__inaKv{--cocso-stock-quantity-status-indicator-width:inherit;flex-shrink:0;height:auto;width:var(--cocso-stock-quantity-status-indicator-width)}.StockQuantityStatus-module_indicator__inaKv>svg{height:100%;width:100%}";
|
|
6
|
+
var styles = {"stock":"StockQuantityStatus-module_stock__mWbqI","indicator":"StockQuantityStatus-module_indicator__inaKv"};
|
|
7
|
+
styleInject_es(css_248z);
|
|
8
|
+
|
|
9
|
+
module.exports = styles;
|
|
@@ -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,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactPrimitive = require('@radix-ui/react-primitive');
|
|
4
|
+
var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var tsPattern = require('ts-pattern');
|
|
8
|
+
var Switch_module = require('./Switch.module.css.js');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
var color = require('../token/color.js');
|
|
11
|
+
var Typography = require('../typography/Typography.js');
|
|
12
|
+
var spacing = require('../token/spacing.js');
|
|
13
|
+
|
|
14
|
+
function _interopNamespaceDefault(e) {
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(SwitchPrimitive);
|
|
32
|
+
|
|
33
|
+
const Switch = /*#__PURE__*/react.forwardRef(({
|
|
34
|
+
id: _id,
|
|
35
|
+
className,
|
|
36
|
+
style: _style,
|
|
37
|
+
size = 'md',
|
|
38
|
+
position = 'right',
|
|
39
|
+
disabled,
|
|
40
|
+
label,
|
|
41
|
+
...props
|
|
42
|
+
}, ref) => {
|
|
43
|
+
const generatedId = react.useId();
|
|
44
|
+
const id = _id ?? generatedId;
|
|
45
|
+
const style = {
|
|
46
|
+
..._style,
|
|
47
|
+
'--cocso-switch-width': getSwitchWidth(size),
|
|
48
|
+
'--cocso-switch-height': getSwitchHeight(size),
|
|
49
|
+
'--cocso-switch-thumb-width': getThumbSize(size),
|
|
50
|
+
'--cocso-switch-thumb-height': getThumbSize(size),
|
|
51
|
+
'--cocso-switch-bg-color': color.colors.neutral100
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactPrimitive.Primitive.div, {
|
|
54
|
+
className: clsx.clsx(Switch_module.wrapper, className),
|
|
55
|
+
"aria-disabled": disabled,
|
|
56
|
+
style: style,
|
|
57
|
+
children: [position === 'left' && /*#__PURE__*/jsxRuntime.jsx(Typography.Typography, {
|
|
58
|
+
type: "body",
|
|
59
|
+
size: size,
|
|
60
|
+
asChild: true,
|
|
61
|
+
children: /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
62
|
+
htmlFor: id,
|
|
63
|
+
children: label
|
|
64
|
+
})
|
|
65
|
+
}), /*#__PURE__*/jsxRuntime.jsx(SwitchPrimitive__namespace.Root, {
|
|
66
|
+
ref: ref,
|
|
67
|
+
className: Switch_module.switch,
|
|
68
|
+
disabled: disabled,
|
|
69
|
+
...props,
|
|
70
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SwitchPrimitive__namespace.Thumb, {
|
|
71
|
+
className: Switch_module.thumb
|
|
72
|
+
})
|
|
73
|
+
}), position === 'right' && /*#__PURE__*/jsxRuntime.jsx(Typography.Typography, {
|
|
74
|
+
type: "body",
|
|
75
|
+
size: size,
|
|
76
|
+
"aria-disabled": disabled,
|
|
77
|
+
asChild: true,
|
|
78
|
+
children: /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
79
|
+
htmlFor: id,
|
|
80
|
+
children: label
|
|
81
|
+
})
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
const getSwitchWidth = size => tsPattern.match(size).with('lg', () => spacing.spacing.s14).with('md', () => spacing.spacing.s12).exhaustive();
|
|
86
|
+
const getSwitchHeight = size => tsPattern.match(size).with('lg', () => spacing.spacing.s10).with('md', () => spacing.spacing.s9).exhaustive();
|
|
87
|
+
const getThumbSize = size => tsPattern.match(size).with('lg', () => spacing.spacing.s9).with('md', () => spacing.spacing.s8).exhaustive();
|
|
88
|
+
|
|
89
|
+
exports.Switch = Switch;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var styleInject_es = require('../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js');
|
|
4
|
+
|
|
5
|
+
var css_248z = ".Switch-module_wrapper__qcI9-{align-items:center;display:flex;gap:var(--ds-spacing-5)}.Switch-module_wrapper__qcI9-[aria-disabled=true]{cursor:not-allowed;opacity:.4}.Switch-module_switch__pwmft{--cocso-switch-width:inherit;--cocso-switch-height:inherit;--cocso-switch-bg-color:inherit;background-color:var(--cocso-switch-bg-color);border-radius:var(--ds-spacing-max);cursor:pointer;height:var(--cocso-switch-height);opacity:1;position:relative;width:var(--cocso-switch-width)}.Switch-module_switch__pwmft[data-disabled=true],.Switch-module_switch__pwmft[disabled]{cursor:not-allowed;opacity:.4}.Switch-module_switch__pwmft[data-state=checked]{--cocso-switch-bg-color:var(--ds-color-primary-500)}.Switch-module_thumb__pQGDy{--cocso-switch-thumb-width:inherit;--cocso-switch-thumb-height:inherit;background-color:var(--ds-color-white);border-radius:var(--ds-spacing-max);display:block;height:var(--cocso-switch-thumb-width);transform:translateX(var(--ds-spacing-2));transition:transform .15s ease;width:var(--cocso-switch-thumb-width);will-change:transform}.Switch-module_thumb__pQGDy[data-state=checked]{transform:translateX(calc(var(--cocso-switch-width) - var(--cocso-switch-thumb-width) - var(--ds-spacing-2)))}";
|
|
6
|
+
var styles = {"wrapper":"Switch-module_wrapper__qcI9-","switch":"Switch-module_switch__pwmft","thumb":"Switch-module_thumb__pQGDy"};
|
|
7
|
+
styleInject_es(css_248z);
|
|
8
|
+
|
|
9
|
+
module.exports = styles;
|
|
@@ -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,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var TabPrimitive = require('@radix-ui/react-tabs');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var TabPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TabPrimitive);
|
|
25
|
+
|
|
26
|
+
const TabPrimitiveRoot = /*#__PURE__*/react.forwardRef(({
|
|
27
|
+
...props
|
|
28
|
+
}, ref) => {
|
|
29
|
+
return /*#__PURE__*/jsxRuntime.jsx(TabPrimitive__namespace.Root, {
|
|
30
|
+
ref: ref,
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
const TabPrimitiveList = /*#__PURE__*/react.forwardRef(({
|
|
35
|
+
...props
|
|
36
|
+
}, ref) => {
|
|
37
|
+
return /*#__PURE__*/jsxRuntime.jsx(TabPrimitive__namespace.List, {
|
|
38
|
+
ref: ref,
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
const TabPrimitiveTrigger = /*#__PURE__*/react.forwardRef(({
|
|
43
|
+
...props
|
|
44
|
+
}, ref) => {
|
|
45
|
+
return /*#__PURE__*/jsxRuntime.jsx(TabPrimitive__namespace.Trigger, {
|
|
46
|
+
ref: ref,
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const TabPrimitiveContent = /*#__PURE__*/react.forwardRef(({
|
|
51
|
+
...props
|
|
52
|
+
}, ref) => {
|
|
53
|
+
return /*#__PURE__*/jsxRuntime.jsx(TabPrimitive__namespace.Content, {
|
|
54
|
+
ref: ref,
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
const Tab = Object.assign(TabPrimitiveRoot, {
|
|
59
|
+
List: TabPrimitiveList,
|
|
60
|
+
Trigger: TabPrimitiveTrigger,
|
|
61
|
+
Content: TabPrimitiveContent
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
exports.Tab = Tab;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const colors = {
|
|
4
|
+
transparent: 'var(--ds-color-transparent)',
|
|
5
|
+
white: 'var(--ds-color-white)',
|
|
6
|
+
whiteAlpha5: 'var(--ds-color-white-alpha-5)',
|
|
7
|
+
whiteAlpha10: 'var(--ds-color-white-alpha-10)',
|
|
8
|
+
whiteAlpha20: 'var(--ds-color-white-alpha-20)',
|
|
9
|
+
whiteAlpha30: 'var(--ds-color-white-alpha-30)',
|
|
10
|
+
whiteAlpha40: 'var(--ds-color-white-alpha-40)',
|
|
11
|
+
whiteAlpha50: 'var(--ds-color-white-alpha-50)',
|
|
12
|
+
whiteAlpha60: 'var(--ds-color-white-alpha-60)',
|
|
13
|
+
whiteAlpha70: 'var(--ds-color-white-alpha-70)',
|
|
14
|
+
whiteAlpha80: 'var(--ds-color-white-alpha-80)',
|
|
15
|
+
whiteAlpha90: 'var(--ds-color-white-alpha-90)',
|
|
16
|
+
black: 'var(--ds-color-black)',
|
|
17
|
+
blackAlpha5: 'var(--ds-color-black-alpha-5)',
|
|
18
|
+
blackAlpha10: 'var(--ds-color-black-alpha-10)',
|
|
19
|
+
blackAlpha20: 'var(--ds-color-black-alpha-20)',
|
|
20
|
+
blackAlpha30: 'var(--ds-color-black-alpha-30)',
|
|
21
|
+
blackAlpha40: 'var(--ds-color-black-alpha-40)',
|
|
22
|
+
blackAlpha50: 'var(--ds-color-black-alpha-50)',
|
|
23
|
+
blackAlpha60: 'var(--ds-color-black-alpha-60)',
|
|
24
|
+
blackAlpha70: 'var(--ds-color-black-alpha-70)',
|
|
25
|
+
blackAlpha80: 'var(--ds-color-black-alpha-80)',
|
|
26
|
+
blackAlpha90: 'var(--ds-color-black-alpha-90)',
|
|
27
|
+
neutral50: 'var(--ds-color-neutral-50)',
|
|
28
|
+
neutral100: 'var(--ds-color-neutral-100)',
|
|
29
|
+
neutral200: 'var(--ds-color-neutral-200)',
|
|
30
|
+
neutral300: 'var(--ds-color-neutral-300)',
|
|
31
|
+
neutral400: 'var(--ds-color-neutral-400)',
|
|
32
|
+
neutral500: 'var(--ds-color-neutral-500)',
|
|
33
|
+
neutral600: 'var(--ds-color-neutral-600)',
|
|
34
|
+
neutral700: 'var(--ds-color-neutral-700)',
|
|
35
|
+
neutral800: 'var(--ds-color-neutral-800)',
|
|
36
|
+
neutral900: 'var(--ds-color-neutral-900)',
|
|
37
|
+
neutral950: 'var(--ds-color-neutral-950)',
|
|
38
|
+
primary50: 'var(--ds-color-primary-50)',
|
|
39
|
+
primary100: 'var(--ds-color-primary-100)',
|
|
40
|
+
primary200: 'var(--ds-color-primary-200)',
|
|
41
|
+
primary300: 'var(--ds-color-primary-300)',
|
|
42
|
+
primary400: 'var(--ds-color-primary-400)',
|
|
43
|
+
primary500: 'var(--ds-color-primary-500)',
|
|
44
|
+
primary600: 'var(--ds-color-primary-600)',
|
|
45
|
+
primary700: 'var(--ds-color-primary-700)',
|
|
46
|
+
primary800: 'var(--ds-color-primary-800)',
|
|
47
|
+
primary900: 'var(--ds-color-primary-900)',
|
|
48
|
+
primary950: 'var(--ds-color-primary-950)',
|
|
49
|
+
danger50: 'var(--ds-color-danger-50)',
|
|
50
|
+
danger100: 'var(--ds-color-danger-100)',
|
|
51
|
+
danger200: 'var(--ds-color-danger-200)',
|
|
52
|
+
danger300: 'var(--ds-color-danger-300)',
|
|
53
|
+
danger400: 'var(--ds-color-danger-400)',
|
|
54
|
+
danger500: 'var(--ds-color-danger-500)',
|
|
55
|
+
danger600: 'var(--ds-color-danger-600)',
|
|
56
|
+
danger700: 'var(--ds-color-danger-700)',
|
|
57
|
+
danger800: 'var(--ds-color-danger-800)',
|
|
58
|
+
danger900: 'var(--ds-color-danger-900)',
|
|
59
|
+
danger950: 'var(--ds-color-danger-950)',
|
|
60
|
+
warning50: 'var(--ds-color-warning-50)',
|
|
61
|
+
warning100: 'var(--ds-color-warning-100)',
|
|
62
|
+
warning200: 'var(--ds-color-warning-200)',
|
|
63
|
+
warning300: 'var(--ds-color-warning-300)',
|
|
64
|
+
warning400: 'var(--ds-color-warning-400)',
|
|
65
|
+
warning500: 'var(--ds-color-warning-500)',
|
|
66
|
+
warning600: 'var(--ds-color-warning-600)',
|
|
67
|
+
warning700: 'var(--ds-color-warning-700)',
|
|
68
|
+
warning800: 'var(--ds-color-warning-800)',
|
|
69
|
+
warning900: 'var(--ds-color-warning-900)',
|
|
70
|
+
warning950: 'var(--ds-color-warning-950)',
|
|
71
|
+
success50: 'var(--ds-color-success-50)',
|
|
72
|
+
success100: 'var(--ds-color-success-100)',
|
|
73
|
+
success200: 'var(--ds-color-success-200)',
|
|
74
|
+
success300: 'var(--ds-color-success-300)',
|
|
75
|
+
success400: 'var(--ds-color-success-400)',
|
|
76
|
+
success500: 'var(--ds-color-success-500)',
|
|
77
|
+
success600: 'var(--ds-color-success-600)',
|
|
78
|
+
success700: 'var(--ds-color-success-700)',
|
|
79
|
+
success800: 'var(--ds-color-success-800)',
|
|
80
|
+
success900: 'var(--ds-color-success-900)',
|
|
81
|
+
success950: 'var(--ds-color-success-950)'
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
exports.colors = colors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare const spacing: {
|
|
2
2
|
readonly s0: "var(--ds-spacing-0)";
|
|
3
3
|
readonly s1: "var(--ds-spacing-1)";
|
|
4
4
|
readonly s2: "var(--ds-spacing-2)";
|
|
@@ -23,3 +23,5 @@ export declare const spacing: {
|
|
|
23
23
|
readonly s21: "var(--ds-spacing-21)";
|
|
24
24
|
readonly max: "var(--ds-spacing-max)";
|
|
25
25
|
};
|
|
26
|
+
|
|
27
|
+
export { spacing };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const spacing = {
|
|
4
|
+
s0: 'var(--ds-spacing-0)',
|
|
5
|
+
s1: 'var(--ds-spacing-1)',
|
|
6
|
+
s2: 'var(--ds-spacing-2)',
|
|
7
|
+
s3: 'var(--ds-spacing-3)',
|
|
8
|
+
s4: 'var(--ds-spacing-4)',
|
|
9
|
+
s5: 'var(--ds-spacing-5)',
|
|
10
|
+
s6: 'var(--ds-spacing-6)',
|
|
11
|
+
s7: 'var(--ds-spacing-7)',
|
|
12
|
+
s8: 'var(--ds-spacing-8)',
|
|
13
|
+
s9: 'var(--ds-spacing-9)',
|
|
14
|
+
s10: 'var(--ds-spacing-10)',
|
|
15
|
+
s11: 'var(--ds-spacing-11)',
|
|
16
|
+
s12: 'var(--ds-spacing-12)',
|
|
17
|
+
s13: 'var(--ds-spacing-13)',
|
|
18
|
+
s14: 'var(--ds-spacing-14)',
|
|
19
|
+
s15: 'var(--ds-spacing-15)',
|
|
20
|
+
s16: 'var(--ds-spacing-16)',
|
|
21
|
+
s17: 'var(--ds-spacing-17)',
|
|
22
|
+
s18: 'var(--ds-spacing-18)',
|
|
23
|
+
s19: 'var(--ds-spacing-19)',
|
|
24
|
+
s20: 'var(--ds-spacing-20)',
|
|
25
|
+
s21: 'var(--ds-spacing-21)',
|
|
26
|
+
max: 'var(--ds-spacing-max)'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.spacing = spacing;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare const fontSize: {
|
|
2
2
|
readonly 10: 10;
|
|
3
3
|
readonly 11: 11;
|
|
4
4
|
readonly 12: 12;
|
|
@@ -15,13 +15,13 @@ export declare const fontSize: {
|
|
|
15
15
|
readonly 44: 44;
|
|
16
16
|
readonly 60: 60;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
type FontSize = keyof typeof fontSize;
|
|
19
|
+
type ResponsiveFontSize = FontSize | [FontSize, FontSize?, FontSize?] | {
|
|
20
20
|
base: FontSize;
|
|
21
21
|
tablet?: FontSize;
|
|
22
22
|
desktop?: FontSize;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
declare const fontWeight: {
|
|
25
25
|
readonly thin: 100;
|
|
26
26
|
readonly extralight: 200;
|
|
27
27
|
readonly light: 300;
|
|
@@ -32,8 +32,8 @@ export declare const fontWeight: {
|
|
|
32
32
|
readonly extrabold: 800;
|
|
33
33
|
readonly black: 900;
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
type FontWeight = keyof typeof fontWeight;
|
|
36
|
+
declare const lineHeight: {
|
|
37
37
|
readonly none: 1;
|
|
38
38
|
readonly tight: 1.25;
|
|
39
39
|
readonly snug: 1.375;
|
|
@@ -41,4 +41,7 @@ export declare const lineHeight: {
|
|
|
41
41
|
readonly relaxed: 1.625;
|
|
42
42
|
readonly loose: 2;
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
type LineHeight = keyof typeof lineHeight;
|
|
45
|
+
|
|
46
|
+
export { fontSize, fontWeight, lineHeight };
|
|
47
|
+
export type { FontSize, FontWeight, LineHeight, ResponsiveFontSize };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fontSize = {
|
|
4
|
+
10: 10,
|
|
5
|
+
11: 11,
|
|
6
|
+
12: 12,
|
|
7
|
+
13: 13,
|
|
8
|
+
14: 14,
|
|
9
|
+
15: 15,
|
|
10
|
+
16: 16,
|
|
11
|
+
18: 18,
|
|
12
|
+
20: 20,
|
|
13
|
+
24: 24,
|
|
14
|
+
28: 28,
|
|
15
|
+
32: 32,
|
|
16
|
+
36: 36,
|
|
17
|
+
44: 44,
|
|
18
|
+
60: 60
|
|
19
|
+
};
|
|
20
|
+
/*
|
|
21
|
+
Font weights as defined in the CSS specification.
|
|
22
|
+
@see https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
|
|
23
|
+
*/
|
|
24
|
+
const fontWeight = {
|
|
25
|
+
thin: 100,
|
|
26
|
+
extralight: 200,
|
|
27
|
+
light: 300,
|
|
28
|
+
normal: 400,
|
|
29
|
+
medium: 500,
|
|
30
|
+
semibold: 600,
|
|
31
|
+
bold: 700,
|
|
32
|
+
extrabold: 800,
|
|
33
|
+
black: 900
|
|
34
|
+
};
|
|
35
|
+
/*
|
|
36
|
+
Line heights as defined in the tailwindcss documentation.
|
|
37
|
+
@see https://v3.tailwindcss.com/docs/line-height
|
|
38
|
+
*/
|
|
39
|
+
const lineHeight = {
|
|
40
|
+
none: 1,
|
|
41
|
+
tight: 1.25,
|
|
42
|
+
snug: 1.375,
|
|
43
|
+
normal: 1.5,
|
|
44
|
+
relaxed: 1.625,
|
|
45
|
+
loose: 2
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.fontSize = fontSize;
|
|
49
|
+
exports.fontWeight = fontWeight;
|
|
50
|
+
exports.lineHeight = lineHeight;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { FontWeight, LineHeight, ResponsiveFontSize } from '../token/typography.js';
|
|
4
|
+
|
|
5
|
+
type BodySize = 'lg' | 'md' | 'sm' | 'xs';
|
|
6
|
+
type DisplaySize = 'lg' | 'md' | 'sm';
|
|
7
|
+
type HeadingSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
8
|
+
type TypographyPropsBase = {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
weight?: FontWeight;
|
|
11
|
+
lineHeight?: LineHeight;
|
|
12
|
+
} & ComponentPropsWithoutRef<'p'>;
|
|
13
|
+
type CustomTypographyProps = TypographyPropsBase & {
|
|
14
|
+
type?: 'custom';
|
|
15
|
+
size?: ResponsiveFontSize;
|
|
16
|
+
};
|
|
17
|
+
type BodyTypographyProps = TypographyPropsBase & {
|
|
18
|
+
type: 'body';
|
|
19
|
+
size?: BodySize;
|
|
20
|
+
};
|
|
21
|
+
type DisplayTypographyProps = TypographyPropsBase & {
|
|
22
|
+
type: 'display';
|
|
23
|
+
size?: DisplaySize;
|
|
24
|
+
};
|
|
25
|
+
type HeadingTypographyProps = TypographyPropsBase & {
|
|
26
|
+
type: 'heading';
|
|
27
|
+
size?: HeadingSize;
|
|
28
|
+
};
|
|
29
|
+
type TypographyProps = CustomTypographyProps | BodyTypographyProps | DisplayTypographyProps | HeadingTypographyProps;
|
|
30
|
+
declare const Typography: react.ForwardRefExoticComponent<TypographyProps & react.RefAttributes<HTMLElement>>;
|
|
31
|
+
|
|
32
|
+
export { Typography };
|
|
33
|
+
export type { BodySize, DisplaySize, HeadingSize, TypographyProps };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactPrimitive = require('@radix-ui/react-primitive');
|
|
4
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var tsPattern = require('ts-pattern');
|
|
8
|
+
var Typography_module = require('./Typography.module.css.js');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
var typography = require('../token/typography.js');
|
|
11
|
+
|
|
12
|
+
const Typography = /*#__PURE__*/react.forwardRef(({
|
|
13
|
+
asChild,
|
|
14
|
+
className,
|
|
15
|
+
style: _style,
|
|
16
|
+
color,
|
|
17
|
+
type = 'custom',
|
|
18
|
+
weight = type === 'heading' ? 'bold' : 'normal',
|
|
19
|
+
lineHeight = 'normal',
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
22
|
+
const Comp = tsPattern.match({
|
|
23
|
+
asChild,
|
|
24
|
+
type
|
|
25
|
+
}).with({
|
|
26
|
+
asChild: true
|
|
27
|
+
}, () => reactSlot.Slot).with({
|
|
28
|
+
type: 'display'
|
|
29
|
+
}, () => 'h1').with({
|
|
30
|
+
type: 'heading'
|
|
31
|
+
}, () => reactPrimitive.Primitive.h2).otherwise(() => reactPrimitive.Primitive.p);
|
|
32
|
+
const fontSize = tsPattern.match(type).with('custom', () => props.size ?? 16).with('body', () => tsPattern.match(props.size ?? 'md').with('lg', () => 18).with('md', () => 16).with('sm', () => 14).with('xs', () => 12).exhaustive()).with('display', () => tsPattern.match(props.size ?? 'md').with('lg', () => ({
|
|
33
|
+
base: 44,
|
|
34
|
+
tablet: 60
|
|
35
|
+
})).with('md', () => ({
|
|
36
|
+
base: 32,
|
|
37
|
+
tablet: 44
|
|
38
|
+
})).with('sm', () => ({
|
|
39
|
+
base: 28,
|
|
40
|
+
tablet: 36
|
|
41
|
+
})).exhaustive()).with('heading', () => tsPattern.match(props.size ?? 'md').with('xl', () => ({
|
|
42
|
+
base: 28,
|
|
43
|
+
tablet: 36
|
|
44
|
+
})).with('lg', () => ({
|
|
45
|
+
base: 24,
|
|
46
|
+
tablet: 32
|
|
47
|
+
})).with('md', () => ({
|
|
48
|
+
base: 20,
|
|
49
|
+
tablet: 24
|
|
50
|
+
})).with('sm', () => 18).with('xs', () => 16).exhaustive()).otherwise(() => 16);
|
|
51
|
+
let base;
|
|
52
|
+
let tablet;
|
|
53
|
+
let desktop;
|
|
54
|
+
if (Array.isArray(fontSize)) {
|
|
55
|
+
[base, tablet, desktop] = fontSize;
|
|
56
|
+
} else if (typeof fontSize === 'object') {
|
|
57
|
+
({
|
|
58
|
+
base,
|
|
59
|
+
tablet,
|
|
60
|
+
desktop
|
|
61
|
+
} = fontSize);
|
|
62
|
+
} else {
|
|
63
|
+
base = fontSize;
|
|
64
|
+
}
|
|
65
|
+
const style = {
|
|
66
|
+
..._style,
|
|
67
|
+
'--cocso-typography-font-color': color,
|
|
68
|
+
'--cocso-typography-font-size': `${typography.fontSize[base]}px`,
|
|
69
|
+
...(tablet !== undefined && {
|
|
70
|
+
'--cocso-tablet-typography-font-size': `${typography.fontSize[tablet]}px`
|
|
71
|
+
}),
|
|
72
|
+
...(desktop !== undefined && {
|
|
73
|
+
'--cocso-desktop-typography-font-size': `${typography.fontSize[desktop]}px`
|
|
74
|
+
}),
|
|
75
|
+
'--cocso-typography-font-weight': typography.fontWeight[weight],
|
|
76
|
+
'--cocso-typography-line-height': typography.lineHeight[lineHeight]
|
|
77
|
+
};
|
|
78
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp
|
|
79
|
+
// biome-ignore lint/suspicious/noExplicitAny: Polymorphic component with multiple element types (h1, h2, p, Slot) requires type assertion for ref compatibility
|
|
80
|
+
, {
|
|
81
|
+
...(ref && {
|
|
82
|
+
ref: ref
|
|
83
|
+
}),
|
|
84
|
+
className: clsx.clsx(Typography_module.typography, className),
|
|
85
|
+
style: style,
|
|
86
|
+
...props
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
exports.Typography = Typography;
|