@whity/ui 0.5.0 → 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 +107 -107
- package/package.json +221 -192
- package/src/access-denied.stories.tsx +179 -179
- package/src/access-denied.tsx +305 -305
- package/src/action-proposal.tsx +338 -302
- package/src/actor-chip.tsx +71 -71
- package/src/agent-activity.tsx +163 -163
- package/src/agent-collaboration.stories.tsx +156 -156
- package/src/agent-run-status.tsx +196 -196
- package/src/alert-dialog.stories.tsx +45 -45
- package/src/alert-dialog.tsx +147 -147
- package/src/alert.stories.tsx +91 -91
- package/src/alert.tsx +89 -89
- package/src/app-sidebar.stories.tsx +195 -195
- package/src/app-sidebar.tsx +604 -500
- package/src/approval-queue.tsx +109 -108
- package/src/audience-group-picker.stories.tsx +198 -198
- package/src/audience-group-picker.tsx +362 -362
- package/src/audience-people-picker.stories.tsx +102 -102
- package/src/audience-people-picker.tsx +279 -279
- package/src/avatar-pattern.ts +138 -0
- package/src/avatar.tsx +125 -83
- package/src/badge.stories.tsx +105 -105
- package/src/badge.tsx +68 -68
- package/src/beta-warning.stories.tsx +79 -79
- package/src/beta-warning.tsx +189 -189
- package/src/bilingual-input.stories.tsx +82 -82
- package/src/bilingual-input.tsx +188 -183
- package/src/board.tsx +216 -0
- package/src/breadcrumb.stories.tsx +51 -51
- package/src/breadcrumb.tsx +90 -90
- package/src/built-on-whity.tsx +52 -0
- package/src/button.stories.tsx +87 -87
- package/src/button.tsx +123 -118
- package/src/card.stories.tsx +423 -423
- package/src/card.tsx +180 -180
- package/src/chart.stories.tsx +66 -66
- package/src/chart.tsx +228 -228
- package/src/checkbox.stories.tsx +62 -62
- package/src/checkbox.tsx +54 -54
- package/src/collapsible.stories.tsx +48 -48
- package/src/collapsible.tsx +34 -34
- package/src/color-card.stories.tsx +61 -61
- package/src/color-card.tsx +270 -270
- package/src/color-picker.stories.tsx +65 -65
- package/src/color-picker.tsx +425 -425
- package/src/column-matcher.tsx +84 -0
- package/src/command-palette.tsx +398 -306
- package/src/confirm-action.tsx +98 -0
- package/src/copy-block.stories.tsx +38 -38
- package/src/copy-block.tsx +85 -85
- package/src/data-table.stories.tsx +200 -200
- package/src/data-table.tsx +1686 -1106
- package/src/date-picker.stories.tsx +61 -61
- package/src/date-picker.tsx +456 -422
- package/src/design-cards.stories.tsx +551 -458
- package/src/dialog.stories.tsx +48 -48
- package/src/dialog.tsx +179 -166
- package/src/display-preferences.tsx +50 -0
- package/src/documents/barcode-svg.stories.tsx +72 -72
- package/src/documents/barcode-svg.tsx +79 -79
- package/src/dropdown-menu.stories.tsx +77 -77
- package/src/dropdown-menu.tsx +271 -271
- package/src/editor/agent-panel.tsx +222 -0
- package/src/editor/agents.stories.tsx +81 -0
- package/src/editor/agents.ts +55 -0
- package/src/editor/behaviour.ts +279 -279
- package/src/editor/block-ids.ts +44 -44
- package/src/editor/block-list.tsx +104 -101
- package/src/editor/block-toolbar.tsx +490 -477
- package/src/editor/bubble.tsx +119 -93
- package/src/editor/catalogue.ts +169 -103
- package/src/editor/collab-rail.tsx +746 -746
- package/src/editor/collab.stories.tsx +207 -207
- package/src/editor/collab.ts +87 -87
- package/src/editor/contract.ts +476 -408
- package/src/editor/convert.ts +414 -362
- package/src/editor/doc-editor.stories.tsx +98 -98
- package/src/editor/doc-editor.tsx +1492 -1287
- package/src/editor/editor.css +636 -536
- package/src/editor/extensions.ts +86 -86
- package/src/editor/field-bar.tsx +154 -0
- package/src/editor/field-picker.tsx +109 -107
- package/src/editor/fields.ts +100 -100
- package/src/editor/gutter.tsx +443 -367
- package/src/editor/index.ts +23 -22
- package/src/editor/label-sheet.tsx +289 -289
- package/src/editor/labels.ts +394 -310
- package/src/editor/link-tools.tsx +141 -141
- package/src/editor/node-views.tsx +461 -450
- package/src/editor/page-view.tsx +372 -353
- package/src/editor/phone.tsx +310 -0
- package/src/editor/plugin-block-view.tsx +230 -0
- package/src/editor/plugin-blocks.stories.tsx +96 -0
- package/src/editor/plugin-blocks.ts +52 -0
- package/src/editor/publish-check.tsx +201 -182
- package/src/editor/rich-blocks.stories.tsx +146 -146
- package/src/editor/sample.ts +40 -40
- package/src/editor/save-block-dialog.tsx +141 -0
- package/src/editor/saved-block-view.tsx +205 -0
- package/src/editor/saved-blocks.stories.tsx +105 -0
- package/src/editor/saved-parts.ts +192 -0
- package/src/editor/schema-rich.ts +156 -150
- package/src/editor/schema.ts +368 -315
- package/src/editor/services.tsx +205 -127
- package/src/editor/slash.ts +64 -64
- package/src/editor/suggesting.ts +372 -372
- package/src/editor/suggestions.ts +763 -763
- package/src/editor/table-keys.ts +66 -66
- package/src/editor/templates.stories.tsx +324 -324
- package/src/editor/toolbar.tsx +364 -358
- package/src/empty-state.stories.tsx +51 -51
- package/src/empty-state.tsx +126 -100
- package/src/empty-state.usage-notes.md +30 -30
- package/src/form.stories.tsx +112 -112
- package/src/form.tsx +176 -176
- package/src/globals.css +20 -20
- package/src/icon-button.tsx +85 -85
- package/src/icon-map.ts +335 -244
- package/src/icon.tsx +41 -41
- package/src/index.ts +90 -67
- package/src/input.stories.tsx +157 -157
- package/src/input.tsx +768 -759
- package/src/kpi-strip.tsx +47 -0
- package/src/localized-text.ts +76 -0
- package/src/locked-screen.stories.tsx +29 -29
- package/src/locked-screen.tsx +75 -61
- package/src/lockup.tsx +42 -0
- package/src/lottie.tsx +441 -0
- package/src/mark.tsx +62 -62
- package/src/math-text.stories.tsx +33 -33
- package/src/math-text.tsx +43 -43
- package/src/menu-bar.stories.tsx +198 -198
- package/src/menu-bar.tsx +373 -373
- package/src/message-thread.tsx +181 -0
- package/src/money/currency.ts +244 -230
- package/src/money/money-input.tsx +131 -0
- package/src/money/money.tsx +33 -0
- package/src/open-on-computer.tsx +150 -0
- package/src/otp-input.tsx +161 -0
- package/src/page-header.stories.tsx +95 -95
- package/src/page-header.tsx +122 -122
- package/src/page-shell.stories.tsx +42 -42
- package/src/page-shell.tsx +32 -32
- package/src/page-states.tsx +277 -0
- package/src/pagination.stories.tsx +45 -45
- package/src/pagination.tsx +98 -98
- package/src/paper-sheet.stories.tsx +88 -0
- package/src/paper-sheet.tsx +85 -0
- package/src/phone-tab-bar.tsx +152 -0
- package/src/plugin-card.stories.tsx +208 -180
- package/src/plugin-card.tsx +931 -848
- package/src/popover.stories.tsx +48 -48
- package/src/popover.tsx +55 -55
- package/src/radio-group.stories.tsx +26 -26
- package/src/radio-group.tsx +44 -44
- package/src/route-flow/editor.tsx +1087 -1014
- package/src/route-flow/model.ts +771 -716
- package/src/save-bar.tsx +94 -0
- package/src/scope-grant.tsx +139 -139
- package/src/screen-too-small.stories.tsx +61 -61
- package/src/screen-too-small.tsx +104 -104
- package/src/search-field.tsx +65 -0
- package/src/select.stories.tsx +44 -44
- package/src/select.tsx +197 -197
- package/src/separator.stories.tsx +34 -34
- package/src/separator.tsx +34 -34
- package/src/sheet.stories.tsx +49 -49
- package/src/sheet.tsx +168 -168
- package/src/skeleton.stories.tsx +28 -28
- package/src/skeleton.tsx +19 -19
- package/src/slider.stories.tsx +78 -78
- package/src/slider.tsx +300 -300
- package/src/spinner.stories.tsx +33 -33
- package/src/spinner.tsx +55 -55
- package/src/stepper.tsx +85 -0
- package/src/switch.stories.tsx +42 -42
- package/src/switch.tsx +41 -41
- package/src/switcher.stories.tsx +111 -111
- package/src/switcher.tsx +131 -131
- package/src/system-state.tsx +55 -0
- package/src/table.stories.tsx +48 -48
- package/src/table.tsx +121 -121
- package/src/tabs.stories.tsx +74 -74
- package/src/tabs.tsx +90 -90
- package/src/tag-input.stories.tsx +67 -67
- package/src/tag-input.tsx +117 -117
- package/src/tenant-logo.tsx +63 -63
- package/src/tenant-switcher.stories.tsx +38 -38
- package/src/tenant-switcher.tsx +164 -164
- package/src/textarea.stories.tsx +27 -27
- package/src/textarea.tsx +18 -18
- package/src/theme-mode.ts +52 -52
- package/src/time-grid.tsx +163 -0
- package/src/time-picker.stories.tsx +62 -62
- package/src/time-picker.tsx +615 -615
- package/src/toggle-group.tsx +138 -138
- package/src/tooltip.stories.tsx +43 -43
- package/src/tooltip.tsx +73 -73
- package/src/top-nav.stories.tsx +58 -58
- package/src/top-nav.tsx +324 -324
- package/src/undo-bar.tsx +107 -107
- package/src/utils.ts +45 -45
- package/src/view-toggle.stories.tsx +84 -84
- package/src/view-toggle.tsx +110 -110
package/src/icon.tsx
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { ICONS, iconNames, type IconName } from "./icon-map"
|
|
2
|
-
import { cn } from "./utils"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* One of the
|
|
6
|
-
* name. 16px beside 14px text, 20 in touch navigation, 24 in headers and
|
|
7
|
-
* empty states; the stroke is 2.25 at 16px and below and 2 above, so every
|
|
8
|
-
* size reads at the same weight (5.2). Decorative unless `label` is given.
|
|
9
|
-
* Direction icons (chevrons, arrows, undo, send, logout, external, lists)
|
|
10
|
-
* flip in right-to-left layouts; `mirror` overrides the icon's own default.
|
|
11
|
-
*/
|
|
12
|
-
function Icon({
|
|
13
|
-
name,
|
|
14
|
-
size = 16,
|
|
15
|
-
stroke,
|
|
16
|
-
label,
|
|
17
|
-
mirror,
|
|
18
|
-
className,
|
|
19
|
-
}: {
|
|
20
|
-
name: IconName
|
|
21
|
-
size?: number
|
|
22
|
-
stroke?: number
|
|
23
|
-
label?: string
|
|
24
|
-
mirror?: boolean
|
|
25
|
-
className?: string
|
|
26
|
-
}) {
|
|
27
|
-
const { icon: Glyph, mirror: mirrorsByDefault } = ICONS[name]
|
|
28
|
-
const flips = mirror ?? mirrorsByDefault
|
|
29
|
-
return (
|
|
30
|
-
<Glyph
|
|
31
|
-
data-slot="icon"
|
|
32
|
-
data-icon={name}
|
|
33
|
-
size={size}
|
|
34
|
-
stroke={stroke ?? (size <= 16 ? 2.25 : 2)}
|
|
35
|
-
className={cn("shrink-0", flips && "rtl:-scale-x-100", className)}
|
|
36
|
-
{...(label ? { role: "img", "aria-label": label } : { "aria-hidden": true })}
|
|
37
|
-
/>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { Icon, iconNames, type IconName }
|
|
1
|
+
import { ICONS, iconNames, type IconName } from "./icon-map"
|
|
2
|
+
import { cn } from "./utils"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One of the 156 curated Tabler outline icons (decision 5.1), by its Whity
|
|
6
|
+
* name. 16px beside 14px text, 20 in touch navigation, 24 in headers and
|
|
7
|
+
* empty states; the stroke is 2.25 at 16px and below and 2 above, so every
|
|
8
|
+
* size reads at the same weight (5.2). Decorative unless `label` is given.
|
|
9
|
+
* Direction icons (chevrons, arrows, undo, send, logout, external, lists)
|
|
10
|
+
* flip in right-to-left layouts; `mirror` overrides the icon's own default.
|
|
11
|
+
*/
|
|
12
|
+
function Icon({
|
|
13
|
+
name,
|
|
14
|
+
size = 16,
|
|
15
|
+
stroke,
|
|
16
|
+
label,
|
|
17
|
+
mirror,
|
|
18
|
+
className,
|
|
19
|
+
}: {
|
|
20
|
+
name: IconName
|
|
21
|
+
size?: number
|
|
22
|
+
stroke?: number
|
|
23
|
+
label?: string
|
|
24
|
+
mirror?: boolean
|
|
25
|
+
className?: string
|
|
26
|
+
}) {
|
|
27
|
+
const { icon: Glyph, mirror: mirrorsByDefault } = ICONS[name]
|
|
28
|
+
const flips = mirror ?? mirrorsByDefault
|
|
29
|
+
return (
|
|
30
|
+
<Glyph
|
|
31
|
+
data-slot="icon"
|
|
32
|
+
data-icon={name}
|
|
33
|
+
size={size}
|
|
34
|
+
stroke={stroke ?? (size <= 16 ? 2.25 : 2)}
|
|
35
|
+
className={cn("shrink-0", flips && "rtl:-scale-x-100", className)}
|
|
36
|
+
{...(label ? { role: "img", "aria-label": label } : { "aria-hidden": true })}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Icon, iconNames, type IconName }
|
package/src/index.ts
CHANGED
|
@@ -1,67 +1,90 @@
|
|
|
1
|
-
export * from "./access-denied"
|
|
2
|
-
export * from "./actor-chip"
|
|
3
|
-
export * from "./agent-run-status"
|
|
4
|
-
export * from "./alert"
|
|
5
|
-
export * from "./alert-dialog"
|
|
6
|
-
export * from "./app-sidebar"
|
|
7
|
-
export * from "./audience-group-picker"
|
|
8
|
-
export * from "./audience-people-picker"
|
|
9
|
-
export * from "./avatar"
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export * from "./
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
35
|
-
export * from "./
|
|
36
|
-
export * from "./
|
|
37
|
-
export * from "./
|
|
38
|
-
export * from "./
|
|
39
|
-
export * from "./
|
|
40
|
-
export * from "./
|
|
41
|
-
export * from "./
|
|
42
|
-
export * from "./
|
|
43
|
-
export * from "./
|
|
44
|
-
export * from "./
|
|
45
|
-
export * from "./
|
|
46
|
-
export * from "./
|
|
47
|
-
export * from "./
|
|
48
|
-
export * from "./
|
|
49
|
-
export * from "./
|
|
50
|
-
export * from "./
|
|
51
|
-
export * from "./
|
|
52
|
-
export * from "./
|
|
53
|
-
export * from "./
|
|
54
|
-
export * from "./
|
|
55
|
-
export * from "./
|
|
56
|
-
export * from "./
|
|
57
|
-
export * from "./
|
|
58
|
-
export * from "./
|
|
59
|
-
export * from "./
|
|
60
|
-
export * from "./
|
|
61
|
-
export * from "./
|
|
62
|
-
export * from "./
|
|
63
|
-
export * from "./
|
|
64
|
-
export * from "./
|
|
65
|
-
export * from "./
|
|
66
|
-
export * from "./
|
|
67
|
-
export * from "./
|
|
1
|
+
export * from "./access-denied"
|
|
2
|
+
export * from "./actor-chip"
|
|
3
|
+
export * from "./agent-run-status"
|
|
4
|
+
export * from "./alert"
|
|
5
|
+
export * from "./alert-dialog"
|
|
6
|
+
export * from "./app-sidebar"
|
|
7
|
+
export * from "./audience-group-picker"
|
|
8
|
+
export * from "./audience-people-picker"
|
|
9
|
+
export * from "./avatar"
|
|
10
|
+
export * from "./avatar-pattern"
|
|
11
|
+
export * from "./board"
|
|
12
|
+
export * from "./column-matcher"
|
|
13
|
+
export * from "./kpi-strip"
|
|
14
|
+
export * from "./message-thread"
|
|
15
|
+
export * from "./time-grid"
|
|
16
|
+
export * from "./badge"
|
|
17
|
+
export * from "./beta-warning"
|
|
18
|
+
export * from "./bilingual-input"
|
|
19
|
+
export * from "./localized-text"
|
|
20
|
+
export * from "./breadcrumb"
|
|
21
|
+
export * from "./button"
|
|
22
|
+
export * from "./card"
|
|
23
|
+
export * from "./chart"
|
|
24
|
+
export * from "./checkbox"
|
|
25
|
+
export * from "./collapsible"
|
|
26
|
+
export * from "./color-card"
|
|
27
|
+
export * from "./color-picker"
|
|
28
|
+
export * from "./copy-block"
|
|
29
|
+
export * from "./data-table"
|
|
30
|
+
export * from "./date-picker"
|
|
31
|
+
export * from "./dialog"
|
|
32
|
+
export * from "./dropdown-menu"
|
|
33
|
+
export * from "./empty-state"
|
|
34
|
+
export * from "./form"
|
|
35
|
+
export * from "./icon"
|
|
36
|
+
export * from "./icon-button"
|
|
37
|
+
export * from "./input"
|
|
38
|
+
export * from "./locked-screen"
|
|
39
|
+
export * from "./lottie"
|
|
40
|
+
export * from "./mark"
|
|
41
|
+
export * from "./math-text"
|
|
42
|
+
export * from "./menu-bar"
|
|
43
|
+
export * from "./page-header"
|
|
44
|
+
export * from "./page-shell"
|
|
45
|
+
export * from "./phone-tab-bar"
|
|
46
|
+
export * from "./open-on-computer"
|
|
47
|
+
export * from "./pagination"
|
|
48
|
+
export * from "./plugin-card"
|
|
49
|
+
export * from "./popover"
|
|
50
|
+
export * from "./radio-group"
|
|
51
|
+
export * from "./screen-too-small"
|
|
52
|
+
export * from "./select"
|
|
53
|
+
export * from "./separator"
|
|
54
|
+
export * from "./sheet"
|
|
55
|
+
export * from "./skeleton"
|
|
56
|
+
export * from "./slider"
|
|
57
|
+
export * from "./spinner"
|
|
58
|
+
export * from "./switch"
|
|
59
|
+
export * from "./switcher"
|
|
60
|
+
export * from "./table"
|
|
61
|
+
export * from "./tabs"
|
|
62
|
+
export * from "./tag-input"
|
|
63
|
+
export * from "./tenant-logo"
|
|
64
|
+
export * from "./built-on-whity"
|
|
65
|
+
export * from "./paper-sheet"
|
|
66
|
+
export * from "./lockup"
|
|
67
|
+
export * from "./tenant-switcher"
|
|
68
|
+
export * from "./textarea"
|
|
69
|
+
export * from "./theme-mode"
|
|
70
|
+
export * from "./time-picker"
|
|
71
|
+
export * from "./toggle-group"
|
|
72
|
+
export * from "./tooltip"
|
|
73
|
+
export * from "./top-nav"
|
|
74
|
+
export * from "./utils"
|
|
75
|
+
export * from "./view-toggle"
|
|
76
|
+
export * from "./action-proposal"
|
|
77
|
+
export * from "./agent-activity"
|
|
78
|
+
export * from "./approval-queue"
|
|
79
|
+
export * from "./scope-grant"
|
|
80
|
+
export * from "./undo-bar"
|
|
81
|
+
export * from "./confirm-action"
|
|
82
|
+
export * from "./display-preferences"
|
|
83
|
+
export * from "./money/money-input"
|
|
84
|
+
export * from "./money/money"
|
|
85
|
+
export * from "./page-states"
|
|
86
|
+
export * from "./save-bar"
|
|
87
|
+
export * from "./search-field"
|
|
88
|
+
export * from "./stepper"
|
|
89
|
+
export * from "./otp-input"
|
|
90
|
+
export * from "./system-state"
|
package/src/input.stories.tsx
CHANGED
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
-
|
|
3
|
-
import { Input } from "./input"
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: "Primitives/Input",
|
|
7
|
-
component: Input,
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
args: { placeholder: "you@example.com" },
|
|
10
|
-
} satisfies Meta<typeof Input>
|
|
11
|
-
|
|
12
|
-
export default meta
|
|
13
|
-
type Story = StoryObj<typeof meta>
|
|
14
|
-
|
|
15
|
-
export const Playground: Story = {}
|
|
16
|
-
|
|
17
|
-
export const Types: Story = {
|
|
18
|
-
render: () => (
|
|
19
|
-
<div className="flex w-80 flex-col gap-4">
|
|
20
|
-
<Input placeholder="Text" />
|
|
21
|
-
<Input type="email" placeholder="Email" />
|
|
22
|
-
<Input type="password" placeholder="Password" />
|
|
23
|
-
<Input type="number" placeholder="42" />
|
|
24
|
-
<Input type="search" placeholder="Search components..." />
|
|
25
|
-
<Input type="date" />
|
|
26
|
-
<Input type="time" />
|
|
27
|
-
<Input type="range" defaultValue={65} min={0} max={100} label="Volume Slider Input" />
|
|
28
|
-
</div>
|
|
29
|
-
),
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const DateTimeAndSearch: Story = {
|
|
33
|
-
render: () => (
|
|
34
|
-
<div className="flex w-80 flex-col gap-4">
|
|
35
|
-
<Input
|
|
36
|
-
type="search"
|
|
37
|
-
label="Search Database"
|
|
38
|
-
placeholder="Type to filter records..."
|
|
39
|
-
tooltip="Performs instant client and server side search."
|
|
40
|
-
helperText="Includes search icon and clear trigger."
|
|
41
|
-
/>
|
|
42
|
-
<Input
|
|
43
|
-
type="date"
|
|
44
|
-
label="Start Date"
|
|
45
|
-
required
|
|
46
|
-
tooltip="Select event start date."
|
|
47
|
-
helperText="Native date picker with custom calendar icon."
|
|
48
|
-
/>
|
|
49
|
-
<Input
|
|
50
|
-
type="time"
|
|
51
|
-
label="Shift Start Time"
|
|
52
|
-
required
|
|
53
|
-
tooltip="Select shift time with 1-minute granularity and direct wheel scroll."
|
|
54
|
-
helperText="Direct wheel scroll over columns ticks hours and minutes seamlessly."
|
|
55
|
-
/>
|
|
56
|
-
<Input
|
|
57
|
-
type="range"
|
|
58
|
-
label="Brightness Control"
|
|
59
|
-
defaultValue={75}
|
|
60
|
-
tooltip="Adjust brightness level from 0 to 100%."
|
|
61
|
-
helperText="Input type='range' renders custom Radix slider with value badge."
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
),
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const OutsideLabelAndTooltip: Story = {
|
|
68
|
-
render: () => (
|
|
69
|
-
<div className="flex w-80 flex-col gap-4">
|
|
70
|
-
<Input
|
|
71
|
-
label="Email"
|
|
72
|
-
required
|
|
73
|
-
tooltip="Enter your primary work email address."
|
|
74
|
-
placeholder="alex@company.com"
|
|
75
|
-
helperText="Clean static title positioned outside above the field."
|
|
76
|
-
/>
|
|
77
|
-
<Input
|
|
78
|
-
type="password"
|
|
79
|
-
label="Password"
|
|
80
|
-
required
|
|
81
|
-
tooltip="Must contain at least 8 characters."
|
|
82
|
-
placeholder="••••••••"
|
|
83
|
-
helperText="Includes show/hide password toggle button."
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
),
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export const ErrorAndNotes: Story = {
|
|
90
|
-
render: () => (
|
|
91
|
-
<div className="flex w-80 flex-col gap-4">
|
|
92
|
-
<Input
|
|
93
|
-
label="Username"
|
|
94
|
-
required
|
|
95
|
-
defaultValue="invalid_user_#99"
|
|
96
|
-
aria-invalid
|
|
97
|
-
errorText="Usernames can only contain letters, numbers, and underscores."
|
|
98
|
-
/>
|
|
99
|
-
<Input
|
|
100
|
-
label="Max Users"
|
|
101
|
-
type="number"
|
|
102
|
-
defaultValue={5}
|
|
103
|
-
tooltip="Maximum seats allowed in team subscription."
|
|
104
|
-
helperText="Includes custom stepper buttons."
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
),
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export const DropzoneFileDefault: Story = {
|
|
111
|
-
render: () => (
|
|
112
|
-
<div className="flex w-96 flex-col gap-4">
|
|
113
|
-
<Input
|
|
114
|
-
type="file"
|
|
115
|
-
multiple
|
|
116
|
-
label="Attachment Uploads (Default Dropzone)"
|
|
117
|
-
required
|
|
118
|
-
tooltip="Drag files directly into the box or click to select."
|
|
119
|
-
helperText="Default file upload style is now the prominent drag-and-drop box with larger file cards."
|
|
120
|
-
/>
|
|
121
|
-
</div>
|
|
122
|
-
),
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export const CompactFileInputAlternative: Story = {
|
|
126
|
-
render: () => (
|
|
127
|
-
<div className="flex w-96 flex-col gap-4">
|
|
128
|
-
<div>
|
|
129
|
-
<Input
|
|
130
|
-
type="file"
|
|
131
|
-
fileVariant="compact"
|
|
132
|
-
label="Single File (Compact Variant)"
|
|
133
|
-
helperText="Inline compact alternative file picker with pill badges."
|
|
134
|
-
/>
|
|
135
|
-
</div>
|
|
136
|
-
<div>
|
|
137
|
-
<Input
|
|
138
|
-
type="file"
|
|
139
|
-
fileVariant="compact"
|
|
140
|
-
multiple
|
|
141
|
-
label="Multiple Files (Compact Variant)"
|
|
142
|
-
helperText="Compact inline multi-file picker with interactive pills and remove buttons."
|
|
143
|
-
/>
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
),
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export const States: Story = {
|
|
150
|
-
render: () => (
|
|
151
|
-
<div className="flex w-72 flex-col gap-3">
|
|
152
|
-
<Input placeholder="Default" />
|
|
153
|
-
<Input placeholder="Disabled" disabled />
|
|
154
|
-
<Input placeholder="Invalid" aria-invalid defaultValue="not-an-email" />
|
|
155
|
-
</div>
|
|
156
|
-
),
|
|
157
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
+
|
|
3
|
+
import { Input } from "./input"
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Primitives/Input",
|
|
7
|
+
component: Input,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
args: { placeholder: "you@example.com" },
|
|
10
|
+
} satisfies Meta<typeof Input>
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
type Story = StoryObj<typeof meta>
|
|
14
|
+
|
|
15
|
+
export const Playground: Story = {}
|
|
16
|
+
|
|
17
|
+
export const Types: Story = {
|
|
18
|
+
render: () => (
|
|
19
|
+
<div className="flex w-80 flex-col gap-4">
|
|
20
|
+
<Input placeholder="Text" />
|
|
21
|
+
<Input type="email" placeholder="Email" />
|
|
22
|
+
<Input type="password" placeholder="Password" />
|
|
23
|
+
<Input type="number" placeholder="42" />
|
|
24
|
+
<Input type="search" placeholder="Search components..." />
|
|
25
|
+
<Input type="date" />
|
|
26
|
+
<Input type="time" />
|
|
27
|
+
<Input type="range" defaultValue={65} min={0} max={100} label="Volume Slider Input" />
|
|
28
|
+
</div>
|
|
29
|
+
),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const DateTimeAndSearch: Story = {
|
|
33
|
+
render: () => (
|
|
34
|
+
<div className="flex w-80 flex-col gap-4">
|
|
35
|
+
<Input
|
|
36
|
+
type="search"
|
|
37
|
+
label="Search Database"
|
|
38
|
+
placeholder="Type to filter records..."
|
|
39
|
+
tooltip="Performs instant client and server side search."
|
|
40
|
+
helperText="Includes search icon and clear trigger."
|
|
41
|
+
/>
|
|
42
|
+
<Input
|
|
43
|
+
type="date"
|
|
44
|
+
label="Start Date"
|
|
45
|
+
required
|
|
46
|
+
tooltip="Select event start date."
|
|
47
|
+
helperText="Native date picker with custom calendar icon."
|
|
48
|
+
/>
|
|
49
|
+
<Input
|
|
50
|
+
type="time"
|
|
51
|
+
label="Shift Start Time"
|
|
52
|
+
required
|
|
53
|
+
tooltip="Select shift time with 1-minute granularity and direct wheel scroll."
|
|
54
|
+
helperText="Direct wheel scroll over columns ticks hours and minutes seamlessly."
|
|
55
|
+
/>
|
|
56
|
+
<Input
|
|
57
|
+
type="range"
|
|
58
|
+
label="Brightness Control"
|
|
59
|
+
defaultValue={75}
|
|
60
|
+
tooltip="Adjust brightness level from 0 to 100%."
|
|
61
|
+
helperText="Input type='range' renders custom Radix slider with value badge."
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const OutsideLabelAndTooltip: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<div className="flex w-80 flex-col gap-4">
|
|
70
|
+
<Input
|
|
71
|
+
label="Email"
|
|
72
|
+
required
|
|
73
|
+
tooltip="Enter your primary work email address."
|
|
74
|
+
placeholder="alex@company.com"
|
|
75
|
+
helperText="Clean static title positioned outside above the field."
|
|
76
|
+
/>
|
|
77
|
+
<Input
|
|
78
|
+
type="password"
|
|
79
|
+
label="Password"
|
|
80
|
+
required
|
|
81
|
+
tooltip="Must contain at least 8 characters."
|
|
82
|
+
placeholder="••••••••"
|
|
83
|
+
helperText="Includes show/hide password toggle button."
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const ErrorAndNotes: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<div className="flex w-80 flex-col gap-4">
|
|
92
|
+
<Input
|
|
93
|
+
label="Username"
|
|
94
|
+
required
|
|
95
|
+
defaultValue="invalid_user_#99"
|
|
96
|
+
aria-invalid
|
|
97
|
+
errorText="Usernames can only contain letters, numbers, and underscores."
|
|
98
|
+
/>
|
|
99
|
+
<Input
|
|
100
|
+
label="Max Users"
|
|
101
|
+
type="number"
|
|
102
|
+
defaultValue={5}
|
|
103
|
+
tooltip="Maximum seats allowed in team subscription."
|
|
104
|
+
helperText="Includes custom stepper buttons."
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
),
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const DropzoneFileDefault: Story = {
|
|
111
|
+
render: () => (
|
|
112
|
+
<div className="flex w-96 flex-col gap-4">
|
|
113
|
+
<Input
|
|
114
|
+
type="file"
|
|
115
|
+
multiple
|
|
116
|
+
label="Attachment Uploads (Default Dropzone)"
|
|
117
|
+
required
|
|
118
|
+
tooltip="Drag files directly into the box or click to select."
|
|
119
|
+
helperText="Default file upload style is now the prominent drag-and-drop box with larger file cards."
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
),
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export const CompactFileInputAlternative: Story = {
|
|
126
|
+
render: () => (
|
|
127
|
+
<div className="flex w-96 flex-col gap-4">
|
|
128
|
+
<div>
|
|
129
|
+
<Input
|
|
130
|
+
type="file"
|
|
131
|
+
fileVariant="compact"
|
|
132
|
+
label="Single File (Compact Variant)"
|
|
133
|
+
helperText="Inline compact alternative file picker with pill badges."
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
<div>
|
|
137
|
+
<Input
|
|
138
|
+
type="file"
|
|
139
|
+
fileVariant="compact"
|
|
140
|
+
multiple
|
|
141
|
+
label="Multiple Files (Compact Variant)"
|
|
142
|
+
helperText="Compact inline multi-file picker with interactive pills and remove buttons."
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
),
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export const States: Story = {
|
|
150
|
+
render: () => (
|
|
151
|
+
<div className="flex w-72 flex-col gap-3">
|
|
152
|
+
<Input placeholder="Default" />
|
|
153
|
+
<Input placeholder="Disabled" disabled />
|
|
154
|
+
<Input placeholder="Invalid" aria-invalid defaultValue="not-an-email" />
|
|
155
|
+
</div>
|
|
156
|
+
),
|
|
157
|
+
}
|