@ngrok/mantle 0.73.3 → 0.73.4
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/dist/accordion.d.ts +7 -9
- package/dist/accordion.js +1 -1
- package/dist/accordion.js.map +1 -1
- package/dist/agent.json +1 -1
- package/dist/alert-dialog.d.ts +33 -38
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +9 -11
- package/dist/alert.js +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/{anchor-2stEauOz.js → anchor-CcTY5SIz.js} +2 -2
- package/dist/{anchor-2stEauOz.js.map → anchor-CcTY5SIz.js.map} +1 -1
- package/dist/anchor.d.ts +2 -3
- package/dist/anchor.js +1 -1
- package/dist/{as-child-CpZKMqTE.d.ts → as-child-uN_018tj.d.ts} +1 -1
- package/dist/badge.d.ts +3 -4
- package/dist/badge.js +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/{booleanish-CBGdPL3Q.js → booleanish-BfvnW6vy.js} +1 -1
- package/dist/{booleanish-CBGdPL3Q.js.map → booleanish-BfvnW6vy.js.map} +1 -1
- package/dist/{browser-only-QPyyfLaB.js → browser-only-BSl_hruR.js} +1 -1
- package/dist/{browser-only-QPyyfLaB.js.map → browser-only-BSl_hruR.js.map} +1 -1
- package/dist/browser-only.js +1 -1
- package/dist/{button-POMJ-20y.js → button-BAxneEMu.js} +2 -2
- package/dist/{button-POMJ-20y.js.map → button-BAxneEMu.js.map} +1 -1
- package/dist/{button-DbHFERMB.d.ts → button-BYZOBUgj.d.ts} +16 -19
- package/dist/{button-GokecthL.js → button-uMIZVKit.js} +2 -2
- package/dist/{button-GokecthL.js.map → button-uMIZVKit.js.map} +1 -1
- package/dist/button.d.ts +4 -4
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -2
- package/dist/calendar.js +1 -1
- package/dist/calendar.js.map +1 -1
- package/dist/card.d.ts +6 -7
- package/dist/card.js +1 -1
- package/dist/card.js.map +1 -1
- package/dist/checkbox.d.ts +3 -4
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/code-block.d.ts +17 -19
- package/dist/code-block.js +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +2 -3
- package/dist/code.js +1 -1
- package/dist/code.js.map +1 -1
- package/dist/color.d.ts +2 -2
- package/dist/color.js.map +1 -1
- package/dist/combobox.d.ts +11 -13
- package/dist/combobox.js +1 -1
- package/dist/combobox.js.map +1 -1
- package/dist/command.d.ts +133 -220
- package/dist/command.js +1 -1
- package/dist/command.js.map +1 -1
- package/dist/{compose-refs-DZ3cPi47.js → compose-refs-Cjf2gfB8.js} +1 -1
- package/dist/{compose-refs-DZ3cPi47.js.map → compose-refs-Cjf2gfB8.js.map} +1 -1
- package/dist/{copy-to-clipboard-CNMRyck4.js → copy-to-clipboard-Baw30q9O.js} +2 -2
- package/dist/{copy-to-clipboard-CNMRyck4.js.map → copy-to-clipboard-Baw30q9O.js.map} +1 -1
- package/dist/{cx-D1HYnpvA.js → cx-CBSnSC36.js} +1 -1
- package/dist/{cx-D1HYnpvA.js.map → cx-CBSnSC36.js.map} +1 -1
- package/dist/cx.js +1 -1
- package/dist/data-table.d.ts +13 -15
- package/dist/data-table.js +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/{deep-non-nullable-Xu7ckQM6.d.ts → deep-non-nullable-BxRoySYR.d.ts} +1 -1
- package/dist/description-list.d.ts +5 -6
- package/dist/description-list.js +1 -1
- package/dist/description-list.js.map +1 -1
- package/dist/{dialog-B1KCB7JT.js → dialog-Dn-brQBw.js} +2 -2
- package/dist/{dialog-B1KCB7JT.js.map → dialog-Dn-brQBw.js.map} +1 -1
- package/dist/dialog.d.ts +14 -17
- package/dist/dialog.js +1 -1
- package/dist/{direction-D9IZ1wW6.d.ts → direction-CcTY0FmA.d.ts} +2 -2
- package/dist/{direction-HqPHXGIs.js → direction-Wa9W2F61.js} +1 -1
- package/dist/{direction-HqPHXGIs.js.map → direction-Wa9W2F61.js.map} +1 -1
- package/dist/{dropdown-menu-CvOiQUSZ.d.ts → dropdown-menu-BgYk4L8o.d.ts} +22 -24
- package/dist/{dropdown-menu-DY4w933w.js → dropdown-menu-C3YZJBkV.js} +2 -2
- package/dist/{dropdown-menu-DY4w933w.js.map → dropdown-menu-C3YZJBkV.js.map} +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -8
- package/dist/empty.js +1 -1
- package/dist/empty.js.map +1 -1
- package/dist/{field-context-B7Z1cmZW.js → field-context-4k1kI7Bo.js} +2 -2
- package/dist/{field-context-B7Z1cmZW.js.map → field-context-4k1kI7Bo.js.map} +1 -1
- package/dist/field.d.ts +23 -25
- package/dist/field.js +1 -1
- package/dist/field.js.map +1 -1
- package/dist/flag.d.ts +1 -2
- package/dist/flag.js +1 -1
- package/dist/flag.js.map +1 -1
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hover-card.d.ts +4 -6
- package/dist/hover-card.js +1 -1
- package/dist/hover-card.js.map +1 -1
- package/dist/{icon-bWc5yC3-.js → icon-C8bYBIHW.js} +2 -2
- package/dist/{icon-bWc5yC3-.js.map → icon-C8bYBIHW.js.map} +1 -1
- package/dist/{icon-button-ZKN0sRIJ.js → icon-button-C_Ht_g1C.js} +2 -2
- package/dist/{icon-button-ZKN0sRIJ.js.map → icon-button-C_Ht_g1C.js.map} +1 -1
- package/dist/{icon-button-BDTb-lxs.d.ts → icon-button-ntupABbM.d.ts} +6 -8
- package/dist/{icon-BJ7q2RXZ.d.ts → icon-n49kOh4_.d.ts} +3 -4
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/icons.d.ts +9 -10
- package/dist/icons.js +1 -1
- package/dist/icons.js.map +1 -1
- package/dist/{in-view-BUgyu-Tk.d.ts → in-view-BC3wmz-a.d.ts} +1 -1
- package/dist/{in-view-CeVqeGbv.js → in-view-C2DpZ6s0.js} +1 -1
- package/dist/{in-view-CeVqeGbv.js.map → in-view-C2DpZ6s0.js.map} +1 -1
- package/dist/{index-BhlxYL_y.d.ts → index-BL5WVva_.d.ts} +3 -6
- package/dist/{index-CWXKBva-.d.ts → index-DBZ3eRsl.d.ts} +5 -7
- package/dist/{index-DS_4n2eb.d.ts → index-DorCusfG.d.ts} +1 -1
- package/dist/{index-BbZBDzPh.d.ts → index-L3NmbHi5.d.ts} +1 -1
- package/dist/input.d.ts +7 -8
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/{is-input-CtUHJGgL.js → is-input-CXmS0OFN.js} +1 -1
- package/dist/{is-input-CtUHJGgL.js.map → is-input-CXmS0OFN.js.map} +1 -1
- package/dist/{kbd-CbMxDL9E.js → kbd-Bv6tefdB.js} +2 -2
- package/dist/{kbd-CbMxDL9E.js.map → kbd-Bv6tefdB.js.map} +1 -1
- package/dist/kbd.d.ts +1 -2
- package/dist/kbd.js +1 -1
- package/dist/{label-x6FcOpxc.js → label-DhIUmTN2.js} +2 -2
- package/dist/{label-x6FcOpxc.js.map → label-DhIUmTN2.js.map} +1 -1
- package/dist/label.d.ts +2 -4
- package/dist/label.js +1 -1
- package/dist/llms.txt +1 -1
- package/dist/main.d.ts +1 -2
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/media-object.d.ts +4 -5
- package/dist/media-object.js +1 -1
- package/dist/media-object.js.map +1 -1
- package/dist/multi-select.d.ts +16 -18
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/otp-input.d.ts +6 -7
- package/dist/otp-input.js +1 -1
- package/dist/otp-input.js.map +1 -1
- package/dist/pagination.d.ts +7 -9
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/{popover-CoZxokw_.js → popover-DponNBot.js} +2 -2
- package/dist/{popover-CoZxokw_.js.map → popover-DponNBot.js.map} +1 -1
- package/dist/popover.d.ts +6 -7
- package/dist/popover.js +1 -1
- package/dist/primitive-Cn3h4DJg.js +2 -0
- package/dist/primitive-Cn3h4DJg.js.map +1 -0
- package/dist/{primitive-qkxTYBUY.d.ts → primitive-D_-h74Kt.d.ts} +2 -3
- package/dist/progress.d.ts +4 -5
- package/dist/progress.js +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.d.ts +18 -20
- package/dist/radio-group.js +1 -1
- package/dist/radio-group.js.map +1 -1
- package/dist/{resolve-pre-rendered-props-BfWe69-w.js → resolve-pre-rendered-props-C-vrNxH1.js} +8 -8
- package/dist/resolve-pre-rendered-props-C-vrNxH1.js.map +1 -0
- package/dist/{resolve-pre-rendered-props-BONSCwYA.d.ts → resolve-pre-rendered-props-DxJ9-DAl.d.ts} +1 -1
- package/dist/sandboxed-on-click.d.ts +3 -4
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/sandboxed-on-click.js.map +1 -1
- package/dist/{select-SZFFzYs0.d.ts → select-C15-XvRT.d.ts} +15 -16
- package/dist/select-Cxc9VmP8.js +2 -0
- package/dist/select-Cxc9VmP8.js.map +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/separator-Bqjy77rG.js +2 -0
- package/dist/separator-Bqjy77rG.js.map +1 -0
- package/dist/separator.d.ts +3 -5
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +15 -19
- package/dist/sheet.js +1 -1
- package/dist/sheet.js.map +1 -1
- package/dist/skeleton.d.ts +4 -6
- package/dist/skeleton.js +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/skip-to-main-link.d.ts +1 -2
- package/dist/skip-to-main-link.js +1 -1
- package/dist/skip-to-main-link.js.map +1 -1
- package/dist/slider.d.ts +1 -2
- package/dist/slider.js +1 -1
- package/dist/slider.js.map +1 -1
- package/dist/{slot-D_ZUrdEW.js → slot-CV5fmqFr.js} +2 -2
- package/dist/{slot-D_ZUrdEW.js.map → slot-CV5fmqFr.js.map} +1 -1
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/{sort-mXo37xN2.js → sort-BPX2Fk9t.js} +2 -2
- package/dist/{sort-mXo37xN2.js.map → sort-BPX2Fk9t.js.map} +1 -1
- package/dist/split-button.d.ts +10 -12
- package/dist/split-button.js +1 -1
- package/dist/split-button.js.map +1 -1
- package/dist/{svg-only-7gYlsX8f.js → svg-only-Cz1cby8y.js} +2 -2
- package/dist/{svg-only-7gYlsX8f.js.map → svg-only-Cz1cby8y.js.map} +1 -1
- package/dist/{svg-only-D4uqM1OC.d.ts → svg-only-f6ToFLH0.d.ts} +3 -4
- package/dist/switch.d.ts +3 -5
- package/dist/switch.js +1 -1
- package/dist/switch.js.map +1 -1
- package/dist/{table-CjSQkfZe.d.ts → table-BWD9IlIN.d.ts} +10 -12
- package/dist/{table-CHd39aT-.js → table-eyoUW2Uv.js} +2 -2
- package/dist/{table-CHd39aT-.js.map → table-eyoUW2Uv.js.map} +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +6 -9
- package/dist/tabs.js +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/text-area.d.ts +2 -3
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/theme-provider-MMwxHEfw.js +2 -0
- package/dist/theme-provider-MMwxHEfw.js.map +1 -0
- package/dist/theme.d.ts +9 -10
- package/dist/theme.js +1 -1
- package/dist/theme.js.map +1 -1
- package/dist/{themes-FPux5kIu.d.ts → themes-CYNpplwN.d.ts} +1 -1
- package/dist/toast-CR3MVChj.js +2 -0
- package/dist/toast-CR3MVChj.js.map +1 -0
- package/dist/toast.d.ts +8 -10
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +4 -6
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/{traffic-policy-file-BwHHdhWJ.js → traffic-policy-file-0g5RXFqu.js} +1 -1
- package/dist/{traffic-policy-file-BwHHdhWJ.js.map → traffic-policy-file-0g5RXFqu.js.map} +1 -1
- package/dist/{types-QKZ5fvaQ.d.ts → types-BvUzforF.d.ts} +1 -1
- package/dist/types-D85fCNV3.js +2 -0
- package/dist/{types-884RJJqm.js.map → types-D85fCNV3.js.map} +1 -1
- package/dist/types.d.ts +6 -6
- package/dist/types.js +1 -1
- package/dist/use-copy-to-clipboard-BLpquU9d.js +2 -0
- package/dist/{use-copy-to-clipboard-CTgtLjUg.js.map → use-copy-to-clipboard-BLpquU9d.js.map} +1 -1
- package/dist/{use-isomorphic-layout-effect-CNSD0lhi.js → use-isomorphic-layout-effect-DdTRtMY-.js} +1 -1
- package/dist/{use-isomorphic-layout-effect-CNSD0lhi.js.map → use-isomorphic-layout-effect-DdTRtMY-.js.map} +1 -1
- package/dist/{use-matches-media-query-CojcYxlA.js → use-matches-media-query-CMSxHR9n.js} +1 -1
- package/dist/{use-matches-media-query-CojcYxlA.js.map → use-matches-media-query-CMSxHR9n.js.map} +1 -1
- package/dist/{use-prefers-reduced-motion-Bpx8G3UT.js → use-prefers-reduced-motion-CWIoFA6W.js} +2 -2
- package/dist/{use-prefers-reduced-motion-Bpx8G3UT.js.map → use-prefers-reduced-motion-CWIoFA6W.js.map} +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/{validation-BYME8rWN.js → validation-DCyx-ceH.js} +1 -1
- package/dist/{validation-BYME8rWN.js.map → validation-DCyx-ceH.js.map} +1 -1
- package/dist/{validation-CBSOmooP.d.ts → validation-xyX_6kph.d.ts} +1 -1
- package/dist/{variant-props-BZbM__kQ.d.ts → variant-props-CVymuSfa.d.ts} +2 -2
- package/dist/{with-style-props-xzZLnIrF.d.ts → with-style-props-CyImx7vd.d.ts} +1 -1
- package/package.json +6 -6
- package/dist/primitive-tXm_8n_t.js +0 -2
- package/dist/primitive-tXm_8n_t.js.map +0 -1
- package/dist/resolve-pre-rendered-props-BfWe69-w.js.map +0 -1
- package/dist/select-B7orOUPj.js +0 -2
- package/dist/select-B7orOUPj.js.map +0 -1
- package/dist/separator-awchG4LI.js +0 -2
- package/dist/separator-awchG4LI.js.map +0 -1
- package/dist/theme-provider-BFcnjeME.js +0 -2
- package/dist/theme-provider-BFcnjeME.js.map +0 -1
- package/dist/toast-CGnquSKO.js +0 -2
- package/dist/toast-CGnquSKO.js.map +0 -1
- package/dist/types-884RJJqm.js +0 -2
- package/dist/use-copy-to-clipboard-CTgtLjUg.js +0 -2
package/dist/empty.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.js","names":[],"sources":["../src/components/empty/empty.tsx"],"sourcesContent":["import type { ComponentProps, HTMLAttributes, ReactNode } from \"react\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { Slot } from \"../slot/index.js\";\n\n/**\n * The root container for an empty state. Centers content horizontally\n * with consistent vertical padding and max-width.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No results found</Empty.Title>\n * <Empty.Description>Try adjusting your search or filters.</Empty.Description>\n * <Empty.Actions>\n * <Button>Clear filters</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Root = ({ asChild, children, className, ...props }: ComponentProps<\"div\"> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty\"\n\t\t\tclassName={cx(\"mx-auto flex max-w-lg flex-col items-center py-14 text-center\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nRoot.displayName = \"Empty\";\n\ntype EmptyIconProps = Omit<SvgAttributes, \"children\"> & {\n\t/**\n\t * A single SVG icon element.\n\t */\n\tsvg: ReactNode;\n};\n\n/**\n * Renders a large icon for the empty state. Pass a single SVG icon element\n * via the `svg` prop (e.g. from `@phosphor-icons/react`).\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Icon = ({ className, svg, ...props }: EmptyIconProps) => {\n\treturn (\n\t\t<SvgOnly\n\t\t\tdata-slot=\"empty-icon\"\n\t\t\tclassName={cx(\"mb-2 size-16 text-muted\", className)}\n\t\t\tsvg={svg}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\nIcon.displayName = \"EmptyIcon\";\n\n/**\n * The heading text for the empty state. Renders as an `h3` by default. Use the\n * `asChild` prop to render as a different heading level (e.g. `h1`, `h2`).\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n *\n * <Empty.Title asChild>\n * <h2>No results found</h2>\n * </Empty.Title>\n * ```\n */\nconst Title = ({\n\tasChild,\n\tchildren,\n\tclassName,\n\t...props\n}: HTMLAttributes<HTMLHeadingElement> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"h3\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty-title\"\n\t\t\tclassName={cx(\"text-strong text-xl font-medium\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nTitle.displayName = \"EmptyTitle\";\n\n/**\n * Supporting descriptive text below the title. Renders as a `div` with\n * `space-y-4` so multiple paragraphs can be placed inside. Use the `asChild`\n * prop to render as a different element.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n *\n * <Empty.Description>\n * <p>Something went wrong.</p>\n * <p>Please try again in a few minutes.</p>\n * </Empty.Description>\n * ```\n */\nconst Description = ({\n\tasChild,\n\tchildren,\n\tclassName,\n\t...props\n}: ComponentProps<\"div\"> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty-description\"\n\t\t\tclassName={cx(\"text-body mt-1 space-y-4 text-sm\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nDescription.displayName = \"EmptyDescription\";\n\n/**\n * A container for action buttons or links in the empty state.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * <Button appearance=\"outlined\">Go back</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Actions = ({\n\tasChild,\n\tchildren,\n\tclassName,\n\t...props\n}: ComponentProps<\"div\"> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty-actions\"\n\t\t\tclassName={cx(\"mt-4 flex items-center gap-2\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nActions.displayName = \"EmptyActions\";\n\n/**\n * Compound component for rendering empty states. Use with `Empty.Root`,\n * `Empty.Icon`, `Empty.Title`, `Empty.Description`, and `Empty.Actions`.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * Composition:\n * ```\n * Empty.Root\n * ├── Empty.Icon\n * ├── Empty.Title\n * ├── Empty.Description\n * └── Empty.Actions\n * ```\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>\n * Create your first endpoint to get started.\n * </Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Empty = {\n\t/**\n\t * The root container for an empty state. Centers content vertically and\n\t * horizontally with consistent padding and max-width.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tRoot,\n\t/**\n\t * Renders a large icon for the empty state. Pass a single SVG icon element\n\t * via the `svg` prop.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tIcon,\n\t/**\n\t * The heading text for the empty state. Renders as an `h3` by default.\n\t * Use `asChild` to render as a different heading level.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t *\n\t * <Empty.Title asChild>\n\t * <h2>No results found</h2>\n\t * </Empty.Title>\n\t * ```\n\t */\n\tTitle,\n\t/**\n\t * Supporting descriptive text below the title. Renders as a `div` with\n\t * `space-y-4` for multiple paragraphs. Use `asChild` to render as a\n\t * different element.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tDescription,\n\t/**\n\t * A container for action buttons or links in the empty state.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tActions,\n} as const;\n\nexport {\n\t//,\n\tEmpty,\n};\n"],"mappings":"0JAyBA,MAAM,GAAQ,CAAE,UAAS,WAAU,YAAW,GAAG,KAI/C,EAHY,EAAU,EAAO,MAG7B,CACC,YAAU,QACV,UAAW,EAAG,gEAAiE,
|
|
1
|
+
{"version":3,"file":"empty.js","names":[],"sources":["../src/components/empty/empty.tsx"],"sourcesContent":["import type { ComponentProps, HTMLAttributes, ReactNode } from \"react\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { Slot } from \"../slot/index.js\";\n\n/**\n * The root container for an empty state. Centers content horizontally\n * with consistent vertical padding and max-width.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No results found</Empty.Title>\n * <Empty.Description>Try adjusting your search or filters.</Empty.Description>\n * <Empty.Actions>\n * <Button>Clear filters</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Root = ({ asChild, children, className, ...props }: ComponentProps<\"div\"> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty\"\n\t\t\tclassName={cx(\"mx-auto flex max-w-lg flex-col items-center py-14 text-center\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nRoot.displayName = \"Empty\";\n\ntype EmptyIconProps = Omit<SvgAttributes, \"children\"> & {\n\t/**\n\t * A single SVG icon element.\n\t */\n\tsvg: ReactNode;\n};\n\n/**\n * Renders a large icon for the empty state. Pass a single SVG icon element\n * via the `svg` prop (e.g. from `@phosphor-icons/react`).\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Icon = ({ className, svg, ...props }: EmptyIconProps) => {\n\treturn (\n\t\t<SvgOnly\n\t\t\tdata-slot=\"empty-icon\"\n\t\t\tclassName={cx(\"mb-2 size-16 text-muted\", className)}\n\t\t\tsvg={svg}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\nIcon.displayName = \"EmptyIcon\";\n\n/**\n * The heading text for the empty state. Renders as an `h3` by default. Use the\n * `asChild` prop to render as a different heading level (e.g. `h1`, `h2`).\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n *\n * <Empty.Title asChild>\n * <h2>No results found</h2>\n * </Empty.Title>\n * ```\n */\nconst Title = ({\n\tasChild,\n\tchildren,\n\tclassName,\n\t...props\n}: HTMLAttributes<HTMLHeadingElement> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"h3\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty-title\"\n\t\t\tclassName={cx(\"text-strong text-xl font-medium\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nTitle.displayName = \"EmptyTitle\";\n\n/**\n * Supporting descriptive text below the title. Renders as a `div` with\n * `space-y-4` so multiple paragraphs can be placed inside. Use the `asChild`\n * prop to render as a different element.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n *\n * <Empty.Description>\n * <p>Something went wrong.</p>\n * <p>Please try again in a few minutes.</p>\n * </Empty.Description>\n * ```\n */\nconst Description = ({\n\tasChild,\n\tchildren,\n\tclassName,\n\t...props\n}: ComponentProps<\"div\"> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty-description\"\n\t\t\tclassName={cx(\"text-body mt-1 space-y-4 text-sm\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nDescription.displayName = \"EmptyDescription\";\n\n/**\n * A container for action buttons or links in the empty state.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * <Button appearance=\"outlined\">Go back</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Actions = ({\n\tasChild,\n\tchildren,\n\tclassName,\n\t...props\n}: ComponentProps<\"div\"> & WithAsChild) => {\n\tconst Comp = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"empty-actions\"\n\t\t\tclassName={cx(\"mt-4 flex items-center gap-2\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Comp>\n\t);\n};\nActions.displayName = \"EmptyActions\";\n\n/**\n * Compound component for rendering empty states. Use with `Empty.Root`,\n * `Empty.Icon`, `Empty.Title`, `Empty.Description`, and `Empty.Actions`.\n *\n * @see https://mantle.ngrok.com/components/empty\n *\n * @example\n * Composition:\n * ```\n * Empty.Root\n * ├── Empty.Icon\n * ├── Empty.Title\n * ├── Empty.Description\n * └── Empty.Actions\n * ```\n *\n * @example\n * ```tsx\n * <Empty.Root>\n * <Empty.Icon svg={<GhostIcon />} />\n * <Empty.Title>No endpoints yet</Empty.Title>\n * <Empty.Description>\n * Create your first endpoint to get started.\n * </Empty.Description>\n * <Empty.Actions>\n * <Button>Create endpoint</Button>\n * </Empty.Actions>\n * </Empty.Root>\n * ```\n */\nconst Empty = {\n\t/**\n\t * The root container for an empty state. Centers content vertically and\n\t * horizontally with consistent padding and max-width.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tRoot,\n\t/**\n\t * Renders a large icon for the empty state. Pass a single SVG icon element\n\t * via the `svg` prop.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tIcon,\n\t/**\n\t * The heading text for the empty state. Renders as an `h3` by default.\n\t * Use `asChild` to render as a different heading level.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t *\n\t * <Empty.Title asChild>\n\t * <h2>No results found</h2>\n\t * </Empty.Title>\n\t * ```\n\t */\n\tTitle,\n\t/**\n\t * Supporting descriptive text below the title. Renders as a `div` with\n\t * `space-y-4` for multiple paragraphs. Use `asChild` to render as a\n\t * different element.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tDescription,\n\t/**\n\t * A container for action buttons or links in the empty state.\n\t *\n\t * @see https://mantle.ngrok.com/components/empty\n\t *\n\t * @example\n\t * ```tsx\n\t * <Empty.Root>\n\t * <Empty.Icon svg={<GhostIcon />} />\n\t * <Empty.Title>No endpoints yet</Empty.Title>\n\t * <Empty.Description>Create your first endpoint to get started.</Empty.Description>\n\t * <Empty.Actions>\n\t * <Button>Create endpoint</Button>\n\t * </Empty.Actions>\n\t * </Empty.Root>\n\t * ```\n\t */\n\tActions,\n} as const;\n\nexport {\n\t//,\n\tEmpty,\n};\n"],"mappings":"0JAyBA,MAAM,GAAQ,CAAE,UAAS,WAAU,YAAW,GAAG,KAI/C,EAHY,EAAU,EAAO,MAG7B,CACC,YAAU,QACV,UAAW,EAAG,gEAAiE,CAAS,EACxF,GAAI,EAEH,UACI,CAAA,EAGR,EAAK,YAAc,QA2BnB,MAAM,GAAQ,CAAE,YAAW,MAAK,GAAG,KAEjC,EAAC,EAAD,CACC,YAAU,aACV,UAAW,EAAG,0BAA2B,CAAS,EAC7C,MACL,GAAI,CACJ,CAAA,EAGH,EAAK,YAAc,YAwBnB,MAAM,GAAS,CACd,UACA,WACA,YACA,GAAG,KAKF,EAHY,EAAU,EAAO,KAG7B,CACC,YAAU,cACV,UAAW,EAAG,kCAAmC,CAAS,EAC1D,GAAI,EAEH,UACI,CAAA,EAGR,EAAM,YAAc,aA0BpB,MAAM,GAAe,CACpB,UACA,WACA,YACA,GAAG,KAKF,EAHY,EAAU,EAAO,MAG7B,CACC,YAAU,oBACV,UAAW,EAAG,mCAAoC,CAAS,EAC3D,GAAI,EAEH,UACI,CAAA,EAGR,EAAY,YAAc,mBAoB1B,MAAM,GAAW,CAChB,UACA,WACA,YACA,GAAG,KAKF,EAHY,EAAU,EAAO,MAG7B,CACC,YAAU,gBACV,UAAW,EAAG,+BAAgC,CAAS,EACvD,GAAI,EAEH,UACI,CAAA,EAGR,EAAQ,YAAc,eAgCtB,MAAM,EAAQ,CAmBb,OAmBA,OAuBA,QAoBA,cAkBA,SACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./validation-
|
|
2
|
-
//# sourceMappingURL=field-context-
|
|
1
|
+
import{r as e}from"./validation-DCyx-ceH.js";import{createContext as t}from"react";const n=t(null),r=t(null),i=({context:t})=>{if(!t)return{ariaProps:{},validation:void 0};let n=e({defaultAriaInvalid:!1,validation:t.validation});return{ariaProps:{"aria-describedby":`${t.descriptionId} ${t.errorId}`,"aria-errormessage":n.isInvalid?t.errorId:void 0,"aria-invalid":n.ariaInvalid,id:t.controlId,name:t.name},validation:n.validation}};export{n,i as r,r as t};
|
|
2
|
+
//# sourceMappingURL=field-context-4k1kI7Bo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-context-
|
|
1
|
+
{"version":3,"file":"field-context-4k1kI7Bo.js","names":[],"sources":["../src/components/field/field-context.ts"],"sourcesContent":["import { createContext, type ComponentProps } from \"react\";\nimport { parseValidation, type ValidationState } from \"./validation.js\";\n\n/**\n * ARIA and identity props that `Field.Control` applies to the field's\n * focusable control. `id` and `name` come from the surrounding `Field.Item`\n * so a caller only needs to declare `name` once.\n */\ntype FieldControlAriaProps = {\n\t/**\n\t * IDREFs for helper or error text that describe the focusable control.\n\t */\n\t\"aria-describedby\"?: string;\n\t/**\n\t * IDREFs for error text that represent the control's current error state.\n\t */\n\t\"aria-errormessage\"?: string;\n\t/**\n\t * The resolved ARIA invalid state for the focusable control.\n\t */\n\t\"aria-invalid\"?: ComponentProps<\"input\">[\"aria-invalid\"];\n\t/**\n\t * Stable DOM id for the focusable control, generated by `Field.Item` and\n\t * also used as `Field.Label`'s default `htmlFor`.\n\t */\n\tid?: string;\n\t/**\n\t * Form value identity from `Field.Item`'s required `name` prop.\n\t */\n\tname?: string;\n};\n\n/**\n * Context value owned by `Field.Item` and consumed by message/control parts.\n *\n * `Field.Item` owns the two stable slot IDs (one for the description, one for\n * the error list) so consumers don't manage ARIA wiring themselves. The IDs\n * are emitted unconditionally; ARIA treats unresolved IDREFs as no-ops, so\n * dangling IDs (when no description or error list is rendered) are harmless.\n */\ntype FieldItemContextValue = {\n\t/**\n\t * Stable DOM id applied to the `Field.Control` child and consumed by\n\t * `Field.Label` as the default `htmlFor` target.\n\t */\n\tcontrolId: string;\n\t/**\n\t * Stable ID for the rendered `Field.Description` slot, generated once per\n\t * `Field.Item`.\n\t */\n\tdescriptionId: string;\n\t/**\n\t * Stable ID for the rendered `Field.Errors` / `Field.ErrorList` slot,\n\t * generated once per `Field.Item`.\n\t */\n\terrorId: string;\n\t/**\n\t * Form-value name for the field, supplied by the required `name` prop on\n\t * `Field.Item` and splatted onto the `Field.Control` child.\n\t */\n\tname: string;\n\t/**\n\t * `true` while a non-empty `Field.Errors` / `Field.ErrorList` is mounted\n\t * under this `Field.Item`. Used by `Field.Item` to infer an `\"error\"`\n\t * validation state when no explicit `validation` prop is supplied.\n\t */\n\thasErrors: boolean;\n\t/**\n\t * Marks a non-empty `Field.Errors` / `Field.ErrorList` as mounted. Returns\n\t * its cleanup callback.\n\t */\n\tregisterError: () => () => void;\n\t/**\n\t * Validation state inferred or supplied by the surrounding `Field.Item`.\n\t */\n\tvalidation?: ValidationState;\n};\n\n/**\n * Options for resolving the ARIA props that `Field.Control` applies.\n */\ntype ResolveFieldControlAriaPropsOptions = {\n\t/**\n\t * The nearest `Field.Item` context, when the control is rendered inside one.\n\t */\n\tcontext: FieldItemContextValue | null;\n};\n\n/**\n * Context shared by the parts of a single `Field.Item`.\n */\nconst FieldItemContext = createContext<FieldItemContextValue | null>(null);\n\n/**\n * Context published by `Field.Control` carrying the resolved ARIA / identity\n * props that should land on the focusable control. Mantle compound triggers\n * (`Select.Trigger`, `MultiSelect.Trigger`, …) consume this so wrapping a\n * compound widget in `Field.Control` works — `cloneElement` only reaches the\n * direct child, which for a compound widget is a context provider that does\n * not forward ARIA props to its inner trigger.\n *\n * `null` when no `Field.Control` is in the tree.\n */\nconst FieldControlContext = createContext<FieldControlAriaProps | null>(null);\n\n/**\n * Resolves the ARIA, identity, and validation props that `Field.Control`\n * applies to its focusable child. `Field.Item` is the single source of truth\n * for `id`, `name`, `aria-*`, and `validation` — the resolver reads only the\n * surrounding `Field.Item` context and ignores anything supplied on the child\n * element. To override these values, set them on `Field.Item` itself.\n */\nconst resolveFieldControlAriaProps = ({ context }: ResolveFieldControlAriaPropsOptions) => {\n\tif (!context) {\n\t\treturn {\n\t\t\tariaProps: {} as const satisfies FieldControlAriaProps,\n\t\t\tvalidation: undefined,\n\t\t};\n\t}\n\n\tconst parsedValidation = parseValidation({\n\t\tdefaultAriaInvalid: false,\n\t\tvalidation: context.validation,\n\t});\n\t// Always emit both slot IDs in aria-describedby when inside a Field.Item.\n\t// Per WAI-ARIA, unresolved IDREFs are ignored by assistive tech, so the\n\t// dangling ID is harmless when the corresponding slot isn't rendered and\n\t// lets us skip mount-time bookkeeping. aria-errormessage is additionally\n\t// spec-gated on aria-invalid=\"true\", so it stays inert until the field is\n\t// actually invalid.\n\tconst ariaDescribedBy = `${context.descriptionId} ${context.errorId}`;\n\tconst ariaErrorMessage = parsedValidation.isInvalid ? context.errorId : undefined;\n\n\treturn {\n\t\tariaProps: {\n\t\t\t\"aria-describedby\": ariaDescribedBy,\n\t\t\t\"aria-errormessage\": ariaErrorMessage,\n\t\t\t\"aria-invalid\": parsedValidation.ariaInvalid,\n\t\t\tid: context.controlId,\n\t\t\tname: context.name,\n\t\t} satisfies FieldControlAriaProps,\n\t\tvalidation: parsedValidation.validation,\n\t};\n};\n\nexport {\n\t//,\n\tFieldControlContext,\n\tFieldItemContext,\n\tresolveFieldControlAriaProps,\n};\nexport type {\n\t//,\n\tFieldControlAriaProps,\n\tFieldItemContextValue,\n};\n"],"mappings":"mFA2FA,MAAM,EAAmB,EAA4C,IAAI,EAYnE,EAAsB,EAA4C,IAAI,EAStE,GAAgC,CAAE,aAAmD,CAC1F,GAAI,CAAC,EACJ,MAAO,CACN,UAAW,CAAC,EACZ,WAAY,IAAA,EACb,EAGD,IAAM,EAAmB,EAAgB,CACxC,mBAAoB,GACpB,WAAY,EAAQ,UACrB,CAAC,EAUD,MAAO,CACN,UAAW,CACV,mBAAoB,GALK,EAAQ,cAAc,GAAG,EAAQ,UAM1D,oBALuB,EAAiB,UAAY,EAAQ,QAAU,IAAA,GAMtE,eAAgB,EAAiB,YACjC,GAAI,EAAQ,UACZ,KAAM,EAAQ,IACf,EACA,WAAY,EAAiB,UAC9B,CACD"}
|
package/dist/field.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { t as WithAsChild } from "./as-child-
|
|
2
|
-
import { n as IconButtonProps } from "./icon-button-
|
|
3
|
-
import { a as ValidationState, c as parseValidation, i as ValidationProp, l as resolveValidation, n as ParsedValidation, o as WithValidation, r as Validation, s as isAriaInvalid, t as AriaInvalid } from "./validation-
|
|
4
|
-
import { t as Slot } from "./index-
|
|
5
|
-
import * as _$react from "react";
|
|
1
|
+
import { t as WithAsChild } from "./as-child-uN_018tj.js";
|
|
2
|
+
import { n as IconButtonProps } from "./icon-button-ntupABbM.js";
|
|
3
|
+
import { a as ValidationState, c as parseValidation, i as ValidationProp, l as resolveValidation, n as ParsedValidation, o as WithValidation, r as Validation, s as isAriaInvalid, t as AriaInvalid } from "./validation-xyX_6kph.js";
|
|
4
|
+
import { t as Slot } from "./index-BL5WVva_.js";
|
|
6
5
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
7
|
-
import * as _$_radix_ui_react_popover0 from "@radix-ui/react-popover";
|
|
8
6
|
|
|
9
7
|
//#region src/components/field/field-context.d.ts
|
|
10
8
|
/**
|
|
@@ -227,7 +225,7 @@ declare const Field: {
|
|
|
227
225
|
* </Field.Group>
|
|
228
226
|
* ```
|
|
229
227
|
*/
|
|
230
|
-
readonly Item:
|
|
228
|
+
readonly Item: import("react").ForwardRefExoticComponent<Omit<FieldItemProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
231
229
|
/**
|
|
232
230
|
* Applies generated field ARIA props and validation state to a single
|
|
233
231
|
* focusable control. Accepts either a single React element child (cloned
|
|
@@ -267,7 +265,7 @@ declare const Field: {
|
|
|
267
265
|
* </Field.Item>
|
|
268
266
|
* ```
|
|
269
267
|
*/
|
|
270
|
-
readonly Control:
|
|
268
|
+
readonly Control: import("react").ForwardRefExoticComponent<(Omit<FieldControlElementProps, "ref"> | Omit<FieldControlRenderProps, "ref">) & import("react").RefAttributes<HTMLElement>>;
|
|
271
269
|
/**
|
|
272
270
|
* Layout container that stacks multiple `Field.Item`s vertically.
|
|
273
271
|
*
|
|
@@ -295,7 +293,7 @@ declare const Field: {
|
|
|
295
293
|
* </Field.Group>
|
|
296
294
|
* ```
|
|
297
295
|
*/
|
|
298
|
-
readonly Group:
|
|
296
|
+
readonly Group: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
299
297
|
/**
|
|
300
298
|
* Semantic `<fieldset>` for related controls that share one accessible
|
|
301
299
|
* name from `Field.Legend`.
|
|
@@ -313,7 +311,7 @@ declare const Field: {
|
|
|
313
311
|
* </Field.Set>
|
|
314
312
|
* ```
|
|
315
313
|
*/
|
|
316
|
-
readonly Set:
|
|
314
|
+
readonly Set: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & import("react").RefAttributes<HTMLFieldSetElement>>;
|
|
317
315
|
/**
|
|
318
316
|
* Caption for `Field.Set`. Renders a semantic `<legend>`.
|
|
319
317
|
*
|
|
@@ -330,7 +328,7 @@ declare const Field: {
|
|
|
330
328
|
* </Field.Set>
|
|
331
329
|
* ```
|
|
332
330
|
*/
|
|
333
|
-
readonly Legend:
|
|
331
|
+
readonly Legend: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, "ref"> & import("react").RefAttributes<HTMLLegendElement>>;
|
|
334
332
|
/**
|
|
335
333
|
* The Mantle `Label`, exposed on `Field` for field composition. Inside a
|
|
336
334
|
* `Field.Item`, `htmlFor` defaults to the same stable id that `Field.Control`
|
|
@@ -365,9 +363,9 @@ declare const Field: {
|
|
|
365
363
|
* </Field.Group>
|
|
366
364
|
* ```
|
|
367
365
|
*/
|
|
368
|
-
readonly Label:
|
|
366
|
+
readonly Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
|
|
369
367
|
disabled?: boolean;
|
|
370
|
-
} &
|
|
368
|
+
} & import("react").RefAttributes<HTMLLabelElement>, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
371
369
|
/**
|
|
372
370
|
* Static, label-styled text for a `Field.Item` row that has no focusable
|
|
373
371
|
* control to caption. Renders a `<p>` with the same typography as
|
|
@@ -389,7 +387,7 @@ declare const Field: {
|
|
|
389
387
|
* </Field.Item>
|
|
390
388
|
* ```
|
|
391
389
|
*/
|
|
392
|
-
readonly LabelText:
|
|
390
|
+
readonly LabelText: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLParagraphElement> & import("react").HTMLAttributes<HTMLParagraphElement> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
393
391
|
/**
|
|
394
392
|
* Horizontal layout container for the label area of a field. Aligns a
|
|
395
393
|
* `<Field.Label>` (which may contain `Field.Optional`) with adjacent affordances
|
|
@@ -419,7 +417,7 @@ declare const Field: {
|
|
|
419
417
|
* </Field.Group>
|
|
420
418
|
* ```
|
|
421
419
|
*/
|
|
422
|
-
readonly LabelRow:
|
|
420
|
+
readonly LabelRow: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
423
421
|
/**
|
|
424
422
|
* `Popover.Root` re-export for the help-affordance pattern. Pair with
|
|
425
423
|
* `Field.HelpTrigger` and `Field.HelpContent` to drop a `?` button next to
|
|
@@ -449,7 +447,7 @@ declare const Field: {
|
|
|
449
447
|
* </Field.Group>
|
|
450
448
|
* ```
|
|
451
449
|
*/
|
|
452
|
-
readonly Help:
|
|
450
|
+
readonly Help: import("react").FC<import("@radix-ui/react-popover").PopoverProps>;
|
|
453
451
|
/**
|
|
454
452
|
* Trigger for a `Field.Help` popover — a ghost `IconButton` with a default
|
|
455
453
|
* `QuestionIcon`. Requires a contextual `label`; pass `icon` to swap the
|
|
@@ -479,13 +477,13 @@ declare const Field: {
|
|
|
479
477
|
* </Field.Group>
|
|
480
478
|
* ```
|
|
481
479
|
*/
|
|
482
|
-
readonly HelpTrigger:
|
|
480
|
+
readonly HelpTrigger: import("react").ForwardRefExoticComponent<Partial<Omit<IconButtonProps, "label" | "icon">> & Pick<IconButtonProps, "label"> & {
|
|
483
481
|
/**
|
|
484
482
|
* The icon to render inside the trigger button. Defaults to a Phosphor
|
|
485
483
|
* `QuestionIcon` so the most common case only needs a contextual label.
|
|
486
484
|
*/
|
|
487
485
|
icon?: ReactNode;
|
|
488
|
-
} &
|
|
486
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
489
487
|
/**
|
|
490
488
|
* Body of a `Field.Help` popover. Re-exports `Popover.Content` so all
|
|
491
489
|
* positioning / sizing options (`side`, `align`, `preferredWidth`, etc.)
|
|
@@ -515,9 +513,9 @@ declare const Field: {
|
|
|
515
513
|
* </Field.Group>
|
|
516
514
|
* ```
|
|
517
515
|
*/
|
|
518
|
-
readonly HelpContent:
|
|
516
|
+
readonly HelpContent: import("react").ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-popover").PopoverContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
519
517
|
preferredWidth?: `max-w-${string}`;
|
|
520
|
-
} &
|
|
518
|
+
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
521
519
|
/**
|
|
522
520
|
* Inline "(Optional)" suffix to mark a field as optional. Default content
|
|
523
521
|
* is `(Optional)`; pass children to translate or replace it. Place inside
|
|
@@ -548,7 +546,7 @@ declare const Field: {
|
|
|
548
546
|
* </Field.Group>
|
|
549
547
|
* ```
|
|
550
548
|
*/
|
|
551
|
-
readonly Optional:
|
|
549
|
+
readonly Optional: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
552
550
|
/**
|
|
553
551
|
* Helper / hint text rendered below the control in the muted body color.
|
|
554
552
|
*
|
|
@@ -576,7 +574,7 @@ declare const Field: {
|
|
|
576
574
|
* </Field.Group>
|
|
577
575
|
* ```
|
|
578
576
|
*/
|
|
579
|
-
readonly Description:
|
|
577
|
+
readonly Description: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "id"> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
580
578
|
/**
|
|
581
579
|
* Convenience renderer for validation messages. Trims string messages,
|
|
582
580
|
* filters empty values, and renders a `Field.ErrorList` with one
|
|
@@ -606,7 +604,7 @@ declare const Field: {
|
|
|
606
604
|
* </Field.Group>
|
|
607
605
|
* ```
|
|
608
606
|
*/
|
|
609
|
-
readonly Errors:
|
|
607
|
+
readonly Errors: import("react").ForwardRefExoticComponent<Omit<FieldErrorsProps, "ref"> & import("react").RefAttributes<HTMLUListElement>>;
|
|
610
608
|
/**
|
|
611
609
|
* Wraps one or more `Field.ErrorItem` children in a semantic `<ul>`.
|
|
612
610
|
* Renders nothing when given no renderable children.
|
|
@@ -630,7 +628,7 @@ declare const Field: {
|
|
|
630
628
|
* </Field.Group>
|
|
631
629
|
* ```
|
|
632
630
|
*/
|
|
633
|
-
readonly ErrorList:
|
|
631
|
+
readonly ErrorList: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "id"> & WithAsChild, "ref"> & import("react").RefAttributes<HTMLUListElement>>;
|
|
634
632
|
/**
|
|
635
633
|
* A single error message list item for a field. Renders an `<li>` in
|
|
636
634
|
* `text-danger-600` and must be nested inside a `Field.ErrorList`.
|
|
@@ -654,7 +652,7 @@ declare const Field: {
|
|
|
654
652
|
* </Field.Group>
|
|
655
653
|
* ```
|
|
656
654
|
*/
|
|
657
|
-
readonly ErrorItem:
|
|
655
|
+
readonly ErrorItem: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
|
|
658
656
|
};
|
|
659
657
|
//#endregion
|
|
660
658
|
//#region src/components/field/field-error-messages.d.ts
|
package/dist/field.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./cx-
|
|
1
|
+
import{t as e}from"./cx-CBSnSC36.js";import{t}from"./slot-CV5fmqFr.js";import{t as n}from"./icon-button-C_Ht_g1C.js";import{i as r,n as i,r as a,t as o}from"./validation-DCyx-ceH.js";import{t as s}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{t as c}from"./label-DhIUmTN2.js";import{t as l}from"./popover-DponNBot.js";import{n as u,r as d,t as f}from"./field-context-4k1kI7Bo.js";import{Children as p,Fragment as m,cloneElement as h,forwardRef as g,isValidElement as _,useCallback as v,useContext as y,useId as b,useMemo as x,useState as S}from"react";import C from"tiny-invariant";import{jsx as w}from"react/jsx-runtime";import{QuestionIcon as T}from"@phosphor-icons/react/Question";const E=e=>{let t=[],n=new Set;for(let r of e??[]){if(typeof r!=`string`)continue;let e=r.trim();e.length===0||n.has(e)||(n.add(e),t.push(e))}return t},D=e=>!(e==null||typeof e==`boolean`||typeof e==`string`&&e.trim().length===0),O=({children:e,errorItemType:t})=>{let n=!1;return p.forEach(e,e=>{if(!(n||e==null||typeof e==`boolean`)){if(typeof e==`string`){e.trim().length>0&&(n=!0);return}if(!_(e)){n=!0;return}if(e.type===t){n=D(e.props.children);return}if(e.type===m){n=O({children:e.props.children,errorItemType:t});return}n=!0}}),n},k=g(({className:t,...n},r)=>w(`fieldset`,{ref:r,"data-slot":`field-set`,className:e(`flex w-full min-w-0 flex-col gap-4 border-0 p-0`,t),...n}));k.displayName=`FieldSet`;const A=g(({className:t,...n},r)=>w(`legend`,{ref:r,"data-slot":`field-legend`,className:e(`text-strong mb-1.5 text-sm font-medium font-sans`,t),...n}));A.displayName=`FieldLegend`;const j=g(({htmlFor:e,...t},n)=>{let r=y(u);return w(c,{ref:n,htmlFor:e??r?.controlId,...t})});j.displayName=`FieldLabel`;const M=g(({asChild:n,className:r,...i},a)=>w(n?t:`p`,{ref:a,"data-slot":`field-label-text`,className:e(`text-strong text-sm font-medium font-sans`,r),...i}));M.displayName=`FieldLabelText`;const N=g(({asChild:n,className:r,...i},a)=>w(n?t:`div`,{ref:a,"data-slot":`field-label-row`,className:e(`flex items-center gap-1`,r),...i}));N.displayName=`FieldLabelRow`;const P=l.Root,F=w(T,{}),I=g(({appearance:t=`ghost`,className:r,icon:i=F,label:a,size:o=`xs`,type:s=`button`,...c},u)=>w(l.Trigger,{asChild:!0,children:w(n,{ref:u,appearance:t,className:e(`text-body -my-0.5`,r),icon:i,label:a,size:o,type:s,...c})}));I.displayName=`FieldHelpTrigger`;const L=g((e,t)=>w(l.Content,{ref:t,"data-slot":`field-help-content`,...e}));L.displayName=`FieldHelpContent`;const R=g(({asChild:n,children:r,className:i,...a},o)=>w(n?t:`span`,{ref:o,"data-slot":`field-optional`,className:e(`text-muted text-sm font-normal font-sans`,i),...a,children:r??`(Optional)`}));R.displayName=`FieldOptional`;const z=g(({asChild:n,className:r,...i},a)=>w(n?t:`div`,{ref:a,"data-slot":`field-group`,className:e(`flex w-full flex-col gap-4`,r),...i}));z.displayName=`FieldGroup`;const B=g(({asChild:n,children:i,className:a,name:s,validation:c,...l},d)=>{let f=n?t:`div`,p=b(),m=b(),h=b(),[g,_]=S(!1),y=r(c??(g?`error`:void 0)),C=v(()=>(_(!0),()=>{_(!1)}),[]),T=x(()=>({controlId:p,descriptionId:m,errorId:h,hasErrors:g,name:s,registerError:C,validation:y}),[p,m,h,g,s,C,y]);return w(u.Provider,{value:T,children:w(o,{validation:y,children:w(f,{ref:d,"data-slot":`field-item`,"data-validation":y,className:e(`flex w-full flex-col gap-1.5`,a),...l,children:i})})})});B.displayName=`FieldItem`;const V=g(({children:e,...n},r)=>{let i=y(u),a=d({context:i});return typeof e==`function`?w(o,{validation:a.validation,children:w(f.Provider,{value:i?a.ariaProps:null,children:e(a.ariaProps)})}):(C(_(e),`Field.Control expects a single React element child (or a render-prop function). Got a non-element value (string, array, fragment, null, or undefined). Wrap the control in a single element, or use the function child form: <Field.Control>{(props) => <YourControl {...props} />}</Field.Control>.`),w(o,{validation:a.validation,children:w(f.Provider,{value:i?a.ariaProps:null,children:w(t,{ref:r,...n,children:h(e,a.ariaProps)})})}))});V.displayName=`FieldControl`;const H=g(({asChild:n,className:r,...i},a)=>w(n?t:`p`,{ref:a,"data-slot":`field-description`,id:y(u)?.descriptionId,className:e(`text-body text-sm leading-4`,`[:where([data-slot=field-error-list]+&)]:-mt-1.5`,r),...i}));H.displayName=`FieldDescription`;const U=g(({children:t,className:n,...r},i)=>D(t)?w(`li`,{ref:i,"data-slot":`field-error`,className:e(`text-danger-600 text-sm leading-4`,n),...r,children:t}):null);U.displayName=`FieldErrorItem`;const W=g(({messages:e,...t},n)=>w(G,{ref:n,...t,children:E(e).map(e=>w(U,{children:e},e))}));W.displayName=`FieldErrors`;const G=g(({asChild:n,children:r,className:i,...a},o)=>{let c=O({children:r,errorItemType:U}),l=y(u),d=l?.registerError;return s(()=>{if(!(!c||d==null))return d()},[c,d]),c?w(n?t:`ul`,{ref:o,"data-slot":`field-error-list`,id:l?.errorId,role:`list`,className:e(`m-0 flex w-full flex-col list-none p-0`,i),...a,children:r}):null});G.displayName=`FieldErrorList`;const K={Item:B,Control:V,Group:z,Set:k,Legend:A,Label:j,LabelText:M,LabelRow:N,Help:P,HelpTrigger:I,HelpContent:L,Optional:R,Description:H,Errors:W,ErrorList:G,ErrorItem:U},q=e=>E(e?.map(e=>typeof e==`string`||!e?e:e.message));export{K as Field,i as isAriaInvalid,a as parseValidation,r as resolveValidation,q as toErrorMessages};
|
|
2
2
|
//# sourceMappingURL=field.js.map
|