@dnanpm/ui-components 0.0.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 +69 -0
- package/dist/components/Box/Box.d.ts +24 -0
- package/dist/components/Box/Box.d.ts.map +1 -0
- package/dist/components/Box/Box.types.d.ts +24 -0
- package/dist/components/Box/Box.types.d.ts.map +1 -0
- package/dist/components/Box/index.d.ts +3 -0
- package/dist/components/Box/index.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +3 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.types.d.ts +51 -0
- package/dist/components/Button/Button.types.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/index.cjs +97 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +327 -0
- package/dist/utils/cn/cn.d.ts +6 -0
- package/dist/utils/cn/cn.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# UI Components
|
|
2
|
+
|
|
3
|
+
React component library for the DNA Design System. Built with TypeScript, CSS Modules, and design tokens.
|
|
4
|
+
|
|
5
|
+
**NPM:** [`@dnanpm/ui-components`](https://www.npmjs.com/package/@dnanpm/ui-components)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @dnanpm/ui-components @dnanpm/design-tokens
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Button, Box } from '@dnanpm/ui-components';
|
|
17
|
+
import '@dnanpm/ui-components/styles.css';
|
|
18
|
+
|
|
19
|
+
function App() {
|
|
20
|
+
return (
|
|
21
|
+
<div>
|
|
22
|
+
<Button variant="primary">Primary Button</Button>
|
|
23
|
+
<Button variant="secondary" size="small">
|
|
24
|
+
Small Secondary
|
|
25
|
+
</Button>
|
|
26
|
+
<Button loading>Processing...</Button>
|
|
27
|
+
|
|
28
|
+
<Box elevation="high">
|
|
29
|
+
<h2>Elevated Content</h2>
|
|
30
|
+
</Box>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Design tokens are available as CSS custom properties: `var(--colors-primitive-pink-500)`, `var(--spacing-ui-md)`, etc.
|
|
37
|
+
|
|
38
|
+
## Components
|
|
39
|
+
|
|
40
|
+
### Button
|
|
41
|
+
|
|
42
|
+
**Variants:** `primary` | `secondary`
|
|
43
|
+
**Sizes:** `default` | `small`
|
|
44
|
+
**Features:** Loading states, full width, polymorphic (button/anchor)
|
|
45
|
+
|
|
46
|
+
### Box
|
|
47
|
+
|
|
48
|
+
**Elevations:** `none` | `low` | `high` | `extraHigh`
|
|
49
|
+
**Features:** Polymorphic rendering, ref forwarding
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pnpm build # Build library
|
|
55
|
+
pnpm dev # Watch mode
|
|
56
|
+
pnpm test # Run tests
|
|
57
|
+
pnpm lint # Lint code
|
|
58
|
+
pnpm type-check # Type checking
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
|
|
64
|
+
|
|
65
|
+
## Resources
|
|
66
|
+
|
|
67
|
+
- [How to Add a Component](../../docs/how-to/HOW-TO-COMPONENT.md)
|
|
68
|
+
- [How to Publish](../../docs/how-to/HOW-TO-PUBLISH.md)
|
|
69
|
+
- [How to Changelog](../../docs/how-to/HOW-TO-CHANGELOG.md)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Box Component
|
|
3
|
+
*
|
|
4
|
+
* A versatile container component with elevation (shadow) variants.
|
|
5
|
+
* Can be rendered as any HTML element using the polymorphic `as` prop.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Polymorphic: Render as any element (div, section, article, etc.)
|
|
9
|
+
* - Elevation: Four shadow depth levels (none, low, high, extraHigh)
|
|
10
|
+
* - Ref forwarding supported
|
|
11
|
+
* - Uses design tokens for consistent shadows
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic box with no elevation
|
|
15
|
+
* <Box>Content</Box>
|
|
16
|
+
*
|
|
17
|
+
* // Box with elevation
|
|
18
|
+
* <Box elevation="high">Elevated content</Box>
|
|
19
|
+
*
|
|
20
|
+
* // Box as section element
|
|
21
|
+
* <Box as="section" elevation="low">Section content</Box>
|
|
22
|
+
*/
|
|
23
|
+
export declare const Box: import('react').ForwardRefExoticComponent<import('./Box.types').BaseBoxProps & import('react').HTMLAttributes<HTMLElement> & import('react').RefAttributes<HTMLElement>>;
|
|
24
|
+
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,eAAO,MAAM,GAAG,0KAUf,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type BoxElevation = 'none' | 'low' | 'high' | 'extraHigh';
|
|
3
|
+
export interface BaseBoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* The element type to render
|
|
6
|
+
* @default "div"
|
|
7
|
+
*/
|
|
8
|
+
readonly as?: React.ElementType;
|
|
9
|
+
/**
|
|
10
|
+
* The elevation level (shadow depth) of the box
|
|
11
|
+
* @default "none"
|
|
12
|
+
*/
|
|
13
|
+
readonly elevation?: BoxElevation;
|
|
14
|
+
/**
|
|
15
|
+
* The content of the box
|
|
16
|
+
*/
|
|
17
|
+
readonly children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Custom className to apply to the box
|
|
20
|
+
*/
|
|
21
|
+
readonly className?: string;
|
|
22
|
+
}
|
|
23
|
+
export type BoxProps = BaseBoxProps & React.HTMLAttributes<HTMLElement>;
|
|
24
|
+
//# sourceMappingURL=Box.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Box.types.d.ts","sourceRoot":"","sources":["../../../src/components/Box/Box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;AAEjE,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,eAAO,MAAM,MAAM,+HAoDlB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface BaseButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* The visual style variant of the button
|
|
5
|
+
* @default "primary"
|
|
6
|
+
*/
|
|
7
|
+
readonly variant?: 'primary' | 'secondary';
|
|
8
|
+
/**
|
|
9
|
+
* The size variant of the button
|
|
10
|
+
* @default "default"
|
|
11
|
+
*/
|
|
12
|
+
readonly size?: 'default' | 'small';
|
|
13
|
+
/**
|
|
14
|
+
* The content of the button
|
|
15
|
+
*/
|
|
16
|
+
readonly children: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the button should take full width
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
readonly fullWidth?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the button is in a loading state
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
readonly loading?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Custom className to apply to the button
|
|
29
|
+
*/
|
|
30
|
+
readonly className?: string;
|
|
31
|
+
}
|
|
32
|
+
interface ButtonAsButton extends BaseButtonProps, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'className'> {
|
|
33
|
+
/**
|
|
34
|
+
* Render as a different element (button or anchor)
|
|
35
|
+
* @default "button"
|
|
36
|
+
*/
|
|
37
|
+
readonly as?: 'button';
|
|
38
|
+
}
|
|
39
|
+
interface ButtonAsAnchor extends BaseButtonProps, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'className'> {
|
|
40
|
+
/**
|
|
41
|
+
* Render as a different element (button or anchor)
|
|
42
|
+
*/
|
|
43
|
+
readonly as: 'a';
|
|
44
|
+
/**
|
|
45
|
+
* The URL to link to (required when as="a")
|
|
46
|
+
*/
|
|
47
|
+
readonly href: string;
|
|
48
|
+
}
|
|
49
|
+
export type ButtonProps = ButtonAsButton | ButtonAsAnchor;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=Button.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,UAAU,eAAe;IACrB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,UAAU,cACN,SACI,eAAe,EACf,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACjF;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC;CAC1B;AAED,UAAU,cACN,SACI,eAAe,EACf,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACjF;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
function cn(...inputs) {
|
|
6
|
+
const classes = [];
|
|
7
|
+
for (const input of inputs) {
|
|
8
|
+
if (!input) continue;
|
|
9
|
+
if (typeof input === "string") {
|
|
10
|
+
classes.push(input);
|
|
11
|
+
} else if (typeof input === "object") {
|
|
12
|
+
for (const [key, value] of Object.entries(input)) {
|
|
13
|
+
if (value) {
|
|
14
|
+
classes.push(key);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return classes.join(" ");
|
|
20
|
+
}
|
|
21
|
+
const box = "_box_5e7g9_14";
|
|
22
|
+
const styles$1 = {
|
|
23
|
+
box,
|
|
24
|
+
"box--none": "_box--none_5e7g9_23",
|
|
25
|
+
"box--low": "_box--low_5e7g9_27",
|
|
26
|
+
"box--high": "_box--high_5e7g9_31",
|
|
27
|
+
"box--extraHigh": "_box--extraHigh_5e7g9_35"
|
|
28
|
+
};
|
|
29
|
+
const Box = react.forwardRef(
|
|
30
|
+
({ as: Component = "div", elevation = "none", children, className, ...props }, ref) => {
|
|
31
|
+
const classes = cn(styles$1.box, styles$1[`box--${elevation}`], className);
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: classes, ...props, children });
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
Box.displayName = "Box";
|
|
36
|
+
const button = "_button_1p878_15";
|
|
37
|
+
const styles = {
|
|
38
|
+
button,
|
|
39
|
+
"button--primary": "_button--primary_1p878_45",
|
|
40
|
+
"button--secondary": "_button--secondary_1p878_58",
|
|
41
|
+
"button--default": "_button--default_1p878_73",
|
|
42
|
+
"button--small": "_button--small_1p878_77",
|
|
43
|
+
"button--fullWidth": "_button--fullWidth_1p878_84",
|
|
44
|
+
"button--loading": "_button--loading_1p878_89"
|
|
45
|
+
};
|
|
46
|
+
const Button = react.forwardRef(
|
|
47
|
+
(props, ref) => {
|
|
48
|
+
const {
|
|
49
|
+
as = "button",
|
|
50
|
+
variant = "primary",
|
|
51
|
+
size = "default",
|
|
52
|
+
fullWidth = false,
|
|
53
|
+
loading = false,
|
|
54
|
+
children,
|
|
55
|
+
className,
|
|
56
|
+
...restProps
|
|
57
|
+
} = props;
|
|
58
|
+
const classes = cn(
|
|
59
|
+
styles.button,
|
|
60
|
+
styles[`button--${variant}`],
|
|
61
|
+
styles[`button--${size}`],
|
|
62
|
+
{
|
|
63
|
+
[styles["button--fullWidth"]]: fullWidth,
|
|
64
|
+
[styles["button--loading"]]: loading
|
|
65
|
+
},
|
|
66
|
+
className
|
|
67
|
+
);
|
|
68
|
+
const content = loading ? "Loading..." : children;
|
|
69
|
+
if (as === "a") {
|
|
70
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
+
"a",
|
|
72
|
+
{
|
|
73
|
+
ref,
|
|
74
|
+
className: classes,
|
|
75
|
+
...restProps,
|
|
76
|
+
children: content
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
ref,
|
|
84
|
+
type: "button",
|
|
85
|
+
className: classes,
|
|
86
|
+
...restProps,
|
|
87
|
+
disabled: loading || restProps.disabled,
|
|
88
|
+
children: content
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
Button.displayName = "Button";
|
|
94
|
+
exports.Box = Box;
|
|
95
|
+
exports.Button = Button;
|
|
96
|
+
exports.cn = cn;
|
|
97
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/utils/cn/cn.ts","../src/components/Box/Box.tsx","../src/components/Button/Button.tsx"],"sourcesContent":["/**\n * Utility function to conditionally join class names.\n * A minimal alternative to clsx/classnames without external dependencies.\n */\nexport function cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === 'string') {\n classes.push(input);\n } else if (typeof input === 'object') {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n","/**\n * Box Component\n *\n * A versatile container component with elevation (shadow) variants.\n * Can be rendered as any HTML element using the polymorphic `as` prop.\n *\n * Features:\n * - Polymorphic: Render as any element (div, section, article, etc.)\n * - Elevation: Four shadow depth levels (none, low, high, extraHigh)\n * - Ref forwarding supported\n * - Uses design tokens for consistent shadows\n *\n * @example\n * // Basic box with no elevation\n * <Box>Content</Box>\n *\n * // Box with elevation\n * <Box elevation=\"high\">Elevated content</Box>\n *\n * // Box as section element\n * <Box as=\"section\" elevation=\"low\">Section content</Box>\n */\n\nimport { forwardRef } from 'react';\nimport { cn } from '@/utils';\nimport { BoxProps } from './Box.types';\nimport styles from './Box.module.css';\n\nexport const Box = forwardRef<HTMLElement, BoxProps>(\n ({ as: Component = 'div', elevation = 'none', children, className, ...props }, ref) => {\n const classes = cn(styles.box, styles[`box--${elevation}`], className);\n\n return (\n <Component ref={ref} className={classes} {...props}>\n {children}\n </Component>\n );\n },\n);\n\nBox.displayName = 'Box';\n","/**\n * Button Component\n *\n * This component demonstrates both approaches for using design tokens:\n * 1. CSS Variables: Used in Button.module.css (e.g., var(--colors-primitive-pink-500))\n * 2. JavaScript Imports: Available for programmatic use\n *\n * Features:\n * - Polymorphic: Can render as button or anchor (link)\n * - Variants: primary, secondary\n * - Sizes: default, small\n * - States: loading, disabled\n * - Layout: fullWidth option\n * - Ref forwarding supported\n *\n * @example\n * // Basic button\n * <Button variant=\"primary\">Click me</Button>\n *\n * // As link\n * <Button as=\"a\" href=\"/path\">Navigate</Button>\n *\n * // Loading state\n * <Button loading>Processing...</Button>\n */\n\nimport { forwardRef } from 'react';\nimport { cn } from '@/utils';\nimport type { ButtonProps } from './Button.types';\nimport styles from './Button.module.css';\n\nexport const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (props, ref) => {\n const {\n as = 'button',\n variant = 'primary',\n size = 'default',\n fullWidth = false,\n loading = false,\n children,\n className,\n ...restProps\n } = props;\n\n const classes = cn(\n styles.button,\n styles[`button--${variant}`],\n styles[`button--${size}`],\n {\n [styles['button--fullWidth']]: fullWidth,\n [styles['button--loading']]: loading,\n },\n className,\n );\n\n const content = loading ? 'Loading...' : children;\n\n if (as === 'a') {\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n className={classes}\n {...(restProps as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {content}\n </a>\n );\n }\n\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n className={classes}\n {...(restProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n disabled={\n loading || (restProps as React.ButtonHTMLAttributes<HTMLButtonElement>).disabled\n }\n >\n {content}\n </button>\n );\n },\n);\n\nButton.displayName = 'Button';\n"],"names":["forwardRef","styles","jsx"],"mappings":";;;;AAIO,SAAS,MACT,QACG;AACN,QAAM,UAAoB,CAAA;AAE1B,aAAW,SAAS,QAAQ;AACxB,QAAI,CAAC,MAAO;AAEZ,QAAI,OAAO,UAAU,UAAU;AAC3B,cAAQ,KAAK,KAAK;AAAA,IACtB,WAAW,OAAO,UAAU,UAAU;AAClC,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC9C,YAAI,OAAO;AACP,kBAAQ,KAAK,GAAG;AAAA,QACpB;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO,QAAQ,KAAK,GAAG;AAC3B;;;;;;;;;ACIO,MAAM,MAAMA,MAAAA;AAAAA,EACf,CAAC,EAAE,IAAI,YAAY,OAAO,YAAY,QAAQ,UAAU,WAAW,GAAG,MAAA,GAAS,QAAQ;AACnF,UAAM,UAAU,GAAGC,SAAO,KAAKA,SAAO,QAAQ,SAAS,EAAE,GAAG,SAAS;AAErE,0CACK,WAAA,EAAU,KAAU,WAAW,SAAU,GAAG,OACxC,UACL;AAAA,EAER;AACJ;AAEA,IAAI,cAAc;;;;;;;;;;;ACTX,MAAM,SAASD,MAAAA;AAAAA,EAClB,CAAC,OAAO,QAAQ;AACZ,UAAM;AAAA,MACF,KAAK;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACH;AAEJ,UAAM,UAAU;AAAA,MACZ,OAAO;AAAA,MACP,OAAO,WAAW,OAAO,EAAE;AAAA,MAC3B,OAAO,WAAW,IAAI,EAAE;AAAA,MACxB;AAAA,QACI,CAAC,OAAO,mBAAmB,CAAC,GAAG;AAAA,QAC/B,CAAC,OAAO,iBAAiB,CAAC,GAAG;AAAA,MAAA;AAAA,MAEjC;AAAA,IAAA;AAGJ,UAAM,UAAU,UAAU,eAAe;AAEzC,QAAI,OAAO,KAAK;AACZ,aACIE,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACG;AAAA,UACA,WAAW;AAAA,UACV,GAAI;AAAA,UAEJ,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAGb;AAEA,WACIA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACG;AAAA,QACA,MAAK;AAAA,QACL,WAAW;AAAA,QACV,GAAI;AAAA,QACL,UACI,WAAY,UAA4D;AAAA,QAG3E,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGb;AACJ;AAEA,OAAO,cAAc;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
function cn(...inputs) {
|
|
4
|
+
const classes = [];
|
|
5
|
+
for (const input of inputs) {
|
|
6
|
+
if (!input) continue;
|
|
7
|
+
if (typeof input === "string") {
|
|
8
|
+
classes.push(input);
|
|
9
|
+
} else if (typeof input === "object") {
|
|
10
|
+
for (const [key, value] of Object.entries(input)) {
|
|
11
|
+
if (value) {
|
|
12
|
+
classes.push(key);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return classes.join(" ");
|
|
18
|
+
}
|
|
19
|
+
const box = "_box_5e7g9_14";
|
|
20
|
+
const styles$1 = {
|
|
21
|
+
box,
|
|
22
|
+
"box--none": "_box--none_5e7g9_23",
|
|
23
|
+
"box--low": "_box--low_5e7g9_27",
|
|
24
|
+
"box--high": "_box--high_5e7g9_31",
|
|
25
|
+
"box--extraHigh": "_box--extraHigh_5e7g9_35"
|
|
26
|
+
};
|
|
27
|
+
const Box = forwardRef(
|
|
28
|
+
({ as: Component = "div", elevation = "none", children, className, ...props }, ref) => {
|
|
29
|
+
const classes = cn(styles$1.box, styles$1[`box--${elevation}`], className);
|
|
30
|
+
return /* @__PURE__ */ jsx(Component, { ref, className: classes, ...props, children });
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
Box.displayName = "Box";
|
|
34
|
+
const button = "_button_1p878_15";
|
|
35
|
+
const styles = {
|
|
36
|
+
button,
|
|
37
|
+
"button--primary": "_button--primary_1p878_45",
|
|
38
|
+
"button--secondary": "_button--secondary_1p878_58",
|
|
39
|
+
"button--default": "_button--default_1p878_73",
|
|
40
|
+
"button--small": "_button--small_1p878_77",
|
|
41
|
+
"button--fullWidth": "_button--fullWidth_1p878_84",
|
|
42
|
+
"button--loading": "_button--loading_1p878_89"
|
|
43
|
+
};
|
|
44
|
+
const Button = forwardRef(
|
|
45
|
+
(props, ref) => {
|
|
46
|
+
const {
|
|
47
|
+
as = "button",
|
|
48
|
+
variant = "primary",
|
|
49
|
+
size = "default",
|
|
50
|
+
fullWidth = false,
|
|
51
|
+
loading = false,
|
|
52
|
+
children,
|
|
53
|
+
className,
|
|
54
|
+
...restProps
|
|
55
|
+
} = props;
|
|
56
|
+
const classes = cn(
|
|
57
|
+
styles.button,
|
|
58
|
+
styles[`button--${variant}`],
|
|
59
|
+
styles[`button--${size}`],
|
|
60
|
+
{
|
|
61
|
+
[styles["button--fullWidth"]]: fullWidth,
|
|
62
|
+
[styles["button--loading"]]: loading
|
|
63
|
+
},
|
|
64
|
+
className
|
|
65
|
+
);
|
|
66
|
+
const content = loading ? "Loading..." : children;
|
|
67
|
+
if (as === "a") {
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
"a",
|
|
70
|
+
{
|
|
71
|
+
ref,
|
|
72
|
+
className: classes,
|
|
73
|
+
...restProps,
|
|
74
|
+
children: content
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
type: "button",
|
|
83
|
+
className: classes,
|
|
84
|
+
...restProps,
|
|
85
|
+
disabled: loading || restProps.disabled,
|
|
86
|
+
children: content
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
Button.displayName = "Button";
|
|
92
|
+
export {
|
|
93
|
+
Box,
|
|
94
|
+
Button,
|
|
95
|
+
cn
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/utils/cn/cn.ts","../src/components/Box/Box.tsx","../src/components/Button/Button.tsx"],"sourcesContent":["/**\n * Utility function to conditionally join class names.\n * A minimal alternative to clsx/classnames without external dependencies.\n */\nexport function cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === 'string') {\n classes.push(input);\n } else if (typeof input === 'object') {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n","/**\n * Box Component\n *\n * A versatile container component with elevation (shadow) variants.\n * Can be rendered as any HTML element using the polymorphic `as` prop.\n *\n * Features:\n * - Polymorphic: Render as any element (div, section, article, etc.)\n * - Elevation: Four shadow depth levels (none, low, high, extraHigh)\n * - Ref forwarding supported\n * - Uses design tokens for consistent shadows\n *\n * @example\n * // Basic box with no elevation\n * <Box>Content</Box>\n *\n * // Box with elevation\n * <Box elevation=\"high\">Elevated content</Box>\n *\n * // Box as section element\n * <Box as=\"section\" elevation=\"low\">Section content</Box>\n */\n\nimport { forwardRef } from 'react';\nimport { cn } from '@/utils';\nimport { BoxProps } from './Box.types';\nimport styles from './Box.module.css';\n\nexport const Box = forwardRef<HTMLElement, BoxProps>(\n ({ as: Component = 'div', elevation = 'none', children, className, ...props }, ref) => {\n const classes = cn(styles.box, styles[`box--${elevation}`], className);\n\n return (\n <Component ref={ref} className={classes} {...props}>\n {children}\n </Component>\n );\n },\n);\n\nBox.displayName = 'Box';\n","/**\n * Button Component\n *\n * This component demonstrates both approaches for using design tokens:\n * 1. CSS Variables: Used in Button.module.css (e.g., var(--colors-primitive-pink-500))\n * 2. JavaScript Imports: Available for programmatic use\n *\n * Features:\n * - Polymorphic: Can render as button or anchor (link)\n * - Variants: primary, secondary\n * - Sizes: default, small\n * - States: loading, disabled\n * - Layout: fullWidth option\n * - Ref forwarding supported\n *\n * @example\n * // Basic button\n * <Button variant=\"primary\">Click me</Button>\n *\n * // As link\n * <Button as=\"a\" href=\"/path\">Navigate</Button>\n *\n * // Loading state\n * <Button loading>Processing...</Button>\n */\n\nimport { forwardRef } from 'react';\nimport { cn } from '@/utils';\nimport type { ButtonProps } from './Button.types';\nimport styles from './Button.module.css';\n\nexport const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (props, ref) => {\n const {\n as = 'button',\n variant = 'primary',\n size = 'default',\n fullWidth = false,\n loading = false,\n children,\n className,\n ...restProps\n } = props;\n\n const classes = cn(\n styles.button,\n styles[`button--${variant}`],\n styles[`button--${size}`],\n {\n [styles['button--fullWidth']]: fullWidth,\n [styles['button--loading']]: loading,\n },\n className,\n );\n\n const content = loading ? 'Loading...' : children;\n\n if (as === 'a') {\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n className={classes}\n {...(restProps as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {content}\n </a>\n );\n }\n\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n className={classes}\n {...(restProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n disabled={\n loading || (restProps as React.ButtonHTMLAttributes<HTMLButtonElement>).disabled\n }\n >\n {content}\n </button>\n );\n },\n);\n\nButton.displayName = 'Button';\n"],"names":["styles"],"mappings":";;AAIO,SAAS,MACT,QACG;AACN,QAAM,UAAoB,CAAA;AAE1B,aAAW,SAAS,QAAQ;AACxB,QAAI,CAAC,MAAO;AAEZ,QAAI,OAAO,UAAU,UAAU;AAC3B,cAAQ,KAAK,KAAK;AAAA,IACtB,WAAW,OAAO,UAAU,UAAU;AAClC,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC9C,YAAI,OAAO;AACP,kBAAQ,KAAK,GAAG;AAAA,QACpB;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO,QAAQ,KAAK,GAAG;AAC3B;;;;;;;;;ACIO,MAAM,MAAM;AAAA,EACf,CAAC,EAAE,IAAI,YAAY,OAAO,YAAY,QAAQ,UAAU,WAAW,GAAG,MAAA,GAAS,QAAQ;AACnF,UAAM,UAAU,GAAGA,SAAO,KAAKA,SAAO,QAAQ,SAAS,EAAE,GAAG,SAAS;AAErE,+BACK,WAAA,EAAU,KAAU,WAAW,SAAU,GAAG,OACxC,UACL;AAAA,EAER;AACJ;AAEA,IAAI,cAAc;;;;;;;;;;;ACTX,MAAM,SAAS;AAAA,EAClB,CAAC,OAAO,QAAQ;AACZ,UAAM;AAAA,MACF,KAAK;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACH;AAEJ,UAAM,UAAU;AAAA,MACZ,OAAO;AAAA,MACP,OAAO,WAAW,OAAO,EAAE;AAAA,MAC3B,OAAO,WAAW,IAAI,EAAE;AAAA,MACxB;AAAA,QACI,CAAC,OAAO,mBAAmB,CAAC,GAAG;AAAA,QAC/B,CAAC,OAAO,iBAAiB,CAAC,GAAG;AAAA,MAAA;AAAA,MAEjC;AAAA,IAAA;AAGJ,UAAM,UAAU,UAAU,eAAe;AAEzC,QAAI,OAAO,KAAK;AACZ,aACI;AAAA,QAAC;AAAA,QAAA;AAAA,UACG;AAAA,UACA,WAAW;AAAA,UACV,GAAI;AAAA,UAEJ,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAGb;AAEA,WACI;AAAA,MAAC;AAAA,MAAA;AAAA,QACG;AAAA,QACA,MAAK;AAAA,QACL,WAAW;AAAA,QACV,GAAI;AAAA,QACL,UACI,WAAY,UAA4D;AAAA,QAG3E,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGb;AACJ;AAEA,OAAO,cAAc;"}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly, this file was auto-generated.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--colors-primitive-neutral-100: #ffffff;
|
|
7
|
+
--colors-primitive-neutral-200: #f7f7f7;
|
|
8
|
+
--colors-primitive-neutral-300: #efeeed;
|
|
9
|
+
--colors-primitive-neutral-400: #e7e5e3;
|
|
10
|
+
--colors-primitive-neutral-500: #d4d2ce;
|
|
11
|
+
--colors-primitive-neutral-600: #948b89;
|
|
12
|
+
--colors-primitive-neutral-700: #505050;
|
|
13
|
+
--colors-primitive-neutral-800: #121212;
|
|
14
|
+
--colors-primitive-neutral-900: #000000;
|
|
15
|
+
--colors-primitive-pink-200: #ffbfe0;
|
|
16
|
+
--colors-primitive-pink-300: #ff82c1;
|
|
17
|
+
--colors-primitive-pink-400: #f7007f;
|
|
18
|
+
--colors-primitive-pink-500: #da0070;
|
|
19
|
+
--colors-primitive-pink-600: #ae005a;
|
|
20
|
+
--colors-primitive-plum-200: #792a59;
|
|
21
|
+
--colors-primitive-plum-300: #732654;
|
|
22
|
+
--colors-primitive-plum-400: #69214c;
|
|
23
|
+
--colors-primitive-plum-500: #551c3e;
|
|
24
|
+
--colors-primitive-plum-600: #441632;
|
|
25
|
+
--colors-primitive-sand-200: #fdfbfa;
|
|
26
|
+
--colors-primitive-sand-300: #f8f4f1;
|
|
27
|
+
--colors-primitive-sand-400: #efeae4;
|
|
28
|
+
--colors-primitive-sand-500: #ede8e1;
|
|
29
|
+
--colors-primitive-sand-600: #cabca7;
|
|
30
|
+
--colors-primitive-lemon-300: #fffaba;
|
|
31
|
+
--colors-primitive-lemon-400: #fff9a3;
|
|
32
|
+
--colors-primitive-lemon-500: #fff347;
|
|
33
|
+
--colors-primitive-orange-300: #ffdbad;
|
|
34
|
+
--colors-primitive-orange-400: #ffca85;
|
|
35
|
+
--colors-primitive-orange-500: #ffa633;
|
|
36
|
+
--colors-primitive-orange-600: #eb6600;
|
|
37
|
+
--colors-primitive-sky-300: #96e4f8;
|
|
38
|
+
--colors-primitive-sky-400: #77dcf5;
|
|
39
|
+
--colors-primitive-sky-500: #2ecaf0;
|
|
40
|
+
--colors-primitive-blue-400: #d8e9ff;
|
|
41
|
+
--colors-primitive-blue-500: #0064e2;
|
|
42
|
+
--colors-primitive-red-500: #dd0a0a;
|
|
43
|
+
--colors-primitive-green-500: #008500;
|
|
44
|
+
--colors-primitive-teal-500: #0b7c99;
|
|
45
|
+
--colors-semantic-foreground-default: #121212;
|
|
46
|
+
--colors-semantic-foreground-muted: #505050;
|
|
47
|
+
--colors-semantic-foreground-inverse: #ffffff;
|
|
48
|
+
--colors-semantic-foreground-primary-strong: #da0070;
|
|
49
|
+
--colors-semantic-foreground-primary-mid: #ff82c1;
|
|
50
|
+
--colors-semantic-foreground-primary-soft: #ffbfe0;
|
|
51
|
+
--colors-semantic-foreground-secondary-strong: #551c3e;
|
|
52
|
+
--colors-semantic-foreground-secondary-mid: #69214c;
|
|
53
|
+
--colors-semantic-foreground-secondary-soft: #792a59;
|
|
54
|
+
--colors-semantic-foreground-status-error: #dd0a0a;
|
|
55
|
+
--colors-semantic-foreground-status-warning: #eb6600;
|
|
56
|
+
--colors-semantic-foreground-status-success: #008500;
|
|
57
|
+
--colors-semantic-foreground-status-info: #0b7c99;
|
|
58
|
+
--colors-semantic-foreground-link: #da0070;
|
|
59
|
+
--colors-semantic-foreground-link-inverse: #ffffff;
|
|
60
|
+
--colors-semantic-foreground-link-hover: #ae005a;
|
|
61
|
+
--colors-semantic-foreground-link-inverse-hover: rgba(255, 255, 255, 0.8);
|
|
62
|
+
--colors-semantic-surface-base: #ffffff;
|
|
63
|
+
--colors-semantic-surface-neutral-soft: #fdfbfa;
|
|
64
|
+
--colors-semantic-surface-neutral-mid: #f8f4f1;
|
|
65
|
+
--colors-semantic-surface-neutral-strong: #ede8e1;
|
|
66
|
+
--colors-semantic-surface-primary-strong: #da0070;
|
|
67
|
+
--colors-semantic-surface-primary-mid: #ff82c1;
|
|
68
|
+
--colors-semantic-surface-primary-soft: #ffbfe0;
|
|
69
|
+
--colors-semantic-surface-secondary-strong: #551c3e;
|
|
70
|
+
--colors-semantic-surface-secondary-mid: #69214c;
|
|
71
|
+
--colors-semantic-surface-secondary-soft: #792a59;
|
|
72
|
+
--colors-semantic-border-neutral-mid: #d4d2ce;
|
|
73
|
+
--colors-semantic-border-neutral-soft: #e7e5e3;
|
|
74
|
+
--colors-semantic-border-neutral-base: #efeeed;
|
|
75
|
+
--colors-semantic-border-neutral-strong: #948b89;
|
|
76
|
+
--colors-semantic-border-secondary: #551c3e;
|
|
77
|
+
--colors-semantic-border-primary: #da0070;
|
|
78
|
+
--colors-semantic-border-focus: #0064e2;
|
|
79
|
+
--colors-semantic-border-inverse: #ffffff;
|
|
80
|
+
--colors-semantic-border-error: #dd0a0a;
|
|
81
|
+
--colors-semantic-border-warning: #eb6600;
|
|
82
|
+
--colors-semantic-border-success: #008500;
|
|
83
|
+
--colors-semantic-border-info: #0b7c99;
|
|
84
|
+
--colors-semantic-utility-focus-soft: #d8e9ff;
|
|
85
|
+
--colors-semantic-utility-focus-strong: #0064e2;
|
|
86
|
+
--colors-semantic-utility-overlay-strong: rgba(85, 28, 62, 0.4);
|
|
87
|
+
--colors-semantic-utility-overlay-soft: rgba(85, 28, 62, 0.1);
|
|
88
|
+
--colors-semantic-status-info: #0b7c99;
|
|
89
|
+
--colors-semantic-status-success: #008500;
|
|
90
|
+
--colors-semantic-status-warning: #eb6600;
|
|
91
|
+
--colors-semantic-status-error: #dd0a0a;
|
|
92
|
+
--colors-semantic-accent-lemon-300: #fffaba;
|
|
93
|
+
--colors-semantic-accent-lemon-400: #fff9a3;
|
|
94
|
+
--colors-semantic-accent-lemon-500: #fff347;
|
|
95
|
+
--colors-semantic-accent-orange-300: #ffdbad;
|
|
96
|
+
--colors-semantic-accent-orange-400: #ffca85;
|
|
97
|
+
--colors-semantic-accent-orange-500: #ffa633;
|
|
98
|
+
--colors-semantic-accent-sky-300: #96e4f8;
|
|
99
|
+
--colors-semantic-accent-sky-400: #77dcf5;
|
|
100
|
+
--colors-semantic-accent-sky-500: #2ecaf0;
|
|
101
|
+
--colors-semantic-interactive-primary-default: #da0070;
|
|
102
|
+
--colors-semantic-interactive-primary-hover: #ae005a;
|
|
103
|
+
--colors-semantic-interactive-primary-active: #f7007f;
|
|
104
|
+
--colors-semantic-interactive-primary-disabled: rgba(218, 0, 112, 0.3);
|
|
105
|
+
--colors-semantic-interactive-primary-focus: #ae005a;
|
|
106
|
+
--colors-semantic-interactive-secondary-default: #551c3e;
|
|
107
|
+
--colors-semantic-interactive-secondary-hover: #441632;
|
|
108
|
+
--colors-semantic-interactive-secondary-focus: #441632;
|
|
109
|
+
--colors-semantic-interactive-secondary-active: #732654;
|
|
110
|
+
--colors-semantic-interactive-secondary-disabled: rgba(85, 28, 62, 0.3);
|
|
111
|
+
--colors-semantic-interactive-neutral-default: #ede8e1;
|
|
112
|
+
--colors-semantic-interactive-neutral-hover: #cabca7;
|
|
113
|
+
--colors-semantic-interactive-neutral-focus: #cabca7;
|
|
114
|
+
--colors-semantic-interactive-neutral-active: #efeae4;
|
|
115
|
+
--colors-semantic-interactive-neutral-disabled: rgba(237, 232, 225, 0.3);
|
|
116
|
+
--colors-semantic-interactive-focus-ring: #0064e2;
|
|
117
|
+
--colors-semantic-interactive-focus-ring-weak: #d8e9ff;
|
|
118
|
+
--spacing-ui-md: 16px;
|
|
119
|
+
--spacing-ui-lg: 20px;
|
|
120
|
+
--spacing-ui-sm: 12px;
|
|
121
|
+
--spacing-ui-xl: 24px;
|
|
122
|
+
--spacing-ui-xs: 8px;
|
|
123
|
+
--spacing-ui-xxs: 4px;
|
|
124
|
+
--spacing-ui-xxl: 32px;
|
|
125
|
+
--spacing-ui-none: 0px;
|
|
126
|
+
--spacing-primitive-size0: 0px;
|
|
127
|
+
--spacing-primitive-size8: 8px;
|
|
128
|
+
--spacing-primitive-size16: 16px;
|
|
129
|
+
--spacing-primitive-size24: 24px;
|
|
130
|
+
--spacing-primitive-size32: 32px;
|
|
131
|
+
--spacing-primitive-size40: 40px;
|
|
132
|
+
--spacing-primitive-size12: 12px;
|
|
133
|
+
--spacing-primitive-size20: 20px;
|
|
134
|
+
--spacing-primitive-size4: 4px;
|
|
135
|
+
--spacing-primitive-size2: 2px;
|
|
136
|
+
--spacing-primitive-size48: 48px;
|
|
137
|
+
--spacing-primitive-size56: 56px;
|
|
138
|
+
--spacing-primitive-size64: 64px;
|
|
139
|
+
--spacing-primitive-size72: 72px;
|
|
140
|
+
--spacing-primitive-size80: 80px;
|
|
141
|
+
--spacing-primitive-size88: 88px;
|
|
142
|
+
--spacing-primitive-size96: 96px;
|
|
143
|
+
--spacing-primitive-size104: 104px;
|
|
144
|
+
--spacing-primitive-size112: 112px;
|
|
145
|
+
--spacing-primitive-size120: 120px;
|
|
146
|
+
--spacing-primitive-size128: 128px;
|
|
147
|
+
--spacing-primitive-size136: 136px;
|
|
148
|
+
--spacing-primitive-size144: 144px;
|
|
149
|
+
--spacing-primitive-size152: 152px;
|
|
150
|
+
--spacing-primitive-size160: 160px;
|
|
151
|
+
--spacing-layout-none: 0px;
|
|
152
|
+
--spacing-layout-xxs: 16px;
|
|
153
|
+
--spacing-layout-xs: 32px;
|
|
154
|
+
--spacing-layout-sm: 48px;
|
|
155
|
+
--spacing-layout-md: 64px;
|
|
156
|
+
--spacing-layout-lg: 80px;
|
|
157
|
+
--spacing-layout-xl: 96px;
|
|
158
|
+
--spacing-layout-xxl: 112px;
|
|
159
|
+
--radius-semantic-none: 0px;
|
|
160
|
+
--radius-semantic-sm: 4px;
|
|
161
|
+
--radius-semantic-md: 8px;
|
|
162
|
+
--radius-semantic-lg: 12px;
|
|
163
|
+
--radius-semantic-full: 1000px;
|
|
164
|
+
--radius-primitive-size0: 0px;
|
|
165
|
+
--radius-primitive-size4: 4px;
|
|
166
|
+
--radius-primitive-size8: 8px;
|
|
167
|
+
--radius-primitive-size12: 12px;
|
|
168
|
+
--radius-primitive-size1000: 1000px;
|
|
169
|
+
--borderwidth-semantic-none: 0px;
|
|
170
|
+
--borderwidth-semantic-xs: 1px;
|
|
171
|
+
--borderwidth-semantic-md: 3px;
|
|
172
|
+
--borderwidth-semantic-lg: 4px;
|
|
173
|
+
--borderwidth-semantic-xl: 5px;
|
|
174
|
+
--borderwidth-semantic-xxl: 6px;
|
|
175
|
+
--borderwidth-semantic-sm: 2px;
|
|
176
|
+
--borderwidth-primitive-size0: 0px;
|
|
177
|
+
--borderwidth-primitive-size1: 1px;
|
|
178
|
+
--borderwidth-primitive-size2: 2px;
|
|
179
|
+
--borderwidth-primitive-size3: 3px;
|
|
180
|
+
--borderwidth-primitive-size4: 4px;
|
|
181
|
+
--borderwidth-primitive-size5: 5px;
|
|
182
|
+
--borderwidth-primitive-size6: 6px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
html {
|
|
186
|
+
font-synthesis: none;
|
|
187
|
+
text-rendering: optimizeLegibility;
|
|
188
|
+
-webkit-font-smoothing: antialiased;
|
|
189
|
+
-moz-osx-font-smoothing: grayscale;
|
|
190
|
+
-webkit-text-size-adjust: 100%;
|
|
191
|
+
|
|
192
|
+
scroll-behavior: smooth;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Box Component Styles
|
|
196
|
+
*
|
|
197
|
+
* Design tokens are consumed via CSS custom properties (variables).
|
|
198
|
+
* These variables come from @dnanpm/design-tokens package.
|
|
199
|
+
*
|
|
200
|
+
* Elevation shadows based on DNA Design System specifications:
|
|
201
|
+
* - None: No shadow
|
|
202
|
+
* - Low: Subtle depth (0 2px 16px rgba(18, 18, 18, 0.06))
|
|
203
|
+
* - High: Medium depth (0 6px 24px rgba(18, 18, 18, 0.08))
|
|
204
|
+
* - Extra High: Maximum depth (0 8px 64px rgba(18, 18, 18, 0.16))
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
._box_5e7g9_14 {
|
|
208
|
+
display: block;
|
|
209
|
+
padding: var(--spacing-ui-md, 1rem);
|
|
210
|
+
border-radius: var(--radius-semantic-md, 0.5rem);
|
|
211
|
+
background-color: var(--colors-primitive-neutral-0, #ffffff);
|
|
212
|
+
transition: box-shadow 0.2s ease-in-out;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* Elevation Variants */
|
|
216
|
+
._box--none_5e7g9_23 {
|
|
217
|
+
box-shadow: none;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
._box--low_5e7g9_27 {
|
|
221
|
+
box-shadow: 0 2px 16px rgba(18, 18, 18, 0.06);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
._box--high_5e7g9_31 {
|
|
225
|
+
box-shadow: 0 6px 24px rgba(18, 18, 18, 0.08);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
._box--extraHigh_5e7g9_35 {
|
|
229
|
+
box-shadow: 0 8px 64px rgba(18, 18, 18, 0.16);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Button Component Styles
|
|
233
|
+
*
|
|
234
|
+
* Design tokens are consumed via CSS custom properties (variables).
|
|
235
|
+
* These variables come from @dnanpm/design-tokens package.
|
|
236
|
+
*
|
|
237
|
+
* Examples:
|
|
238
|
+
* - Colors: var(--colors-primitive-pink-500)
|
|
239
|
+
* - Spacing: var(--spacing-ui-md)
|
|
240
|
+
* - Border radius: var(--radius-semantic-md)
|
|
241
|
+
*
|
|
242
|
+
* Fallback values are defined in src/styles/base.css
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
._button_1p878_15 {
|
|
246
|
+
display: inline-flex;
|
|
247
|
+
align-items: center;
|
|
248
|
+
justify-content: center;
|
|
249
|
+
height: 2.5rem;
|
|
250
|
+
padding: 0 var(--spacing-ui-md, 1rem);
|
|
251
|
+
font-family:
|
|
252
|
+
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell',
|
|
253
|
+
sans-serif;
|
|
254
|
+
font-size: 0.875rem;
|
|
255
|
+
font-weight: 500;
|
|
256
|
+
border-radius: var(--radius-semantic-md, 0.5rem);
|
|
257
|
+
border: 1px solid transparent;
|
|
258
|
+
cursor: pointer;
|
|
259
|
+
transition: all 0.15s ease-in-out;
|
|
260
|
+
text-decoration: none;
|
|
261
|
+
white-space: nowrap;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
._button_1p878_15:focus-visible {
|
|
265
|
+
outline: 2px solid var(--colors-primitive-utility-focusstrong, #1d4ed8);
|
|
266
|
+
outline-offset: 2px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
._button_1p878_15:disabled {
|
|
270
|
+
opacity: 0.5;
|
|
271
|
+
cursor: not-allowed;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Button Variants */
|
|
275
|
+
._button--primary_1p878_45 {
|
|
276
|
+
background-color: var(--colors-primitive-pink-500, #ec4899);
|
|
277
|
+
color: white;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
._button--primary_1p878_45:hover:not(:disabled) {
|
|
281
|
+
background-color: var(--colors-primitive-pink-600, #db2777);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
._button--primary_1p878_45:active:not(:disabled) {
|
|
285
|
+
background-color: var(--colors-primitive-pink-400, #f472b6);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
._button--secondary_1p878_58 {
|
|
289
|
+
background-color: var(--colors-primitive-neutral-100, #f5f5f5);
|
|
290
|
+
color: var(--colors-primitive-neutral-900, #171717);
|
|
291
|
+
border-color: var(--colors-primitive-neutral-300, #d4d4d4);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
._button--secondary_1p878_58:hover:not(:disabled) {
|
|
295
|
+
background-color: var(--colors-primitive-neutral-200, #e5e5e5);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
._button--secondary_1p878_58:active:not(:disabled) {
|
|
299
|
+
background-color: var(--colors-primitive-neutral-300, #d4d4d4);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* Size Variants */
|
|
303
|
+
._button--default_1p878_73 {
|
|
304
|
+
/* Default size (already set in base styles) */
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
._button--small_1p878_77 {
|
|
308
|
+
height: 2rem;
|
|
309
|
+
padding: 0 var(--spacing-ui-sm, 0.75rem);
|
|
310
|
+
font-size: 0.75rem;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/* Layout Modifiers */
|
|
314
|
+
._button--fullWidth_1p878_84 {
|
|
315
|
+
width: 100%;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* State Modifiers */
|
|
319
|
+
._button--loading_1p878_89 {
|
|
320
|
+
opacity: 0.7;
|
|
321
|
+
cursor: wait;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
._button--loading_1p878_89:hover {
|
|
325
|
+
/* Prevent hover effects when loading */
|
|
326
|
+
background-color: inherit;
|
|
327
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to conditionally join class names.
|
|
3
|
+
* A minimal alternative to clsx/classnames without external dependencies.
|
|
4
|
+
*/
|
|
5
|
+
export declare function cn(...inputs: (string | undefined | null | false | Record<string, boolean>)[]): string;
|
|
6
|
+
//# sourceMappingURL=cn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../../src/utils/cn/cn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,EAAE,CACd,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,GAC3E,MAAM,CAkBR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dnanpm/ui-components",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "DNA Design System - React UI Components",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./styles.css": "./dist/styles.css"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"ui-components",
|
|
22
|
+
"react",
|
|
23
|
+
"design-system",
|
|
24
|
+
"DTCG"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
34
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@storybook/react-vite": "^10.2.17",
|
|
38
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
39
|
+
"@testing-library/react": "^16.1.0",
|
|
40
|
+
"@testing-library/user-event": "^14.5.2",
|
|
41
|
+
"@types/react": "^19.2.14",
|
|
42
|
+
"@types/react-dom": "^19.2.3",
|
|
43
|
+
"@vitejs/plugin-react": "^5.1.4",
|
|
44
|
+
"eslint": "^9.39.2",
|
|
45
|
+
"jsdom": "^28.1.0",
|
|
46
|
+
"prettier": "^3.8.1",
|
|
47
|
+
"react": "^19.2.4",
|
|
48
|
+
"react-dom": "^19.2.4",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"vite": "^7.3.1",
|
|
51
|
+
"vite-plugin-dts": "^4.5.4",
|
|
52
|
+
"vitest": "^4.0.18",
|
|
53
|
+
"@dnanpm/design-tokens": "0.0.1",
|
|
54
|
+
"@repo/eslint-config": "0.0.0",
|
|
55
|
+
"@repo/typescript-config": "0.0.0"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "https://github.com/DNA-Online-Services/dna-design-system.git",
|
|
60
|
+
"directory": "packages/ui-components"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/DNA-Online-Services/dna-design-system/tree/main/packages/ui-components#readme",
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsc --project tsconfig.build.json && vite build",
|
|
65
|
+
"dev": "vite build --watch",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"test:watch": "vitest",
|
|
68
|
+
"format": "prettier --write .",
|
|
69
|
+
"format:check": "prettier --check .",
|
|
70
|
+
"lint": "eslint .",
|
|
71
|
+
"lint:fix": "eslint . --fix",
|
|
72
|
+
"clean": "rm -rf dist node_modules",
|
|
73
|
+
"type-check": "tsc --noEmit",
|
|
74
|
+
"tar": "bash scripts/generate-tar.sh"
|
|
75
|
+
}
|
|
76
|
+
}
|