@ngrok/mantle 0.78.0 → 0.79.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/agent.json +1 -1
- package/dist/alert-dialog.d.ts +85 -46
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +24 -16
- package/dist/alert.js +1 -1
- package/dist/button-ClC60Nzg.js +1 -0
- package/dist/{button-Bw9MpShl.d.ts → button-DcXOWUYo.d.ts} +49 -7
- package/dist/button.d.ts +6 -5
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/centered-layout.d.ts +17 -5
- package/dist/code-block.js +1 -1
- package/dist/command.d.ts +12 -12
- package/dist/command.js +1 -1
- package/dist/data-table.d.ts +36 -10
- package/dist/data-table.js +1 -1
- package/dist/{dialog-DVDFVT_-.js → dialog-ZCgG41hx.js} +1 -1
- package/dist/dialog.d.ts +72 -54
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-Bt1aKF1g.js +1 -0
- package/dist/{dropdown-menu-DT30TQzL.d.ts → dropdown-menu-DP_Ne9Mr.d.ts} +7 -4
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +12 -12
- package/dist/field.d.ts +19 -2
- package/dist/field.js +1 -1
- package/dist/hover-card.d.ts +9 -7
- package/dist/{icon-button-DuRSCsPh.d.ts → icon-button-B7uEj1qq.d.ts} +68 -5
- package/dist/icon-button-DV2-GZHf.js +1 -0
- package/dist/{index-CDwfBOAA.d.ts → index-BivvYYs-.d.ts} +5 -5
- package/dist/index-g2rfwNCH.d.ts +1 -0
- package/dist/intents-DdSKSj1c.d.ts +28 -0
- package/dist/llms.txt +1 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +1 -1
- package/dist/popover.d.ts +11 -11
- package/dist/{primitive-wm7Wk-gy.js → primitive-M-kZdNIS.js} +1 -1
- package/dist/sheet.d.ts +81 -52
- package/dist/sheet.js +1 -1
- package/dist/{sizes-Dje_rwKc.d.ts → sizes-BCoI4bhP.d.ts} +2 -2
- package/dist/split-button.d.ts +8 -7
- package/dist/split-button.js +1 -1
- package/dist/theme-switcher.d.ts +150 -21
- package/dist/theme-switcher.js +1 -1
- package/dist/toast-D3ntBmn4.js +1 -0
- package/dist/toast.d.ts +19 -13
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +6 -6
- package/package.json +1 -1
- package/dist/button-AS5Ir3DE.js +0 -1
- package/dist/dropdown-menu-ByUQkAvJ.js +0 -1
- package/dist/icon-button-CxVsZ2N1.js +0 -1
- package/dist/index-BnI3OppC.d.ts +0 -1
- package/dist/toast-RkhbliFh.js +0 -1
package/dist/hover-card.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
|
15
15
|
* ```tsx
|
|
16
16
|
* <HoverCard.Root>
|
|
17
17
|
* <HoverCard.Trigger asChild>
|
|
18
|
-
* <Button type="button" appearance="outlined">
|
|
18
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
19
19
|
* Hover me
|
|
20
20
|
* </Button>
|
|
21
21
|
* </HoverCard.Trigger>
|
|
@@ -58,7 +58,7 @@ declare const Root: {
|
|
|
58
58
|
* ```tsx
|
|
59
59
|
* <HoverCard.Root>
|
|
60
60
|
* <HoverCard.Trigger asChild>
|
|
61
|
-
* <Button type="button" appearance="outlined">
|
|
61
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
62
62
|
* Hover me
|
|
63
63
|
* </Button>
|
|
64
64
|
* </HoverCard.Trigger>
|
|
@@ -82,7 +82,9 @@ declare const HoverCard: {
|
|
|
82
82
|
* ```tsx
|
|
83
83
|
* <HoverCard.Root>
|
|
84
84
|
* <HoverCard.Trigger asChild>
|
|
85
|
-
* <Button
|
|
85
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
86
|
+
* Hover me
|
|
87
|
+
* </Button>
|
|
86
88
|
* </HoverCard.Trigger>
|
|
87
89
|
* <HoverCard.Content>
|
|
88
90
|
* <p>This is the hover card content.</p>
|
|
@@ -104,13 +106,13 @@ declare const HoverCard: {
|
|
|
104
106
|
* ```tsx
|
|
105
107
|
* <HoverCard.Root>
|
|
106
108
|
* <HoverCard.Trigger asChild>
|
|
107
|
-
* <Button type="button"
|
|
109
|
+
* <Button type="button" appearance="link" intent="accent">@username</Button>
|
|
108
110
|
* </HoverCard.Trigger>
|
|
109
111
|
* <HoverCard.Content side="top">
|
|
110
112
|
* <div className="space-y-2">
|
|
111
113
|
* <Text weight="strong">User Profile</Text>
|
|
112
114
|
* <Text>Additional information about the user.</Text>
|
|
113
|
-
* <Button type="button" size="sm">Follow</Button>
|
|
115
|
+
* <Button type="button" appearance="filled" intent="neutral" size="sm">Follow</Button>
|
|
114
116
|
* </div>
|
|
115
117
|
* </HoverCard.Content>
|
|
116
118
|
* </HoverCard.Root>
|
|
@@ -129,7 +131,7 @@ declare const HoverCard: {
|
|
|
129
131
|
* ```tsx
|
|
130
132
|
* <HoverCard.Root>
|
|
131
133
|
* <HoverCard.Trigger asChild>
|
|
132
|
-
* <Button type="button" appearance="outlined">
|
|
134
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
133
135
|
* Hover me
|
|
134
136
|
* </Button>
|
|
135
137
|
* </HoverCard.Trigger>
|
|
@@ -151,7 +153,7 @@ declare const HoverCard: {
|
|
|
151
153
|
* ```tsx
|
|
152
154
|
* <HoverCard.Root>
|
|
153
155
|
* <HoverCard.Trigger asChild>
|
|
154
|
-
* <Button type="button"
|
|
156
|
+
* <Button type="button" appearance="ghost" intent="neutral">
|
|
155
157
|
* Hover for details
|
|
156
158
|
* </Button>
|
|
157
159
|
* </HoverCard.Trigger>
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
2
|
import { i as DeepNonNullable, r as VariantProps } from "./index-D47aqlpz.js";
|
|
3
|
+
import { t as ButtonIntent } from "./intents-DdSKSj1c.js";
|
|
3
4
|
import { ButtonHTMLAttributes, ReactNode } from "react";
|
|
4
5
|
//#region src/components/button/icon-button.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The visual style of an `IconButton`: how much visual weight it carries,
|
|
8
|
+
* independent of its tone (`intent`). IconButton has no `filled` or `link`
|
|
9
|
+
* appearance — a filled icon-only box reads as a toggle, and an icon-only
|
|
10
|
+
* link has no text to read as a link.
|
|
11
|
+
*/
|
|
12
|
+
type IconButtonAppearance = "ghost" | "outlined";
|
|
5
13
|
declare const iconButtonVariants: (props?: ({
|
|
6
14
|
appearance?: "ghost" | "outlined" | null | undefined;
|
|
15
|
+
intent?: "accent" | "danger" | "neutral" | null | undefined;
|
|
7
16
|
isLoading?: boolean | null | undefined;
|
|
8
17
|
size?: "lg" | "md" | "sm" | "xl" | "xs" | null | undefined;
|
|
9
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -11,7 +20,28 @@ type IconButtonVariants = VariantProps<typeof iconButtonVariants>;
|
|
|
11
20
|
/**
|
|
12
21
|
* The props for the `IconButton` component.
|
|
13
22
|
*/
|
|
14
|
-
type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & WithAsChild & IconButtonVariants & {
|
|
23
|
+
type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & WithAsChild & Omit<IconButtonVariants, "appearance" | "intent"> & {
|
|
24
|
+
/**
|
|
25
|
+
* The visual style of the IconButton. Required — there is no default,
|
|
26
|
+
* so every call site states the weight it means.
|
|
27
|
+
*
|
|
28
|
+
* @enum
|
|
29
|
+
* - `"ghost"`: no border or fill until hovered
|
|
30
|
+
* - `"outlined"`: bordered on the form background
|
|
31
|
+
*/
|
|
32
|
+
appearance: IconButtonAppearance;
|
|
33
|
+
/**
|
|
34
|
+
* The tone of the IconButton — the purpose its color communicates to
|
|
35
|
+
* the user. Required — there is no default, so every call site states
|
|
36
|
+
* the tone it means. `"neutral"` is the workhorse tone (and matches
|
|
37
|
+
* how IconButton rendered before it had an intent axis).
|
|
38
|
+
*
|
|
39
|
+
* @enum
|
|
40
|
+
* - `"neutral"`: the workhorse tone — routine and secondary actions
|
|
41
|
+
* - `"accent"`: deliberate brand emphasis; reach for it when an action should carry the brand color
|
|
42
|
+
* - `"danger"`: a destructive or irreversible action
|
|
43
|
+
*/
|
|
44
|
+
intent: ButtonIntent;
|
|
15
45
|
/**
|
|
16
46
|
* The accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags.
|
|
17
47
|
*/
|
|
@@ -47,6 +77,10 @@ type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & WithAsChild & I
|
|
|
47
77
|
* as submitting a form or opening a dialog.
|
|
48
78
|
* Renders only a single icon as children with an accessible, screen-reader-only label.
|
|
49
79
|
*
|
|
80
|
+
* `appearance` (visual weight) and `intent` (tone) are required — every call
|
|
81
|
+
* site states what it means; there are no implicit defaults. `intent="neutral"`
|
|
82
|
+
* matches how IconButton rendered before it had an intent axis.
|
|
83
|
+
*
|
|
50
84
|
* @see https://mantle.ngrok.com/components/actions/icon-button
|
|
51
85
|
*
|
|
52
86
|
* @example
|
|
@@ -55,6 +89,7 @@ type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & WithAsChild & I
|
|
|
55
89
|
* icon={<TrashIcon />}
|
|
56
90
|
* label="Delete item"
|
|
57
91
|
* appearance="ghost"
|
|
92
|
+
* intent="danger"
|
|
58
93
|
* size="sm"
|
|
59
94
|
* onClick={handleDelete}
|
|
60
95
|
* />
|
|
@@ -63,14 +98,42 @@ type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & WithAsChild & I
|
|
|
63
98
|
* @example
|
|
64
99
|
* Submit a form — opt in with `type="submit"` (the default `"button"` does not submit):
|
|
65
100
|
* ```tsx
|
|
66
|
-
* <IconButton
|
|
101
|
+
* <IconButton
|
|
102
|
+
* type="submit"
|
|
103
|
+
* appearance="outlined"
|
|
104
|
+
* intent="neutral"
|
|
105
|
+
* icon={<MagnifyingGlassIcon />}
|
|
106
|
+
* label="Search"
|
|
107
|
+
* />
|
|
67
108
|
* ```
|
|
68
109
|
*/
|
|
69
|
-
declare const IconButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & WithAsChild & Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
110
|
+
declare const IconButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & WithAsChild & Omit<Partial<DeepNonNullable<import("class-variance-authority").VariantProps<(props?: ({
|
|
70
111
|
appearance?: "ghost" | "outlined" | null | undefined;
|
|
112
|
+
intent?: "accent" | "danger" | "neutral" | null | undefined;
|
|
71
113
|
isLoading?: boolean | null | undefined;
|
|
72
114
|
size?: "lg" | "md" | "sm" | "xl" | "xs" | null | undefined;
|
|
73
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string
|
|
115
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string>>>, "appearance" | "intent"> & {
|
|
116
|
+
/**
|
|
117
|
+
* The visual style of the IconButton. Required — there is no default,
|
|
118
|
+
* so every call site states the weight it means.
|
|
119
|
+
*
|
|
120
|
+
* @enum
|
|
121
|
+
* - `"ghost"`: no border or fill until hovered
|
|
122
|
+
* - `"outlined"`: bordered on the form background
|
|
123
|
+
*/
|
|
124
|
+
appearance: IconButtonAppearance;
|
|
125
|
+
/**
|
|
126
|
+
* The tone of the IconButton — the purpose its color communicates to
|
|
127
|
+
* the user. Required — there is no default, so every call site states
|
|
128
|
+
* the tone it means. `"neutral"` is the workhorse tone (and matches
|
|
129
|
+
* how IconButton rendered before it had an intent axis).
|
|
130
|
+
*
|
|
131
|
+
* @enum
|
|
132
|
+
* - `"neutral"`: the workhorse tone — routine and secondary actions
|
|
133
|
+
* - `"accent"`: deliberate brand emphasis; reach for it when an action should carry the brand color
|
|
134
|
+
* - `"danger"`: a destructive or irreversible action
|
|
135
|
+
*/
|
|
136
|
+
intent: ButtonIntent;
|
|
74
137
|
/**
|
|
75
138
|
* The accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags.
|
|
76
139
|
*/
|
|
@@ -100,4 +163,4 @@ declare const IconButton: import("react").ForwardRefExoticComponent<ButtonHTMLAt
|
|
|
100
163
|
type?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
101
164
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
102
165
|
//#endregion
|
|
103
|
-
export {
|
|
166
|
+
export { IconButtonAppearance as n, IconButtonProps as r, IconButton as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-CDtYjF_H.js";import{t as n}from"./slot-DmPrjM7N.js";import{t as r}from"./booleanish-BfvnW6vy.js";import{Children as i,cloneElement as a,forwardRef as o,isValidElement as s}from"react";import c from"tiny-invariant";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{cva as f}from"class-variance-authority";import{CircleNotchIcon as p}from"@phosphor-icons/react/CircleNotch";const m=f(e(`icon-button`,`inline-flex shrink-0 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] border`,`focus:outline-hidden focus-visible:ring-4`,`disabled:cursor-default disabled:opacity-50`,`not-disabled:active:scale-97 ease-out transition-transform duration-150`),{variants:{appearance:{ghost:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border-transparent`,outlined:`border-accent-600 bg-form text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-accent-700 not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700`},intent:{accent:``,danger:``,neutral:``},isLoading:{false:``,true:`opacity-50`},size:{xs:`size-6`,sm:`size-7`,md:`size-9`,lg:`size-10`,xl:`size-12`}},defaultVariants:{intent:`neutral`,size:`md`},compoundVariants:[{appearance:`ghost`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700 border-transparent`},{appearance:`outlined`,intent:`danger`,class:`border-danger-600 bg-form text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:border-danger-700 not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700`},{appearance:`ghost`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong border-transparent`},{appearance:`outlined`,intent:`neutral`,class:`border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong focus-visible:not-disabled:hover:border-accent-600 focus-visible:not-disabled:active:border-accent-600`}]}),h=o(({"aria-disabled":o,appearance:f,asChild:h=!1,children:g,className:_,disabled:v,icon:y,intent:b,isLoading:x=!1,label:S,size:C=`md`,type:w,...T},E)=>{let D=r(o??v??x),O=x?u(p,{className:`animate-spin`}):y,k={"aria-disabled":D,"data-slot":`icon-button`,className:e(m({appearance:f,intent:b,isLoading:x,size:C}),_),"data-appearance":f,"data-disabled":D,"data-icon-button":!0,"data-intent":b,"data-loading":x,"data-size":C,disabled:D,ref:E,...T},A=d(l,{children:[u(`span`,{className:`sr-only`,children:S}),u(t,{svg:O})]});return h?(c(s(g)&&i.only(g),"When using `asChild`, IconButton must be passed a single child as a JSX tag."),u(n,{...k,children:a(g,{},A)})):u(`button`,{...k,type:w??`button`,children:A})});h.displayName=`IconButton`;export{m as n,h as t};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
2
|
import { r as VariantProps } from "./index-D47aqlpz.js";
|
|
3
|
-
import "./button-
|
|
4
|
-
import "./icon-button-
|
|
3
|
+
import "./button-DcXOWUYo.js";
|
|
4
|
+
import "./icon-button-B7uEj1qq.js";
|
|
5
5
|
import { ComponentProps } from "react";
|
|
6
6
|
//#region src/components/button/button-group.d.ts
|
|
7
7
|
declare const buttonGroupVariants: (props?: ({
|
|
@@ -17,9 +17,9 @@ type ButtonGroupProps = ComponentProps<"div"> & ButtonGroupVariants & WithAsChil
|
|
|
17
17
|
* @example
|
|
18
18
|
* ```tsx
|
|
19
19
|
* <ButtonGroup appearance="panel">
|
|
20
|
-
* <IconButton icon={<Bold />} label="Bold" />
|
|
21
|
-
* <IconButton icon={<Italic />} label="Italic" />
|
|
22
|
-
* <IconButton icon={<Underline />} label="Underline" />
|
|
20
|
+
* <IconButton appearance="ghost" intent="neutral" icon={<Bold />} label="Bold" />
|
|
21
|
+
* <IconButton appearance="ghost" intent="neutral" icon={<Italic />} label="Italic" />
|
|
22
|
+
* <IconButton appearance="ghost" intent="neutral" icon={<Underline />} label="Underline" />
|
|
23
23
|
* </ButtonGroup>
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./dropdown-menu-DP_Ne9Mr.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/components/button/intents.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The tone axis shared by the button family (`Button` and `IconButton`) —
|
|
4
|
+
* the purpose a button's color communicates to the user:
|
|
5
|
+
*
|
|
6
|
+
* - `"neutral"` — the workhorse tone: routine and secondary actions, and the
|
|
7
|
+
* default primary action (`appearance="filled" intent="neutral"`)
|
|
8
|
+
* - `"accent"` — deliberate brand emphasis, colored with the accent tokens
|
|
9
|
+
* (e.g. `bg-filled-accent`, `text-accent-600`); reach for it when an
|
|
10
|
+
* action should carry the brand color, not as the routine primary
|
|
11
|
+
* - `"danger"` — a destructive or irreversible action
|
|
12
|
+
*
|
|
13
|
+
* There is no default: `intent` is a required prop on the button family so
|
|
14
|
+
* every call site states the tone it means.
|
|
15
|
+
*
|
|
16
|
+
* See `decisions/2026-07-13-button-size-and-intent-api.md`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Button appearance="filled" intent="neutral">Save</Button>
|
|
21
|
+
* <Button appearance="outlined" intent="neutral">Cancel</Button>
|
|
22
|
+
* <Button appearance="filled" intent="danger">Delete</Button>
|
|
23
|
+
* <Button appearance="filled" intent="accent">Upgrade to Pro</Button>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
type ButtonIntent = "accent" | "danger" | "neutral";
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ButtonIntent as t };
|
package/dist/llms.txt
CHANGED
package/dist/pagination.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
|
-
import { t as ButtonGroup } from "./index-
|
|
2
|
+
import { t as ButtonGroup } from "./index-BivvYYs-.js";
|
|
3
3
|
import { t as Select } from "./select-Bwt2YduR.js";
|
|
4
4
|
import { ComponentProps } from "react";
|
|
5
5
|
//#region src/components/pagination/cursor-pagination.d.ts
|
package/dist/pagination.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-DmPrjM7N.js";import{t as n}from"./icon-button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-DmPrjM7N.js";import{t as n}from"./icon-button-DV2-GZHf.js";import{t as r}from"./button-5t6-JS_I.js";import{n as i}from"./separator-kBnnv3Cw.js";import{t as a}from"./select-D-5u0Blc.js";import{createContext as o,forwardRef as s,useContext as c,useEffect as l,useMemo as u,useState as d}from"react";import f from"tiny-invariant";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{CaretRightIcon as h}from"@phosphor-icons/react/CaretRight";import{CaretLeftIcon as g}from"@phosphor-icons/react/CaretLeft";const _=o(void 0),v=s(({className:t,children:n,defaultPageSize:r,...i},a)=>{let[o,s]=d(r),c=u(()=>({defaultPageSize:r,pageSize:o,setPageSize:s}),[r,o]);return p(_.Provider,{value:c,children:p(`div`,{"data-slot":`cursor-pagination`,className:e(`inline-flex items-center justify-between gap-2`,t),ref:a,...i,children:n})})});v.displayName=`CursorPagination`;const y=s(({hasNextPage:e,hasPreviousPage:t,onNextPage:a,onPreviousPage:o,...s},c)=>m(r,{"data-slot":`cursor-pagination-buttons`,appearance:`panel`,ref:c,...s,children:[p(n,{"data-slot":`cursor-pagination-previous`,appearance:`ghost`,disabled:!t,icon:p(g,{}),intent:`neutral`,label:`Previous page`,onClick:o,size:`sm`,type:`button`}),p(i,{"data-slot":`cursor-pagination-separator`,orientation:`vertical`,className:`min-h-5`}),p(n,{"data-slot":`cursor-pagination-next`,appearance:`ghost`,disabled:!e,icon:p(h,{}),intent:`neutral`,label:`Next page`,onClick:a,size:`sm`,type:`button`})]}));y.displayName=`CursorButtons`;const b=[5,10,20,50,100],x=s(({className:t,pageSizes:n=b,onChangePageSize:r,...i},o)=>{let s=c(_);return f(s,`CursorPageSizeSelect must be used as a child of a CursorPagination component`),f(n.includes(s.defaultPageSize),`CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes`),f(n.includes(s.pageSize),`CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes`),m(a.Root,{defaultValue:`${s.pageSize}`,onValueChange:e=>{let t=Number.parseInt(e,10);Number.isNaN(t)&&(t=s.defaultPageSize),s.setPageSize(t),r?.(t)},children:[p(a.Trigger,{ref:o,"data-slot":`cursor-pagination-page-size-select`,className:e(`w-auto min-w-36`,t),value:s.pageSize,...i,children:p(a.Value,{})}),p(a.Content,{width:`trigger`,children:n.map(e=>m(a.Item,{value:`${e}`,children:[e,` per page`]},e))})]})});x.displayName=`CursorPageSizeSelect`;function S({asChild:n=!1,className:r,...i}){let a=c(_);return f(a,`CursorPageSizeValue must be used as a child of a CursorPagination component`),m(n?t:`span`,{"data-slot":`cursor-pagination-page-size-value`,className:e(`text-muted text-sm font-normal`,r),...i,children:[a.pageSize,` per page`]})}S.displayName=`CursorPageSizeValue`;const C={Root:v,Buttons:y,PageSizeSelect:x,PageSizeValue:S};function w({listSize:e,pageSize:t}){let[n,r]=d(1),[i,a]=d(t);l(()=>{a(t),r(1)},[t]),l(()=>{r(1)},[e]);let o=Math.ceil(e/i),s=(n-1)*i,c=n>1,u=n<o;function f(e){r(Math.max(1,Math.min(e,o)))}function p(){u&&r(e=>Math.min(e+1,o))}function m(){c&&r(e=>Math.max(e-1,1))}function h(e){a(e),r(1)}function g(){r(o)}function _(){r(1)}return{currentPage:n,goToFirstPage:_,goToLastPage:g,goToPage:f,hasNextPage:u,hasPreviousPage:c,nextPage:p,offset:s,pageSize:i,previousPage:m,setPageSize:h,totalPages:o}}function T(e,t){return e.slice(t.offset,t.offset+t.pageSize)}export{C as CursorPagination,T as getOffsetPaginatedSlice,w as useOffsetPagination};
|
package/dist/popover.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
|
37
37
|
* ```tsx
|
|
38
38
|
* <Popover.Root>
|
|
39
39
|
* <Popover.Trigger asChild>
|
|
40
|
-
* <Button type="button" appearance="outlined">
|
|
40
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
41
41
|
* Open Popover
|
|
42
42
|
* </Button>
|
|
43
43
|
* </Popover.Trigger>
|
|
@@ -61,7 +61,7 @@ declare const Popover: {
|
|
|
61
61
|
* ```tsx
|
|
62
62
|
* <Popover.Root>
|
|
63
63
|
* <Popover.Trigger asChild>
|
|
64
|
-
* <Button>Open popover</Button>
|
|
64
|
+
* <Button type="button" appearance="outlined" intent="neutral">Open popover</Button>
|
|
65
65
|
* </Popover.Trigger>
|
|
66
66
|
* <Popover.Content>
|
|
67
67
|
* <p>This is the popover content.</p>
|
|
@@ -82,12 +82,12 @@ declare const Popover: {
|
|
|
82
82
|
* <div>Position relative to this element</div>
|
|
83
83
|
* </Popover.Anchor>
|
|
84
84
|
* <Popover.Trigger asChild>
|
|
85
|
-
* <Button type="button" appearance="outlined">Open Popover</Button>
|
|
85
|
+
* <Button type="button" appearance="outlined" intent="neutral">Open Popover</Button>
|
|
86
86
|
* </Popover.Trigger>
|
|
87
87
|
* <Popover.Content>
|
|
88
88
|
* <p>This popover is positioned relative to the anchor.</p>
|
|
89
89
|
* <Popover.Close asChild>
|
|
90
|
-
* <Button type="button">Close</Button>
|
|
90
|
+
* <Button type="button" appearance="outlined" intent="neutral">Close</Button>
|
|
91
91
|
* </Popover.Close>
|
|
92
92
|
* </Popover.Content>
|
|
93
93
|
* </Popover.Root>
|
|
@@ -103,13 +103,13 @@ declare const Popover: {
|
|
|
103
103
|
* ```tsx
|
|
104
104
|
* <Popover.Root>
|
|
105
105
|
* <Popover.Trigger asChild>
|
|
106
|
-
* <Button type="button">Settings</Button>
|
|
106
|
+
* <Button type="button" appearance="outlined" intent="neutral">Settings</Button>
|
|
107
107
|
* </Popover.Trigger>
|
|
108
108
|
* <Popover.Content>
|
|
109
109
|
* <div className="flex items-center justify-between">
|
|
110
110
|
* <Text>Settings Panel</Text>
|
|
111
111
|
* <Popover.Close asChild>
|
|
112
|
-
* <
|
|
112
|
+
* <IconButton type="button" appearance="ghost" intent="neutral" size="sm" label="Close" icon={<XIcon />} />
|
|
113
113
|
* </Popover.Close>
|
|
114
114
|
* </div>
|
|
115
115
|
* <Text>Configure your preferences here.</Text>
|
|
@@ -131,13 +131,13 @@ declare const Popover: {
|
|
|
131
131
|
* ```tsx
|
|
132
132
|
* <Popover.Root>
|
|
133
133
|
* <Popover.Trigger asChild>
|
|
134
|
-
* <Button type="button">Show Info</Button>
|
|
134
|
+
* <Button type="button" appearance="outlined" intent="neutral">Show Info</Button>
|
|
135
135
|
* </Popover.Trigger>
|
|
136
136
|
* <Popover.Content side="top" align="center">
|
|
137
137
|
* <div className="space-y-2">
|
|
138
138
|
* <Text weight="strong">Additional Information</Text>
|
|
139
139
|
* <Text>This is the content inside the popover.</Text>
|
|
140
|
-
* <Button type="button" size="sm">Action</Button>
|
|
140
|
+
* <Button type="button" appearance="filled" intent="neutral" size="sm">Action</Button>
|
|
141
141
|
* </div>
|
|
142
142
|
* </Popover.Content>
|
|
143
143
|
* </Popover.Root>
|
|
@@ -163,14 +163,14 @@ declare const Popover: {
|
|
|
163
163
|
* ```tsx
|
|
164
164
|
* <Popover.Root>
|
|
165
165
|
* <Popover.Trigger asChild>
|
|
166
|
-
* <Button type="button" appearance="outlined">
|
|
166
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
167
167
|
* Options
|
|
168
168
|
* </Button>
|
|
169
169
|
* </Popover.Trigger>
|
|
170
170
|
* <Popover.Content>
|
|
171
171
|
* <div className="space-y-2">
|
|
172
|
-
* <Button type="button"
|
|
173
|
-
* <Button type="button"
|
|
172
|
+
* <Button type="button" appearance="ghost" intent="neutral">Edit</Button>
|
|
173
|
+
* <Button type="button" appearance="ghost" intent="danger">Delete</Button>
|
|
174
174
|
* </div>
|
|
175
175
|
* </Popover.Content>
|
|
176
176
|
* </Popover.Root>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./slot-DmPrjM7N.js";import{t}from"./booleanish-BfvnW6vy.js";import{i as n}from"./toast-
|
|
1
|
+
import{t as e}from"./slot-DmPrjM7N.js";import{t}from"./booleanish-BfvnW6vy.js";import{i as n}from"./toast-D3ntBmn4.js";import{createContext as r,forwardRef as i,useContext as a,useEffect as o,useMemo as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";import*as u from"@radix-ui/react-dialog";const d=r({hasDescription:!1,setHasDescription:()=>{}});function f(e){let[t,n]=c(!1),r=s(()=>({hasDescription:t,setHasDescription:n}),[t]);return l(d.Provider,{value:r,children:l(u.Root,{...e})})}f.displayName=`DialogPrimitiveRoot`;const p=u.Trigger;p.displayName=`DialogPrimitiveTrigger`;const m=u.Portal;m.displayName=`DialogPrimitivePortal`;const h=u.Close;h.displayName=`DialogPrimitiveClose`;const g=i((e,t)=>l(u.Overlay,{"data-overlay":!0,ref:t,...e}));g.displayName=`DialogPrimitiveOverlay`;const _=i(({onEscapeKeyDown:e,onInteractOutside:t,onPointerDownOutside:r,...i},o)=>{let s=a(d);return l(u.Content,{ref:o,onEscapeKeyDown:t=>{x(t),e?.(t)},onInteractOutside:e=>{n(e),t?.(e)},onPointerDownOutside:e=>{n(e),r?.(e)},...s.hasDescription?{}:{"aria-describedby":void 0},...i})});_.displayName=`DialogPrimitiveContent`;const v=u.Title,y=i(({asChild:t,children:n,...r},i)=>{let s=a(d);o(()=>(s.setHasDescription(!0),()=>s.setHasDescription(!1)),[s]);let c=t?e:`div`;return l(u.Description,{ref:i,asChild:!0,children:l(c,{...r,children:n})})});y.displayName=`DialogPrimitiveDescription`;function b(e){return e instanceof HTMLElement&&e.hasAttribute(`data-overlay`)}function x(e){if(!T(e.currentTarget))return;let n=e.currentTarget,r=n instanceof Document?n.activeElement:n.ownerDocument?.activeElement??null,i=S(e.target)??S(r),a=i?C(i):null;i!=null&&t(i.getAttribute(`aria-expanded`))&&a!=null&&n.contains(i)&&n.contains(a)&&(a.getAttribute(`data-open`)===`true`||a.getAttribute(`data-state`)===`open`)&&e.preventDefault()}function S(e){return w(e)?e.closest(`[aria-expanded='true'][aria-controls]`):null}function C(e){let t=e.getAttribute(`aria-controls`);if(!t)return null;let n=e.ownerDocument.getElementById(t);return n instanceof HTMLElement?n:null}function w(e){return e instanceof HTMLElement}function T(e){return e instanceof Node&&`querySelector`in e}export{m as a,p as c,g as i,b as l,_ as n,f as o,y as r,v as s,h as t};
|