@ngrok/mantle 0.66.0 → 0.66.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/dist/accordion.d.ts +158 -154
- package/dist/accordion.js +1 -1
- package/dist/accordion.js.map +1 -1
- package/dist/alert-dialog.d.ts +282 -277
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +145 -138
- package/dist/alert.js +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/anchor.d.ts +25 -22
- package/dist/anchor.js +1 -1
- package/dist/anchor.js.map +1 -1
- package/dist/as-child-XMVTepJu.d.ts +31 -0
- package/dist/badge.d.ts +29 -19
- package/dist/badge.js +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/booleanish-CBGdPL3Q.js +2 -0
- package/dist/booleanish-CBGdPL3Q.js.map +1 -0
- package/dist/browser-only-jrBUqioz.js +2 -0
- package/dist/browser-only-jrBUqioz.js.map +1 -0
- package/dist/browser-only.d.ts +20 -15
- package/dist/browser-only.js +1 -2
- package/dist/button-CKL-3sIr.d.ts +175 -0
- package/dist/button-CRRPesae.js +2 -0
- package/dist/button-CRRPesae.js.map +1 -0
- package/dist/button-DA2p0_5F.js +2 -0
- package/dist/button-DA2p0_5F.js.map +1 -0
- package/dist/button.d.ts +4 -9
- package/dist/button.js +1 -2
- package/dist/calendar.d.ts +14 -8
- package/dist/calendar.js +1 -1
- package/dist/calendar.js.map +1 -1
- package/dist/card.d.ts +99 -97
- package/dist/card.js +1 -1
- package/dist/card.js.map +1 -1
- package/dist/checkbox.d.ts +14 -12
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/code-block.d.ts +254 -237
- package/dist/code-block.js +3 -3
- package/dist/code-block.js.map +1 -1
- package/dist/code.d.ts +5 -3
- package/dist/code.js +1 -1
- package/dist/code.js.map +1 -1
- package/dist/color.d.ts +2 -38
- package/dist/color.js +1 -1
- package/dist/color.js.map +1 -1
- package/dist/combobox.d.ts +172 -167
- package/dist/combobox.js +1 -1
- package/dist/combobox.js.map +1 -1
- package/dist/command.d.ts +234 -227
- package/dist/command.js +1 -1
- package/dist/command.js.map +1 -1
- package/dist/compose-refs-DeIsFv68.js +2 -0
- package/dist/compose-refs-DeIsFv68.js.map +1 -0
- package/dist/cx-bKromGBh.js +2 -0
- package/dist/cx-bKromGBh.js.map +1 -0
- package/dist/cx.d.ts +4 -2
- package/dist/cx.js +1 -2
- package/dist/data-table.d.ts +211 -184
- package/dist/data-table.js +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/deep-non-nullable-BLM3Gz0I.d.ts +8 -0
- package/dist/description-list.d.ts +61 -59
- package/dist/description-list.js +1 -1
- package/dist/description-list.js.map +1 -1
- package/dist/dialog-BuD_JQf_.d.ts +422 -0
- package/dist/dialog-CGBjHvo_.js +2 -0
- package/dist/dialog-CGBjHvo_.js.map +1 -0
- package/dist/dialog.d.ts +3 -410
- package/dist/dialog.js +1 -2
- package/dist/direction-DfrtFTny.js +2 -0
- package/dist/direction-DfrtFTny.js.map +1 -0
- package/dist/{direction-DHheuUag.d.ts → direction-deXpJFDZ.d.ts} +9 -7
- package/dist/dropdown-menu-CjOaj-Ap.js +2 -0
- package/dist/dropdown-menu-CjOaj-Ap.js.map +1 -0
- package/dist/dropdown-menu-D_ZoY1AH.d.ts +330 -0
- package/dist/dropdown-menu.d.ts +2 -325
- package/dist/dropdown-menu.js +1 -2
- package/dist/flag.d.ts +31 -22
- package/dist/flag.js +1 -1
- package/dist/flag.js.map +1 -1
- package/dist/hooks.d.ts +72 -59
- package/dist/hooks.js +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hover-card.d.ts +97 -91
- package/dist/hover-card.js +1 -1
- package/dist/hover-card.js.map +1 -1
- package/dist/{icon-DXTMiV1L.d.ts → icon-B1XLv02t.d.ts} +11 -9
- package/dist/icon-B5oNYYrJ.js +2 -0
- package/dist/icon-B5oNYYrJ.js.map +1 -0
- package/dist/icon-button-2r6S3HVA.d.ts +98 -0
- package/dist/icon-button-D4e9-dq-.js +2 -0
- package/dist/icon-button-D4e9-dq-.js.map +1 -0
- package/dist/icon.d.ts +4 -4
- package/dist/icon.js +1 -2
- package/dist/icons.d.ts +54 -41
- package/dist/icons.js +1 -1
- package/dist/icons.js.map +1 -1
- package/dist/{in-view-aHeQHaUj.d.ts → in-view-CTQRT44m.d.ts} +29 -22
- package/dist/in-view-bPnaWEL4.js +2 -0
- package/dist/in-view-bPnaWEL4.js.map +1 -0
- package/dist/index-BLCvtjLi.d.ts +40 -0
- package/dist/index-DWqhfw9n.d.ts +103 -0
- package/dist/{button-group-BFnqgdtl.d.ts → index-ViSCOUrU.d.ts} +10 -8
- package/dist/index-s8rMcilU.d.ts +47 -0
- package/dist/input.d.ts +3 -100
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/is-input-BFR8yMM7.js +2 -0
- package/dist/is-input-BFR8yMM7.js.map +1 -0
- package/dist/kbd-pyj32aN4.js +2 -0
- package/dist/kbd-pyj32aN4.js.map +1 -0
- package/dist/kbd.d.ts +10 -4
- package/dist/kbd.js +1 -2
- package/dist/label.d.ts +8 -6
- package/dist/label.js +1 -1
- package/dist/label.js.map +1 -1
- package/dist/media-object.d.ts +70 -68
- package/dist/media-object.js +1 -1
- package/dist/media-object.js.map +1 -1
- package/dist/multi-select.d.ts +226 -218
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/pagination.d.ts +168 -164
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/popover.d.ts +119 -117
- package/dist/popover.js +1 -1
- package/dist/popover.js.map +1 -1
- package/dist/primitive-W5Izf14l.js +2 -0
- package/dist/primitive-W5Izf14l.js.map +1 -0
- package/dist/primitive-tuHqhoRE.d.ts +16 -0
- package/dist/progress.d.ts +175 -150
- package/dist/progress.js +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.d.ts +246 -230
- package/dist/radio-group.js +1 -1
- package/dist/radio-group.js.map +1 -1
- package/dist/sandboxed-on-click.d.ts +36 -31
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/sandboxed-on-click.js.map +1 -1
- package/dist/select-39Jfc1Cb.d.ts +265 -0
- package/dist/select-DZ2ztBkI.js +2 -0
- package/dist/select-DZ2ztBkI.js.map +1 -0
- package/dist/select.d.ts +2 -263
- package/dist/select.js +1 -2
- package/dist/separator-BcCNbHBg.js +2 -0
- package/dist/separator-BcCNbHBg.js.map +1 -0
- package/dist/separator.d.ts +28 -21
- package/dist/separator.js +1 -2
- package/dist/sheet.d.ts +319 -305
- package/dist/sheet.js +1 -1
- package/dist/sheet.js.map +1 -1
- package/dist/skeleton.d.ts +8 -6
- package/dist/skeleton.js +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.d.ts +48 -35
- package/dist/slider.js +1 -1
- package/dist/slider.js.map +1 -1
- package/dist/slot-DdnjeV2n.js +2 -0
- package/dist/slot-DdnjeV2n.js.map +1 -0
- package/dist/slot.d.ts +6 -4
- package/dist/slot.js +1 -2
- package/dist/sort-CfPsu1Gs.js +2 -0
- package/dist/sort-CfPsu1Gs.js.map +1 -0
- package/dist/split-button.d.ts +158 -162
- package/dist/split-button.js +1 -1
- package/dist/split-button.js.map +1 -1
- package/dist/svg-only-BVLlbQ4e.js +2 -0
- package/dist/svg-only-BVLlbQ4e.js.map +1 -0
- package/dist/{svg-only-Cp8Mu_sh.d.ts → svg-only-Dti1FvNV.d.ts} +11 -9
- package/dist/switch.d.ts +10 -8
- package/dist/switch.js +1 -1
- package/dist/switch.js.map +1 -1
- package/dist/table-BWMp12sl.js +2 -0
- package/dist/table-BWMp12sl.js.map +1 -0
- package/dist/table-Dpt192qt.d.ts +398 -0
- package/dist/table.d.ts +2 -396
- package/dist/table.js +1 -2
- package/dist/tabs.d.ts +110 -104
- package/dist/tabs.js +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/text-area.d.ts +10 -8
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/theme-provider-CbzLgte1.js +2 -0
- package/dist/theme-provider-CbzLgte1.js.map +1 -0
- package/dist/theme.d.ts +65 -38
- package/dist/theme.js +1 -2
- package/dist/{themes-Bi46K9ZW.d.ts → themes-ClppRAGt.d.ts} +4 -2
- package/dist/toast-B4gxB8U0.js +2 -0
- package/dist/toast-B4gxB8U0.js.map +1 -0
- package/dist/toast.d.ts +95 -87
- package/dist/toast.js +1 -2
- package/dist/tooltip.d.ts +78 -73
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/{chunk-W2YQRWR5.js → traffic-policy-file-QnF-2YkY.js} +2 -2
- package/dist/traffic-policy-file-QnF-2YkY.js.map +1 -0
- package/dist/types-884RJJqm.js +2 -0
- package/dist/types-884RJJqm.js.map +1 -0
- package/dist/{types-DehRoXC5.d.ts → types-DgXUgkpc.d.ts} +38 -36
- package/dist/types-Dh4BVhXC.d.ts +9 -0
- package/dist/types.d.ts +6 -49
- package/dist/types.js +1 -2
- package/dist/use-copy-to-clipboard-BEbQOKHc.js +2 -0
- package/dist/use-copy-to-clipboard-BEbQOKHc.js.map +1 -0
- package/dist/use-matches-media-query-BxTQ5f4i.js +2 -0
- package/dist/use-matches-media-query-BxTQ5f4i.js.map +1 -0
- package/dist/use-prefers-reduced-motion-BPlsKyCJ.js +2 -0
- package/dist/use-prefers-reduced-motion-BPlsKyCJ.js.map +1 -0
- package/dist/utils.d.ts +6 -5
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/variant-props-UE-phTwh.d.ts +13 -0
- package/dist/with-style-props-D1QFTzj6.d.ts +29 -0
- package/package.json +6 -6
- package/dist/as-child-DJ7x3JFV.d.ts +0 -21
- package/dist/browser-only.js.map +0 -1
- package/dist/button-DLUUf_c-.d.ts +0 -173
- package/dist/button.js.map +0 -1
- package/dist/chunk-2FYR6IJV.js +0 -2
- package/dist/chunk-2FYR6IJV.js.map +0 -1
- package/dist/chunk-5VDCC3YW.js +0 -2
- package/dist/chunk-5VDCC3YW.js.map +0 -1
- package/dist/chunk-63ZAW25Z.js +0 -2
- package/dist/chunk-63ZAW25Z.js.map +0 -1
- package/dist/chunk-6J7D73WA.js +0 -2
- package/dist/chunk-6J7D73WA.js.map +0 -1
- package/dist/chunk-72TJUKMV.js +0 -1
- package/dist/chunk-72TJUKMV.js.map +0 -1
- package/dist/chunk-7MJQGBE4.js +0 -2
- package/dist/chunk-7MJQGBE4.js.map +0 -1
- package/dist/chunk-7YLII2US.js +0 -2
- package/dist/chunk-7YLII2US.js.map +0 -1
- package/dist/chunk-ADF5DAYG.js +0 -2
- package/dist/chunk-ADF5DAYG.js.map +0 -1
- package/dist/chunk-CBRSMQ26.js +0 -2
- package/dist/chunk-CBRSMQ26.js.map +0 -1
- package/dist/chunk-COQIVAQH.js +0 -2
- package/dist/chunk-COQIVAQH.js.map +0 -1
- package/dist/chunk-ELZLLG6G.js +0 -2
- package/dist/chunk-ELZLLG6G.js.map +0 -1
- package/dist/chunk-EVU5XGB4.js +0 -2
- package/dist/chunk-EVU5XGB4.js.map +0 -1
- package/dist/chunk-EYZYDUS2.js +0 -2
- package/dist/chunk-EYZYDUS2.js.map +0 -1
- package/dist/chunk-HKSO72E5.js +0 -2
- package/dist/chunk-HKSO72E5.js.map +0 -1
- package/dist/chunk-HL2HWYKP.js +0 -2
- package/dist/chunk-HL2HWYKP.js.map +0 -1
- package/dist/chunk-IVQ626TU.js +0 -2
- package/dist/chunk-IVQ626TU.js.map +0 -1
- package/dist/chunk-JQ5D5YZR.js +0 -2
- package/dist/chunk-JQ5D5YZR.js.map +0 -1
- package/dist/chunk-LBO5LEYM.js +0 -2
- package/dist/chunk-LBO5LEYM.js.map +0 -1
- package/dist/chunk-MLXONRJD.js +0 -2
- package/dist/chunk-MLXONRJD.js.map +0 -1
- package/dist/chunk-OHPGAB7U.js +0 -2
- package/dist/chunk-OHPGAB7U.js.map +0 -1
- package/dist/chunk-OP6JMBKJ.js +0 -2
- package/dist/chunk-OP6JMBKJ.js.map +0 -1
- package/dist/chunk-PFXFESEN.js +0 -2
- package/dist/chunk-PFXFESEN.js.map +0 -1
- package/dist/chunk-PNL7JOXI.js +0 -2
- package/dist/chunk-PNL7JOXI.js.map +0 -1
- package/dist/chunk-RED6SFAV.js +0 -2
- package/dist/chunk-RED6SFAV.js.map +0 -1
- package/dist/chunk-SBQHQ2SJ.js +0 -2
- package/dist/chunk-SBQHQ2SJ.js.map +0 -1
- package/dist/chunk-SGGOH2WW.js +0 -2
- package/dist/chunk-SGGOH2WW.js.map +0 -1
- package/dist/chunk-W2YQRWR5.js.map +0 -1
- package/dist/chunk-W5A5HSFE.js +0 -2
- package/dist/chunk-W5A5HSFE.js.map +0 -1
- package/dist/chunk-YPAUKPCE.js +0 -2
- package/dist/chunk-YPAUKPCE.js.map +0 -1
- package/dist/cx.js.map +0 -1
- package/dist/deep-non-nullable-SmpSvoSd.d.ts +0 -8
- package/dist/dialog.js.map +0 -1
- package/dist/dropdown-menu.js.map +0 -1
- package/dist/icon-button-CT71Ti9V.d.ts +0 -96
- package/dist/icon.js.map +0 -1
- package/dist/kbd.js.map +0 -1
- package/dist/primitive-CBR_XmVa.d.ts +0 -14
- package/dist/select.js.map +0 -1
- package/dist/separator.js.map +0 -1
- package/dist/slot.js.map +0 -1
- package/dist/table.js.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/toast.js.map +0 -1
- package/dist/types-BuKAGhC-.d.ts +0 -7
- package/dist/types.js.map +0 -1
- package/dist/variant-props-oDo2u-We.d.ts +0 -11
- package/dist/with-style-props-VnLWm0Yd.d.ts +0 -27
package/dist/types.d.ts
CHANGED
|
@@ -1,49 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type Booleanish = boolean | "true" | "false";
|
|
9
|
-
/**
|
|
10
|
-
* Parse/coerce a booleanish value (boolean | "true" | "false") into a boolean.
|
|
11
|
-
* @default false if the value is not a boolean or "true"
|
|
12
|
-
*/
|
|
13
|
-
declare function parseBooleanish(value: Booleanish | (string & {}) | undefined | null): boolean;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A CSS custom property (CSS variable) name.
|
|
17
|
-
*
|
|
18
|
-
* CSS variables must start with `--`, e.g. `--brand-color` or `--spacing-2`.
|
|
19
|
-
* This template-literal type lets TypeScript recognize those keys as valid
|
|
20
|
-
* style keys when building objects for `style={...}`.
|
|
21
|
-
*/
|
|
22
|
-
type CssVariableName = `--${string}`;
|
|
23
|
-
/**
|
|
24
|
-
* React-compatible CSS properties plus support for CSS custom properties.
|
|
25
|
-
*
|
|
26
|
-
* React's `CSSProperties` type does not allow arbitrary property names by
|
|
27
|
-
* default, so keys like `--foo` would normally be rejected by TypeScript.
|
|
28
|
-
*
|
|
29
|
-
* This type extends React's `CSSProperties` and additionally permits any
|
|
30
|
-
* CSS variable name (keys starting with `--`) with values that match what
|
|
31
|
-
* CSS variables accept in React style objects: `string | number`.
|
|
32
|
-
*/
|
|
33
|
-
type CssProperties = CSSProperties & Record<CssVariableName, string | number>;
|
|
34
|
-
/**
|
|
35
|
-
* Helper to type-check a style object while preserving its exact inferred type.
|
|
36
|
-
*
|
|
37
|
-
* Why not just annotate with `CssProperties`?
|
|
38
|
-
* - Annotating forces the value to be treated as the *wider* `CssProperties` type,
|
|
39
|
-
* which can lose useful inference (literal values, narrow unions, etc.).
|
|
40
|
-
*
|
|
41
|
-
* This function validates that `input` conforms to `CssProperties` (including
|
|
42
|
-
* CSS variables like `--foo`) and returns it unchanged, keeping inference intact.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* style={$cssProperties({ display: "block", "--gap": 8 })}
|
|
46
|
-
*/
|
|
47
|
-
declare const $cssProperties: <T extends CssProperties = CssProperties>(input: T) => CSSProperties;
|
|
48
|
-
|
|
49
|
-
export { $cssProperties, type Booleanish, type CssProperties, parseBooleanish };
|
|
1
|
+
import { t as DeepNonNullable } from "./deep-non-nullable-BLM3Gz0I.js";
|
|
2
|
+
import { t as WithAsChild } from "./as-child-XMVTepJu.js";
|
|
3
|
+
import { i as parseBooleanish, n as CssProperties, r as Booleanish, t as $cssProperties } from "./index-s8rMcilU.js";
|
|
4
|
+
import { t as WithStyleProps } from "./with-style-props-D1QFTzj6.js";
|
|
5
|
+
import { t as VariantProps } from "./variant-props-UE-phTwh.js";
|
|
6
|
+
export { $cssProperties, Booleanish, CssProperties, DeepNonNullable, VariantProps, WithAsChild, WithStyleProps, parseBooleanish };
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
import{t as e}from"./booleanish-CBGdPL3Q.js";import{t}from"./types-884RJJqm.js";export{t as $cssProperties,e as parseBooleanish};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as e,useState as t}from"react";function n(){let[n,i]=t(``);return[n,e(e=>{(async()=>{try{if(typeof window.navigator?.clipboard?.writeText==`function`)await navigator.clipboard.writeText(e),i(e);else throw Error(`writeText not supported`)}catch{r(e),i(e)}})()},[])]}function r(e){let t=document.createElement(`textarea`);t.value=e,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}export{n as t};
|
|
2
|
+
//# sourceMappingURL=use-copy-to-clipboard-BEbQOKHc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-copy-to-clipboard-BEbQOKHc.js","names":[],"sources":["../src/hooks/use-copy-to-clipboard.tsx"],"sourcesContent":["import { useCallback, useState } from \"react\";\n\n/**\n * A hook that allows you to copy a string to the clipboard.\n *\n * Inspired by: https://usehooks.com/usecopytoclipboard\n */\nfunction useCopyToClipboard() {\n\tconst [state, setState] = useState<string>(\"\");\n\n\tconst copyToClipboard = useCallback((value: string) => {\n\t\tconst handleCopy = async () => {\n\t\t\ttry {\n\t\t\t\tif (typeof window.navigator?.clipboard?.writeText === \"function\") {\n\t\t\t\t\tawait navigator.clipboard.writeText(value);\n\t\t\t\t\tsetState(value);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(\"writeText not supported\");\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tcopyToClipboardPolyfill(value);\n\t\t\t\tsetState(value);\n\t\t\t}\n\t\t};\n\n\t\thandleCopy();\n\t}, []);\n\n\treturn [state, copyToClipboard] as const;\n}\n\nexport {\n\t//,\n\tuseCopyToClipboard,\n};\n\n/**\n * A fallback copy to clipboard function for older browsers.\n */\nfunction copyToClipboardPolyfill(text: string) {\n\tconst tempTextArea = document.createElement(\"textarea\");\n\ttempTextArea.value = text;\n\tdocument.body.appendChild(tempTextArea);\n\ttempTextArea.select();\n\tdocument.execCommand(\"copy\");\n\tdocument.body.removeChild(tempTextArea);\n}\n"],"mappings":"kDAOA,SAAS,GAAqB,CAC7B,GAAM,CAAC,EAAO,GAAY,EAAiB,GAAG,CAoB9C,MAAO,CAAC,EAlBgB,EAAa,GAAkB,EACnC,SAAY,CAC9B,GAAI,CACH,GAAI,OAAO,OAAO,WAAW,WAAW,WAAc,WACrD,MAAM,UAAU,UAAU,UAAU,EAAM,CAC1C,EAAS,EAAM,MAEf,MAAU,MAAM,0BAA0B,MAEpC,CACP,EAAwB,EAAM,CAC9B,EAAS,EAAM,KAIL,EACV,EAAE,CAAC,CAEyB,CAWhC,SAAS,EAAwB,EAAc,CAC9C,IAAM,EAAe,SAAS,cAAc,WAAW,CACvD,EAAa,MAAQ,EACrB,SAAS,KAAK,YAAY,EAAa,CACvC,EAAa,QAAQ,CACrB,SAAS,YAAY,OAAO,CAC5B,SAAS,KAAK,YAAY,EAAa"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as e,useSyncExternalStore as t}from"react";function n(n){return t(e(e=>{let t=window.matchMedia(n);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},[n]),()=>window.matchMedia(n).matches,()=>!1)}export{n as t};
|
|
2
|
+
//# sourceMappingURL=use-matches-media-query-BxTQ5f4i.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-matches-media-query-BxTQ5f4i.js","names":[],"sources":["../src/hooks/use-matches-media-query.tsx"],"sourcesContent":["import { useCallback, useSyncExternalStore } from \"react\";\n\n/**\n * React hook that subscribes to and returns the result of a CSS media query.\n *\n * This hook uses `window.matchMedia` under the hood and leverages\n * `useSyncExternalStore` to stay compliant with React's concurrent rendering model.\n *\n * @param {string} query - A valid CSS media query string (e.g., `(max-width: 768px)`).\n *\n * @returns {boolean} `true` if the media query currently matches, otherwise `false`.\n *\n * @example\n * // Detect if the user prefers a dark color scheme:\n * const isDarkMode = useMatchesMediaQuery(\"(prefers-color-scheme: dark)\");\n *\n * if (isDarkMode) {\n * document.body.classList.add(\"dark\");\n * } else {\n * document.body.classList.remove(\"dark\");\n * }\n */\nexport function useMatchesMediaQuery(query: string) {\n\tconst subscribe = useCallback(\n\t\t(callback: () => void) => {\n\t\t\tconst matchMedia = window.matchMedia(query);\n\n\t\t\tmatchMedia.addEventListener(\"change\", callback);\n\t\t\treturn () => {\n\t\t\t\tmatchMedia.removeEventListener(\"change\", callback);\n\t\t\t};\n\t\t},\n\t\t[query],\n\t);\n\n\treturn useSyncExternalStore(\n\t\tsubscribe,\n\t\t() => {\n\t\t\treturn window.matchMedia(query).matches;\n\t\t},\n\t\t() => false,\n\t);\n}\n"],"mappings":"8DAsBA,SAAgB,EAAqB,EAAe,CAanD,OAAO,EAZW,EAChB,GAAyB,CACzB,IAAM,EAAa,OAAO,WAAW,EAAM,CAG3C,OADA,EAAW,iBAAiB,SAAU,EAAS,KAClC,CACZ,EAAW,oBAAoB,SAAU,EAAS,GAGpD,CAAC,EAAM,CACP,KAKQ,OAAO,WAAW,EAAM,CAAC,YAE3B,GACN"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./browser-only-jrBUqioz.js";import{useEffect as t,useState as n}from"react";const r=`(prefers-reduced-motion: no-preference)`;function i(){return e()?!window.matchMedia(r).matches:!0}function a(){let[e,a]=n(!0);return t(()=>{let e=window.matchMedia(r);a(i());function t(e){a(!e.matches)}return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}},[]),e}export{a as n,i as t};
|
|
2
|
+
//# sourceMappingURL=use-prefers-reduced-motion-BPlsKyCJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-prefers-reduced-motion-BPlsKyCJ.js","names":[],"sources":["../src/hooks/use-prefers-reduced-motion.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { canUseDOM } from \"../components/browser-only/browser-only.js\";\n\n/**\n * no-preference is the default value for the prefers-reduced-motion media query.\n * Users who have never fiddled with their a11y settings will still see animations\n * (no explicit opt-in required from a user's perspective)\n */\nconst query = \"(prefers-reduced-motion: no-preference)\";\n\n/**\n * Imperatively reads the current `prefers-reduced-motion` preference.\n * Useful in event handlers and plain functions where a hook cannot be called.\n *\n * Returns `true` when the user has opted out of animations.\n *\n * @remarks\n * Returns `true` (reduce motion) when called outside a browser environment (SSR),\n * matching the conservative default of {@link usePrefersReducedMotion}.\n */\nexport function getPrefersReducedMotion(): boolean {\n\tif (!canUseDOM()) {\n\t\treturn true;\n\t}\n\treturn !window.matchMedia(query).matches;\n}\n\n/**\n * Returns `true` when the user has opted out of animations (i.e., prefers reduced motion).\n *\n * Implementation notes:\n * - Uses the `(prefers-reduced-motion: no-preference)` media query and inverts it.\n * This keeps the “default” mental model explicit: if the system hasn’t opted out,\n * animations are allowed.\n * - Defaults to `true` (reduce motion) on the server/during SSR to avoid animating\n * before hydration. The initial client effect reads the *real* preference and updates state.\n *\n * @example\n * // Conditionally shorten or skip transitions\n * const reduce = usePrefersReducedMotion();\n * const duration = reduce ? 0 : 200;\n *\n * @remarks\n * If you need to support very old browsers that lack `MediaQueryList.addEventListener`,\n * consider falling back to `addListener/removeListener`.\n */\nexport function usePrefersReducedMotion(): boolean {\n\t// Default to no animations on SSR/first paint; update on mount with the real value.\n\tconst [prefersReducedMotion, setPrefersReducedMotion] = useState(true);\n\n\tuseEffect(() => {\n\t\tconst mediaQueryList = window.matchMedia(query);\n\n\t\t// set the _real_ initial value now that we're on the client\n\t\tsetPrefersReducedMotion(getPrefersReducedMotion());\n\n\t\t// register for updates\n\t\tfunction listener(event: MediaQueryListEvent) {\n\t\t\tsetPrefersReducedMotion(!event.matches);\n\t\t}\n\n\t\tmediaQueryList.addEventListener(\"change\", listener);\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener(\"change\", listener);\n\t\t};\n\t}, []);\n\n\treturn prefersReducedMotion;\n}\n"],"mappings":"+FAQA,MAAM,EAAQ,0CAYd,SAAgB,GAAmC,CAIlD,OAHK,GAAW,CAGT,CAAC,OAAO,WAAW,EAAM,CAAC,QAFzB,GAwBT,SAAgB,GAAmC,CAElD,GAAM,CAAC,EAAsB,GAA2B,EAAS,GAAK,CAoBtE,OAlBA,MAAgB,CACf,IAAM,EAAiB,OAAO,WAAW,EAAM,CAG/C,EAAwB,GAAyB,CAAC,CAGlD,SAAS,EAAS,EAA4B,CAC7C,EAAwB,CAAC,EAAM,QAAQ,CAKxC,OAFA,EAAe,iBAAiB,SAAU,EAAS,KAEtC,CACZ,EAAe,oBAAoB,SAAU,EAAS,GAErD,EAAE,CAAC,CAEC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import 'react';
|
|
1
|
+
import { _ as timeSortingDirections, a as AlphanumericSortingDirection, c as TimeSortingDirection, d as isSortingDirection, f as isSortingMode, g as timeSortingByDirection, h as sortingModes, i as $timeSortingDirection, l as alphanumericSortingDirections, m as sortingDirections, n as $sortingDirection, o as SortingDirection, p as isTimeSortingDirection, r as $sortingMode, s as SortingMode, t as $alphanumericSortingDirection, u as isAlphanumericSortingDirection } from "./direction-deXpJFDZ.js";
|
|
2
|
+
import { a as composeRefs, i as inView, n as MarginType, r as ViewChangeHandler, t as InViewOptions } from "./in-view-CTQRT44m.js";
|
|
4
3
|
|
|
4
|
+
//#region src/utils/sorting/compare.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Compare dates in newest-to-oldest (descending) order.
|
|
7
7
|
* Used for chronological sorting use cases.
|
|
@@ -16,5 +16,6 @@ declare function compareDatesNewestToOldest(a: Date, b: Date): number;
|
|
|
16
16
|
* @returns A negative number if `a` comes earlier in time than `b`; positive if `a` comes later in time than `b`; 0 if they are equivalent.
|
|
17
17
|
*/
|
|
18
18
|
declare function compareDatesOldestToNewest(a: Date, b: Date): number;
|
|
19
|
-
|
|
20
|
-
export { compareDatesNewestToOldest, compareDatesOldestToNewest };
|
|
19
|
+
//#endregion
|
|
20
|
+
export { $alphanumericSortingDirection, $sortingDirection, $sortingMode, $timeSortingDirection, type AlphanumericSortingDirection, type InViewOptions, type MarginType, type SortingDirection, type SortingMode, type TimeSortingDirection, type ViewChangeHandler, alphanumericSortingDirections, compareDatesNewestToOldest, compareDatesOldestToNewest, composeRefs, inView, isAlphanumericSortingDirection, isSortingDirection, isSortingMode, isTimeSortingDirection, sortingDirections, sortingModes, timeSortingByDirection, timeSortingDirections };
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"./compose-refs-DeIsFv68.js";import{a as t,c as n,d as r,f as i,i as a,l as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./direction-DfrtFTny.js";import{t as m}from"./in-view-bPnaWEL4.js";function h(e,t){return Math.sign(t.getTime()-e.getTime())}function g(e,t){return Math.sign(e.getTime()-t.getTime())}export{f as $alphanumericSortingDirection,s as $sortingDirection,u as $sortingMode,a as $timeSortingDirection,t as alphanumericSortingDirections,h as compareDatesNewestToOldest,g as compareDatesOldestToNewest,e as composeRefs,m as inView,c as isAlphanumericSortingDirection,d as isSortingDirection,n as isSortingMode,o as isTimeSortingDirection,p as sortingDirections,r as sortingModes,i as timeSortingByDirection,l as timeSortingDirections};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/sorting/compare.ts"],"sourcesContent":["/**\n * Compare dates in newest-to-oldest (descending) order.\n * Used for chronological sorting use cases.\n *\n * @returns A negative number if `b` comes earlier in time than `a`; positive if `b` comes later in time than `a`; 0 if they are equivalent.\n */\nfunction compareDatesNewestToOldest(a: Date, b: Date): number {\n\treturn Math.sign(b.getTime() - a.getTime());\n}\n\n/**\n * Compare dates in oldest-to-newest (ascending) order.\n * Used for chronological sorting use cases.\n *\n * @returns A negative number if `a` comes earlier in time than `b`; positive if `a` comes later in time than `b`; 0 if they are equivalent.\n */\nfunction compareDatesOldestToNewest(a: Date, b: Date): number {\n\treturn Math.sign(a.getTime() - b.getTime());\n}\n\nexport {\n\t//,\n\tcompareDatesNewestToOldest,\n\tcompareDatesOldestToNewest,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils/sorting/compare.ts"],"sourcesContent":["/**\n * Compare dates in newest-to-oldest (descending) order.\n * Used for chronological sorting use cases.\n *\n * @returns A negative number if `b` comes earlier in time than `a`; positive if `b` comes later in time than `a`; 0 if they are equivalent.\n */\nfunction compareDatesNewestToOldest(a: Date, b: Date): number {\n\treturn Math.sign(b.getTime() - a.getTime());\n}\n\n/**\n * Compare dates in oldest-to-newest (ascending) order.\n * Used for chronological sorting use cases.\n *\n * @returns A negative number if `a` comes earlier in time than `b`; positive if `a` comes later in time than `b`; 0 if they are equivalent.\n */\nfunction compareDatesOldestToNewest(a: Date, b: Date): number {\n\treturn Math.sign(a.getTime() - b.getTime());\n}\n\nexport {\n\t//,\n\tcompareDatesNewestToOldest,\n\tcompareDatesOldestToNewest,\n};\n"],"mappings":"yNAMA,SAAS,EAA2B,EAAS,EAAiB,CAC7D,OAAO,KAAK,KAAK,EAAE,SAAS,CAAG,EAAE,SAAS,CAAC,CAS5C,SAAS,EAA2B,EAAS,EAAiB,CAC7D,OAAO,KAAK,KAAK,EAAE,SAAS,CAAG,EAAE,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as DeepNonNullable } from "./deep-non-nullable-BLM3Gz0I.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
//#region src/types/variant-props.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Variant props that are optional and cannot be `null`.
|
|
7
|
+
*
|
|
8
|
+
* Using VariantProps directly from CVA produces that can be `null`, which is not what we want.
|
|
9
|
+
*/
|
|
10
|
+
type VariantProps$1<Variants extends (props: Record<PropertyKey, unknown> | undefined) => string> = Partial<DeepNonNullable<VariantProps<Variants>>>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { VariantProps$1 as t };
|
|
13
|
+
//# sourceMappingURL=variant-props-UE-phTwh.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/types/with-style-props.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Helper type that includes an optional className and style prop for react
|
|
6
|
+
* components.
|
|
7
|
+
*/
|
|
8
|
+
type WithStyleProps = {
|
|
9
|
+
/**
|
|
10
|
+
* A string. Specifies the element’s CSS class name.
|
|
11
|
+
*
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/className
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* An object with CSS styles, for example `{ fontWeight: 'bold', margin: 20 }`.
|
|
17
|
+
* Similarly to the DOM style property, the CSS property names need to be
|
|
18
|
+
* written as camelCase, for example fontWeight instead of font-weight.
|
|
19
|
+
* You can pass strings or numbers as values. If you pass a number, like
|
|
20
|
+
* `width: 100`, React will automatically append px (“pixels”) to the value
|
|
21
|
+
* unless it’s a unitless property.
|
|
22
|
+
*
|
|
23
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
24
|
+
*/
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { WithStyleProps as t };
|
|
29
|
+
//# sourceMappingURL=with-style-props-D1QFTzj6.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrok/mantle",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.1",
|
|
4
4
|
"description": "mantle is ngrok's UI library and design system.",
|
|
5
5
|
"homepage": "https://mantle.ngrok.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
}
|
|
284
284
|
},
|
|
285
285
|
"dependencies": {
|
|
286
|
-
"@ariakit/react": "0.4.
|
|
286
|
+
"@ariakit/react": "0.4.22",
|
|
287
287
|
"@headlessui/react": "2.2.9",
|
|
288
288
|
"@radix-ui/react-accordion": "1.2.12",
|
|
289
289
|
"@radix-ui/react-dialog": "1.1.15",
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
"clsx": "2.1.1",
|
|
304
304
|
"cmdk": "1.1.1",
|
|
305
305
|
"prismjs": "1.30.0",
|
|
306
|
-
"react-day-picker": "9.
|
|
306
|
+
"react-day-picker": "9.14.0",
|
|
307
307
|
"sonner": "2.0.7",
|
|
308
308
|
"tailwind-merge": "3.5.0",
|
|
309
309
|
"tiny-invariant": "1.3.3",
|
|
@@ -326,7 +326,7 @@
|
|
|
326
326
|
"react": "19.2.4",
|
|
327
327
|
"react-dom": "19.2.4",
|
|
328
328
|
"tailwindcss": "4.2.1",
|
|
329
|
-
"
|
|
329
|
+
"tsdown": "0.21.0",
|
|
330
330
|
"typescript": "5.9.3",
|
|
331
331
|
"@cfg/tsconfig": "1.0.0"
|
|
332
332
|
},
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
"date-fns": "^4.1.0",
|
|
336
336
|
"react": "^18 || ^19",
|
|
337
337
|
"react-dom": "^18 || ^19",
|
|
338
|
-
"tailwindcss": "^4.2.
|
|
338
|
+
"tailwindcss": "^4.2.1"
|
|
339
339
|
},
|
|
340
340
|
"browserslist": [
|
|
341
341
|
"last 2 years, not dead, > 0.2%"
|
|
@@ -344,7 +344,7 @@
|
|
|
344
344
|
"node": "^24.0.0"
|
|
345
345
|
},
|
|
346
346
|
"scripts": {
|
|
347
|
-
"build": "NODE_OPTIONS='--max-old-space-size=16384'
|
|
347
|
+
"build": "NODE_OPTIONS='--max-old-space-size=16384' tsdown",
|
|
348
348
|
"clean": "rm -rf dist",
|
|
349
349
|
"install:playwright": "node ../../scripts/install-playwright.js",
|
|
350
350
|
"prebuild": "pnpm run clean",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility type for adding the optional `asChild` boolean prop to a component.
|
|
3
|
-
*/
|
|
4
|
-
type WithAsChild = {
|
|
5
|
-
/**
|
|
6
|
-
* Use the `asChild` prop to compose component functionality onto alternative
|
|
7
|
-
* element types or your own React components.
|
|
8
|
-
*
|
|
9
|
-
* When `asChild` is set to `true`, mantle will not render a default DOM
|
|
10
|
-
* element, instead cloning the part's child and passing it the props and
|
|
11
|
-
* behavior required to make it functional.
|
|
12
|
-
*
|
|
13
|
-
* `asChild` can be used as deeply as you need to. This means it is a great way
|
|
14
|
-
* to compose multiple primitive's behavior together.
|
|
15
|
-
*
|
|
16
|
-
* @see https://www.radix-ui.com/docs/primitives/guides/composition#composition
|
|
17
|
-
*/
|
|
18
|
-
asChild?: boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type { WithAsChild as W };
|
package/dist/browser-only.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { D as DeepNonNullable } from './deep-non-nullable-SmpSvoSd.js';
|
|
2
|
-
import * as class_variance_authority from 'class-variance-authority';
|
|
3
|
-
import * as react from 'react';
|
|
4
|
-
import { ReactNode, ComponentProps } from 'react';
|
|
5
|
-
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
-
import { V as VariantProps } from './variant-props-oDo2u-We.js';
|
|
7
|
-
|
|
8
|
-
declare const buttonVariants: (props?: ({
|
|
9
|
-
appearance?: "filled" | "link" | "ghost" | "outlined" | null | undefined;
|
|
10
|
-
isLoading?: boolean | null | undefined;
|
|
11
|
-
priority?: "default" | "danger" | "neutral" | null | undefined;
|
|
12
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
-
type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
14
|
-
/**
|
|
15
|
-
* The props for the `Button` component.
|
|
16
|
-
*/
|
|
17
|
-
type ButtonProps = ComponentProps<"button"> & ButtonVariants & {
|
|
18
|
-
/**
|
|
19
|
-
* An icon to render inside the button. If the `state` is `"pending"`, then
|
|
20
|
-
* the icon will automatically be replaced with a spinner.
|
|
21
|
-
*/
|
|
22
|
-
icon?: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* The side that the icon will render on, if one is present. If `state="pending"`,
|
|
25
|
-
* then the loading icon will also render on this side.
|
|
26
|
-
* @default "start"
|
|
27
|
-
*/
|
|
28
|
-
iconPlacement?: "start" | "end";
|
|
29
|
-
} & ({
|
|
30
|
-
/**
|
|
31
|
-
* Use the `asChild` prop to compose Radix's functionality onto alternative
|
|
32
|
-
* element types or your own React components.
|
|
33
|
-
*
|
|
34
|
-
* When `asChild` is set to `true`, mantle will not render a default DOM
|
|
35
|
-
* element, instead cloning the component's child and passing it the props and
|
|
36
|
-
* behavior required to make it functional.
|
|
37
|
-
*
|
|
38
|
-
* asChild can be used as deeply as you need to. This means it is a great way
|
|
39
|
-
* to compose multiple primitive's behavior together.
|
|
40
|
-
*
|
|
41
|
-
* @see https://www.radix-ui.com/docs/primitives/guides/composition#composition
|
|
42
|
-
*/
|
|
43
|
-
asChild: true;
|
|
44
|
-
/**
|
|
45
|
-
* The default behavior of the button. Possible values are: `"button"`, `"submit"`, and `"reset"`.
|
|
46
|
-
*
|
|
47
|
-
* if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.
|
|
48
|
-
*
|
|
49
|
-
* If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type
|
|
50
|
-
*
|
|
51
|
-
* @enum
|
|
52
|
-
* - `"button"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.
|
|
53
|
-
* - `"reset"`: The button resets all the controls to their initial values.
|
|
54
|
-
* - `"submit"`: The button submits the form data to the server.
|
|
55
|
-
*
|
|
56
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type
|
|
57
|
-
*/
|
|
58
|
-
type?: ComponentProps<"button">["type"];
|
|
59
|
-
} | {
|
|
60
|
-
asChild?: false | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* The default behavior of the button. Possible values are: `"button"`, `"submit"`, and `"reset"`.
|
|
63
|
-
*
|
|
64
|
-
* if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.
|
|
65
|
-
*
|
|
66
|
-
* If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type
|
|
67
|
-
*
|
|
68
|
-
* @enum
|
|
69
|
-
* - `"button"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.
|
|
70
|
-
* - `"reset"`: The button resets all the controls to their initial values.
|
|
71
|
-
* - `"submit"`: The button submits the form data to the server.
|
|
72
|
-
*
|
|
73
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type
|
|
74
|
-
*/
|
|
75
|
-
type: Exclude<ComponentProps<"button">["type"], undefined>;
|
|
76
|
-
});
|
|
77
|
-
/**
|
|
78
|
-
* Renders a button or a component that looks like a button, an interactive
|
|
79
|
-
* element activated by a user with a mouse, keyboard, finger, voice command, or
|
|
80
|
-
* other assistive technology. Once activated, it then performs an action, such
|
|
81
|
-
* as submitting a form or opening a dialog.
|
|
82
|
-
*
|
|
83
|
-
* @see https://mantle.ngrok.com/components/button
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```tsx
|
|
87
|
-
* <Button type="button" appearance="filled" priority="default">
|
|
88
|
-
* Click me
|
|
89
|
-
* </Button>
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
declare const Button: react.ForwardRefExoticComponent<(Omit<react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<class_variance_authority.VariantProps<(props?: ({
|
|
93
|
-
appearance?: "filled" | "link" | "ghost" | "outlined" | null | undefined;
|
|
94
|
-
isLoading?: boolean | null | undefined;
|
|
95
|
-
priority?: "default" | "danger" | "neutral" | null | undefined;
|
|
96
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string>>> & {
|
|
97
|
-
/**
|
|
98
|
-
* An icon to render inside the button. If the `state` is `"pending"`, then
|
|
99
|
-
* the icon will automatically be replaced with a spinner.
|
|
100
|
-
*/
|
|
101
|
-
icon?: ReactNode;
|
|
102
|
-
/**
|
|
103
|
-
* The side that the icon will render on, if one is present. If `state="pending"`,
|
|
104
|
-
* then the loading icon will also render on this side.
|
|
105
|
-
* @default "start"
|
|
106
|
-
*/
|
|
107
|
-
iconPlacement?: "start" | "end";
|
|
108
|
-
} & {
|
|
109
|
-
/**
|
|
110
|
-
* Use the `asChild` prop to compose Radix's functionality onto alternative
|
|
111
|
-
* element types or your own React components.
|
|
112
|
-
*
|
|
113
|
-
* When `asChild` is set to `true`, mantle will not render a default DOM
|
|
114
|
-
* element, instead cloning the component's child and passing it the props and
|
|
115
|
-
* behavior required to make it functional.
|
|
116
|
-
*
|
|
117
|
-
* asChild can be used as deeply as you need to. This means it is a great way
|
|
118
|
-
* to compose multiple primitive's behavior together.
|
|
119
|
-
*
|
|
120
|
-
* @see https://www.radix-ui.com/docs/primitives/guides/composition#composition
|
|
121
|
-
*/
|
|
122
|
-
asChild: true;
|
|
123
|
-
/**
|
|
124
|
-
* The default behavior of the button. Possible values are: `"button"`, `"submit"`, and `"reset"`.
|
|
125
|
-
*
|
|
126
|
-
* if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.
|
|
127
|
-
*
|
|
128
|
-
* If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type
|
|
129
|
-
*
|
|
130
|
-
* @enum
|
|
131
|
-
* - `"button"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.
|
|
132
|
-
* - `"reset"`: The button resets all the controls to their initial values.
|
|
133
|
-
* - `"submit"`: The button submits the form data to the server.
|
|
134
|
-
*
|
|
135
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type
|
|
136
|
-
*/
|
|
137
|
-
type?: ComponentProps<"button">["type"];
|
|
138
|
-
}, "ref"> | Omit<react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<class_variance_authority.VariantProps<(props?: ({
|
|
139
|
-
appearance?: "filled" | "link" | "ghost" | "outlined" | null | undefined;
|
|
140
|
-
isLoading?: boolean | null | undefined;
|
|
141
|
-
priority?: "default" | "danger" | "neutral" | null | undefined;
|
|
142
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string>>> & {
|
|
143
|
-
/**
|
|
144
|
-
* An icon to render inside the button. If the `state` is `"pending"`, then
|
|
145
|
-
* the icon will automatically be replaced with a spinner.
|
|
146
|
-
*/
|
|
147
|
-
icon?: ReactNode;
|
|
148
|
-
/**
|
|
149
|
-
* The side that the icon will render on, if one is present. If `state="pending"`,
|
|
150
|
-
* then the loading icon will also render on this side.
|
|
151
|
-
* @default "start"
|
|
152
|
-
*/
|
|
153
|
-
iconPlacement?: "start" | "end";
|
|
154
|
-
} & {
|
|
155
|
-
asChild?: false | undefined;
|
|
156
|
-
/**
|
|
157
|
-
* The default behavior of the button. Possible values are: `"button"`, `"submit"`, and `"reset"`.
|
|
158
|
-
*
|
|
159
|
-
* if `asChild` is NOT used: Unlike the native `<button>` element, this prop is required and has no default value.
|
|
160
|
-
*
|
|
161
|
-
* If `asChild` IS used: This prop HAS NO EFFECT, is REMOVED, and has no default value. This is because we do not want the `button` `type` to automatically merge with any child anchor `type` attribute because the `anchor` `type` is _strictly different_ than the `button` type, see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type
|
|
162
|
-
*
|
|
163
|
-
* @enum
|
|
164
|
-
* - `"button"`: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.
|
|
165
|
-
* - `"reset"`: The button resets all the controls to their initial values.
|
|
166
|
-
* - `"submit"`: The button submits the form data to the server.
|
|
167
|
-
*
|
|
168
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type
|
|
169
|
-
*/
|
|
170
|
-
type: Exclude<ComponentProps<"button">["type"], undefined>;
|
|
171
|
-
}, "ref">) & react.RefAttributes<HTMLButtonElement>>;
|
|
172
|
-
|
|
173
|
-
export { Button as B, type ButtonProps as a };
|
package/dist/button.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-2FYR6IJV.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{m as y}from"./chunk-SGGOH2WW.js";import{a as p}from"./chunk-IVQ626TU.js";import{a as d}from"./chunk-ADF5DAYG.js";import{a as n}from"./chunk-PFXFESEN.js";import{CheckCircleIcon as x}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as w}from"@phosphor-icons/react/Info";import{WarningIcon as I}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as N}from"@phosphor-icons/react/WarningDiamond";import{createContext as P,forwardRef as l,useContext as f}from"react";import*as c from"sonner";import{jsx as s,jsxs as k}from"react/jsx-runtime";var A=({className:t,containerAriaLabel:e,dir:o,duration_ms:r=4e3,position:i="top-center",style:a})=>{let m=y();return s(c.Toaster,{className:n("toaster overlay-prompt pointer-events-auto *:duration-200",t),containerAriaLabel:e,dir:o,duration:r,gap:12,position:i??"top-center",style:a,theme:m,toastOptions:{unstyled:!0}})};A.displayName="Toaster";var g=P("");function L(t,e){let o=e?.duration_ms;return typeof o=="number"&&o<=0&&(o=Number.POSITIVE_INFINITY),c.toast.custom(r=>s(g.Provider,{value:r,children:t}),{duration:o,...e?.id?{id:e.id}:{},unstyled:!0})}var T=P({priority:"info"}),v=l(({asChild:t,children:e,className:o,priority:r,...i},a)=>{let m=t?d:"div";return s(T.Provider,{value:{priority:r},children:k(m,{className:n("relative flex items-start gap-2 text-sm font-sans","p-3 pl-3.75","bg-popover high-contrast:border-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg",o),ref:a,...i,children:[s(S,{priority:r}),e]})})});v.displayName="Toast";var h=l(({className:t,svg:e,...o},r)=>{let i=f(T);switch(i.priority){case"danger":return s(p,{className:n("text-danger-600",t),ref:r,svg:e??s(I,{weight:"fill"}),...o});case"warning":return s(p,{className:n("text-warning-600",t),ref:r,svg:e??s(N,{weight:"fill"}),...o});case"success":return s(p,{className:n("text-success-600",t),ref:r,svg:e??s(x,{weight:"fill"}),...o});case"info":return s(p,{className:n("text-accent-600",t),ref:r,svg:s(w,{weight:"fill"}),...o});default:throw new Error(`Unreachable Case: ${i.priority}`)}});h.displayName="ToastIcon";var C=l(({asChild:t,className:e,onClick:o,...r},i)=>{let a=f(g);return s(t?d:"button",{className:n("shrink-0","data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs",e),onClick:u=>{o?.(u),!u.defaultPrevented&&c.toast.dismiss(a)},ref:i,...r})});C.displayName="ToastAction";var b=l(({asChild:t,className:e,...o},r)=>s(t?d:"p",{className:n("text-strong flex-1 text-sm font-body",e),ref:r,...o}));b.displayName="ToastMessage";var z={Root:v,Action:C,Icon:h,Message:b};function U(t){t.target instanceof Element&&t.target.closest(".overlay-prompt")&&t.preventDefault()}var R={info:"bg-accent-600",warning:"bg-warning-600",success:"bg-success-600",danger:"bg-danger-600"};function S({className:t,priority:e,...o}){return s("div",{"aria-hidden":!0,className:n("z-1 absolute -inset-px right-auto w-1.5 rounded-l",R[e],t),...o})}export{A as a,L as b,z as c,U as d};
|
|
2
|
-
//# sourceMappingURL=chunk-2FYR6IJV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { CheckCircleIcon } from \"@phosphor-icons/react/CheckCircle\";\nimport { InfoIcon } from \"@phosphor-icons/react/Info\";\nimport { WarningIcon } from \"@phosphor-icons/react/Warning\";\nimport { WarningDiamondIcon } from \"@phosphor-icons/react/WarningDiamond\";\nimport {\n\ttype ComponentProps,\n\ttype ComponentRef,\n\ttype ReactNode,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n} from \"react\";\nimport * as ToastPrimitive from \"sonner\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport type { WithStyleProps } from \"../../types/with-style-props.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon as IconComponent } from \"../icon/icon.js\";\nimport type { SvgOnlyProps } from \"../icon/svg-only.js\";\nimport { Slot } from \"../slot/index.js\";\nimport { useAppliedTheme } from \"../theme/theme-provider.js\";\n\ntype ToasterPrimitiveProps = ComponentProps<typeof ToastPrimitive.Toaster>;\ntype ToasterPrimitiveTheme = ToasterPrimitiveProps[\"theme\"];\n\ntype ToasterProps = WithStyleProps &\n\tPick<ToasterPrimitiveProps, \"containerAriaLabel\" | \"dir\" | \"position\"> & {\n\t\t/**\n\t\t * Time in milliseconds that should elapse before automatically dismissing toasts.\n\t\t * When set here, this will be the default duration for all toasts.\n\t\t * @default 4000\n\t\t */\n\t\tduration_ms?: number;\n\t};\n\n/**\n * A container for displaying all toasts.\n *\n * Only one `<Toaster />` should be rendered in an app a time, preferably at the\n * root level of the app.\n *\n * @see https://mantle.ngrok.com/components/toast#toaster\n *\n * @example\n * ```tsx\n * <Toaster\n * position=\"top-right\"\n * duration_ms={5000}\n * />\n * ```\n */\nconst Toaster = ({\n\t//,\n\tclassName,\n\tcontainerAriaLabel,\n\tdir,\n\tduration_ms = 4000,\n\tposition = \"top-center\",\n\tstyle,\n}: ToasterProps) => {\n\tconst theme = useAppliedTheme();\n\n\treturn (\n\t\t<ToastPrimitive.Toaster\n\t\t\tclassName={cx(\"toaster overlay-prompt pointer-events-auto *:duration-200\", className)}\n\t\t\tcontainerAriaLabel={containerAriaLabel}\n\t\t\tdir={dir}\n\t\t\tduration={duration_ms}\n\t\t\tgap={12}\n\t\t\tposition={position ?? \"top-center\"}\n\t\t\tstyle={style}\n\t\t\ttheme={theme as ToasterPrimitiveTheme} // we have additional themes that are not in the sonner types, so we need to cast for now\n\t\t\ttoastOptions={{\n\t\t\t\tunstyled: true,\n\t\t\t}}\n\t\t/>\n\t);\n};\nToaster.displayName = \"Toaster\";\n\nconst ToastIdContext = createContext<string | number>(\"\");\n\ntype MakeToastOptions = {\n\t/**\n\t * Time in milliseconds that should elapse before automatically closing the toast.\n\t * Will default to the `<Toaster />`'s `duration_ms` if not provided.\n\t *\n\t * You can keep the toast open until manually dismissed by passing a value <= 0 or Number.POSITIVE_INFINITY\n\t */\n\tduration_ms?: number;\n\t/**\n\t * An optional custom ID for this toast. If not given, a unique ID is provided for you.\n\t */\n\tid?: string;\n};\n\n/**\n * Create a toast. Provide a `<Toast.Root>` component as the `children` to be rendered\n * inside the `<Toaster />` section.\n *\n * @see https://mantle.ngrok.com/components/toast#maketoast\n *\n * @example\n * ```tsx\n * // Basic toast with auto-dismiss (default 4000ms, inherits from `<Toaster>`)\n * makeToast(\n * <Toast.Root priority=\"success\">\n * <Toast.Icon />\n * <Toast.Message>Operation completed successfully!</Toast.Message>\n * <Toast.Action>Dismiss</Toast.Action>\n * </Toast.Root>\n * );\n *\n * // Toast that stays open until manually dismissed\n * makeToast(\n * <Toast.Root priority=\"warning\">\n * <Toast.Icon />\n * <Toast.Message>Action required</Toast.Message>\n * <Toast.Action>Dismiss</Toast.Action>\n * </Toast.Root>,\n * { duration_ms: Number.POSITIVE_INFINITY }\n * );\n * ```\n */\nfunction makeToast(children: ReactNode, options?: MakeToastOptions) {\n\tlet duration = options?.duration_ms;\n\tif (typeof duration === \"number\" && duration <= 0) {\n\t\tduration = Number.POSITIVE_INFINITY;\n\t}\n\n\treturn ToastPrimitive.toast.custom(\n\t\t(toastId) => <ToastIdContext.Provider value={toastId}>{children}</ToastIdContext.Provider>,\n\t\t{\n\t\t\t//\n\t\t\tduration,\n\t\t\t// If a custom ID is provided, use it, else use the toastId provided by the sonner library\n\t\t\t// don't set an ID to `undefined` as it breaks the sonner library\n\t\t\t...(options?.id ? { id: options.id } : {}),\n\t\t\tunstyled: true,\n\t\t},\n\t);\n}\n\nconst priorities = [\n\t//,\n\t\"danger\",\n\t\"info\",\n\t\"success\",\n\t\"warning\",\n] as const;\ntype Priority = (typeof priorities)[number];\n\ntype ToastState = {\n\tpriority: Priority;\n};\n\nconst ToastStateContext = createContext<ToastState>({\n\tpriority: \"info\",\n});\n\ntype ToastProps = ComponentProps<\"div\"> &\n\tWithAsChild & {\n\t\tpriority: Priority;\n\t};\n\n/**\n * A succinct message with a priority that is displayed temporarily.\n * Toasts are used to provide feedback to the user without interrupting their workflow.\n *\n * @see https://mantle.ngrok.com/components/toast#toastroot\n *\n * @example\n * ```tsx\n * <Toast.Root priority=\"success\">\n * <Toast.Icon />\n * <Toast.Message>Changes saved successfully!</Toast.Message>\n * <Toast.Action>Undo</Toast.Action>\n * </Toast.Root>\n * ```\n */\nconst Root = forwardRef<ComponentRef<\"div\">, ToastProps>(\n\t({ asChild, children, className, priority, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\n\t\treturn (\n\t\t\t<ToastStateContext.Provider value={{ priority }}>\n\t\t\t\t<Component\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"relative flex items-start gap-2 text-sm font-sans\",\n\t\t\t\t\t\t\"p-3 pl-3.75\",\n\t\t\t\t\t\t\"bg-popover high-contrast:border-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg\",\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Do not apply overflow-hidden because we want the priority bar accent\n\t\t\t\t\t\t * to overlap the toast border, else the border flows over the\n\t\t\t\t\t\t * priority bar.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<PriorityBarAccent priority={priority} />\n\t\t\t\t\t{children}\n\t\t\t\t</Component>\n\t\t\t</ToastStateContext.Provider>\n\t\t);\n\t},\n);\nRoot.displayName = \"Toast\";\n\ntype ToastIconProps = Partial<SvgOnlyProps>;\n\n/**\n * An icon that visually represents the priority of the toast.\n * If you do not provide an icon, the default icon and color for the priority is used.\n *\n * @see https://mantle.ngrok.com/components/toast#toasticon\n *\n * @example\n * ```tsx\n * <Toast.Root priority=\"warning\">\n * <Toast.Icon />\n * <Toast.Message>Warning message</Toast.Message>\n * </Toast.Root>\n * ```\n */\nconst Icon = forwardRef<ComponentRef<\"svg\">, ToastIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useContext(ToastStateContext);\n\n\t\tswitch (ctx.priority) {\n\t\t\tcase \"danger\":\n\t\t\t\treturn (\n\t\t\t\t\t<IconComponent\n\t\t\t\t\t\tclassName={cx(\"text-danger-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={svg ?? <WarningIcon weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase \"warning\":\n\t\t\t\treturn (\n\t\t\t\t\t<IconComponent\n\t\t\t\t\t\tclassName={cx(\"text-warning-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={svg ?? <WarningDiamondIcon weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase \"success\":\n\t\t\t\treturn (\n\t\t\t\t\t<IconComponent\n\t\t\t\t\t\tclassName={cx(\"text-success-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={svg ?? <CheckCircleIcon weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase \"info\":\n\t\t\t\treturn (\n\t\t\t\t\t<IconComponent\n\t\t\t\t\t\t//\n\t\t\t\t\t\tclassName={cx(\"text-accent-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={<InfoIcon weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unreachable Case: ${ctx.priority}`);\n\t\t}\n\t},\n);\nIcon.displayName = \"ToastIcon\";\n\ntype ToastActionProps = ComponentProps<\"button\"> & WithAsChild;\n\n/**\n * A button that dismisses the toast when clicked.\n * You can prevent the toast from being dismissed `onClick` by calling `event.preventDefault()`\n *\n * @see https://mantle.ngrok.com/components/toast#toastaction\n *\n * @example\n * ```tsx\n * <Toast.Root priority=\"info\">\n * <Toast.Icon />\n * <Toast.Message>File uploaded successfully</Toast.Message>\n * <Toast.Action>View File</Toast.Action>\n * </Toast.Root>\n * ```\n */\nconst Action = forwardRef<ComponentRef<\"button\">, ToastActionProps>(\n\t({ asChild, className, onClick, ...props }, ref) => {\n\t\tconst ctx = useContext(ToastIdContext);\n\n\t\tconst Component = asChild ? Slot : \"button\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tclassName={cx(\n\t\t\t\t\t//,\n\t\t\t\t\t\"shrink-0\",\n\t\t\t\t\t// 👇 wiggle the bits so that icon buttons toast actions are aligned with the toast icon\n\t\t\t\t\t\"data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tToastPrimitive.toast.dismiss(ctx);\n\t\t\t\t}}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAction.displayName = \"ToastAction\";\n\ntype ToastMessageProps = ComponentProps<\"p\"> & WithAsChild;\n\n/**\n * The message content of the toast.\n *\n * @see https://mantle.ngrok.com/components/toast#toastmessage\n *\n * @example\n * ```tsx\n * <Toast.Root priority=\"success\">\n * <Toast.Icon />\n * <Toast.Message>Your changes have been saved</Toast.Message>\n * </Toast.Root>\n * ```\n */\nconst Message = forwardRef<ComponentRef<\"p\">, ToastMessageProps>(\n\t({ asChild, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"p\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\t//\n\t\t\t\tclassName={cx(\"text-strong flex-1 text-sm font-body\", className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nMessage.displayName = \"ToastMessage\";\n\n/**\n * A succinct message that is displayed temporarily. Toasts are used to provide\n * feedback to the user without interrupting their workflow.\n *\n * @see https://mantle.ngrok.com/components/toast\n *\n * @example\n * ```tsx\n * makeToast(\n * <Toast.Root priority=\"success\">\n * <Toast.Icon />\n * <Toast.Message>Operation completed successfully!</Toast.Message>\n * <Toast.Action>Dismiss</Toast.Action>\n * </Toast.Root>\n * );\n * ```\n */\nconst Toast = {\n\t/**\n\t * A succinct message with a priority that is displayed temporarily.\n\t *\n\t * @see https://mantle.ngrok.com/components/toast#toastroot\n\t *\n\t * @example\n\t * ```tsx\n\t * <Toast.Root priority=\"success\">\n\t * <Toast.Icon />\n\t * <Toast.Message>Changes saved successfully!</Toast.Message>\n\t * <Toast.Action>Undo</Toast.Action>\n\t * </Toast.Root>\n\t * ```\n\t */\n\tRoot,\n\t/**\n\t * A button that dismisses the toast when clicked.\n\t *\n\t * @see https://mantle.ngrok.com/components/toast#toastaction\n\t *\n\t * @example\n\t * ```tsx\n\t * <Toast.Root priority=\"info\">\n\t * <Toast.Icon />\n\t * <Toast.Message>File uploaded successfully</Toast.Message>\n\t * <Toast.Action>View File</Toast.Action>\n\t * </Toast.Root>\n\t * ```\n\t */\n\tAction,\n\t/**\n\t * An icon that visually represents the priority of the toast.\n\t *\n\t * @see https://mantle.ngrok.com/components/toast#toasticon\n\t *\n\t * @example\n\t * ```tsx\n\t * <Toast.Root priority=\"warning\">\n\t * <Toast.Icon />\n\t * <Toast.Message>Warning message</Toast.Message>\n\t * </Toast.Root>\n\t * ```\n\t */\n\tIcon,\n\t/**\n\t * The message content of the toast.\n\t *\n\t * @see https://mantle.ngrok.com/components/toast#toastmessage\n\t *\n\t * @example\n\t * ```tsx\n\t * <Toast.Root priority=\"success\">\n\t * <Toast.Icon />\n\t * <Toast.Message>Your changes have been saved</Toast.Message>\n\t * </Toast.Root>\n\t * ```\n\t */\n\tMessage,\n} as const;\n\nexport {\n\t//,\n\tmakeToast,\n\tToast,\n\tToaster,\n};\n\nexport type {\n\t//,\n\tPriority,\n};\n\n/**\n * @private\n *\n * Allows any mantle floating prompt (e.g. toasts and notifications) to be interacted with\n * even when a modaled view (e.g. dialog, sheet, etc) is open and a focus trap is active.\n *\n * Without this, interacting with the prompt would close the modaled view.\n *\n * @example\n * ```tsx\n * <Dialog.Root onInteractOutside={preventCloseOnPromptInteraction}>\n * <Dialog.Content>\n * <p>Dialog content</p>\n * </Dialog.Content>\n * </Dialog.Root>\n * ```\n */\nexport function preventCloseOnPromptInteraction(\n\tevent: CustomEvent | PointerEvent | MouseEvent | TouchEvent | FocusEvent,\n) {\n\tif (!(event.target instanceof Element)) {\n\t\treturn;\n\t}\n\n\tif (event.target.closest(\".overlay-prompt\")) {\n\t\tevent.preventDefault();\n\t}\n}\n\nconst priorityBackgroundColor = {\n\tinfo: \"bg-accent-600\",\n\twarning: \"bg-warning-600\",\n\tsuccess: \"bg-success-600\",\n\tdanger: \"bg-danger-600\",\n} as const satisfies Record<Priority, string>;\n\ntype PriorityBarAccentProps = Omit<ComponentProps<\"div\">, \"children\"> & {\n\tpriority: Priority;\n};\n\n/**\n * @private\n *\n * A colored bar that visually represents the priority of the toast.\n */\nfunction PriorityBarAccent({ className, priority, ...props }: PriorityBarAccentProps) {\n\treturn (\n\t\t<div\n\t\t\taria-hidden\n\t\t\tclassName={cx(\n\t\t\t\t//\n\t\t\t\t\"z-1 absolute -inset-px right-auto w-1.5 rounded-l\",\n\t\t\t\tpriorityBackgroundColor[priority],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n"],"mappings":"gKAEA,OAAS,mBAAAA,MAAuB,oCAChC,OAAS,YAAAC,MAAgB,6BACzB,OAAS,eAAAC,MAAmB,gCAC5B,OAAS,sBAAAC,MAA0B,uCACnC,OAIC,iBAAAC,EACA,cAAAC,EACA,cAAAC,MACM,QACP,UAAYC,MAAoB,SAkD9B,cAAAC,EA2HE,QAAAC,MA3HF,oBAZF,IAAMC,EAAU,CAAC,CAEhB,UAAAC,EACA,mBAAAC,EACA,IAAAC,EACA,YAAAC,EAAc,IACd,SAAAC,EAAW,aACX,MAAAC,CACD,IAAoB,CACnB,IAAMC,EAAQC,EAAgB,EAE9B,OACCV,EAAgB,UAAf,CACA,UAAWW,EAAG,4DAA6DR,CAAS,EACpF,mBAAoBC,EACpB,IAAKC,EACL,SAAUC,EACV,IAAK,GACL,SAAUC,GAAY,aACtB,MAAOC,EACP,MAAOC,EACP,aAAc,CACb,SAAU,EACX,EACD,CAEF,EACAP,EAAQ,YAAc,UAEtB,IAAMU,EAAiBC,EAA+B,EAAE,EA4CxD,SAASC,EAAUC,EAAqBC,EAA4B,CACnE,IAAIC,EAAWD,GAAS,YACxB,OAAI,OAAOC,GAAa,UAAYA,GAAY,IAC/CA,EAAW,OAAO,mBAGG,QAAM,OAC1BC,GAAYlB,EAACY,EAAe,SAAf,CAAwB,MAAOM,EAAU,SAAAH,EAAS,EAChE,CAEC,SAAAE,EAGA,GAAID,GAAS,GAAK,CAAE,GAAIA,EAAQ,EAAG,EAAI,CAAC,EACxC,SAAU,EACX,CACD,CACD,CAeA,IAAMG,EAAoBC,EAA0B,CACnD,SAAU,MACX,CAAC,EAsBKC,EAAOC,EACZ,CAAC,CAAE,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IAAQ,CAC9D,IAAMC,EAAYN,EAAUO,EAAO,MAEnC,OACCC,EAACZ,EAAkB,SAAlB,CAA2B,MAAO,CAAE,SAAAO,CAAS,EAC7C,SAAAM,EAACH,EAAA,CACA,UAAWI,EACV,oDACA,cACA,4GAMAR,CACD,EACA,IAAKG,EACJ,GAAGD,EAEJ,UAAAI,EAACG,EAAA,CAAkB,SAAUR,EAAU,EACtCF,GACF,EACD,CAEF,CACD,EACAH,EAAK,YAAc,QAkBnB,IAAMc,EAAOb,EACZ,CAAC,CAAE,UAAAG,EAAW,IAAAW,EAAK,GAAGT,CAAM,EAAGC,IAAQ,CACtC,IAAMS,EAAMC,EAAWnB,CAAiB,EAExC,OAAQkB,EAAI,SAAU,CACrB,IAAK,SACJ,OACCN,EAACI,EAAA,CACA,UAAWF,EAAG,kBAAmBR,CAAS,EAC1C,IAAKG,EACL,IAAKQ,GAAOL,EAACQ,EAAA,CAAY,OAAO,OAAO,EACtC,GAAGZ,EACL,EAEF,IAAK,UACJ,OACCI,EAACI,EAAA,CACA,UAAWF,EAAG,mBAAoBR,CAAS,EAC3C,IAAKG,EACL,IAAKQ,GAAOL,EAACS,EAAA,CAAmB,OAAO,OAAO,EAC7C,GAAGb,EACL,EAEF,IAAK,UACJ,OACCI,EAACI,EAAA,CACA,UAAWF,EAAG,mBAAoBR,CAAS,EAC3C,IAAKG,EACL,IAAKQ,GAAOL,EAACU,EAAA,CAAgB,OAAO,OAAO,EAC1C,GAAGd,EACL,EAEF,IAAK,OACJ,OACCI,EAACI,EAAA,CAEA,UAAWF,EAAG,kBAAmBR,CAAS,EAC1C,IAAKG,EACL,IAAKG,EAACW,EAAA,CAAS,OAAO,OAAO,EAC5B,GAAGf,EACL,EAEF,QACC,MAAM,IAAI,MAAM,qBAAqBU,EAAI,QAAQ,EAAE,CACrD,CACD,CACD,EACAF,EAAK,YAAc,YAmBnB,IAAMQ,EAASrB,EACd,CAAC,CAAE,QAAAC,EAAS,UAAAE,EAAW,QAAAmB,EAAS,GAAGjB,CAAM,EAAGC,IAAQ,CACnD,IAAMS,EAAMC,EAAWO,CAAc,EAIrC,OACCd,EAHiBR,EAAUO,EAAO,SAGjC,CACA,UAAWG,EAEV,WAEA,gFACAR,CACD,EACA,QAAUqB,GAAU,CACnBF,IAAUE,CAAK,EACX,CAAAA,EAAM,kBAGK,QAAM,QAAQT,CAAG,CACjC,EACA,IAAKT,EACJ,GAAGD,EACL,CAEF,CACD,EACAgB,EAAO,YAAc,cAiBrB,IAAMI,EAAUzB,EACf,CAAC,CAAE,QAAAC,EAAS,UAAAE,EAAW,GAAGE,CAAM,EAAGC,IAIjCG,EAHiBR,EAAUO,EAAO,IAGjC,CAEA,UAAWG,EAAG,uCAAwCR,CAAS,EAC/D,IAAKG,EACJ,GAAGD,EACL,CAGH,EACAoB,EAAQ,YAAc,eAmBtB,IAAMC,EAAQ,CAeb,KAAA3B,EAeA,OAAAsB,EAcA,KAAAR,EAcA,QAAAY,CACD,EA+BO,SAASE,EACfC,EACC,CACKA,EAAM,kBAAkB,SAI1BA,EAAM,OAAO,QAAQ,iBAAiB,GACzCA,EAAM,eAAe,CAEvB,CAEA,IAAMC,EAA0B,CAC/B,KAAM,gBACN,QAAS,iBACT,QAAS,iBACT,OAAQ,eACT,EAWA,SAASC,EAAkB,CAAE,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,EAA2B,CACrF,OACCC,EAAC,OACA,cAAW,GACX,UAAWC,EAEV,oDACAN,EAAwBG,CAAQ,EAChCD,CACD,EACC,GAAGE,EACL,CAEF","names":["CheckCircleIcon","InfoIcon","WarningIcon","WarningDiamondIcon","createContext","forwardRef","useContext","ToastPrimitive","jsx","jsxs","Toaster","className","containerAriaLabel","dir","duration_ms","position","style","theme","useAppliedTheme","cx","ToastIdContext","createContext","makeToast","children","options","duration","toastId","ToastStateContext","createContext","Root","forwardRef","asChild","children","className","priority","props","ref","Component","Slot","jsx","jsxs","cx","PriorityBarAccent","Icon","svg","ctx","useContext","WarningIcon","WarningDiamondIcon","CheckCircleIcon","InfoIcon","Action","onClick","ToastIdContext","event","Message","Toast","preventCloseOnPromptInteraction","event","priorityBackgroundColor","PriorityBarAccent","className","priority","props","jsx","cx"]}
|
package/dist/chunk-5VDCC3YW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useSyncExternalStore as n}from"react";function e(){return n(o,()=>!0,()=>!1)}function o(){return()=>{}}function f({children:r,fallback:t=null}){return e()?r():t}function a(){return typeof window<"u"&&typeof document<"u"}export{e as a,f as b,a as c};
|
|
2
|
-
//# sourceMappingURL=chunk-5VDCC3YW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-is-hydrated.tsx","../src/components/browser-only/browser-only.tsx"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\n\n/**\n * React hook that returns whether the component tree has been hydrated\n * on the client.\n *\n * Uses `useSyncExternalStore` to ensure the value is consistent between\n * server and client rendering, preventing hydration mismatches.\n *\n * - On the server, it always returns `false`.\n * - On the client (after hydration), it returns `true`.\n *\n * @see https://tkdodo.eu/blog/avoiding-hydration-mismatches-with-use-sync-external-store\n *\n * @returns {boolean} `true` once hydration has occurred on the client,\n * otherwise `false`.\n *\n * @example\n * const isHydrated = useIsHydrated();\n *\n * if (!isHydrated) {\n * return <span style={{ visibility: \"hidden\" }}>Loading…</span>;\n * }\n *\n * return <span>Ready!</span>;\n */\nfunction useIsHydrated() {\n\treturn useSyncExternalStore(\n\t\temptySubscribe,\n\t\t() => true,\n\t\t() => false,\n\t);\n}\n\nexport {\n\t//,\n\tuseIsHydrated,\n};\n\n/**\n * No-op subscription function required by `useSyncExternalStore`.\n *\n * Since hydration state never changes after mount, this effectively\n * does nothing.\n *\n * @private\n */\nfunction emptySubscribe() {\n\treturn () => {};\n}\n","import type { ReactNode } from \"react\";\nimport { useIsHydrated } from \"../../hooks/use-is-hydrated.js\";\n\ntype Props = {\n\t/**\n\t * Children must be a render function so that evaluation is deferred\n\t * until after hydration has occurred.\n\t */\n\tchildren: () => ReactNode;\n\t/**\n\t * Optional fallback to render on the server (and during hydration)\n\t * before the client-only children are mounted.\n\t * Ideally, this should be the same dimensions as the eventual children\n\t * to avoid layout shift.\n\t */\n\tfallback?: ReactNode;\n};\n\n/**\n * A wrapper component that ensures its children only render in the browser,\n * after hydration has completed.\n *\n * This is useful for components that rely on browser-only APIs\n * (e.g. `window`, `document`, `localStorage`, media queries) or that\n * cannot safely be rendered during server-side rendering (SSR).\n *\n * - On the server, and during the initial hydration pass,\n * the `fallback` is rendered.\n * - On the client, after hydration, the `children` render function is called.\n *\n * @see https://mantle.ngrok.com/components/browser-only\n *\n * @example\n * ```tsx\n * <BrowserOnly fallback={<div style={{ height: 200 }} />} >\n * {() => <ExpensiveChart />}\n * </BrowserOnly>\n * ```\n *\n * @see useIsHydrated\n */\nfunction BrowserOnly({ children, fallback = null }: Props) {\n\treturn useIsHydrated() ? children() : fallback;\n}\n\n/**\n * Detects whether DOM APIs are available.\n *\n * @description\n * Returns `true` when running in a windowed browser context where both\n * `window` and a real `document` exist. This will be `false` in SSR/Node.\n *\n * Note: Test environments that provide a DOM shim (e.g. JSDOM) will return `true`.\n *\n * @returns {boolean} `true` if DOM APIs are available; otherwise `false`.\n *\n * @example\n * if (canUseDOM()) {\n * localStorage.setItem(\"foo\", \"bar\");\n * }\n */\nfunction canUseDOM(): boolean {\n\treturn typeof window !== \"undefined\" && typeof document !== \"undefined\";\n}\n\nexport {\n\t//,\n\tcanUseDOM,\n\tBrowserOnly,\n};\n"],"mappings":"AAAA,OAAS,wBAAAA,MAA4B,QA0BrC,SAASC,GAAgB,CACxB,OAAOD,EACNE,EACA,IAAM,GACN,IAAM,EACP,CACD,CAeA,SAASC,GAAiB,CACzB,MAAO,IAAM,CAAC,CACf,CCRA,SAASC,EAAY,CAAE,SAAAC,EAAU,SAAAC,EAAW,IAAK,EAAU,CAC1D,OAAOC,EAAc,EAAIF,EAAS,EAAIC,CACvC,CAkBA,SAASE,GAAqB,CAC7B,OAAO,OAAO,OAAW,KAAe,OAAO,SAAa,GAC7D","names":["useSyncExternalStore","useIsHydrated","emptySubscribe","emptySubscribe","BrowserOnly","children","fallback","useIsHydrated","canUseDOM"]}
|
package/dist/chunk-63ZAW25Z.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/css-properties.ts"],"sourcesContent":["import type { CSSProperties as ReactCSSProperties } from \"react\";\n\n/**\n * A CSS custom property (CSS variable) name.\n *\n * CSS variables must start with `--`, e.g. `--brand-color` or `--spacing-2`.\n * This template-literal type lets TypeScript recognize those keys as valid\n * style keys when building objects for `style={...}`.\n */\ntype CssVariableName = `--${string}`;\n\n/**\n * React-compatible CSS properties plus support for CSS custom properties.\n *\n * React's `CSSProperties` type does not allow arbitrary property names by\n * default, so keys like `--foo` would normally be rejected by TypeScript.\n *\n * This type extends React's `CSSProperties` and additionally permits any\n * CSS variable name (keys starting with `--`) with values that match what\n * CSS variables accept in React style objects: `string | number`.\n */\ntype CssProperties = ReactCSSProperties & Record<CssVariableName, string | number>;\n\n/**\n * Helper to type-check a style object while preserving its exact inferred type.\n *\n * Why not just annotate with `CssProperties`?\n * - Annotating forces the value to be treated as the *wider* `CssProperties` type,\n * which can lose useful inference (literal values, narrow unions, etc.).\n *\n * This function validates that `input` conforms to `CssProperties` (including\n * CSS variables like `--foo`) and returns it unchanged, keeping inference intact.\n *\n * @example\n * style={$cssProperties({ display: \"block\", \"--gap\": 8 })}\n */\nconst $cssProperties = <T extends CssProperties = CssProperties>(input: T): ReactCSSProperties =>\n\tinput;\n\nexport { type CssProperties, $cssProperties };\n"],"mappings":"AAoCA,IAAMA,EAA2DC,GAChEA","names":["$cssProperties","input"]}
|
package/dist/chunk-6J7D73WA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useCallback as a,useSyncExternalStore as i}from"react";function c(e){let r=a(t=>{let n=window.matchMedia(e);return n.addEventListener("change",t),()=>{n.removeEventListener("change",t)}},[e]);return i(r,()=>window.matchMedia(e).matches,()=>!1)}export{c as a};
|
|
2
|
-
//# sourceMappingURL=chunk-6J7D73WA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-matches-media-query.tsx"],"sourcesContent":["import { useCallback, useSyncExternalStore } from \"react\";\n\n/**\n * React hook that subscribes to and returns the result of a CSS media query.\n *\n * This hook uses `window.matchMedia` under the hood and leverages\n * `useSyncExternalStore` to stay compliant with React's concurrent rendering model.\n *\n * @param {string} query - A valid CSS media query string (e.g., `(max-width: 768px)`).\n *\n * @returns {boolean} `true` if the media query currently matches, otherwise `false`.\n *\n * @example\n * // Detect if the user prefers a dark color scheme:\n * const isDarkMode = useMatchesMediaQuery(\"(prefers-color-scheme: dark)\");\n *\n * if (isDarkMode) {\n * document.body.classList.add(\"dark\");\n * } else {\n * document.body.classList.remove(\"dark\");\n * }\n */\nexport function useMatchesMediaQuery(query: string) {\n\tconst subscribe = useCallback(\n\t\t(callback: () => void) => {\n\t\t\tconst matchMedia = window.matchMedia(query);\n\n\t\t\tmatchMedia.addEventListener(\"change\", callback);\n\t\t\treturn () => {\n\t\t\t\tmatchMedia.removeEventListener(\"change\", callback);\n\t\t\t};\n\t\t},\n\t\t[query],\n\t);\n\n\treturn useSyncExternalStore(\n\t\tsubscribe,\n\t\t() => {\n\t\t\treturn window.matchMedia(query).matches;\n\t\t},\n\t\t() => false,\n\t);\n}\n"],"mappings":"AAAA,OAAS,eAAAA,EAAa,wBAAAC,MAA4B,QAsB3C,SAASC,EAAqBC,EAAe,CACnD,IAAMC,EAAYJ,EAChBK,GAAyB,CACzB,IAAMC,EAAa,OAAO,WAAWH,CAAK,EAE1C,OAAAG,EAAW,iBAAiB,SAAUD,CAAQ,EACvC,IAAM,CACZC,EAAW,oBAAoB,SAAUD,CAAQ,CAClD,CACD,EACA,CAACF,CAAK,CACP,EAEA,OAAOF,EACNG,EACA,IACQ,OAAO,WAAWD,CAAK,EAAE,QAEjC,IAAM,EACP,CACD","names":["useCallback","useSyncExternalStore","useMatchesMediaQuery","query","subscribe","callback","matchMedia"]}
|
package/dist/chunk-72TJUKMV.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-72TJUKMV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-7MJQGBE4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t=["alphanumeric","time"],g=i=>typeof i=="string"&&t.includes(i),S=i=>i,n=["asc","desc"],o=i=>typeof i=="string"&&n.includes(i),D=i=>i,e=[...n],m=i=>typeof i=="string"&&e.includes(i),d=i=>i,r=["newest-to-oldest","oldest-to-newest"],s=i=>typeof i=="string"&&r.includes(i),c={asc:"oldest-to-newest",desc:"newest-to-oldest"};function p(i){if(o(i))return c[i];if(s(i))return i;throw new Error(`Invalid time sorting direction given: "${i}"`)}export{t as a,g as b,S as c,n as d,o as e,D as f,e as g,m as h,d as i,r as j,s as k,c as l,p as m};
|
|
2
|
-
//# sourceMappingURL=chunk-7MJQGBE4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/sorting/direction.ts"],"sourcesContent":["/**\n * Sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n */\nconst sortingModes = [\"alphanumeric\", \"time\"] as const;\n\n/**\n * Sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n */\ntype SortingMode = (typeof sortingModes)[number];\n\n/**\n * Type guard for sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n *\n * @example isSortingMode(\"alphanumeric\") // true\n * @example isSortingMode(\"time\") // true\n * @example isSortingMode(\"foo\") // false\n */\nconst isSortingMode = (value: unknown): value is SortingMode =>\n\ttypeof value === \"string\" && sortingModes.includes(value as SortingMode);\n\n/**\n * Runtime type-to-value helper for sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n *\n * @example $sortingMode(\"alphanumeric\") // \"alphanumeric\"\n * @example $sortingMode(\"time\") // \"time\"\n */\nconst $sortingMode = <T extends SortingMode = SortingMode>(value: T) => value;\n\n/**\n * Sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n */\nconst sortingDirections = [\"asc\", \"desc\"] as const;\n\n/**\n * Sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n */\ntype SortingDirection = (typeof sortingDirections)[number];\n\n/**\n * Type guard for sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n *\n * @example isSortingDirection(\"asc\") // true\n * @example isSortingDirection(\"desc\") // true\n * @example isSortingDirection(\"foo\") // false\n */\nconst isSortingDirection = (value: unknown): value is SortingDirection =>\n\ttypeof value === \"string\" && sortingDirections.includes(value as SortingDirection);\n\n/**\n * Runtime type-to-value helper for sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n *\n * @example $sortingDirection(\"asc\") // \"asc\"\n * @example $sortingDirection(\"desc\") // \"desc\"\n */\nconst $sortingDirection = <T extends SortingDirection = SortingDirection>(value: T) => value;\n\n/**\n * Alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n */\nconst alphanumericSortingDirections = [...sortingDirections] as const;\n\n/**\n * Alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n */\ntype AlphanumericSortingDirection = (typeof alphanumericSortingDirections)[number];\n\n/**\n * Type guard for alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n *\n * @example isAlphanumericSortingDirection(\"asc\") // true\n * @example isAlphanumericSortingDirection(\"desc\") // true\n * @example isAlphanumericSortingDirection(\"foo\") // false\n */\nconst isAlphanumericSortingDirection = (value: unknown): value is AlphanumericSortingDirection =>\n\ttypeof value === \"string\" &&\n\talphanumericSortingDirections.includes(value as AlphanumericSortingDirection);\n\n/**\n * Runtime type-to-value helper for alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n *\n * @example $alphanumericSortingDirection(\"asc\") // \"asc\"\n * @example $alphanumericSortingDirection(\"desc\") // \"desc\"\n */\nconst $alphanumericSortingDirection = <\n\tT extends AlphanumericSortingDirection = AlphanumericSortingDirection,\n>(\n\tvalue: T,\n) => value;\n\n/**\n * Time sorting directions\n * - newest-to-oldest: Descending order (newest first, oldest last)\n * - oldest-to-newest: Ascending order (oldest first, newest last)\n */\nconst timeSortingDirections = [\"newest-to-oldest\", \"oldest-to-newest\"] as const;\n\n/**\n * Time sorting directions\n * - newest-to-oldest: Descending order (newest first, oldest last)\n * - oldest-to-newest: Ascending order (oldest first, newest last)\n */\ntype TimeSortingDirection = (typeof timeSortingDirections)[number];\n\n/**\n * Type guard for time sorting directions\n * - newest-to-oldest: Descending order (newest first, oldest last)\n * - oldest-to-newest: Ascending order (oldest first, newest last)\n *\n * @example isTimeSortingDirection(\"newest-to-oldest\") // true\n * @example isTimeSortingDirection(\"oldest-to-newest\") // true\n * @example isTimeSortingDirection(\"foo\") // false\n * @example isTimeSortingDirection(\"asc\") // false\n * @example isTimeSortingDirection(\"desc\") // false\n */\nconst isTimeSortingDirection = (value: unknown): value is TimeSortingDirection =>\n\ttypeof value === \"string\" && timeSortingDirections.includes(value as TimeSortingDirection);\n\n/**\n * Converts a sorting direction to a time sorting direction\n * - asc -> oldest-to-newest\n * - desc -> newest-to-oldest\n */\nconst timeSortingByDirection = {\n\tasc: \"oldest-to-newest\",\n\tdesc: \"newest-to-oldest\",\n} as const satisfies Record<SortingDirection, TimeSortingDirection>;\n\n/**\n * Runtime type-to-value helper for time sorting directions.\n * If given a sorting direction, it will convert it to a time sorting direction.\n * - newest-to-oldest: Descending order (desc; newest first, oldest last)\n * - oldest-to-newest: Ascending order (asc; oldest first, newest last)\n *\n * @example $timeSortingDirection(\"asc\") // \"oldest-to-newest\"\n * @example $timeSortingDirection(\"desc\") // \"newest-to-oldest\"\n * @example $timeSortingDirection(\"oldest-to-newest\") // \"oldest-to-newest\"\n * @example $timeSortingDirection(\"newest-to-oldest\") // \"newest-to-oldest\"\n */\nfunction $timeSortingDirection<T extends TimeSortingDirection | SortingDirection>(value: T) {\n\tif (isSortingDirection(value)) {\n\t\treturn timeSortingByDirection[value];\n\t}\n\tif (isTimeSortingDirection(value)) {\n\t\treturn value;\n\t}\n\tthrow new Error(`Invalid time sorting direction given: \"${value}\"`);\n}\n\nexport {\n\t//,\n\t$alphanumericSortingDirection,\n\t$sortingDirection,\n\t$sortingMode,\n\t$timeSortingDirection,\n\talphanumericSortingDirections,\n\tisAlphanumericSortingDirection,\n\tisSortingDirection,\n\tisSortingMode,\n\tisTimeSortingDirection,\n\tsortingDirections,\n\tsortingModes,\n\ttimeSortingByDirection,\n\ttimeSortingDirections,\n};\n\nexport type {\n\t//,\n\tAlphanumericSortingDirection,\n\tSortingDirection,\n\tSortingMode,\n\tTimeSortingDirection,\n};\n"],"mappings":"AAKA,IAAMA,EAAe,CAAC,eAAgB,MAAM,EAkBtCC,EAAiBC,GACtB,OAAOA,GAAU,UAAYF,EAAa,SAASE,CAAoB,EAUlEC,EAAqDD,GAAaA,EAOlEE,EAAoB,CAAC,MAAO,MAAM,EAkBlCC,EAAsBH,GAC3B,OAAOA,GAAU,UAAYE,EAAkB,SAASF,CAAyB,EAU5EI,EAAoEJ,GAAaA,EAOjFK,EAAgC,CAAC,GAAGH,CAAiB,EAkBrDI,EAAkCN,GACvC,OAAOA,GAAU,UACjBK,EAA8B,SAASL,CAAqC,EAUvEO,EAGLP,GACIA,EAOCQ,EAAwB,CAAC,mBAAoB,kBAAkB,EAoB/DC,EAA0BT,GAC/B,OAAOA,GAAU,UAAYQ,EAAsB,SAASR,CAA6B,EAOpFU,EAAyB,CAC9B,IAAK,mBACL,KAAM,kBACP,EAaA,SAASC,EAAyEX,EAAU,CAC3F,GAAIG,EAAmBH,CAAK,EAC3B,OAAOU,EAAuBV,CAAK,EAEpC,GAAIS,EAAuBT,CAAK,EAC/B,OAAOA,EAER,MAAM,IAAI,MAAM,0CAA0CA,CAAK,GAAG,CACnE","names":["sortingModes","isSortingMode","value","$sortingMode","sortingDirections","isSortingDirection","$sortingDirection","alphanumericSortingDirections","isAlphanumericSortingDirection","$alphanumericSortingDirection","timeSortingDirections","isTimeSortingDirection","timeSortingByDirection","$timeSortingDirection"]}
|
package/dist/chunk-7YLII2US.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as c}from"./chunk-MLXONRJD.js";import{a as s}from"./chunk-IVQ626TU.js";import{a}from"./chunk-PFXFESEN.js";import{CaretRightIcon as k}from"@phosphor-icons/react/CaretRight";import{CheckIcon as f}from"@phosphor-icons/react/Check";import*as e from"@radix-ui/react-dropdown-menu";import{forwardRef as d}from"react";import{jsx as n,jsxs as u}from"react/jsx-runtime";var g=e.Root;g.displayName="DropdownMenu";var w=e.Trigger;w.displayName="DropdownMenuTrigger";var h=d(({className:o,...t},i)=>n(e.Group,{ref:i,className:a("space-y-px",o),...t}));h.displayName="DropdownMenuGroup";var m=e.Portal;m.displayName="DropdownMenuPortal";var v=e.Sub;v.displayName="DropdownMenuSub";var b=d(({className:o,...t},i)=>n(e.RadioGroup,{ref:i,className:a("space-y-px",o),...t}));b.displayName="DropdownMenuRadioGroup";var P=d(({className:o,inset:t,children:i,...r},p)=>u(e.SubTrigger,{className:a("focus:bg-accent data-state-open:bg-accent relative flex select-none items-center rounded-md py-1.5 pl-2 pr-9 text-sm outline-hidden","data-highlighted:bg-active-menu-item data-state-open:bg-active-menu-item","[&>svg]:size-5 [&_svg]:shrink-0",t&&"pl-8",o),ref:p,...r,children:[i,n("span",{className:"absolute right-2 flex items-center",children:n(s,{svg:n(k,{weight:"bold"}),className:"size-4"})})]}));P.displayName="DropdownMenuSubTrigger";var D=d(({className:o,loop:t=!0,...i},r)=>n(m,{children:n(e.SubContent,{className:a("scrollbar","text-popover-foreground border-popover bg-popover p-1.25 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95 data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 z-50 min-w-32 overflow-hidden rounded-md border shadow-xl space-y-px font-sans","my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)-16px)] overflow-auto",o),loop:t,ref:r,...i})}));D.displayName="DropdownMenuSubContent";var M=d(({className:o,onClick:t,loop:i=!0,width:r,...p},S)=>n(m,{children:n(e.Content,{ref:S,className:a("scrollbar","text-popover-foreground border-popover bg-popover p-1.25 z-50 min-w-32 overflow-hidden rounded-md border shadow-xl outline-hidden space-y-px font-sans","data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95","my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)-16px)] overflow-auto",r==="trigger"&&"w-(--radix-dropdown-menu-trigger-width)",o),loop:i,onClick:l=>{l.stopPropagation(),t?.(l)},...p})}));M.displayName="DropdownMenuContent";var y=d(({className:o,inset:t,...i},r)=>n(e.Item,{ref:r,className:a("relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 text-strong text-sm font-normal outline-hidden transition-colors","data-highlighted:bg-active-menu-item","focus:bg-accent focus:text-accent-foreground","data-disabled:cursor-default data-disabled:opacity-50","[&>svg]:size-5 [&_svg]:shrink-0",t&&"pl-8",o),...i}));y.displayName="DropdownMenuItem";var x=d(({className:o,children:t,checked:i,...r},p)=>u(e.CheckboxItem,{ref:p,className:a("text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-9 text-sm font-normal outline-hidden","data-highlighted:bg-active-menu-item","aria-checked:bg-selected-menu-item","data-highlighted:aria-checked:bg-active-selected-menu-item!","[&>svg]:size-5 [&_svg]:shrink-0",o),checked:i,...r,children:[n("span",{className:"absolute right-2 flex items-center",children:n(e.ItemIndicator,{children:n(s,{svg:n(f,{weight:"bold"}),className:"size-4 text-accent-600"})})}),t]}));x.displayName="DropdownMenuCheckboxItem";var C=d(({className:o,children:t,...i},r)=>u(e.RadioItem,{className:a("group/dropdown-menu-radio-item","text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded-md py-1.5 px-2 text-sm font-normal outline-none","data-highlighted:bg-active-menu-item","aria-checked:bg-selected-menu-item aria-checked:pr-9","data-highlighted:aria-checked:bg-active-selected-menu-item!","[&>svg]:size-5 [&_svg]:shrink-0",o),ref:r,...i,children:[n("span",{className:"absolute right-2 items-center hidden group-aria-checked/dropdown-menu-radio-item:flex",children:n(e.ItemIndicator,{children:n(s,{svg:n(f,{weight:"bold"}),className:"size-4 text-accent-600"})})}),t]}));C.displayName="DropdownMenuRadioItem";var R=d(({className:o,inset:t,...i},r)=>n(e.Label,{ref:r,className:a("px-2 py-1.5 text-sm font-medium",t&&"pl-8",o),...i}));R.displayName="DropdownMenuLabel";var N=d(({className:o,...t},i)=>n(c,{ref:i,className:a("-mx-1.25 my-1 w-auto",o),...t}));N.displayName="DropdownMenuSeparator";var I=({className:o,...t})=>n("span",{className:a("ml-auto text-xs tracking-widest opacity-60",o),...t});I.displayName="DropdownMenuShortcut";var q={Root:g,CheckboxItem:x,Content:M,Group:h,Item:y,Label:R,RadioGroup:b,RadioItem:C,Separator:N,Shortcut:I,Sub:v,SubContent:D,SubTrigger:P,Trigger:w};export{q as a};
|
|
2
|
-
//# sourceMappingURL=chunk-7YLII2US.js.map
|