pathum-ds-library 0.0.8
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 +162 -0
- package/dist/index.d.cts +64 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +485 -0
- package/dist/index.mjs +462 -0
- package/package.json +50 -0
- package/src/styles/globals.css +19 -0
- package/src/styles/theme.css +1195 -0
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# pathum-ds-library
|
|
2
|
+
|
|
3
|
+
KAST Design System — A React component library built with
|
|
4
|
+
React Aria, Tailwind CSS v4, and CVA. Components and design
|
|
5
|
+
tokens are generated directly from Figma.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
npm install pathum-ds-library
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
### 1. Import styles once in your root CSS file
|
|
14
|
+
|
|
15
|
+
This loads all design tokens (colors, typography, spacing,
|
|
16
|
+
radius, shadows) and the Inter font automatically:
|
|
17
|
+
|
|
18
|
+
@import "pathum-ds-library/styles";
|
|
19
|
+
|
|
20
|
+
Or if you use Tailwind CSS v4:
|
|
21
|
+
|
|
22
|
+
@import "tailwindcss";
|
|
23
|
+
@import "pathum-ds-library/styles";
|
|
24
|
+
|
|
25
|
+
### 2. Use components
|
|
26
|
+
|
|
27
|
+
import { Button, Input } from 'pathum-ds-library'
|
|
28
|
+
|
|
29
|
+
export default function Page() {
|
|
30
|
+
return (
|
|
31
|
+
<div>
|
|
32
|
+
<Button hierarchy="primary" size="md">
|
|
33
|
+
Save changes
|
|
34
|
+
</Button>
|
|
35
|
+
<Input
|
|
36
|
+
label="Email"
|
|
37
|
+
placeholder="you@company.com"
|
|
38
|
+
hint="We will never share your email."
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
## Components
|
|
45
|
+
|
|
46
|
+
### Button
|
|
47
|
+
|
|
48
|
+
import { Button } from 'pathum-ds-library'
|
|
49
|
+
|
|
50
|
+
Props:
|
|
51
|
+
- hierarchy: "primary" | "secondary-gray" | "secondary-color" | "tertiary-gray" | "tertiary-color" | "link-gray" | "link-color"
|
|
52
|
+
- size: "sm" | "md" | "lg" | "xl" | "2xl"
|
|
53
|
+
- isDisabled: boolean
|
|
54
|
+
- iconLeft: ReactNode
|
|
55
|
+
- iconRight: ReactNode
|
|
56
|
+
- iconOnly: ReactNode
|
|
57
|
+
- dotLeading: boolean
|
|
58
|
+
- className: string
|
|
59
|
+
|
|
60
|
+
Examples:
|
|
61
|
+
<Button hierarchy="primary" size="md">Save</Button>
|
|
62
|
+
<Button hierarchy="secondary-gray" size="sm">Cancel</Button>
|
|
63
|
+
<Button hierarchy="primary" size="md" isDisabled>Disabled</Button>
|
|
64
|
+
|
|
65
|
+
### Input
|
|
66
|
+
|
|
67
|
+
import { Input } from 'pathum-ds-library'
|
|
68
|
+
|
|
69
|
+
Props:
|
|
70
|
+
- label: string
|
|
71
|
+
- placeholder: string
|
|
72
|
+
- hint: string
|
|
73
|
+
- errorMessage: string
|
|
74
|
+
- destructive: boolean
|
|
75
|
+
- isDisabled: boolean
|
|
76
|
+
- size: "sm" | "md"
|
|
77
|
+
- composition: "default" | "icon-leading" | "leading-dropdown" | "trailing-dropdown" | "leading-text" | "payment-input" | "trailing-button" | "tags"
|
|
78
|
+
- className: string
|
|
79
|
+
|
|
80
|
+
Examples:
|
|
81
|
+
<Input label="Email" placeholder="you@company.com" />
|
|
82
|
+
<Input label="Email" destructive errorMessage="Invalid email" />
|
|
83
|
+
<Input label="Email" isDisabled />
|
|
84
|
+
<Input label="Email" hint="We will never share your email." />
|
|
85
|
+
|
|
86
|
+
## Design Tokens
|
|
87
|
+
|
|
88
|
+
All tokens are available as CSS variables after importing styles.
|
|
89
|
+
|
|
90
|
+
### Colors
|
|
91
|
+
--color-brand-500
|
|
92
|
+
--color-brand-600
|
|
93
|
+
--color-brand-700
|
|
94
|
+
--color-text-primary
|
|
95
|
+
--color-text-secondary
|
|
96
|
+
--color-text-tertiary
|
|
97
|
+
--color-text-white
|
|
98
|
+
--color-bg-primary
|
|
99
|
+
--color-bg-secondary
|
|
100
|
+
--color-border-primary
|
|
101
|
+
--color-border-secondary
|
|
102
|
+
--color-border-brand
|
|
103
|
+
--color-border-error
|
|
104
|
+
|
|
105
|
+
### Typography
|
|
106
|
+
--font-body: "Inter", sans-serif
|
|
107
|
+
--text-xs: 0.75rem
|
|
108
|
+
--text-sm: 0.875rem
|
|
109
|
+
--text-md: 1rem
|
|
110
|
+
--text-lg: 1.125rem
|
|
111
|
+
--text-xl: 1.25rem
|
|
112
|
+
--text-display-xs
|
|
113
|
+
--text-display-sm
|
|
114
|
+
--text-display-md
|
|
115
|
+
--text-display-lg
|
|
116
|
+
--text-display-xl
|
|
117
|
+
--text-display-2xl
|
|
118
|
+
|
|
119
|
+
### Spacing
|
|
120
|
+
--spacing-1: 4px
|
|
121
|
+
--spacing-2: 8px
|
|
122
|
+
--spacing-3: 12px
|
|
123
|
+
--spacing-4: 16px
|
|
124
|
+
--spacing-5: 20px
|
|
125
|
+
--spacing-6: 24px
|
|
126
|
+
--spacing-8: 32px
|
|
127
|
+
--spacing-10: 40px
|
|
128
|
+
--spacing-12: 48px
|
|
129
|
+
|
|
130
|
+
### Border Radius
|
|
131
|
+
--radius-none: 0px
|
|
132
|
+
--radius-xs: 2px
|
|
133
|
+
--radius-sm: 6px
|
|
134
|
+
--radius-md: 8px
|
|
135
|
+
--radius-lg: 10px
|
|
136
|
+
--radius-xl: 12px
|
|
137
|
+
--radius-2xl: 16px
|
|
138
|
+
--radius-full: 9999px
|
|
139
|
+
|
|
140
|
+
### Shadows
|
|
141
|
+
--shadow-xs
|
|
142
|
+
--shadow-sm
|
|
143
|
+
--shadow-md
|
|
144
|
+
--shadow-lg
|
|
145
|
+
|
|
146
|
+
### Dark Mode
|
|
147
|
+
Dark mode is supported automatically. Add the .dark class
|
|
148
|
+
to your html element to activate dark mode:
|
|
149
|
+
|
|
150
|
+
html class="dark"
|
|
151
|
+
|
|
152
|
+
All semantic color tokens update automatically in dark mode.
|
|
153
|
+
|
|
154
|
+
## Tech Stack
|
|
155
|
+
- React 19 + TypeScript
|
|
156
|
+
- React Aria Components (accessibility)
|
|
157
|
+
- Tailwind CSS v4
|
|
158
|
+
- Class Variance Authority (CVA)
|
|
159
|
+
- Inter font via @fontsource/inter
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
ISC
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { ReactNode, JSX } from 'react';
|
|
4
|
+
import { ButtonProps as ButtonProps$1, TextFieldProps } from 'react-aria-components';
|
|
5
|
+
import { ClassValue } from 'clsx';
|
|
6
|
+
|
|
7
|
+
declare const buttonVariants: (props?: ({
|
|
8
|
+
hierarchy?: "primary" | "secondary-gray" | "secondary-color" | "tertiary-gray" | "tertiary-color" | "link-gray" | "link-color" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | "xl" | "2xl" | null | undefined;
|
|
10
|
+
layoutMode?: "labeled" | "iconOnly" | null | undefined;
|
|
11
|
+
dotLeading?: boolean | null | undefined;
|
|
12
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
+
type ButtonVariantsFromCva = Pick<VariantProps<typeof buttonVariants>, "hierarchy" | "size">;
|
|
14
|
+
interface ButtonProps extends Omit<ButtonProps$1, "children" | "className">, ButtonVariantsFromCva {
|
|
15
|
+
className?: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
iconLeft?: ReactNode;
|
|
18
|
+
iconRight?: ReactNode;
|
|
19
|
+
/** Figma Icon=Only — single centered glyph. */
|
|
20
|
+
iconOnly?: ReactNode;
|
|
21
|
+
/** Figma Dot leading — 8×8 leading indicator (not valid on link-* hierarchies). */
|
|
22
|
+
dotLeading?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare function Button({ hierarchy, size, className, children, iconLeft, iconRight, iconOnly, dotLeading, isDisabled, ...rest }: ButtonProps): JSX.Element;
|
|
25
|
+
|
|
26
|
+
/** Figma Input field (`9:2`) composition variants — Size × Type × Destructive × State matrix. */
|
|
27
|
+
type InputComposition = "default" | "icon-leading" | "leading-dropdown" | "trailing-dropdown" | "leading-text" | "payment-input" | "tags" | "trailing-button";
|
|
28
|
+
interface InputProps extends Omit<TextFieldProps, "children" | "className" | "isInvalid" | "validationBehavior"> {
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Figma Size — `sm` | `md`. */
|
|
31
|
+
size?: "sm" | "md";
|
|
32
|
+
/** Figma Type — composition layout inside the bordered shell. */
|
|
33
|
+
composition?: InputComposition;
|
|
34
|
+
/** Figma Destructive=True — `border-error`, invalid field; hint row shows error styling when `errorMessage` is set. */
|
|
35
|
+
destructive?: boolean;
|
|
36
|
+
label?: ReactNode;
|
|
37
|
+
hint?: ReactNode;
|
|
38
|
+
/** Under-field message when destructive (stays `--color-text-error-primary` even when disabled — Figma `5:104`). */
|
|
39
|
+
errorMessage?: ReactNode;
|
|
40
|
+
/** Shown before the text value (`Icon leading`). */
|
|
41
|
+
leadingIcon?: ReactNode;
|
|
42
|
+
/** Prefix dropdown (`Leading dropdown`) — Figma sample uses country + chevron in `pl-[14px] pr-[8px]` zone. */
|
|
43
|
+
leadingDropdown?: ReactNode;
|
|
44
|
+
/** Suffix dropdown (`Trailing dropdown`) — mirrored paddings from leading-dropdown samples. */
|
|
45
|
+
trailingDropdown?: ReactNode;
|
|
46
|
+
/** Static prefix strip (`Leading text`) — e.g. `https://` on `--color-bg-secondary`, `pl-[14px] pr-[12px]`. */
|
|
47
|
+
leadingText?: ReactNode;
|
|
48
|
+
/** Card artwork (`Payment input`) — parent applies 32×20, radius 4px, `#99abbf` stroke frame. */
|
|
49
|
+
paymentGraphic?: ReactNode;
|
|
50
|
+
/** Tag chips (`Tags`) — rendered before the editable input with 8px gaps. */
|
|
51
|
+
tags?: ReactNode;
|
|
52
|
+
/** Trailing action (`Trailing button`) — placed after divider (`border-secondary` rule); label 14px/20 Medium per Figma `8:177`. */
|
|
53
|
+
trailingButton?: ReactNode;
|
|
54
|
+
/** Trailing help affordance — 16×16 frame, 1.5px border, 8px radius; border `--color-fg-tertiary` / `--color-fg-disabled`. */
|
|
55
|
+
helpIcon?: ReactNode;
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
inputClassName?: string;
|
|
58
|
+
}
|
|
59
|
+
declare function Input({ size, composition, destructive, label, hint, errorMessage, leadingIcon, leadingDropdown, trailingDropdown, leadingText, paymentGraphic, tags, trailingButton, helpIcon, placeholder, inputClassName, className, isDisabled, ...rest }: InputProps): JSX.Element;
|
|
60
|
+
|
|
61
|
+
/** Merge class lists and resolve Tailwind conflicts (later wins). */
|
|
62
|
+
declare function cx(...inputs: ClassValue[]): string;
|
|
63
|
+
|
|
64
|
+
export { Button, type ButtonProps, Input, type InputComposition, type InputProps, cx };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { ReactNode, JSX } from 'react';
|
|
4
|
+
import { ButtonProps as ButtonProps$1, TextFieldProps } from 'react-aria-components';
|
|
5
|
+
import { ClassValue } from 'clsx';
|
|
6
|
+
|
|
7
|
+
declare const buttonVariants: (props?: ({
|
|
8
|
+
hierarchy?: "primary" | "secondary-gray" | "secondary-color" | "tertiary-gray" | "tertiary-color" | "link-gray" | "link-color" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | "xl" | "2xl" | null | undefined;
|
|
10
|
+
layoutMode?: "labeled" | "iconOnly" | null | undefined;
|
|
11
|
+
dotLeading?: boolean | null | undefined;
|
|
12
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
+
type ButtonVariantsFromCva = Pick<VariantProps<typeof buttonVariants>, "hierarchy" | "size">;
|
|
14
|
+
interface ButtonProps extends Omit<ButtonProps$1, "children" | "className">, ButtonVariantsFromCva {
|
|
15
|
+
className?: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
iconLeft?: ReactNode;
|
|
18
|
+
iconRight?: ReactNode;
|
|
19
|
+
/** Figma Icon=Only — single centered glyph. */
|
|
20
|
+
iconOnly?: ReactNode;
|
|
21
|
+
/** Figma Dot leading — 8×8 leading indicator (not valid on link-* hierarchies). */
|
|
22
|
+
dotLeading?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare function Button({ hierarchy, size, className, children, iconLeft, iconRight, iconOnly, dotLeading, isDisabled, ...rest }: ButtonProps): JSX.Element;
|
|
25
|
+
|
|
26
|
+
/** Figma Input field (`9:2`) composition variants — Size × Type × Destructive × State matrix. */
|
|
27
|
+
type InputComposition = "default" | "icon-leading" | "leading-dropdown" | "trailing-dropdown" | "leading-text" | "payment-input" | "tags" | "trailing-button";
|
|
28
|
+
interface InputProps extends Omit<TextFieldProps, "children" | "className" | "isInvalid" | "validationBehavior"> {
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Figma Size — `sm` | `md`. */
|
|
31
|
+
size?: "sm" | "md";
|
|
32
|
+
/** Figma Type — composition layout inside the bordered shell. */
|
|
33
|
+
composition?: InputComposition;
|
|
34
|
+
/** Figma Destructive=True — `border-error`, invalid field; hint row shows error styling when `errorMessage` is set. */
|
|
35
|
+
destructive?: boolean;
|
|
36
|
+
label?: ReactNode;
|
|
37
|
+
hint?: ReactNode;
|
|
38
|
+
/** Under-field message when destructive (stays `--color-text-error-primary` even when disabled — Figma `5:104`). */
|
|
39
|
+
errorMessage?: ReactNode;
|
|
40
|
+
/** Shown before the text value (`Icon leading`). */
|
|
41
|
+
leadingIcon?: ReactNode;
|
|
42
|
+
/** Prefix dropdown (`Leading dropdown`) — Figma sample uses country + chevron in `pl-[14px] pr-[8px]` zone. */
|
|
43
|
+
leadingDropdown?: ReactNode;
|
|
44
|
+
/** Suffix dropdown (`Trailing dropdown`) — mirrored paddings from leading-dropdown samples. */
|
|
45
|
+
trailingDropdown?: ReactNode;
|
|
46
|
+
/** Static prefix strip (`Leading text`) — e.g. `https://` on `--color-bg-secondary`, `pl-[14px] pr-[12px]`. */
|
|
47
|
+
leadingText?: ReactNode;
|
|
48
|
+
/** Card artwork (`Payment input`) — parent applies 32×20, radius 4px, `#99abbf` stroke frame. */
|
|
49
|
+
paymentGraphic?: ReactNode;
|
|
50
|
+
/** Tag chips (`Tags`) — rendered before the editable input with 8px gaps. */
|
|
51
|
+
tags?: ReactNode;
|
|
52
|
+
/** Trailing action (`Trailing button`) — placed after divider (`border-secondary` rule); label 14px/20 Medium per Figma `8:177`. */
|
|
53
|
+
trailingButton?: ReactNode;
|
|
54
|
+
/** Trailing help affordance — 16×16 frame, 1.5px border, 8px radius; border `--color-fg-tertiary` / `--color-fg-disabled`. */
|
|
55
|
+
helpIcon?: ReactNode;
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
inputClassName?: string;
|
|
58
|
+
}
|
|
59
|
+
declare function Input({ size, composition, destructive, label, hint, errorMessage, leadingIcon, leadingDropdown, trailingDropdown, leadingText, paymentGraphic, tags, trailingButton, helpIcon, placeholder, inputClassName, className, isDisabled, ...rest }: InputProps): JSX.Element;
|
|
60
|
+
|
|
61
|
+
/** Merge class lists and resolve Tailwind conflicts (later wins). */
|
|
62
|
+
declare function cx(...inputs: ClassValue[]): string;
|
|
63
|
+
|
|
64
|
+
export { Button, type ButtonProps, Input, type InputComposition, type InputProps, cx };
|