@cloudflare/kumo 1.17.0 → 1.18.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 +53 -0
- package/ai/USAGE.md +38 -32
- package/ai/component-registry.json +123 -120
- package/ai/component-registry.md +203 -63
- package/ai/schemas.ts +1 -1
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +40 -48
- package/dist/ai/schemas.d.ts.map +1 -1
- package/dist/ai/schemas.js +2 -2
- package/dist/ai/schemas.js.map +1 -1
- package/dist/chunks/badge-dan90i0rzy4pwa1j.js +102 -0
- package/dist/chunks/badge-dan90i0rzy4pwa1j.js.map +1 -0
- package/dist/chunks/{banner-nz0eryqnz3qd86ln.js → banner-eiwcnk7ts21s3bnb.js} +4 -4
- package/dist/chunks/{banner-nz0eryqnz3qd86ln.js.map → banner-eiwcnk7ts21s3bnb.js.map} +1 -1
- package/dist/chunks/{breadcrumbs-cjgn3w4drahvqnuj.js → breadcrumbs-k39s28qx05vbxxth.js} +2 -2
- package/dist/chunks/{breadcrumbs-cjgn3w4drahvqnuj.js.map → breadcrumbs-k39s28qx05vbxxth.js.map} +1 -1
- package/dist/chunks/{button-odxi0hp4fvi5i2w3.js → button-cdxnqcgzwko8ooha.js} +15 -15
- package/dist/chunks/button-cdxnqcgzwko8ooha.js.map +1 -0
- package/dist/chunks/{checkbox-dx8x0rzv582yjv7n.js → checkbox-kt1uojk2f9e0d0h1.js} +13 -13
- package/dist/chunks/checkbox-kt1uojk2f9e0d0h1.js.map +1 -0
- package/dist/chunks/{clipboard-text-kyk51d1ze7zvdn4q.js → clipboard-text-vcbvmtne4zjk4b18.js} +4 -4
- package/dist/chunks/{clipboard-text-kyk51d1ze7zvdn4q.js.map → clipboard-text-vcbvmtne4zjk4b18.js.map} +1 -1
- package/dist/chunks/{code-liq1g6f5lhee305d.js → code-cz0w1y5z4h29a9eg.js} +18 -18
- package/dist/chunks/code-cz0w1y5z4h29a9eg.js.map +1 -0
- package/dist/chunks/{combobox-9fhjzprab46csmon.js → combobox-he2hd9e2ruknq5mp.js} +4 -4
- package/dist/chunks/{combobox-9fhjzprab46csmon.js.map → combobox-he2hd9e2ruknq5mp.js.map} +1 -1
- package/dist/chunks/{command-palette-kenx2bbdzd4kpx36.js → command-palette-jc1w07jwakxvj23a.js} +4 -4
- package/dist/chunks/{command-palette-kenx2bbdzd4kpx36.js.map → command-palette-jc1w07jwakxvj23a.js.map} +1 -1
- package/dist/chunks/{dialog-e05ysa8t2fklw065.js → dialog-oqh8l3l3zutpibxx.js} +3 -3
- package/dist/chunks/{dialog-e05ysa8t2fklw065.js.map → dialog-oqh8l3l3zutpibxx.js.map} +1 -1
- package/dist/chunks/{dropdown-g587px7zv3ssaxr4.js → dropdown-ncwhcd912vmone8k.js} +2 -2
- package/dist/chunks/{dropdown-g587px7zv3ssaxr4.js.map → dropdown-ncwhcd912vmone8k.js.map} +1 -1
- package/dist/chunks/{empty-fuz1un7r7mbz0kim.js → empty-cj898km1r8xwuw44.js} +2 -2
- package/dist/chunks/{empty-fuz1un7r7mbz0kim.js.map → empty-cj898km1r8xwuw44.js.map} +1 -1
- package/dist/chunks/{field-fq504lyu7ttsh5m9.js → field-krp6z6vfbkrvufz2.js} +3 -3
- package/dist/chunks/{field-fq504lyu7ttsh5m9.js.map → field-krp6z6vfbkrvufz2.js.map} +1 -1
- package/dist/chunks/input-area-no30c09udyjxshu5.js +78 -0
- package/dist/chunks/input-area-no30c09udyjxshu5.js.map +1 -0
- package/dist/chunks/{input-group-hbebbyh8fo6aqydn.js → input-group-lxdd09p60cf27pe1.js} +26 -26
- package/dist/chunks/input-group-lxdd09p60cf27pe1.js.map +1 -0
- package/dist/chunks/{input-kvhyo3p4859bexvx.js → input-h48k3uagzrgb98au.js} +40 -36
- package/dist/chunks/input-h48k3uagzrgb98au.js.map +1 -0
- package/dist/chunks/{label-j9owppbgnn35mebg.js → label-latndvb1ngem7we8.js} +3 -3
- package/dist/chunks/{label-j9owppbgnn35mebg.js.map → label-latndvb1ngem7we8.js.map} +1 -1
- package/dist/chunks/{link-hmmf3k1xn6rm72rt.js → link-hn5ejal7nhh0o0b4.js} +2 -2
- package/dist/chunks/{link-hmmf3k1xn6rm72rt.js.map → link-hn5ejal7nhh0o0b4.js.map} +1 -1
- package/dist/chunks/{loader-m5wfmqwgucrr4i5v.js → loader-hr2w7cpqeev3p3vl.js} +9 -6
- package/dist/chunks/loader-hr2w7cpqeev3p3vl.js.map +1 -0
- package/dist/chunks/{menubar-abojnm0uwjuni8ok.js → menubar-f1pilzooe5mue7c4.js} +2 -2
- package/dist/chunks/{menubar-abojnm0uwjuni8ok.js.map → menubar-f1pilzooe5mue7c4.js.map} +1 -1
- package/dist/chunks/{meter-i84dte2f82qmvn7y.js → meter-gfa1hz9fhjnvx784.js} +2 -2
- package/dist/chunks/{meter-i84dte2f82qmvn7y.js.map → meter-gfa1hz9fhjnvx784.js.map} +1 -1
- package/dist/chunks/pagination-cu5lm6p5dxuycta4.js +243 -0
- package/dist/chunks/pagination-cu5lm6p5dxuycta4.js.map +1 -0
- package/dist/chunks/{popover-i951xjcgezeqr4iv.js → popover-h300w4vit0s2ayej.js} +7 -7
- package/dist/chunks/{popover-i951xjcgezeqr4iv.js.map → popover-h300w4vit0s2ayej.js.map} +1 -1
- package/dist/chunks/{radio-l2vkcue40d84fmo1.js → radio-jouttv89lbvhs55r.js} +37 -37
- package/dist/chunks/radio-jouttv89lbvhs55r.js.map +1 -0
- package/dist/chunks/select-kva5ru5f673kah1m.js +179 -0
- package/dist/chunks/select-kva5ru5f673kah1m.js.map +1 -0
- package/dist/chunks/{sensitive-input-kznmknpp5h1grc6k.js → sensitive-input-hd4tpqkzifad1yca.js} +34 -34
- package/dist/chunks/{sensitive-input-kznmknpp5h1grc6k.js.map → sensitive-input-hd4tpqkzifad1yca.js.map} +1 -1
- package/dist/chunks/{sidebar-jepeq7gaf4issuw6.js → sidebar-hljy3ssm8itc0ucx.js} +5 -5
- package/dist/chunks/sidebar-hljy3ssm8itc0ucx.js.map +1 -0
- package/dist/chunks/{surface-blo81kgy9g0sexgm.js → surface-cilvbyhmyujz1bee.js} +2 -2
- package/dist/chunks/{surface-blo81kgy9g0sexgm.js.map → surface-cilvbyhmyujz1bee.js.map} +1 -1
- package/dist/chunks/{switch-i0zwcp3wq6vsxm1c.js → switch-ihaydbzem62bey4p.js} +106 -104
- package/dist/chunks/switch-ihaydbzem62bey4p.js.map +1 -0
- package/dist/chunks/{table-nrcw19tlpduayukl.js → table-inweecadl3her7pd.js} +9 -9
- package/dist/chunks/{table-nrcw19tlpduayukl.js.map → table-inweecadl3her7pd.js.map} +1 -1
- package/dist/chunks/{tabs-bw92jb303zxw7w4f.js → tabs-e7eh7l3mpk3xgmwq.js} +15 -15
- package/dist/chunks/{tabs-bw92jb303zxw7w4f.js.map → tabs-e7eh7l3mpk3xgmwq.js.map} +1 -1
- package/dist/chunks/{toast-lrnwby56drs7vtae.js → toast-bpz6iaq54u9jmuu8.js} +30 -30
- package/dist/chunks/{toast-lrnwby56drs7vtae.js.map → toast-bpz6iaq54u9jmuu8.js.map} +1 -1
- package/dist/chunks/{tooltip-cit9ltlxfuhwctuj.js → tooltip-belkznz8t8333h5f.js} +20 -16
- package/dist/chunks/tooltip-belkznz8t8333h5f.js.map +1 -0
- package/dist/chunks/{vendor-base-ui-n30qblevnpk9cc5c.js → vendor-base-ui-k7bzesq81ie36nya.js} +34 -31
- package/dist/chunks/{vendor-base-ui-n30qblevnpk9cc5c.js.map → vendor-base-ui-k7bzesq81ie36nya.js.map} +1 -1
- package/dist/code.js +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/code.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/input.js +3 -3
- package/dist/components/label.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/loader.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.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 +38 -38
- 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 +29 -110
- package/dist/scripts/theme-generator/config.js.map +1 -1
- package/dist/src/components/badge/badge.d.ts +61 -79
- package/dist/src/components/badge/badge.d.ts.map +1 -1
- package/dist/src/components/banner/banner.d.ts +3 -3
- package/dist/src/components/button/button.d.ts +2 -2
- package/dist/src/components/checkbox/checkbox.d.ts +1 -1
- package/dist/src/components/code/code.d.ts.map +1 -1
- package/dist/src/components/input/input-area.d.ts.map +1 -1
- package/dist/src/components/input/input.d.ts +1 -2
- package/dist/src/components/input/input.d.ts.map +1 -1
- package/dist/src/components/loader/loader.d.ts +7 -1
- package/dist/src/components/loader/loader.d.ts.map +1 -1
- package/dist/src/components/pagination/pagination.d.ts +11 -1
- package/dist/src/components/pagination/pagination.d.ts.map +1 -1
- package/dist/src/components/radio/radio.d.ts +1 -1
- package/dist/src/components/select/select.d.ts +66 -2
- package/dist/src/components/select/select.d.ts.map +1 -1
- package/dist/src/components/sensitive-input/sensitive-input.d.ts +1 -1
- package/dist/src/components/switch/switch.d.ts.map +1 -1
- package/dist/src/components/toast/toast.d.ts +1 -1
- package/dist/src/components/tooltip/tooltip.d.ts +11 -1
- package/dist/src/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/styles/kumo-binding.css +3 -0
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/theme-fedramp.css +3 -3
- package/dist/styles/theme-kumo.css +61 -122
- package/package.json +1 -1
- package/scripts/component-registry/index.test.ts +4 -4
- package/scripts/component-registry/metadata.ts +3 -3
- package/scripts/theme-generator/config.ts +29 -110
- package/dist/chunks/badge-n80t3z8u9ttlxi20.js +0 -120
- package/dist/chunks/badge-n80t3z8u9ttlxi20.js.map +0 -1
- package/dist/chunks/button-odxi0hp4fvi5i2w3.js.map +0 -1
- package/dist/chunks/checkbox-dx8x0rzv582yjv7n.js.map +0 -1
- package/dist/chunks/code-liq1g6f5lhee305d.js.map +0 -1
- package/dist/chunks/input-area-nq40szg9110on89c.js +0 -74
- package/dist/chunks/input-area-nq40szg9110on89c.js.map +0 -1
- package/dist/chunks/input-group-hbebbyh8fo6aqydn.js.map +0 -1
- package/dist/chunks/input-kvhyo3p4859bexvx.js.map +0 -1
- package/dist/chunks/loader-m5wfmqwgucrr4i5v.js.map +0 -1
- package/dist/chunks/pagination-pbd7qqik97ac0l7m.js +0 -224
- package/dist/chunks/pagination-pbd7qqik97ac0l7m.js.map +0 -1
- package/dist/chunks/radio-l2vkcue40d84fmo1.js.map +0 -1
- package/dist/chunks/select-paedwa3nlhpq82ua.js +0 -132
- package/dist/chunks/select-paedwa3nlhpq82ua.js.map +0 -1
- package/dist/chunks/sidebar-jepeq7gaf4issuw6.js.map +0 -1
- package/dist/chunks/switch-i0zwcp3wq6vsxm1c.js.map +0 -1
- package/dist/chunks/tooltip-cit9ltlxfuhwctuj.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-jouttv89lbvhs55r.js","sources":["../../src/components/radio/radio.tsx"],"sourcesContent":["import { forwardRef, createContext, useContext, type ReactNode } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Fieldset } from \"@base-ui/react/fieldset\";\nimport { RadioGroup as BaseRadioGroup } from \"@base-ui/react/radio-group\";\nimport { Radio as BaseRadio } from \"@base-ui/react/radio\";\n\n/** Radio variant definitions mapping variant names to their Tailwind classes. */\nexport const KUMO_RADIO_VARIANTS = {\n variant: {\n default: {\n classes: \"ring-kumo-line\",\n description: \"Default radio appearance\",\n },\n error: {\n classes: \"ring-kumo-danger\",\n description: \"Error state for validation failures\",\n },\n },\n appearance: {\n default: {\n classes: \"\",\n description: \"Standard inline radio item\",\n },\n card: {\n classes:\n \"rounded-lg border border-kumo-hairline bg-kumo-base p-3 transition-colors hover:bg-kumo-tint has-[[data-checked]]:border-kumo-interact has-[[data-checked]]:bg-kumo-tint\",\n description:\n \"Choice card appearance with border, padding, and highlighted selection state\",\n },\n },\n} as const;\n\nexport const KUMO_RADIO_DEFAULT_VARIANTS = {\n variant: \"default\",\n appearance: \"default\",\n} as const;\n\n// Derived types from KUMO_RADIO_VARIANTS\nexport type KumoRadioVariant = keyof typeof KUMO_RADIO_VARIANTS.variant;\nexport type KumoRadioAppearance = keyof typeof KUMO_RADIO_VARIANTS.appearance;\n\nexport interface KumoRadioVariantsProps {\n /**\n * Visual variant.\n * - `\"default\"` — Standard radio appearance\n * - `\"error\"` — Error state for validation failures\n * @default \"default\"\n */\n variant?: KumoRadioVariant;\n /**\n * Visual appearance.\n * - `\"default\"` — Standard inline radio item\n * - `\"card\"` — Choice card with border, padding, and highlighted selection state\n * @default \"default\"\n */\n appearance?: KumoRadioAppearance;\n}\n\nexport function radioVariants({\n variant = KUMO_RADIO_DEFAULT_VARIANTS.variant,\n appearance = KUMO_RADIO_DEFAULT_VARIANTS.appearance,\n}: KumoRadioVariantsProps = {}) {\n return cn(\n KUMO_RADIO_VARIANTS.variant[variant].classes,\n KUMO_RADIO_VARIANTS.appearance[appearance].classes,\n );\n}\n\n// Legacy type alias for backwards compatibility\nexport type RadioVariant = KumoRadioVariant;\n\n/** Position of the radio control relative to its label */\nexport type RadioControlPosition = \"start\" | \"end\";\n\n// Context for passing controlPosition and appearance from Group to Items\nconst RadioGroupContext = createContext<{\n controlPosition: RadioControlPosition;\n appearance: KumoRadioAppearance;\n}>({\n controlPosition: \"start\",\n appearance: \"default\",\n});\n\n/**\n * Radio group component props (with built-in Fieldset and RadioGroup)\n *\n * @example\n * // Basic usage\n * ```tsx\n * <Radio.Group legend=\"Notification preference\" defaultValue=\"email\">\n * <Radio.Item label=\"Email\" value=\"email\" />\n * <Radio.Item label=\"SMS\" value=\"sms\" />\n * <Radio.Item label=\"Push\" value=\"push\" />\n * </Radio.Group>\n * ```\n *\n * @example\n * // Horizontal layout\n * ```tsx\n * <Radio.Group legend=\"Size\" orientation=\"horizontal\" defaultValue=\"md\">\n * <Radio.Item label=\"Small\" value=\"sm\" />\n * <Radio.Item label=\"Medium\" value=\"md\" />\n * <Radio.Item label=\"Large\" value=\"lg\" />\n * </Radio.Group>\n * ```\n *\n * @example\n * // With error and description\n * ```tsx\n * <Radio.Group\n * legend=\"Payment method\"\n * error=\"Please select a payment method\"\n * description=\"Choose how you'd like to pay\"\n * >\n * <Radio.Item label=\"Credit Card\" value=\"card\" />\n * <Radio.Item label=\"PayPal\" value=\"paypal\" />\n * </Radio.Group>\n * ```\n *\n * @example\n * // Controlled\n * ```tsx\n * const [value, setValue] = useState(\"email\");\n * <Radio.Group legend=\"Contact\" value={value} onValueChange={setValue}>\n * <Radio.Item label=\"Email\" value=\"email\" />\n * <Radio.Item label=\"Phone\" value=\"phone\" />\n * </Radio.Group>\n * ```\n *\n * @example\n * // Label before radio (controlPosition=\"end\")\n * ```tsx\n * <Radio.Group legend=\"Options\" controlPosition=\"end\" defaultValue=\"a\">\n * <Radio.Item label=\"Option A\" value=\"a\" />\n * <Radio.Item label=\"Option B\" value=\"b\" />\n * </Radio.Group>\n * ```\n */\nexport interface RadioGroupProps {\n /** Legend text for the group (required for accessibility) */\n legend: string;\n /** Child Radio.Item components */\n children: ReactNode;\n /** Layout direction of the radio items */\n orientation?: \"vertical\" | \"horizontal\";\n /**\n * Visual appearance applied to all Radio.Item children.\n * - `\"default\"` — Standard inline radio items\n * - `\"card\"` — Choice card with border, padding, and highlighted selection state\n *\n * Individual items can override this with their own `appearance` prop.\n * @default \"default\"\n */\n appearance?: KumoRadioAppearance;\n /** Error message for the group */\n error?: string;\n /** Helper text for the group */\n description?: ReactNode;\n /** Value of the radio that should be initially selected (uncontrolled) */\n defaultValue?: string;\n /** Value of the radio that should be selected (controlled) */\n value?: string;\n /** Event handler called when radio value changes */\n onValueChange?: (value: string) => void;\n /** Whether all radios in the group are disabled */\n disabled?: boolean;\n /** Position of radio control relative to label: \"start\" (default) puts radio before label, \"end\" puts label before radio. Note: In card appearance, the control is always positioned at the end. */\n controlPosition?: RadioControlPosition;\n /** Form submission name for the radio group */\n name?: string;\n /** Additional CSS classes */\n className?: string;\n}\n\n/**\n * Individual radio item within a group\n *\n * @example\n * ```tsx\n * <Radio.Item label=\"Option A\" value=\"a\" />\n * ```\n *\n * @example\n * // Disabled item\n * ```tsx\n * <Radio.Item label=\"Unavailable\" value=\"unavailable\" disabled />\n * ```\n */\nexport type RadioItemProps = {\n /** Visual variant: \"default\" or \"error\" for validation failures */\n variant?: RadioVariant;\n /**\n * Visual appearance of the radio item.\n * - `\"default\"` — Standard inline radio item\n * - `\"card\"` — Choice card with border, padding, and highlighted selection state\n *\n * When set on an individual item, overrides the group-level `appearance`.\n * @default \"default\"\n */\n appearance?: KumoRadioAppearance;\n /** Label text displayed next to radio (required) */\n label: string;\n /** Description text displayed below the label (only visible in card appearance) */\n description?: ReactNode;\n /** Value of the radio (required) */\n value: string;\n /** Additional CSS classes for the label wrapper */\n className?: string;\n /** Whether the radio is disabled */\n disabled?: boolean;\n};\n\n// Radio.Item for use within Radio.Group\nconst RadioItem = forwardRef<HTMLButtonElement, RadioItemProps>(\n (\n {\n className,\n disabled,\n variant = \"default\",\n appearance: appearanceProp,\n label,\n description,\n value,\n },\n ref,\n ) => {\n const { controlPosition, appearance: groupAppearance } =\n useContext(RadioGroupContext);\n const appearance = appearanceProp ?? groupAppearance;\n const isCard = appearance === \"card\";\n\n // In card mode, default to \"end\" (radio on the right); otherwise follow group setting\n const effectiveControlPosition = isCard ? \"end\" : controlPosition;\n\n if (isCard) {\n return (\n <label\n className={cn(\n \"m-0 group relative flex items-start gap-3 rounded-lg border border-kumo-hairline bg-kumo-base p-3 transition-colors has-[[data-checked]]:border-kumo-interact has-[[data-checked]]:bg-kumo-tint\",\n variant === \"error\" &&\n \"border-kumo-danger has-[[data-checked]]:border-kumo-danger has-[[data-checked]]:bg-kumo-base\",\n disabled\n ? \"cursor-not-allowed opacity-50\"\n : cn(\n \"has-[[data-disabled]]:cursor-not-allowed has-[[data-disabled]]:opacity-50 cursor-pointer\",\n variant !== \"error\" &&\n \"hover:not-has-[[data-disabled]]:bg-kumo-tint\",\n ),\n className,\n )}\n >\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"text-base font-medium text-kumo-default\">\n {label}\n </span>\n {description && (\n <span className=\"text-sm text-kumo-subtle\">{description}</span>\n )}\n </div>\n <BaseRadio.Root\n ref={ref}\n value={value}\n disabled={disabled}\n className={cn(\n \"relative mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-0 bg-kumo-base ring\",\n variant === \"error\" ? \"ring-kumo-danger\" : \"ring-kumo-line\",\n !disabled &&\n variant !== \"error\" &&\n \"group-hover:ring-kumo-hairline focus-visible:ring-kumo-hairline focus-visible:outline-offset-3\",\n !disabled &&\n variant === \"error\" &&\n \"focus-visible:ring-kumo-danger focus-visible:outline-offset-3\",\n \"data-[checked]:bg-kumo-contrast\",\n )}\n >\n <BaseRadio.Indicator\n keepMounted\n className=\"flex items-center justify-center\"\n >\n <span className=\"h-2 w-2 rounded-full bg-kumo-base\" />\n </BaseRadio.Indicator>\n </BaseRadio.Root>\n </label>\n );\n }\n\n return (\n <label\n className={cn(\n \"m-0 group relative inline-flex items-center gap-2\",\n // \"start\" (default): radio before label\n // \"end\": label before radio using flex-row-reverse\n effectiveControlPosition === \"end\" && \"flex-row-reverse justify-end\",\n disabled ? \"cursor-not-allowed opacity-50\" : \"cursor-pointer\",\n className,\n )}\n >\n <BaseRadio.Root\n ref={ref}\n value={value}\n disabled={disabled}\n className={cn(\n \"relative flex h-4 w-4 items-center justify-center rounded-full border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2\",\n variant === \"error\" ? \"ring-kumo-danger\" : \"ring-kumo-line\",\n !disabled &&\n variant !== \"error\" &&\n \"group-hover:ring-kumo-hairline focus-visible:ring-kumo-hairline focus-visible:outline-offset-3\",\n !disabled &&\n variant === \"error\" &&\n \"focus-visible:ring-kumo-danger focus-visible:outline-offset-3\",\n \"data-[checked]:bg-kumo-contrast\",\n )}\n >\n <BaseRadio.Indicator\n keepMounted\n className=\"flex items-center justify-center\"\n >\n <span className=\"h-2 w-2 rounded-full bg-kumo-base\" />\n </BaseRadio.Indicator>\n </BaseRadio.Root>\n <span className=\"text-base text-kumo-default\">{label}</span>\n </label>\n );\n },\n);\n\nRadioItem.displayName = \"Radio.Item\";\n\n// Radio.Group with built-in Fieldset and RadioGroup\nfunction RadioGroup({\n legend,\n children,\n orientation = \"vertical\",\n appearance = \"default\",\n error,\n description,\n defaultValue,\n value,\n onValueChange,\n disabled,\n controlPosition = \"start\",\n name,\n className,\n}: RadioGroupProps) {\n return (\n <RadioGroupContext.Provider value={{ controlPosition, appearance }}>\n <BaseRadioGroup\n defaultValue={defaultValue}\n value={value}\n onValueChange={(newValue) => onValueChange?.(newValue)}\n disabled={disabled}\n name={name}\n >\n <Fieldset.Root\n disabled={disabled}\n className={cn(\"flex flex-col gap-4\", className)}\n >\n <Fieldset.Legend className=\"text-base font-medium text-kumo-default\">\n {legend}\n </Fieldset.Legend>\n <div\n className={cn(\n orientation === \"vertical\"\n ? cn(\"flex flex-col\", appearance === \"card\" ? \"gap-3\" : \"gap-2\")\n : appearance === \"card\"\n ? \"grid grid-cols-2 gap-3\"\n : \"flex flex-row flex-wrap gap-2\",\n )}\n >\n {children}\n </div>\n {error && <p className=\"text-sm text-kumo-danger\">{error}</p>}\n {description && (\n <p className=\"text-sm text-kumo-subtle\">{description}</p>\n )}\n </Fieldset.Root>\n </BaseRadioGroup>\n </RadioGroupContext.Provider>\n );\n}\n\nRadioGroup.displayName = \"Radio.Group\";\n\n// Export RadioGroup directly for external usage\nexport { RadioGroup };\n\n/**\n * Radio — radio button group for single-select choices.\n *\n * Compound component: `Radio.Group` (with built-in Fieldset) and `Radio.Item`.\n * Built on `@base-ui/react/radio-group` + `@base-ui/react/radio`.\n *\n * @example\n * ```tsx\n * <Radio.Group legend=\"Notification preference\" defaultValue=\"email\">\n * <Radio.Item label=\"Email\" value=\"email\" />\n * <Radio.Item label=\"SMS\" value=\"sms\" />\n * <Radio.Item label=\"Push\" value=\"push\" />\n * </Radio.Group>\n * ```\n */\nexport const Radio = Object.assign(RadioGroup, {\n Item: RadioItem,\n Group: RadioGroup,\n});\n"],"names":["KUMO_RADIO_VARIANTS","KUMO_RADIO_DEFAULT_VARIANTS","radioVariants","variant","appearance","cn","RadioGroupContext","createContext","RadioItem","forwardRef","className","disabled","appearanceProp","label","description","value","ref","controlPosition","groupAppearance","useContext","isCard","effectiveControlPosition","jsxs","jsx","BaseRadio.Root","BaseRadio.Indicator","RadioGroup","legend","children","orientation","error","defaultValue","onValueChange","name","BaseRadioGroup","newValue","Fieldset.Root","Fieldset.Legend","Radio"],"mappings":";;;;;AAOO,MAAMA,IAAsB;AAAA,EACjC,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;AAAA,EAEF,YAAY;AAAA,IACV,SAAS;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,MAAM;AAAA,MACJ,SACE;AAAA,MACF,aACE;AAAA,IAAA;AAAA,EACJ;AAEJ,GAEaC,IAA8B;AAAA,EACzC,SAAS;AAAA,EACT,YAAY;AACd;AAuBO,SAASC,EAAc;AAAA,EAC5B,SAAAC,IAAUF,EAA4B;AAAA,EACtC,YAAAG,IAAaH,EAA4B;AAC3C,IAA4B,IAAI;AAC9B,SAAOI;AAAA,IAC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;AAAA,EAClB,MAAAgB;AAAA,EACA,WAAAvB;AACF,GAAoB;AAClB,SACE,gBAAAa,EAACjB,EAAkB,UAAlB,EAA2B,OAAO,EAAE,iBAAAW,GAAiB,YAAAb,KACpD,UAAA,gBAAAmB;AAAA,IAACW;AAAAA,IAAA;AAAA,MACC,cAAAH;AAAA,MACA,OAAAhB;AAAA,MACA,eAAe,CAACoB,MAAaH,IAAgBG,CAAQ;AAAA,MACrD,UAAAxB;AAAA,MACA,MAAAsB;AAAA,MAEA,UAAA,gBAAAX;AAAA,QAACc;AAAAA,QAAA;AAAA,UACC,UAAAzB;AAAA,UACA,WAAWN,EAAG,uBAAuBK,CAAS;AAAA,UAE9C,UAAA;AAAA,YAAA,gBAAAa,EAACc,GAAA,EAAgB,WAAU,2CACxB,UAAAV,GACH;AAAA,YACA,gBAAAJ;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWlB;AAAA,kBACTwB,MAAgB,aACZxB,EAAG,iBAAiBD,MAAe,SAAS,UAAU,OAAO,IAC7DA,MAAe,SACb,2BACA;AAAA,gBAAA;AAAA,gBAGP,UAAAwB;AAAA,cAAA;AAAA,YAAA;AAAA,YAEFE,KAAS,gBAAAP,EAAC,KAAA,EAAE,WAAU,4BAA4B,UAAAO,GAAM;AAAA,YACxDhB,KACC,gBAAAS,EAAC,KAAA,EAAE,WAAU,4BAA4B,UAAAT,EAAA,CAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEzD;AAAA,EAAA,GAEJ;AAEJ;AAEAY,EAAW,cAAc;AAoBlB,MAAMY,IAAQ,OAAO,OAAOZ,GAAY;AAAA,EAC7C,MAAMlB;AAAA,EACN,OAAOkB;AACT,CAAC;"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { CaretUpDownIcon as _, CheckIcon as M } from "@phosphor-icons/react";
|
|
4
|
+
import { useId as R, forwardRef as p } from "react";
|
|
5
|
+
import { c as r } from "./cn-ct4n7r74mh8y0f48.js";
|
|
6
|
+
import { b as T } from "./button-cdxnqcgzwko8ooha.js";
|
|
7
|
+
import { S as W } from "./skeleton-line-epxenksfesr2fkcv.js";
|
|
8
|
+
import { F as B } from "./field-krp6z6vfbkrvufz2.js";
|
|
9
|
+
import { u as K } from "./portal-provider-hwmkdmkpvct0cb76.js";
|
|
10
|
+
import { aV as U, aW as X, aX as Y, aY as Z, aZ as q, a_ as H, a$ as J, b0 as Q, b1 as ee, b2 as ae, b3 as te, b4 as le, b5 as oe, S as ne } from "./vendor-base-ui-k7bzesq81ie36nya.js";
|
|
11
|
+
function x(e) {
|
|
12
|
+
if (e == null || typeof e != "object" || Array.isArray(e) || "$$typeof" in e || e instanceof Promise) return !1;
|
|
13
|
+
const l = e;
|
|
14
|
+
return "label" in l && l.label !== void 0;
|
|
15
|
+
}
|
|
16
|
+
function N(e) {
|
|
17
|
+
return Array.isArray(e) ? e : Object.entries(e).map(([l, o]) => ({
|
|
18
|
+
value: l,
|
|
19
|
+
label: x(o) ? o.label : o
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
function se(e) {
|
|
23
|
+
const l = N(e), o = /* @__PURE__ */ new Map();
|
|
24
|
+
if (!Array.isArray(e))
|
|
25
|
+
for (const [a, i] of Object.entries(e))
|
|
26
|
+
x(i) && o.set(a, { disabled: i.disabled });
|
|
27
|
+
return l.filter((a) => a.value !== null).map((a, i) => {
|
|
28
|
+
const d = typeof a.value == "string" ? a.value : `option-${i}`, m = typeof a.value == "string" ? o.get(a.value) : void 0;
|
|
29
|
+
return /* @__PURE__ */ t(k, { value: a.value, disabled: m?.disabled, children: a.label }, d);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function c({
|
|
33
|
+
children: e,
|
|
34
|
+
className: l,
|
|
35
|
+
renderValue: o,
|
|
36
|
+
label: a,
|
|
37
|
+
hideLabel: i,
|
|
38
|
+
placeholder: d,
|
|
39
|
+
loading: m,
|
|
40
|
+
labelTooltip: G,
|
|
41
|
+
description: b,
|
|
42
|
+
error: n,
|
|
43
|
+
required: O,
|
|
44
|
+
container: j,
|
|
45
|
+
...s
|
|
46
|
+
}) {
|
|
47
|
+
const f = R(), A = K(), C = j ?? A ?? void 0, h = s, F = h["aria-label"], P = h["aria-labelledby"], $ = typeof a == "string" ? a : d;
|
|
48
|
+
process.env.NODE_ENV !== "production" && i !== void 0 && console.warn(
|
|
49
|
+
'[Kumo Select]: `hideLabel` is deprecated. For hidden labels, use `aria-label` instead of `label` + `hideLabel={true}`.\n Migration:\n - For visible labels: <Select label="Country" /> (hideLabel no longer needed)\n - For hidden labels: <Select aria-label="Select a country" /> (remove label and hideLabel)'
|
|
50
|
+
);
|
|
51
|
+
const y = a && i !== !0, g = y ? void 0 : P ?? (a ? f : void 0), z = F ?? (g ? void 0 : $), V = s.items ? N(s.items) : void 0, D = e ?? (s.items ? se(s.items) : null), { items: ie, ...E } = s, S = /* @__PURE__ */ u(
|
|
52
|
+
U,
|
|
53
|
+
{
|
|
54
|
+
...E,
|
|
55
|
+
items: V,
|
|
56
|
+
disabled: m || s.disabled,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ u(
|
|
59
|
+
X,
|
|
60
|
+
{
|
|
61
|
+
className: r(
|
|
62
|
+
T(),
|
|
63
|
+
"justify-between font-normal",
|
|
64
|
+
"focus:opacity-100 focus-visible:ring-1 focus-visible:ring-kumo-hairline *:in-focus:opacity-100",
|
|
65
|
+
s.disabled && "cursor-not-allowed opacity-50",
|
|
66
|
+
l
|
|
67
|
+
),
|
|
68
|
+
"aria-label": z,
|
|
69
|
+
"aria-labelledby": g,
|
|
70
|
+
children: [
|
|
71
|
+
m ? /* @__PURE__ */ t(W, { className: "w-32" }) : /* @__PURE__ */ t(
|
|
72
|
+
Y,
|
|
73
|
+
{
|
|
74
|
+
placeholder: d,
|
|
75
|
+
className: "min-w-0 truncate",
|
|
76
|
+
children: o
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ t(Z, { className: "flex shrink-0 items-center", children: /* @__PURE__ */ t(_, {}) })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ t(q, { container: C, children: /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(
|
|
84
|
+
J,
|
|
85
|
+
{
|
|
86
|
+
className: r(
|
|
87
|
+
"flex flex-col",
|
|
88
|
+
"max-h-[var(--available-height)] bg-kumo-base text-kumo-default",
|
|
89
|
+
"rounded-lg shadow-lg ring ring-kumo-hairline",
|
|
90
|
+
"min-w-[calc(var(--anchor-width)+3px)] py-1.5"
|
|
91
|
+
),
|
|
92
|
+
children: /* @__PURE__ */ t(
|
|
93
|
+
Q,
|
|
94
|
+
{
|
|
95
|
+
className: r(
|
|
96
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-none scroll-pt-2 scroll-pb-2"
|
|
97
|
+
),
|
|
98
|
+
children: D
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
) }) })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
if (y)
|
|
107
|
+
return /* @__PURE__ */ t(
|
|
108
|
+
B,
|
|
109
|
+
{
|
|
110
|
+
label: a,
|
|
111
|
+
required: O,
|
|
112
|
+
labelTooltip: G,
|
|
113
|
+
description: b,
|
|
114
|
+
error: n ? typeof n == "string" ? { message: n, match: !0 } : n : void 0,
|
|
115
|
+
children: S
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
const v = n ? typeof n == "string" ? { message: n } : n : void 0;
|
|
119
|
+
return /* @__PURE__ */ u("div", { className: "grid gap-2", children: [
|
|
120
|
+
a && /* @__PURE__ */ t("span", { id: f, className: "sr-only", children: a }),
|
|
121
|
+
S,
|
|
122
|
+
v ? /* @__PURE__ */ t("span", { className: "text-sm text-kumo-danger", children: v.message }) : b && /* @__PURE__ */ t("span", { className: "text-sm leading-snug text-kumo-subtle", children: b })
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
function k({ children: e, value: l, disabled: o, className: a }) {
|
|
126
|
+
return /* @__PURE__ */ u(
|
|
127
|
+
ee,
|
|
128
|
+
{
|
|
129
|
+
value: l,
|
|
130
|
+
disabled: o,
|
|
131
|
+
className: r(
|
|
132
|
+
"group mx-1.5 flex cursor-pointer items-center justify-between gap-2 rounded px-2 py-1.5 text-base data-highlighted:bg-kumo-tint",
|
|
133
|
+
"data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
134
|
+
a
|
|
135
|
+
),
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ t(ae, { children: e }),
|
|
138
|
+
/* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(M, {}) })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
const L = p(
|
|
144
|
+
({ children: e, className: l }, o) => /* @__PURE__ */ t(le, { ref: o, className: r(l), children: e })
|
|
145
|
+
);
|
|
146
|
+
L.displayName = "Select.Group";
|
|
147
|
+
const w = p(
|
|
148
|
+
({ children: e, className: l }, o) => /* @__PURE__ */ t(
|
|
149
|
+
oe,
|
|
150
|
+
{
|
|
151
|
+
ref: o,
|
|
152
|
+
className: r(
|
|
153
|
+
"px-3.5 py-1.5 text-sm font-semibold text-kumo-subtle",
|
|
154
|
+
l
|
|
155
|
+
),
|
|
156
|
+
children: e
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
);
|
|
160
|
+
w.displayName = "Select.GroupLabel";
|
|
161
|
+
const I = p(
|
|
162
|
+
({ className: e }, l) => /* @__PURE__ */ t(
|
|
163
|
+
ne,
|
|
164
|
+
{
|
|
165
|
+
ref: l,
|
|
166
|
+
className: r("-mx-1 my-1 h-px bg-kumo-line", e)
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
);
|
|
170
|
+
I.displayName = "Select.Separator";
|
|
171
|
+
c.Option = k;
|
|
172
|
+
c.Group = L;
|
|
173
|
+
c.GroupLabel = w;
|
|
174
|
+
c.Separator = I;
|
|
175
|
+
c.Option.displayName = "Select.Option";
|
|
176
|
+
export {
|
|
177
|
+
c as S
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=select-kva5ru5f673kah1m.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-kva5ru5f673kah1m.js","sources":["../../src/components/select/select.tsx"],"sourcesContent":["import { Select as SelectBase } from \"@base-ui/react/select\";\nimport { CaretUpDownIcon, CheckIcon } from \"@phosphor-icons/react\";\nimport { forwardRef, useId } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { buttonVariants } from \"../button\";\nimport { SkeletonLine } from \"../loader\";\nimport { Field, type FieldErrorMatch } from \"../field/field\";\nimport {\n usePortalContainer,\n type PortalContainer,\n} from \"../../utils/portal-provider\";\n\n/** Select variant definitions (currently empty, reserved for future additions). */\nexport const KUMO_SELECT_VARIANTS = {\n // Select currently has no variant options but structure is ready for future additions\n} as const;\n\nexport const KUMO_SELECT_DEFAULT_VARIANTS = {} as const;\n\n/**\n * Select component styling metadata for Figma plugin code generation\n * Extracted from select.tsx implementation (source of truth)\n */\nexport const KUMO_SELECT_STYLING = {\n trigger: {\n height: 36, // h-9\n paddingX: 12, // px-3\n borderRadius: 8, // rounded-lg\n background: \"color-secondary\",\n text: \"text-color-surface\",\n ring: \"color-border\",\n fontSize: 16, // text-base\n fontWeight: 400, // font-normal\n },\n stateTokens: {\n focus: { ring: \"color-active\" },\n disabled: { opacity: 0.5 },\n },\n icons: {\n caret: { name: \"ph-caret-up-down\", size: 20 },\n check: { name: \"ph-check\", size: 20 },\n },\n popup: {\n background: \"color-secondary\",\n ring: \"color-border\",\n borderRadius: 8, // rounded-lg\n padding: 6, // p-1.5\n },\n option: {\n paddingX: 8, // px-2\n paddingY: 6, // py-1.5\n borderRadius: 4, // rounded\n fontSize: 16, // text-base\n highlightBackground: \"color-surface-secondary\",\n },\n} as const;\n\n// Derived types from KUMO_SELECT_VARIANTS\nexport interface KumoSelectVariantsProps {}\n\nexport function selectVariants(_props: KumoSelectVariantsProps = {}) {\n return cn(\n buttonVariants(),\n \"justify-between font-normal\",\n \"focus:opacity-100 focus-visible:ring-1 focus-visible:ring-kumo-hairline *:in-focus:opacity-100\",\n );\n}\n\n/**\n * Shape for items that carry extra metadata (disabled state, tooltip).\n * Plain `ReactNode` values are still supported for backward compatibility.\n */\nexport interface SelectItemDescriptor {\n /** Display label for the option. */\n label: ReactNode;\n /** When `true`, the option cannot be selected. */\n disabled?: boolean;\n}\n\n/** Value type accepted by the `items` object-map prop. */\nexport type SelectItemValue = ReactNode | SelectItemDescriptor;\n\nfunction isItemDescriptor(\n value: SelectItemValue,\n): value is SelectItemDescriptor {\n if (value === null || value === undefined) return false;\n if (typeof value !== \"object\" || Array.isArray(value)) return false;\n // React elements have $$typeof — exclude them\n if (\"$$typeof\" in (value as object)) return false;\n // Promises are not descriptors\n if (value instanceof Promise) return false;\n // Must have a defined label (not just the key existing)\n const candidate = value as unknown as Record<string, unknown>;\n return \"label\" in candidate && candidate.label !== undefined;\n}\n\n/**\n * Normalizes items to array format for Base UI.\n * Object maps are converted to array format so Base UI can properly\n * handle value matching and placeholder display.\n */\nfunction normalizeItems<T>(\n items:\n | Record<string, SelectItemValue>\n | ReadonlyArray<{ label: ReactNode; value: T }>,\n): ReadonlyArray<{ label: ReactNode; value: T }> {\n if (Array.isArray(items)) {\n return items;\n }\n // Convert object map to array format\n return Object.entries(items).map(([key, entry]) => ({\n value: key as T,\n label: isItemDescriptor(entry) ? entry.label : entry,\n }));\n}\n\n/**\n * Auto-generates Select.Option elements from items prop.\n * Only used when children are not explicitly provided.\n * Filters out null values (typically used for placeholders).\n */\nfunction renderOptionsFromItems<T>(\n items:\n | Record<string, SelectItemValue>\n | ReadonlyArray<{ label: ReactNode; value: T }>,\n): ReactNode {\n const normalizedItems = normalizeItems(items);\n\n // Build a lookup for disabled metadata from object-map items.\n // Object-map keys are always strings (Record<string, ...>), so the lookup\n // uses string keys. The array form ({ label, value }[]) does not support\n // descriptors — consumers should use the children API for that case.\n const disabledLookup = new Map<string, { disabled?: boolean }>();\n if (!Array.isArray(items)) {\n for (const [key, entry] of Object.entries(items)) {\n if (isItemDescriptor(entry)) {\n disabledLookup.set(key, { disabled: entry.disabled });\n }\n }\n }\n\n // Filter out null values and render options\n return normalizedItems\n .filter((item) => item.value !== null)\n .map((item, index) => {\n const key =\n typeof item.value === \"string\" ? item.value : `option-${index}`;\n // When items is an object-map, value is always a string key from\n // Object.entries. When items is an array, disabledLookup is empty.\n const meta =\n typeof item.value === \"string\"\n ? disabledLookup.get(item.value)\n : undefined;\n\n return (\n <Option key={key} value={item.value} disabled={meta?.disabled}>\n {item.label}\n </Option>\n );\n });\n}\n\ntype SelectPropsGeneric<T, Multiple extends boolean | undefined = false> = Omit<\n SelectBase.Root.Props<T, Multiple>,\n \"items\"\n> &\n KumoSelectVariantsProps & {\n multiple?: Multiple;\n renderValue?: (value: Multiple extends true ? T[] : T) => ReactNode;\n className?: string;\n /**\n * Data structure of items rendered in the popup.\n * Accepts a plain object map (`{ key: \"Label\" }`) or an array of `{ label, value }`.\n *\n * Object-map values can be a `ReactNode` (backward-compatible) **or** a\n * `SelectItemDescriptor` for extra metadata:\n *\n * ```tsx\n * items={{\n * apple: \"Apple\",\n * banana: { label: \"Banana\", disabled: true, disabledReason: \"Out of season\" },\n * }}\n * ```\n */\n items?:\n | Record<string, SelectItemValue>\n | ReadonlyArray<{ label: ReactNode; value: T }>;\n /**\n * Label content for the select.\n * When provided, enables the Field wrapper with a visible label.\n * For accessibility without a visible label, use `aria-label` instead.\n */\n label?: ReactNode;\n /**\n * @deprecated Use `aria-label` for hidden labels instead of `label` + `hideLabel={true}`.\n * When `label` is provided without `hideLabel`, the label is now visible by default (matching Input behavior).\n * This prop will be removed in a future version.\n */\n hideLabel?: boolean;\n placeholder?: string;\n loading?: boolean;\n /** Tooltip content to display next to the label via an info icon */\n labelTooltip?: ReactNode;\n /** Helper text displayed below the select */\n description?: ReactNode;\n /** Error message or validation error object */\n error?: string | { message: ReactNode; match: FieldErrorMatch };\n /**\n * Container element for the portal. Use this to render the select inside\n * a Shadow DOM or custom container. Overrides `KumoPortalProvider` context.\n * @default document.body (or KumoPortalProvider container if set)\n */\n container?: PortalContainer;\n };\n\n/**\n * Select component props.\n *\n * **Accessible Name Required:** Select should have one of:\n * 1. `label` prop (recommended) - enables Field wrapper with visible label\n * 2. `aria-label` - for selects without visible label (accessibility-only)\n * 3. `aria-labelledby` - for custom label association\n *\n * @example\n * ```tsx\n * // With visible label (recommended)\n * <Select label=\"Country\" onValueChange={setValue}>\n * <Select.Option value=\"us\">United States</Select.Option>\n * <Select.Option value=\"uk\">United Kingdom</Select.Option>\n * </Select>\n *\n * // Without visible label (use aria-label for accessibility)\n * <Select aria-label=\"Select a country\" onValueChange={setValue}>\n * <Select.Option value=\"us\">United States</Select.Option>\n * </Select>\n * ```\n */\nexport interface SelectProps {\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n /**\n * Label content for the select.\n * When provided, enables the Field wrapper with a visible label above the select.\n * For accessibility without a visible label, use `aria-label` instead.\n */\n label?: ReactNode;\n /**\n * @deprecated Use `aria-label` for hidden labels instead of `label` + `hideLabel={true}`.\n * When `label` is provided without `hideLabel`, the label is now visible by default (matching Input behavior).\n * This prop will be removed in a future version.\n */\n hideLabel?: boolean;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /** When `true`, shows a skeleton loader in place of the selected value. */\n loading?: boolean;\n /** Whether the select is disabled. */\n disabled?: boolean;\n /** Whether the select is required. When `false`, shows \"(optional)\" text. */\n required?: boolean;\n /** Tooltip content displayed next to the label via an info icon. */\n labelTooltip?: ReactNode;\n /** Currently selected value (controlled mode). */\n value?: unknown;\n /** Initial value for uncontrolled mode. */\n defaultValue?: unknown;\n /** Callback fired when the selected value changes. */\n onValueChange?: (value: unknown) => void;\n /** Enable multi-select mode. */\n multiple?: boolean;\n /** `Select.Option` elements to render in the dropdown. */\n children?: ReactNode;\n /** Helper text displayed below the select. */\n description?: ReactNode;\n /** Error message string or validation error object with `match` key. */\n error?: string | { message: ReactNode; match: FieldErrorMatch };\n}\n\n/**\n * Select.Option component props.\n */\nexport interface SelectOptionProps {\n /** The option content. */\n children: ReactNode;\n /** The value associated with this option. */\n value: unknown;\n /** When `true`, the option cannot be selected. */\n disabled?: boolean;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n}\n\n/**\n * Dropdown for selecting a value from a list of options.\n * Wraps Base UI Select with Kumo styling and optional Field integration.\n *\n * @example\n * ```tsx\n * <Select label=\"Fruit\" onValueChange={setFruit}>\n * <Select.Option value=\"apple\">Apple</Select.Option>\n * <Select.Option value=\"banana\">Banana</Select.Option>\n * </Select>\n * ```\n */\nexport function Select<T, Multiple extends boolean | undefined = false>({\n children,\n className,\n renderValue,\n label,\n hideLabel,\n placeholder,\n loading,\n labelTooltip,\n description,\n error,\n required,\n container: containerProp,\n ...props\n}: SelectPropsGeneric<T, Multiple> & { required?: boolean }) {\n const labelId = useId();\n const contextContainer = usePortalContainer();\n const container = containerProp ?? contextContainer ?? undefined;\n const propLookup = props as Record<string, unknown>;\n const ariaLabel = propLookup[\"aria-label\"] as string | undefined;\n const ariaLabelledby = propLookup[\"aria-labelledby\"] as string | undefined;\n // For aria-label, use string label or placeholder (ReactNode labels can't be used for aria-label)\n const fallbackLabel = typeof label === \"string\" ? label : placeholder;\n\n // Deprecation warning for hideLabel\n if (process.env.NODE_ENV !== \"production\" && hideLabel !== undefined) {\n console.warn(\n \"[Kumo Select]: `hideLabel` is deprecated. For hidden labels, use `aria-label` instead of `label` + `hideLabel={true}`.\\n\" +\n \" Migration:\\n\" +\n ' - For visible labels: <Select label=\"Country\" /> (hideLabel no longer needed)\\n' +\n ' - For hidden labels: <Select aria-label=\"Select a country\" /> (remove label and hideLabel)',\n );\n }\n\n // New behavior: label presence determines Field wrapper visibility (like Input)\n // hideLabel is only respected for backward compatibility when explicitly set to true\n const useFieldWrapper = label && hideLabel !== true;\n const triggerLabelledBy = useFieldWrapper\n ? undefined\n : (ariaLabelledby ?? (label ? labelId : undefined));\n const triggerAriaLabel =\n ariaLabel ?? (!triggerLabelledBy ? fallbackLabel : undefined);\n\n // Normalize items to array format for Base UI compatibility\n // This fixes placeholder not showing with object map items\n const normalizedItems = props.items ? normalizeItems(props.items) : undefined;\n\n // Auto-render children from items if children not provided\n const renderedChildren =\n children ?? (props.items ? renderOptionsFromItems(props.items) : null);\n\n // Exclude Kumo-extended `items` from Base UI spread — we pass `normalizedItems` instead\n const { items: _items, ...baseProps } = props;\n\n const selectControl = (\n <SelectBase.Root\n {...baseProps}\n items={normalizedItems}\n disabled={loading || props.disabled}\n >\n <SelectBase.Trigger\n className={cn(\n buttonVariants(),\n \"justify-between font-normal\",\n \"focus:opacity-100 focus-visible:ring-1 focus-visible:ring-kumo-hairline *:in-focus:opacity-100\",\n props.disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n aria-label={triggerAriaLabel}\n aria-labelledby={triggerLabelledBy}\n >\n {loading ? (\n <SkeletonLine className=\"w-32\" />\n ) : (\n <SelectBase.Value\n placeholder={placeholder}\n className=\"min-w-0 truncate\"\n >\n {renderValue}\n </SelectBase.Value>\n )}\n <SelectBase.Icon className=\"flex shrink-0 items-center\">\n <CaretUpDownIcon />\n </SelectBase.Icon>\n </SelectBase.Trigger>\n <SelectBase.Portal container={container}>\n <SelectBase.Positioner>\n <SelectBase.Popup\n className={cn(\n \"flex flex-col\",\n \"max-h-[var(--available-height)] bg-kumo-base text-kumo-default\",\n \"rounded-lg shadow-lg ring ring-kumo-hairline\",\n \"min-w-[calc(var(--anchor-width)+3px)] py-1.5\",\n )}\n >\n <SelectBase.List\n className={cn(\n \"min-h-0 flex-1 overflow-y-auto overscroll-none scroll-pt-2 scroll-pb-2\",\n )}\n >\n {renderedChildren}\n </SelectBase.List>\n </SelectBase.Popup>\n </SelectBase.Positioner>\n </SelectBase.Portal>\n </SelectBase.Root>\n );\n\n // Use Field wrapper when label is provided and not hidden\n if (useFieldWrapper) {\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 {selectControl}\n </Field>\n );\n }\n\n // Render with standalone label when label is hidden (sr-only)\n // Still show description/error for accessibility and UX\n const normalizedError = error\n ? typeof error === \"string\"\n ? { message: error, match: true as const }\n : error\n : undefined;\n\n return (\n <div className=\"grid gap-2\">\n {label && (\n <span id={labelId} className=\"sr-only\">\n {label}\n </span>\n )}\n {selectControl}\n {normalizedError ? (\n <span className=\"text-sm text-kumo-danger\">\n {normalizedError.message}\n </span>\n ) : (\n description && (\n <span className=\"text-sm leading-snug text-kumo-subtle\">\n {description}\n </span>\n )\n )}\n </div>\n );\n}\n\ntype OptionProps<T> = {\n children: ReactNode;\n value: T;\n /** When `true`, the option cannot be selected. */\n disabled?: boolean;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n};\n\nfunction Option<T>({ children, value, disabled, className }: OptionProps<T>) {\n return (\n <SelectBase.Item\n value={value}\n disabled={disabled}\n className={cn(\n \"group mx-1.5 flex cursor-pointer items-center justify-between gap-2 rounded px-2 py-1.5 text-base data-highlighted:bg-kumo-tint\",\n \"data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\n className,\n )}\n >\n <SelectBase.ItemText>{children}</SelectBase.ItemText>\n <SelectBase.ItemIndicator>\n <CheckIcon />\n </SelectBase.ItemIndicator>\n </SelectBase.Item>\n );\n}\n\n// --- Select.Group ---\n\ntype GroupProps = {\n children: ReactNode;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n};\n\n/**\n * Groups related options together with an accessible `role=\"group\"`.\n * Use with `Select.GroupLabel` to provide a visible heading for the group.\n *\n * @example\n * ```tsx\n * <Select.Group>\n * <Select.GroupLabel>Fruits</Select.GroupLabel>\n * <Select.Option value=\"apple\">Apple</Select.Option>\n * </Select.Group>\n * ```\n */\nconst Group = forwardRef<HTMLDivElement, GroupProps>(\n ({ children, className }, ref) => (\n <SelectBase.Group ref={ref} className={cn(className)}>\n {children}\n </SelectBase.Group>\n ),\n);\nGroup.displayName = \"Select.Group\";\n\n// --- Select.GroupLabel ---\n\ntype GroupLabelProps = {\n children: ReactNode;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n};\n\n/**\n * A visible heading for a `Select.Group`.\n * Automatically associated with its parent group for accessibility.\n *\n * @example\n * ```tsx\n * <Select.Group>\n * <Select.GroupLabel>Available</Select.GroupLabel>\n * <Select.Option value=\"a\">Option A</Select.Option>\n * </Select.Group>\n * ```\n */\nconst GroupLabel = forwardRef<HTMLDivElement, GroupLabelProps>(\n ({ children, className }, ref) => (\n <SelectBase.GroupLabel\n ref={ref}\n className={cn(\n \"px-3.5 py-1.5 text-sm font-semibold text-kumo-subtle\",\n className,\n )}\n >\n {children}\n </SelectBase.GroupLabel>\n ),\n);\nGroupLabel.displayName = \"Select.GroupLabel\";\n\n// --- Select.Separator ---\n\ntype SeparatorProps = {\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n};\n\n/**\n * A visual divider between option groups.\n *\n * @example\n * ```tsx\n * <Select.Option value=\"a\">Option A</Select.Option>\n * <Select.Separator />\n * <Select.Option value=\"b\">Option B</Select.Option>\n * ```\n */\nconst Separator = forwardRef<HTMLDivElement, SeparatorProps>(\n ({ className }, ref) => (\n <SelectBase.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-kumo-line\", className)}\n />\n ),\n);\nSeparator.displayName = \"Select.Separator\";\n\n// --- Assign sub-components ---\n\nSelect.Option = Option;\nSelect.Group = Group;\nSelect.GroupLabel = GroupLabel;\nSelect.Separator = Separator;\n\n(Select.Option as { displayName?: string }).displayName = \"Select.Option\";\n"],"names":["isItemDescriptor","value","candidate","normalizeItems","items","key","entry","renderOptionsFromItems","normalizedItems","disabledLookup","item","index","meta","jsx","Option","Select","children","className","renderValue","label","hideLabel","placeholder","loading","labelTooltip","description","error","required","containerProp","props","labelId","useId","contextContainer","usePortalContainer","container","propLookup","ariaLabel","ariaLabelledby","fallbackLabel","useFieldWrapper","triggerLabelledBy","triggerAriaLabel","renderedChildren","_items","baseProps","selectControl","jsxs","SelectBase.Root","SelectBase.Trigger","cn","buttonVariants","SkeletonLine","SelectBase.Value","SelectBase.Icon","CaretUpDownIcon","SelectBase.Portal","SelectBase.Positioner","SelectBase.Popup","SelectBase.List","Field","normalizedError","disabled","SelectBase.Item","SelectBase.ItemText","SelectBase.ItemIndicator","CheckIcon","Group","forwardRef","ref","SelectBase.Group","GroupLabel","SelectBase.GroupLabel","Separator","SelectBase.Separator"],"mappings":";;;;;;;;;;AAmFA,SAASA,EACPC,GAC+B;AAM/B,MALIA,KAAU,QACV,OAAOA,KAAU,YAAY,MAAM,QAAQA,CAAK,KAEhD,cAAeA,KAEfA,aAAiB,QAAS,QAAO;AAErC,QAAMC,IAAYD;AAClB,SAAO,WAAWC,KAAaA,EAAU,UAAU;AACrD;AAOA,SAASC,EACPC,GAG+C;AAC/C,SAAI,MAAM,QAAQA,CAAK,IACdA,IAGF,OAAO,QAAQA,CAAK,EAAE,IAAI,CAAC,CAACC,GAAKC,CAAK,OAAO;AAAA,IAClD,OAAOD;AAAA,IACP,OAAOL,EAAiBM,CAAK,IAAIA,EAAM,QAAQA;AAAA,EAAA,EAC/C;AACJ;AAOA,SAASC,GACPH,GAGW;AACX,QAAMI,IAAkBL,EAAeC,CAAK,GAMtCK,wBAAqB,IAAA;AAC3B,MAAI,CAAC,MAAM,QAAQL,CAAK;AACtB,eAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAAQF,CAAK;AAC7C,MAAIJ,EAAiBM,CAAK,KACxBG,EAAe,IAAIJ,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MACxB,gBAAAtD;AAAA,IAACyD;AAAAA,IAAA;AAAA,MACC,KAAAH;AAAA,MACA,WAAWnB;AAAA,QACT;AAAA,QACA/B;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;AACAqD,EAAW,cAAc;AAmBzB,MAAME,IAAYL;AAAA,EAChB,CAAC,EAAE,WAAAjD,KAAakD,MACd,gBAAAtD;AAAA,IAAC2D;AAAAA,IAAA;AAAA,MACC,KAAAL;AAAA,MACA,WAAWnB,EAAG,gCAAgC/B,CAAS;AAAA,IAAA;AAAA,EAAA;AAG7D;AACAsD,EAAU,cAAc;AAIxBxD,EAAO,SAASD;AAChBC,EAAO,QAAQkD;AACflD,EAAO,aAAasD;AACpBtD,EAAO,YAAYwD;AAElBxD,EAAO,OAAoC,cAAc;"}
|
package/dist/chunks/{sensitive-input-kznmknpp5h1grc6k.js → sensitive-input-hd4tpqkzifad1yca.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as y, Fragment as ce, jsx as
|
|
2
|
+
import { jsxs as y, Fragment as ce, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { EyeSlash as ue, Eye as pe } from "@phosphor-icons/react";
|
|
4
4
|
import { forwardRef as de, useState as C, useRef as N, useId as T, useCallback as c, useEffect as fe } from "react";
|
|
5
5
|
import { c as p } from "./cn-ct4n7r74mh8y0f48.js";
|
|
6
|
-
import { K as me, i as he } from "./input-
|
|
7
|
-
import { F as ve } from "./field-
|
|
8
|
-
import { I as ge } from "./vendor-base-ui-
|
|
6
|
+
import { K as me, i as he } from "./input-h48k3uagzrgb98au.js";
|
|
7
|
+
import { F as ve } from "./field-krp6z6vfbkrvufz2.js";
|
|
8
|
+
import { I as ge } from "./vendor-base-ui-k7bzesq81ie36nya.js";
|
|
9
9
|
const Te = me, M = {
|
|
10
10
|
size: "base",
|
|
11
11
|
variant: "default"
|
|
@@ -18,7 +18,7 @@ const Te = me, M = {
|
|
|
18
18
|
onCopy: k,
|
|
19
19
|
size: t = M.size,
|
|
20
20
|
variant: j = M.variant,
|
|
21
|
-
disabled:
|
|
21
|
+
disabled: a = !1,
|
|
22
22
|
readOnly: d = !1,
|
|
23
23
|
id: $,
|
|
24
24
|
autoComplete: H = "off",
|
|
@@ -73,7 +73,7 @@ const Te = me, M = {
|
|
|
73
73
|
A.current !== o && (A.current = o, !o && n === "masked" && l("empty"));
|
|
74
74
|
const te = c(
|
|
75
75
|
(e) => {
|
|
76
|
-
if (!
|
|
76
|
+
if (!a) {
|
|
77
77
|
if (u.current) {
|
|
78
78
|
const i = u.current.getBoundingClientRect();
|
|
79
79
|
if (!(e.clientX >= i.left && e.clientX <= i.right && e.clientY >= i.top && e.clientY <= i.bottom)) return;
|
|
@@ -81,7 +81,7 @@ const Te = me, M = {
|
|
|
81
81
|
n === "masked" && o && (l("revealed"), d || setTimeout(() => I.current?.focus(), 0));
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
|
-
[n, o,
|
|
84
|
+
[n, o, a, d]
|
|
85
85
|
), ne = c(
|
|
86
86
|
(e) => {
|
|
87
87
|
e.stopPropagation(), n === "revealed" ? l("masked") : n === "empty" && o && l("revealed");
|
|
@@ -98,26 +98,26 @@ const Te = me, M = {
|
|
|
98
98
|
u.current && e.relatedTarget instanceof Node && u.current.contains(e.relatedTarget) || o && l("masked");
|
|
99
99
|
},
|
|
100
100
|
[o]
|
|
101
|
-
),
|
|
101
|
+
), ae = c(
|
|
102
102
|
(e) => {
|
|
103
|
-
|
|
103
|
+
a || n === "masked" && o && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l("revealed"), d || setTimeout(() => I.current?.focus(), 0));
|
|
104
104
|
},
|
|
105
|
-
[n, o,
|
|
106
|
-
),
|
|
105
|
+
[n, o, a, d]
|
|
106
|
+
), re = c(
|
|
107
107
|
(e) => {
|
|
108
108
|
n === "revealed" && e.key === "Escape" && (l("masked"), setTimeout(() => u.current?.focus(), 0));
|
|
109
109
|
},
|
|
110
110
|
[n]
|
|
111
|
-
), s = n === "masked" && o, _ = !
|
|
111
|
+
), s = n === "masked" && o, _ = !a && (n === "revealed" || n === "empty" && o), se = t === "xs" || t === "sm" ? "size-3" : "size-4", D = p(
|
|
112
112
|
he({ size: t, variant: j, parentFocusIndicator: !0 }),
|
|
113
113
|
"group/container relative flex w-full items-center",
|
|
114
114
|
// Show browser-native focus outline on container when child input is focused
|
|
115
115
|
"focus-within:outline focus-within:outline-2 focus-within:outline-[-webkit-focus-ring-color]",
|
|
116
|
-
s && !
|
|
117
|
-
|
|
116
|
+
s && !a && "cursor-pointer",
|
|
117
|
+
a && "cursor-not-allowed",
|
|
118
118
|
L
|
|
119
119
|
), P = /* @__PURE__ */ y(ce, { children: [
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ r(
|
|
121
121
|
ge,
|
|
122
122
|
{
|
|
123
123
|
ref: z,
|
|
@@ -126,8 +126,8 @@ const Te = me, M = {
|
|
|
126
126
|
value: m,
|
|
127
127
|
onChange: oe,
|
|
128
128
|
onBlur: ie,
|
|
129
|
-
onKeyDown:
|
|
130
|
-
disabled:
|
|
129
|
+
onKeyDown: re,
|
|
130
|
+
disabled: a,
|
|
131
131
|
readOnly: d || s,
|
|
132
132
|
autoComplete: H,
|
|
133
133
|
tabIndex: s ? -1 : 0,
|
|
@@ -143,7 +143,7 @@ const Te = me, M = {
|
|
|
143
143
|
...q
|
|
144
144
|
}
|
|
145
145
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ r(
|
|
147
147
|
"span",
|
|
148
148
|
{
|
|
149
149
|
className: p(
|
|
@@ -169,20 +169,20 @@ const Te = me, M = {
|
|
|
169
169
|
),
|
|
170
170
|
"aria-hidden": "true",
|
|
171
171
|
children: /* @__PURE__ */ y("span", { className: "relative", children: [
|
|
172
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ r(
|
|
173
173
|
"span",
|
|
174
174
|
{
|
|
175
175
|
className: p(
|
|
176
|
-
s && !
|
|
176
|
+
s && !a && "group-focus-within/container:invisible group-hover/mask:invisible"
|
|
177
177
|
),
|
|
178
178
|
children: "••••••••"
|
|
179
179
|
}
|
|
180
180
|
),
|
|
181
|
-
s && !
|
|
181
|
+
s && !a && /* @__PURE__ */ r("span", { className: "invisible absolute left-0 top-0 whitespace-nowrap text-kumo-subtle group-focus-within/container:visible group-hover/mask:visible", children: "Click to reveal" })
|
|
182
182
|
] })
|
|
183
183
|
}
|
|
184
184
|
),
|
|
185
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ r(
|
|
186
186
|
"button",
|
|
187
187
|
{
|
|
188
188
|
type: "button",
|
|
@@ -191,7 +191,7 @@ const Te = me, M = {
|
|
|
191
191
|
"aria-label": n === "revealed" ? "Hide value" : "Reveal value",
|
|
192
192
|
tabIndex: _ ? 0 : -1,
|
|
193
193
|
className: p(
|
|
194
|
-
"absolute top-1/2 right-0 -translate-y-1/2 cursor-pointer text-kumo-subtle hover:text-kumo-default focus:text-kumo-default focus-visible:ring-1 focus-visible:ring-kumo-
|
|
194
|
+
"absolute top-1/2 right-0 -translate-y-1/2 cursor-pointer text-kumo-subtle hover:text-kumo-default focus:text-kumo-default focus-visible:ring-1 focus-visible:ring-kumo-hairline focus-visible:rounded-sm",
|
|
195
195
|
// Defensive styles to prevent global CSS pollution (e.g., button { background: gray })
|
|
196
196
|
"bg-transparent border-none shadow-none p-0 m-0 h-auto min-h-0 inline-flex items-center justify-center",
|
|
197
197
|
// Match right padding from inputVariants
|
|
@@ -202,10 +202,10 @@ const Te = me, M = {
|
|
|
202
202
|
se,
|
|
203
203
|
!_ && "pointer-events-none opacity-0"
|
|
204
204
|
),
|
|
205
|
-
children: n === "revealed" ? /* @__PURE__ */
|
|
205
|
+
children: n === "revealed" ? /* @__PURE__ */ r(ue, { className: "size-full" }) : /* @__PURE__ */ r(pe, { className: "size-full" })
|
|
206
206
|
}
|
|
207
207
|
),
|
|
208
|
-
o && !
|
|
208
|
+
o && !a && /* @__PURE__ */ r(
|
|
209
209
|
"button",
|
|
210
210
|
{
|
|
211
211
|
type: "button",
|
|
@@ -213,7 +213,7 @@ const Te = me, M = {
|
|
|
213
213
|
onKeyDown: (e) => e.stopPropagation(),
|
|
214
214
|
"aria-label": h ? "Copied" : "Copy to clipboard",
|
|
215
215
|
className: p(
|
|
216
|
-
"absolute -top-px right-2 -translate-y-full cursor-pointer rounded-t-md bg-kumo-brand px-2 py-0.5 text-xs text-white opacity-0 transition-opacity group-focus-within/container:opacity-100 group-hover/container:opacity-100 hover:brightness-120 focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-kumo-
|
|
216
|
+
"absolute -top-px right-2 -translate-y-full cursor-pointer rounded-t-md bg-kumo-brand px-2 py-0.5 text-xs text-white opacity-0 transition-opacity group-focus-within/container:opacity-100 group-hover/container:opacity-100 hover:brightness-120 focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-kumo-hairline",
|
|
217
217
|
// Defensive styles to prevent global CSS pollution
|
|
218
218
|
"border-none shadow-none m-0 h-auto min-h-0"
|
|
219
219
|
),
|
|
@@ -221,28 +221,28 @@ const Te = me, M = {
|
|
|
221
221
|
}
|
|
222
222
|
)
|
|
223
223
|
] }), U = /* @__PURE__ */ y("div", { children: [
|
|
224
|
-
s ? /* @__PURE__ */
|
|
224
|
+
s ? /* @__PURE__ */ r(
|
|
225
225
|
"div",
|
|
226
226
|
{
|
|
227
227
|
ref: u,
|
|
228
228
|
role: "button",
|
|
229
|
-
tabIndex:
|
|
229
|
+
tabIndex: a ? -1 : 0,
|
|
230
230
|
className: D,
|
|
231
231
|
onClick: te,
|
|
232
|
-
onKeyDown:
|
|
232
|
+
onKeyDown: ae,
|
|
233
233
|
"aria-label": `${G}, masked.`,
|
|
234
234
|
"aria-describedby": `${K} ${V}`,
|
|
235
|
-
"aria-disabled":
|
|
235
|
+
"aria-disabled": a,
|
|
236
236
|
children: P
|
|
237
237
|
}
|
|
238
|
-
) : /* @__PURE__ */
|
|
239
|
-
s && /* @__PURE__ */
|
|
238
|
+
) : /* @__PURE__ */ r("div", { ref: u, className: D, children: P }),
|
|
239
|
+
s && /* @__PURE__ */ r("span", { id: K, className: "sr-only", children: "Click or press Enter to reveal." }),
|
|
240
240
|
/* @__PURE__ */ y("span", { id: V, className: "sr-only", "aria-live": "polite", children: [
|
|
241
241
|
n === "masked" && o && "Value hidden",
|
|
242
242
|
h && "Copied to clipboard"
|
|
243
243
|
] })
|
|
244
244
|
] });
|
|
245
|
-
return g ? /* @__PURE__ */
|
|
245
|
+
return g ? /* @__PURE__ */ r(
|
|
246
246
|
ve,
|
|
247
247
|
{
|
|
248
248
|
label: g,
|
|
@@ -261,4 +261,4 @@ export {
|
|
|
261
261
|
be as S,
|
|
262
262
|
M as a
|
|
263
263
|
};
|
|
264
|
-
//# sourceMappingURL=sensitive-input-
|
|
264
|
+
//# sourceMappingURL=sensitive-input-hd4tpqkzifad1yca.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitive-input-kznmknpp5h1grc6k.js","sources":["../../src/components/sensitive-input/sensitive-input.tsx"],"sourcesContent":["import { Eye, EyeSlash } from \"@phosphor-icons/react\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport {\n inputVariants,\n KUMO_INPUT_VARIANTS,\n type KumoInputSize,\n type KumoInputVariant,\n} from \"../input/input\";\nimport { Field, type FieldErrorMatch } from \"../field/field\";\n\nexport const KUMO_SENSITIVE_INPUT_VARIANTS = KUMO_INPUT_VARIANTS;\n\nexport const KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS = {\n size: \"base\",\n variant: \"default\",\n} as const;\n\ntype Mode = \"masked\" | \"revealed\" | \"empty\";\n\n/**\n * SensitiveInput component props.\n *\n * @example\n * ```tsx\n * <SensitiveInput label=\"API Key\" defaultValue=\"sk_live_abc123xyz789\" />\n * <SensitiveInput label=\"Secret\" value={secret} onValueChange={setSecret} />\n * ```\n */\nexport interface SensitiveInputProps\n extends Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"size\" | \"type\" | \"value\" | \"defaultValue\"\n > {\n /** Controlled value */\n value?: string;\n /** Uncontrolled default value */\n defaultValue?: string;\n /** Simplified change handler receiving just the value */\n onValueChange?: (value: string) => void;\n /** Callback fired after value is copied to clipboard */\n onCopy?: () => void;\n /**\n * Size of the input.\n * - `\"xs\"` — Extra small for compact UIs\n * - `\"sm\"` — Small for secondary fields\n * - `\"base\"` — Default input size\n * - `\"lg\"` — Large for prominent fields\n * @default \"base\"\n */\n size?: KumoInputSize;\n /**\n * Style variant of the input.\n * - `\"default\"` — Default input appearance\n * - `\"error\"` — Error state for validation failures\n * @default \"default\"\n */\n variant?: KumoInputVariant;\n /** Label content for the input (enables Field wrapper and sets masked state label) - 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\n/**\n * Password/secret input that masks its value by default and reveals on click.\n * Includes a built-in copy-to-clipboard button on hover.\n *\n * @example\n * ```tsx\n * <SensitiveInput label=\"API Key\" defaultValue=\"sk_live_abc123xyz789\" />\n * ```\n */\nexport const SensitiveInput = forwardRef<HTMLInputElement, SensitiveInputProps>(\n (\n {\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onValueChange,\n onCopy,\n size = KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS.size,\n variant = KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS.variant,\n disabled = false,\n readOnly = false,\n id,\n autoComplete = \"off\",\n className,\n label,\n labelTooltip,\n description,\n error,\n required,\n ...inputProps\n },\n ref,\n ) => {\n // For aria-label, only use string labels (ReactNode labels can't be used for aria-label)\n const ariaLabelFallback =\n typeof label === \"string\" ? label : \"Sensitive value\";\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const value = isControlled ? controlledValue : internalValue;\n const hasValue = value.length > 0;\n\n const [mode, setMode] = useState<Mode>(() =>\n hasValue ? \"masked\" : \"empty\",\n );\n\n const [copied, setCopied] = useState(false);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const liveRegionId = useId();\n const generatedId = useId();\n const inputId = id ?? generatedId;\n const maskedInstructionId = useId();\n\n const mergedRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n // Reset copied state after 2 seconds\n useEffect(() => {\n if (copied) {\n const timeoutId = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timeoutId);\n }\n }, [copied]);\n\n const copyToClipboard = useCallback(\n async (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n try {\n if (\n typeof navigator !== \"undefined\" &&\n navigator.clipboard &&\n typeof navigator.clipboard.writeText === \"function\"\n ) {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n onCopy?.();\n return;\n }\n } catch {\n // Fall through to manual fallback\n }\n\n if (typeof document !== \"undefined\") {\n const textarea = document.createElement(\"textarea\");\n textarea.value = value;\n textarea.setAttribute(\"readonly\", \"\");\n textarea.style.position = \"absolute\";\n textarea.style.left = \"-9999px\";\n document.body.appendChild(textarea);\n const selection = document.getSelection();\n const previousRange = selection?.rangeCount\n ? selection.getRangeAt(0)\n : null;\n textarea.select();\n try {\n document.execCommand(\"copy\");\n setCopied(true);\n onCopy?.();\n } catch (error) {\n console.warn(\"Clipboard copy failed\", error);\n } finally {\n document.body.removeChild(textarea);\n if (previousRange) {\n selection?.removeAllRanges();\n selection?.addRange(previousRange);\n }\n }\n }\n },\n [value, onCopy],\n );\n\n // Sync mode when value changes externally\n const prevHasValueRef = useRef(hasValue);\n if (prevHasValueRef.current !== hasValue) {\n prevHasValueRef.current = hasValue;\n if (!hasValue && mode === \"masked\") {\n setMode(\"empty\");\n }\n }\n\n const handleContainerClick = useCallback(\n (e: React.MouseEvent) => {\n if (disabled) return;\n // Ignore clicks that originated from outside (e.g., label click focusing input)\n // Label clicks trigger a click on the input, but the click coordinates are outside the container\n if (containerRef.current) {\n const rect = containerRef.current.getBoundingClientRect();\n const isClickInsideContainer =\n e.clientX >= rect.left &&\n e.clientX <= rect.right &&\n e.clientY >= rect.top &&\n e.clientY <= rect.bottom;\n if (!isClickInsideContainer) return;\n }\n if (mode === \"masked\" && hasValue) {\n setMode(\"revealed\");\n if (!readOnly) {\n setTimeout(() => inputRef.current?.focus(), 0);\n }\n }\n },\n [mode, hasValue, disabled, readOnly],\n );\n\n const handleToggleVisibility = useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n if (mode === \"revealed\") {\n setMode(\"masked\");\n } else if (mode === \"empty\" && hasValue) {\n setMode(\"revealed\");\n }\n },\n [mode, hasValue],\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n if (!isControlled) {\n setInternalValue(newValue);\n }\n // When typing into an empty field, switch to revealed mode\n // so the input shows as type=\"text\" instead of type=\"password\"\n if (mode === \"empty\" && newValue.length > 0) {\n setMode(\"revealed\");\n }\n onChange?.(e);\n onValueChange?.(newValue);\n },\n [isControlled, onChange, onValueChange, mode],\n );\n\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n // Don't mask if focus is moving to a button inside the container (copy/eye buttons)\n if (\n containerRef.current &&\n e.relatedTarget instanceof Node &&\n containerRef.current.contains(e.relatedTarget)\n ) {\n return;\n }\n if (hasValue) {\n setMode(\"masked\");\n }\n },\n [hasValue],\n );\n\n const handleContainerKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n if (mode === \"masked\" && hasValue) {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n setMode(\"revealed\");\n if (!readOnly) {\n setTimeout(() => inputRef.current?.focus(), 0);\n }\n }\n }\n },\n [mode, hasValue, disabled, readOnly],\n );\n\n const handleInputKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (mode === \"revealed\" && e.key === \"Escape\") {\n setMode(\"masked\");\n // Move focus to container to avoid focus trap (input becomes tabIndex={-1})\n setTimeout(() => containerRef.current?.focus(), 0);\n }\n },\n [mode],\n );\n\n const isMaskedWithValue = mode === \"masked\" && hasValue;\n const showEyeButton =\n !disabled && (mode === \"revealed\" || (mode === \"empty\" && hasValue));\n\n // Icon sizes matching input sizes\n const iconSize = size === \"xs\" || size === \"sm\" ? \"size-3\" : \"size-4\";\n\n const containerClassName = cn(\n inputVariants({ size, variant, parentFocusIndicator: true }),\n \"group/container relative flex w-full items-center\",\n // Show browser-native focus outline on container when child input is focused\n \"focus-within:outline focus-within:outline-2 focus-within:outline-[-webkit-focus-ring-color]\",\n isMaskedWithValue && !disabled && \"cursor-pointer\",\n disabled && \"cursor-not-allowed\",\n className,\n );\n\n const containerContent = (\n <>\n {/* Input - defines the width, always rendered */}\n <BaseInput\n ref={mergedRef}\n id={inputId}\n type={mode === \"revealed\" ? \"text\" : \"password\"}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onKeyDown={handleInputKeyDown}\n disabled={disabled}\n readOnly={readOnly || isMaskedWithValue}\n autoComplete={autoComplete}\n tabIndex={isMaskedWithValue ? -1 : 0}\n className={cn(\n \"w-full border-0 bg-transparent p-0 text-kumo-default ring-0 outline-none kumo-input-placeholder disabled:cursor-not-allowed disabled:text-kumo-subtle\",\n size === \"xs\" && \"pr-5\",\n size === \"sm\" && \"pr-6\",\n size === \"base\" && \"pr-8\",\n size === \"lg\" && \"pr-10\",\n isMaskedWithValue && \"pointer-events-none text-transparent\",\n )}\n aria-hidden={isMaskedWithValue}\n {...inputProps}\n />\n\n {/* Mask overlay - absolutely positioned, doesn't affect layout */}\n <span\n className={cn(\n \"pointer-events-none absolute inset-y-0 left-0 flex items-center overflow-hidden select-none\",\n // Match input pr padding (space for icon)\n size === \"xs\" && \"right-5\",\n size === \"sm\" && \"right-6\",\n size === \"base\" && \"right-8\",\n size === \"lg\" && \"right-10\",\n // Match the padding from inputVariants\n size === \"xs\" && \"px-1.5\",\n size === \"sm\" && \"px-2\",\n size === \"base\" && \"px-3\",\n size === \"lg\" && \"px-4\",\n // Hidden when not masked\n !isMaskedWithValue && \"invisible\",\n // When masked: enable pointer events\n isMaskedWithValue && \"pointer-events-auto\",\n // Text color - use text-kumo-default to contrast with bg-kumo-control input background\n \"text-kumo-default\",\n // Hover state - pure CSS, no React state (group for children)\n \"group/mask\",\n )}\n aria-hidden=\"true\"\n >\n {/* Both texts rendered, stacked. Visibility toggled on hover to prevent layout shift */}\n <span className=\"relative\">\n <span\n className={cn(\n isMaskedWithValue &&\n !disabled &&\n \"group-focus-within/container:invisible group-hover/mask:invisible\",\n )}\n >\n ••••••••\n </span>\n {isMaskedWithValue && !disabled && (\n <span className=\"invisible absolute left-0 top-0 whitespace-nowrap text-kumo-subtle group-focus-within/container:visible group-hover/mask:visible\">\n Click to reveal\n </span>\n )}\n </span>\n </span>\n\n {/* Eye button - absolutely positioned to the right */}\n <button\n type=\"button\"\n onClick={handleToggleVisibility}\n onKeyDown={(e) => e.stopPropagation()}\n aria-label={mode === \"revealed\" ? \"Hide value\" : \"Reveal value\"}\n tabIndex={showEyeButton ? 0 : -1}\n className={cn(\n \"absolute top-1/2 right-0 -translate-y-1/2 cursor-pointer text-kumo-subtle hover:text-kumo-default focus:text-kumo-default focus-visible:ring-1 focus-visible:ring-kumo-ring focus-visible:rounded-sm\",\n // Defensive styles to prevent global CSS pollution (e.g., button { background: gray })\n \"bg-transparent border-none shadow-none p-0 m-0 h-auto min-h-0 inline-flex items-center justify-center\",\n // Match right padding from inputVariants\n size === \"xs\" && \"right-1.5\",\n size === \"sm\" && \"right-2\",\n size === \"base\" && \"right-3\",\n size === \"lg\" && \"right-4\",\n iconSize,\n !showEyeButton && \"pointer-events-none opacity-0\",\n )}\n >\n {mode === \"revealed\" ? (\n <EyeSlash className=\"size-full\" />\n ) : (\n <Eye className=\"size-full\" />\n )}\n </button>\n\n {/* Copy tab - appears on hover/focus at top right (hidden when disabled) */}\n {hasValue && !disabled && (\n <button\n type=\"button\"\n onClick={copyToClipboard}\n onKeyDown={(e) => e.stopPropagation()}\n aria-label={copied ? \"Copied\" : \"Copy to clipboard\"}\n className={cn(\n \"absolute -top-px right-2 -translate-y-full cursor-pointer rounded-t-md bg-kumo-brand px-2 py-0.5 text-xs text-white opacity-0 transition-opacity group-focus-within/container:opacity-100 group-hover/container:opacity-100 hover:brightness-120 focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-kumo-ring\",\n // Defensive styles to prevent global CSS pollution\n \"border-none shadow-none m-0 h-auto min-h-0\",\n )}\n >\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n )}\n </>\n );\n\n const input = (\n <div>\n {isMaskedWithValue ? (\n <div\n ref={containerRef}\n // Cannot use <button> here because containerContent contains interactive button elements (Copy, Reveal).\n // Using role=\"button\" with proper keyboard handling instead.\n // oxlint-disable-next-line prefer-tag-over-role\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n className={containerClassName}\n onClick={handleContainerClick}\n onKeyDown={handleContainerKeyDown}\n aria-label={`${ariaLabelFallback}, masked.`}\n aria-describedby={`${maskedInstructionId} ${liveRegionId}`}\n aria-disabled={disabled}\n >\n {containerContent}\n </div>\n ) : (\n <div ref={containerRef} className={containerClassName}>\n {containerContent}\n </div>\n )}\n {isMaskedWithValue && (\n <span id={maskedInstructionId} className=\"sr-only\">\n Click or press Enter to reveal.\n </span>\n )}\n <span id={liveRegionId} className=\"sr-only\" aria-live=\"polite\">\n {mode === \"masked\" && hasValue && \"Value hidden\"}\n {copied && \"Copied to clipboard\"}\n </span>\n </div>\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);\n\nSensitiveInput.displayName = \"SensitiveInput\";\n"],"names":["KUMO_SENSITIVE_INPUT_VARIANTS","KUMO_INPUT_VARIANTS","KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS","SensitiveInput","forwardRef","controlledValue","defaultValue","onChange","onValueChange","onCopy","size","variant","disabled","readOnly","id","autoComplete","className","label","labelTooltip","description","error","required","inputProps","ref","ariaLabelFallback","isControlled","internalValue","setInternalValue","useState","value","hasValue","mode","setMode","copied","setCopied","inputRef","useRef","containerRef","liveRegionId","useId","generatedId","inputId","maskedInstructionId","mergedRef","useCallback","node","useEffect","timeoutId","copyToClipboard","textarea","selection","previousRange","prevHasValueRef","handleContainerClick","rect","handleToggleVisibility","handleChange","newValue","handleBlur","handleContainerKeyDown","handleInputKeyDown","isMaskedWithValue","showEyeButton","iconSize","containerClassName","cn","inputVariants","containerContent","jsxs","Fragment","jsx","BaseInput","EyeSlash","Eye","input","Field"],"mappings":";;;;;;;;AAqBO,MAAMA,KAAgCC,IAEhCC,IAAwC;AAAA,EACnD,MAAM;AAAA,EACN,SAAS;AACX,GA6DaC,KAAiBC;AAAA,EAC5B,CACE;AAAA,IACE,OAAOC;AAAA,IACP,cAAAC,IAAe;AAAA,IACf,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC,IAAOR,EAAsC;AAAA,IAC7C,SAAAS,IAAUT,EAAsC;AAAA,IAChD,UAAAU,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,IAAAC;AAAA,IACA,cAAAC,IAA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,GAGIS,sBACH,OAAA,EACE,UAAA;AAAA,MAAAb,IACC,gBAAAS;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAKjC;AAAA,UAIL,MAAK;AAAA,UACL,UAAUzB,IAAW,KAAK;AAAA,UAC1B,WAAWoD;AAAA,UACX,SAASX;AAAA,UACT,WAAWM;AAAA,UACX,cAAY,GAAGnC,CAAiB;AAAA,UAChC,oBAAkB,GAAGkB,CAAmB,IAAIJ,CAAY;AAAA,UACxD,iBAAe1B;AAAA,UAEd,UAAAuD;AAAA,QAAA;AAAA,MAAA,IAGH,gBAAAG,EAAC,OAAA,EAAI,KAAKjC,GAAc,WAAW2B,GAChC,UAAAG,GACH;AAAA,MAEDN,KACC,gBAAAS,EAAC,QAAA,EAAK,IAAI5B,GAAqB,WAAU,WAAU,UAAA,mCAEnD;AAAA,wBAED,QAAA,EAAK,IAAIJ,GAAc,WAAU,WAAU,aAAU,UACnD,UAAA;AAAA,QAAAP,MAAS,YAAYD,KAAY;AAAA,QACjCG,KAAU;AAAA,MAAA,EAAA,CACb;AAAA,IAAA,GACF;AAIF,WAAIhB,IAEA,gBAAAqD;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,OAAA1D;AAAA,QACA,UAAAI;AAAA,QACA,cAAAH;AAAA,QACA,aAAAC;AAAA,QACA,OACEC,IACI,OAAOA,KAAU,WACf,EAAE,SAASA,GAAO,OAAO,GAAA,IACzBA,IACF;AAAA,QAGL,UAAAsD;AAAA,MAAA;AAAA,IAAA,IAMAA;AAAA,EACT;AACF;AAEAvE,GAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"sensitive-input-hd4tpqkzifad1yca.js","sources":["../../src/components/sensitive-input/sensitive-input.tsx"],"sourcesContent":["import { Eye, EyeSlash } from \"@phosphor-icons/react\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport {\n inputVariants,\n KUMO_INPUT_VARIANTS,\n type KumoInputSize,\n type KumoInputVariant,\n} from \"../input/input\";\nimport { Field, type FieldErrorMatch } from \"../field/field\";\n\nexport const KUMO_SENSITIVE_INPUT_VARIANTS = KUMO_INPUT_VARIANTS;\n\nexport const KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS = {\n size: \"base\",\n variant: \"default\",\n} as const;\n\ntype Mode = \"masked\" | \"revealed\" | \"empty\";\n\n/**\n * SensitiveInput component props.\n *\n * @example\n * ```tsx\n * <SensitiveInput label=\"API Key\" defaultValue=\"sk_live_abc123xyz789\" />\n * <SensitiveInput label=\"Secret\" value={secret} onValueChange={setSecret} />\n * ```\n */\nexport interface SensitiveInputProps\n extends Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"size\" | \"type\" | \"value\" | \"defaultValue\"\n > {\n /** Controlled value */\n value?: string;\n /** Uncontrolled default value */\n defaultValue?: string;\n /** Simplified change handler receiving just the value */\n onValueChange?: (value: string) => void;\n /** Callback fired after value is copied to clipboard */\n onCopy?: () => void;\n /**\n * Size of the input.\n * - `\"xs\"` — Extra small for compact UIs\n * - `\"sm\"` — Small for secondary fields\n * - `\"base\"` — Default input size\n * - `\"lg\"` — Large for prominent fields\n * @default \"base\"\n */\n size?: KumoInputSize;\n /**\n * Style variant of the input.\n * - `\"default\"` — Default input appearance\n * - `\"error\"` — Error state for validation failures\n * @default \"default\"\n */\n variant?: KumoInputVariant;\n /** Label content for the input (enables Field wrapper and sets masked state label) - 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\n/**\n * Password/secret input that masks its value by default and reveals on click.\n * Includes a built-in copy-to-clipboard button on hover.\n *\n * @example\n * ```tsx\n * <SensitiveInput label=\"API Key\" defaultValue=\"sk_live_abc123xyz789\" />\n * ```\n */\nexport const SensitiveInput = forwardRef<HTMLInputElement, SensitiveInputProps>(\n (\n {\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onValueChange,\n onCopy,\n size = KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS.size,\n variant = KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS.variant,\n disabled = false,\n readOnly = false,\n id,\n autoComplete = \"off\",\n className,\n label,\n labelTooltip,\n description,\n error,\n required,\n ...inputProps\n },\n ref,\n ) => {\n // For aria-label, only use string labels (ReactNode labels can't be used for aria-label)\n const ariaLabelFallback =\n typeof label === \"string\" ? label : \"Sensitive value\";\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const value = isControlled ? controlledValue : internalValue;\n const hasValue = value.length > 0;\n\n const [mode, setMode] = useState<Mode>(() =>\n hasValue ? \"masked\" : \"empty\",\n );\n\n const [copied, setCopied] = useState(false);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const liveRegionId = useId();\n const generatedId = useId();\n const inputId = id ?? generatedId;\n const maskedInstructionId = useId();\n\n const mergedRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n // Reset copied state after 2 seconds\n useEffect(() => {\n if (copied) {\n const timeoutId = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timeoutId);\n }\n }, [copied]);\n\n const copyToClipboard = useCallback(\n async (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n try {\n if (\n typeof navigator !== \"undefined\" &&\n navigator.clipboard &&\n typeof navigator.clipboard.writeText === \"function\"\n ) {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n onCopy?.();\n return;\n }\n } catch {\n // Fall through to manual fallback\n }\n\n if (typeof document !== \"undefined\") {\n const textarea = document.createElement(\"textarea\");\n textarea.value = value;\n textarea.setAttribute(\"readonly\", \"\");\n textarea.style.position = \"absolute\";\n textarea.style.left = \"-9999px\";\n document.body.appendChild(textarea);\n const selection = document.getSelection();\n const previousRange = selection?.rangeCount\n ? selection.getRangeAt(0)\n : null;\n textarea.select();\n try {\n document.execCommand(\"copy\");\n setCopied(true);\n onCopy?.();\n } catch (error) {\n console.warn(\"Clipboard copy failed\", error);\n } finally {\n document.body.removeChild(textarea);\n if (previousRange) {\n selection?.removeAllRanges();\n selection?.addRange(previousRange);\n }\n }\n }\n },\n [value, onCopy],\n );\n\n // Sync mode when value changes externally\n const prevHasValueRef = useRef(hasValue);\n if (prevHasValueRef.current !== hasValue) {\n prevHasValueRef.current = hasValue;\n if (!hasValue && mode === \"masked\") {\n setMode(\"empty\");\n }\n }\n\n const handleContainerClick = useCallback(\n (e: React.MouseEvent) => {\n if (disabled) return;\n // Ignore clicks that originated from outside (e.g., label click focusing input)\n // Label clicks trigger a click on the input, but the click coordinates are outside the container\n if (containerRef.current) {\n const rect = containerRef.current.getBoundingClientRect();\n const isClickInsideContainer =\n e.clientX >= rect.left &&\n e.clientX <= rect.right &&\n e.clientY >= rect.top &&\n e.clientY <= rect.bottom;\n if (!isClickInsideContainer) return;\n }\n if (mode === \"masked\" && hasValue) {\n setMode(\"revealed\");\n if (!readOnly) {\n setTimeout(() => inputRef.current?.focus(), 0);\n }\n }\n },\n [mode, hasValue, disabled, readOnly],\n );\n\n const handleToggleVisibility = useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n if (mode === \"revealed\") {\n setMode(\"masked\");\n } else if (mode === \"empty\" && hasValue) {\n setMode(\"revealed\");\n }\n },\n [mode, hasValue],\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n if (!isControlled) {\n setInternalValue(newValue);\n }\n // When typing into an empty field, switch to revealed mode\n // so the input shows as type=\"text\" instead of type=\"password\"\n if (mode === \"empty\" && newValue.length > 0) {\n setMode(\"revealed\");\n }\n onChange?.(e);\n onValueChange?.(newValue);\n },\n [isControlled, onChange, onValueChange, mode],\n );\n\n const handleBlur = useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n // Don't mask if focus is moving to a button inside the container (copy/eye buttons)\n if (\n containerRef.current &&\n e.relatedTarget instanceof Node &&\n containerRef.current.contains(e.relatedTarget)\n ) {\n return;\n }\n if (hasValue) {\n setMode(\"masked\");\n }\n },\n [hasValue],\n );\n\n const handleContainerKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n if (mode === \"masked\" && hasValue) {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n setMode(\"revealed\");\n if (!readOnly) {\n setTimeout(() => inputRef.current?.focus(), 0);\n }\n }\n }\n },\n [mode, hasValue, disabled, readOnly],\n );\n\n const handleInputKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (mode === \"revealed\" && e.key === \"Escape\") {\n setMode(\"masked\");\n // Move focus to container to avoid focus trap (input becomes tabIndex={-1})\n setTimeout(() => containerRef.current?.focus(), 0);\n }\n },\n [mode],\n );\n\n const isMaskedWithValue = mode === \"masked\" && hasValue;\n const showEyeButton =\n !disabled && (mode === \"revealed\" || (mode === \"empty\" && hasValue));\n\n // Icon sizes matching input sizes\n const iconSize = size === \"xs\" || size === \"sm\" ? \"size-3\" : \"size-4\";\n\n const containerClassName = cn(\n inputVariants({ size, variant, parentFocusIndicator: true }),\n \"group/container relative flex w-full items-center\",\n // Show browser-native focus outline on container when child input is focused\n \"focus-within:outline focus-within:outline-2 focus-within:outline-[-webkit-focus-ring-color]\",\n isMaskedWithValue && !disabled && \"cursor-pointer\",\n disabled && \"cursor-not-allowed\",\n className,\n );\n\n const containerContent = (\n <>\n {/* Input - defines the width, always rendered */}\n <BaseInput\n ref={mergedRef}\n id={inputId}\n type={mode === \"revealed\" ? \"text\" : \"password\"}\n value={value}\n onChange={handleChange}\n onBlur={handleBlur}\n onKeyDown={handleInputKeyDown}\n disabled={disabled}\n readOnly={readOnly || isMaskedWithValue}\n autoComplete={autoComplete}\n tabIndex={isMaskedWithValue ? -1 : 0}\n className={cn(\n \"w-full border-0 bg-transparent p-0 text-kumo-default ring-0 outline-none kumo-input-placeholder disabled:cursor-not-allowed disabled:text-kumo-subtle\",\n size === \"xs\" && \"pr-5\",\n size === \"sm\" && \"pr-6\",\n size === \"base\" && \"pr-8\",\n size === \"lg\" && \"pr-10\",\n isMaskedWithValue && \"pointer-events-none text-transparent\",\n )}\n aria-hidden={isMaskedWithValue}\n {...inputProps}\n />\n\n {/* Mask overlay - absolutely positioned, doesn't affect layout */}\n <span\n className={cn(\n \"pointer-events-none absolute inset-y-0 left-0 flex items-center overflow-hidden select-none\",\n // Match input pr padding (space for icon)\n size === \"xs\" && \"right-5\",\n size === \"sm\" && \"right-6\",\n size === \"base\" && \"right-8\",\n size === \"lg\" && \"right-10\",\n // Match the padding from inputVariants\n size === \"xs\" && \"px-1.5\",\n size === \"sm\" && \"px-2\",\n size === \"base\" && \"px-3\",\n size === \"lg\" && \"px-4\",\n // Hidden when not masked\n !isMaskedWithValue && \"invisible\",\n // When masked: enable pointer events\n isMaskedWithValue && \"pointer-events-auto\",\n // Text color - use text-kumo-default to contrast with bg-kumo-control input background\n \"text-kumo-default\",\n // Hover state - pure CSS, no React state (group for children)\n \"group/mask\",\n )}\n aria-hidden=\"true\"\n >\n {/* Both texts rendered, stacked. Visibility toggled on hover to prevent layout shift */}\n <span className=\"relative\">\n <span\n className={cn(\n isMaskedWithValue &&\n !disabled &&\n \"group-focus-within/container:invisible group-hover/mask:invisible\",\n )}\n >\n ••••••••\n </span>\n {isMaskedWithValue && !disabled && (\n <span className=\"invisible absolute left-0 top-0 whitespace-nowrap text-kumo-subtle group-focus-within/container:visible group-hover/mask:visible\">\n Click to reveal\n </span>\n )}\n </span>\n </span>\n\n {/* Eye button - absolutely positioned to the right */}\n <button\n type=\"button\"\n onClick={handleToggleVisibility}\n onKeyDown={(e) => e.stopPropagation()}\n aria-label={mode === \"revealed\" ? \"Hide value\" : \"Reveal value\"}\n tabIndex={showEyeButton ? 0 : -1}\n className={cn(\n \"absolute top-1/2 right-0 -translate-y-1/2 cursor-pointer text-kumo-subtle hover:text-kumo-default focus:text-kumo-default focus-visible:ring-1 focus-visible:ring-kumo-hairline focus-visible:rounded-sm\",\n // Defensive styles to prevent global CSS pollution (e.g., button { background: gray })\n \"bg-transparent border-none shadow-none p-0 m-0 h-auto min-h-0 inline-flex items-center justify-center\",\n // Match right padding from inputVariants\n size === \"xs\" && \"right-1.5\",\n size === \"sm\" && \"right-2\",\n size === \"base\" && \"right-3\",\n size === \"lg\" && \"right-4\",\n iconSize,\n !showEyeButton && \"pointer-events-none opacity-0\",\n )}\n >\n {mode === \"revealed\" ? (\n <EyeSlash className=\"size-full\" />\n ) : (\n <Eye className=\"size-full\" />\n )}\n </button>\n\n {/* Copy tab - appears on hover/focus at top right (hidden when disabled) */}\n {hasValue && !disabled && (\n <button\n type=\"button\"\n onClick={copyToClipboard}\n onKeyDown={(e) => e.stopPropagation()}\n aria-label={copied ? \"Copied\" : \"Copy to clipboard\"}\n className={cn(\n \"absolute -top-px right-2 -translate-y-full cursor-pointer rounded-t-md bg-kumo-brand px-2 py-0.5 text-xs text-white opacity-0 transition-opacity group-focus-within/container:opacity-100 group-hover/container:opacity-100 hover:brightness-120 focus-visible:outline focus-visible:outline-offset-1 focus-visible:outline-kumo-hairline\",\n // Defensive styles to prevent global CSS pollution\n \"border-none shadow-none m-0 h-auto min-h-0\",\n )}\n >\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n )}\n </>\n );\n\n const input = (\n <div>\n {isMaskedWithValue ? (\n <div\n ref={containerRef}\n // Cannot use <button> here because containerContent contains interactive button elements (Copy, Reveal).\n // Using role=\"button\" with proper keyboard handling instead.\n // oxlint-disable-next-line prefer-tag-over-role\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n className={containerClassName}\n onClick={handleContainerClick}\n onKeyDown={handleContainerKeyDown}\n aria-label={`${ariaLabelFallback}, masked.`}\n aria-describedby={`${maskedInstructionId} ${liveRegionId}`}\n aria-disabled={disabled}\n >\n {containerContent}\n </div>\n ) : (\n <div ref={containerRef} className={containerClassName}>\n {containerContent}\n </div>\n )}\n {isMaskedWithValue && (\n <span id={maskedInstructionId} className=\"sr-only\">\n Click or press Enter to reveal.\n </span>\n )}\n <span id={liveRegionId} className=\"sr-only\" aria-live=\"polite\">\n {mode === \"masked\" && hasValue && \"Value hidden\"}\n {copied && \"Copied to clipboard\"}\n </span>\n </div>\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);\n\nSensitiveInput.displayName = \"SensitiveInput\";\n"],"names":["KUMO_SENSITIVE_INPUT_VARIANTS","KUMO_INPUT_VARIANTS","KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS","SensitiveInput","forwardRef","controlledValue","defaultValue","onChange","onValueChange","onCopy","size","variant","disabled","readOnly","id","autoComplete","className","label","labelTooltip","description","error","required","inputProps","ref","ariaLabelFallback","isControlled","internalValue","setInternalValue","useState","value","hasValue","mode","setMode","copied","setCopied","inputRef","useRef","containerRef","liveRegionId","useId","generatedId","inputId","maskedInstructionId","mergedRef","useCallback","node","useEffect","timeoutId","copyToClipboard","textarea","selection","previousRange","prevHasValueRef","handleContainerClick","rect","handleToggleVisibility","handleChange","newValue","handleBlur","handleContainerKeyDown","handleInputKeyDown","isMaskedWithValue","showEyeButton","iconSize","containerClassName","cn","inputVariants","containerContent","jsxs","Fragment","jsx","BaseInput","EyeSlash","Eye","input","Field"],"mappings":";;;;;;;;AAqBO,MAAMA,KAAgCC,IAEhCC,IAA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