@ngrok/mantle 0.76.1 → 0.76.3
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/agent.json +1 -1
- package/dist/alert-dialog.d.ts +4 -4
- package/dist/alert.d.ts +1 -1
- package/dist/{button-BYZOBUgj.d.ts → button-BXZ_JTu_.d.ts} +4 -4
- package/dist/button.d.ts +2 -2
- package/dist/checkbox.d.ts +30 -1
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/command.d.ts +7 -7
- package/dist/data-table.d.ts +123 -43
- package/dist/data-table.js +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/empty.js +1 -1
- package/dist/empty.js.map +1 -1
- package/dist/field.d.ts +2 -2
- package/dist/{icon-button-Ct3A7aoj.d.ts → icon-button-ntupABbM.d.ts} +2 -2
- package/dist/{index-BL5WVva_.d.ts → index-CJbKEKr2.d.ts} +4 -2
- package/dist/input.d.ts +3 -3
- package/dist/llms.txt +1 -1
- package/dist/mantle.css +178 -8
- package/dist/sandboxed-on-click.d.ts +1 -0
- package/dist/sandboxed-on-click.js.map +1 -1
- package/dist/sheet.d.ts +2 -2
- package/dist/sheet.js.map +1 -1
- package/dist/slot.d.ts +1 -1
- package/dist/split-button.d.ts +2 -2
- package/dist/table-DWy_oNta.js +2 -0
- package/dist/table-DWy_oNta.js.map +1 -0
- package/dist/table.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/theme.d.ts +3 -3
- package/dist/well.js +1 -1
- package/dist/well.js.map +1 -1
- package/package.json +19 -19
- package/dist/table-eyoUW2Uv.js +0 -2
- package/dist/table-eyoUW2Uv.js.map +0 -1
package/dist/agent.json
CHANGED
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -198,7 +198,7 @@ declare const AlertDialog: {
|
|
|
198
198
|
* ```
|
|
199
199
|
*/
|
|
200
200
|
readonly Action: import("react").ForwardRefExoticComponent<(Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
201
|
-
appearance?: "link" | "
|
|
201
|
+
appearance?: "link" | "ghost" | "outlined" | "filled" | null | undefined;
|
|
202
202
|
isLoading?: boolean | null | undefined;
|
|
203
203
|
priority?: "danger" | "neutral" | "default" | null | undefined;
|
|
204
204
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>> & {
|
|
@@ -208,7 +208,7 @@ declare const AlertDialog: {
|
|
|
208
208
|
asChild: true;
|
|
209
209
|
type?: ComponentProps<"button">["type"];
|
|
210
210
|
}, "ref"> | Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
211
|
-
appearance?: "link" | "
|
|
211
|
+
appearance?: "link" | "ghost" | "outlined" | "filled" | null | undefined;
|
|
212
212
|
isLoading?: boolean | null | undefined;
|
|
213
213
|
priority?: "danger" | "neutral" | "default" | null | undefined;
|
|
214
214
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>> & {
|
|
@@ -293,7 +293,7 @@ declare const AlertDialog: {
|
|
|
293
293
|
* ```
|
|
294
294
|
*/
|
|
295
295
|
readonly Cancel: import("react").ForwardRefExoticComponent<(Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
296
|
-
appearance?: "link" | "
|
|
296
|
+
appearance?: "link" | "ghost" | "outlined" | "filled" | null | undefined;
|
|
297
297
|
isLoading?: boolean | null | undefined;
|
|
298
298
|
priority?: "danger" | "neutral" | "default" | null | undefined;
|
|
299
299
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>> & {
|
|
@@ -303,7 +303,7 @@ declare const AlertDialog: {
|
|
|
303
303
|
asChild: true;
|
|
304
304
|
type?: ComponentProps<"button">["type"];
|
|
305
305
|
}, "ref"> | Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
306
|
-
appearance?: "link" | "
|
|
306
|
+
appearance?: "link" | "ghost" | "outlined" | "filled" | null | undefined;
|
|
307
307
|
isLoading?: boolean | null | undefined;
|
|
308
308
|
priority?: "danger" | "neutral" | "default" | null | undefined;
|
|
309
309
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>> & {
|
package/dist/alert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as SvgAttributes } from "./types-BvUzforF.js";
|
|
2
2
|
import { t as WithAsChild } from "./as-child-uN_018tj.js";
|
|
3
|
-
import { n as IconButtonProps } from "./icon-button-
|
|
3
|
+
import { n as IconButtonProps } from "./icon-button-ntupABbM.js";
|
|
4
4
|
import { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/alert/alert.d.ts
|
|
@@ -4,7 +4,7 @@ import { ComponentProps, ReactNode } from "react";
|
|
|
4
4
|
|
|
5
5
|
//#region src/components/button/button.d.ts
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
appearance?: "link" | "
|
|
7
|
+
appearance?: "link" | "ghost" | "outlined" | "filled" | null | undefined;
|
|
8
8
|
isLoading?: boolean | null | undefined;
|
|
9
9
|
priority?: "danger" | "neutral" | "default" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -88,7 +88,7 @@ type ButtonProps = ComponentProps<"button"> & ButtonVariants & {
|
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
90
|
declare const Button: import("react").ForwardRefExoticComponent<(Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
91
|
-
appearance?: "link" | "
|
|
91
|
+
appearance?: "link" | "ghost" | "outlined" | "filled" | null | undefined;
|
|
92
92
|
isLoading?: boolean | null | undefined;
|
|
93
93
|
priority?: "danger" | "neutral" | "default" | null | undefined;
|
|
94
94
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>> & {
|
|
@@ -134,7 +134,7 @@ declare const Button: import("react").ForwardRefExoticComponent<(Omit<import("re
|
|
|
134
134
|
*/
|
|
135
135
|
type?: ComponentProps<"button">["type"];
|
|
136
136
|
}, "ref"> | Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
137
|
-
appearance?: "link" | "
|
|
137
|
+
appearance?: "link" | "ghost" | "outlined" | "filled" | null | undefined;
|
|
138
138
|
isLoading?: boolean | null | undefined;
|
|
139
139
|
priority?: "danger" | "neutral" | "default" | null | undefined;
|
|
140
140
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>> & {
|
|
@@ -169,4 +169,4 @@ declare const Button: import("react").ForwardRefExoticComponent<(Omit<import("re
|
|
|
169
169
|
}, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
|
|
170
170
|
//#endregion
|
|
171
171
|
export { ButtonProps as n, Button as t };
|
|
172
|
-
//# sourceMappingURL=button-
|
|
172
|
+
//# sourceMappingURL=button-BXZ_JTu_.d.ts.map
|
package/dist/button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as IconButtonProps, t as IconButton } from "./icon-button-
|
|
2
|
-
import { n as ButtonProps, t as Button } from "./button-
|
|
1
|
+
import { n as IconButtonProps, t as IconButton } from "./icon-button-ntupABbM.js";
|
|
2
|
+
import { n as ButtonProps, t as Button } from "./button-BXZ_JTu_.js";
|
|
3
3
|
import { n as ButtonGroupProps, t as ButtonGroup } from "./index-DBZ3eRsl.js";
|
|
4
4
|
export { Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, IconButton, type IconButtonProps };
|
package/dist/checkbox.d.ts
CHANGED
|
@@ -28,6 +28,35 @@ declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<Omit<impo
|
|
|
28
28
|
*/
|
|
29
29
|
defaultChecked?: CheckedState;
|
|
30
30
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the tri-state `checked` value for a "select all" checkbox from the
|
|
33
|
+
* current selection counts: `true` when everything is selected,
|
|
34
|
+
* `"indeterminate"` when only some is, and `false` when nothing is. The result
|
|
35
|
+
* is a {@link CheckedState}, ready to pass straight to `<Checkbox checked={…} />`.
|
|
36
|
+
*
|
|
37
|
+
* `allSelected` is checked first, so it wins even if a caller also reports
|
|
38
|
+
* `someSelected` for the all-selected case.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Driving a TanStack Table "select all" header checkbox:
|
|
43
|
+
* <Checkbox
|
|
44
|
+
* aria-label="Select all rows"
|
|
45
|
+
* checked={selectAllChecked({
|
|
46
|
+
* allSelected: table.getIsAllRowsSelected(),
|
|
47
|
+
* someSelected: table.getIsSomeRowsSelected(),
|
|
48
|
+
* })}
|
|
49
|
+
* onChange={(event) => table.toggleAllRowsSelected(event.target.checked)}
|
|
50
|
+
* />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function selectAllChecked({
|
|
54
|
+
allSelected,
|
|
55
|
+
someSelected
|
|
56
|
+
}: {
|
|
57
|
+
/** Whether every selectable item is currently selected. */allSelected: boolean; /** Whether some (but not necessarily all) items are selected. */
|
|
58
|
+
someSelected: boolean;
|
|
59
|
+
}): CheckedState;
|
|
31
60
|
//#endregion
|
|
32
|
-
export { Checkbox };
|
|
61
|
+
export { Checkbox, type CheckedState, selectAllChecked };
|
|
33
62
|
//# sourceMappingURL=checkbox.d.ts.map
|
package/dist/checkbox.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-Cjf2gfB8.js";import{a as t,r as n}from"./validation-DCyx-ceH.js";import{forwardRef as r,useEffect as i,useRef as a,useState as o}from"react";import s from"clsx";import{jsx as c}from"react/jsx-runtime";const l=e=>e===`indeterminate`,u=r(({"aria-invalid":r,className:u,checked:d,defaultChecked:f,defaultValue:p=`on`,onClick:m,readOnly:h,validation:g,..._},v)=>{let y=a(null),[b]=o(f),x=t(),{ariaInvalid:S,validation:C}=n({"aria-invalid":r,validation:g??x})
|
|
1
|
+
import{t as e}from"./compose-refs-Cjf2gfB8.js";import{a as t,r as n}from"./validation-DCyx-ceH.js";import{forwardRef as r,useEffect as i,useRef as a,useState as o}from"react";import s from"clsx";import{jsx as c}from"react/jsx-runtime";const l=e=>e===`indeterminate`,u=r(({"aria-invalid":r,className:u,checked:d,defaultChecked:f,defaultValue:p=`on`,onClick:m,readOnly:h,validation:g,..._},v)=>{let y=a(null),[b]=o(f),x=t(),{ariaInvalid:S,validation:C}=n({"aria-invalid":r,validation:g??x}),w=d??b;i(()=>{y.current&&(y.current.indeterminate=l(w))},[w]);let T=d==null?{defaultChecked:l(b)?void 0:b}:{checked:l(d)?!1:d};return c(`input`,{"aria-checked":l(d)?`mixed`:d,"aria-invalid":S,"data-slot":`checkbox`,className:s(`border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50`,`bg-center bg-no-repeat focus:outline-hidden`,`focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4`,`checked:border-accent-600 checked:bg-accent-600 checked:bg-checked-icon`,`indeterminate:border-accent-600 indeterminate:bg-accent-600 indeterminate:bg-indeterminate-icon`,`data-validation-success:border-success-600 data-validation-success:checked:bg-success-600 data-validation-success:indeterminate:bg-success-600 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-600 data-validation-warning:indeterminate:bg-warning-600 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-600 data-validation-error:indeterminate:bg-danger-600 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger`,`where:block where:size-4 where:p-0`,u),...T,"data-validation":C||void 0,defaultValue:p,onClick:e=>{if(h){e.preventDefault();return}m?.(e)},readOnly:h,ref:e(y,v),type:`checkbox`,..._})});u.displayName=`Checkbox`;function d({allSelected:e,someSelected:t}){return e?!0:t?`indeterminate`:!1}export{u as Checkbox,d as selectAllChecked};
|
|
2
2
|
//# sourceMappingURL=checkbox.js.map
|
package/dist/checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":["clsx"],"sources":["../src/components/checkbox/checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport clsx from \"clsx\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentRef } from \"react\";\nimport { composeRefs } from \"../../utils/compose-refs/index.js\";\nimport { parseValidation, useFieldValidation } from \"../field/validation.js\";\nimport type { WithValidation } from \"../field/validation.js\";\n\ntype CheckedState = boolean | \"indeterminate\";\n\nconst isIndeterminate = (checked: CheckedState | undefined): checked is \"indeterminate\" =>\n\tchecked === \"indeterminate\";\n\ntype Props = Omit<ComponentPropsWithoutRef<\"input\">, \"type\" | \"checked\" | \"defaultChecked\"> &\n\tWithValidation & {\n\t\t/**\n\t\t * The controlled checked state of the checkbox. Must be used in conjunction with onChange.\n\t\t */\n\t\tchecked?: CheckedState;\n\t\t/**\n\t\t * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n\t\t */\n\t\tdefaultChecked?: CheckedState;\n\t};\n\n/**\n * A form control that allows the user to toggle between checked and not checked.\n * Supports indeterminate state.\n *\n * @see https://mantle.ngrok.com/components/checkbox\n *\n * @example\n * ```tsx\n * <form>\n * <Label htmlFor=\"terms\" className=\"flex items-center gap-2\">\n * <Checkbox name=\"terms\" id=\"terms\" />\n * Accept terms and conditions\n * </Label>\n * </form>\n * ```\n */\nconst Checkbox = forwardRef<ComponentRef<\"input\">, Props>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tclassName,\n\t\t\tchecked: _checked,\n\t\t\tdefaultChecked: _defaultChecked,\n\t\t\tdefaultValue = \"on\",\n\t\t\tonClick,\n\t\t\treadOnly,\n\t\t\tvalidation: _validation,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst innerRef = useRef<ComponentRef<\"input\">>(null);\n\t\tconst [defaultChecked] = useState(_defaultChecked);\n\t\tconst fieldValidation = useFieldValidation();\n\t\tconst { ariaInvalid, validation } = parseValidation({\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tvalidation: _validation ?? fieldValidation,\n\t\t});\n\n\t\
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":["clsx"],"sources":["../src/components/checkbox/checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport clsx from \"clsx\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentRef } from \"react\";\nimport { composeRefs } from \"../../utils/compose-refs/index.js\";\nimport { parseValidation, useFieldValidation } from \"../field/validation.js\";\nimport type { WithValidation } from \"../field/validation.js\";\n\ntype CheckedState = boolean | \"indeterminate\";\n\nconst isIndeterminate = (checked: CheckedState | undefined): checked is \"indeterminate\" =>\n\tchecked === \"indeterminate\";\n\ntype Props = Omit<ComponentPropsWithoutRef<\"input\">, \"type\" | \"checked\" | \"defaultChecked\"> &\n\tWithValidation & {\n\t\t/**\n\t\t * The controlled checked state of the checkbox. Must be used in conjunction with onChange.\n\t\t */\n\t\tchecked?: CheckedState;\n\t\t/**\n\t\t * The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.\n\t\t */\n\t\tdefaultChecked?: CheckedState;\n\t};\n\n/**\n * A form control that allows the user to toggle between checked and not checked.\n * Supports indeterminate state.\n *\n * @see https://mantle.ngrok.com/components/checkbox\n *\n * @example\n * ```tsx\n * <form>\n * <Label htmlFor=\"terms\" className=\"flex items-center gap-2\">\n * <Checkbox name=\"terms\" id=\"terms\" />\n * Accept terms and conditions\n * </Label>\n * </form>\n * ```\n */\nconst Checkbox = forwardRef<ComponentRef<\"input\">, Props>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tclassName,\n\t\t\tchecked: _checked,\n\t\t\tdefaultChecked: _defaultChecked,\n\t\t\tdefaultValue = \"on\",\n\t\t\tonClick,\n\t\t\treadOnly,\n\t\t\tvalidation: _validation,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst innerRef = useRef<ComponentRef<\"input\">>(null);\n\t\tconst [defaultChecked] = useState(_defaultChecked);\n\t\tconst fieldValidation = useFieldValidation();\n\t\tconst { ariaInvalid, validation } = parseValidation({\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tvalidation: _validation ?? fieldValidation,\n\t\t});\n\n\t\t// `indeterminate` is a DOM-only property (it has no HTML attribute), so set it\n\t\t// imperatively from the *effective* checked state — the controlled `checked`\n\t\t// when present, otherwise the (stable) initial `defaultChecked`. A single effect\n\t\t// keyed on that value avoids two competing effects clobbering each other on\n\t\t// mount, which previously dropped the indeterminate visual for a controlled\n\t\t// `checked=\"indeterminate\"`.\n\t\tconst effectiveChecked = _checked != null ? _checked : defaultChecked;\n\t\tuseEffect(() => {\n\t\t\tif (innerRef.current) {\n\t\t\t\tinnerRef.current.indeterminate = isIndeterminate(effectiveChecked);\n\t\t\t}\n\t\t}, [effectiveChecked]);\n\n\t\t// React warns (and the linter flags) when both `checked` and `defaultChecked` are\n\t\t// passed on the same input. Pick exactly one based on whether the consumer is in\n\t\t// controlled mode (`_checked != null`). The indeterminate *visual* is applied\n\t\t// to the DOM node imperatively via the `useEffect`s above on both paths — so in\n\t\t// controlled mode we still pass a boolean `checked` (treating indeterminate as\n\t\t// unchecked) and never let it become `undefined`. Passing `checked: undefined` for\n\t\t// the indeterminate frame flips the input controlled → uncontrolled and trips\n\t\t// React's \"changing a controlled input to be uncontrolled\" warning.\n\t\tconst checkedProp =\n\t\t\t_checked != null\n\t\t\t\t? { checked: isIndeterminate(_checked) ? false : _checked }\n\t\t\t\t: { defaultChecked: isIndeterminate(defaultChecked) ? undefined : defaultChecked };\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\taria-checked={isIndeterminate(_checked) ? \"mixed\" : _checked}\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tdata-slot=\"checkbox\"\n\t\t\t\tclassName={clsx(\n\t\t\t\t\t\"border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50\",\n\t\t\t\t\t\"bg-center bg-no-repeat focus:outline-hidden\",\n\t\t\t\t\t\"focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4\",\n\t\t\t\t\t\"checked:border-accent-600 checked:bg-accent-600 checked:bg-checked-icon\",\n\t\t\t\t\t\"indeterminate:border-accent-600 indeterminate:bg-accent-600 indeterminate:bg-indeterminate-icon\",\n\t\t\t\t\t\"data-validation-success:border-success-600 data-validation-success:checked:bg-success-600 data-validation-success:indeterminate:bg-success-600 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success\",\n\t\t\t\t\t\"data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-600 data-validation-warning:indeterminate:bg-warning-600 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning\",\n\t\t\t\t\t\"data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-600 data-validation-error:indeterminate:bg-danger-600 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger\",\n\t\t\t\t\t\"where:block where:size-4 where:p-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...checkedProp}\n\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tif (readOnly) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tref={composeRefs(innerRef, ref)}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nCheckbox.displayName = \"Checkbox\";\n\n/**\n * Resolve the tri-state `checked` value for a \"select all\" checkbox from the\n * current selection counts: `true` when everything is selected,\n * `\"indeterminate\"` when only some is, and `false` when nothing is. The result\n * is a {@link CheckedState}, ready to pass straight to `<Checkbox checked={…} />`.\n *\n * `allSelected` is checked first, so it wins even if a caller also reports\n * `someSelected` for the all-selected case.\n *\n * @example\n * ```tsx\n * // Driving a TanStack Table \"select all\" header checkbox:\n * <Checkbox\n * aria-label=\"Select all rows\"\n * checked={selectAllChecked({\n * allSelected: table.getIsAllRowsSelected(),\n * someSelected: table.getIsSomeRowsSelected(),\n * })}\n * onChange={(event) => table.toggleAllRowsSelected(event.target.checked)}\n * />\n * ```\n */\nfunction selectAllChecked({\n\tallSelected,\n\tsomeSelected,\n}: {\n\t/** Whether every selectable item is currently selected. */\n\tallSelected: boolean;\n\t/** Whether some (but not necessarily all) items are selected. */\n\tsomeSelected: boolean;\n}): CheckedState {\n\tif (allSelected) {\n\t\treturn true;\n\t}\n\tif (someSelected) {\n\t\treturn \"indeterminate\";\n\t}\n\treturn false;\n}\n\nexport {\n\t//,\n\tCheckbox,\n\tselectAllChecked,\n};\n\nexport type {\n\t//,\n\tCheckedState,\n};\n"],"mappings":"2OAWA,MAAM,EAAmB,GACxB,IAAY,gBA8BP,EAAW,GAEf,CACC,eAAgB,EAChB,YACA,QAAS,EACT,eAAgB,EAChB,eAAe,KACf,UACA,WACA,WAAY,EACZ,GAAG,GAEJ,IACI,CACJ,IAAM,EAAW,EAA8B,IAAI,EAC7C,CAAC,GAAkB,EAAS,CAAe,EAC3C,EAAkB,EAAmB,EACrC,CAAE,cAAa,cAAe,EAAgB,CACnD,eAAgB,EAChB,WAAY,GAAe,CAC5B,CAAC,EAQK,EAAmB,GAA8B,EACvD,MAAgB,CACX,EAAS,UACZ,EAAS,QAAQ,cAAgB,EAAgB,CAAgB,EAEnE,EAAG,CAAC,CAAgB,CAAC,EAUrB,IAAM,EACL,GAAY,KAET,CAAE,eAAgB,EAAgB,CAAc,EAAI,IAAA,GAAY,CAAe,EAD/E,CAAE,QAAS,EAAgB,CAAQ,EAAI,GAAQ,CAAS,EAG5D,OACC,EAAC,QAAD,CACC,eAAc,EAAgB,CAAQ,EAAI,QAAU,EACpD,eAAc,EACd,YAAU,WACV,UAAWA,EACV,qIACA,8CACA,oHACA,0EACA,kGACA,mQACA,mQACA,oPACA,qCACA,CACD,EACA,GAAI,EACJ,kBAAiB,GAAc,IAAA,GACjB,eACd,QAAU,GAAU,CACnB,GAAI,EAAU,CACb,EAAM,eAAe,EACrB,MACD,CACA,IAAU,CAAK,CAChB,EACU,WACV,IAAK,EAAY,EAAU,CAAG,EAC9B,KAAK,WACL,GAAI,CACJ,CAAA,CAEH,CACD,EACA,EAAS,YAAc,WAwBvB,SAAS,EAAiB,CACzB,cACA,gBAMgB,CAOhB,OANI,EACI,GAEJ,EACI,gBAED,EACR"}
|
package/dist/command.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ declare const Command: {
|
|
|
135
135
|
ref?: React.Ref<HTMLDivElement>;
|
|
136
136
|
} & {
|
|
137
137
|
asChild?: boolean;
|
|
138
|
-
}, "key" |
|
|
138
|
+
}, "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
139
139
|
label?: string;
|
|
140
140
|
shouldFilter?: boolean;
|
|
141
141
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -243,7 +243,7 @@ declare const Command: {
|
|
|
243
243
|
ref?: React.Ref<HTMLInputElement>;
|
|
244
244
|
} & {
|
|
245
245
|
asChild?: boolean;
|
|
246
|
-
}, "key" | "asChild" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "
|
|
246
|
+
}, "key" | "asChild" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
|
|
247
247
|
value?: string;
|
|
248
248
|
onValueChange?: (search: string) => void;
|
|
249
249
|
} & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -285,7 +285,7 @@ declare const Command: {
|
|
|
285
285
|
ref?: React.Ref<HTMLDivElement>;
|
|
286
286
|
} & {
|
|
287
287
|
asChild?: boolean;
|
|
288
|
-
}, "key" |
|
|
288
|
+
}, "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
289
289
|
label?: string;
|
|
290
290
|
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
291
291
|
/**
|
|
@@ -326,7 +326,7 @@ declare const Command: {
|
|
|
326
326
|
ref?: React.Ref<HTMLDivElement>;
|
|
327
327
|
} & {
|
|
328
328
|
asChild?: boolean;
|
|
329
|
-
}, "key" |
|
|
329
|
+
}, "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "asChild"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
330
330
|
/**
|
|
331
331
|
* The group component for the Command component.
|
|
332
332
|
*
|
|
@@ -365,7 +365,7 @@ declare const Command: {
|
|
|
365
365
|
ref?: React.Ref<HTMLDivElement>;
|
|
366
366
|
} & {
|
|
367
367
|
asChild?: boolean;
|
|
368
|
-
}, "key" |
|
|
368
|
+
}, "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
|
|
369
369
|
heading?: React.ReactNode;
|
|
370
370
|
value?: string;
|
|
371
371
|
forceMount?: boolean;
|
|
@@ -408,7 +408,7 @@ declare const Command: {
|
|
|
408
408
|
ref?: React.Ref<HTMLDivElement>;
|
|
409
409
|
} & {
|
|
410
410
|
asChild?: boolean;
|
|
411
|
-
}, "key" |
|
|
411
|
+
}, "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "disabled" | "value"> & {
|
|
412
412
|
disabled?: boolean;
|
|
413
413
|
onSelect?: (value: string) => void;
|
|
414
414
|
value?: string;
|
|
@@ -484,7 +484,7 @@ declare const Command: {
|
|
|
484
484
|
ref?: React.Ref<HTMLDivElement>;
|
|
485
485
|
} & {
|
|
486
486
|
asChild?: boolean;
|
|
487
|
-
}, "key" |
|
|
487
|
+
}, "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
488
488
|
alwaysRender?: boolean;
|
|
489
489
|
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
490
490
|
};
|
package/dist/data-table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Button } from "./button-
|
|
1
|
+
import { t as Button } from "./button-BXZ_JTu_.js";
|
|
2
2
|
import { s as SortingMode } from "./direction-CcTY0FmA.js";
|
|
3
3
|
import { t as Table$1 } from "./table-BWD9IlIN.js";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
@@ -240,21 +240,55 @@ type DataTableEmptyRowProps = ComponentProps<typeof Table$1.Row>;
|
|
|
240
240
|
* collapsing to an empty `<tbody>`. The cell `colSpan` is computed from the
|
|
241
241
|
* TanStack Table instance via context, so no manual column count is needed.
|
|
242
242
|
*
|
|
243
|
+
* Host an `Empty` for a real empty state, and branch on whether a filter is
|
|
244
|
+
* active so the user sees the right message (and a way out when filtered):
|
|
245
|
+
*
|
|
243
246
|
* @see https://mantle.ngrok.com/components/data-table#datatableemptyrow
|
|
247
|
+
* @see https://mantle.ngrok.com/components/empty
|
|
244
248
|
*
|
|
245
249
|
* @example
|
|
246
250
|
* ```tsx
|
|
247
|
-
*
|
|
248
|
-
*
|
|
251
|
+
* import { DataTable } from "@ngrok/mantle/data-table";
|
|
252
|
+
* import { Empty } from "@ngrok/mantle/empty";
|
|
253
|
+
* import { Button } from "@ngrok/mantle/button";
|
|
254
|
+
* import { MagnifyingGlassIcon } from "@phosphor-icons/react/MagnifyingGlass";
|
|
255
|
+
* import { TrayIcon } from "@phosphor-icons/react/Tray";
|
|
249
256
|
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
257
|
+
* // `table` is your useReactTable instance; derive everything else from it.
|
|
258
|
+
* const rows = table.getRowModel().rows;
|
|
259
|
+
* const isFiltered = (table.getState().globalFilter ?? "") !== "";
|
|
260
|
+
*
|
|
261
|
+
* // EmptyRow already spans every column and Empty.Root centers itself — drop a
|
|
262
|
+
* // single Empty.Root in as the child; don't hand-roll a <td> or any centering.
|
|
263
|
+
* <DataTable.Body>
|
|
264
|
+
* {rows.length > 0 ? (
|
|
265
|
+
* rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
266
|
+
* ) : isFiltered ? (
|
|
267
|
+
* <DataTable.EmptyRow>
|
|
268
|
+
* <Empty.Root>
|
|
269
|
+
* <Empty.Icon svg={<MagnifyingGlassIcon />} />
|
|
270
|
+
* <Empty.Title>No results match your filter</Empty.Title>
|
|
271
|
+
* <Empty.Actions>
|
|
272
|
+
* <Button
|
|
273
|
+
* type="button"
|
|
274
|
+
* appearance="outlined"
|
|
275
|
+
* priority="neutral"
|
|
276
|
+
* onClick={() => table.setGlobalFilter("")}
|
|
277
|
+
* >
|
|
278
|
+
* Clear filters
|
|
279
|
+
* </Button>
|
|
280
|
+
* </Empty.Actions>
|
|
281
|
+
* </Empty.Root>
|
|
282
|
+
* </DataTable.EmptyRow>
|
|
283
|
+
* ) : (
|
|
284
|
+
* <DataTable.EmptyRow>
|
|
285
|
+
* <Empty.Root>
|
|
286
|
+
* <Empty.Icon svg={<TrayIcon />} />
|
|
287
|
+
* <Empty.Title>No endpoints yet</Empty.Title>
|
|
288
|
+
* </Empty.Root>
|
|
289
|
+
* </DataTable.EmptyRow>
|
|
290
|
+
* )}
|
|
291
|
+
* </DataTable.Body>
|
|
258
292
|
* ```
|
|
259
293
|
*/
|
|
260
294
|
declare function EmptyRow<TData>({
|
|
@@ -397,7 +431,10 @@ declare namespace ActionHeader {
|
|
|
397
431
|
* ```
|
|
398
432
|
*
|
|
399
433
|
* @example
|
|
400
|
-
* Sortable
|
|
434
|
+
* Sortable, filterable, paginated, with both empty states — a global text
|
|
435
|
+
* filter, the no-data vs. no-results-for-filter empty states (an `Empty`
|
|
436
|
+
* dropped into `DataTable.EmptyRow`), and `CursorPagination` with a page-size
|
|
437
|
+
* dropdown:
|
|
401
438
|
* ```tsx
|
|
402
439
|
* import {
|
|
403
440
|
* DataTable,
|
|
@@ -409,11 +446,19 @@ declare namespace ActionHeader {
|
|
|
409
446
|
* useReactTable,
|
|
410
447
|
* } from "@ngrok/mantle/data-table";
|
|
411
448
|
* import { Button } from "@ngrok/mantle/button";
|
|
449
|
+
* import { CursorPagination } from "@ngrok/mantle/pagination";
|
|
450
|
+
* import { Empty } from "@ngrok/mantle/empty";
|
|
412
451
|
* import { Input } from "@ngrok/mantle/input";
|
|
452
|
+
* import { MagnifyingGlassIcon } from "@phosphor-icons/react/MagnifyingGlass";
|
|
453
|
+
* import { TrayIcon } from "@phosphor-icons/react/Tray";
|
|
413
454
|
* import { useState } from "react";
|
|
414
455
|
*
|
|
415
456
|
* type Payment = { id: string; amount: number; status: "pending" | "succeeded" | "failed"; email: string };
|
|
416
457
|
*
|
|
458
|
+
* // `defaultPageSize` seeds an UNCONTROLLED <Select>, so keep it stable — a
|
|
459
|
+
* // module const (or the table's INITIAL page size), never the live page size.
|
|
460
|
+
* const DEFAULT_PAGE_SIZE = 10;
|
|
461
|
+
*
|
|
417
462
|
* const columnHelper = createColumnHelper<Payment>();
|
|
418
463
|
* const columns = [
|
|
419
464
|
* columnHelper.accessor("status", {
|
|
@@ -472,8 +517,10 @@ declare namespace ActionHeader {
|
|
|
472
517
|
* getSortedRowModel: getSortedRowModel(),
|
|
473
518
|
* getFilteredRowModel: getFilteredRowModel(),
|
|
474
519
|
* getPaginationRowModel: getPaginationRowModel(),
|
|
520
|
+
* initialState: { pagination: { pageSize: DEFAULT_PAGE_SIZE } },
|
|
475
521
|
* });
|
|
476
522
|
* const rows = table.getRowModel().rows;
|
|
523
|
+
* const isFiltered = globalFilter.trim() !== "";
|
|
477
524
|
*
|
|
478
525
|
* return (
|
|
479
526
|
* <div className="space-y-4">
|
|
@@ -485,34 +532,57 @@ declare namespace ActionHeader {
|
|
|
485
532
|
* <DataTable.Root table={table}>
|
|
486
533
|
* <DataTable.Head />
|
|
487
534
|
* <DataTable.Body>
|
|
488
|
-
* {rows.length > 0
|
|
489
|
-
*
|
|
490
|
-
*
|
|
535
|
+
* {rows.length > 0 ? (
|
|
536
|
+
* rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
537
|
+
* ) : isFiltered ? (
|
|
538
|
+
* // No results for the active filter — give the user a way out.
|
|
539
|
+
* <DataTable.EmptyRow>
|
|
540
|
+
* <Empty.Root>
|
|
541
|
+
* <Empty.Icon svg={<MagnifyingGlassIcon />} />
|
|
542
|
+
* <Empty.Title>No payments match your filter</Empty.Title>
|
|
543
|
+
* <Empty.Description>
|
|
544
|
+
* <p>Try a different search, or clear the filter to see everything.</p>
|
|
545
|
+
* </Empty.Description>
|
|
546
|
+
* <Empty.Actions>
|
|
547
|
+
* <Button
|
|
548
|
+
* type="button"
|
|
549
|
+
* appearance="outlined"
|
|
550
|
+
* priority="neutral"
|
|
551
|
+
* onClick={() => setGlobalFilter("")}
|
|
552
|
+
* >
|
|
553
|
+
* Clear filters
|
|
554
|
+
* </Button>
|
|
555
|
+
* </Empty.Actions>
|
|
556
|
+
* </Empty.Root>
|
|
557
|
+
* </DataTable.EmptyRow>
|
|
558
|
+
* ) : (
|
|
559
|
+
* // No data yet — informational, optionally a primary "create" action.
|
|
560
|
+
* <DataTable.EmptyRow>
|
|
561
|
+
* <Empty.Root>
|
|
562
|
+
* <Empty.Icon svg={<TrayIcon />} />
|
|
563
|
+
* <Empty.Title>No payments yet</Empty.Title>
|
|
564
|
+
* <Empty.Description>
|
|
565
|
+
* <p>Payments you receive will appear here.</p>
|
|
566
|
+
* </Empty.Description>
|
|
567
|
+
* </Empty.Root>
|
|
568
|
+
* </DataTable.EmptyRow>
|
|
569
|
+
* )}
|
|
491
570
|
* </DataTable.Body>
|
|
492
571
|
* </DataTable.Root>
|
|
493
|
-
* <
|
|
494
|
-
* <
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
* type="button"
|
|
508
|
-
* priority="neutral"
|
|
509
|
-
* onClick={() => table.nextPage()}
|
|
510
|
-
* disabled={!table.getCanNextPage()}
|
|
511
|
-
* >
|
|
512
|
-
* Next
|
|
513
|
-
* </Button>
|
|
514
|
-
* </div>
|
|
515
|
-
* </div>
|
|
572
|
+
* <CursorPagination.Root className="flex justify-end" defaultPageSize={DEFAULT_PAGE_SIZE}>
|
|
573
|
+
* <CursorPagination.PageSizeSelect
|
|
574
|
+
* onChangePageSize={(size) => {
|
|
575
|
+
* table.setPageSize(size);
|
|
576
|
+
* table.setPageIndex(0); // reset to the first page when the size changes
|
|
577
|
+
* }}
|
|
578
|
+
* />
|
|
579
|
+
* <CursorPagination.Buttons
|
|
580
|
+
* hasPreviousPage={table.getCanPreviousPage()}
|
|
581
|
+
* hasNextPage={table.getCanNextPage()}
|
|
582
|
+
* onPreviousPage={() => table.previousPage()}
|
|
583
|
+
* onNextPage={() => table.nextPage()}
|
|
584
|
+
* />
|
|
585
|
+
* </CursorPagination.Root>
|
|
516
586
|
* </div>
|
|
517
587
|
* );
|
|
518
588
|
* }
|
|
@@ -707,15 +777,25 @@ declare const DataTable: {
|
|
|
707
777
|
* branch when `rows.length === 0` to keep the table's frame intact instead
|
|
708
778
|
* of collapsing to an empty `<tbody>`.
|
|
709
779
|
*
|
|
780
|
+
* Drop an `Empty` in as the child for a real empty state — `EmptyRow` spans
|
|
781
|
+
* every column and `Empty.Root` centers itself, so no `<td>` or centering
|
|
782
|
+
* markup is needed.
|
|
783
|
+
*
|
|
710
784
|
* @see https://mantle.ngrok.com/components/data-table#datatableemptyrow
|
|
785
|
+
* @see https://mantle.ngrok.com/components/empty
|
|
711
786
|
*
|
|
712
787
|
* @example
|
|
713
788
|
* ```tsx
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
*
|
|
718
|
-
*
|
|
789
|
+
* import { DataTable } from "@ngrok/mantle/data-table";
|
|
790
|
+
* import { Empty } from "@ngrok/mantle/empty";
|
|
791
|
+
* import { TrayIcon } from "@phosphor-icons/react/Tray";
|
|
792
|
+
*
|
|
793
|
+
* <DataTable.EmptyRow>
|
|
794
|
+
* <Empty.Root>
|
|
795
|
+
* <Empty.Icon svg={<TrayIcon />} />
|
|
796
|
+
* <Empty.Title>No endpoints yet</Empty.Title>
|
|
797
|
+
* </Empty.Root>
|
|
798
|
+
* </DataTable.EmptyRow>
|
|
719
799
|
* ```
|
|
720
800
|
*/
|
|
721
801
|
readonly EmptyRow: typeof EmptyRow;
|
package/dist/data-table.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./cx-CBSnSC36.js";import{t}from"./button-uMIZVKit.js";import{i as n}from"./direction-Wa9W2F61.js";import{t as r}from"./sort-BPX2Fk9t.js";import{t as i}from"./table-
|
|
1
|
+
import{t as e}from"./cx-CBSnSC36.js";import{t}from"./button-uMIZVKit.js";import{i as n}from"./direction-Wa9W2F61.js";import{t as r}from"./sort-BPX2Fk9t.js";import{t as i}from"./table-DWy_oNta.js";import{Fragment as a,createContext as o,forwardRef as s,useContext as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{flexRender as p}from"@tanstack/react-table";export*from"@tanstack/react-table";const m=[`unsorted`,`asc`,`desc`],h=[`unsorted`,`desc`,`asc`];function g(e,t){return _(t===`alphanumeric`?m:h,e)??`unsorted`}function _(e,t,n){if(e.length===0)return n;let r=e.findIndex(e=>e===t);if(r===-1)return n;let i=(r+1)%e.length;return e.at(i)??n}const v=o(null);function y(){let e=c(v);return u(e,`useDataTableContext should only be used within a DataTable child component`),e}function b({children:e,table:t,...n}){let r=l(()=>({table:t}),[t]);return d(v.Provider,{value:r,children:d(i.Root,{"data-slot":`data-table`,...n,children:d(i.Element,{children:e})})})}function x({children:r,className:i,column:a,disableSorting:o=!1,iconPlacement:s=`end`,sortingMode:c,sortIcon:l,onClick:u,...p}){let m=a.getIsSorted(),h=!o&&a.getCanSort(),g=h&&typeof m==`string`?m:`unsorted`,_=l?.(g)??d(j,{mode:c,direction:g});return f(t,{appearance:`ghost`,"data-slot":`data-table-header-sort-button`,className:e(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none text-muted`,i),"data-sort-direction":g,"data-table-header-action":!0,icon:_,iconPlacement:s,onClick:e=>{u?.(e),!e.defaultPrevented&&(!h||o||c===void 0||M(a,c))},priority:`neutral`,type:`button`,...p,children:[h&&g!==`unsorted`&&f(`span`,{className:`sr-only`,children:[`Column sorted in`,` `,c===`alphanumeric`?g===`asc`?`ascending`:`descending`:n(g),` `,`order`]}),r]})}function S({children:t,className:n,...r}){return d(i.Header,{"data-slot":`data-table-header`,className:e(`has-data-table-header-action:px-0`,n),...r,children:t})}const C=s((e,t)=>d(i.Body,{ref:t,"data-slot":`data-table-body`,...e}));C.displayName=`DataTableBody`;function w(e){let{table:t}=y();return d(i.Head,{"data-slot":`data-table-head`,...e,children:t.getHeaderGroups().map(e=>d(i.Row,{children:e.headers.map(e=>d(a,{children:e.isPlaceholder?d(i.Header,{},e.id):p(e.column.columnDef.header,e.getContext())},e.id))},e.id))})}function T({className:t,row:n,...r}){return d(i.Row,{"data-slot":`data-table-row`,className:e(r.onClick&&`cursor-pointer`,t),...r,children:n.getVisibleCells().map(e=>d(a,{children:p(e.column.columnDef.cell,e.getContext())},e.id))})}function E({children:e,...t}){let{table:n}=y(),r=n.getAllColumns().length;return d(i.Row,{"data-slot":`data-table-empty-row`,...t,children:d(i.Cell,{colSpan:r,children:e})})}function D(){return d(`span`,{"aria-hidden":!0,className:e(`pointer-events-none absolute -inset-y-px -left-1.5 w-1.5`,`opacity-0 transition-opacity group-data-sticky-active/table:opacity-100`,`shadow-[1px_0_0_0_var(--border-color-card-muted)]`,`bg-linear-to-l to-transparent`,`from-[color-mix(in_oklab,var(--shadow-color)_var(--shadow-second-opacity),transparent)]`)})}function O({children:t,className:n,...r}){return f(i.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":`data-table-action-cell`,className:e(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,n),...r,children:[d(D,{}),t]})}function k({children:t,className:n,...r}){let{table:a}=y(),o=a.getRowModel().rows.length>0;return f(i.Header,{...o?{"data-mantle-table-sticky-right":!0}:{},"data-slot":`data-table-action-header`,className:e(o&&`sticky z-10 right-0 bg-inherit`,n),...r,children:[o&&d(D,{}),t]})}b.displayName=`DataTable`,O.displayName=`DataTableActionCell`,k.displayName=`DataTableActionHeader`,C.displayName=`DataTableBody`,E.displayName=`DataTableEmptyRow`,w.displayName=`DataTableHead`,S.displayName=`DataTableHeader`,x.displayName=`DataTableHeaderSortButton`,T.displayName=`DataTableRow`;const A={Root:b,ActionCell:O,ActionHeader:k,Cell:i.Cell,Body:C,EmptyRow:E,Head:w,Header:S,HeaderSortButton:x,Row:T};function j({direction:e,mode:t,...n}){return e===`unsorted`||!t||!e?d(`svg`,{"aria-hidden":!0,...n}):d(r,{mode:t,direction:e,...n})}function M(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(g(typeof n==`string`?n:`unsorted`,t)){case`unsorted`:e.clearSorting();return;case`asc`:e.toggleSorting(!1);return;case`desc`:e.toggleSorting(!0);return;default:return}}export{A as DataTable};
|
|
2
2
|
//# sourceMappingURL=data-table.js.map
|