@kpf_/kiso 1.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 +168 -0
- package/dist/components/atoms/Button.d.ts +11 -0
- package/dist/components/atoms/Input.d.ts +8 -0
- package/dist/components/atoms/Toggle.d.ts +9 -0
- package/dist/components/molecules/Modal.d.ts +23 -0
- package/dist/components/molecules/Stepper.d.ts +8 -0
- package/dist/components/molecules/Timeline.d.ts +13 -0
- package/dist/components/molecules/Toast.d.ts +19 -0
- package/dist/components/motion/HotSlider.d.ts +10 -0
- package/dist/components/motion/StaggerText.d.ts +6 -0
- package/dist/components/motion/ViewTransition.d.ts +8 -0
- package/dist/index.d.ts +11 -0
- package/dist/kiso.js +6560 -0
- package/dist/kiso.umd.cjs +77 -0
- package/dist/lib/utils.d.ts +2 -0
- package/package.json +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Kiso Design System
|
|
2
|
+
|
|
3
|
+
Package: `@kpf/kiso`
|
|
4
|
+
Version: `1.0.0`
|
|
5
|
+
Framework: React 19 / TypeScript
|
|
6
|
+
|
|
7
|
+
**Kiso** (Japanese for *Foundation*) is a strict, atomic UI library built for tactile interaction and precise motion. It enforces a specific set of physics curves (`ease-kiso`) and a hardcoded token system to ensure visual consistency across applications.
|
|
8
|
+
|
|
9
|
+
## Integration
|
|
10
|
+
|
|
11
|
+
### 1. Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @kpf/kiso framer-motion
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. Styles & Fonts
|
|
18
|
+
|
|
19
|
+
Kiso relies on **Plus Jakarta Sans** and a compiled CSS file for token injection.
|
|
20
|
+
|
|
21
|
+
In your root entry file (e.g., `main.tsx` or `layout.tsx`):
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// 1. Import the Font
|
|
25
|
+
import '@fontsource/plus-jakarta-sans/400.css';
|
|
26
|
+
import '@fontsource/plus-jakarta-sans/500.css';
|
|
27
|
+
import '@fontsource/plus-jakarta-sans/600.css';
|
|
28
|
+
import '@fontsource/plus-jakarta-sans/700.css';
|
|
29
|
+
|
|
30
|
+
// 2. Import Kiso Core Styles
|
|
31
|
+
import '@kpf/kiso/dist/style.css';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Provider Setup
|
|
35
|
+
|
|
36
|
+
The system requires a global context for feedback loops (Toasts). Wrap your application root:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { KisoToastProvider } from '@kpf/kiso';
|
|
40
|
+
|
|
41
|
+
function App() {
|
|
42
|
+
return (
|
|
43
|
+
<KisoToastProvider>
|
|
44
|
+
<YourApplication />
|
|
45
|
+
</KisoToastProvider>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Component Architecture
|
|
51
|
+
|
|
52
|
+
Kiso uses a specific naming convention (`Kiso[Component]`) and favors **Compound Component** patterns for complex molecules to keep the API surface minimal.
|
|
53
|
+
|
|
54
|
+
### Atoms
|
|
55
|
+
|
|
56
|
+
#### Button
|
|
57
|
+
Utilizes tactile press physics (`scale-96`) and custom easing.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { KisoButton } from '@kpf/kiso';
|
|
61
|
+
|
|
62
|
+
<KisoButton variant='primary' onClick={handleClick}>
|
|
63
|
+
Confirm Action
|
|
64
|
+
</KisoButton>
|
|
65
|
+
|
|
66
|
+
<KisoButton variant='destructive' isLoading={isDeleting}>
|
|
67
|
+
Delete Item
|
|
68
|
+
</KisoButton>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Input
|
|
72
|
+
Includes slot support for icons and right-aligned actions.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { KisoInput } from '@kpf/kiso';
|
|
76
|
+
import { MagnifyingGlass } from '@phosphor-icons/react';
|
|
77
|
+
|
|
78
|
+
<KisoInput
|
|
79
|
+
placeholder='Search...'
|
|
80
|
+
leftIcon={<MagnifyingGlass />}
|
|
81
|
+
error={hasError}
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Molecules (Stateful)
|
|
86
|
+
|
|
87
|
+
#### Modal System
|
|
88
|
+
Uses a compound pattern. The `Content` component handles the entrance animation automatically based on the `variant` prop (`standard` | `sheet` | `bottom`).
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { KisoModal } from '@kpf/kiso';
|
|
92
|
+
|
|
93
|
+
<KisoModal open={isOpen} onOpenChange={setIsOpen}>
|
|
94
|
+
<KisoModal.Content variant='sheet'>
|
|
95
|
+
<KisoModal.Header>
|
|
96
|
+
<h2>Transaction Details</h2>
|
|
97
|
+
</KisoModal.Header>
|
|
98
|
+
|
|
99
|
+
<div className='p-6'>
|
|
100
|
+
{/* Content */}
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<KisoModal.Footer>
|
|
104
|
+
<KisoButton variant='secondary' onClick={close}>Close</KisoButton>
|
|
105
|
+
</KisoModal.Footer>
|
|
106
|
+
</KisoModal.Content>
|
|
107
|
+
</KisoModal>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Toast Feedback
|
|
111
|
+
Triggered via hook.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { useToast } from '@kpf/kiso';
|
|
115
|
+
|
|
116
|
+
const { success, error } = useToast();
|
|
117
|
+
|
|
118
|
+
const handleSubmit = () => {
|
|
119
|
+
try {
|
|
120
|
+
saveData();
|
|
121
|
+
success('Changes saved successfully.');
|
|
122
|
+
} catch (err) {
|
|
123
|
+
error('Failed to save data.');
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Motion System
|
|
129
|
+
|
|
130
|
+
Kiso provides pre-configured motion primitives powered by Framer Motion. These use the **wise-drama** bezier curve (`0.1, 0.9, 0.2, 1`).
|
|
131
|
+
|
|
132
|
+
#### Stagger Text
|
|
133
|
+
Splits strings into characters and cascades them in.
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { KisoStaggerText } from '@kpf/kiso';
|
|
137
|
+
|
|
138
|
+
<h1 className='text-4xl font-bold text-kiso-forest'>
|
|
139
|
+
<KisoStaggerText text='Welcome Back' />
|
|
140
|
+
</h1>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### View Transition (Wizard)
|
|
144
|
+
Handles the exit/enter overlap logic for multi-step forms.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { KisoViewTransition } from '@kpf/kiso';
|
|
148
|
+
|
|
149
|
+
// direction is 'forward' | 'backward'
|
|
150
|
+
<KisoViewTransition direction={navDirection}>
|
|
151
|
+
{step === 1 && <StepOne key='step1' />}
|
|
152
|
+
{step === 2 && <StepTwo key='step2' />}
|
|
153
|
+
</KisoViewTransition>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Design Tokens
|
|
157
|
+
|
|
158
|
+
Do not use arbitrary values. Use the Kiso token set for consistency.
|
|
159
|
+
|
|
160
|
+
| Category | Token | Value |
|
|
161
|
+
| --- | --- | --- |
|
|
162
|
+
| **Color** | `text-kiso-forest` | Primary Text (#163300) |
|
|
163
|
+
| | `bg-kiso-green` | Primary Action (#9FE870) |
|
|
164
|
+
| | `bg-kiso-gray` | Backgrounds (#F2F4F8) |
|
|
165
|
+
| | `border-kiso-stroke` | Borders (#D3D5D8) |
|
|
166
|
+
| **Shadow** | `shadow-kiso-modal` | Deep elevation for dialogs |
|
|
167
|
+
| **Ease** | `ease-kiso` | Standard interaction curve |
|
|
168
|
+
| **Ease** | `ease-drama` | Long-form motion curve |
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "primary" | "secondary" | "destructive" | "ghost" | "inverse" | null | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
leftIcon?: React.ReactNode;
|
|
4
|
+
rightAction?: React.ReactNode;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
8
|
+
export { Input };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ToggleProps {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
onChange: (checked: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export { Toggle };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
type ModalVariant = "standard" | "sheet" | "bottom";
|
|
4
|
+
interface ModalContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
|
|
5
|
+
variant?: ModalVariant;
|
|
6
|
+
}
|
|
7
|
+
export declare const KisoModal: {
|
|
8
|
+
Root: React.FC<DialogPrimitive.DialogProps>;
|
|
9
|
+
Trigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
Content: React.ForwardRefExoticComponent<ModalContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
Header: {
|
|
12
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
Footer: {
|
|
16
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
Title: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
20
|
+
Description: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
21
|
+
Close: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface KisoStepperProps {
|
|
3
|
+
currentStep: number;
|
|
4
|
+
steps: string[];
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const KisoStepper: React.ForwardRefExoticComponent<KisoStepperProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface TimelineItem {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
status: 'active' | 'complete' | 'pending';
|
|
7
|
+
}
|
|
8
|
+
interface KisoTimelineProps {
|
|
9
|
+
items: TimelineItem[];
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const KisoTimeline: React.ForwardRefExoticComponent<KisoTimelineProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
3
|
+
export type KisoToastVariant = "success" | "error" | "warning" | "info";
|
|
4
|
+
declare const KisoToast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & {
|
|
5
|
+
variant?: KisoToastVariant;
|
|
6
|
+
} & React.RefAttributes<HTMLLIElement>>;
|
|
7
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof KisoToast>;
|
|
8
|
+
interface ToastContextType {
|
|
9
|
+
toast: (props: ToastProps & {
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
variant?: KisoToastVariant;
|
|
13
|
+
}) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const useToast: () => ToastContextType;
|
|
16
|
+
declare const KisoToaster: ({ children }: {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export { KisoToast, KisoToaster, useToast };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface HotSliderProps {
|
|
2
|
+
min?: number;
|
|
3
|
+
max?: number;
|
|
4
|
+
step?: number;
|
|
5
|
+
value: number;
|
|
6
|
+
onChange: (value: number) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function HotSlider({ min, max, step, value, onChange, className, }: HotSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface KisoViewTransitionProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
direction?: "forward" | "backward";
|
|
4
|
+
className?: string;
|
|
5
|
+
layoutId?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function KisoViewTransition({ children, direction, className, layoutId }: KisoViewTransitionProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Button as KisoButton, buttonVariants } from './components/atoms/Button';
|
|
2
|
+
export { Input as KisoInput } from './components/atoms/Input';
|
|
3
|
+
export { Toggle as KisoToggle } from './components/atoms/Toggle';
|
|
4
|
+
export { KisoModal } from './components/molecules/Modal';
|
|
5
|
+
export { KisoToast, KisoToaster, KisoToaster as KisoToastProvider, useToast } from './components/molecules/Toast';
|
|
6
|
+
export { KisoStepper } from './components/molecules/Stepper';
|
|
7
|
+
export { KisoTimeline } from './components/molecules/Timeline';
|
|
8
|
+
export { StaggerText as KisoStaggerText } from './components/motion/StaggerText';
|
|
9
|
+
export { HotSlider as KisoHotSlider } from './components/motion/HotSlider';
|
|
10
|
+
export { KisoViewTransition } from './components/motion/ViewTransition';
|
|
11
|
+
export { cn } from './lib/utils';
|