@mehdashti/ui 0.1.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 +228 -0
- package/dist/components/__tests__/button.test.d.ts +2 -0
- package/dist/components/__tests__/button.test.d.ts.map +1 -0
- package/dist/components/__tests__/button.test.js +105 -0
- package/dist/components/__tests__/button.test.js.map +1 -0
- package/dist/components/__tests__/input.test.d.ts +2 -0
- package/dist/components/__tests__/input.test.d.ts.map +1 -0
- package/dist/components/__tests__/input.test.js +270 -0
- package/dist/components/__tests__/input.test.js.map +1 -0
- package/dist/components/__tests__/label.test.d.ts +2 -0
- package/dist/components/__tests__/label.test.d.ts.map +1 -0
- package/dist/components/__tests__/label.test.js +181 -0
- package/dist/components/__tests__/label.test.js.map +1 -0
- package/dist/components/button.d.ts +28 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +45 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/button.stories.js +103 -0
- package/dist/components/button.stories.js.map +1 -0
- package/dist/components/dialog.d.ts +20 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +22 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dialog.stories.d.ts +44 -0
- package/dist/components/dialog.stories.d.ts.map +1 -0
- package/dist/components/dialog.stories.js +64 -0
- package/dist/components/dialog.stories.js.map +1 -0
- package/dist/components/input.d.ts +14 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +17 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/input.stories.d.ts +80 -0
- package/dist/components/input.stories.d.ts.map +1 -0
- package/dist/components/input.stories.js +142 -0
- package/dist/components/input.stories.js.map +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +10 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/label.stories.d.ts +52 -0
- package/dist/components/label.stories.d.ts.map +1 -0
- package/dist/components/label.stories.js +74 -0
- package/dist/components/label.stories.js.map +1 -0
- package/dist/components/select.d.ts +14 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +26 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/select.stories.d.ts +48 -0
- package/dist/components/select.stories.d.ts.map +1 -0
- package/dist/components/select.stories.js +67 -0
- package/dist/components/select.stories.js.map +1 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +21 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +8 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +13 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tabs.stories.d.ts +40 -0
- package/dist/components/tabs.stories.d.ts.map +1 -0
- package/dist/components/tabs.stories.js +100 -0
- package/dist/components/tabs.stories.js.map +1 -0
- package/dist/components/toast.d.ts +16 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +34 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toast.stories.d.ts +371 -0
- package/dist/components/toast.stories.d.ts.map +1 -0
- package/dist/components/toast.stories.js +228 -0
- package/dist/components/toast.stories.js.map +1 -0
- package/dist/hooks/use-toast.d.ts +45 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +125 -0
- package/dist/hooks/use-toast.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +10 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Input component for text, email, password, etc.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <Input type="email" placeholder="Enter email" />
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
13
|
+
return (_jsx("input", { type: type, "data-slot": "input", className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm [border-radius:var(--radius-md)]", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className), ref: ref, ...props }));
|
|
14
|
+
});
|
|
15
|
+
Input.displayName = "Input";
|
|
16
|
+
export { Input };
|
|
17
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/components/input.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAKrC;;;;;;;GAOG;AACH,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACrC,OAAO,CACL,gBACE,IAAI,EAAE,IAAI,eACA,OAAO,EACjB,SAAS,EAAE,EAAE,CACX,kdAAkd,EACld,+EAA+E,EAC/E,wGAAwG,EACxG,SAAS,CACV,EACD,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<import("./input").InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
argTypes: {
|
|
10
|
+
type: {
|
|
11
|
+
control: "select";
|
|
12
|
+
options: string[];
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
control: "boolean";
|
|
16
|
+
};
|
|
17
|
+
placeholder: {
|
|
18
|
+
control: "text";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
/**
|
|
25
|
+
* Default input with text type
|
|
26
|
+
*/
|
|
27
|
+
export declare const Default: Story;
|
|
28
|
+
/**
|
|
29
|
+
* Email input type
|
|
30
|
+
*/
|
|
31
|
+
export declare const Email: Story;
|
|
32
|
+
/**
|
|
33
|
+
* Password input type
|
|
34
|
+
*/
|
|
35
|
+
export declare const Password: Story;
|
|
36
|
+
/**
|
|
37
|
+
* Number input type
|
|
38
|
+
*/
|
|
39
|
+
export declare const Number: Story;
|
|
40
|
+
/**
|
|
41
|
+
* Search input type
|
|
42
|
+
*/
|
|
43
|
+
export declare const Search: Story;
|
|
44
|
+
/**
|
|
45
|
+
* Disabled state
|
|
46
|
+
*/
|
|
47
|
+
export declare const Disabled: Story;
|
|
48
|
+
/**
|
|
49
|
+
* With default value
|
|
50
|
+
*/
|
|
51
|
+
export declare const WithValue: Story;
|
|
52
|
+
/**
|
|
53
|
+
* Error state using aria-invalid
|
|
54
|
+
*/
|
|
55
|
+
export declare const Error: Story;
|
|
56
|
+
/**
|
|
57
|
+
* File input type
|
|
58
|
+
*/
|
|
59
|
+
export declare const File: Story;
|
|
60
|
+
/**
|
|
61
|
+
* Date input type
|
|
62
|
+
*/
|
|
63
|
+
export declare const Date: Story;
|
|
64
|
+
/**
|
|
65
|
+
* Time input type
|
|
66
|
+
*/
|
|
67
|
+
export declare const Time: Story;
|
|
68
|
+
/**
|
|
69
|
+
* Input with Label component
|
|
70
|
+
*/
|
|
71
|
+
export declare const WithLabel: Story;
|
|
72
|
+
/**
|
|
73
|
+
* Form example with multiple inputs
|
|
74
|
+
*/
|
|
75
|
+
export declare const FormExample: Story;
|
|
76
|
+
/**
|
|
77
|
+
* All input types showcase
|
|
78
|
+
*/
|
|
79
|
+
export declare const AllTypes: Story;
|
|
80
|
+
//# sourceMappingURL=input.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.stories.d.ts","sourceRoot":"","sources":["../../src/components/input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAItD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;CAmBoB,CAAA;AAE9B,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,KAKpB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,KAKpB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,KAOnB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,KAIlB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,KAIlB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,KAIlB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAqBzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KA6CtB,CAAA"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from './input';
|
|
3
|
+
import { Label } from './label';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Components/Input',
|
|
6
|
+
component: Input,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
type: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['text', 'email', 'password', 'number', 'search', 'tel', 'url', 'date', 'time', 'file'],
|
|
15
|
+
},
|
|
16
|
+
disabled: {
|
|
17
|
+
control: 'boolean',
|
|
18
|
+
},
|
|
19
|
+
placeholder: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export default meta;
|
|
25
|
+
/**
|
|
26
|
+
* Default input with text type
|
|
27
|
+
*/
|
|
28
|
+
export const Default = {
|
|
29
|
+
args: {
|
|
30
|
+
type: 'text',
|
|
31
|
+
placeholder: 'Enter text...',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Email input type
|
|
36
|
+
*/
|
|
37
|
+
export const Email = {
|
|
38
|
+
args: {
|
|
39
|
+
type: 'email',
|
|
40
|
+
placeholder: 'Enter email...',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Password input type
|
|
45
|
+
*/
|
|
46
|
+
export const Password = {
|
|
47
|
+
args: {
|
|
48
|
+
type: 'password',
|
|
49
|
+
placeholder: 'Enter password...',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Number input type
|
|
54
|
+
*/
|
|
55
|
+
export const Number = {
|
|
56
|
+
args: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
placeholder: 'Enter number...',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Search input type
|
|
63
|
+
*/
|
|
64
|
+
export const Search = {
|
|
65
|
+
args: {
|
|
66
|
+
type: 'search',
|
|
67
|
+
placeholder: 'Search...',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Disabled state
|
|
72
|
+
*/
|
|
73
|
+
export const Disabled = {
|
|
74
|
+
args: {
|
|
75
|
+
type: 'text',
|
|
76
|
+
placeholder: 'Disabled input',
|
|
77
|
+
disabled: true,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* With default value
|
|
82
|
+
*/
|
|
83
|
+
export const WithValue = {
|
|
84
|
+
args: {
|
|
85
|
+
type: 'text',
|
|
86
|
+
defaultValue: 'Hello World',
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Error state using aria-invalid
|
|
91
|
+
*/
|
|
92
|
+
export const Error = {
|
|
93
|
+
args: {
|
|
94
|
+
type: 'email',
|
|
95
|
+
placeholder: 'invalid@email',
|
|
96
|
+
defaultValue: 'invalid-email',
|
|
97
|
+
'aria-invalid': true,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* File input type
|
|
102
|
+
*/
|
|
103
|
+
export const File = {
|
|
104
|
+
args: {
|
|
105
|
+
type: 'file',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Date input type
|
|
110
|
+
*/
|
|
111
|
+
export const Date = {
|
|
112
|
+
args: {
|
|
113
|
+
type: 'date',
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Time input type
|
|
118
|
+
*/
|
|
119
|
+
export const Time = {
|
|
120
|
+
args: {
|
|
121
|
+
type: 'time',
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Input with Label component
|
|
126
|
+
*/
|
|
127
|
+
export const WithLabel = {
|
|
128
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem', width: '300px' }, children: [_jsx(Label, { htmlFor: "email", children: "Email" }), _jsx(Input, { id: "email", type: "email", placeholder: "Enter your email..." })] })),
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Form example with multiple inputs
|
|
132
|
+
*/
|
|
133
|
+
export const FormExample = {
|
|
134
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem', width: '300px' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "name", children: "Name" }), _jsx(Input, { id: "name", type: "text", placeholder: "John Doe" })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "email-form", children: "Email" }), _jsx(Input, { id: "email-form", type: "email", placeholder: "john@example.com" })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "password-form", children: "Password" }), _jsx(Input, { id: "password-form", type: "password", placeholder: "Enter password..." })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "phone", children: "Phone" }), _jsx(Input, { id: "phone", type: "tel", placeholder: "+1 (555) 000-0000" })] })] })),
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* All input types showcase
|
|
138
|
+
*/
|
|
139
|
+
export const AllTypes = {
|
|
140
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem', width: '300px' }, children: [_jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Text" }), _jsx(Input, { type: "text", placeholder: "Text input" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Email" }), _jsx(Input, { type: "email", placeholder: "email@example.com" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Password" }), _jsx(Input, { type: "password", placeholder: "Password" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Number" }), _jsx(Input, { type: "number", placeholder: "42" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Search" }), _jsx(Input, { type: "search", placeholder: "Search..." })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Tel" }), _jsx(Input, { type: "tel", placeholder: "+1 (555) 000-0000" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "URL" }), _jsx(Input, { type: "url", placeholder: "https://example.com" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Date" }), _jsx(Input, { type: "date" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Time" }), _jsx(Input, { type: "time" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "File" }), _jsx(Input, { type: "file" })] })] })),
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=input.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.stories.js","sourceRoot":"","sources":["../../src/components/input.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SACjG;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,SAAS;SACnB;QACD,WAAW,EAAE;YACX,OAAO,EAAE,MAAM;SAChB;KACF;CAC2B,CAAA;AAE9B,eAAe,IAAI,CAAA;AAGnB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,eAAe;KAC7B;CACF,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,gBAAgB;KAC9B;CACF,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,mBAAmB;KACjC;CACF,CAAA;AAED;;GAEG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Props } from "class-variance-authority";
|
|
4
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import("class-variance-authority/types").ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
5
|
+
export { Label };
|
|
6
|
+
//# sourceMappingURL=label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,QAAA,MAAM,KAAK,4PAWT,CAAC;AAGH,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
7
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => (_jsx(LabelPrimitive.Root, { ref: ref, "data-slot": "label", className: cn(labelVariants(), className), ...props })));
|
|
8
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
9
|
+
export { Label };
|
|
10
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,MAAM,aAAa,GAAG,GAAG,CACvB,4FAA4F,CAC7F,CAAC;AAEF,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAI5B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,cAAc,CAAC,IAAI,IAClB,GAAG,EAAE,GAAG,eACE,OAAO,EACjB,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,EAAE,SAAS,CAAC,KACrC,KAAK,GACT,CACH,CAAC,CAAC;AACH,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-label").LabelProps & import("react").RefAttributes<HTMLLabelElement>, "ref"> & import("class-variance-authority").VariantProps<(props?: import("class-variance-authority/types").ClassProp | undefined) => string> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
/**
|
|
13
|
+
* Basic label
|
|
14
|
+
*/
|
|
15
|
+
export declare const Default: Story;
|
|
16
|
+
/**
|
|
17
|
+
* Label with Input
|
|
18
|
+
*/
|
|
19
|
+
export declare const WithInput: Story;
|
|
20
|
+
/**
|
|
21
|
+
* Label with Select
|
|
22
|
+
*/
|
|
23
|
+
export declare const WithSelect: Story;
|
|
24
|
+
/**
|
|
25
|
+
* Label with disabled input (demonstrates peer-disabled styling)
|
|
26
|
+
*/
|
|
27
|
+
export declare const WithDisabledInput: Story;
|
|
28
|
+
/**
|
|
29
|
+
* Label with required indicator
|
|
30
|
+
*/
|
|
31
|
+
export declare const Required: Story;
|
|
32
|
+
/**
|
|
33
|
+
* Label with helper text
|
|
34
|
+
*/
|
|
35
|
+
export declare const WithHelperText: Story;
|
|
36
|
+
/**
|
|
37
|
+
* Label with error message
|
|
38
|
+
*/
|
|
39
|
+
export declare const WithError: Story;
|
|
40
|
+
/**
|
|
41
|
+
* Form with multiple labeled fields
|
|
42
|
+
*/
|
|
43
|
+
export declare const FormExample: Story;
|
|
44
|
+
/**
|
|
45
|
+
* Label alignment variations
|
|
46
|
+
*/
|
|
47
|
+
export declare const AlignmentVariations: Story;
|
|
48
|
+
/**
|
|
49
|
+
* All label variations showcase
|
|
50
|
+
*/
|
|
51
|
+
export declare const Showcase: Story;
|
|
52
|
+
//# sourceMappingURL=label.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.stories.d.ts","sourceRoot":"","sources":["../../src/components/label.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAKtD,QAAA,MAAM,IAAI;;;;;;;CAOoB,CAAA;AAE9B,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAErB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAgBxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAS/B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAU5B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAgBvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KA+CzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,KA8CjC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAyDtB,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Label } from './label';
|
|
3
|
+
import { Input } from './input';
|
|
4
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/Label',
|
|
7
|
+
component: Label,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
/**
|
|
15
|
+
* Basic label
|
|
16
|
+
*/
|
|
17
|
+
export const Default = {
|
|
18
|
+
render: () => _jsx(Label, { children: "Email" }),
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Label with Input
|
|
22
|
+
*/
|
|
23
|
+
export const WithInput = {
|
|
24
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem', width: '300px' }, children: [_jsx(Label, { htmlFor: "email", children: "Email Address" }), _jsx(Input, { id: "email", type: "email", placeholder: "john@example.com" })] })),
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Label with Select
|
|
28
|
+
*/
|
|
29
|
+
export const WithSelect = {
|
|
30
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem', width: '300px' }, children: [_jsx(Label, { htmlFor: "country", children: "Country" }), _jsxs(Select, { children: [_jsx(SelectTrigger, { id: "country", children: _jsx(SelectValue, { placeholder: "Select a country" }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "us", children: "United States" }), _jsx(SelectItem, { value: "uk", children: "United Kingdom" }), _jsx(SelectItem, { value: "ca", children: "Canada" })] })] })] })),
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Label with disabled input (demonstrates peer-disabled styling)
|
|
34
|
+
*/
|
|
35
|
+
export const WithDisabledInput = {
|
|
36
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem', width: '300px' }, children: [_jsx(Label, { htmlFor: "disabled-input", className: "peer", children: "Disabled Field" }), _jsx(Input, { id: "disabled-input", disabled: true, placeholder: "This field is disabled" })] })),
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Label with required indicator
|
|
40
|
+
*/
|
|
41
|
+
export const Required = {
|
|
42
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem', width: '300px' }, children: [_jsxs(Label, { htmlFor: "required-field", children: ["Email Address ", _jsx("span", { style: { color: 'hsl(var(--destructive))' }, children: "*" })] }), _jsx(Input, { id: "required-field", type: "email", placeholder: "john@example.com", required: true })] })),
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Label with helper text
|
|
46
|
+
*/
|
|
47
|
+
export const WithHelperText = {
|
|
48
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem', width: '300px' }, children: [_jsx(Label, { htmlFor: "username", children: "Username" }), _jsx(Input, { id: "username", placeholder: "johndoe" }), _jsx("p", { style: { fontSize: '0.875rem', color: 'hsl(var(--muted-foreground))' }, children: "Choose a unique username for your account." })] })),
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Label with error message
|
|
52
|
+
*/
|
|
53
|
+
export const WithError = {
|
|
54
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem', width: '300px' }, children: [_jsx(Label, { htmlFor: "error-field", children: "Email Address" }), _jsx(Input, { id: "error-field", type: "email", placeholder: "john@example.com", defaultValue: "invalid-email", "aria-invalid": true }), _jsx("p", { style: { fontSize: '0.875rem', color: 'hsl(var(--destructive))' }, children: "Please enter a valid email address." })] })),
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Form with multiple labeled fields
|
|
58
|
+
*/
|
|
59
|
+
export const FormExample = {
|
|
60
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem', width: '400px' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsxs(Label, { htmlFor: "form-name", children: ["Full Name ", _jsx("span", { style: { color: 'hsl(var(--destructive))' }, children: "*" })] }), _jsx(Input, { id: "form-name", placeholder: "John Doe", required: true })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsxs(Label, { htmlFor: "form-email", children: ["Email ", _jsx("span", { style: { color: 'hsl(var(--destructive))' }, children: "*" })] }), _jsx(Input, { id: "form-email", type: "email", placeholder: "john@example.com", required: true }), _jsx("p", { style: { fontSize: '0.875rem', color: 'hsl(var(--muted-foreground))' }, children: "We'll never share your email with anyone else." })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "form-phone", children: "Phone Number" }), _jsx(Input, { id: "form-phone", type: "tel", placeholder: "+1 (555) 000-0000" }), _jsx("p", { style: { fontSize: '0.875rem', color: 'hsl(var(--muted-foreground))' }, children: "Optional" })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "form-country", children: "Country" }), _jsxs(Select, { children: [_jsx(SelectTrigger, { id: "form-country", children: _jsx(SelectValue, { placeholder: "Select your country" }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "us", children: "United States" }), _jsx(SelectItem, { value: "uk", children: "United Kingdom" }), _jsx(SelectItem, { value: "ca", children: "Canada" }), _jsx(SelectItem, { value: "au", children: "Australia" })] })] })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "form-notes", children: "Additional Notes" }), _jsx(Input, { id: "form-notes", placeholder: "Any additional information..." })] })] })),
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Label alignment variations
|
|
64
|
+
*/
|
|
65
|
+
export const AlignmentVariations = {
|
|
66
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '2rem', width: '400px' }, children: [_jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '600', marginBottom: '1rem' }, children: "Vertical (Default)" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "vertical", children: "Email" }), _jsx(Input, { id: "vertical", type: "email", placeholder: "john@example.com" })] })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '600', marginBottom: '1rem' }, children: "Horizontal (Inline)" }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '1rem' }, children: [_jsx(Label, { htmlFor: "horizontal", style: { minWidth: '100px' }, children: "Email" }), _jsx(Input, { id: "horizontal", type: "email", placeholder: "john@example.com" })] })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '600', marginBottom: '1rem' }, children: "Grid Layout" }), _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '120px 1fr', gap: '1rem' }, children: [_jsx(Label, { htmlFor: "grid-name", style: { paddingTop: '0.5rem' }, children: "Name" }), _jsx(Input, { id: "grid-name", placeholder: "John Doe" }), _jsx(Label, { htmlFor: "grid-email", style: { paddingTop: '0.5rem' }, children: "Email" }), _jsx(Input, { id: "grid-email", type: "email", placeholder: "john@example.com" }), _jsx(Label, { htmlFor: "grid-phone", style: { paddingTop: '0.5rem' }, children: "Phone" }), _jsx(Input, { id: "grid-phone", type: "tel", placeholder: "+1 (555) 000-0000" })] })] })] })),
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* All label variations showcase
|
|
70
|
+
*/
|
|
71
|
+
export const Showcase = {
|
|
72
|
+
render: () => (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1.5rem', width: '350px' }, children: [_jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Basic Label" }), _jsx(Label, { children: "Label Text" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "With Input" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "showcase-1", children: "Email" }), _jsx(Input, { id: "showcase-1", type: "email", placeholder: "email@example.com" })] })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Required" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsxs(Label, { htmlFor: "showcase-2", children: ["Password ", _jsx("span", { style: { color: 'hsl(var(--destructive))' }, children: "*" })] }), _jsx(Input, { id: "showcase-2", type: "password", placeholder: "Enter password" })] })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "With Helper" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "showcase-3", children: "Username" }), _jsx(Input, { id: "showcase-3", placeholder: "johndoe" }), _jsx("p", { style: { fontSize: '0.875rem', color: 'hsl(var(--muted-foreground))' }, children: "Choose a unique username." })] })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "With Error" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Label, { htmlFor: "showcase-4", children: "Email" }), _jsx(Input, { id: "showcase-4", defaultValue: "invalid", "aria-invalid": true }), _jsx("p", { style: { fontSize: '0.875rem', color: 'hsl(var(--destructive))' }, children: "Invalid email format." })] })] })] })),
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=label.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.stories.js","sourceRoot":"","sources":["../../src/components/label.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAExF,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;CACU,CAAA;AAE9B,eAAe,IAAI,CAAA;AAGnB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,KAAK,wBAAc;CACnC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,MAAM,EAAE,GAAG,EAAE,CAAC,CACZ,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,aACrF,KAAC,KAAK,IAAC,OAAO,EAAC,OAAO,8BAAsB,EAC5C,KAAC,KAAK,IAAC,EAAE,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,kBAAkB,GAAG,IAC5D,CACP;CACF,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,MAAM,EAAE,GAAG,EAAE,CA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gB,GAAG,IAClE,IACF,EAEN,0BACE,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,4BAEzE,EACJ,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,aACrE,KAAC,KAAK,IAAC,OAAO,EAAC,YAAY,yBAAiB,EAC5C,KAAC,KAAK,IAAC,EAAE,EAAC,YAAY,EAAC,WAAW,EAAC,SAAS,GAAG,EAC/C,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,8BAA8B,EAAE,0CAErE,IACA,IACF,EAEN,0BACE,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,2BAEzE,EACJ,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,aACrE,KAAC,KAAK,IAAC,OAAO,EAAC,YAAY,sBAAc,EACzC,KAAC,KAAK,IAAC,EAAE,EAAC,YAAY,EAAC,YAAY,EAAC,SAAS,yBAAgB,EAC7D,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,EAAE,sCAEhE,IACA,IACF,IACF,CACP;CACF,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
|
+
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
4
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
14
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D,QAAA,MAAM,MAAM,uCAAuB,CAAC;AAEpC,QAAA,MAAM,WAAW,yGAAwB,CAAC;AAE1C,QAAA,MAAM,WAAW,0GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,oKAoCjB,CAAC;AAGH,QAAA,MAAM,oBAAoB,qKA0BxB,CAAC;AAGH,QAAA,MAAM,sBAAsB,uKA0B1B,CAAC;AAIH,QAAA,MAAM,aAAa,8JA8BjB,CAAC;AAGH,QAAA,MAAM,WAAW,4JASf,CAAC;AAGH,QAAA,MAAM,UAAU,2JAiCd,CAAC;AAGH,QAAA,MAAM,eAAe,gKASnB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
const Select = SelectPrimitive.Root;
|
|
6
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
7
|
+
const SelectValue = SelectPrimitive.Value;
|
|
8
|
+
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, "data-slot": "select-trigger", className: cn("flex h-9 w-full items-center justify-between border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none [border-radius:var(--radius-md)]", "placeholder:text-muted-foreground", "focus:border-ring focus:ring-ring/50 focus:ring-[3px]", "disabled:cursor-not-allowed disabled:opacity-50", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", "[&>span]:line-clamp-1", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "opacity-50", children: _jsx("path", { d: "m6 9 6 6 6-6" }) }) })] })));
|
|
9
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
10
|
+
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "m18 15-6-6-6 6" }) }) })));
|
|
11
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
12
|
+
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "m6 9 6 6 6-6" }) }) })));
|
|
13
|
+
SelectScrollDownButton.displayName =
|
|
14
|
+
SelectPrimitive.ScrollDownButton.displayName;
|
|
15
|
+
const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { ref: ref, className: cn("relative z-50 max-h-96 min-w-[8rem] overflow-hidden border border-border bg-background text-foreground shadow-md [border-radius:var(--radius-md)]", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", position === "popper" &&
|
|
16
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn("p-1", position === "popper" &&
|
|
17
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }), _jsx(SelectScrollDownButton, {})] }) })));
|
|
18
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
19
|
+
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold", className), ...props })));
|
|
20
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
21
|
+
const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: cn("relative flex w-full cursor-default select-none items-center py-1.5 pl-2 pr-8 text-sm outline-none [border-radius:var(--radius-sm)]", "focus:bg-accent focus:text-accent-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [_jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: "M20 6 9 17l-5-5" }) }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] })));
|
|
22
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
23
|
+
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props })));
|
|
24
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
25
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
26
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC;AAEpC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;AAE1C,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;AAE1C,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAGpC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC5C,MAAC,eAAe,CAAC,OAAO,IACtB,GAAG,EAAE,GAAG,eACE,gBAAgB,EAC1B,SAAS,EAAE,EAAE,CACX,yLAAyL,EACzL,mCAAmC,EACnC,uDAAuD,EACvD,iDAAiD,EACjD,wGAAwG,EACxG,uBAAuB,EACvB,SAAS,CACV,KACG,KAAK,aAER,QAAQ,EACT,KAAC,eAAe,CAAC,IAAI,IAAC,OAAO,kBAC3B,cACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,SAAS,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
|
|
4
|
+
component: import("react").FC<import("@radix-ui/react-select").SelectProps>;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
/**
|
|
13
|
+
* Basic select with simple options
|
|
14
|
+
*/
|
|
15
|
+
export declare const Default: Story;
|
|
16
|
+
/**
|
|
17
|
+
* Select with default value
|
|
18
|
+
*/
|
|
19
|
+
export declare const WithDefaultValue: Story;
|
|
20
|
+
/**
|
|
21
|
+
* Disabled select
|
|
22
|
+
*/
|
|
23
|
+
export declare const Disabled: Story;
|
|
24
|
+
/**
|
|
25
|
+
* Select with grouped options
|
|
26
|
+
*/
|
|
27
|
+
export declare const WithGroups: Story;
|
|
28
|
+
/**
|
|
29
|
+
* Select with many options (scroll behavior)
|
|
30
|
+
*/
|
|
31
|
+
export declare const WithManyOptions: Story;
|
|
32
|
+
/**
|
|
33
|
+
* Select with disabled items
|
|
34
|
+
*/
|
|
35
|
+
export declare const WithDisabledItems: Story;
|
|
36
|
+
/**
|
|
37
|
+
* Select with Label component
|
|
38
|
+
*/
|
|
39
|
+
export declare const WithLabel: Story;
|
|
40
|
+
/**
|
|
41
|
+
* Form example with multiple selects
|
|
42
|
+
*/
|
|
43
|
+
export declare const FormExample: Story;
|
|
44
|
+
/**
|
|
45
|
+
* All select variants showcase
|
|
46
|
+
*/
|
|
47
|
+
export declare const Showcase: Story;
|
|
48
|
+
//# sourceMappingURL=select.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.stories.d.ts","sourceRoot":"","sources":["../../src/components/select.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAatD,QAAA,MAAM,IAAI;;;;;;;CAOqB,CAAA;AAE/B,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAerB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAe9B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAatB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAuBxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KA8B7B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAkB/B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAkBvB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KA+DzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAyEtB,CAAA"}
|