@ngrok/mantle 0.93.7 → 0.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/accordion.d.ts +73 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1234 -84
- package/dist/alert-BkJHDx9X.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-D0zRRUHV.d.ts} +35 -25
- package/dist/alert-center.d.ts +67 -55
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +35 -10
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-Dc6IgvXV.js +1 -0
- package/dist/anchor.d.ts +17 -5
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +33 -18
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +153 -97
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +36 -24
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +19 -7
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +155 -100
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +47 -36
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CZfkNw5A.js +1 -0
- package/dist/browser-only-ymFoM3Ya.js +1 -0
- package/dist/browser-only.d.ts +8 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-BX-4lYUn.d.ts → button-5Pc7Mby_.d.ts} +4 -4
- package/dist/button-B9bChDgl.js +1 -0
- package/dist/button-D8jixIbH.js +1 -0
- package/dist/button-DNLTJ32M.js +1 -0
- package/dist/{button-CPsKGDK0.d.ts → button-Ddj6yr10.d.ts} +34 -27
- package/dist/{button-Yxyu1XMd.d.ts → button-DnYv7IOT.d.ts} +29 -22
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +8 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +7 -2
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +34 -23
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BLCqzt56.js +1 -0
- package/dist/chart-CChZiCrt.js +1 -0
- package/dist/chart-CUmSu9d7.js +1 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-Dl8gFo_D.d.ts} +117 -121
- package/dist/chart-DtgZBAas.js +2 -0
- package/dist/checkbox-Cu5cgZmk.js +1 -0
- package/dist/checkbox.d.ts +15 -2
- package/dist/checkbox.js +1 -1
- package/dist/choice-CCVG2hb9.js +1 -0
- package/dist/{choice-BLR0_MeB.d.ts → choice-CNiOSzqV.d.ts} +26 -20
- package/dist/choice.d.ts +6 -1
- package/dist/choice.js +1 -1
- package/dist/code-BPKNY1_w.js +1 -0
- package/dist/{code-block-BGdV4Yty.d.ts → code-block-BDw6MEwH.d.ts} +9 -9
- package/dist/{code-block-W3kWPxCJ.js → code-block-CKzsAMzj.js} +3 -3
- package/dist/code-block.d.ts +28 -19
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +6 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +16 -3
- package/dist/code.js +1 -1
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +42 -28
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +59 -47
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdRUneoc.js +1 -0
- package/dist/{copy-to-clipboard-DInu78k_.js → copy-to-clipboard-Dd83caRw.js} +1 -1
- package/dist/cx.d.ts +4 -4
- package/dist/cx.js +1 -1
- package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
- package/dist/data-table.d.ts +83 -52
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +13 -2
- package/dist/description-list.js +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-CIEuwNys.d.ts} +32 -8
- package/dist/dialog-CbEEA0fl.d.ts +32 -0
- package/dist/dialog-DmzoDfY3.js +1 -0
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-CeY498yk.d.ts} +41 -33
- package/dist/dropdown-menu-uheL0prz.js +1 -0
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -2
- package/dist/empty.js +1 -1
- package/dist/field-Bpvn4tQp.js +1 -0
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field-Cai_4c1l.js +1 -0
- package/dist/field.d.ts +53 -42
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +11 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +35 -10
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +25 -14
- package/dist/hover-card.js +1 -1
- package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
- package/dist/{icon-ByLVhdYq.d.ts → icon-DuIYoyft.d.ts} +8 -2
- package/dist/{icon-DXDyhy2N.d.ts → icon-QCm1ui29.d.ts} +2 -2
- package/dist/icon-xb7d9M7X.js +1 -0
- package/dist/icon.d.ts +8 -3
- package/dist/icon.js +1 -1
- package/dist/icons-DEDCLZ8B.js +1 -0
- package/dist/icons-DXadFwpo.js +1 -0
- package/dist/icons-DcesO4Ng.js +1 -0
- package/dist/icons.d.ts +13 -1
- package/dist/icons.js +1 -1
- package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-DC4nW0Sr.d.ts} +12 -2
- package/dist/input-fW8QSZEO.js +1 -0
- package/dist/input.d.ts +37 -5
- package/dist/input.js +1 -1
- package/dist/kbd-P1nQshWo.js +1 -0
- package/dist/kbd.d.ts +17 -5
- package/dist/kbd.js +1 -1
- package/dist/label-DO1RlMKl.js +1 -0
- package/dist/{label-Dn5CPJUj.d.ts → label-epgtywRz.d.ts} +14 -8
- package/dist/label.d.ts +6 -1
- package/dist/label.js +1 -1
- package/dist/layer-container-DL4yclOu.js +1 -0
- package/dist/layer-container.d.ts +2 -2
- package/dist/layer-container.js +1 -1
- package/dist/line-chart.d.ts +147 -90
- package/dist/line-chart.js +1 -1
- package/dist/list-cQZPSjfz.js +1 -0
- package/dist/list.d.ts +34 -16
- package/dist/list.js +1 -1
- package/dist/live-region-Dhapu8a5.js +1 -0
- package/dist/live-region.d.ts +15 -2
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +82 -79
- package/dist/main-CHyWYDak.js +1 -0
- package/dist/main.d.ts +13 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +133 -88
- package/dist/media-object.d.ts +16 -4
- package/dist/media-object.js +1 -1
- package/dist/migrations/0014-chart-named-colors.yml +1389 -0
- package/dist/migrations/0015-segmented-control.yml +788 -0
- package/dist/multi-select.d.ts +42 -29
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +20 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +93 -4
- package/dist/pagination.js +1 -1
- package/dist/{popover-BfB2I9G0.d.ts → popover-Bei0jyfH.d.ts} +87 -12
- package/dist/popover-DhgunktK.js +1 -0
- package/dist/popover-T2EyaqGK.d.ts +1 -0
- package/dist/popover.d.ts +7 -2
- package/dist/popover.js +1 -1
- package/dist/primitive-D8CzV_Ft.js +1 -0
- package/dist/progress.d.ts +28 -11
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +11 -3
- package/dist/qr-code.js +1 -1
- package/dist/query-filter.d.ts +6 -6
- package/dist/query.d.ts +9 -4
- package/dist/query.js +1 -1
- package/dist/radio-group-BJQ6EOqh.d.ts +27 -0
- package/dist/radio-group-BliblUqe.js +1 -0
- package/dist/radio-group-ggEkCi0V.js +1 -0
- package/dist/radio-group.d.ts +21 -100
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +43 -30
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +137 -76
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +136 -0
- package/dist/segmented-control.js +1 -0
- package/dist/select-1xuUx_os.js +1 -0
- package/dist/{select-BkhBxtOT.d.ts → select-BpaXHxJm.d.ts} +33 -25
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +29 -18
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-Ck4sPrdN.d.ts} +4 -2
- package/dist/separator-DnvhwY2J.js +1 -0
- package/dist/separator.d.ts +6 -1
- package/dist/separator.js +1 -1
- package/dist/{shake-DL6WhMXM.js → shake-CAUpKBHe.js} +1 -1
- package/dist/sheet-DHy_vlme.js +1 -0
- package/dist/sheet.d.ts +36 -7
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +53 -37
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DHfyjuQi.js +1 -0
- package/dist/skeleton.d.ts +15 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +12 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +11 -1
- package/dist/slider.js +1 -1
- package/dist/slot-B7rwscwd.js +1 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-BEMQMbk3.d.ts} +6 -4
- package/dist/slot.d.ts +6 -1
- package/dist/slot.js +1 -1
- package/dist/source-all.css +5 -1
- package/dist/split-button.d.ts +20 -9
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +35 -22
- package/dist/strata.js +1 -1
- package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
- package/dist/switch.d.ts +14 -2
- package/dist/switch.js +1 -1
- package/dist/table-BnLdXUai.js +1 -0
- package/dist/{table-vT6Okwfa.d.ts → table-Ii9hHUWN.d.ts} +84 -5
- package/dist/table.d.ts +6 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +24 -12
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +12 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-BNdZl352.js +1 -0
- package/dist/theme-switcher.d.ts +18 -4
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +25 -11
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +15 -2
- package/dist/toast.js +1 -1
- package/dist/tokens.dark.json +3261 -0
- package/dist/tokens.json +4933 -0
- package/dist/tokens.resolver.json +37 -0
- package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CstGDKwy.d.ts} +18 -11
- package/dist/tooltip-DQO40Mrq.js +1 -0
- package/dist/tooltip.d.ts +6 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +28 -14
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/use-breakpoint-B4Kh0xE6.js +1 -0
- package/dist/use-callback-ref-DiOXFQzM.js +1 -0
- package/dist/use-composed-refs-DPYmLDSe.js +1 -0
- package/dist/use-copy-to-clipboard-hBL6_65i.js +1 -0
- package/dist/use-inert-siblings-C4RHXrZc.js +1 -0
- package/dist/use-is-apple-platform-Bq6_KbVX.js +1 -0
- package/dist/use-is-hydrated-BeLOGKwE.js +1 -0
- package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +1 -0
- package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +1 -0
- package/dist/use-matches-media-query-FfvtNKQe.js +1 -0
- package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +1 -0
- package/dist/use-swipe-to-dismiss-BYdlca8r.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +14 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +7 -2
- package/dist/well.js +1 -1
- package/package.json +21 -7
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.js +0 -1
- package/dist/anchor-CgcbWEUs.js +0 -1
- package/dist/browser-only-BTSrYWLj.js +0 -1
- package/dist/button-69InNC_m.js +0 -1
- package/dist/button-B8k98Pby.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/checkbox-DmSQXs26.js +0 -1
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/code-DUJzSl4K.js +0 -1
- package/dist/compose-refs-sFdxsL7k.js +0 -1
- package/dist/dialog-7TUgiSzX.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
- package/dist/field-Bihblt8U.js +0 -1
- package/dist/field-CPvjazWN.js +0 -1
- package/dist/icon-kK0c-POG.js +0 -1
- package/dist/icons-CDLz5lpI.js +0 -1
- package/dist/icons-CSwTVV2m.js +0 -1
- package/dist/icons-DP3lQw5O.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/kbd-CLHsJ99p.js +0 -1
- package/dist/label-nHqqYS7e.js +0 -1
- package/dist/layer-container-kEQiE4zV.js +0 -1
- package/dist/list-RFRIQxU2.js +0 -1
- package/dist/live-region-DQ1QLv3L.js +0 -1
- package/dist/main-CC1L9IsH.js +0 -1
- package/dist/popover-C96V8SXi.d.ts +0 -1
- package/dist/popover-DxOqLKxy.js +0 -1
- package/dist/primitive-Dz9Al-us.js +0 -1
- package/dist/radio-group-HDVxTNPi.js +0 -1
- package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/separator-DfzxVutO.js +0 -1
- package/dist/sheet-CSJc_sB4.js +0 -1
- package/dist/skeleton-DBpI-ko5.js +0 -1
- package/dist/slot-DdYN1L1C.js +0 -1
- package/dist/table-CFHiDBW8.js +0 -1
- package/dist/theme-C-glc5Q-.js +0 -1
- package/dist/tooltip-b6oiTaWq.js +0 -1
- package/dist/use-breakpoint--mo7kr9d.js +0 -1
- package/dist/use-callback-ref-BvVyI5K1.js +0 -1
- package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +0 -1
- package/dist/use-is-apple-platform-D4nifHMx.js +0 -1
- package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +0 -1
- package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +0 -1
- package/dist/use-matches-media-query-m860lols.js +0 -1
- package/dist/use-prefers-reduced-motion-CU6mWmOe.js +0 -1
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
package/dist/field.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Field component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/field
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance } from "./button-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { t as Slot } from "./slot-
|
|
7
|
-
import { t as Popover } from "./popover-
|
|
8
|
-
import "./
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance } from "./button-DnYv7IOT.js";
|
|
9
|
+
import { t as Label } from "./label-epgtywRz.js";
|
|
10
|
+
import "./popover-T2EyaqGK.js";
|
|
11
|
+
import { t as Slot } from "./slot-BEMQMbk3.js";
|
|
12
|
+
import { t as Popover } from "./popover-Bei0jyfH.js";
|
|
13
|
+
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 "./field-BshcNVe_.js";
|
|
9
14
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
10
15
|
/**
|
|
11
16
|
* ARIA and identity props that `Field.Control` applies to the field's
|
|
@@ -48,7 +53,7 @@ type FieldErrorMessage = string | null | undefined | false;
|
|
|
48
53
|
* `Field.Legend` and `Field.Group`. Always renders a real `<fieldset>` so
|
|
49
54
|
* the grouping semantics cannot be accidentally removed.
|
|
50
55
|
*
|
|
51
|
-
* Reach for `Field.Set` when the grouping carries semantic weight
|
|
56
|
+
* Reach for `Field.Set` when the grouping carries semantic weight: most
|
|
52
57
|
* commonly a `RadioGroup` (where the legend names the question the radios
|
|
53
58
|
* answer) or a set of related checkboxes. For laying out unrelated fields
|
|
54
59
|
* with consistent spacing, prefer `Field.Group` on its own.
|
|
@@ -74,7 +79,7 @@ declare const FieldSet: ({ "data-slot": dataSlot, className, ref, ...props }: Co
|
|
|
74
79
|
* (e.g. "Notification frequency, group, Daily").
|
|
75
80
|
*
|
|
76
81
|
* **Spacing.** Has a default `mb-1.5` so the legend sits 6px above the next
|
|
77
|
-
* sibling
|
|
82
|
+
* sibling, as in the figma. We use a margin (not the parent `Field.Set`'s
|
|
78
83
|
* flex `gap`) because `<legend>` has special browser rendering inside a
|
|
79
84
|
* `<fieldset>` that ignores the parent's flex `gap`. Override the default
|
|
80
85
|
* with any `mb-*` utility on `Field.Legend`.
|
|
@@ -92,7 +97,7 @@ declare const FieldSet: ({ "data-slot": dataSlot, className, ref, ...props }: Co
|
|
|
92
97
|
* </Field.Set>
|
|
93
98
|
* ```
|
|
94
99
|
*/
|
|
95
|
-
declare const Legend: ({ className, ref, ...props }: ComponentProps<"legend">) => import("react").JSX.Element;
|
|
100
|
+
declare const Legend: ({ className, "data-slot": dataSlot, ref, ...props }: ComponentProps<"legend"> & WithDataSlot) => import("react").JSX.Element;
|
|
96
101
|
/**
|
|
97
102
|
* Props for `Field.Label`: the Mantle `Label` props without `htmlFor`.
|
|
98
103
|
*/
|
|
@@ -140,7 +145,7 @@ type FieldLabelProps = Omit<ComponentProps<typeof Label>, "htmlFor">;
|
|
|
140
145
|
* </Field.Item>
|
|
141
146
|
* ```
|
|
142
147
|
*/
|
|
143
|
-
declare const FieldLabel: ({ ref, ...props }: FieldLabelProps) => import("react").JSX.Element;
|
|
148
|
+
declare const FieldLabel: ({ "data-slot": dataSlot, ref, ...props }: FieldLabelProps) => import("react").JSX.Element;
|
|
144
149
|
/**
|
|
145
150
|
* Static, label-styled text for a `Field.Item` row that does **not** caption a
|
|
146
151
|
* focusable form control. Renders a `<p>` (not a `<label>`) with the same
|
|
@@ -155,15 +160,15 @@ declare const FieldLabel: ({ ref, ...props }: FieldLabelProps) => import("react"
|
|
|
155
160
|
* - Read-only summary rows inside a sheet or detail panel that should
|
|
156
161
|
* visually align with sibling `Field.Item`s but have no editable control.
|
|
157
162
|
* - Anywhere you would otherwise hand-roll a `<p>` styled to mimic
|
|
158
|
-
* `Field.Label` typography
|
|
163
|
+
* `Field.Label` typography. Prefer this so intent is explicit at the call site.
|
|
159
164
|
*
|
|
160
165
|
* **When not to use**
|
|
161
166
|
* - The row has a focusable control (input, select, checkbox, switch,
|
|
162
167
|
* button trigger). Use `Field.Label` so the click-to-focus and
|
|
163
168
|
* accessible-name association are wired correctly.
|
|
164
169
|
* - For body copy, section headings, or any text whose typography happens
|
|
165
|
-
* to look similar by accident
|
|
166
|
-
* directly. `Field.LabelText` exists specifically to slot into the
|
|
170
|
+
* to look similar by accident. Use the appropriate heading or `<p>`
|
|
171
|
+
* directly instead. `Field.LabelText` exists specifically to slot into the
|
|
167
172
|
* `Field.Label` position of a `Field.Item`.
|
|
168
173
|
*
|
|
169
174
|
* @see https://mantle.ngrok.com/components/forms/field
|
|
@@ -182,15 +187,15 @@ declare const LabelText: ({ "data-slot": dataSlot, asChild, className, ref, ...p
|
|
|
182
187
|
* Horizontal layout container for the label area of a field. Aligns a
|
|
183
188
|
* `<Field.Label>` (which may contain `Field.Optional`) with adjacent affordances
|
|
184
189
|
* like a help-icon `Popover.Trigger` on a shared center line with a tight
|
|
185
|
-
* `gap-1`. Center-alignment is used (not baseline) so SVG icon buttons
|
|
186
|
-
* which have no text baseline
|
|
190
|
+
* `gap-1`. Center-alignment is used (not baseline) so SVG icon buttons,
|
|
191
|
+
* which have no text baseline, sit visually centered next to the label
|
|
187
192
|
* text rather than dropping to the box bottom.
|
|
188
193
|
*
|
|
189
194
|
* Use this when the label needs sibling decorations that can't live inside
|
|
190
|
-
* the `<Field.Label>` itself (e.g. an interactive help button
|
|
195
|
+
* the `<Field.Label>` itself (e.g. an interactive help button: clicking inside a
|
|
191
196
|
* `<label>` would forward focus to the associated control). For a label
|
|
192
197
|
* with only an `(Optional)` suffix, place `Field.Optional` directly inside
|
|
193
|
-
* the `<Field.Label>` instead
|
|
198
|
+
* the `<Field.Label>` instead, with no `LabelRow`.
|
|
194
199
|
*
|
|
195
200
|
* @see https://mantle.ngrok.com/components/forms/field
|
|
196
201
|
*
|
|
@@ -223,9 +228,9 @@ declare const LabelRow: ({ "data-slot": dataSlot, asChild, className, ref, ...pr
|
|
|
223
228
|
*/
|
|
224
229
|
type FieldHelpTriggerProps = Partial<Omit<IconButtonProps, "appearance" | "icon" | "intent" | "label">> & Pick<IconButtonProps, "label"> & {
|
|
225
230
|
/**
|
|
226
|
-
* The visual style of the trigger button. Optional here
|
|
227
|
-
*
|
|
228
|
-
*
|
|
231
|
+
* The visual style of the trigger button. Optional here: `Field.HelpTrigger`
|
|
232
|
+
* defaults to `"ghost"` so the help affordance reads as subtle metadata
|
|
233
|
+
* next to the label.
|
|
229
234
|
*
|
|
230
235
|
* @default "ghost"
|
|
231
236
|
*/
|
|
@@ -236,7 +241,7 @@ type FieldHelpTriggerProps = Partial<Omit<IconButtonProps, "appearance" | "icon"
|
|
|
236
241
|
*/
|
|
237
242
|
icon?: ReactNode;
|
|
238
243
|
/**
|
|
239
|
-
* The tone of the trigger button. Optional here
|
|
244
|
+
* The tone of the trigger button. Optional here: `Field.HelpTrigger`
|
|
240
245
|
* defaults to `"neutral"` because opening contextual help is a routine
|
|
241
246
|
* action, and it is the only tone `IconButton` draws.
|
|
242
247
|
*
|
|
@@ -245,7 +250,7 @@ type FieldHelpTriggerProps = Partial<Omit<IconButtonProps, "appearance" | "icon"
|
|
|
245
250
|
intent?: IconButtonIntent;
|
|
246
251
|
};
|
|
247
252
|
/**
|
|
248
|
-
* The trigger for a `Field.Help` popover
|
|
253
|
+
* The trigger for a `Field.Help` popover: a `Popover.Trigger` wired to a
|
|
249
254
|
* ghost-appearance `IconButton` with a default Phosphor `QuestionIcon`.
|
|
250
255
|
* Requires a contextual screen-reader label, and accepts `icon` or other
|
|
251
256
|
* `IconButton` props for visual customization.
|
|
@@ -254,7 +259,7 @@ type FieldHelpTriggerProps = Partial<Omit<IconButtonProps, "appearance" | "icon"
|
|
|
254
259
|
* subtle metadata at rest; `IconButton`'s ghost `hover:text-strong` still
|
|
255
260
|
* brightens it on interaction. Carries a default `-my-0.5` so the 24px
|
|
256
261
|
* `xs` button keeps a full click target while contributing only 20px to
|
|
257
|
-
* the `Field.LabelRow` flex line
|
|
262
|
+
* the `Field.LabelRow` flex line. That matches the label's text line-height,
|
|
258
263
|
* so the label text is not pushed off-center.
|
|
259
264
|
*
|
|
260
265
|
* @see https://mantle.ngrok.com/components/forms/field
|
|
@@ -281,7 +286,7 @@ type FieldHelpTriggerProps = Partial<Omit<IconButtonProps, "appearance" | "icon"
|
|
|
281
286
|
* </Field.Group>
|
|
282
287
|
* ```
|
|
283
288
|
*/
|
|
284
|
-
declare const HelpTrigger: ({ appearance, className, icon, intent, label, ref, size, type, ...props }: FieldHelpTriggerProps) => import("react").JSX.Element;
|
|
289
|
+
declare const HelpTrigger: ({ appearance, className, "data-slot": dataSlot, icon, intent, label, ref, size, type, ...props }: FieldHelpTriggerProps) => import("react").JSX.Element;
|
|
285
290
|
/**
|
|
286
291
|
* The popover body for a `Field.Help`. Wraps `Popover.Content` so all
|
|
287
292
|
* positioning / sizing options (`side`, `align`, `preferredWidth`, etc.)
|
|
@@ -317,7 +322,7 @@ declare const HelpContent: ({ "data-slot": dataSlot, ref, ...props }: ComponentP
|
|
|
317
322
|
/**
|
|
318
323
|
* Inline "(Optional)" suffix to mark a field as optional. Defaults to the
|
|
319
324
|
* literal string `(Optional)` so the common case is `<Field.Optional />` with
|
|
320
|
-
* no children
|
|
325
|
+
* no children. Pass children to translate or replace the text. Renders a
|
|
321
326
|
* `<span>` in `text-muted` at `text-sm` / `font-normal` so it reads as
|
|
322
327
|
* secondary metadata next to the bolder Label text.
|
|
323
328
|
*
|
|
@@ -352,8 +357,8 @@ declare const HelpContent: ({ "data-slot": dataSlot, ref, ...props }: ComponentP
|
|
|
352
357
|
declare const Optional: ({ "data-slot": dataSlot, asChild, children, className, ref, ...props }: ComponentProps<"span"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
353
358
|
/**
|
|
354
359
|
* Layout container that stacks multiple `Field.Item`s vertically with
|
|
355
|
-
* `gap-4` between them. This is the default way to compose multiple fields
|
|
356
|
-
*
|
|
360
|
+
* `gap-4` between them. This is the default way to compose multiple fields:
|
|
361
|
+
* most forms only need a `Field.Group` of `Field.Item`s. Reach for
|
|
357
362
|
* `Field.Set` + `Field.Legend` only when the grouping carries semantic
|
|
358
363
|
* weight (e.g. a `RadioGroup` or related checkboxes).
|
|
359
364
|
*
|
|
@@ -402,12 +407,12 @@ type FieldItemProps = Omit<ComponentProps<"div">, "id"> & WithAsChild & WithVali
|
|
|
402
407
|
name: string;
|
|
403
408
|
} & WithDataSlot;
|
|
404
409
|
/**
|
|
405
|
-
* A single form field
|
|
410
|
+
* A single form field: `Label`, a control (`Input`, `Select`, `Checkbox`,
|
|
406
411
|
* etc.), and any `Field.Description`, `Field.Errors`, or `Field.ErrorList` siblings stacked
|
|
407
412
|
* vertically with a consistent `gap-1.5` so help and error messaging sit
|
|
408
413
|
* tightly under the input.
|
|
409
414
|
*
|
|
410
|
-
* Renders a plain `<div
|
|
415
|
+
* Renders a plain `<div>`: the `<label htmlFor>` ↔ control association
|
|
411
416
|
* already carries the right semantics for a single field, so it adds no
|
|
412
417
|
* implicit `role`. `Field.Item` owns the contextual description/error IDs
|
|
413
418
|
* that `Field.Control` applies to the focusable control. Rendered errors
|
|
@@ -461,7 +466,7 @@ declare const Item: ({ "data-slot": dataSlot, asChild, children, className, id:
|
|
|
461
466
|
type FieldControlSlotProps = Omit<ComponentProps<typeof Slot>, "aria-describedby" | "aria-errormessage" | "aria-invalid" | "children" | "id">;
|
|
462
467
|
/**
|
|
463
468
|
* Element-child form of `Field.Control`. Renders via `Slot`, so it accepts
|
|
464
|
-
* any HTML/Slot props, including `ref
|
|
469
|
+
* any HTML/Slot props, including `ref`. Those land on the single child
|
|
465
470
|
* element along with the generated ARIA props. `id` is not a prop here;
|
|
466
471
|
* `Field.Item` owns the control id.
|
|
467
472
|
*/
|
|
@@ -473,7 +478,7 @@ type FieldControlElementProps = FieldControlSlotProps & {
|
|
|
473
478
|
};
|
|
474
479
|
/**
|
|
475
480
|
* Render-prop form of `Field.Control`. The caller owns the rendered element,
|
|
476
|
-
* so `Field.Control` itself renders nothing
|
|
481
|
+
* so `Field.Control` itself renders nothing. Extra DOM props and `ref` have
|
|
477
482
|
* no element to attach to and are intentionally not part of this variant.
|
|
478
483
|
* Slot props are marked `never` so passing e.g. `className` alongside a
|
|
479
484
|
* render-prop child is a type error rather than a silently ignored prop.
|
|
@@ -490,24 +495,24 @@ type FieldControlRenderProps = {
|
|
|
490
495
|
* Props for `Field.Control`. A discriminated union over how the caller
|
|
491
496
|
* supplies the focusable element:
|
|
492
497
|
*
|
|
493
|
-
* - `FieldControlElementProps
|
|
498
|
+
* - `FieldControlElementProps`: pass a single React element child and
|
|
494
499
|
* `Field.Control` clones the generated ARIA props onto it via `Slot`.
|
|
495
500
|
* Accepts the full Slot prop surface, including `ref`.
|
|
496
|
-
* - `FieldControlRenderProps
|
|
501
|
+
* - `FieldControlRenderProps`: pass a render function that receives the
|
|
497
502
|
* ARIA props and places them on a control of the caller's choosing. The
|
|
498
503
|
* caller owns the rendered element, so DOM/Slot props and `ref` are
|
|
499
504
|
* excluded from this variant at the type level.
|
|
500
505
|
*
|
|
501
506
|
* @example
|
|
502
507
|
* ```tsx
|
|
503
|
-
* // Element form
|
|
508
|
+
* // Element form: Slot splats id, name, and ARIA props onto <Input/>
|
|
504
509
|
* <Field.Item name="email">
|
|
505
510
|
* <Field.Control>
|
|
506
511
|
* <Input type="email" />
|
|
507
512
|
* </Field.Control>
|
|
508
513
|
* </Field.Item>
|
|
509
514
|
*
|
|
510
|
-
* // Render-prop form
|
|
515
|
+
* // Render-prop form: caller spreads the props onto its own element
|
|
511
516
|
* <Field.Item name="acceptTerms">
|
|
512
517
|
* <Field.Control>
|
|
513
518
|
* {(controlProps) => (
|
|
@@ -530,7 +535,7 @@ type FieldControlProps = FieldControlElementProps | FieldControlRenderProps;
|
|
|
530
535
|
* composition; otherwise use the render-prop form to place the generated props
|
|
531
536
|
* on the actual focusable element.
|
|
532
537
|
*
|
|
533
|
-
* `Field.Item` owns the full control contract
|
|
538
|
+
* `Field.Item` owns the full control contract: `id`, `name`, `aria-*`, and
|
|
534
539
|
* `validation` all flow down from the surrounding `Field.Item` and overwrite
|
|
535
540
|
* anything passed on the child. To override these values, set them on
|
|
536
541
|
* `Field.Item` itself (`<Field.Item id="password">`,
|
|
@@ -575,7 +580,7 @@ declare const Control: ({ children, ref, ...props }: FieldControlProps) => impor
|
|
|
575
580
|
* `Field.Errors` or `Field.ErrorList` output, the parent's `gap-1.5`
|
|
576
581
|
* collapses via a matching negative top margin so error list + helper read as
|
|
577
582
|
* one tight block. Pass any margin utility (`mt-1`, `mt-0`, etc.) to override
|
|
578
|
-
*
|
|
583
|
+
* it. The rule's specificity is flattened to `(0,1,0)`, so a single user class wins.
|
|
579
584
|
*
|
|
580
585
|
* @see https://mantle.ngrok.com/components/forms/field
|
|
581
586
|
*
|
|
@@ -734,6 +739,12 @@ declare const FieldErrorList: ({ "data-slot": dataSlot, asChild, children, class
|
|
|
734
739
|
* `Field.Group`; use `Field.Set` + `Field.Legend` for radios / related
|
|
735
740
|
* checkboxes that share one accessible name.
|
|
736
741
|
*
|
|
742
|
+
* @useWhen Group one form control with its label, its description, and its validation errors.
|
|
743
|
+
*
|
|
744
|
+
* @siblings
|
|
745
|
+
* - `Label`: the control needs only a caption, with no description or errors.
|
|
746
|
+
* - `Choice`: a checkbox, a radio, or a switch sits beside a title and a description.
|
|
747
|
+
*
|
|
737
748
|
* @see https://mantle.ngrok.com/components/forms/field
|
|
738
749
|
*
|
|
739
750
|
* @example
|
|
@@ -814,7 +825,7 @@ declare const Field: {
|
|
|
814
825
|
* Applies generated field ARIA props and validation state to a single
|
|
815
826
|
* focusable control. Accepts either a single React element child (cloned
|
|
816
827
|
* via `Slot`) or a render-prop child that receives the ARIA props for
|
|
817
|
-
* cases where `Slot` cannot reach the focusable element
|
|
828
|
+
* cases where `Slot` cannot reach the focusable element, for example a
|
|
818
829
|
* `<label>`-wrapped native checkbox, or a third-party component that
|
|
819
830
|
* needs the props placed manually on an inner input.
|
|
820
831
|
*
|
|
@@ -822,7 +833,7 @@ declare const Field: {
|
|
|
822
833
|
*
|
|
823
834
|
* @example
|
|
824
835
|
* ```tsx
|
|
825
|
-
* // Element child
|
|
836
|
+
* // Element child: Slot splats id, name, and ARIA props onto <Input/>.
|
|
826
837
|
* <Field.Item name="apiKey">
|
|
827
838
|
* <Field.Label>API key</Field.Label>
|
|
828
839
|
* <Field.Control>
|
|
@@ -834,7 +845,7 @@ declare const Field: {
|
|
|
834
845
|
*
|
|
835
846
|
* @example
|
|
836
847
|
* ```tsx
|
|
837
|
-
* // Render-prop child
|
|
848
|
+
* // Render-prop child: caller spreads the props onto an inner element
|
|
838
849
|
* // when the focusable target is nested (e.g. inside a <label>).
|
|
839
850
|
* <Field.Item name="acceptTerms">
|
|
840
851
|
* <Field.Control>
|
|
@@ -1029,7 +1040,7 @@ declare const Field: {
|
|
|
1029
1040
|
*/
|
|
1030
1041
|
readonly Help: import("react").FC<import("@radix-ui/react-popover").PopoverProps>;
|
|
1031
1042
|
/**
|
|
1032
|
-
* Trigger for a `Field.Help` popover
|
|
1043
|
+
* Trigger for a `Field.Help` popover: a ghost `IconButton` with a default
|
|
1033
1044
|
* `QuestionIcon`. Requires a contextual `label`; pass `icon` to swap the
|
|
1034
1045
|
* glyph, or other `IconButton` props (`size`, `appearance`, etc.) to customize.
|
|
1035
1046
|
*
|
package/dist/field.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./slot-DdYN1L1C.js";import{t as i}from"./button-B8k98Pby.js";import{i as a,n as o,r as s,t as c}from"./field-CPvjazWN.js";import{n as l,r as u,t as d}from"./field-Bihblt8U.js";import{t as f}from"./label-nHqqYS7e.js";import{t as p}from"./popover-DxOqLKxy.js";import{c as m}from"react/compiler-runtime";import{Children as h,Fragment as g,cloneElement as _,isValidElement as v,useContext as y,useId as b,useState as x}from"react";import S from"tiny-invariant";import{jsx as C}from"react/jsx-runtime";import{QuestionIcon as w}from"@phosphor-icons/react/Question";const T=e=>{let t=[],n=/* @__PURE__ */ 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},E=e=>!(e==null||typeof e==`boolean`||typeof e==`string`&&e.trim().length===0),D=({children:e,errorItemType:t})=>{let n=!1;return h.forEach(e,e=>{n||e==null||typeof e==`boolean`||(typeof e==`string`?e.trim().length>0&&(n=!0):n=v(e)?e.type===t?E(e.props.children):e.type!==g||D({children:e.props.children,errorItemType:t}):!0)}),n},O=e=>{let r=m(14),i,a,o,s;r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4]):({"data-slot":a,className:i,ref:s,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c;r[5]===a?c=r[6]:(c=n(a,`field-set`),r[5]=a,r[6]=c);let l;r[7]===i?l=r[8]:(l=t(`flex w-full min-w-0 flex-col gap-4 border-0 p-0`,i),r[7]=i,r[8]=l);let u;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(u=/* @__PURE__ */ C(`fieldset`,{ref:s,"data-slot":c,className:l,...o}),r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=u):u=r[13],u},k=e=>{let n=m(10),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,ref:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===r?o=n[5]:(o=t(`text-strong mb-1.5 text-sm font-medium font-sans`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==a||n[8]!==o?(s=/* @__PURE__ */ C(`legend`,{ref:a,"data-slot":`field-legend`,className:o,...i}),n[6]=i,n[7]=a,n[8]=o,n[9]=s):s=n[9],s},A=e=>{let t=m(7),n,r;t[0]===e?(n=t[1],r=t[2]):({ref:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=y(l)?.controlId,a;return t[3]!==n||t[4]!==r||t[5]!==i?(a=/* @__PURE__ */ C(f,{ref:r,...n,htmlFor:i}),t[3]=n,t[4]=r,t[5]=i,t[6]=a):a=t[6],a},j=e=>{let i=m(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({"data-slot":s,asChild:a,className:o,ref:l,...c}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`p`,d;i[6]===s?d=i[7]:(d=n(s,`field-label-text`),i[6]=s,i[7]=d);let f;i[8]===o?f=i[9]:(f=t(`text-strong text-sm font-medium font-sans`,o),i[8]=o,i[9]=f);let p;return i[10]!==u||i[11]!==c||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ C(u,{ref:l,"data-slot":d,className:f,...c}),i[10]=u,i[11]=c,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},M=e=>{let i=m(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({"data-slot":s,asChild:a,className:o,ref:l,...c}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===s?d=i[7]:(d=n(s,`field-label-row`),i[6]=s,i[7]=d);let f;i[8]===o?f=i[9]:(f=t(`flex items-center gap-1`,o),i[8]=o,i[9]=f);let p;return i[10]!==u||i[11]!==c||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ C(u,{ref:l,"data-slot":d,className:f,...c}),i[10]=u,i[11]=c,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},N=p.Root,P=/* @__PURE__ */ C(w,{}),F=e=>{let n=m(22),r,a,o,s,c,l,u,d,f;n[0]===e?(r=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=n[8],f=n[9]):({appearance:c,className:r,icon:l,intent:u,label:a,ref:s,size:d,type:f,...o}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o,n[4]=s,n[5]=c,n[6]=l,n[7]=u,n[8]=d,n[9]=f);let h=c===void 0?`ghost`:c,g=l===void 0?P:l,_=u===void 0?`neutral`:u,v=d===void 0?`xs`:d,y=f===void 0?`button`:f,b;n[10]===r?b=n[11]:(b=t(`text-body -my-0.5`,r),n[10]=r,n[11]=b);let x;return n[12]!==h||n[13]!==g||n[14]!==_||n[15]!==a||n[16]!==o||n[17]!==s||n[18]!==v||n[19]!==b||n[20]!==y?(x=/* @__PURE__ */ C(p.Trigger,{asChild:!0,children:/* @__PURE__ */ C(i,{ref:s,appearance:h,className:b,icon:g,intent:_,label:a,size:v,type:y,...o})}),n[12]=h,n[13]=g,n[14]=_,n[15]=a,n[16]=o,n[17]=s,n[18]=v,n[19]=b,n[20]=y,n[21]=x):x=n[21],x},I=e=>{let t=m(10),r,i,a;t[0]===e?(r=t[1],i=t[2],a=t[3]):({"data-slot":r,ref:a,...i}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a);let o;t[4]===r?o=t[5]:(o=n(r,`field-help-content`),t[4]=r,t[5]=o);let s;return t[6]!==i||t[7]!==a||t[8]!==o?(s=/* @__PURE__ */ C(p.Content,{ref:a,"data-slot":o,...i}),t[6]=i,t[7]=a,t[8]=o,t[9]=s):s=t[9],s},L=e=>{let i=m(18),a,o,s,c,l,u;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({"data-slot":c,asChild:a,children:o,className:s,ref:u,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let d=a?r:`span`,f;i[7]===c?f=i[8]:(f=n(c,`field-optional`),i[7]=c,i[8]=f);let p;i[9]===s?p=i[10]:(p=t(`text-muted text-sm font-normal font-sans`,s),i[9]=s,i[10]=p);let h=o??`(Optional)`,g;return i[11]!==d||i[12]!==l||i[13]!==u||i[14]!==f||i[15]!==p||i[16]!==h?(g=/* @__PURE__ */ C(d,{ref:u,"data-slot":f,className:p,...l,children:h}),i[11]=d,i[12]=l,i[13]=u,i[14]=f,i[15]=p,i[16]=h,i[17]=g):g=i[17],g},R=e=>{let i=m(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({"data-slot":s,asChild:a,className:o,ref:l,...c}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===s?d=i[7]:(d=n(s,`field-group`),i[6]=s,i[7]=d);let f;i[8]===o?f=i[9]:(f=t(`flex w-full flex-col gap-4`,o),i[8]=o,i[9]=f);let p;return i[10]!==u||i[11]!==c||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ C(u,{ref:l,"data-slot":d,className:f,...c}),i[10]=u,i[11]=c,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},z=e=>{let i=m(37),o,s,u,d,f,p,h,g,_;i[0]===e?(o=i[1],s=i[2],u=i[3],d=i[4],f=i[5],p=i[6],h=i[7],g=i[8],_=i[9]):({"data-slot":d,asChild:o,children:s,className:u,id:f,name:p,ref:g,validation:_,...h}=e,i[0]=e,i[1]=o,i[2]=s,i[3]=u,i[4]=d,i[5]=f,i[6]=p,i[7]=h,i[8]=g,i[9]=_);let v=o?r:`div`,y=b(),S=f??y,w=b(),T=b(),[E,D]=x(!1),O=_??(E?`error`:void 0),k;i[10]===O?k=i[11]:(k=a(O),i[10]=O,i[11]=k);let A=k,j;i[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>(D(!0),()=>{D(!1)}),i[12]=j):j=i[12];let M=j,N;i[13]!==S||i[14]!==w||i[15]!==T||i[16]!==p||i[17]!==A?(N={controlId:S,descriptionId:w,errorId:T,name:p,registerError:M,validation:A},i[13]=S,i[14]=w,i[15]=T,i[16]=p,i[17]=A,i[18]=N):N=i[18];let P=N,F;i[19]===d?F=i[20]:(F=n(d,`field-item`),i[19]=d,i[20]=F);let I;i[21]===u?I=i[22]:(I=t(`flex w-full flex-col gap-1.5`,u),i[21]=u,i[22]=I);let L;i[23]!==v||i[24]!==s||i[25]!==h||i[26]!==g||i[27]!==F||i[28]!==I||i[29]!==A?(L=/* @__PURE__ */ C(v,{ref:g,"data-slot":F,"data-validation":A,className:I,...h,children:s}),i[23]=v,i[24]=s,i[25]=h,i[26]=g,i[27]=F,i[28]=I,i[29]=A,i[30]=L):L=i[30];let R;i[31]!==L||i[32]!==A?(R=/* @__PURE__ */ C(c,{validation:A,children:L}),i[31]=L,i[32]=A,i[33]=R):R=i[33];let z;return i[34]!==P||i[35]!==R?(z=/* @__PURE__ */ C(l.Provider,{value:P,children:R}),i[34]=P,i[35]=R,i[36]=z):z=i[36],z},B=e=>{let t=m(30),n,i,a;t[0]===e?(n=t[1],i=t[2],a=t[3]):({children:n,ref:a,...i}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a);let o=y(l),s,f,p,h,g,b,x,w,T;if(t[4]!==n||t[5]!==o||t[6]!==i||t[7]!==a){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u({context:o});if(typeof n==`function`){T=/* @__PURE__ */ C(c,{validation:e.validation,children:/* @__PURE__ */ C(d.Provider,{value:o?e.ariaProps:null,children:n(e.ariaProps)})});break bb0}S(v(n),`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>.`),p=c,w=e.validation,f=d.Provider,x=o?e.ariaProps:null,s=r,h=a,g=i,b=_(n,e.ariaProps)}t[4]=n,t[5]=o,t[6]=i,t[7]=a,t[8]=s,t[9]=f,t[10]=p,t[11]=h,t[12]=g,t[13]=b,t[14]=x,t[15]=w,t[16]=T}else s=t[8],f=t[9],p=t[10],h=t[11],g=t[12],b=t[13],x=t[14],w=t[15],T=t[16];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let E;t[17]!==s||t[18]!==h||t[19]!==g||t[20]!==b?(E=/* @__PURE__ */ C(s,{ref:h,...g,children:b}),t[17]=s,t[18]=h,t[19]=g,t[20]=b,t[21]=E):E=t[21];let D;t[22]!==f||t[23]!==x||t[24]!==E?(D=/* @__PURE__ */ C(f,{value:x,children:E}),t[22]=f,t[23]=x,t[24]=E,t[25]=D):D=t[25];let O;return t[26]!==p||t[27]!==w||t[28]!==D?(O=/* @__PURE__ */ C(p,{validation:w,children:D}),t[26]=p,t[27]=w,t[28]=D,t[29]=O):O=t[29],O},V=e=>{let i=m(17),a,o,s,c,u;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],u=i[5]):({"data-slot":s,asChild:a,className:o,ref:u,...c}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=u);let d=a?r:`p`,f=y(l),p;i[6]===s?p=i[7]:(p=n(s,`field-description`),i[6]=s,i[7]=p);let h=f?.descriptionId,g;i[8]===o?g=i[9]:(g=t(`text-body text-sm leading-4`,`[:where([data-slot=field-error-list]+&)]:-mt-1.5`,o),i[8]=o,i[9]=g);let _;return i[10]!==d||i[11]!==c||i[12]!==u||i[13]!==p||i[14]!==h||i[15]!==g?(_=/* @__PURE__ */ C(d,{ref:u,"data-slot":p,id:h,className:g,...c}),i[10]=d,i[11]=c,i[12]=u,i[13]=p,i[14]=h,i[15]=g,i[16]=_):_=i[16],_},H=e=>{let r=m(16),i,a,o,s,c;if(r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":o,children:i,className:a,ref:c,...s}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c),!E(i))return null;let l;r[6]===o?l=r[7]:(l=n(o,`field-error`),r[6]=o,r[7]=l);let u;r[8]===a?u=r[9]:(u=t(`text-danger-600 text-sm leading-4`,a),r[8]=a,r[9]=u);let d;return r[10]!==i||r[11]!==s||r[12]!==c||r[13]!==l||r[14]!==u?(d=/* @__PURE__ */ C(`li`,{ref:c,"data-slot":l,className:u,...s,children:i}),r[10]=i,r[11]=s,r[12]=c,r[13]=l,r[14]=u,r[15]=d):d=r[15],d},U=e=>{let t=m(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({messages:n,ref:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=T(n).map(K),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=/* @__PURE__ */ C(W,{ref:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},W=i=>{let a=m(25),o,s,c,u,d,f;a[0]===i?(o=a[1],s=a[2],c=a[3],u=a[4],d=a[5],f=a[6]):({"data-slot":u,asChild:o,children:s,className:c,ref:f,...d}=i,a[0]=i,a[1]=o,a[2]=s,a[3]=c,a[4]=u,a[5]=d,a[6]=f);let p;a[7]===s?p=a[8]:(p=D({children:s,errorItemType:H}),a[7]=s,a[8]=p);let h=p,g=y(l),_=g?.registerError,v,b;if(a[9]!==h||a[10]!==_?(v=()=>{if(h&&_!=null)return _()},b=[h,_],a[9]=h,a[10]=_,a[11]=v,a[12]=b):(v=a[11],b=a[12]),e(v,b),!h)return null;let x=o?r:`ul`,S;a[13]===u?S=a[14]:(S=n(u,`field-error-list`),a[13]=u,a[14]=S);let w=g?.errorId,T;a[15]===c?T=a[16]:(T=t(`m-0 flex w-full flex-col list-none p-0`,c),a[15]=c,a[16]=T);let E;return a[17]!==x||a[18]!==s||a[19]!==d||a[20]!==f||a[21]!==S||a[22]!==w||a[23]!==T?(E=/* @__PURE__ */ C(x,{ref:f,"data-slot":S,id:w,role:`list`,className:T,...d,children:s}),a[17]=x,a[18]=s,a[19]=d,a[20]=f,a[21]=S,a[22]=w,a[23]=T,a[24]=E):E=a[24],E},G={Item:z,Control:B,Group:R,Set:O,Legend:k,Label:A,LabelText:j,LabelRow:M,Help:N,HelpTrigger:F,HelpContent:I,Optional:L,Description:V,Errors:U,ErrorList:W,ErrorItem:H};function K(e){return/* @__PURE__ */ C(H,{children:e},e)}const q=e=>T(e?.map(e=>typeof e==`string`||!e?e:e.message));export{G as Field,o as isAriaInvalid,s as parseValidation,a as resolveValidation,q as toErrorMessages};
|
|
1
|
+
"use client";import{t as e}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./button-B9bChDgl.js";import{t as i}from"./label-DO1RlMKl.js";import{t as a}from"./popover-DhgunktK.js";import{t as o}from"./slot-B7rwscwd.js";import{n as s,r as c,t as l}from"./field-Cai_4c1l.js";import{i as u,n as d,r as f,t as p}from"./field-Bpvn4tQp.js";import{c as m}from"react/compiler-runtime";import{Children as h,Fragment as g,cloneElement as _,isValidElement as v,useContext as y,useId as b,useState as x}from"react";import S from"tiny-invariant";import{jsx as C}from"react/jsx-runtime";import{QuestionIcon as w}from"@phosphor-icons/react/Question";const T=e=>{let t=[],n=/* @__PURE__ */ 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},E=e=>!(e==null||typeof e==`boolean`||typeof e==`string`&&e.trim().length===0),D=({children:e,errorItemType:t})=>{let n=!1;return h.forEach(e,e=>{n||e==null||typeof e==`boolean`||(typeof e==`string`?e.trim().length>0&&(n=!0):n=v(e)?e.type===t?E(e.props.children):e.type!==g||D({children:e.props.children,errorItemType:t}):!0)}),n},O=e=>{let r=m(14),i,a,o,s;r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4]):({"data-slot":a,className:i,ref:s,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c;r[5]===a?c=r[6]:(c=n(a,`field-set`),r[5]=a,r[6]=c);let l;r[7]===i?l=r[8]:(l=t(`flex w-full min-w-0 flex-col gap-4 border-0 p-0`,i),r[7]=i,r[8]=l);let u;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(u=/* @__PURE__ */ C(`fieldset`,{ref:s,"data-slot":c,className:l,...o}),r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=u):u=r[13],u},k=e=>{let r=m(14),i,a,o,s;r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4]):({className:i,"data-slot":a,ref:s,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c;r[5]===a?c=r[6]:(c=n(a,`field-legend`),r[5]=a,r[6]=c);let l;r[7]===i?l=r[8]:(l=t(`text-strong mb-1.5 text-sm font-medium font-sans`,i),r[7]=i,r[8]=l);let u;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(u=/* @__PURE__ */ C(`legend`,{ref:s,"data-slot":c,className:l,...o}),r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=u):u=r[13],u},A=e=>{let t=m(11),r,a,o;t[0]===e?(r=t[1],a=t[2],o=t[3]):({"data-slot":r,ref:o,...a}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=o);let c=y(s),l;t[4]===r?l=t[5]:(l=n(r,`field-label`),t[4]=r,t[5]=l);let u=c?.controlId,d;return t[6]!==a||t[7]!==o||t[8]!==l||t[9]!==u?(d=/* @__PURE__ */ C(i,{ref:o,"data-slot":l,...a,htmlFor:u}),t[6]=a,t[7]=o,t[8]=l,t[9]=u,t[10]=d):d=t[10],d},j=e=>{let r=m(16),i,a,s,c,l;r[0]===e?(i=r[1],a=r[2],s=r[3],c=r[4],l=r[5]):({"data-slot":s,asChild:i,className:a,ref:l,...c}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=s,r[4]=c,r[5]=l);let u=i?o:`p`,d;r[6]===s?d=r[7]:(d=n(s,`field-label-text`),r[6]=s,r[7]=d);let f;r[8]===a?f=r[9]:(f=t(`text-strong text-sm font-medium font-sans`,a),r[8]=a,r[9]=f);let p;return r[10]!==u||r[11]!==c||r[12]!==l||r[13]!==d||r[14]!==f?(p=/* @__PURE__ */ C(u,{ref:l,"data-slot":d,className:f,...c}),r[10]=u,r[11]=c,r[12]=l,r[13]=d,r[14]=f,r[15]=p):p=r[15],p},M=e=>{let r=m(16),i,a,s,c,l;r[0]===e?(i=r[1],a=r[2],s=r[3],c=r[4],l=r[5]):({"data-slot":s,asChild:i,className:a,ref:l,...c}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=s,r[4]=c,r[5]=l);let u=i?o:`div`,d;r[6]===s?d=r[7]:(d=n(s,`field-label-row`),r[6]=s,r[7]=d);let f;r[8]===a?f=r[9]:(f=t(`flex items-center gap-1`,a),r[8]=a,r[9]=f);let p;return r[10]!==u||r[11]!==c||r[12]!==l||r[13]!==d||r[14]!==f?(p=/* @__PURE__ */ C(u,{ref:l,"data-slot":d,className:f,...c}),r[10]=u,r[11]=c,r[12]=l,r[13]=d,r[14]=f,r[15]=p):p=r[15],p},N=a.Root,P=/* @__PURE__ */ C(w,{}),F=e=>{let i=m(28),o,s,c,l,u,d,f,p,h,g;i[0]===e?(o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],h=i[9],g=i[10]):({appearance:d,className:o,"data-slot":s,icon:f,intent:p,label:c,ref:u,size:h,type:g,...l}=e,i[0]=e,i[1]=o,i[2]=s,i[3]=c,i[4]=l,i[5]=u,i[6]=d,i[7]=f,i[8]=p,i[9]=h,i[10]=g);let _=d===void 0?`ghost`:d,v=f===void 0?P:f,y=p===void 0?`neutral`:p,b=h===void 0?`xs`:h,x=g===void 0?`button`:g,S;i[11]===s?S=i[12]:(S=n(s,`field-help-trigger`),i[11]=s,i[12]=S);let w;i[13]===o?w=i[14]:(w=t(`text-body -my-0.5`,o),i[13]=o,i[14]=w);let T;i[15]!==_||i[16]!==v||i[17]!==y||i[18]!==c||i[19]!==l||i[20]!==u||i[21]!==b||i[22]!==w||i[23]!==x?(T=/* @__PURE__ */ C(r,{ref:u,appearance:_,className:w,icon:v,intent:y,label:c,size:b,type:x,...l}),i[15]=_,i[16]=v,i[17]=y,i[18]=c,i[19]=l,i[20]=u,i[21]=b,i[22]=w,i[23]=x,i[24]=T):T=i[24];let E;return i[25]!==S||i[26]!==T?(E=/* @__PURE__ */ C(a.Trigger,{asChild:!0,"data-slot":S,children:T}),i[25]=S,i[26]=T,i[27]=E):E=i[27],E},I=e=>{let t=m(10),r,i,o;t[0]===e?(r=t[1],i=t[2],o=t[3]):({"data-slot":r,ref:o,...i}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=o);let s;t[4]===r?s=t[5]:(s=n(r,`field-help-content`),t[4]=r,t[5]=s);let c;return t[6]!==i||t[7]!==o||t[8]!==s?(c=/* @__PURE__ */ C(a.Content,{ref:o,"data-slot":s,...i}),t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c},L=e=>{let r=m(18),i,a,s,c,l,u;r[0]===e?(i=r[1],a=r[2],s=r[3],c=r[4],l=r[5],u=r[6]):({"data-slot":c,asChild:i,children:a,className:s,ref:u,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=s,r[4]=c,r[5]=l,r[6]=u);let d=i?o:`span`,f;r[7]===c?f=r[8]:(f=n(c,`field-optional`),r[7]=c,r[8]=f);let p;r[9]===s?p=r[10]:(p=t(`text-muted text-sm font-normal font-sans`,s),r[9]=s,r[10]=p);let h=a??`(Optional)`,g;return r[11]!==d||r[12]!==l||r[13]!==u||r[14]!==f||r[15]!==p||r[16]!==h?(g=/* @__PURE__ */ C(d,{ref:u,"data-slot":f,className:p,...l,children:h}),r[11]=d,r[12]=l,r[13]=u,r[14]=f,r[15]=p,r[16]=h,r[17]=g):g=r[17],g},R=e=>{let r=m(16),i,a,s,c,l;r[0]===e?(i=r[1],a=r[2],s=r[3],c=r[4],l=r[5]):({"data-slot":s,asChild:i,className:a,ref:l,...c}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=s,r[4]=c,r[5]=l);let u=i?o:`div`,d;r[6]===s?d=r[7]:(d=n(s,`field-group`),r[6]=s,r[7]=d);let f;r[8]===a?f=r[9]:(f=t(`flex w-full flex-col gap-4`,a),r[8]=a,r[9]=f);let p;return r[10]!==u||r[11]!==c||r[12]!==l||r[13]!==d||r[14]!==f?(p=/* @__PURE__ */ C(u,{ref:l,"data-slot":d,className:f,...c}),r[10]=u,r[11]=c,r[12]=l,r[13]=d,r[14]=f,r[15]=p):p=r[15],p},z=e=>{let r=m(37),i,a,c,l,d,f,h,g,_;r[0]===e?(i=r[1],a=r[2],c=r[3],l=r[4],d=r[5],f=r[6],h=r[7],g=r[8],_=r[9]):({"data-slot":l,asChild:i,children:a,className:c,id:d,name:f,ref:g,validation:_,...h}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=c,r[4]=l,r[5]=d,r[6]=f,r[7]=h,r[8]=g,r[9]=_);let v=i?o:`div`,y=b(),S=d??y,w=b(),T=b(),[E,D]=x(!1),O=_??(E?`error`:void 0),k;r[10]===O?k=r[11]:(k=u(O),r[10]=O,r[11]=k);let A=k,j;r[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>(D(!0),()=>{D(!1)}),r[12]=j):j=r[12];let M=j,N;r[13]!==S||r[14]!==w||r[15]!==T||r[16]!==f||r[17]!==A?(N={controlId:S,descriptionId:w,errorId:T,name:f,registerError:M,validation:A},r[13]=S,r[14]=w,r[15]=T,r[16]=f,r[17]=A,r[18]=N):N=r[18];let P=N,F;r[19]===l?F=r[20]:(F=n(l,`field-item`),r[19]=l,r[20]=F);let I;r[21]===c?I=r[22]:(I=t(`flex w-full flex-col gap-1.5`,c),r[21]=c,r[22]=I);let L;r[23]!==v||r[24]!==a||r[25]!==h||r[26]!==g||r[27]!==F||r[28]!==I||r[29]!==A?(L=/* @__PURE__ */ C(v,{ref:g,"data-slot":F,"data-validation":A,className:I,...h,children:a}),r[23]=v,r[24]=a,r[25]=h,r[26]=g,r[27]=F,r[28]=I,r[29]=A,r[30]=L):L=r[30];let R;r[31]!==L||r[32]!==A?(R=/* @__PURE__ */ C(p,{validation:A,children:L}),r[31]=L,r[32]=A,r[33]=R):R=r[33];let z;return r[34]!==P||r[35]!==R?(z=/* @__PURE__ */ C(s.Provider,{value:P,children:R}),r[34]=P,r[35]=R,r[36]=z):z=r[36],z},B=e=>{let t=m(30),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,ref:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=y(s),u,d,f,h,g,b,x,w,T;if(t[4]!==n||t[5]!==a||t[6]!==r||t[7]!==i){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c({context:a});if(typeof n==`function`){T=/* @__PURE__ */ C(p,{validation:e.validation,children:/* @__PURE__ */ C(l.Provider,{value:a?e.ariaProps:null,children:n(e.ariaProps)})});break bb0}S(v(n),`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>.`),f=p,w=e.validation,d=l.Provider,x=a?e.ariaProps:null,u=o,h=i,g=r,b=_(n,e.ariaProps)}t[4]=n,t[5]=a,t[6]=r,t[7]=i,t[8]=u,t[9]=d,t[10]=f,t[11]=h,t[12]=g,t[13]=b,t[14]=x,t[15]=w,t[16]=T}else u=t[8],d=t[9],f=t[10],h=t[11],g=t[12],b=t[13],x=t[14],w=t[15],T=t[16];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let E;t[17]!==u||t[18]!==h||t[19]!==g||t[20]!==b?(E=/* @__PURE__ */ C(u,{ref:h,...g,children:b}),t[17]=u,t[18]=h,t[19]=g,t[20]=b,t[21]=E):E=t[21];let D;t[22]!==d||t[23]!==x||t[24]!==E?(D=/* @__PURE__ */ C(d,{value:x,children:E}),t[22]=d,t[23]=x,t[24]=E,t[25]=D):D=t[25];let O;return t[26]!==f||t[27]!==w||t[28]!==D?(O=/* @__PURE__ */ C(f,{validation:w,children:D}),t[26]=f,t[27]=w,t[28]=D,t[29]=O):O=t[29],O},V=e=>{let r=m(17),i,a,c,l,u;r[0]===e?(i=r[1],a=r[2],c=r[3],l=r[4],u=r[5]):({"data-slot":c,asChild:i,className:a,ref:u,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=c,r[4]=l,r[5]=u);let d=i?o:`p`,f=y(s),p;r[6]===c?p=r[7]:(p=n(c,`field-description`),r[6]=c,r[7]=p);let h=f?.descriptionId,g;r[8]===a?g=r[9]:(g=t(`text-body text-sm leading-4`,`[:where([data-slot=field-error-list]+&)]:-mt-1.5`,a),r[8]=a,r[9]=g);let _;return r[10]!==d||r[11]!==l||r[12]!==u||r[13]!==p||r[14]!==h||r[15]!==g?(_=/* @__PURE__ */ C(d,{ref:u,"data-slot":p,id:h,className:g,...l}),r[10]=d,r[11]=l,r[12]=u,r[13]=p,r[14]=h,r[15]=g,r[16]=_):_=r[16],_},H=e=>{let r=m(16),i,a,o,s,c;if(r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":o,children:i,className:a,ref:c,...s}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c),!E(i))return null;let l;r[6]===o?l=r[7]:(l=n(o,`field-error`),r[6]=o,r[7]=l);let u;r[8]===a?u=r[9]:(u=t(`text-danger-600 text-sm leading-4`,a),r[8]=a,r[9]=u);let d;return r[10]!==i||r[11]!==s||r[12]!==c||r[13]!==l||r[14]!==u?(d=/* @__PURE__ */ C(`li`,{ref:c,"data-slot":l,className:u,...s,children:i}),r[10]=i,r[11]=s,r[12]=c,r[13]=l,r[14]=u,r[15]=d):d=r[15],d},U=e=>{let t=m(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({messages:n,ref:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=T(n).map(K),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=/* @__PURE__ */ C(W,{ref:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},W=r=>{let i=m(25),a,c,l,u,d,f;i[0]===r?(a=i[1],c=i[2],l=i[3],u=i[4],d=i[5],f=i[6]):({"data-slot":u,asChild:a,children:c,className:l,ref:f,...d}=r,i[0]=r,i[1]=a,i[2]=c,i[3]=l,i[4]=u,i[5]=d,i[6]=f);let p;i[7]===c?p=i[8]:(p=D({children:c,errorItemType:H}),i[7]=c,i[8]=p);let h=p,g=y(s),_=g?.registerError,v,b;if(i[9]!==h||i[10]!==_?(v=()=>{if(h&&_!=null)return _()},b=[h,_],i[9]=h,i[10]=_,i[11]=v,i[12]=b):(v=i[11],b=i[12]),e(v,b),!h)return null;let x=a?o:`ul`,S;i[13]===u?S=i[14]:(S=n(u,`field-error-list`),i[13]=u,i[14]=S);let w=g?.errorId,T;i[15]===l?T=i[16]:(T=t(`m-0 flex w-full flex-col list-none p-0`,l),i[15]=l,i[16]=T);let E;return i[17]!==x||i[18]!==c||i[19]!==d||i[20]!==f||i[21]!==S||i[22]!==w||i[23]!==T?(E=/* @__PURE__ */ C(x,{ref:f,"data-slot":S,id:w,role:`list`,className:T,...d,children:c}),i[17]=x,i[18]=c,i[19]=d,i[20]=f,i[21]=S,i[22]=w,i[23]=T,i[24]=E):E=i[24],E},G={Item:z,Control:B,Group:R,Set:O,Legend:k,Label:A,LabelText:j,LabelRow:M,Help:N,HelpTrigger:F,HelpContent:I,Optional:L,Description:V,Errors:U,ErrorList:W,ErrorItem:H};function K(e){return/* @__PURE__ */ C(H,{children:e},e)}const q=e=>T(e?.map(e=>typeof e==`string`||!e?e:e.message));export{G as Field,d as isAriaInvalid,f as parseValidation,u as resolveValidation,q as toErrorMessages};
|
package/dist/flag.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Flag component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/data-display/flag
|
|
5
|
+
*/
|
|
6
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
2
7
|
import { ComponentProps } from "react";
|
|
3
8
|
/** All valid values for a flag
|
|
4
9
|
* @see https://www.flagpack.xyz/docs/flag-index
|
|
@@ -47,8 +52,8 @@ type Props = Omit<ComponentProps<"div">, "children"> & {
|
|
|
47
52
|
* - Inside a select option, list row, or status pill that needs a quick visual cue.
|
|
48
53
|
*
|
|
49
54
|
* **When not to use**
|
|
50
|
-
* - As a stand-in for language. Flags
|
|
51
|
-
* not "Portugal", Spanish is not just "Spain". Use a language label instead.
|
|
55
|
+
* - As a stand-in for language. Flags are not languages: Brazilian Portuguese is
|
|
56
|
+
* not "Portugal", and Spanish is not just "Spain". Use a language label instead.
|
|
52
57
|
* - As decoration where the country isn't meaningful to the user.
|
|
53
58
|
*
|
|
54
59
|
* **Sizing.** `"s"` (16×12), `"m"` (20×15), and `"l"` (32×24, default) match
|
|
@@ -63,6 +68,9 @@ type Props = Omit<ComponentProps<"div">, "children"> & {
|
|
|
63
68
|
* **Loading.** Defaults to `loading="lazy"`. Use `loading="eager"` for flags
|
|
64
69
|
* above the fold or in critical content.
|
|
65
70
|
*
|
|
71
|
+
* @useWhen Show the country of a region, an IP address, or a billing address as a flag, from its
|
|
72
|
+
* two-letter country code.
|
|
73
|
+
*
|
|
66
74
|
* @see https://mantle.ngrok.com/components/data-display/flag
|
|
67
75
|
*
|
|
68
76
|
* @example
|
package/dist/flag.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{c as n}from"react/compiler-runtime";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{cva as a}from"class-variance-authority";const o=a(``,{variants:{size:{s:`rounded-[0.0625rem]`,m:`rounded-[0.09375rem]`,l:`rounded-xs`}}}),s=a(``,{variants:{size:{s:`w-4 h-3`,m:`w-5 h-3.75`,l:`w-8 h-6`}}});function c(a){let c=n(31),l,u,d,f,p,m;c[0]===a?(l=c[1],u=c[2],d=c[3],f=c[4],p=c[5],m=c[6]):({"data-slot":d,className:l,code:u,size:p,loading:m,...f}=a,c[0]=a,c[1]=l,c[2]=u,c[3]=d,c[4]=f,c[5]=p,c[6]=m);let h=p===void 0?`l`:p,g=m===void 0?`lazy`:m,_,v,y,b,x;if(c[7]!==l||c[8]!==d||c[9]!==f||c[10]!==h){let n=o({size:h}),r=s({size:h});c[16]===d?y=c[17]:(y=t(d,`flag`),c[16]=d,c[17]=y),b=e(`flag relative overflow-hidden`,n,r,l),x=f,_=!0,v=e(`absolute inset-0 border border-[#000]/10`,n),c[7]=l,c[8]=d,c[9]=f,c[10]=h,c[11]=_,c[12]=v,c[13]=y,c[14]=b,c[15]=x}else _=c[11],v=c[12],y=c[13],b=c[14],x=c[15];let S;c[18]!==_||c[19]!==v?(S=/* @__PURE__ */ r(`div`,{"aria-hidden":_,className:v}),c[18]=_,c[19]=v,c[20]=S):S=c[20];let C=`https://assets.ngrok.com/flags/${h}/${u}.svg`,w=`flag for ${u}`,T;c[21]!==g||c[22]!==w||c[23]!==C?(T=/* @__PURE__ */ r(`img`,{className:`h-full w-full block object-cover`,src:C,alt:w,loading:g}),c[21]=g,c[22]=w,c[23]=C,c[24]=T):T=c[24];let E;return c[25]!==T||c[26]!==y||c[27]!==b||c[28]!==x||c[29]!==S?(E=/* @__PURE__ */ i(`div`,{"data-slot":y,className:b,...x,children:[S,T]}),c[25]=T,c[26]=y,c[27]=b,c[28]=x,c[29]=S,c[30]=E):E=c[30],E}const l=/* @__PURE__ */ `004.008.010.016.020.024.028.031.032.040.044.048.050.051.052.056.060.064.068.070.072.074.076.084.086.090.092.096.100.104.108.112.116.120.124.132.136.140.144.148.152.156.158.162.166.170.174.178.180.184.188.191.192.196.203.204.208.212.214.218.222.226.231.232.233.234.238.239.242.246.248.250.254.258.260.262.266.268.270.275.276.288.292.296.300.304.308.312.316.320.324.328.332.334.336.340.344.348.352.356.360.364.368.372.376.380.384.388.392.398.400.404.408.410.414.417.418.422.426.428.430.434.438.440.442.446.450.454.458.462.466.470.474.478.480.484.492.496.498.499.500.504.508.512.516.520.524.528.531.533.534.540.548.554.558.562.566.570.574.578.580.581.583.584.585.586.591.598.600.604.608.612.616.620.624.626.630.634.638.642.643.646.652.654.659.660.662.663.666.670.674.678.682.686.688.690.694.702.703.704.705.706.710.716.724.728.729.732.740.744.748.752.756.760.762.764.768.772.776.780.784.788.792.795.796.798.800.804.807.818.831.832.833.834.836.840.850.854.858.860.862.876.882.887.894.ABW.AD.AE.AF.AFG.AFRUN.AG.AGO.AI.AIA.AL.ALA.ALB.AM.AMS.AND.AO.AQ.AR.ARE.ARG.ARM.AS.ASM.AT.ATA.ATF.ATG.AU.AUS.AUT.AW.AX.AZ.AZE.BA.BB.BD.BDI.BE.BEL.BEN.BF.BFA.BG.BGD.BGR.BH.BHR.BHS.BI.BIH.BJ.BL.BLM.BLR.BLZ.BM.BMU.BN.BO.BOL.BQ-BO.BQ-SA.BQ-SE.BR.BRA.BRB.BRN.BS.BT.BTN.BV.BVT.BW.BWA.BY.BZ.CA.CAF.CAN.CC.CCK.CD.CF.CG.CH.CHE.CHL.CHN.CI.CIV.CK.CL.CM.CMR.CN.CO.COD.COG.COK.COL.COM.CPV.CR.CRI.CU.CUB.CUW.CV.CW.CX.CXR.CY.CYM.CYP.CZ.CZE.DE.DEU.DJ.DJI.DK.DM.DMA.DNK.DO.DOM.EC.ECU.EE.EG.EGY.EH.ER.ERI.ES.ESH.ESP.EST.ET.ETH.EU.FI.FIN.FJ.FJI.FK.FLK.FM.FO.FR.FRA.FRO.FSM.GA.GAB.GB-ENG.GB-NIR.GB-SCT.GB-UKM.GB-WLS.GB.GBR.GD.GE.GEO.GF.GG.GGY.GH.GHA.GI.GIB.GIN.GL.GLP.GM.GMB.GN.GNB.GNQ.GP.GQ.GR.GRC.GRD.GRL.GS.GT.GTM.GU.GUF.GUM.GUY.GW.GY.HK.HKG.HM.HMD.HN.HND.HR.HRV.HT.HTI.HU.HUN.ID.IDN.IE.IL.IM.IMN.IN.IND.IO.IOT.IQ.IR.IRL.IRN.IRQ.IS.ISL.ISR.IT.ITA.JAM.JE.JEY.JM.JO.JOR.JP.JPN.KAZ.KE.KEN.KG.KGZ.KH.KHM.KI.KIR.KM.KN-SK.KNA.KOR.KP.KR.KW.KWT.KY.KZ.LA.LAO.LB.LBN.LBR.LBY.LC.LCA.LI.LIE.LK.LKA.LR.LS.LSO.LT.LTU.LU.LUX.LV.LVA.LY.MA.MAC.MAF.MAR.MC.MCO.MD.MDA.MDG.MDV.ME.MEX.MF.MG.MH.MHL.MK.MKD.ML.MLI.MLT.MM.MMR.MN.MNE.MNG.MNP.MO.MOZ.MP.MQ.MR.MRT.MS.MSR.MT.MTQ.MU.MUS.MV.MW.MWI.MX.MY.MYS.MZ.NA.NAM.NC.NCL.NE.NER.NF.NFK.NG.NGA.NI.NIC.NIU.NL.NLD.NO.NOR.NP.NPL.NR.NRU.NU.NZ.NZL.OM.OMN.PA.PAK.PAN.PCN.PE.PER.PF.PG.PH.PHL.PK.PL.PLW.PM.PN.PNG.POL.PR.PRI.PRK.PRT.PRY.PS.PSE.PT.PW.PY.PYF.QA.QAT.RAINBOW.RE.REU.RO.ROU.RS.RU.RUS.RW.RWA.SA.SAU.SB.SC.SD.SDN.SE.SEN.SG.SGP.SGS.SH.SHN.SI.SJ.SJM.SK.SL.SLB.SLE.SLV.SM.SMR.SN.SO.SOM.SPM.SR.SRB.SS.SSD.ST.STP.SUR.SV.SVK.SVN.SWE.SWZ.SX.SXM.SY.SYC.SYR.SZ.TC.TCA.TCD.TD.TF.TG.TGO.TH.THA.TJ.TJK.TK.TKL.TKM.TL.TLS.TM.TN.TO.TON.TR.TT.TTO.TUN.TUR.TUV.TV.TW.TWN.TZ.TZA.UA.UG.UGA.UKR.UM.UMI.UNASUR.URY.US.USA.UY.UZ.UZB.VA.VAT.VC.VCT.VE.VEN.VG.VGB.VI.VIR.VN.VNM.VU.VUT.WF.WLF.WS.WSM.YE.YEM.ZA.ZAF.ZM.ZMB.ZW.ZWE`.split(`.`),u=new Set(l);function d(e){return typeof e==`string`&&u.has(e)}export{c as Flag,l as countryCodes,d as isCountryCode};
|
|
1
|
+
"use client";import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{c as n}from"react/compiler-runtime";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{cva as a}from"class-variance-authority";const o=a(``,{variants:{size:{s:`rounded-[0.0625rem]`,m:`rounded-[0.09375rem]`,l:`rounded-xs`}}}),s=a(``,{variants:{size:{s:`w-4 h-3`,m:`w-5 h-3.75`,l:`w-8 h-6`}}});function c(a){let c=n(31),l,u,d,f,p,m;c[0]===a?(l=c[1],u=c[2],d=c[3],f=c[4],p=c[5],m=c[6]):({"data-slot":d,className:l,code:u,size:p,loading:m,...f}=a,c[0]=a,c[1]=l,c[2]=u,c[3]=d,c[4]=f,c[5]=p,c[6]=m);let h=p===void 0?`l`:p,g=m===void 0?`lazy`:m,_,v,y,b,x;if(c[7]!==l||c[8]!==d||c[9]!==f||c[10]!==h){let n=o({size:h}),r=s({size:h});c[16]===d?y=c[17]:(y=t(d,`flag`),c[16]=d,c[17]=y),b=e(`flag relative overflow-hidden`,n,r,l),x=f,_=!0,v=e(`absolute inset-0 border border-[#000]/10`,n),c[7]=l,c[8]=d,c[9]=f,c[10]=h,c[11]=_,c[12]=v,c[13]=y,c[14]=b,c[15]=x}else _=c[11],v=c[12],y=c[13],b=c[14],x=c[15];let S;c[18]!==_||c[19]!==v?(S=/* @__PURE__ */ r(`div`,{"aria-hidden":_,className:v}),c[18]=_,c[19]=v,c[20]=S):S=c[20];let C=`https://assets.ngrok.com/flags/${h}/${u}.svg`,w=`flag for ${u}`,T;c[21]!==g||c[22]!==w||c[23]!==C?(T=/* @__PURE__ */ r(`img`,{className:`h-full w-full block object-cover`,src:C,alt:w,loading:g}),c[21]=g,c[22]=w,c[23]=C,c[24]=T):T=c[24];let E;return c[25]!==T||c[26]!==y||c[27]!==b||c[28]!==x||c[29]!==S?(E=/* @__PURE__ */ i(`div`,{"data-slot":y,className:b,...x,children:[S,T]}),c[25]=T,c[26]=y,c[27]=b,c[28]=x,c[29]=S,c[30]=E):E=c[30],E}const l=/* @__PURE__ */ `004.008.010.016.020.024.028.031.032.040.044.048.050.051.052.056.060.064.068.070.072.074.076.084.086.090.092.096.100.104.108.112.116.120.124.132.136.140.144.148.152.156.158.162.166.170.174.178.180.184.188.191.192.196.203.204.208.212.214.218.222.226.231.232.233.234.238.239.242.246.248.250.254.258.260.262.266.268.270.275.276.288.292.296.300.304.308.312.316.320.324.328.332.334.336.340.344.348.352.356.360.364.368.372.376.380.384.388.392.398.400.404.408.410.414.417.418.422.426.428.430.434.438.440.442.446.450.454.458.462.466.470.474.478.480.484.492.496.498.499.500.504.508.512.516.520.524.528.531.533.534.540.548.554.558.562.566.570.574.578.580.581.583.584.585.586.591.598.600.604.608.612.616.620.624.626.630.634.638.642.643.646.652.654.659.660.662.663.666.670.674.678.682.686.688.690.694.702.703.704.705.706.710.716.724.728.729.732.740.744.748.752.756.760.762.764.768.772.776.780.784.788.792.795.796.798.800.804.807.818.831.832.833.834.836.840.850.854.858.860.862.876.882.887.894.ABW.AD.AE.AF.AFG.AFRUN.AG.AGO.AI.AIA.AL.ALA.ALB.AM.AMS.AND.AO.AQ.AR.ARE.ARG.ARM.AS.ASM.AT.ATA.ATF.ATG.AU.AUS.AUT.AW.AX.AZ.AZE.BA.BB.BD.BDI.BE.BEL.BEN.BF.BFA.BG.BGD.BGR.BH.BHR.BHS.BI.BIH.BJ.BL.BLM.BLR.BLZ.BM.BMU.BN.BO.BOL.BQ-BO.BQ-SA.BQ-SE.BR.BRA.BRB.BRN.BS.BT.BTN.BV.BVT.BW.BWA.BY.BZ.CA.CAF.CAN.CC.CCK.CD.CF.CG.CH.CHE.CHL.CHN.CI.CIV.CK.CL.CM.CMR.CN.CO.COD.COG.COK.COL.COM.CPV.CR.CRI.CU.CUB.CUW.CV.CW.CX.CXR.CY.CYM.CYP.CZ.CZE.DE.DEU.DJ.DJI.DK.DM.DMA.DNK.DO.DOM.EC.ECU.EE.EG.EGY.EH.ER.ERI.ES.ESH.ESP.EST.ET.ETH.EU.FI.FIN.FJ.FJI.FK.FLK.FM.FO.FR.FRA.FRO.FSM.GA.GAB.GB-ENG.GB-NIR.GB-SCT.GB-UKM.GB-WLS.GB.GBR.GD.GE.GEO.GF.GG.GGY.GH.GHA.GI.GIB.GIN.GL.GLP.GM.GMB.GN.GNB.GNQ.GP.GQ.GR.GRC.GRD.GRL.GS.GT.GTM.GU.GUF.GUM.GUY.GW.GY.HK.HKG.HM.HMD.HN.HND.HR.HRV.HT.HTI.HU.HUN.ID.IDN.IE.IL.IM.IMN.IN.IND.IO.IOT.IQ.IR.IRL.IRN.IRQ.IS.ISL.ISR.IT.ITA.JAM.JE.JEY.JM.JO.JOR.JP.JPN.KAZ.KE.KEN.KG.KGZ.KH.KHM.KI.KIR.KM.KN-SK.KNA.KOR.KP.KR.KW.KWT.KY.KZ.LA.LAO.LB.LBN.LBR.LBY.LC.LCA.LI.LIE.LK.LKA.LR.LS.LSO.LT.LTU.LU.LUX.LV.LVA.LY.MA.MAC.MAF.MAR.MC.MCO.MD.MDA.MDG.MDV.ME.MEX.MF.MG.MH.MHL.MK.MKD.ML.MLI.MLT.MM.MMR.MN.MNE.MNG.MNP.MO.MOZ.MP.MQ.MR.MRT.MS.MSR.MT.MTQ.MU.MUS.MV.MW.MWI.MX.MY.MYS.MZ.NA.NAM.NC.NCL.NE.NER.NF.NFK.NG.NGA.NI.NIC.NIU.NL.NLD.NO.NOR.NP.NPL.NR.NRU.NU.NZ.NZL.OM.OMN.PA.PAK.PAN.PCN.PE.PER.PF.PG.PH.PHL.PK.PL.PLW.PM.PN.PNG.POL.PR.PRI.PRK.PRT.PRY.PS.PSE.PT.PW.PY.PYF.QA.QAT.RAINBOW.RE.REU.RO.ROU.RS.RU.RUS.RW.RWA.SA.SAU.SB.SC.SD.SDN.SE.SEN.SG.SGP.SGS.SH.SHN.SI.SJ.SJM.SK.SL.SLB.SLE.SLV.SM.SMR.SN.SO.SOM.SPM.SR.SRB.SS.SSD.ST.STP.SUR.SV.SVK.SVN.SWE.SWZ.SX.SXM.SY.SYC.SYR.SZ.TC.TCA.TCD.TD.TF.TG.TGO.TH.THA.TJ.TJK.TK.TKL.TKM.TL.TLS.TM.TN.TO.TON.TR.TT.TTO.TUN.TUR.TUV.TV.TW.TWN.TZ.TZA.UA.UG.UGA.UKR.UM.UMI.UNASUR.URY.US.USA.UY.UZ.UZB.VA.VAT.VC.VCT.VE.VEN.VG.VGB.VI.VIR.VN.VNM.VU.VUT.WF.WLF.WS.WSM.YE.YEM.ZA.ZAF.ZM.ZMB.ZW.ZWE`.split(`.`),u=new Set(l);function d(e){return typeof e==`string`&&u.has(e)}export{c as Flag,l as countryCodes,d as isCountryCode};
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for @ngrok/mantle hooks.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/hooks
|
|
5
|
+
*/
|
|
6
|
+
import { a as PossibleRef, n as MarginType, s as copyToClipboard } from "./in-view-C_daNafg.js";
|
|
7
|
+
import { RefCallback, RefObject, useLayoutEffect } from "react";
|
|
3
8
|
/**
|
|
4
9
|
* Tailwind CSS breakpoints in descending order (largest → smallest).
|
|
5
10
|
*
|
|
@@ -145,7 +150,7 @@ declare function useCallbackRef<T extends (...args: never[]) => unknown>(callbac
|
|
|
145
150
|
* The returned function uses the Clipboard API when available and falls back
|
|
146
151
|
* to a `document.execCommand("copy")` polyfill for older browsers. `await`
|
|
147
152
|
* the call (or attach a `.then()` / `.catch()`) to observe whether the copy
|
|
148
|
-
* succeeded
|
|
153
|
+
* succeeded: the function throws when both the Clipboard API and the
|
|
149
154
|
* polyfill fail, or when called outside of a DOM environment.
|
|
150
155
|
*
|
|
151
156
|
* Inspired by: https://usehooks.com/usecopytoclipboard
|
|
@@ -367,7 +372,7 @@ type UseInertSiblingsOptions = {
|
|
|
367
372
|
declare function useInertSiblings(ref: RefObject<HTMLElement | null>, { active }?: UseInertSiblingsOptions): void;
|
|
368
373
|
/**
|
|
369
374
|
* Returns `false` during server rendering and the initial hydration render,
|
|
370
|
-
* then `true` on the client
|
|
375
|
+
* then `true` on the client, without hydration mismatches, because React
|
|
371
376
|
* uses the server snapshot for the hydration pass and re-renders once with
|
|
372
377
|
* the client snapshot afterwards.
|
|
373
378
|
*
|
|
@@ -433,7 +438,7 @@ declare function useIsHydratedAfterPaint(): boolean;
|
|
|
433
438
|
* by other Mantle hooks and components.
|
|
434
439
|
*
|
|
435
440
|
* @param effect - The imperative function that may return a cleanup
|
|
436
|
-
* function
|
|
441
|
+
* function, with the same signature as React's `useLayoutEffect` / `useEffect`.
|
|
437
442
|
* @param deps - Optional dependency list, same semantics as
|
|
438
443
|
* `useLayoutEffect`.
|
|
439
444
|
* @returns Nothing.
|
|
@@ -559,7 +564,7 @@ declare function useSessionStorage(key: string, defaultValue: string): readonly
|
|
|
559
564
|
*
|
|
560
565
|
* Useful in event handlers, animation entrypoints, or plain functions where
|
|
561
566
|
* a React hook cannot be called. Prefer {@link usePrefersReducedMotion}
|
|
562
|
-
* inside components
|
|
567
|
+
* inside components: it subscribes to live changes.
|
|
563
568
|
*
|
|
564
569
|
* @returns `true` when the user has opted out of animations or when called
|
|
565
570
|
* outside a browser environment (SSR), `false` when motion is allowed.
|
|
@@ -612,8 +617,8 @@ export declare function usePrefersReducedMotion(): boolean;
|
|
|
612
617
|
/**
|
|
613
618
|
* `scroll-behavior` values:
|
|
614
619
|
*
|
|
615
|
-
* - `"auto"
|
|
616
|
-
* - `"smooth"
|
|
620
|
+
* - `"auto"`: scrolling happens instantly (no animation).
|
|
621
|
+
* - `"smooth"`: scrolling animates smoothly using a user-agent–defined easing and duration.
|
|
617
622
|
*
|
|
618
623
|
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior#values
|
|
619
624
|
*/
|
|
@@ -789,6 +794,26 @@ type UseSwipeToDismissOptions = {
|
|
|
789
794
|
* ```
|
|
790
795
|
*/
|
|
791
796
|
declare function useSwipeToDismiss(handle: RefObject<HTMLElement | null>, options: UseSwipeToDismissOptions): void;
|
|
797
|
+
/**
|
|
798
|
+
* A custom hook that composes up to three refs into a single callback ref.
|
|
799
|
+
* Accepts callback refs and RefObject(s). The callback keeps one identity
|
|
800
|
+
* while the refs it composes keep theirs, so React attaches it once per
|
|
801
|
+
* mount. If you pass a new ref on a later render, React detaches the old
|
|
802
|
+
* callback and attaches the new one, so the new ref receives the node at
|
|
803
|
+
* once. A consumer callback ref fires once per mount when the consumer
|
|
804
|
+
* passes the same function each render, and on every render when the
|
|
805
|
+
* consumer passes a new function, as it does on a plain element. Any
|
|
806
|
+
* cleanup the composed ref returns targets the refs it composed (see
|
|
807
|
+
* {@link composeRefs} for the cleanup propagation contract).
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* function MyInput({ ref, ...props }: ComponentProps<"input">) {
|
|
811
|
+
* const internalRef = useRef<HTMLInputElement>(null);
|
|
812
|
+
* const composedRef = useComposedRefs(internalRef, ref);
|
|
813
|
+
* return <input ref={composedRef} {...props} />;
|
|
814
|
+
* }
|
|
815
|
+
*/
|
|
816
|
+
declare function useComposedRefs<T>(firstRef: PossibleRef<T>, secondRef: PossibleRef<T>, thirdRef?: PossibleRef<T>): RefCallback<T>;
|
|
792
817
|
/**
|
|
793
818
|
* Options for the `useInView` hook.
|
|
794
819
|
*/
|
|
@@ -877,7 +902,7 @@ type UseUndoRedoReturn<T> = {
|
|
|
877
902
|
/**
|
|
878
903
|
* Generic undo/redo hook that maintains two history stacks (undo and redo).
|
|
879
904
|
*
|
|
880
|
-
* The hook does not own your application state
|
|
905
|
+
* The hook does not own your application state; instead it helps you
|
|
881
906
|
* snapshot it. Call `push(snapshot)` *before* mutating state to capture
|
|
882
907
|
* the current value, then call `undo(current)` or `redo(current)` to swap
|
|
883
908
|
* `current` with the previous/next snapshot. Both `undo` and `redo` return
|
|
@@ -885,7 +910,7 @@ type UseUndoRedoReturn<T> = {
|
|
|
885
910
|
* new snapshot clears the redo stack, matching standard editor semantics.
|
|
886
911
|
*
|
|
887
912
|
* `push`, `undo`, and `redo` operate on the live history, so calling them
|
|
888
|
-
* multiple times within a single event handler works as expected
|
|
913
|
+
* multiple times within a single event handler works as expected: each
|
|
889
914
|
* call sees the result of the previous one.
|
|
890
915
|
*
|
|
891
916
|
* @typeParam T - The type of the value being snapshotted (e.g. a list of
|
package/dist/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
"use client";import{n as e,r as t,t as n}from"./use-breakpoint-B4Kh0xE6.js";import{t as r}from"./use-callback-ref-DiOXFQzM.js";import{t as i}from"./use-copy-to-clipboard-hBL6_65i.js";import{n as a,t as o}from"./use-inert-siblings-C4RHXrZc.js";import{t as s}from"./use-is-hydrated-BeLOGKwE.js";import{t as c}from"./use-is-hydrated-after-paint-CrHt3OHw.js";import{t as l}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t as u}from"./use-matches-media-query-FfvtNKQe.js";import{n as d,t as f}from"./use-prefers-reduced-motion-Ck6dnOM9.js";import{n as p}from"./use-swipe-to-dismiss-BYdlca8r.js";import{t as m}from"./use-composed-refs-DPYmLDSe.js";import{t as h}from"./in-view-Dxv_GrUU.js";import{c as g}from"react/compiler-runtime";import{useEffect as _,useRef as v,useState as y,useSyncExternalStore as b}from"react";function x(e,t){let n=g(4),[r,i]=y(e),a,o;return n[0]!==t.waitMs||n[1]!==e?(a=()=>{let n=window.setTimeout(()=>{i(e)},t.waitMs);return()=>{window.clearTimeout(n)}},o=[e,t.waitMs],n[0]=t.waitMs,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),_(a,o),r}function S(e,t){let n=g(5),i=r(e),a=v(0),o,s;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>window.clearTimeout(a.current),s=[],n[0]=o,n[1]=s):(o=n[0],s=n[1]),_(o,s);let c;return n[2]!==t.waitMs||n[3]!==i?(c=(...e)=>{let n=e;window.clearTimeout(a.current),a.current=window.setTimeout(()=>i(...n),t.waitMs)},n[2]=t.waitMs,n[3]=i,n[4]=c):c=n[4],c}const C=/* @__PURE__ */ new Map;function w(e){e.key==null?C.clear():C.has(e.key)&&(e.newValue==null?C.delete(e.key):C.set(e.key,e.newValue))}function T(){try{return window.localStorage}catch{return null}}function E(e){return function(t){function n(n){let r=n.storageArea==null||n.storageArea===T(),i=n.key==null||n.key===e;r&&i&&(w(n),t())}return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}}}function D(){return null}function O(e){let t=C.get(e);if(t!=null)return t;try{return window.localStorage.getItem(e)}catch{return null}}function k(e,t){try{window.localStorage.setItem(e,t),C.delete(e)}catch{C.set(e,t)}}function A(e,t){try{let n=JSON.parse(e);return typeof n==`string`?n:t}catch{return t}}function j(e,t){let n=g(12),r;n[0]===e?r=n[1]:(r=E(e),n[0]=e,n[1]=r);let i=r,a;n[2]===e?a=n[3]:(a=()=>O(e),n[2]=e,n[3]=a);let o=b(i,a,D),s;n[4]!==t||n[5]!==o?(s=o==null?t:A(o,t),n[4]=t,n[5]=o,n[6]=s):s=n[6];let c=s,l;n[7]===e?l=n[8]:(l=t=>{let n=JSON.stringify(t);k(e,n),window.dispatchEvent(new StorageEvent(`storage`,{key:e,newValue:n,storageArea:T()}))},n[7]=e,n[8]=l);let u=l,d;return n[9]!==u||n[10]!==c?(d=[c,u],n[9]=u,n[10]=c,n[11]=d):d=n[11],d}const M=/* @__PURE__ */ new Map;function N(e){e.key==null?M.clear():M.has(e.key)&&(e.newValue==null?M.delete(e.key):M.set(e.key,e.newValue))}function P(){try{return window.sessionStorage}catch{return null}}function F(e){return function(t){function n(n){let r=n.storageArea==null||n.storageArea===P(),i=n.key==null||n.key===e;r&&i&&(N(n),t())}return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}}}function I(){return null}function L(e){let t=M.get(e);if(t!=null)return t;try{return window.sessionStorage.getItem(e)}catch{return null}}function R(e,t){try{window.sessionStorage.setItem(e,t),M.delete(e)}catch{M.set(e,t)}}function z(e,t){try{let n=JSON.parse(e);return typeof n==`string`?n:t}catch{return t}}function B(e,t){let n=g(12),r;n[0]===e?r=n[1]:(r=F(e),n[0]=e,n[1]=r);let i=r,a;n[2]===e?a=n[3]:(a=()=>L(e),n[2]=e,n[3]=a);let o=b(i,a,I),s;n[4]!==t||n[5]!==o?(s=o==null?t:z(o,t),n[4]=t,n[5]=o,n[6]=s):s=n[6];let c=s,l;n[7]===e?l=n[8]:(l=t=>{let n=JSON.stringify(t);R(e,n),window.dispatchEvent(new StorageEvent(`storage`,{key:e,newValue:n,storageArea:P()}))},n[7]=e,n[8]=l);let u=l,d;return n[9]!==u||n[10]!==c?(d=[c,u],n[9]=u,n[10]=c,n[11]=d):d=n[11],d}function V(){return d()?`auto`:`smooth`}function H(e,t){let n=g(9),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let{root:i,margin:a,amount:o,once:s,initial:c}=r,l=s!==void 0&&s,u=c!==void 0&&c,[d,f]=y(u),p=v(u),m,b;return n[2]!==o||n[3]!==a||n[4]!==l||n[5]!==e||n[6]!==i?(m=()=>{let t=e.current;if(t==null||l&&p.current)return;let n=function(){if(p.current=!0,f(!0),!l)return()=>{p.current=!1,f(!1)}},r={root:i?.current??void 0,margin:a,amount:o};return h(t,n,r)},b=[i,e,a,l,o],n[2]=o,n[3]=a,n[4]=l,n[5]=e,n[6]=i,n[7]=m,n[8]=b):(m=n[7],b=n[8]),_(m,b),d}function U(){let e=g(9),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let n=v(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],e[1]=r):r=e[1];let i=v(r),a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={undo:0,redo:0},e[2]=a):a=e[2];let[o,s]=y(a),c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{n.current.push(e),i.current=[],s({undo:n.current.length,redo:0})},e[3]=c):c=e[3];let l=c,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let t=n.current[n.current.length-1];if(t!==void 0)return n.current.pop(),i.current.push(e),s({undo:n.current.length,redo:i.current.length}),t},e[4]=u):u=e[4];let d=u,f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{let t=i.current[i.current.length-1];if(t!==void 0)return i.current.pop(),n.current.push(e),s({undo:n.current.length,redo:i.current.length}),t},e[5]=f):f=e[5];let p=f,m=o.undo>0,h=o.redo>0,_;return e[6]!==h||e[7]!==m?(_={canUndo:m,canRedo:h,push:l,undo:d,redo:p},e[6]=h,e[7]=m,e[8]=_):_=e[8],_}export{n as breakpoints,f as getPrefersReducedMotion,e as useBreakpoint,r as useCallbackRef,m as useComposedRefs,i as useCopyToClipboard,x as useDebounce,S as useDebouncedCallback,a as useFocusTrap,H as useInView,o as useInertSiblings,t as useIsBelowBreakpoint,s as useIsHydrated,c as useIsHydratedAfterPaint,l as useIsomorphicLayoutEffect,j as useLocalStorage,u as useMatchesMediaQuery,d as usePrefersReducedMotion,V as useScrollBehavior,B as useSessionStorage,p as useSwipeToDismiss,U as useUndoRedo};
|