@bronzelabs/oakma-ui 0.0.1
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/.prettierrc.cjs +25 -0
- package/.storybook/components/ActionButton.tsx +44 -0
- package/.storybook/components/DummyIcons.tsx +47 -0
- package/.storybook/components/index.ts +2 -0
- package/.storybook/docs/blocks/ImportStatement.tsx +52 -0
- package/.storybook/docs/blocks/index.ts +1 -0
- package/.storybook/docs/page.tsx +41 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/postcss.config.cjs +8 -0
- package/.storybook/preview-body.html +20 -0
- package/.storybook/preview-head.html +6 -0
- package/.storybook/preview.tsx +30 -0
- package/.storybook/tailwind.css +6 -0
- package/.storybook/utils/index.ts +2 -0
- package/.storybook/utils/renderAsReact.tsx +30 -0
- package/.storybook/utils/renderDocsWithProps.tsx +22 -0
- package/@types/markdown.d.ts +4 -0
- package/README.md +3 -0
- package/eslint.config.js +91 -0
- package/package.json +63 -0
- package/postcss.config.cjs +8 -0
- package/scripts/release.sh +76 -0
- package/src/components/Button/Button.stories.tsx +314 -0
- package/src/components/Button/Button.tsx +132 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Button/types.ts +19 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +152 -0
- package/src/components/Checkbox/Checkbox.tsx +90 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Checkbox/types.ts +6 -0
- package/src/components/Chip/Chip.stories.tsx +146 -0
- package/src/components/Chip/Chip.tsx +59 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/Chip/types.ts +6 -0
- package/src/components/Drawer/Drawer.docs.md +88 -0
- package/src/components/Drawer/Drawer.stories.tsx +239 -0
- package/src/components/Drawer/Drawer.tsx +194 -0
- package/src/components/Drawer/index.ts +3 -0
- package/src/components/Drawer/types.ts +3 -0
- package/src/components/Dropdown/AsyncDropdown.tsx +105 -0
- package/src/components/Dropdown/Dropdown.docs.md +33 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +419 -0
- package/src/components/Dropdown/Dropdown.tsx +104 -0
- package/src/components/Dropdown/MultiValue.tsx +19 -0
- package/src/components/Dropdown/ValueContainer.tsx +114 -0
- package/src/components/Dropdown/index.ts +4 -0
- package/src/components/Dropdown/types.ts +29 -0
- package/src/components/Dropdown/useDropdown.tsx +257 -0
- package/src/components/Logo/Logo.stories.tsx +130 -0
- package/src/components/Logo/Logo.tsx +80 -0
- package/src/components/Logo/index.ts +2 -0
- package/src/components/Modal/Modal.docs.md +94 -0
- package/src/components/Modal/Modal.stories.tsx +318 -0
- package/src/components/Modal/Modal.tsx +217 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/MultiSelect/AsyncMultiSelect.tsx +47 -0
- package/src/components/MultiSelect/MultiSelect.docs.md +37 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +493 -0
- package/src/components/MultiSelect/MultiSelect.tsx +81 -0
- package/src/components/MultiSelect/index.ts +2 -0
- package/src/components/Notification/Notification.stories.tsx +158 -0
- package/src/components/Notification/Notification.tsx +110 -0
- package/src/components/Notification/index.ts +1 -0
- package/src/components/Notification/types.ts +11 -0
- package/src/components/Notifications/Notifications.docs.md +103 -0
- package/src/components/Notifications/Notifications.stories.tsx +159 -0
- package/src/components/Notifications/Notifications.tsx +90 -0
- package/src/components/Notifications/NotificationsContext.tsx +90 -0
- package/src/components/Notifications/index.ts +7 -0
- package/src/components/Select/Select.stories.tsx +234 -0
- package/src/components/Select/Select.tsx +129 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Select/types.ts +1 -0
- package/src/components/Spinner/Spinner.stories.tsx +55 -0
- package/src/components/Spinner/Spinner.tsx +48 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Spinner/types.ts +8 -0
- package/src/components/TextArea/TextArea.stories.tsx +243 -0
- package/src/components/TextArea/TextArea.tsx +133 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextArea/types.ts +4 -0
- package/src/components/TextField/Container.tsx +68 -0
- package/src/components/TextField/ErrorMessage.tsx +37 -0
- package/src/components/TextField/Icon.tsx +77 -0
- package/src/components/TextField/Label.tsx +56 -0
- package/src/components/TextField/NotchBorder.tsx +67 -0
- package/src/components/TextField/index.ts +14 -0
- package/src/components/TextField/types.ts +15 -0
- package/src/components/TextField/useInputKeyboardFocus.tsx +63 -0
- package/src/components/TextInput/TextInput.stories.tsx +384 -0
- package/src/components/TextInput/TextInput.tsx +255 -0
- package/src/components/TextInput/index.ts +2 -0
- package/src/components/TextInput/types.ts +4 -0
- package/src/components/Toggle/Toggle.stories.tsx +142 -0
- package/src/components/Toggle/Toggle.tsx +69 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useCombinedRefs.ts +37 -0
- package/src/hooks/useEventListener.ts +87 -0
- package/src/hooks/useFocusTrap/createAriaHider.ts +62 -0
- package/src/hooks/useFocusTrap/index.ts +1 -0
- package/src/hooks/useFocusTrap/scopeTab.ts +46 -0
- package/src/hooks/useFocusTrap/tabbable.ts +107 -0
- package/src/hooks/useFocusTrap/useFocusTrap.ts +97 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +14 -0
- package/src/hooks/useLockBodyScroll.ts +24 -0
- package/src/hooks/useOnClickOutside.ts +53 -0
- package/src/index.ts +22 -0
- package/src/tailwind.css +4 -0
- package/src/types/helpers.ts +11 -0
- package/src/types/polymorphic.ts +39 -0
- package/src/utils/animation/variants.ts +21 -0
- package/src/utils/array/index.ts +1 -0
- package/src/utils/array/uniqBy.ts +12 -0
- package/src/utils/common/index.ts +1 -0
- package/src/utils/common/isFunction.ts +17 -0
- package/src/utils/react/extractDisplayName.ts +15 -0
- package/src/utils/react/index.ts +1 -0
- package/tsconfig.json +16 -0
- package/tsconfig.production.json +19 -0
- package/tsup.config.ts +16 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default as Container } from "./Container"
|
|
2
|
+
export { default as ErrorMessage } from "./ErrorMessage"
|
|
3
|
+
export { default as Label } from "./Label"
|
|
4
|
+
export { default as Icon } from "./Icon"
|
|
5
|
+
export { default as NotchBorder } from "./NotchBorder"
|
|
6
|
+
|
|
7
|
+
export { default as useInputKeyboardFocus } from "./useInputKeyboardFocus"
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
TEXT_FIELD_SIZES,
|
|
11
|
+
type TextFieldSize,
|
|
12
|
+
TEXT_FIELD_VARIANTS,
|
|
13
|
+
type TextFieldVariant,
|
|
14
|
+
} from "./types"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const TEXT_FIELD_SIZES = ["sm", "md"] as const
|
|
10
|
+
|
|
11
|
+
export type TextFieldSize = (typeof TEXT_FIELD_SIZES)[number]
|
|
12
|
+
|
|
13
|
+
export const TEXT_FIELD_VARIANTS = ["dark", "light"] as const
|
|
14
|
+
|
|
15
|
+
export type TextFieldVariant = (typeof TEXT_FIELD_VARIANTS)[number]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useRef, useState, useCallback } from "react"
|
|
4
|
+
|
|
5
|
+
// Params
|
|
6
|
+
interface UseInputKeyboardFocusProps<T> {
|
|
7
|
+
onFocus?: React.FocusEventHandler<T>
|
|
8
|
+
onBlur?: React.FocusEventHandler<T>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const useInputKeyboardFocus = <T extends HTMLElement = HTMLInputElement>({
|
|
20
|
+
onFocus,
|
|
21
|
+
onBlur,
|
|
22
|
+
}: UseInputKeyboardFocusProps<T>) => {
|
|
23
|
+
// Refs
|
|
24
|
+
const mouseDownRef = useRef(false)
|
|
25
|
+
|
|
26
|
+
// State
|
|
27
|
+
const [keyboardFocused, setKeyboardFocused] = useState(false)
|
|
28
|
+
|
|
29
|
+
// Functions
|
|
30
|
+
const handleMouseDown = useCallback(() => {
|
|
31
|
+
mouseDownRef.current = true
|
|
32
|
+
}, [])
|
|
33
|
+
|
|
34
|
+
const handleMouseUp = useCallback(() => {
|
|
35
|
+
mouseDownRef.current = false
|
|
36
|
+
}, [])
|
|
37
|
+
|
|
38
|
+
const handleFocus = useCallback(
|
|
39
|
+
(e: React.FocusEvent<T>) => {
|
|
40
|
+
if (!mouseDownRef.current) setKeyboardFocused(true)
|
|
41
|
+
return onFocus?.(e)
|
|
42
|
+
},
|
|
43
|
+
[onFocus],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const handleBlur = useCallback(
|
|
47
|
+
(e: React.FocusEvent<T>) => {
|
|
48
|
+
setKeyboardFocused(false)
|
|
49
|
+
return onBlur?.(e)
|
|
50
|
+
},
|
|
51
|
+
[onBlur],
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
keyboardFocused,
|
|
56
|
+
handleMouseDown,
|
|
57
|
+
handleMouseUp,
|
|
58
|
+
handleFocus,
|
|
59
|
+
handleBlur,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default useInputKeyboardFocus
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
// Components
|
|
4
|
+
import TextInput from "./TextInput"
|
|
5
|
+
|
|
6
|
+
// Types
|
|
7
|
+
import type { Meta, StoryFn } from "@storybook/react-webpack5"
|
|
8
|
+
import { TEXT_FIELD_SIZES, TEXT_FIELD_VARIANTS } from "../TextField"
|
|
9
|
+
|
|
10
|
+
// Utils
|
|
11
|
+
import {
|
|
12
|
+
DummyPhoneIcon,
|
|
13
|
+
DummyChevronDownIcon,
|
|
14
|
+
StorybookActionButton,
|
|
15
|
+
} from "../../../.storybook/components"
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
type TextInputStoryProps = React.ComponentProps<typeof TextInput>
|
|
25
|
+
|
|
26
|
+
const meta: Meta<TextInputStoryProps> = {
|
|
27
|
+
title: "Components/TextInput",
|
|
28
|
+
component: TextInput,
|
|
29
|
+
parameters: {
|
|
30
|
+
docs: {
|
|
31
|
+
description: {
|
|
32
|
+
component:
|
|
33
|
+
"A labelled text field with optional error state and an optional inline action button.",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
controls: {
|
|
37
|
+
exclude: ["className", "ref"],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
argTypes: {
|
|
41
|
+
label: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Visible label rendered above the input.",
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: "string" },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "Determines the size of the input field.",
|
|
51
|
+
table: {
|
|
52
|
+
type: {
|
|
53
|
+
summary: TEXT_FIELD_SIZES.map(size => `"${size}"`).join(" | "),
|
|
54
|
+
},
|
|
55
|
+
defaultValue: { summary: '"md"' },
|
|
56
|
+
},
|
|
57
|
+
options: TEXT_FIELD_SIZES,
|
|
58
|
+
control: { type: "select" },
|
|
59
|
+
},
|
|
60
|
+
variant: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "Determines the color scheme of the input field.",
|
|
63
|
+
table: {
|
|
64
|
+
type: { summary: TEXT_FIELD_VARIANTS.map(variant => `"${variant}"`).join(" | ") },
|
|
65
|
+
defaultValue: { summary: '"dark"' },
|
|
66
|
+
},
|
|
67
|
+
options: TEXT_FIELD_VARIANTS,
|
|
68
|
+
control: { type: "select" },
|
|
69
|
+
},
|
|
70
|
+
type: {
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "The HTML input type.",
|
|
73
|
+
table: {
|
|
74
|
+
type: {
|
|
75
|
+
summary:
|
|
76
|
+
'"text" | "email" | "password" | "number" | "search" | "tel" | "url" | "date" | "datetime-local" | "month" | "time" | "week" | "range"',
|
|
77
|
+
},
|
|
78
|
+
defaultValue: { summary: '"text"' },
|
|
79
|
+
},
|
|
80
|
+
options: [
|
|
81
|
+
"text",
|
|
82
|
+
"email",
|
|
83
|
+
"password",
|
|
84
|
+
"number",
|
|
85
|
+
"search",
|
|
86
|
+
"tel",
|
|
87
|
+
"url",
|
|
88
|
+
"date",
|
|
89
|
+
"datetime-local",
|
|
90
|
+
"month",
|
|
91
|
+
"time",
|
|
92
|
+
"week",
|
|
93
|
+
"range",
|
|
94
|
+
],
|
|
95
|
+
control: { type: "select" },
|
|
96
|
+
},
|
|
97
|
+
placeholder: {
|
|
98
|
+
type: "string",
|
|
99
|
+
description: "Placeholder text shown when the input is empty.",
|
|
100
|
+
table: {
|
|
101
|
+
type: { summary: "string" },
|
|
102
|
+
defaultValue: { summary: "undefined" },
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
showOptional: {
|
|
106
|
+
type: "boolean",
|
|
107
|
+
description: 'Shows an "Optional" tag next to the label when the field is not required.',
|
|
108
|
+
table: {
|
|
109
|
+
type: { summary: "boolean" },
|
|
110
|
+
defaultValue: { summary: "true" },
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
required: {
|
|
114
|
+
type: "boolean",
|
|
115
|
+
description: 'Marks the field as required and hides the "Optional" tag.',
|
|
116
|
+
table: {
|
|
117
|
+
type: { summary: "boolean" },
|
|
118
|
+
defaultValue: { summary: "false" },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
disabled: {
|
|
122
|
+
type: "boolean",
|
|
123
|
+
description: "Disables the input.",
|
|
124
|
+
table: {
|
|
125
|
+
type: { summary: "boolean" },
|
|
126
|
+
defaultValue: { summary: "false" },
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
leadingIcon: {
|
|
130
|
+
type: "function",
|
|
131
|
+
description: "Renders an icon inside the input, aligned to the left.",
|
|
132
|
+
table: {
|
|
133
|
+
type: { summary: "ReactNode" },
|
|
134
|
+
defaultValue: { summary: "undefined" },
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
error: {
|
|
138
|
+
description: "Renders the field in an error state and displays the provided message.",
|
|
139
|
+
table: {
|
|
140
|
+
type: { summary: "{ message: string }" },
|
|
141
|
+
defaultValue: { summary: "undefined" },
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
button: {
|
|
145
|
+
description: "Renders an inline action button inside the field.",
|
|
146
|
+
table: {
|
|
147
|
+
type: { summary: "Omit<ButtonProps, 'children'> & { label: string }" },
|
|
148
|
+
defaultValue: { summary: "undefined" },
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
args: {
|
|
153
|
+
id: "text-input",
|
|
154
|
+
label: "Label",
|
|
155
|
+
showOptional: true,
|
|
156
|
+
required: false,
|
|
157
|
+
disabled: false,
|
|
158
|
+
type: "text",
|
|
159
|
+
size: "md",
|
|
160
|
+
variant: "dark",
|
|
161
|
+
},
|
|
162
|
+
decorators: [
|
|
163
|
+
Story => (
|
|
164
|
+
<div style={{ width: 450 }}>
|
|
165
|
+
<Story />
|
|
166
|
+
</div>
|
|
167
|
+
),
|
|
168
|
+
],
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const Template: StoryFn<TextInputStoryProps> = args => <TextInput {...args} />
|
|
172
|
+
|
|
173
|
+
const LeadingIconTemplate: StoryFn<TextInputStoryProps> = args => (
|
|
174
|
+
<div className="flex flex-col gap-6">
|
|
175
|
+
<TextInput {...args} leadingIcon={{ icon: <DummyPhoneIcon className="size-5" /> }} />
|
|
176
|
+
<TextInput {...args} leadingIcon={{ icon: <DummyPhoneIcon className="size-5" /> }} />
|
|
177
|
+
</div>
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
const TrailingIconTemplate: StoryFn<TextInputStoryProps> = args => (
|
|
181
|
+
<div className="flex flex-col gap-6">
|
|
182
|
+
<TextInput {...args} trailingIcon={{ icon: <DummyChevronDownIcon className="size-6" /> }} />
|
|
183
|
+
<TextInput
|
|
184
|
+
{...args}
|
|
185
|
+
trailingIcon={{
|
|
186
|
+
icon: <DummyChevronDownIcon className="size-6" />,
|
|
187
|
+
onClick: () => alert("Trailing icon clicked!"),
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
const VariantsTemplate: StoryFn<TextInputStoryProps> = args => (
|
|
194
|
+
<div className="flex flex-col">
|
|
195
|
+
<div className="bg-[#fff] p-6">
|
|
196
|
+
<TextInput {...args} variant="dark" label="Dark Variant" />
|
|
197
|
+
</div>
|
|
198
|
+
<div className="bg-[#333] p-6">
|
|
199
|
+
<TextInput {...args} variant="light" label="Light Variant" />
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
const TemporalTemplate: StoryFn<TextInputStoryProps> = args => {
|
|
205
|
+
return (
|
|
206
|
+
<div className="flex flex-col gap-6">
|
|
207
|
+
<TextInput {...args} type="date" label="Date" />
|
|
208
|
+
<TextInput {...args} type="time" label="Time" />
|
|
209
|
+
<TextInput {...args} type="datetime-local" label="Date & Time" />
|
|
210
|
+
<TextInput {...args} type="month" label="Month" />
|
|
211
|
+
<TextInput {...args} type="week" label="Week" />
|
|
212
|
+
</div>
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const RequiredTemplate: StoryFn<TextInputStoryProps> = args => {
|
|
217
|
+
return (
|
|
218
|
+
<form
|
|
219
|
+
onSubmit={e => {
|
|
220
|
+
e.preventDefault()
|
|
221
|
+
const formData = new FormData(e.currentTarget)
|
|
222
|
+
alert(`Form submitted: ${formData.get("required-field")}`)
|
|
223
|
+
}}
|
|
224
|
+
className="flex flex-col gap-3"
|
|
225
|
+
>
|
|
226
|
+
<TextInput {...args} required label="Required Field" name="required-field" />
|
|
227
|
+
<StorybookActionButton>Submit</StorybookActionButton>
|
|
228
|
+
</form>
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const Default = Template.bind({})
|
|
233
|
+
const Small = Template.bind({})
|
|
234
|
+
const Variants = VariantsTemplate.bind({})
|
|
235
|
+
const WithLeadingIcon = LeadingIconTemplate.bind({})
|
|
236
|
+
const WithTrailingIcon = TrailingIconTemplate.bind({})
|
|
237
|
+
const WithButton = Template.bind({})
|
|
238
|
+
const Required = RequiredTemplate.bind({})
|
|
239
|
+
const WithError = Template.bind({})
|
|
240
|
+
const Disabled = Template.bind({})
|
|
241
|
+
const Password = Template.bind({})
|
|
242
|
+
const Temporal = TemporalTemplate.bind({})
|
|
243
|
+
|
|
244
|
+
// Args
|
|
245
|
+
Default.args = {
|
|
246
|
+
placeholder: "e.g. TF1 AAA",
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
WithLeadingIcon.args = {
|
|
250
|
+
placeholder: "Search…",
|
|
251
|
+
leadingIcon: { icon: <DummyPhoneIcon className="size-6" /> },
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
WithButton.args = {
|
|
255
|
+
id: "text-input-button",
|
|
256
|
+
placeholder: "Search…",
|
|
257
|
+
button: { label: "Search", variant: "primary" },
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
Small.args = {
|
|
261
|
+
size: "sm",
|
|
262
|
+
placeholder: "e.g. TF1 AAA",
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
Required.args = {
|
|
266
|
+
required: true,
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
WithError.args = {
|
|
270
|
+
error: { message: "This field is required." },
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
Disabled.args = {
|
|
274
|
+
disabled: true,
|
|
275
|
+
placeholder: "Disabled",
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
Variants.args = {
|
|
279
|
+
placeholder: "e.g. TF1 AAA",
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
Password.args = {
|
|
283
|
+
type: "password",
|
|
284
|
+
placeholder: "Enter your password",
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Parameters
|
|
288
|
+
Required.parameters = {
|
|
289
|
+
docs: {
|
|
290
|
+
description: {
|
|
291
|
+
story: 'Setting `required` hides the "Optional" tag and marks the input as required.',
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
WithError.parameters = {
|
|
297
|
+
docs: {
|
|
298
|
+
description: {
|
|
299
|
+
story: "Pass an `error` object with a `message` string to display an inline error.",
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
WithLeadingIcon.parameters = {
|
|
305
|
+
docs: {
|
|
306
|
+
description: {
|
|
307
|
+
story: "The `leadingIcon` prop renders an icon inside the field, aligned to the left.",
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
WithButton.parameters = {
|
|
313
|
+
docs: {
|
|
314
|
+
description: {
|
|
315
|
+
story: "The `button` prop renders an inline action button inside the field.",
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
Small.parameters = {
|
|
321
|
+
docs: {
|
|
322
|
+
description: {
|
|
323
|
+
story: 'Setting `size="sm"` renders a more compact version of the input field.',
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
Disabled.parameters = {
|
|
329
|
+
docs: {
|
|
330
|
+
description: {
|
|
331
|
+
story: "Setting `disabled` prevents interaction and visually dims the field.",
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
Variants.parameters = {
|
|
337
|
+
docs: {
|
|
338
|
+
description: {
|
|
339
|
+
story:
|
|
340
|
+
'The `variant` prop controls the color scheme of the input. Use `"dark"` on light backgrounds and `"light"` on dark backgrounds.',
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
WithTrailingIcon.parameters = {
|
|
346
|
+
docs: {
|
|
347
|
+
description: {
|
|
348
|
+
story:
|
|
349
|
+
"The `trailingIcon` prop renders an icon inside the field, aligned to the right. Providing an `onClick` handler makes the icon interactive.",
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Temporal.parameters = {
|
|
355
|
+
docs: {
|
|
356
|
+
description: {
|
|
357
|
+
story:
|
|
358
|
+
"The input supports all native temporal types (`date`, `time`, `datetime-local`, `month`, `week`) via the `type` prop.",
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
Password.parameters = {
|
|
364
|
+
docs: {
|
|
365
|
+
description: {
|
|
366
|
+
story: 'Setting `type="password"` masks the input value for sensitive fields.',
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export {
|
|
372
|
+
Default,
|
|
373
|
+
Small,
|
|
374
|
+
Variants,
|
|
375
|
+
WithLeadingIcon,
|
|
376
|
+
WithTrailingIcon,
|
|
377
|
+
WithButton,
|
|
378
|
+
Temporal,
|
|
379
|
+
Password,
|
|
380
|
+
WithError,
|
|
381
|
+
Required,
|
|
382
|
+
Disabled,
|
|
383
|
+
}
|
|
384
|
+
export default meta
|