@cloudflare/kumo 1.18.0 → 1.19.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/CHANGELOG.md +90 -0
- package/ai/component-registry.json +174 -66
- package/ai/component-registry.md +836 -503
- package/ai/schemas.ts +19 -3
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +55 -8
- package/dist/ai/schemas.d.ts.map +1 -1
- package/dist/ai/schemas.js +163 -146
- package/dist/ai/schemas.js.map +1 -1
- package/dist/chunks/{Legend-o0ntojbaplmszwk0.js → Legend-ks7se6149vsa3tze.js} +127 -118
- package/dist/chunks/Legend-ks7se6149vsa3tze.js.map +1 -0
- package/dist/chunks/{breadcrumbs-k39s28qx05vbxxth.js → breadcrumbs-ge20hcb3o5spswrk.js} +2 -2
- package/dist/chunks/{breadcrumbs-k39s28qx05vbxxth.js.map → breadcrumbs-ge20hcb3o5spswrk.js.map} +1 -1
- package/dist/chunks/{button-cdxnqcgzwko8ooha.js → button-oaqi7ykdisyskoos.js} +12 -12
- package/dist/chunks/button-oaqi7ykdisyskoos.js.map +1 -0
- package/dist/chunks/{checkbox-kt1uojk2f9e0d0h1.js → checkbox-mwgmohffm22ut13s.js} +5 -5
- package/dist/chunks/checkbox-mwgmohffm22ut13s.js.map +1 -0
- package/dist/chunks/{clipboard-text-vcbvmtne4zjk4b18.js → clipboard-text-dxczqon3d27xp6f0.js} +10 -10
- package/dist/chunks/{clipboard-text-vcbvmtne4zjk4b18.js.map → clipboard-text-dxczqon3d27xp6f0.js.map} +1 -1
- package/dist/chunks/{cloudflare-logo-bgts2jgsdh7sslw4.js → cloudflare-logo-pbavoe1wu8nr5c4n.js} +9 -9
- package/dist/chunks/{cloudflare-logo-bgts2jgsdh7sslw4.js.map → cloudflare-logo-pbavoe1wu8nr5c4n.js.map} +1 -1
- package/dist/chunks/{combobox-he2hd9e2ruknq5mp.js → combobox-eaowwt1xr4d23gsn.js} +113 -101
- package/dist/chunks/combobox-eaowwt1xr4d23gsn.js.map +1 -0
- package/dist/chunks/{command-palette-jc1w07jwakxvj23a.js → command-palette-maqtbmpfev9mysqd.js} +19 -19
- package/dist/chunks/command-palette-maqtbmpfev9mysqd.js.map +1 -0
- package/dist/chunks/{dialog-oqh8l3l3zutpibxx.js → dialog-e3m5bhs7fds26p9y.js} +25 -25
- package/dist/chunks/dialog-e3m5bhs7fds26p9y.js.map +1 -0
- package/dist/chunks/{dropdown-ncwhcd912vmone8k.js → dropdown-ewte287db3vyt8t5.js} +94 -92
- package/dist/chunks/{dropdown-ncwhcd912vmone8k.js.map → dropdown-ewte287db3vyt8t5.js.map} +1 -1
- package/dist/chunks/{empty-cj898km1r8xwuw44.js → empty-dr1eckm2z40euns6.js} +2 -2
- package/dist/chunks/{empty-cj898km1r8xwuw44.js.map → empty-dr1eckm2z40euns6.js.map} +1 -1
- package/dist/chunks/{field-krp6z6vfbkrvufz2.js → field-bo5gmna16odrrb1q.js} +3 -3
- package/dist/chunks/{field-krp6z6vfbkrvufz2.js.map → field-bo5gmna16odrrb1q.js.map} +1 -1
- package/dist/chunks/{grid-m9r71jxo2b8q1972.js → grid-hj1ylz16p7g5uelh.js} +2 -2
- package/dist/chunks/{grid-m9r71jxo2b8q1972.js.map → grid-hj1ylz16p7g5uelh.js.map} +1 -1
- package/dist/chunks/{input-area-no30c09udyjxshu5.js → input-area-jkkkjej6luumrqpa.js} +4 -4
- package/dist/chunks/{input-area-no30c09udyjxshu5.js.map → input-area-jkkkjej6luumrqpa.js.map} +1 -1
- package/dist/chunks/{input-h48k3uagzrgb98au.js → input-cw05pbqdburghkus.js} +31 -31
- package/dist/chunks/input-cw05pbqdburghkus.js.map +1 -0
- package/dist/chunks/{input-group-lxdd09p60cf27pe1.js → input-group-lfugneuz71g42n0w.js} +6 -6
- package/dist/chunks/input-group-lfugneuz71g42n0w.js.map +1 -0
- package/dist/chunks/label-cvyvbqmt4mt757ff.js +68 -0
- package/dist/chunks/{label-latndvb1ngem7we8.js.map → label-cvyvbqmt4mt757ff.js.map} +1 -1
- package/dist/chunks/layer-card-ljqth3yxgnk04v2o.js +46 -0
- package/dist/chunks/layer-card-ljqth3yxgnk04v2o.js.map +1 -0
- package/dist/chunks/{link-hn5ejal7nhh0o0b4.js → link-fjnhtxvfe5ieamjf.js} +2 -2
- package/dist/chunks/{link-hn5ejal7nhh0o0b4.js.map → link-fjnhtxvfe5ieamjf.js.map} +1 -1
- package/dist/chunks/menubar-e5e4zwfagr0wx023.js +96 -0
- package/dist/chunks/menubar-e5e4zwfagr0wx023.js.map +1 -0
- package/dist/chunks/{meter-gfa1hz9fhjnvx784.js → meter-duj3micor1lqj3y2.js} +2 -2
- package/dist/chunks/{meter-gfa1hz9fhjnvx784.js.map → meter-duj3micor1lqj3y2.js.map} +1 -1
- package/dist/chunks/pagination-olaypvwr8swsmn8m.js +266 -0
- package/dist/chunks/pagination-olaypvwr8swsmn8m.js.map +1 -0
- package/dist/chunks/{popover-h300w4vit0s2ayej.js → popover-nv9cmzbo7mf6bky0.js} +70 -74
- package/dist/chunks/popover-nv9cmzbo7mf6bky0.js.map +1 -0
- package/dist/chunks/{radio-jouttv89lbvhs55r.js → radio-ihxbe37us2jnqtzf.js} +5 -5
- package/dist/chunks/radio-ihxbe37us2jnqtzf.js.map +1 -0
- package/dist/chunks/select-nx6ded5swra74iar.js +213 -0
- package/dist/chunks/select-nx6ded5swra74iar.js.map +1 -0
- package/dist/chunks/{sensitive-input-hd4tpqkzifad1yca.js → sensitive-input-00fujb510rrn61v9.js} +4 -4
- package/dist/chunks/{sensitive-input-hd4tpqkzifad1yca.js.map → sensitive-input-00fujb510rrn61v9.js.map} +1 -1
- package/dist/chunks/{sidebar-hljy3ssm8itc0ucx.js → sidebar-ltbfius1eolkl8tb.js} +22 -26
- package/dist/chunks/sidebar-ltbfius1eolkl8tb.js.map +1 -0
- package/dist/chunks/surface-dfgurg5eu3et4vw1.js +29 -0
- package/dist/chunks/surface-dfgurg5eu3et4vw1.js.map +1 -0
- package/dist/chunks/{switch-ihaydbzem62bey4p.js → switch-fbv3iawqo3o3jgap.js} +17 -17
- package/dist/chunks/switch-fbv3iawqo3o3jgap.js.map +1 -0
- package/dist/chunks/table-of-contents-f813ivi7ta23vqdm.js +88 -0
- package/dist/chunks/table-of-contents-f813ivi7ta23vqdm.js.map +1 -0
- package/dist/chunks/table-olwwulga2l3hdwlx.js +189 -0
- package/dist/chunks/table-olwwulga2l3hdwlx.js.map +1 -0
- package/dist/chunks/{tabs-e7eh7l3mpk3xgmwq.js → tabs-lohcglgppp6gj0hp.js} +4 -4
- package/dist/chunks/{tabs-e7eh7l3mpk3xgmwq.js.map → tabs-lohcglgppp6gj0hp.js.map} +1 -1
- package/dist/chunks/{toast-bpz6iaq54u9jmuu8.js → toast-dg52x89yd231mxhe.js} +4 -4
- package/dist/chunks/{toast-bpz6iaq54u9jmuu8.js.map → toast-dg52x89yd231mxhe.js.map} +1 -1
- package/dist/chunks/{tooltip-belkznz8t8333h5f.js → tooltip-hikjvdbg3xghnq1x.js} +38 -37
- package/dist/chunks/tooltip-hikjvdbg3xghnq1x.js.map +1 -0
- package/dist/chunks/{vendor-base-ui-k7bzesq81ie36nya.js → vendor-base-ui-m5pz3e8c4grg5qmj.js} +21 -21
- package/dist/chunks/{vendor-base-ui-k7bzesq81ie36nya.js.map → vendor-base-ui-m5pz3e8c4grg5qmj.js.map} +1 -1
- package/dist/code.js +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/chart.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/cloudflare-logo.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-palette.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/empty.js +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/flow.js +2 -2
- package/dist/components/flow.js.map +1 -1
- package/dist/components/grid.js +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +1 -1
- package/dist/components/layer-card.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sensitive-input.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/surface.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table-of-contents.js +8 -0
- package/dist/components/table-of-contents.js.map +1 -0
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/index.js +124 -120
- package/dist/index.js.map +1 -1
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/csp-provider.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +1 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.js +1 -1
- package/dist/scripts/theme-generator/config.d.ts.map +1 -1
- package/dist/scripts/theme-generator/config.js +3 -3
- package/dist/scripts/theme-generator/config.js.map +1 -1
- package/dist/src/components/button/button.d.ts +1 -1
- package/dist/src/components/button/button.d.ts.map +1 -1
- package/dist/src/components/chart/EChart.d.ts +18 -2
- package/dist/src/components/chart/EChart.d.ts.map +1 -1
- package/dist/src/components/chart/TimeseriesChart.d.ts.map +1 -1
- package/dist/src/components/chart/index.d.ts +1 -1
- package/dist/src/components/chart/index.d.ts.map +1 -1
- package/dist/src/components/combobox/combobox.d.ts +16 -2
- package/dist/src/components/combobox/combobox.d.ts.map +1 -1
- package/dist/src/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/src/components/input/input.d.ts.map +1 -1
- package/dist/src/components/label/label.d.ts.map +1 -1
- package/dist/src/components/layer-card/layer-card.d.ts +39 -5
- package/dist/src/components/layer-card/layer-card.d.ts.map +1 -1
- package/dist/src/components/menubar/menubar.d.ts.map +1 -1
- package/dist/src/components/pagination/pagination.d.ts +51 -1
- package/dist/src/components/pagination/pagination.d.ts.map +1 -1
- package/dist/src/components/popover/popover.d.ts +35 -8
- package/dist/src/components/popover/popover.d.ts.map +1 -1
- package/dist/src/components/radio/radio.d.ts +1 -1
- package/dist/src/components/select/select.d.ts +49 -5
- package/dist/src/components/select/select.d.ts.map +1 -1
- package/dist/src/components/sidebar/sidebar.d.ts +2 -2
- package/dist/src/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/src/components/surface/index.d.ts +3 -0
- package/dist/src/components/surface/index.d.ts.map +1 -1
- package/dist/src/components/surface/surface.d.ts +14 -10
- package/dist/src/components/surface/surface.d.ts.map +1 -1
- package/dist/src/components/table/table.d.ts.map +1 -1
- package/dist/src/components/table-of-contents/index.d.ts +2 -0
- package/dist/src/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/src/components/table-of-contents/table-of-contents.d.ts +70 -0
- package/dist/src/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/src/components/tooltip/tooltip.d.ts +15 -6
- package/dist/src/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/styles/kumo-binding.css +1 -0
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/theme-kumo.css +6 -6
- package/package.json +5 -1
- package/scripts/theme-generator/config.ts +8 -6
- package/dist/chunks/Legend-o0ntojbaplmszwk0.js.map +0 -1
- package/dist/chunks/button-cdxnqcgzwko8ooha.js.map +0 -1
- package/dist/chunks/checkbox-kt1uojk2f9e0d0h1.js.map +0 -1
- package/dist/chunks/combobox-he2hd9e2ruknq5mp.js.map +0 -1
- package/dist/chunks/command-palette-jc1w07jwakxvj23a.js.map +0 -1
- package/dist/chunks/dialog-oqh8l3l3zutpibxx.js.map +0 -1
- package/dist/chunks/input-group-lxdd09p60cf27pe1.js.map +0 -1
- package/dist/chunks/input-h48k3uagzrgb98au.js.map +0 -1
- package/dist/chunks/label-latndvb1ngem7we8.js +0 -62
- package/dist/chunks/layer-card-l5yjvrxry1dhte57.js +0 -44
- package/dist/chunks/layer-card-l5yjvrxry1dhte57.js.map +0 -1
- package/dist/chunks/menubar-f1pilzooe5mue7c4.js +0 -92
- package/dist/chunks/menubar-f1pilzooe5mue7c4.js.map +0 -1
- package/dist/chunks/pagination-cu5lm6p5dxuycta4.js +0 -243
- package/dist/chunks/pagination-cu5lm6p5dxuycta4.js.map +0 -1
- package/dist/chunks/popover-h300w4vit0s2ayej.js.map +0 -1
- package/dist/chunks/radio-jouttv89lbvhs55r.js.map +0 -1
- package/dist/chunks/select-kva5ru5f673kah1m.js +0 -179
- package/dist/chunks/select-kva5ru5f673kah1m.js.map +0 -1
- package/dist/chunks/sidebar-hljy3ssm8itc0ucx.js.map +0 -1
- package/dist/chunks/surface-cilvbyhmyujz1bee.js +0 -36
- package/dist/chunks/surface-cilvbyhmyujz1bee.js.map +0 -1
- package/dist/chunks/switch-ihaydbzem62bey4p.js.map +0 -1
- package/dist/chunks/table-inweecadl3her7pd.js +0 -183
- package/dist/chunks/table-inweecadl3her7pd.js.map +0 -1
- package/dist/chunks/tooltip-belkznz8t8333h5f.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-
|
|
1
|
+
{"version":3,"file":"grid-hj1ylz16p7g5uelh.js","sources":["../../src/components/grid/grid.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Grid variant and gap definitions mapping layout names to their responsive Tailwind classes. */\nexport const KUMO_GRID_VARIANTS = {\n variant: {\n \"2up\": {\n classes: \"grid-cols-1 md:grid-cols-2\",\n description:\n \"Grid items stack on small screens, display side-by-side on medium screens and up\",\n },\n \"side-by-side\": {\n classes: \"grid-cols-2\",\n description: \"Grid items always displayed side-by-side\",\n },\n \"2-1\": {\n classes: \"grid-cols-1 md:grid-cols-[2fr_1fr]\",\n description:\n \"Two-thirds / one-third split (66%/33%) on medium screens and up\",\n },\n \"1-2\": {\n classes: \"grid-cols-1 md:grid-cols-[1fr_2fr]\",\n description:\n \"One-third / two-thirds split (33%/66%) on medium screens and up\",\n },\n \"1-3up\": {\n classes: \"grid-cols-1 lg:grid-cols-3\",\n description:\n \"Grid items stack on small screens, expand to 3 across on large screens\",\n },\n \"3up\": {\n classes: \"grid-cols-1 md:grid-cols-2 lg:grid-cols-3\",\n description:\n \"Grid items stack on small screens, 2 across on medium, 3 across on large\",\n },\n \"4up\": {\n classes: \"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\",\n description:\n \"Grid items stack on small screens, progressively increase columns at larger breakpoints\",\n },\n \"6up\": {\n classes: \"grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6\",\n description: \"Grid items start at 2 across, expand to 6 across on XL\",\n },\n \"1-2-4up\": {\n classes: \"grid-cols-1 md:grid-cols-2 lg:grid-cols-4\",\n description:\n \"Grid items stack on small screens, 2 across on medium, 4 across on large\",\n },\n },\n gap: {\n none: {\n classes: \"gap-0\",\n description: \"No gap between grid items\",\n },\n sm: {\n classes: \"gap-3\",\n description: \"Small gap between grid items\",\n },\n base: {\n classes: \"gap-2 md:gap-6 lg:gap-8\",\n description: \"Default responsive gap between grid items\",\n },\n lg: {\n classes: \"gap-8\",\n description: \"Large gap between grid items\",\n },\n },\n} as const;\n\nexport const KUMO_GRID_DEFAULT_VARIANTS = {\n gap: \"base\",\n} as const;\n\nexport type KumoGridVariant = keyof typeof KUMO_GRID_VARIANTS.variant;\nexport type KumoGridGap = keyof typeof KUMO_GRID_VARIANTS.gap;\n\n/**\n * Grid component props.\n *\n * @example\n * ```tsx\n * <Grid variant=\"3up\" gap=\"sm\">\n * <GridItem><Surface className=\"p-4\">1</Surface></GridItem>\n * <GridItem><Surface className=\"p-4\">2</Surface></GridItem>\n * <GridItem><Surface className=\"p-4\">3</Surface></GridItem>\n * </Grid>\n * ```\n */\nexport interface GridProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Grid items to render. */\n children?: React.ReactNode;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n /** Show dividers between grid items on mobile (only works with `\"4up\"` variant). */\n mobileDivider?: boolean;\n /**\n * Gap size between grid items.\n * - `\"none\"` — No gap\n * - `\"sm\"` — 12px gap\n * - `\"base\"` — Responsive gap (8px → 24px → 32px)\n * - `\"lg\"` — 32px gap\n * @default \"base\"\n */\n gap?: KumoGridGap;\n /**\n * Responsive column layout variant.\n * - `\"2up\"` — 1 col → 2 cols at md\n * - `\"side-by-side\"` — Always 2 cols\n * - `\"2-1\"` — 66%/33% split at md\n * - `\"1-2\"` — 33%/66% split at md\n * - `\"3up\"` — 1 → 2 → 3 cols\n * - `\"4up\"` — 1 → 2 → 3 → 4 cols\n * - `\"6up\"` — 2 → 3 → 4 → 6 cols\n * - `\"1-2-4up\"` — 1 → 2 → 4 cols\n */\n variant?: KumoGridVariant;\n}\n\n/** GridItem component props — a single cell within a Grid. */\nexport interface GridItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Content for this grid cell. */\n children?: React.ReactNode;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n}\n\ninterface GridContextValue {\n variant?: KumoGridVariant;\n gap: KumoGridGap;\n mobileDivider?: boolean;\n}\n\nconst GridContext = React.createContext<GridContextValue>({\n gap: \"base\",\n});\n\nexport function gridVariants({\n variant,\n gap = KUMO_GRID_DEFAULT_VARIANTS.gap,\n}: {\n variant?: KumoGridVariant;\n gap?: KumoGridGap;\n} = {}) {\n return cn(\n \"grid\",\n variant && KUMO_GRID_VARIANTS.variant[variant].classes,\n KUMO_GRID_VARIANTS.gap[gap].classes,\n );\n}\n\nexport function gridItemVariants({\n variant,\n mobileDivider,\n}: {\n variant?: KumoGridVariant;\n mobileDivider?: boolean;\n} = {}) {\n return cn(\n mobileDivider &&\n variant === \"4up\" &&\n \"border-b border-kumo-hairline pb-8 md:border-b-0 md:pb-0\",\n );\n}\n\n/**\n * Responsive CSS grid layout container with preset column configurations.\n *\n * @example\n * ```tsx\n * <Grid variant=\"2up\" gap=\"base\">\n * <GridItem>Left</GridItem>\n * <GridItem>Right</GridItem>\n * </Grid>\n * ```\n */\nexport const Grid = React.forwardRef<HTMLDivElement, GridProps>(\n (\n {\n children,\n className,\n mobileDivider,\n gap = KUMO_GRID_DEFAULT_VARIANTS.gap,\n variant,\n ...props\n },\n ref,\n ) => {\n return (\n <GridContext.Provider value={{ variant, gap, mobileDivider }}>\n <div\n ref={ref}\n className={cn(gridVariants({ variant, gap }), className)}\n {...props}\n >\n {children}\n </div>\n </GridContext.Provider>\n );\n },\n);\n\nGrid.displayName = \"Grid\";\n\nexport const GridItem = React.forwardRef<HTMLDivElement, GridItemProps>(\n ({ children, className, ...props }, ref) => {\n const { variant, mobileDivider } = React.useContext(GridContext);\n\n return (\n <div\n ref={ref}\n className={cn(gridItemVariants({ variant, mobileDivider }), className)}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nGridItem.displayName = \"GridItem\";\n"],"names":["KUMO_GRID_VARIANTS","KUMO_GRID_DEFAULT_VARIANTS","GridContext","React","gridVariants","variant","gap","cn","gridItemVariants","mobileDivider","Grid","children","className","props","ref","jsx","GridItem"],"mappings":";;;;AAIO,MAAMA,IAAqB;AAAA,EAChC,SAAS;AAAA,IACP,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aACE;AAAA,IAAA;AAAA,IAEJ,gBAAgB;AAAA,MACd,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aACE;AAAA,IAAA;AAAA,IAEJ,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aACE;AAAA,IAAA;AAAA,IAEJ,SAAS;AAAA,MACP,SAAS;AAAA,MACT,aACE;AAAA,IAAA;AAAA,IAEJ,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aACE;AAAA,IAAA;AAAA,IAEJ,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aACE;AAAA,IAAA;AAAA,IAEJ,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,WAAW;AAAA,MACT,SAAS;AAAA,MACT,aACE;AAAA,IAAA;AAAA,EACJ;AAAA,EAEF,KAAK;AAAA,IACH,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAEaC,IAA6B;AAAA,EACxC,KAAK;AACP,GA6DMC,IAAcC,EAAM,cAAgC;AAAA,EACxD,KAAK;AACP,CAAC;AAEM,SAASC,EAAa;AAAA,EAC3B,SAAAC;AAAA,EACA,KAAAC,IAAML,EAA2B;AACnC,IAGI,IAAI;AACN,SAAOM;AAAA,IACL;AAAA,IACAF,KAAWL,EAAmB,QAAQK,CAAO,EAAE;AAAA,IAC/CL,EAAmB,IAAIM,CAAG,EAAE;AAAA,EAAA;AAEhC;AAEO,SAASE,EAAiB;AAAA,EAC/B,SAAAH;AAAA,EACA,eAAAI;AACF,IAGI,IAAI;AACN,SAAOF;AAAA,IACLE,KACEJ,MAAY,SACZ;AAAA,EAAA;AAEN;AAaO,MAAMK,IAAOP,EAAM;AAAA,EACxB,CACE;AAAA,IACE,UAAAQ;AAAA,IACA,WAAAC;AAAA,IACA,eAAAH;AAAA,IACA,KAAAH,IAAML,EAA2B;AAAA,IACjC,SAAAI;AAAA,IACA,GAAGQ;AAAA,EAAA,GAELC,MAGE,gBAAAC,EAACb,EAAY,UAAZ,EAAqB,OAAO,EAAE,SAAAG,GAAS,KAAAC,GAAK,eAAAG,KAC3C,UAAA,gBAAAM;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,WAAWP,EAAGH,EAAa,EAAE,SAAAC,GAAS,KAAAC,EAAA,CAAK,GAAGM,CAAS;AAAA,MACtD,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA,GAEL;AAGN;AAEAD,EAAK,cAAc;AAEZ,MAAMM,IAAWb,EAAM;AAAA,EAC5B,CAAC,EAAE,UAAAQ,GAAU,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAAQ;AAC1C,UAAM,EAAE,SAAAT,GAAS,eAAAI,EAAA,IAAkBN,EAAM,WAAWD,CAAW;AAE/D,WACE,gBAAAa;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,WAAWP,EAAGC,EAAiB,EAAE,SAAAH,GAAS,eAAAI,EAAA,CAAe,GAAGG,CAAS;AAAA,QACpE,GAAGC;AAAA,QAEH,UAAAF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAK,EAAS,cAAc;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { i as y } from "./input-
|
|
3
|
+
import { i as y } from "./input-cw05pbqdburghkus.js";
|
|
4
4
|
import { c as N } from "./cn-ct4n7r74mh8y0f48.js";
|
|
5
5
|
import * as x from "react";
|
|
6
6
|
import { useCallback as I } from "react";
|
|
7
|
-
import { F as b } from "./field-
|
|
8
|
-
import { aP as w } from "./vendor-base-ui-
|
|
7
|
+
import { F as b } from "./field-bo5gmna16odrrb1q.js";
|
|
8
|
+
import { aP as w } from "./vendor-base-ui-m5pz3e8c4grg5qmj.js";
|
|
9
9
|
const c = x.forwardRef(
|
|
10
10
|
(u, t) => {
|
|
11
11
|
const {
|
|
@@ -75,4 +75,4 @@ export {
|
|
|
75
75
|
c as I,
|
|
76
76
|
j as T
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=input-area-
|
|
78
|
+
//# sourceMappingURL=input-area-jkkkjej6luumrqpa.js.map
|
package/dist/chunks/{input-area-no30c09udyjxshu5.js.map → input-area-jkkkjej6luumrqpa.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-area-
|
|
1
|
+
{"version":3,"file":"input-area-jkkkjej6luumrqpa.js","sources":["../../src/components/input/input-area.tsx"],"sourcesContent":["import { inputVariants } from \"./input\";\nimport { cn } from \"../../utils/cn\";\nimport { useCallback, type ReactNode } from \"react\";\nimport * as React from \"react\";\nimport { Field as FieldBase } from \"@base-ui/react/field\";\nimport { Field as KumoField, type FieldErrorMatch } from \"../field/field\";\n\nexport const InputArea = React.forwardRef<HTMLTextAreaElement, InputAreaProps>(\n (props, ref) => {\n const {\n className,\n onValueChange,\n size = \"base\",\n variant: variantProp,\n onChange,\n label,\n labelTooltip,\n description,\n error,\n ...inputProps\n } = props;\n\n // Deprecation warning for variant=\"error\"\n if (process.env.NODE_ENV !== \"production\" && variantProp === \"error\") {\n console.warn(\n '[Kumo InputArea]: variant=\"error\" is deprecated. ' +\n \"Error styling is now automatically applied when the `error` prop is truthy. \" +\n \"Simply remove the variant prop and pass an error message instead.\",\n );\n }\n\n // Auto-apply error styling when error prop is truthy\n // Explicit variant prop takes precedence for backwards compatibility\n const variant = variantProp ?? (error ? \"error\" : \"default\");\n\n // Extract required from inputProps to pass to Field for label decoration\n const { required } = inputProps;\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n onValueChange?.(event.target.value);\n },\n [onChange, onValueChange],\n );\n\n const textareaClassName = cn(\n inputVariants({ size, variant, focusIndicator: true }),\n \"h-auto py-2\", // Input variant always comes with size, but it does not apply for textarea\n className,\n );\n\n // Render with Field wrapper if label is provided\n // Use FieldBase.Control with render callback to ensure proper label-textarea association.\n // The render callback receives props with the correct id/aria-labelledby from Field context.\n if (label) {\n return (\n <KumoField\n label={label}\n required={required}\n labelTooltip={labelTooltip}\n description={description}\n error={\n error\n ? typeof error === \"string\"\n ? { message: error, match: true }\n : error\n : undefined\n }\n >\n <FieldBase.Control\n render={(controlProps) => (\n <textarea\n {...controlProps}\n ref={ref}\n className={textareaClassName}\n onChange={handleChange}\n {...inputProps}\n />\n )}\n />\n </KumoField>\n );\n }\n\n // Render bare textarea without Field wrapper\n return (\n <textarea\n ref={ref}\n className={textareaClassName}\n onChange={handleChange}\n {...inputProps}\n />\n );\n },\n);\n\nInputArea.displayName = \"InputArea\";\n\n/** Alias for InputArea — provided for discoverability when migrating from other libraries */\nexport const Textarea = InputArea;\n\n/**\n * InputArea component props\n * @property {ReactNode} [label] - Label content for the textarea (enables Field wrapper)\n * @property {ReactNode} [description] - Helper text displayed below the textarea\n * @property {string | { message: ReactNode, match: FieldErrorMatch }} [error] - Error message or validation error object\n */\nexport type InputAreaProps = {\n onValueChange?: (value: string) => void;\n variant?: \"default\" | \"error\";\n size?: \"xs\" | \"sm\" | \"base\" | \"lg\";\n // Then other custom props\n children?: React.ReactNode;\n className?: string;\n /** Label content for the textarea (enables Field wrapper) - can be a string or any React node */\n label?: ReactNode;\n /** Tooltip content to display next to the label via an info icon */\n labelTooltip?: ReactNode;\n /** Helper text displayed below the textarea */\n description?: ReactNode;\n /** Error message or validation error object */\n error?: string | { message: ReactNode; match: FieldErrorMatch };\n\n // Finally, spread the native input props (least important)\n} & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"size\">;\n"],"names":["InputArea","React","props","ref","className","onValueChange","size","variantProp","onChange","label","labelTooltip","description","error","inputProps","variant","required","handleChange","useCallback","event","textareaClassName","cn","inputVariants","jsx","KumoField","FieldBase.Control","controlProps","Textarea"],"mappings":";;;;;;;;AAOO,MAAMA,IAAYC,EAAM;AAAA,EAC7B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,eAAAC;AAAA,MACA,MAAAC,IAAO;AAAA,MACP,SAASC;AAAA,MACT,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,OAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,IACDX;AAGJ,IAAI,QAAQ,IAAI,aAAa,gBAAgBK,MAAgB,WAC3D,QAAQ;AAAA,MACN;AAAA,IAAA;AAQJ,UAAMO,IAAUP,MAAgBK,IAAQ,UAAU,YAG5C,EAAE,UAAAG,MAAaF,GACfG,IAAeC;AAAA,MACnB,CAACC,MAAkD;AACjD,QAAAV,IAAWU,CAAK,GAChBb,IAAgBa,EAAM,OAAO,KAAK;AAAA,MACpC;AAAA,MACA,CAACV,GAAUH,CAAa;AAAA,IAAA,GAGpBc,IAAoBC;AAAA,MACxBC,EAAc,EAAE,MAAAf,GAAM,SAAAQ,GAAS,gBAAgB,IAAM;AAAA,MACrD;AAAA;AAAA,MACAV;AAAA,IAAA;AAMF,WAAIK,IAEA,gBAAAa;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,OAAAd;AAAA,QACA,UAAAM;AAAA,QACA,cAAAL;AAAA,QACA,aAAAC;AAAA,QACA,OACEC,IACI,OAAOA,KAAU,WACf,EAAE,SAASA,GAAO,OAAO,GAAA,IACzBA,IACF;AAAA,QAGN,UAAA,gBAAAU;AAAA,UAACE;AAAAA,UAAA;AAAA,YACC,QAAQ,CAACC,MACP,gBAAAH;AAAA,cAAC;AAAA,cAAA;AAAA,gBACE,GAAGG;AAAA,gBACJ,KAAAtB;AAAA,gBACA,WAAWgB;AAAA,gBACX,UAAUH;AAAA,gBACT,GAAGH;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA,IAOJ,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAnB;AAAA,QACA,WAAWgB;AAAA,QACX,UAAUH;AAAA,QACT,GAAGH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAb,EAAU,cAAc;AAGjB,MAAM0B,IAAW1B;"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as p } from "react/jsx-runtime";
|
|
3
3
|
import { c as d } from "./cn-ct4n7r74mh8y0f48.js";
|
|
4
4
|
import { forwardRef as I } from "react";
|
|
5
|
-
import { F as
|
|
6
|
-
import { I as
|
|
7
|
-
const
|
|
5
|
+
import { F as N } from "./field-bo5gmna16odrrb1q.js";
|
|
6
|
+
import { I as k } from "./vendor-base-ui-m5pz3e8c4grg5qmj.js";
|
|
7
|
+
const u = {
|
|
8
8
|
size: {
|
|
9
9
|
xs: {
|
|
10
10
|
classes: "h-5 gap-1 rounded-sm px-1.5 text-xs",
|
|
@@ -33,34 +33,34 @@ const c = {
|
|
|
33
33
|
description: "Error state for validation failures"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, c = {
|
|
37
37
|
size: "base",
|
|
38
38
|
variant: "default"
|
|
39
39
|
};
|
|
40
|
-
function
|
|
41
|
-
variant: r =
|
|
42
|
-
size: s =
|
|
43
|
-
parentFocusIndicator:
|
|
44
|
-
focusIndicator:
|
|
40
|
+
function y({
|
|
41
|
+
variant: r = c.variant,
|
|
42
|
+
size: s = c.size,
|
|
43
|
+
parentFocusIndicator: i = !1,
|
|
44
|
+
focusIndicator: o = !1
|
|
45
45
|
} = {}) {
|
|
46
46
|
return d(
|
|
47
47
|
// Base styles
|
|
48
|
-
"border-0 bg-kumo-control text-kumo-default ring ring-kumo-
|
|
48
|
+
"border-0 bg-kumo-control text-kumo-default ring ring-kumo-hairline",
|
|
49
49
|
// Disabled state and placeholder styles (using vanilla CSS class for Chrome compatibility)
|
|
50
50
|
"kumo-input-placeholder disabled:text-kumo-subtle",
|
|
51
51
|
// Apply size styles from KUMO_INPUT_VARIANTS
|
|
52
|
-
|
|
52
|
+
u.size[s].classes,
|
|
53
53
|
// Apply variant styles from KUMO_INPUT_VARIANTS
|
|
54
|
-
|
|
54
|
+
u.variant[r].classes,
|
|
55
55
|
// Focus state handling
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
i && "focus-within:ring-kumo-hairline",
|
|
57
|
+
o && "focus:ring-kumo-hairline"
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const E = I((r, s) => {
|
|
61
61
|
const {
|
|
62
|
-
className:
|
|
63
|
-
size:
|
|
62
|
+
className: i,
|
|
63
|
+
size: o = "base",
|
|
64
64
|
variant: n,
|
|
65
65
|
label: t,
|
|
66
66
|
labelTooltip: m,
|
|
@@ -71,32 +71,32 @@ const y = I((r, s) => {
|
|
|
71
71
|
process.env.NODE_ENV !== "production" && n === "error" && console.warn(
|
|
72
72
|
'[Kumo Input]: variant="error" is deprecated. Error styling is now automatically applied when the `error` prop is truthy. Simply remove the variant prop and pass an error message instead.'
|
|
73
73
|
);
|
|
74
|
-
const b = n ?? (e ? "error" : "default"), { required:
|
|
74
|
+
const b = n ?? (e ? "error" : "default"), { required: g } = a;
|
|
75
75
|
if (process.env.NODE_ENV !== "production") {
|
|
76
|
-
const
|
|
77
|
-
!
|
|
76
|
+
const h = !!t, v = !!a["aria-label"], x = !!a["aria-labelledby"];
|
|
77
|
+
!h && !v && !x && console.warn(
|
|
78
78
|
`[Kumo Input]: Input must have an accessible name. Provide either:
|
|
79
79
|
- label prop: <Input label='Email' />
|
|
80
|
-
-
|
|
80
|
+
- aria-label: <Input aria-label='Email address' />
|
|
81
81
|
- aria-labelledby for custom label association`
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
const l = /* @__PURE__ */ p(
|
|
85
|
-
|
|
85
|
+
k,
|
|
86
86
|
{
|
|
87
87
|
ref: s,
|
|
88
88
|
className: d(
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
y({ size: o, variant: b, focusIndicator: !0 }),
|
|
90
|
+
i
|
|
91
91
|
),
|
|
92
92
|
...a
|
|
93
93
|
}
|
|
94
94
|
);
|
|
95
95
|
return t ? /* @__PURE__ */ p(
|
|
96
|
-
|
|
96
|
+
N,
|
|
97
97
|
{
|
|
98
98
|
label: t,
|
|
99
|
-
required:
|
|
99
|
+
required: g,
|
|
100
100
|
labelTooltip: m,
|
|
101
101
|
description: f,
|
|
102
102
|
error: e ? typeof e == "string" ? { message: e, match: !0 } : e : void 0,
|
|
@@ -104,10 +104,10 @@ const y = I((r, s) => {
|
|
|
104
104
|
}
|
|
105
105
|
) : l;
|
|
106
106
|
});
|
|
107
|
-
|
|
107
|
+
E.displayName = "Input";
|
|
108
108
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
E as I,
|
|
110
|
+
u as K,
|
|
111
|
+
y as i
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=input-
|
|
113
|
+
//# sourceMappingURL=input-cw05pbqdburghkus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-cw05pbqdburghkus.js","sources":["../../src/components/input/input.tsx"],"sourcesContent":["import { cn } from \"../../utils/cn\";\nimport {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from \"react\";\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport { Field, type FieldErrorMatch } from \"../field/field\";\n\n/** Input size and variant definitions mapping names to their Tailwind classes. */\nexport const KUMO_INPUT_VARIANTS = {\n size: {\n xs: {\n classes: \"h-5 gap-1 rounded-sm px-1.5 text-xs\",\n description: \"Extra small input for compact UIs\",\n },\n sm: {\n classes: \"h-6.5 gap-1 rounded-md px-2 text-xs\",\n description: \"Small input for secondary fields\",\n },\n base: {\n classes: \"h-9 gap-1.5 rounded-lg px-3 text-base\",\n description: \"Default input size\",\n },\n lg: {\n classes: \"h-10 gap-2 rounded-lg px-4 text-base\",\n description: \"Large input for prominent fields\",\n },\n },\n variant: {\n default: {\n classes: \"focus:ring-kumo-hairline\",\n description: \"Default input appearance\",\n },\n error: {\n classes: \"!ring-kumo-danger focus:ring-kumo-danger\",\n description: \"Error state for validation failures\",\n },\n },\n} as const;\n\nexport const KUMO_INPUT_DEFAULT_VARIANTS = {\n size: \"base\",\n variant: \"default\",\n} as const;\n\nexport const KUMO_INPUT_STYLING = {\n dimensions: {\n xs: { height: 20, paddingX: 6, fontSize: 12, borderRadius: 2, width: 160 },\n sm: { height: 26, paddingX: 8, fontSize: 12, borderRadius: 6, width: 200 },\n base: {\n height: 36,\n paddingX: 12,\n fontSize: 16,\n borderRadius: 8,\n width: 280,\n },\n lg: { height: 40, paddingX: 16, fontSize: 16, borderRadius: 8, width: 320 },\n },\n baseTokens: {\n background: \"color-secondary\",\n text: \"text-color-surface\",\n placeholder: \"text-color-muted\",\n ring: \"color-border\",\n },\n stateTokens: {\n focus: { ring: \"color-active\" },\n error: { ring: \"color-error\" },\n disabled: { opacity: 0.5, text: \"text-color-muted\" },\n },\n} as const;\n\n// Derived types from KUMO_INPUT_VARIANTS\nexport type KumoInputSize = keyof typeof KUMO_INPUT_VARIANTS.size;\nexport type KumoInputVariant = keyof typeof KUMO_INPUT_VARIANTS.variant;\n\nexport interface KumoInputVariantsProps {\n /**\n * Input size.\n * - `\"xs\"` — Extra small for compact UIs\n * - `\"sm\"` — Small for secondary fields\n * - `\"base\"` — Default size\n * - `\"lg\"` — Large for prominent fields\n * @default \"base\"\n */\n size?: KumoInputSize;\n /**\n * Visual variant.\n * - `\"default\"` — Standard input\n * - `\"error\"` — Error state for validation failures\n * @default \"default\"\n */\n variant?: KumoInputVariant;\n parentFocusIndicator?: boolean;\n focusIndicator?: boolean;\n}\n\n// Omit native `size` attribute (number) to avoid conflict with our custom `size` variant\ntype BaseInputProps = Omit<ComponentPropsWithoutRef<typeof BaseInput>, \"size\">;\n\nexport function inputVariants({\n variant = KUMO_INPUT_DEFAULT_VARIANTS.variant,\n size = KUMO_INPUT_DEFAULT_VARIANTS.size,\n parentFocusIndicator = false,\n focusIndicator = false,\n}: KumoInputVariantsProps = {}) {\n return cn(\n // Base styles\n \"border-0 bg-kumo-control text-kumo-default ring ring-kumo-hairline\",\n // Disabled state and placeholder styles (using vanilla CSS class for Chrome compatibility)\n \"kumo-input-placeholder disabled:text-kumo-subtle\",\n // Apply size styles from KUMO_INPUT_VARIANTS\n KUMO_INPUT_VARIANTS.size[size].classes,\n // Apply variant styles from KUMO_INPUT_VARIANTS\n KUMO_INPUT_VARIANTS.variant[variant].classes,\n // Focus state handling\n parentFocusIndicator && \"focus-within:ring-kumo-hairline\",\n focusIndicator && \"focus:ring-kumo-hairline\",\n );\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>((props, ref) => {\n const {\n className,\n size = \"base\",\n variant: variantProp,\n label,\n labelTooltip,\n description,\n error,\n ...inputProps\n } = props;\n\n // Deprecation warning for variant=\"error\"\n if (process.env.NODE_ENV !== \"production\" && variantProp === \"error\") {\n console.warn(\n '[Kumo Input]: variant=\"error\" is deprecated. ' +\n \"Error styling is now automatically applied when the `error` prop is truthy. \" +\n \"Simply remove the variant prop and pass an error message instead.\",\n );\n }\n\n // Auto-apply error styling when error prop is truthy\n // Explicit variant prop takes precedence for backwards compatibility\n const variant = variantProp ?? (error ? \"error\" : \"default\");\n\n // Extract required from inputProps to pass to Field for label decoration\n const { required } = inputProps;\n\n // A11y enforcement: warn in dev if no accessible name provided\n if (process.env.NODE_ENV !== \"production\") {\n const hasLabel = Boolean(label);\n const hasAriaLabel = Boolean(inputProps[\"aria-label\"]);\n const hasAriaLabelledBy = Boolean(inputProps[\"aria-labelledby\"]);\n\n if (!hasLabel && !hasAriaLabel && !hasAriaLabelledBy) {\n console.warn(\n \"[Kumo Input]: Input must have an accessible name. Provide either:\\n\" +\n \" - label prop: <Input label='Email' />\\n\" +\n \" - aria-label: <Input aria-label='Email address' />\\n\" +\n \" - aria-labelledby for custom label association\",\n );\n }\n }\n\n const input = (\n <BaseInput\n ref={ref}\n className={cn(\n inputVariants({ size, variant, focusIndicator: true }),\n className,\n )}\n {...inputProps}\n />\n );\n\n // Render with Field wrapper if label is provided\n if (label) {\n return (\n <Field\n label={label}\n required={required}\n labelTooltip={labelTooltip}\n description={description}\n error={\n error\n ? typeof error === \"string\"\n ? { message: error, match: true }\n : error\n : undefined\n }\n >\n {input}\n </Field>\n );\n }\n\n // Render bare input without Field wrapper\n return input;\n});\n\nInput.displayName = \"Input\";\n\n/**\n * Input component props with accessibility guidance.\n *\n * **Accessible Name Required:** Input should have one of:\n * 1. `label` prop (recommended) - enables Field wrapper with label/description/error\n * 2. `placeholder` + `aria-label` - for bare inputs with visual placeholder\n * 3. `aria-labelledby` - for custom label association\n *\n * Missing accessible names will trigger console warnings in development.\n *\n * @example\n * // Recommended: Built-in Field wrapper\n * <Input label=\"Email\" placeholder=\"you@example.com\" />\n *\n * @example\n * // Bare input with placeholder and aria-label\n * <Input placeholder=\"Search...\" aria-label=\"Search products\" />\n *\n * @example\n * // Custom label association\n * <label id=\"email-label\">Email</label>\n * <Input aria-labelledby=\"email-label\" />\n *\n * @example\n * // With description and error\n * <Input\n * label=\"Password\"\n * description=\"Must be at least 8 characters\"\n * error=\"Password is too short\"\n * />\n */\nexport type InputProps = Pick<KumoInputVariantsProps, \"size\" | \"variant\"> &\n BaseInputProps & {\n /** Label content for the input (enables Field wrapper) - can be a string or any React node */\n label?: ReactNode;\n /** Tooltip content to display next to the label via an info icon */\n labelTooltip?: ReactNode;\n /** Helper text displayed below the input */\n description?: ReactNode;\n /** Error message or validation error object */\n error?: string | { message: ReactNode; match: FieldErrorMatch };\n };\n"],"names":["KUMO_INPUT_VARIANTS","KUMO_INPUT_DEFAULT_VARIANTS","inputVariants","variant","size","parentFocusIndicator","focusIndicator","cn","Input","forwardRef","props","ref","className","variantProp","label","labelTooltip","description","error","inputProps","required","hasLabel","hasAriaLabel","hasAriaLabelledBy","input","jsx","BaseInput","Field"],"mappings":";;;;;;AAUO,MAAMA,IAAsB;AAAA,EACjC,MAAM;AAAA,IACJ,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,EACf;AAAA,EAEF,SAAS;AAAA,IACP,SAAS;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAEaC,IAA8B;AAAA,EACzC,MAAM;AAAA,EACN,SAAS;AACX;AAwDO,SAASC,EAAc;AAAA,EAC5B,SAAAC,IAAUF,EAA4B;AAAA,EACtC,MAAAG,IAAOH,EAA4B;AAAA,EACnC,sBAAAI,IAAuB;AAAA,EACvB,gBAAAC,IAAiB;AACnB,IAA4B,IAAI;AAC9B,SAAOC;AAAA;AAAA,IAEL;AAAA;AAAA,IAEA;AAAA;AAAA,IAEAP,EAAoB,KAAKI,CAAI,EAAE;AAAA;AAAA,IAE/BJ,EAAoB,QAAQG,CAAO,EAAE;AAAA;AAAA,IAErCE,KAAwB;AAAA,IACxBC,KAAkB;AAAA,EAAA;AAEtB;AAEO,MAAME,IAAQC,EAAyC,CAACC,GAAOC,MAAQ;AAC5E,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,MAAAR,IAAO;AAAA,IACP,SAASS;AAAA,IACT,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDR;AAGJ,EAAI,QAAQ,IAAI,aAAa,gBAAgBG,MAAgB,WAC3D,QAAQ;AAAA,IACN;AAAA,EAAA;AAQJ,QAAMV,IAAUU,MAAgBI,IAAQ,UAAU,YAG5C,EAAE,UAAAE,MAAaD;AAGrB,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,UAAME,IAAW,EAAQN,GACnBO,IAAe,EAAQH,EAAW,YAAY,GAC9CI,IAAoB,EAAQJ,EAAW,iBAAiB;AAE9D,IAAI,CAACE,KAAY,CAACC,KAAgB,CAACC,KACjC,QAAQ;AAAA,MACN;AAAA;AAAA;AAAA;AAAA,IAAA;AAAA,EAMN;AAEA,QAAMC,IACJ,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,KAAAd;AAAA,MACA,WAAWJ;AAAA,QACTL,EAAc,EAAE,MAAAE,GAAM,SAAAD,GAAS,gBAAgB,IAAM;AAAA,QACrDS;AAAA,MAAA;AAAA,MAED,GAAGM;AAAA,IAAA;AAAA,EAAA;AAKR,SAAIJ,IAEA,gBAAAU;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,OAAAZ;AAAA,MACA,UAAAK;AAAA,MACA,cAAAJ;AAAA,MACA,aAAAC;AAAA,MACA,OACEC,IACI,OAAOA,KAAU,WACf,EAAE,SAASA,GAAO,OAAO,GAAA,IACzBA,IACF;AAAA,MAGL,UAAAM;AAAA,IAAA;AAAA,EAAA,IAMAA;AACT,CAAC;AAEDf,EAAM,cAAc;"}
|
|
@@ -3,8 +3,8 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
3
3
|
import * as d from "react";
|
|
4
4
|
import { useContext as l } from "react";
|
|
5
5
|
import { c as s } from "./cn-ct4n7r74mh8y0f48.js";
|
|
6
|
-
import { i as m, I as p } from "./input-
|
|
7
|
-
import { B as x } from "./button-
|
|
6
|
+
import { i as m, I as p } from "./input-cw05pbqdburghkus.js";
|
|
7
|
+
import { B as x } from "./button-oaqi7ykdisyskoos.js";
|
|
8
8
|
const I = {
|
|
9
9
|
focusMode: "container"
|
|
10
10
|
}, r = d.createContext(
|
|
@@ -26,7 +26,7 @@ function v({
|
|
|
26
26
|
className: s(
|
|
27
27
|
m({ size: n, parentFocusIndicator: !a }),
|
|
28
28
|
"flex w-full gap-0 border-0 px-0",
|
|
29
|
-
a ? "isolate overflow-visible" : "overflow-hidden shadow-xs ring ring-kumo-line focus-within:ring-kumo-
|
|
29
|
+
a ? "isolate overflow-visible" : "overflow-hidden shadow-xs ring ring-kumo-line focus-within:ring-kumo-line",
|
|
30
30
|
e
|
|
31
31
|
),
|
|
32
32
|
children: i
|
|
@@ -59,7 +59,7 @@ function b(n) {
|
|
|
59
59
|
className: s(
|
|
60
60
|
"flex h-full items-center rounded-none border-0 bg-kumo-base font-sans",
|
|
61
61
|
"grow px-2",
|
|
62
|
-
e ? "relative ring ring-kumo-
|
|
62
|
+
e ? "relative ring ring-kumo-hairline first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-1 focus:outline" : "focus:border-kumo-fill",
|
|
63
63
|
n.className
|
|
64
64
|
)
|
|
65
65
|
}
|
|
@@ -92,7 +92,7 @@ function k({
|
|
|
92
92
|
size: o?.size,
|
|
93
93
|
className: s(
|
|
94
94
|
"h-full! rounded-none disabled:bg-kumo-overlay disabled:text-kumo-inactive!",
|
|
95
|
-
u && "relative ring ring-kumo-
|
|
95
|
+
u && "relative ring ring-kumo-hairline first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-1 focus:outline",
|
|
96
96
|
i
|
|
97
97
|
),
|
|
98
98
|
children: n
|
|
@@ -108,4 +108,4 @@ const U = Object.assign(v, {
|
|
|
108
108
|
export {
|
|
109
109
|
U as I
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=input-group-
|
|
111
|
+
//# sourceMappingURL=input-group-lfugneuz71g42n0w.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group-lfugneuz71g42n0w.js","sources":["../../src/components/input/input-group.tsx"],"sourcesContent":["import { type PropsWithChildren, useContext } from \"react\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport {\n Input as InputExternal,\n type InputProps,\n inputVariants,\n} from \"./input\";\nimport { type ButtonProps, Button as ButtonExternal } from \"../button/button\";\n\nexport const KUMO_INPUT_GROUP_VARIANTS = {\n focusMode: {\n container: {\n classes: \"\",\n description: \"Focus indicator on container (default behavior)\",\n },\n individual: {\n classes: \"\",\n description: \"Focus indicators on individual elements\",\n },\n },\n} as const;\n\nexport const KUMO_INPUT_GROUP_DEFAULT_VARIANTS = {\n focusMode: \"container\",\n} as const;\n\nexport type KumoInputGroupFocusMode =\n keyof typeof KUMO_INPUT_GROUP_VARIANTS.focusMode;\n\nexport interface KumoInputGroupVariantsProps {\n focusMode?: KumoInputGroupFocusMode;\n}\n\ninterface InputGroupRootProps extends KumoInputGroupVariantsProps {\n className?: string;\n size?: \"xs\" | \"sm\" | \"base\" | \"lg\" | undefined;\n}\n\ninterface InputGroupContextValue extends InputGroupRootProps {\n inputId: string;\n descriptionId: string;\n}\n\nconst InputGroupContext = React.createContext<InputGroupContextValue | null>(\n null,\n);\n\nfunction Root({\n size,\n children,\n className,\n focusMode = KUMO_INPUT_GROUP_DEFAULT_VARIANTS.focusMode,\n}: PropsWithChildren<InputGroupRootProps>) {\n const inputId = React.useId();\n const descriptionId = React.useId();\n const contextValue = React.useMemo(\n () => ({ size, inputId, descriptionId, focusMode }),\n [size, inputId, descriptionId, focusMode],\n );\n\n const isIndividualFocus = focusMode === \"individual\";\n\n return (\n <InputGroupContext.Provider value={contextValue}>\n <div\n className={cn(\n inputVariants({ size, parentFocusIndicator: !isIndividualFocus }),\n \"flex w-full gap-0 border-0 px-0\",\n isIndividualFocus\n ? \"isolate overflow-visible\"\n : \"overflow-hidden shadow-xs ring ring-kumo-line focus-within:ring-kumo-line\",\n className,\n )}\n >\n {children}\n </div>\n </InputGroupContext.Provider>\n );\n}\n\nfunction Label({ children }: PropsWithChildren<{}>) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <label\n htmlFor={context?.inputId}\n className={cn(\n \"flex h-full items-center p-0 px-2 text-kumo-subtle\",\n isIndividualFocus &&\n \"first:rounded-l-[inherit] last:rounded-r-[inherit]\",\n )}\n >\n {children}\n </label>\n );\n}\n\nfunction Input(props: InputProps) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <InputExternal\n id={context?.inputId}\n aria-describedby={context?.descriptionId}\n size={context?.size}\n {...props}\n className={cn(\n \"flex h-full items-center rounded-none border-0 bg-kumo-base font-sans\",\n \"grow px-2\",\n isIndividualFocus\n ? \"relative ring ring-kumo-hairline first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-1 focus:outline\"\n : \"focus:border-kumo-fill\",\n props.className,\n )}\n />\n );\n}\n\nfunction Description({ children }: PropsWithChildren<{}>) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <span\n id={context?.descriptionId}\n className={cn(\n \"flex h-full items-center p-0 px-2 text-kumo-subtle\",\n isIndividualFocus &&\n \"first:rounded-l-[inherit] last:rounded-r-[inherit]\",\n )}\n >\n {children}\n </span>\n );\n}\n\nfunction Button({\n children,\n className,\n ...props\n}: PropsWithChildren<ButtonProps>) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <ButtonExternal\n {...props}\n size={context?.size}\n className={cn(\n \"h-full! rounded-none disabled:bg-kumo-overlay disabled:text-kumo-inactive!\",\n isIndividualFocus &&\n \"relative ring ring-kumo-hairline first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-1 focus:outline\",\n className,\n )}\n >\n {children}\n </ButtonExternal>\n );\n}\n\nexport const InputGroup = Object.assign(Root, {\n Label,\n Input,\n Button,\n Description,\n});\n"],"names":["KUMO_INPUT_GROUP_DEFAULT_VARIANTS","InputGroupContext","React","Root","size","children","className","focusMode","inputId","descriptionId","contextValue","isIndividualFocus","jsx","cn","inputVariants","Label","context","useContext","Input","props","InputExternal","Description","Button","ButtonExternal","InputGroup"],"mappings":";;;;;;;AAuBO,MAAMA,IAAoC;AAAA,EAC/C,WAAW;AACb,GAmBMC,IAAoBC,EAAM;AAAA,EAC9B;AACF;AAEA,SAASC,EAAK;AAAA,EACZ,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAYP,EAAkC;AAChD,GAA2C;AACzC,QAAMQ,IAAUN,EAAM,MAAA,GAChBO,IAAgBP,EAAM,MAAA,GACtBQ,IAAeR,EAAM;AAAA,IACzB,OAAO,EAAE,MAAAE,GAAM,SAAAI,GAAS,eAAAC,GAAe,WAAAF,EAAA;AAAA,IACvC,CAACH,GAAMI,GAASC,GAAeF,CAAS;AAAA,EAAA,GAGpCI,IAAoBJ,MAAc;AAExC,SACE,gBAAAK,EAACX,EAAkB,UAAlB,EAA2B,OAAOS,GACjC,UAAA,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTC,EAAc,EAAE,MAAAV,GAAM,sBAAsB,CAACO,GAAmB;AAAA,QAChE;AAAA,QACAA,IACI,6BACA;AAAA,QACJL;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAEA,SAASU,EAAM,EAAE,UAAAV,KAAmC;AAClD,QAAMW,IAAUC,EAAWhB,CAAiB,GACtCU,IAAoBK,GAAS,cAAc;AAEjD,SACE,gBAAAJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAASI,GAAS;AAAA,MAClB,WAAWH;AAAA,QACT;AAAA,QACAF,KACE;AAAA,MAAA;AAAA,MAGH,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,SAASa,EAAMC,GAAmB;AAChC,QAAMH,IAAUC,EAAWhB,CAAiB,GACtCU,IAAoBK,GAAS,cAAc;AAEjD,SACE,gBAAAJ;AAAA,IAACQ;AAAAA,IAAA;AAAA,MACC,IAAIJ,GAAS;AAAA,MACb,oBAAkBA,GAAS;AAAA,MAC3B,MAAMA,GAAS;AAAA,MACd,GAAGG;AAAA,MACJ,WAAWN;AAAA,QACT;AAAA,QACA;AAAA,QACAF,IACI,gHACA;AAAA,QACJQ,EAAM;AAAA,MAAA;AAAA,IACR;AAAA,EAAA;AAGN;AAEA,SAASE,EAAY,EAAE,UAAAhB,KAAmC;AACxD,QAAMW,IAAUC,EAAWhB,CAAiB,GACtCU,IAAoBK,GAAS,cAAc;AAEjD,SACE,gBAAAJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAII,GAAS;AAAA,MACb,WAAWH;AAAA,QACT;AAAA,QACAF,KACE;AAAA,MAAA;AAAA,MAGH,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,SAASiB,EAAO;AAAA,EACd,UAAAjB;AAAA,EACA,WAAAC;AAAA,EACA,GAAGa;AACL,GAAmC;AACjC,QAAMH,IAAUC,EAAWhB,CAAiB,GACtCU,IAAoBK,GAAS,cAAc;AAEjD,SACE,gBAAAJ;AAAA,IAACW;AAAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,MAAMH,GAAS;AAAA,MACf,WAAWH;AAAA,QACT;AAAA,QACAF,KACE;AAAA,QACFL;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;AAEO,MAAMmB,IAAa,OAAO,OAAOrB,GAAM;AAAA,EAC5C,OAAAY;AAAA,EACA,OAAAG;AAAA,EACA,QAAAI;AAAA,EACA,aAAAD;AACF,CAAC;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as c, Fragment as f } from "react/jsx-runtime";
|
|
3
|
+
import { Info as p } from "@phosphor-icons/react";
|
|
4
|
+
import { c as n } from "./cn-ct4n7r74mh8y0f48.js";
|
|
5
|
+
import { B as u } from "./button-oaqi7ykdisyskoos.js";
|
|
6
|
+
import { T as d } from "./tooltip-hikjvdbg3xghnq1x.js";
|
|
7
|
+
const T = {
|
|
8
|
+
// Label currently has no variant options but structure is ready for future additions
|
|
9
|
+
}, g = {};
|
|
10
|
+
function b(a = {}) {
|
|
11
|
+
return n(
|
|
12
|
+
// Base styles - when used standalone, apply text styling
|
|
13
|
+
// When used inside Field, the parent FieldBase.Label provides these styles
|
|
14
|
+
"m-0 text-base font-medium text-kumo-default"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function o() {
|
|
18
|
+
return n(
|
|
19
|
+
// Content wrapper styles - always applied
|
|
20
|
+
"inline-flex items-center gap-1"
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function x({
|
|
24
|
+
children: a,
|
|
25
|
+
showOptional: i = !1,
|
|
26
|
+
tooltip: t,
|
|
27
|
+
className: r,
|
|
28
|
+
htmlFor: l,
|
|
29
|
+
asContent: m = !1
|
|
30
|
+
}) {
|
|
31
|
+
const s = /* @__PURE__ */ c(f, { children: [
|
|
32
|
+
a,
|
|
33
|
+
i && /* @__PURE__ */ e("span", { className: "font-normal text-kumo-strong", children: "(optional)" }),
|
|
34
|
+
t && /* @__PURE__ */ e(
|
|
35
|
+
d,
|
|
36
|
+
{
|
|
37
|
+
content: t,
|
|
38
|
+
render: /* @__PURE__ */ e(
|
|
39
|
+
u,
|
|
40
|
+
{
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "xs",
|
|
43
|
+
shape: "square",
|
|
44
|
+
"aria-label": "More information",
|
|
45
|
+
children: /* @__PURE__ */ e(p, { className: "size-4" })
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
return m ? /* @__PURE__ */ e("span", { className: n(o(), r), children: s }) : /* @__PURE__ */ e(
|
|
52
|
+
"label",
|
|
53
|
+
{
|
|
54
|
+
htmlFor: l,
|
|
55
|
+
className: n(b(), o(), r),
|
|
56
|
+
children: s
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
x.displayName = "Label";
|
|
61
|
+
export {
|
|
62
|
+
T as K,
|
|
63
|
+
x as L,
|
|
64
|
+
o as a,
|
|
65
|
+
g as b,
|
|
66
|
+
b as l
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=label-cvyvbqmt4mt757ff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-
|
|
1
|
+
{"version":3,"file":"label-cvyvbqmt4mt757ff.js","sources":["../../src/components/label/label.tsx"],"sourcesContent":["import { Info } from \"@phosphor-icons/react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../button\";\nimport { Tooltip } from \"../tooltip\";\n\n/** Label variant definitions (currently empty, reserved for future additions). */\nexport const KUMO_LABEL_VARIANTS = {\n // Label currently has no variant options but structure is ready for future additions\n} as const;\n\nexport const KUMO_LABEL_DEFAULT_VARIANTS = {} as const;\n\n// Derived types from KUMO_LABEL_VARIANTS\nexport interface KumoLabelVariantsProps {}\n\nexport function labelVariants(_props: KumoLabelVariantsProps = {}) {\n return cn(\n // Base styles - when used standalone, apply text styling\n // When used inside Field, the parent FieldBase.Label provides these styles\n \"m-0 text-base font-medium text-kumo-default\",\n );\n}\n\nexport function labelContentVariants() {\n return cn(\n // Content wrapper styles - always applied\n \"inline-flex items-center gap-1\",\n );\n}\n\n/**\n * Label component props.\n *\n * @example\n * ```tsx\n * <Label>Email</Label>\n * <Label showOptional>Middle Name</Label>\n * <Label tooltip=\"We'll use this to send you updates\">Email</Label>\n * ```\n */\nexport interface LabelProps extends KumoLabelVariantsProps {\n /** The label content — can be a string or any React node. */\n children: ReactNode;\n /** When `true`, shows gray \"(optional)\" text after the label. */\n showOptional?: boolean;\n /** Tooltip content displayed next to the label via an info icon. */\n tooltip?: ReactNode;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n /** The id of the form element this label is associated with */\n htmlFor?: string;\n /**\n * When true, only renders the inline content (indicators, tooltip) without\n * the outer label element with font styling. Useful when composed inside another\n * label element that already provides the text styling.\n * @default false\n */\n asContent?: boolean;\n}\n\n/**\n * Label component for form fields.\n *\n * Provides a standardized way to display labels with optional indicators:\n * - Optional indicator: gray \"(optional)\" text when `showOptional={true}`\n * - Tooltip: info icon with hover tooltip for additional context\n *\n * @example\n * // Basic label\n * <Label>Email</Label>\n *\n * @example\n * // Optional field with indicator\n * <Label showOptional>Middle Name</Label>\n *\n * @example\n * // With tooltip\n * <Label tooltip=\"We'll use this to send you updates\">Email</Label>\n *\n * @example\n * // With ReactNode children\n * <Label>\n * <span>Custom label with <strong>bold</strong> text</span>\n * </Label>\n */\nexport function Label({\n children,\n showOptional = false,\n tooltip,\n className,\n htmlFor,\n asContent = false,\n}: LabelProps) {\n const content = (\n <>\n {children}\n {showOptional && (\n <span className=\"font-normal text-kumo-strong\">(optional)</span>\n )}\n {tooltip && (\n <Tooltip\n content={tooltip}\n render={\n <Button\n variant=\"ghost\"\n size=\"xs\"\n shape=\"square\"\n aria-label=\"More information\"\n >\n <Info className=\"size-4\" />\n </Button>\n }\n />\n )}\n </>\n );\n\n // When used as content inside another styled element, just render inline\n if (asContent) {\n return (\n <span className={cn(labelContentVariants(), className)}>{content}</span>\n );\n }\n\n // When used standalone, render as <label> for accessibility\n return (\n <label\n htmlFor={htmlFor}\n className={cn(labelVariants(), labelContentVariants(), className)}\n >\n {content}\n </label>\n );\n}\n\nLabel.displayName = \"Label\";\n"],"names":["KUMO_LABEL_VARIANTS","KUMO_LABEL_DEFAULT_VARIANTS","labelVariants","_props","cn","labelContentVariants","Label","children","showOptional","tooltip","className","htmlFor","asContent","content","jsxs","Fragment","jsx","Tooltip","Button","Info"],"mappings":";;;;;;AAOO,MAAMA,IAAsB;AAAA;AAEnC,GAEaC,IAA8B,CAAA;AAKpC,SAASC,EAAcC,IAAiC,IAAI;AACjE,SAAOC;AAAA;AAAA;AAAA,IAGL;AAAA,EAAA;AAEJ;AAEO,SAASC,IAAuB;AACrC,SAAOD;AAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAyDO,SAASE,EAAM;AAAA,EACpB,UAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAe;AACb,QAAMC,IACJ,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAR;AAAA,IACAC,KACC,gBAAAQ,EAAC,QAAA,EAAK,WAAU,gCAA+B,UAAA,cAAU;AAAA,IAE1DP,KACC,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAASR;AAAA,QACT,QACE,gBAAAO;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,OAAM;AAAA,YACN,cAAW;AAAA,YAEX,UAAA,gBAAAF,EAACG,GAAA,EAAK,WAAU,SAAA,CAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MAC3B;AAAA,IAAA;AAAA,EAEJ,GAEJ;AAIF,SAAIP,IAEA,gBAAAI,EAAC,UAAK,WAAWZ,EAAGC,KAAwBK,CAAS,GAAI,UAAAG,GAAQ,IAMnE,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAAL;AAAA,MACA,WAAWP,EAAGF,EAAA,GAAiBG,EAAA,GAAwBK,CAAS;AAAA,MAE/D,UAAAG;AAAA,IAAA;AAAA,EAAA;AAGP;AAEAP,EAAM,cAAc;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as y, Children as p, isValidElement as C, Fragment as g } from "react";
|
|
4
|
+
import { c as a } from "./cn-ct4n7r74mh8y0f48.js";
|
|
5
|
+
import { aQ as L, aR as S } from "./vendor-base-ui-m5pz3e8c4grg5qmj.js";
|
|
6
|
+
const R = "overflow-hidden rounded-lg bg-kumo-base shadow-xs ring ring-kumo-line", A = "flex w-full flex-col overflow-hidden rounded-lg bg-kumo-elevated text-base ring ring-kumo-hairline", _ = "-my-2 flex items-center gap-2 bg-kumo-elevated p-4 text-base font-medium text-kumo-strong", E = "relative flex flex-col gap-2 overflow-hidden rounded-lg bg-kumo-base p-4 pr-3 text-inherit no-underline ring ring-kumo-fill";
|
|
7
|
+
function x(r = {}) {
|
|
8
|
+
return a(R);
|
|
9
|
+
}
|
|
10
|
+
function i(r) {
|
|
11
|
+
return p.toArray(r).some((e) => C(e) ? e.type === t || e.type === n ? !0 : e.type === g ? i(e.props.children) : !1 : !1);
|
|
12
|
+
}
|
|
13
|
+
const d = y(function({ children: e, className: o, render: l, ...m }, u) {
|
|
14
|
+
const f = i(e), c = {
|
|
15
|
+
className: a(
|
|
16
|
+
f ? A : x(),
|
|
17
|
+
o
|
|
18
|
+
)
|
|
19
|
+
};
|
|
20
|
+
return L({
|
|
21
|
+
defaultTagName: "div",
|
|
22
|
+
render: l,
|
|
23
|
+
ref: u,
|
|
24
|
+
props: S(c, m, { children: e })
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
function n({
|
|
28
|
+
children: r,
|
|
29
|
+
className: e
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ s("div", { className: a(_, e), children: r });
|
|
32
|
+
}
|
|
33
|
+
function t({ children: r, className: e }) {
|
|
34
|
+
return /* @__PURE__ */ s("div", { className: a(E, e), children: r });
|
|
35
|
+
}
|
|
36
|
+
d.displayName = "LayerCard";
|
|
37
|
+
n.displayName = "LayerCard.Secondary";
|
|
38
|
+
t.displayName = "LayerCard.Primary";
|
|
39
|
+
const h = Object.assign(d, {
|
|
40
|
+
Primary: t,
|
|
41
|
+
Secondary: n
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
h as L
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=layer-card-ljqth3yxgnk04v2o.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-card-ljqth3yxgnk04v2o.js","sources":["../../src/components/layer-card/layer-card.tsx"],"sourcesContent":["import {\n Children,\n Fragment,\n forwardRef,\n isValidElement,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cn } from \"../../utils/cn\";\n\nconst LAYER_CARD_SURFACE_CLASSES =\n \"overflow-hidden rounded-lg bg-kumo-base shadow-xs ring ring-kumo-line\";\nconst LAYER_CARD_LAYERED_ROOT_CLASSES =\n \"flex w-full flex-col overflow-hidden rounded-lg bg-kumo-elevated text-base ring ring-kumo-hairline\";\nconst LAYER_CARD_SECONDARY_CLASSES =\n \"-my-2 flex items-center gap-2 bg-kumo-elevated p-4 text-base font-medium text-kumo-strong\";\nconst LAYER_CARD_PRIMARY_CLASSES =\n \"relative flex flex-col gap-2 overflow-hidden rounded-lg bg-kumo-base p-4 pr-3 text-inherit no-underline ring ring-kumo-fill\";\n\n/** LayerCard variant definitions (currently empty, reserved for future additions). */\nexport const KUMO_LAYER_CARD_VARIANTS = {\n // LayerCard currently has no variant options but structure is ready for future additions\n} as const;\n\nexport const KUMO_LAYER_CARD_DEFAULT_VARIANTS = {} as const;\n\n// Derived types from KUMO_LAYER_CARD_VARIANTS\nexport interface KumoLayerCardVariantsProps {}\n\nexport function layerCardVariants(_props: KumoLayerCardVariantsProps = {}) {\n return cn(LAYER_CARD_SURFACE_CLASSES);\n}\n\nfunction hasLayerCardSections(children: ReactNode): boolean {\n return Children.toArray(children).some((child): boolean => {\n if (!isValidElement(child)) {\n return false;\n }\n\n if (child.type === LayerCardPrimary || child.type === LayerCardSecondary) {\n return true;\n }\n\n if (child.type === Fragment) {\n const fragmentChild = child as ReactElement<{ children?: ReactNode }>;\n return hasLayerCardSections(fragmentChild.props.children);\n }\n\n return false;\n });\n}\n\n/**\n * LayerCard component props.\n *\n * @example\n * ```tsx\n * <LayerCard className=\"p-4\">\n * Get started with Kumo\n * </LayerCard>\n *\n * <LayerCard>\n * <LayerCard.Secondary>Next Steps</LayerCard.Secondary>\n * <LayerCard.Primary>Get started with Kumo</LayerCard.Primary>\n * </LayerCard>\n * ```\n */\nexport type LayerCardProps = useRender.ComponentProps<\"div\"> &\n KumoLayerCardVariantsProps;\n\nexport type LayerCardSectionProps = PropsWithChildren<{\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n}>;\n\n/**\n * Card container for both simple surfaces and layered layouts.\n *\n * Render children directly for a single-surface card, or use\n * `LayerCard.Secondary` and `LayerCard.Primary` for the layered card treatment.\n *\n * @example\n * ```tsx\n * <LayerCard className=\"rounded-lg p-4\">Card content</LayerCard>\n * ```\n *\n * @example\n * ```tsx\n * <LayerCard>\n * <LayerCard.Secondary>Getting Started</LayerCard.Secondary>\n * <LayerCard.Primary>Quick start guide</LayerCard.Primary>\n * </LayerCard>\n * ```\n */\nconst LayerCardRoot = forwardRef<HTMLDivElement, LayerCardProps>(function LayerCard(\n { children, className, render, ...props },\n ref,\n) {\n const hasStructuredLayers = hasLayerCardSections(children);\n\n const defaultProps: useRender.ElementProps<\"div\"> = {\n className: cn(\n hasStructuredLayers ? LAYER_CARD_LAYERED_ROOT_CLASSES : layerCardVariants(),\n className,\n ),\n };\n\n return useRender({\n defaultTagName: \"div\",\n render,\n ref,\n props: mergeProps<\"div\">(defaultProps, props, { children }),\n });\n});\n\nfunction LayerCardSecondary({\n children,\n className,\n}: LayerCardSectionProps) {\n return <div className={cn(LAYER_CARD_SECONDARY_CLASSES, className)}>{children}</div>;\n}\n\nfunction LayerCardPrimary({ children, className }: LayerCardSectionProps) {\n return <div className={cn(LAYER_CARD_PRIMARY_CLASSES, className)}>{children}</div>;\n}\n\nLayerCardRoot.displayName = \"LayerCard\";\nLayerCardSecondary.displayName = \"LayerCard.Secondary\";\nLayerCardPrimary.displayName = \"LayerCard.Primary\";\n\ntype LayerCardComponent = typeof LayerCardRoot & {\n Primary: typeof LayerCardPrimary;\n Secondary: typeof LayerCardSecondary;\n};\n\nconst LayerCard = Object.assign(LayerCardRoot, {\n Primary: LayerCardPrimary,\n Secondary: LayerCardSecondary,\n}) as LayerCardComponent;\n\nexport { LayerCard };\n"],"names":["LAYER_CARD_SURFACE_CLASSES","LAYER_CARD_LAYERED_ROOT_CLASSES","LAYER_CARD_SECONDARY_CLASSES","LAYER_CARD_PRIMARY_CLASSES","layerCardVariants","_props","cn","hasLayerCardSections","children","Children","child","isValidElement","LayerCardPrimary","LayerCardSecondary","Fragment","LayerCardRoot","forwardRef","className","render","props","ref","hasStructuredLayers","defaultProps","useRender","mergeProps","LayerCard"],"mappings":";;;;;AAaA,MAAMA,IACJ,yEACIC,IACJ,sGACIC,IACJ,6FACIC,IACJ;AAYK,SAASC,EAAkBC,IAAqC,IAAI;AACzE,SAAOC,EAAGN,CAA0B;AACtC;AAEA,SAASO,EAAqBC,GAA8B;AAC1D,SAAOC,EAAS,QAAQD,CAAQ,EAAE,KAAK,CAACE,MACjCC,EAAeD,CAAK,IAIrBA,EAAM,SAASE,KAAoBF,EAAM,SAASG,IAC7C,KAGLH,EAAM,SAASI,IAEVP,EADeG,EACoB,MAAM,QAAQ,IAGnD,KAZE,EAaV;AACH;AA4CA,MAAMK,IAAgBC,EAA2C,SAC/D,EAAE,UAAAR,GAAU,WAAAS,GAAW,QAAAC,GAAQ,GAAGC,EAAA,GAClCC,GACA;AACA,QAAMC,IAAsBd,EAAqBC,CAAQ,GAEnDc,IAA8C;AAAA,IAClD,WAAWhB;AAAA,MACTe,IAAsBpB,IAAkCG,EAAA;AAAA,MACxDa;AAAA,IAAA;AAAA,EACF;AAGF,SAAOM,EAAU;AAAA,IACf,gBAAgB;AAAA,IAChB,QAAAL;AAAA,IACA,KAAAE;AAAA,IACA,OAAOI,EAAkBF,GAAcH,GAAO,EAAE,UAAAX,GAAU;AAAA,EAAA,CAC3D;AACH,CAAC;AAED,SAASK,EAAmB;AAAA,EAC1B,UAAAL;AAAA,EACA,WAAAS;AACF,GAA0B;AACxB,2BAAQ,OAAA,EAAI,WAAWX,EAAGJ,GAA8Be,CAAS,GAAI,UAAAT,GAAS;AAChF;AAEA,SAASI,EAAiB,EAAE,UAAAJ,GAAU,WAAAS,KAAoC;AACxE,2BAAQ,OAAA,EAAI,WAAWX,EAAGH,GAA4Bc,CAAS,GAAI,UAAAT,GAAS;AAC9E;AAEAO,EAAc,cAAc;AAC5BF,EAAmB,cAAc;AACjCD,EAAiB,cAAc;AAO/B,MAAMa,IAAY,OAAO,OAAOV,GAAe;AAAA,EAC7C,SAASH;AAAA,EACT,WAAWC;AACb,CAAC;"}
|
|
@@ -3,7 +3,7 @@ import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef as k } from "react";
|
|
4
4
|
import { c as t } from "./cn-ct4n7r74mh8y0f48.js";
|
|
5
5
|
import { u as p } from "./link-provider-mn2voeohon7cj9o4.js";
|
|
6
|
-
import {
|
|
6
|
+
import { aQ as f, aR as L } from "./vendor-base-ui-m5pz3e8c4grg5qmj.js";
|
|
7
7
|
const i = (n) => /* @__PURE__ */ d(
|
|
8
8
|
"svg",
|
|
9
9
|
{
|
|
@@ -76,4 +76,4 @@ export {
|
|
|
76
76
|
h as a,
|
|
77
77
|
C as l
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=link-
|
|
79
|
+
//# sourceMappingURL=link-fjnhtxvfe5ieamjf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-
|
|
1
|
+
{"version":3,"file":"link-fjnhtxvfe5ieamjf.js","sources":["../../src/components/link/link.tsx"],"sourcesContent":["import { forwardRef, type SVGProps } from \"react\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { cn } from \"../../utils/cn\";\nimport {\n useLinkComponent,\n type LinkComponentProps,\n} from \"../../utils/link-provider\";\n\n/**\n * ExternalIcon - Visual indicator for links that open in a new tab/window.\n *\n * Use this as a child of Link to indicate external navigation:\n * ```tsx\n * <Link href=\"https://example.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n * Visit Example <Link.ExternalIcon />\n * </Link>\n * ```\n */\nconst ExternalIcon = (props: SVGProps<SVGSVGElement>) => (\n <svg\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"link-external-icon\"\n {...props}\n >\n <path d=\"M9 4H8.8C7.11984 4 6.27976 4 5.63803 4.32698C5.07354 4.6146 4.6146 5.07354 4.32698 5.63803C4 6.27976 4 7.11984 4 8.8V15.2C4 16.8802 4 17.7202 4.32698 18.362C4.6146 18.9265 5.07354 19.3854 5.63803 19.673C6.27976 20 7.11984 20 8.8 20H15.2C16.8802 20 17.7202 20 18.362 19.673C18.9265 19.3854 19.3854 18.9265 19.673 18.362C20 17.7202 20 16.8802 20 15.2V15\" />\n <path d=\"M14 4H20M20 4V10M20 4L11 13\" />\n </svg>\n);\n\nExternalIcon.displayName = \"Link.ExternalIcon\";\n\n/** Link variant definitions mapping variant names to their Tailwind classes. */\nexport const KUMO_LINK_VARIANTS = {\n variant: {\n inline: {\n classes:\n // text-kumo-link provides defensive color that won't be overridden by global `a` styles\n \"text-kumo-link underline underline-offset-[0.15em] decoration-[0.0625em] link-current transition-colors\",\n description: \"Inline text link that flows with content\",\n },\n current: {\n classes:\n \"text-current underline underline-offset-[0.15em] decoration-[0.0625em] link-current transition-colors\",\n description: \"Link that inherits color from parent text\",\n },\n plain: {\n classes:\n // text-kumo-link provides defensive color that won't be overridden by global `a` styles\n \"text-kumo-link hover:text-kumo-link/70 transition-colors\",\n description: \"Link without underline decoration\",\n },\n },\n} as const;\n\nexport const KUMO_LINK_DEFAULT_VARIANTS = {\n variant: \"inline\",\n} as const;\n\nexport type KumoLinkVariant = keyof typeof KUMO_LINK_VARIANTS.variant;\n\nexport interface KumoLinkVariantsProps {\n /**\n * Visual style of the link.\n * - `\"inline\"` — Inline text link that flows with content\n * - `\"current\"` — Link that inherits color from parent text\n * - `\"plain\"` — Link without underline decoration\n * @default \"inline\"\n */\n variant?: KumoLinkVariant;\n}\n\nexport function linkVariants({\n variant = KUMO_LINK_DEFAULT_VARIANTS.variant,\n}: KumoLinkVariantsProps = {}) {\n return cn(KUMO_LINK_VARIANTS.variant[variant].classes);\n}\n\n/**\n * Link component props.\n *\n * @example\n * ```tsx\n * <Link href=\"/docs\">Learn more</Link>\n * <Link href=\"https://cloudflare.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n * Visit Cloudflare <Link.ExternalIcon />\n * </Link>\n * <Link render={<RouterLink to=\"/dashboard\" />}>Dashboard</Link>\n * ```\n */\nexport type LinkProps = useRender.ComponentProps<\"a\"> &\n LinkComponentProps &\n KumoLinkVariantsProps;\n\n/**\n * Link component for consistent inline text links.\n *\n * Supports composition via `render` prop for framework-specific routing:\n * - Without render: renders via LinkProvider (default anchor or configured component)\n * - With render: merges props onto the provided element with proper ref/event handling\n *\n * @example Basic usage\n * ```tsx\n * <Link href=\"/docs\">Learn more</Link>\n * ```\n *\n * @example External link with icon\n * ```tsx\n * <Link href=\"https://cloudflare.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n * Visit Cloudflare <Link.ExternalIcon />\n * </Link>\n * ```\n *\n * @example Composition with React Router\n * ```tsx\n * <Link render={<RouterLink to=\"/dashboard\" />} variant=\"inline\">\n * Dashboard\n * </Link>\n * ```\n */\nconst LinkBase = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { className, variant = \"inline\", render, ...props },\n ref,\n) {\n const LinkComponent = useLinkComponent();\n\n const defaultProps: useRender.ElementProps<\"a\"> = {\n className: cn(\n linkVariants({ variant }),\n \"group/link inline-flex items-center gap-[0.1875em]\",\n ),\n };\n\n const element = useRender({\n render: render ?? <LinkComponent />,\n ref,\n props: mergeProps<\"a\">(defaultProps, props, { className }),\n });\n\n return element;\n});\n\nLinkBase.displayName = \"Link\";\n\n// Compound component with ExternalIcon subcomponent\nexport const Link = Object.assign(LinkBase, {\n ExternalIcon,\n});\n"],"names":["ExternalIcon","props","jsxs","jsx","KUMO_LINK_VARIANTS","KUMO_LINK_DEFAULT_VARIANTS","linkVariants","variant","cn","LinkBase","forwardRef","className","render","ref","LinkComponent","useLinkComponent","defaultProps","useRender","mergeProps","Link"],"mappings":";;;;;;AAmBA,MAAMA,IAAe,CAACC,MACpB,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,eAAY;AAAA,IACZ,WAAU;AAAA,IACT,GAAGD;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,kWAAA,CAAkW;AAAA,MAC1W,gBAAAA,EAAC,QAAA,EAAK,GAAE,8BAAA,CAA8B;AAAA,IAAA;AAAA,EAAA;AACxC;AAGFH,EAAa,cAAc;AAGpB,MAAMI,IAAqB;AAAA,EAChC,SAAS;AAAA,IACP,QAAQ;AAAA,MACN;AAAA;AAAA,QAEE;AAAA;AAAA,MACF,aAAa;AAAA,IAAA;AAAA,IAEf,SAAS;AAAA,MACP,SACE;AAAA,MACF,aAAa;AAAA,IAAA;AAAA,IAEf,OAAO;AAAA,MACL;AAAA;AAAA,QAEE;AAAA;AAAA,MACF,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAEaC,IAA6B;AAAA,EACxC,SAAS;AACX;AAeO,SAASC,EAAa;AAAA,EAC3B,SAAAC,IAAUF,EAA2B;AACvC,IAA2B,IAAI;AAC7B,SAAOG,EAAGJ,EAAmB,QAAQG,CAAO,EAAE,OAAO;AACvD;AA4CA,MAAME,IAAWC,EAAyC,SACxD,EAAE,WAAAC,GAAW,SAAAJ,IAAU,UAAU,QAAAK,GAAQ,GAAGX,EAAA,GAC5CY,GACA;AACA,QAAMC,IAAgBC,EAAA,GAEhBC,IAA4C;AAAA,IAChD,WAAWR;AAAA,MACTF,EAAa,EAAE,SAAAC,GAAS;AAAA,MACxB;AAAA,IAAA;AAAA,EACF;AASF,SANgBU,EAAU;AAAA,IACxB,QAAQL,KAAU,gBAAAT,EAACW,GAAA,CAAA,CAAc;AAAA,IACjC,KAAAD;AAAA,IACA,OAAOK,EAAgBF,GAAcf,GAAO,EAAE,WAAAU,GAAW;AAAA,EAAA,CAC1D;AAGH,CAAC;AAEDF,EAAS,cAAc;AAGhB,MAAMU,IAAO,OAAO,OAAOV,GAAU;AAAA,EAC1C,cAAAT;AACF,CAAC;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { T as p } from "./tooltip-hikjvdbg3xghnq1x.js";
|
|
4
|
+
import { c as g } from "./cn-ct4n7r74mh8y0f48.js";
|
|
5
|
+
import { IconContext as w } from "@phosphor-icons/react";
|
|
6
|
+
import { useRef as h, useEffect as y } from "react";
|
|
7
|
+
const E = ({
|
|
8
|
+
menuRef: e,
|
|
9
|
+
direction: o = "horizontal"
|
|
10
|
+
}) => {
|
|
11
|
+
const t = h(null);
|
|
12
|
+
y(() => {
|
|
13
|
+
if (!e.current) return;
|
|
14
|
+
const n = Array.from(
|
|
15
|
+
e.current.querySelectorAll(
|
|
16
|
+
'a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
if (n.length === 0) return;
|
|
20
|
+
const r = (u) => {
|
|
21
|
+
if (!t.current) return;
|
|
22
|
+
const l = n.indexOf(t.current);
|
|
23
|
+
let a = l;
|
|
24
|
+
const m = o === "horizontal", x = m ? "ArrowRight" : "ArrowDown", b = m ? "ArrowLeft" : "ArrowUp";
|
|
25
|
+
if (u.key === x)
|
|
26
|
+
u.preventDefault(), a = (l + 1) % n.length;
|
|
27
|
+
else if (u.key === b)
|
|
28
|
+
u.preventDefault(), a = (l - 1 + n.length) % n.length;
|
|
29
|
+
else
|
|
30
|
+
return;
|
|
31
|
+
const v = n[a];
|
|
32
|
+
t.current = v, v.focus();
|
|
33
|
+
}, s = () => document.addEventListener("keydown", r), i = () => document.removeEventListener("keydown", r), d = () => {
|
|
34
|
+
t.current = document.activeElement, s();
|
|
35
|
+
}, f = () => {
|
|
36
|
+
t.current = null, i();
|
|
37
|
+
};
|
|
38
|
+
return e.current.addEventListener("focusin", d), e.current.addEventListener("focusout", f), () => {
|
|
39
|
+
e.current?.removeEventListener("focusin", d), e.current?.removeEventListener("focusout", f), i();
|
|
40
|
+
};
|
|
41
|
+
}, [e, o]);
|
|
42
|
+
}, k = ({
|
|
43
|
+
icon: e,
|
|
44
|
+
id: o,
|
|
45
|
+
isActive: t,
|
|
46
|
+
onClick: n,
|
|
47
|
+
tooltip: r
|
|
48
|
+
}) => {
|
|
49
|
+
const s = /* @__PURE__ */ c(
|
|
50
|
+
"button",
|
|
51
|
+
{
|
|
52
|
+
"aria-label": r,
|
|
53
|
+
className: g(
|
|
54
|
+
"focus:inset-ring-focus relative -ml-px flex h-full w-11 cursor-pointer items-center justify-center rounded-md border-none bg-kumo-elevated first:rounded-l-lg last:rounded-r-lg transition-colors focus:z-1 focus:outline-none focus-visible:z-1 focus-visible:inset-ring-[0.5]",
|
|
55
|
+
{
|
|
56
|
+
"z-2 bg-kumo-base shadow-xs transition-colors ring ring-kumo-line/40": t === o
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
onClick: n,
|
|
60
|
+
children: /* @__PURE__ */ c(w.Provider, { value: { size: 18 }, children: e })
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return /* @__PURE__ */ c(p, { content: r, render: s });
|
|
64
|
+
}, I = ({
|
|
65
|
+
className: e,
|
|
66
|
+
isActive: o,
|
|
67
|
+
options: t,
|
|
68
|
+
optionIds: n = !1
|
|
69
|
+
// if option needs an extra unique ID
|
|
70
|
+
}) => {
|
|
71
|
+
const r = h(null);
|
|
72
|
+
return E({ menuRef: r, direction: "horizontal" }), /* @__PURE__ */ c(
|
|
73
|
+
"nav",
|
|
74
|
+
{
|
|
75
|
+
className: g(
|
|
76
|
+
"isolate flex rounded-lg ring ring-kumo-line bg-kumo-recessed pl-px shadow-xs transition-colors",
|
|
77
|
+
e
|
|
78
|
+
),
|
|
79
|
+
ref: r,
|
|
80
|
+
children: t.map((s, i) => /* @__PURE__ */ c(
|
|
81
|
+
k,
|
|
82
|
+
{
|
|
83
|
+
...s,
|
|
84
|
+
isActive: o,
|
|
85
|
+
id: n ? s.id : i
|
|
86
|
+
},
|
|
87
|
+
i
|
|
88
|
+
))
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
I as M,
|
|
94
|
+
E as u
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=menubar-e5e4zwfagr0wx023.js.map
|