@ngrok/mantle 0.79.3 → 0.81.0
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 -19
- package/dist/accordion.js +1 -1
- package/dist/agent.json +5 -1
- package/dist/alert-dialog.d.ts +465 -32
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +116 -14
- package/dist/alert.js +1 -1
- package/dist/anchor-DfeXTpKW.js +1 -0
- package/dist/anchor.d.ts +2 -2
- package/dist/anchor.js +1 -1
- package/dist/area-chart.d.ts +504 -0
- package/dist/area-chart.js +1 -0
- package/dist/as-child-D23mGo4f.d.ts +49 -0
- package/dist/badge.d.ts +44 -5
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +491 -0
- package/dist/bar-chart.js +1 -0
- package/dist/breadcrumb.d.ts +196 -14
- package/dist/breadcrumb.js +1 -1
- package/dist/button-BAno7KIU.js +1 -0
- package/dist/{index-BSAizFod.d.ts → button-C-gMbPso.d.ts} +5 -5
- package/dist/{icon-button-BvQvT790.d.ts → button-C7vAl6lS.d.ts} +22 -63
- package/dist/button-D9n09xUg.js +1 -0
- package/dist/{button-DcXOWUYo.d.ts → button-DARFK2KJ.d.ts} +4 -4
- package/dist/button-DjpEKt2X.js +1 -0
- package/dist/button-DvHMWAPl.js +1 -0
- package/dist/button.d.ts +5 -5
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +0 -3
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +131 -9
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +209 -8
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BROa2gqt.js +2 -0
- package/dist/chart-BcOC6Qj0.d.ts +275 -0
- package/dist/checkbox-0EoxOyMA.js +1 -0
- package/dist/checkbox.d.ts +13 -11
- package/dist/checkbox.js +1 -1
- package/dist/choice-BHwFSSyv.js +1 -0
- package/dist/choice-BNRQXszu.d.ts +254 -0
- package/dist/choice.d.ts +1 -252
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +242 -52
- package/dist/code-block.js +6 -6
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +3 -2
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +171 -16
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +279 -81
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdBMM9ga.js +1 -0
- package/dist/data-table.d.ts +28 -6
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +67 -6
- package/dist/description-list.js +1 -1
- package/dist/dialog-BM4wPCft.d.ts +24 -0
- package/dist/dialog-DWZWd5Jt.js +1 -0
- package/dist/dialog.d.ts +226 -35
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-DP_Ne9Mr.d.ts → dropdown-menu-DZg-Cd69.d.ts} +137 -32
- package/dist/dropdown-menu-Dw-OtXPm.d.ts +1 -0
- package/dist/dropdown-menu-RyDWoKHx.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -22
- package/dist/empty.js +1 -1
- package/dist/field-B1wqeZr4.js +1 -0
- package/dist/field.d.ts +568 -47
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +0 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +3 -4
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +48 -7
- package/dist/hover-card.js +1 -1
- package/dist/{svg-only-BFeFS1aa.d.ts → icon-CX_gj6sW.d.ts} +2 -2
- package/dist/icon-d-nMCfAI.js +1 -0
- package/dist/{icon-Cevjo93X.d.ts → icon-k4E9yNWD.d.ts} +2 -2
- package/dist/icon-lZ48P8Nn.js +1 -0
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/{sort-BPX2Fk9t.js → icons-B_DDQcVD.js} +1 -1
- package/dist/{traffic-policy-file-0g5RXFqu.js → icons-CF1lbWtp.js} +1 -1
- package/dist/icons-DLCs1hLP.js +1 -0
- package/dist/icons.d.ts +7 -15
- package/dist/icons.js +1 -1
- package/dist/{in-view-nkSOdED2.d.ts → in-view-DDEGUKDR.d.ts} +17 -9
- package/dist/{index-D47aqlpz.d.ts → index-DA4ig3gj.d.ts} +1 -1
- package/dist/input-BnlpQF0c.js +1 -0
- package/dist/{types-C19IR7jf.d.ts → input-BuYDU6CF.d.ts} +42 -2
- package/dist/input.d.ts +5 -56
- package/dist/input.js +1 -1
- package/dist/{label-v2-bv98k.d.ts → label-C6YH9skg.d.ts} +8 -6
- package/dist/label-D-D11mlp.js +1 -0
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/line-chart.d.ts +490 -0
- package/dist/line-chart.js +1 -0
- package/dist/list-51KQvENW.js +1 -0
- package/dist/list.d.ts +135 -6
- package/dist/list.js +1 -1
- package/dist/llms.txt +5 -1
- package/dist/main.d.ts +20 -4
- package/dist/main.js +1 -1
- package/dist/mantle-dark-high-contrast.css +17 -0
- package/dist/mantle-dark.css +13 -0
- package/dist/mantle-light-high-contrast.css +15 -0
- package/dist/mantle.css +29 -0
- package/dist/media-object.d.ts +18 -4
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +282 -24
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +118 -6
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +61 -6
- package/dist/pagination.js +1 -1
- package/dist/popover-CE4OlWkd.d.ts +208 -0
- package/dist/popover-CQ9s7jG5.js +1 -0
- package/dist/popover.d.ts +1 -181
- package/dist/popover.js +1 -1
- package/dist/primitive-trJDqIXJ.js +1 -0
- package/dist/progress.d.ts +2 -8
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +101 -5
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +110 -35
- package/dist/radio-group.js +1 -1
- package/dist/sandboxed-on-click.d.ts +2 -2
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +495 -0
- package/dist/scatter-plot.js +1 -0
- package/dist/select-0z7HVS6r.d.ts +579 -0
- package/dist/select-BCHWvmyC.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +225 -298
- package/dist/selectable-list.js +1 -1
- package/dist/separator-B5UmkVRL.d.ts +75 -0
- package/dist/separator-bpE_kooz.js +1 -0
- package/dist/separator.d.ts +1 -52
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +285 -38
- package/dist/sheet.js +1 -1
- package/dist/skeleton-CsbUHbBA.js +1 -0
- package/dist/skeleton.d.ts +4 -7
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +24 -4
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.js +1 -1
- package/dist/{index-Rv8RL7xy.d.ts → slot-BtwKJTLq.d.ts} +1 -1
- package/dist/slot-CDk0Bb9z.js +1 -0
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +14 -14
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +10 -7
- package/dist/switch.js +1 -1
- package/dist/table-Bo0vNxIJ.d.ts +848 -0
- package/dist/table-CGxJwtbL.js +1 -0
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +124 -25
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +2 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-C26-Xolp.js +1 -0
- package/dist/theme-switcher.d.ts +105 -33
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +54 -15
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +86 -10
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +50 -5
- package/dist/tooltip.js +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/well.d.ts +3 -3
- package/dist/well.js +1 -1
- package/package.json +9 -3
- package/dist/anchor-C_tjSVy6.js +0 -1
- package/dist/as-child-CYEVu1WY.d.ts +0 -23
- package/dist/button-5t6-JS_I.js +0 -1
- package/dist/button-ClC60Nzg.js +0 -1
- package/dist/checkbox-DJ2xl7Rc.js +0 -1
- package/dist/choice-DOdyNzFC.js +0 -1
- package/dist/compose-refs-Cjf2gfB8.js +0 -1
- package/dist/dialog-vxLIvB8M.js +0 -1
- package/dist/dropdown-menu-Bt1aKF1g.js +0 -1
- package/dist/field-context-BR01g789.js +0 -1
- package/dist/icon-CDtYjF_H.js +0 -1
- package/dist/icon-button-DV2-GZHf.js +0 -1
- package/dist/index-g2rfwNCH.d.ts +0 -1
- package/dist/input-Ct1YOqSy.js +0 -1
- package/dist/label-BMlHW_2D.js +0 -1
- package/dist/popover-D5WxxnBY.js +0 -1
- package/dist/primitive-C64-m48O.d.ts +0 -13
- package/dist/primitive-IKruV2iB.js +0 -1
- package/dist/select-Bwt2YduR.d.ts +0 -345
- package/dist/select-D-5u0Blc.js +0 -1
- package/dist/separator-kBnnv3Cw.js +0 -1
- package/dist/skeleton-Bu3tgNcW.js +0 -1
- package/dist/slot-DmPrjM7N.js +0 -1
- package/dist/svg-only-DDx6FtJd.js +0 -1
- package/dist/table-CPH2md2-.js +0 -1
- package/dist/table-CwFHXC-G.d.ts +0 -414
- package/dist/theme-D3MDng6U.js +0 -1
- package/dist/theme-provider-C9zpDyJW.js +0 -1
- package/dist/toast-BsCjaMVS.js +0 -1
- package/dist/virtual-DZMBu7Ch.js +0 -1
- /package/dist/{sizes-BCoI4bhP.d.ts → button-BCoI4bhP.d.ts} +0 -0
- /package/dist/{intents-DdSKSj1c.d.ts → button-DdSKSj1c.d.ts} +0 -0
- /package/dist/{resolve-pre-rendered-props-B6OlZrSI.d.ts → code-block-B6OlZrSI.d.ts} +0 -0
- /package/dist/{resolve-pre-rendered-props-C9uaM9-V.js → code-block-C9uaM9-V.js} +0 -0
- /package/dist/{validation-7QeiTFwl.d.ts → field-7QeiTFwl.d.ts} +0 -0
- /package/dist/{validation-Bpptk_9t.js → field-Bpptk_9t.js} +0 -0
- /package/dist/{types-D1RY5Tcj.d.ts → icon-D1RY5Tcj.d.ts} +0 -0
- /package/dist/{is-input-CXmS0OFN.js → input-CXmS0OFN.js} +0 -0
- /package/dist/{themes-CYNpplwN.d.ts → theme-CYNpplwN.d.ts} +0 -0
package/dist/pagination.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ButtonGroup } from "./
|
|
3
|
-
import { t as Select } from "./select-
|
|
1
|
+
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
+
import { t as ButtonGroup } from "./button-C-gMbPso.js";
|
|
3
|
+
import { t as Select } from "./select-0z7HVS6r.js";
|
|
4
4
|
import { ComponentProps } from "react";
|
|
5
5
|
//#region src/components/pagination/cursor-pagination.d.ts
|
|
6
6
|
type CursorPaginationProps = ComponentProps<"div"> & {
|
|
@@ -9,6 +9,31 @@ type CursorPaginationProps = ComponentProps<"div"> & {
|
|
|
9
9
|
*/
|
|
10
10
|
defaultPageSize: number;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* A pagination component for use with cursor-based pagination.
|
|
14
|
+
*
|
|
15
|
+
* Cursor-based pagination is a way of loading data in chunks by using a cursor
|
|
16
|
+
* from the last item on the current page to know where to start the next set,
|
|
17
|
+
* making sure nothing is missed or repeated. Like a linked list, but for chunks
|
|
18
|
+
* of data. It doesn't let you jump to a specific page or know how many total pages
|
|
19
|
+
* there are, but it's more efficient for large or real-time data sets.
|
|
20
|
+
*
|
|
21
|
+
* @see https://mantle.ngrok.com/components/navigation/pagination#cursorpaginationroot
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <CursorPagination defaultPageSize={10}>
|
|
26
|
+
* <CursorPagination.Buttons
|
|
27
|
+
* hasNextPage={hasNext}
|
|
28
|
+
* hasPreviousPage={hasPrevious}
|
|
29
|
+
* onNextPage={handleNext}
|
|
30
|
+
* onPreviousPage={handlePrevious}
|
|
31
|
+
* />
|
|
32
|
+
* <CursorPagination.PageSizeSelect />
|
|
33
|
+
* </CursorPagination>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const Root: ({ className, children, defaultPageSize, ref, ...props }: CursorPaginationProps) => import("react").JSX.Element;
|
|
12
37
|
type CursorButtonsProps = Omit<ComponentProps<typeof ButtonGroup>, "appearance"> & {
|
|
13
38
|
/**
|
|
14
39
|
* Whether there is a next page of data to load.
|
|
@@ -27,6 +52,22 @@ type CursorButtonsProps = Omit<ComponentProps<typeof ButtonGroup>, "appearance">
|
|
|
27
52
|
*/
|
|
28
53
|
onPreviousPage?: () => void;
|
|
29
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* A pair of buttons for navigating between pages of data when using cursor-based pagination.
|
|
57
|
+
*
|
|
58
|
+
* @see https://mantle.ngrok.com/components/navigation/pagination#cursorpaginationbuttons
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <CursorPagination.Buttons
|
|
63
|
+
* hasNextPage={hasNext}
|
|
64
|
+
* hasPreviousPage={hasPrevious}
|
|
65
|
+
* onNextPage={() => loadNextPage()}
|
|
66
|
+
* onPreviousPage={() => loadPreviousPage()}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare const Buttons: ({ hasNextPage, hasPreviousPage, onNextPage, onPreviousPage, ref, ...props }: CursorButtonsProps) => import("react").JSX.Element;
|
|
30
71
|
declare const defaultPageSizes: readonly [5, 10, 20, 50, 100];
|
|
31
72
|
type CursorPageSizeSelectProps = Omit<ComponentProps<typeof Select.Trigger>, "children"> & {
|
|
32
73
|
/**
|
|
@@ -38,6 +79,20 @@ type CursorPageSizeSelectProps = Omit<ComponentProps<typeof Select.Trigger>, "ch
|
|
|
38
79
|
*/
|
|
39
80
|
onChangePageSize?: (value: number) => void;
|
|
40
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* A select input for changing the number of items per page when using cursor-based pagination.
|
|
84
|
+
*
|
|
85
|
+
* @see https://mantle.ngrok.com/components/navigation/pagination#cursorpaginationpagesizeselect
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* <CursorPagination.PageSizeSelect
|
|
90
|
+
* pageSizes={[10, 20, 50, 100]}
|
|
91
|
+
* onChangePageSize={(size) => console.log('Page size changed to:', size)}
|
|
92
|
+
* />
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
declare const PageSizeSelect: ({ className, pageSizes, onChangePageSize, ref, ...rest }: CursorPageSizeSelectProps) => import("react").JSX.Element;
|
|
41
96
|
type CursorPageSizeValueProps = Omit<ComponentProps<"span">, "children"> & WithAsChild;
|
|
42
97
|
/**
|
|
43
98
|
* Displays the current page size when using cursor-based pagination as a read-only value.
|
|
@@ -105,7 +160,7 @@ declare const CursorPagination: {
|
|
|
105
160
|
* </CursorPagination.Root>
|
|
106
161
|
* ```
|
|
107
162
|
*/
|
|
108
|
-
readonly Root:
|
|
163
|
+
readonly Root: typeof Root;
|
|
109
164
|
/**
|
|
110
165
|
* A pair of buttons for navigating between pages of data when using cursor-based pagination.
|
|
111
166
|
*
|
|
@@ -121,7 +176,7 @@ declare const CursorPagination: {
|
|
|
121
176
|
* />
|
|
122
177
|
* ```
|
|
123
178
|
*/
|
|
124
|
-
readonly Buttons:
|
|
179
|
+
readonly Buttons: typeof Buttons;
|
|
125
180
|
/**
|
|
126
181
|
* A select input for changing the number of items per page when using cursor-based pagination.
|
|
127
182
|
*
|
|
@@ -135,7 +190,7 @@ declare const CursorPagination: {
|
|
|
135
190
|
* />
|
|
136
191
|
* ```
|
|
137
192
|
*/
|
|
138
|
-
readonly PageSizeSelect:
|
|
193
|
+
readonly PageSizeSelect: typeof PageSizeSelect;
|
|
139
194
|
/**
|
|
140
195
|
* Displays the current page size when using cursor-based pagination as a read-only value.
|
|
141
196
|
*
|
package/dist/pagination.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CDk0Bb9z.js";import{t as n}from"./button-BAno7KIU.js";import{t as r}from"./button-D9n09xUg.js";import{n as i}from"./separator-bpE_kooz.js";import{t as a}from"./select-BCHWvmyC.js";import{createContext as o,useContext as s,useEffect as c,useMemo as l,useState as u}from"react";import d from"tiny-invariant";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{CaretRightIcon as m}from"@phosphor-icons/react/CaretRight";import{CaretLeftIcon as h}from"@phosphor-icons/react/CaretLeft";const g=o(void 0),_=({className:t,children:n,defaultPageSize:r,ref:i,...a})=>{let[o,s]=u(r),c=l(()=>({defaultPageSize:r,pageSize:o,setPageSize:s}),[r,o]);return f(g.Provider,{value:c,children:f(`div`,{"data-slot":`cursor-pagination`,className:e(`inline-flex items-center justify-between gap-2`,t),ref:i,...a,children:n})})},v=({hasNextPage:e,hasPreviousPage:t,onNextPage:a,onPreviousPage:o,ref:s,...c})=>p(r,{"data-slot":`cursor-pagination-buttons`,appearance:`panel`,ref:s,...c,children:[f(n,{"data-slot":`cursor-pagination-previous`,appearance:`ghost`,disabled:!t,icon:f(h,{}),intent:`neutral`,label:`Previous page`,onClick:o,size:`sm`,type:`button`}),f(i,{"data-slot":`cursor-pagination-separator`,orientation:`vertical`,className:`min-h-5`}),f(n,{"data-slot":`cursor-pagination-next`,appearance:`ghost`,disabled:!e,icon:f(m,{}),intent:`neutral`,label:`Next page`,onClick:a,size:`sm`,type:`button`})]}),y=[5,10,20,50,100],b=({className:t,pageSizes:n=y,onChangePageSize:r,ref:i,...o})=>{let c=s(g);return d(c,`CursorPageSizeSelect must be used as a child of a CursorPagination component`),d(n.includes(c.defaultPageSize),`CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes`),d(n.includes(c.pageSize),`CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes`),p(a.Root,{defaultValue:`${c.pageSize}`,onValueChange:e=>{let t=Number.parseInt(e,10);Number.isNaN(t)&&(t=c.defaultPageSize),c.setPageSize(t),r?.(t)},children:[f(a.Trigger,{ref:i,"data-slot":`cursor-pagination-page-size-select`,className:e(`w-auto min-w-36`,t),value:c.pageSize,...o,children:f(a.Value,{})}),f(a.Content,{width:`trigger`,children:n.map(e=>p(a.Item,{value:`${e}`,children:[e,` per page`]},e))})]})};function x({asChild:n=!1,className:r,...i}){let a=s(g);return d(a,`CursorPageSizeValue must be used as a child of a CursorPagination component`),p(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`]})}const S={Root:_,Buttons:v,PageSizeSelect:b,PageSizeValue:x};function C({listSize:e,pageSize:t}){let[n,r]=u(1),[i,a]=u(t);c(()=>{a(t),r(1)},[t]),c(()=>{r(1)},[e]);let o=Math.ceil(e/i),s=(n-1)*i,l=n>1,d=n<o;function f(e){r(Math.max(1,Math.min(e,o)))}function p(){d&&r(e=>Math.min(e+1,o))}function m(){l&&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:d,hasPreviousPage:l,nextPage:p,offset:s,pageSize:i,previousPage:m,setPageSize:h,totalPages:o}}function w(e,t){return e.slice(t.offset,t.offset+t.pageSize)}export{S as CursorPagination,w as getOffsetPaginatedSlice,C as useOffsetPagination};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
//#region src/components/popover/popover.d.ts
|
|
4
|
+
type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
5
|
+
/**
|
|
6
|
+
* The preferred width of the `PopoverContent` as a tailwind `max-w-` class.
|
|
7
|
+
*
|
|
8
|
+
* By default, a `Popover`'s content width is responsive with a default
|
|
9
|
+
* preferred width: the maximum width of the `PopoverContent`
|
|
10
|
+
*
|
|
11
|
+
* @default `max-w-72`
|
|
12
|
+
*/
|
|
13
|
+
preferredWidth?: `max-w-${string}`;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The content to render inside the popover.
|
|
17
|
+
*
|
|
18
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
19
|
+
* z-index. When multiple shared layers are open, the most recently mounted
|
|
20
|
+
* layer renders on top.
|
|
21
|
+
*
|
|
22
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popovercontent
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Popover.Root>
|
|
27
|
+
* <Popover.Trigger asChild>
|
|
28
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
29
|
+
* Open Popover
|
|
30
|
+
* </Button>
|
|
31
|
+
* </Popover.Trigger>
|
|
32
|
+
* <Popover.Content>
|
|
33
|
+
* <p>This is the popover content.</p>
|
|
34
|
+
* </Popover.Content>
|
|
35
|
+
* </Popover.Root>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare const Content: ({ align, className, onClick, preferredWidth, ref, sideOffset, ...props }: PopoverContentProps) => import("react").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* A floating overlay that displays rich content in a portal, triggered by a button.
|
|
41
|
+
*
|
|
42
|
+
* Use `Popover` for INTERACTIVE overlay content — small forms, settings
|
|
43
|
+
* menus, color pickers, action lists. The user opens it deliberately
|
|
44
|
+
* (click/tap or focus + space). For short, non-interactive label hints
|
|
45
|
+
* triggered by hover, use `Tooltip` instead. For non-essential preview
|
|
46
|
+
* content shown on hover, use `HoverCard`.
|
|
47
|
+
*
|
|
48
|
+
* `Popover` is a non-modal dialog by default: focus moves into the content
|
|
49
|
+
* when it opens, `Escape` closes and returns focus to the trigger, clicking
|
|
50
|
+
* outside dismisses, and the page (body and any scroll containers) continues
|
|
51
|
+
* to scroll normally. Pass `modal` on `Popover.Root` to trap focus inside
|
|
52
|
+
* the content, block interaction with the rest of the page, and lock body
|
|
53
|
+
* scroll while the popover is open.
|
|
54
|
+
*
|
|
55
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
56
|
+
* z-index. When multiple shared layers are open, the most recently mounted
|
|
57
|
+
* layer renders on top.
|
|
58
|
+
*
|
|
59
|
+
* @see https://mantle.ngrok.com/components/overlays/popover
|
|
60
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* Composition:
|
|
64
|
+
* ```
|
|
65
|
+
* Popover.Root
|
|
66
|
+
* ├── Popover.Trigger
|
|
67
|
+
* ├── Popover.Anchor
|
|
68
|
+
* └── Popover.Content
|
|
69
|
+
* └── Popover.Close
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <Popover.Root>
|
|
75
|
+
* <Popover.Trigger asChild>
|
|
76
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
77
|
+
* Open Popover
|
|
78
|
+
* </Button>
|
|
79
|
+
* </Popover.Trigger>
|
|
80
|
+
* <Popover.Content>
|
|
81
|
+
* <p>This is the popover content.</p>
|
|
82
|
+
* </Popover.Content>
|
|
83
|
+
* </Popover.Root>
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
declare const Popover: {
|
|
87
|
+
/**
|
|
88
|
+
* The root, stateful component that manages the open/closed state of the popover.
|
|
89
|
+
*
|
|
90
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
91
|
+
* z-index. When multiple shared layers are open, the most recently mounted
|
|
92
|
+
* layer renders on top.
|
|
93
|
+
*
|
|
94
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popoverroot
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx
|
|
98
|
+
* <Popover.Root>
|
|
99
|
+
* <Popover.Trigger asChild>
|
|
100
|
+
* <Button type="button" appearance="outlined" intent="neutral">Open popover</Button>
|
|
101
|
+
* </Popover.Trigger>
|
|
102
|
+
* <Popover.Content>
|
|
103
|
+
* <p>This is the popover content.</p>
|
|
104
|
+
* </Popover.Content>
|
|
105
|
+
* </Popover.Root>
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
readonly Root: import("react").FC<PopoverPrimitive.PopoverProps>;
|
|
109
|
+
/**
|
|
110
|
+
* An optional element to position the PopoverContent against. If not used, content positions alongside the trigger.
|
|
111
|
+
*
|
|
112
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popoveranchor
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```tsx
|
|
116
|
+
* <Popover.Root>
|
|
117
|
+
* <Popover.Anchor asChild>
|
|
118
|
+
* <div>Position relative to this element</div>
|
|
119
|
+
* </Popover.Anchor>
|
|
120
|
+
* <Popover.Trigger asChild>
|
|
121
|
+
* <Button type="button" appearance="outlined" intent="neutral">Open Popover</Button>
|
|
122
|
+
* </Popover.Trigger>
|
|
123
|
+
* <Popover.Content>
|
|
124
|
+
* <p>This popover is positioned relative to the anchor.</p>
|
|
125
|
+
* <Popover.Close asChild>
|
|
126
|
+
* <Button type="button" appearance="outlined" intent="neutral">Close</Button>
|
|
127
|
+
* </Popover.Close>
|
|
128
|
+
* </Popover.Content>
|
|
129
|
+
* </Popover.Root>
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
readonly Anchor: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
133
|
+
/**
|
|
134
|
+
* A button that closes an open popover. Can be placed anywhere within the popover content.
|
|
135
|
+
*
|
|
136
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popoverclose
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```tsx
|
|
140
|
+
* <Popover.Root>
|
|
141
|
+
* <Popover.Trigger asChild>
|
|
142
|
+
* <Button type="button" appearance="outlined" intent="neutral">Settings</Button>
|
|
143
|
+
* </Popover.Trigger>
|
|
144
|
+
* <Popover.Content>
|
|
145
|
+
* <div className="flex items-center justify-between">
|
|
146
|
+
* <Text>Settings Panel</Text>
|
|
147
|
+
* <Popover.Close asChild>
|
|
148
|
+
* <IconButton type="button" appearance="ghost" intent="neutral" size="sm" label="Close" icon={<XIcon />} />
|
|
149
|
+
* </Popover.Close>
|
|
150
|
+
* </div>
|
|
151
|
+
* <Text>Configure your preferences here.</Text>
|
|
152
|
+
* </Popover.Content>
|
|
153
|
+
* </Popover.Root>
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
readonly Close: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
157
|
+
/**
|
|
158
|
+
* The content to render inside the popover. Appears in a portal with rich styling and animations.
|
|
159
|
+
*
|
|
160
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
161
|
+
* z-index. When multiple shared layers are open, the most recently mounted
|
|
162
|
+
* layer renders on top.
|
|
163
|
+
*
|
|
164
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popovercontent
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* <Popover.Root>
|
|
169
|
+
* <Popover.Trigger asChild>
|
|
170
|
+
* <Button type="button" appearance="outlined" intent="neutral">Show Info</Button>
|
|
171
|
+
* </Popover.Trigger>
|
|
172
|
+
* <Popover.Content side="top" align="center">
|
|
173
|
+
* <div className="space-y-2">
|
|
174
|
+
* <Text weight="strong">Additional Information</Text>
|
|
175
|
+
* <Text>This is the content inside the popover.</Text>
|
|
176
|
+
* <Button type="button" appearance="filled" intent="neutral" size="sm">Action</Button>
|
|
177
|
+
* </div>
|
|
178
|
+
* </Popover.Content>
|
|
179
|
+
* </Popover.Root>
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
readonly Content: typeof Content;
|
|
183
|
+
/**
|
|
184
|
+
* The trigger button that opens the popover when clicked or focused.
|
|
185
|
+
*
|
|
186
|
+
* @see https://mantle.ngrok.com/components/overlays/popover#popovertrigger
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```tsx
|
|
190
|
+
* <Popover.Root>
|
|
191
|
+
* <Popover.Trigger asChild>
|
|
192
|
+
* <Button type="button" appearance="outlined" intent="neutral">
|
|
193
|
+
* Options
|
|
194
|
+
* </Button>
|
|
195
|
+
* </Popover.Trigger>
|
|
196
|
+
* <Popover.Content>
|
|
197
|
+
* <div className="space-y-2">
|
|
198
|
+
* <Button type="button" appearance="ghost" intent="neutral">Edit</Button>
|
|
199
|
+
* <Button type="button" appearance="ghost" intent="danger">Delete</Button>
|
|
200
|
+
* </div>
|
|
201
|
+
* </Popover.Content>
|
|
202
|
+
* </Popover.Root>
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
readonly Trigger: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
206
|
+
};
|
|
207
|
+
//#endregion
|
|
208
|
+
export { Popover as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t}from"react/jsx-runtime";import*as n from"@radix-ui/react-popover";const r=n.Root,i=n.Trigger,a={Root:r,Anchor:n.Anchor,Close:n.Close,Content:({align:r=`center`,className:i,onClick:a,preferredWidth:o=`max-w-72`,ref:s,sideOffset:c=4,...l})=>t(n.Portal,{children:t(n.Content,{align:r,"data-slot":`popover-content`,className:e(`text-popover-foreground border-popover bg-popover 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 z-50 rounded-md border p-4 shadow-md outline-hidden`,o,i),onClick:e=>{e.stopPropagation(),a?.(e)},ref:s,sideOffset:c,...l})}),Trigger:i};export{a as t};
|
package/dist/popover.d.ts
CHANGED
|
@@ -1,182 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/components/popover/popover.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* A floating overlay that displays rich content in a portal, triggered by a button.
|
|
5
|
-
*
|
|
6
|
-
* Use `Popover` for INTERACTIVE overlay content — small forms, settings
|
|
7
|
-
* menus, color pickers, action lists. The user opens it deliberately
|
|
8
|
-
* (click/tap or focus + space). For short, non-interactive label hints
|
|
9
|
-
* triggered by hover, use `Tooltip` instead. For non-essential preview
|
|
10
|
-
* content shown on hover, use `HoverCard`.
|
|
11
|
-
*
|
|
12
|
-
* `Popover` is a non-modal dialog by default: focus moves into the content
|
|
13
|
-
* when it opens, `Escape` closes and returns focus to the trigger, clicking
|
|
14
|
-
* outside dismisses, and the page (body and any scroll containers) continues
|
|
15
|
-
* to scroll normally. Pass `modal` on `Popover.Root` to trap focus inside
|
|
16
|
-
* the content, block interaction with the rest of the page, and lock body
|
|
17
|
-
* scroll while the popover is open.
|
|
18
|
-
*
|
|
19
|
-
* `Popover.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
20
|
-
* z-index. When multiple shared layers are open, the most recently mounted
|
|
21
|
-
* layer renders on top.
|
|
22
|
-
*
|
|
23
|
-
* @see https://mantle.ngrok.com/components/overlays/popover
|
|
24
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* Composition:
|
|
28
|
-
* ```
|
|
29
|
-
* Popover.Root
|
|
30
|
-
* ├── Popover.Trigger
|
|
31
|
-
* ├── Popover.Anchor
|
|
32
|
-
* └── Popover.Content
|
|
33
|
-
* └── Popover.Close
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* <Popover.Root>
|
|
39
|
-
* <Popover.Trigger asChild>
|
|
40
|
-
* <Button type="button" appearance="outlined" intent="neutral">
|
|
41
|
-
* Open Popover
|
|
42
|
-
* </Button>
|
|
43
|
-
* </Popover.Trigger>
|
|
44
|
-
* <Popover.Content>
|
|
45
|
-
* <p>This is the popover content.</p>
|
|
46
|
-
* </Popover.Content>
|
|
47
|
-
* </Popover.Root>
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
declare const Popover: {
|
|
51
|
-
/**
|
|
52
|
-
* The root, stateful component that manages the open/closed state of the popover.
|
|
53
|
-
*
|
|
54
|
-
* `Popover.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
55
|
-
* z-index. When multiple shared layers are open, the most recently mounted
|
|
56
|
-
* layer renders on top.
|
|
57
|
-
*
|
|
58
|
-
* @see https://mantle.ngrok.com/components/overlays/popover#popoverroot
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```tsx
|
|
62
|
-
* <Popover.Root>
|
|
63
|
-
* <Popover.Trigger asChild>
|
|
64
|
-
* <Button type="button" appearance="outlined" intent="neutral">Open popover</Button>
|
|
65
|
-
* </Popover.Trigger>
|
|
66
|
-
* <Popover.Content>
|
|
67
|
-
* <p>This is the popover content.</p>
|
|
68
|
-
* </Popover.Content>
|
|
69
|
-
* </Popover.Root>
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
readonly Root: import("react").FC<PopoverPrimitive.PopoverProps>;
|
|
73
|
-
/**
|
|
74
|
-
* An optional element to position the PopoverContent against. If not used, content positions alongside the trigger.
|
|
75
|
-
*
|
|
76
|
-
* @see https://mantle.ngrok.com/components/overlays/popover#popoveranchor
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```tsx
|
|
80
|
-
* <Popover.Root>
|
|
81
|
-
* <Popover.Anchor asChild>
|
|
82
|
-
* <div>Position relative to this element</div>
|
|
83
|
-
* </Popover.Anchor>
|
|
84
|
-
* <Popover.Trigger asChild>
|
|
85
|
-
* <Button type="button" appearance="outlined" intent="neutral">Open Popover</Button>
|
|
86
|
-
* </Popover.Trigger>
|
|
87
|
-
* <Popover.Content>
|
|
88
|
-
* <p>This popover is positioned relative to the anchor.</p>
|
|
89
|
-
* <Popover.Close asChild>
|
|
90
|
-
* <Button type="button" appearance="outlined" intent="neutral">Close</Button>
|
|
91
|
-
* </Popover.Close>
|
|
92
|
-
* </Popover.Content>
|
|
93
|
-
* </Popover.Root>
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
readonly Anchor: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
97
|
-
/**
|
|
98
|
-
* A button that closes an open popover. Can be placed anywhere within the popover content.
|
|
99
|
-
*
|
|
100
|
-
* @see https://mantle.ngrok.com/components/overlays/popover#popoverclose
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```tsx
|
|
104
|
-
* <Popover.Root>
|
|
105
|
-
* <Popover.Trigger asChild>
|
|
106
|
-
* <Button type="button" appearance="outlined" intent="neutral">Settings</Button>
|
|
107
|
-
* </Popover.Trigger>
|
|
108
|
-
* <Popover.Content>
|
|
109
|
-
* <div className="flex items-center justify-between">
|
|
110
|
-
* <Text>Settings Panel</Text>
|
|
111
|
-
* <Popover.Close asChild>
|
|
112
|
-
* <IconButton type="button" appearance="ghost" intent="neutral" size="sm" label="Close" icon={<XIcon />} />
|
|
113
|
-
* </Popover.Close>
|
|
114
|
-
* </div>
|
|
115
|
-
* <Text>Configure your preferences here.</Text>
|
|
116
|
-
* </Popover.Content>
|
|
117
|
-
* </Popover.Root>
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
readonly Close: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
121
|
-
/**
|
|
122
|
-
* The content to render inside the popover. Appears in a portal with rich styling and animations.
|
|
123
|
-
*
|
|
124
|
-
* `Popover.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
125
|
-
* z-index. When multiple shared layers are open, the most recently mounted
|
|
126
|
-
* layer renders on top.
|
|
127
|
-
*
|
|
128
|
-
* @see https://mantle.ngrok.com/components/overlays/popover#popovercontent
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```tsx
|
|
132
|
-
* <Popover.Root>
|
|
133
|
-
* <Popover.Trigger asChild>
|
|
134
|
-
* <Button type="button" appearance="outlined" intent="neutral">Show Info</Button>
|
|
135
|
-
* </Popover.Trigger>
|
|
136
|
-
* <Popover.Content side="top" align="center">
|
|
137
|
-
* <div className="space-y-2">
|
|
138
|
-
* <Text weight="strong">Additional Information</Text>
|
|
139
|
-
* <Text>This is the content inside the popover.</Text>
|
|
140
|
-
* <Button type="button" appearance="filled" intent="neutral" size="sm">Action</Button>
|
|
141
|
-
* </div>
|
|
142
|
-
* </Popover.Content>
|
|
143
|
-
* </Popover.Root>
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
readonly Content: import("react").ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
147
|
-
/**
|
|
148
|
-
* The preferred width of the `PopoverContent` as a tailwind `max-w-` class.
|
|
149
|
-
*
|
|
150
|
-
* By default, a `Popover`'s content width is responsive with a default
|
|
151
|
-
* preferred width: the maximum width of the `PopoverContent`
|
|
152
|
-
*
|
|
153
|
-
* @default `max-w-72`
|
|
154
|
-
*/
|
|
155
|
-
preferredWidth?: `max-w-${string}`;
|
|
156
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
157
|
-
/**
|
|
158
|
-
* The trigger button that opens the popover when clicked or focused.
|
|
159
|
-
*
|
|
160
|
-
* @see https://mantle.ngrok.com/components/overlays/popover#popovertrigger
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```tsx
|
|
164
|
-
* <Popover.Root>
|
|
165
|
-
* <Popover.Trigger asChild>
|
|
166
|
-
* <Button type="button" appearance="outlined" intent="neutral">
|
|
167
|
-
* Options
|
|
168
|
-
* </Button>
|
|
169
|
-
* </Popover.Trigger>
|
|
170
|
-
* <Popover.Content>
|
|
171
|
-
* <div className="space-y-2">
|
|
172
|
-
* <Button type="button" appearance="ghost" intent="neutral">Edit</Button>
|
|
173
|
-
* <Button type="button" appearance="ghost" intent="danger">Delete</Button>
|
|
174
|
-
* </div>
|
|
175
|
-
* </Popover.Content>
|
|
176
|
-
* </Popover.Root>
|
|
177
|
-
* ```
|
|
178
|
-
*/
|
|
179
|
-
readonly Trigger: import("react").ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
180
|
-
};
|
|
181
|
-
//#endregion
|
|
1
|
+
import { t as Popover } from "./popover-CE4OlWkd.js";
|
|
182
2
|
export { Popover };
|
package/dist/popover.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./popover-
|
|
1
|
+
import{t as e}from"./popover-CQ9s7jG5.js";export{e as Popover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./slot-CDk0Bb9z.js";import{t}from"./booleanish-BfvnW6vy.js";import{createContext as n,useContext as r,useEffect as i,useMemo as a,useState as o}from"react";import{jsx as s}from"react/jsx-runtime";import*as c from"@radix-ui/react-dialog";function l(e){e.target instanceof Element&&e.target.closest(`.overlay-prompt`)&&e.preventDefault()}const u=n({hasDescription:!1,setHasDescription:()=>{}});function d(e){let[t,n]=o(!1),r=a(()=>({hasDescription:t,setHasDescription:n}),[t]);return s(u.Provider,{value:r,children:s(c.Root,{...e})})}const f=c.Trigger,p=c.Portal,m=c.Close,h=e=>s(c.Overlay,{"data-overlay":!0,...e}),g=({onEscapeKeyDown:e,onInteractOutside:t,onPointerDownOutside:n,ref:i,...a})=>{let o=r(u);return s(c.Content,{ref:i,onEscapeKeyDown:t=>{b(t),e?.(t)},onInteractOutside:e=>{l(e),t?.(e)},onPointerDownOutside:e=>{l(e),n?.(e)},...o.hasDescription?{}:{"aria-describedby":void 0},...a})},_=c.Title,v=({asChild:t,children:n,ref:a,...o})=>{let l=r(u);i(()=>(l.setHasDescription(!0),()=>l.setHasDescription(!1)),[l]);let d=t?e:`div`;return s(c.Description,{ref:a,asChild:!0,children:s(d,{...o,children:n})})};function y(e){return e instanceof HTMLElement&&e.hasAttribute(`data-overlay`)}function b(e){if(!w(e.currentTarget))return;let n=e.currentTarget,r=n instanceof Document?n.activeElement:n.ownerDocument?.activeElement??null,i=x(e.target)??x(r),a=i?S(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 x(e){return C(e)?e.closest(`[aria-expanded='true'][aria-controls]`):null}function S(e){let t=e.getAttribute(`aria-controls`);if(!t)return null;let n=e.ownerDocument.getElementById(t);return n instanceof HTMLElement?n:null}function C(e){return e instanceof HTMLElement}function w(e){return e instanceof Node&&`querySelector`in e}export{p as a,f as c,h as i,y as l,g as n,d as o,v as r,_ as s,m as t};
|
package/dist/progress.d.ts
CHANGED
|
@@ -62,10 +62,7 @@ type Props = SvgAttributes & {
|
|
|
62
62
|
* </ProgressDonut.Root>
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
|
-
declare const Root$1: {
|
|
66
|
-
({ children, className, max: _max, strokeWidth: _strokeWidth, value: _value, indeterminateRotationSpeed, ...props }: Props): import("react").JSX.Element;
|
|
67
|
-
displayName: string;
|
|
68
|
-
};
|
|
65
|
+
declare const Root$1: ({ children, className, max: _max, strokeWidth: _strokeWidth, value: _value, indeterminateRotationSpeed, ...props }: Props) => import("react").JSX.Element;
|
|
69
66
|
type ProgressDonutIndicatorProps = Omit<ComponentProps<"g">, "children">;
|
|
70
67
|
/**
|
|
71
68
|
* The indicator for the circular progress bar.
|
|
@@ -83,10 +80,7 @@ type ProgressDonutIndicatorProps = Omit<ComponentProps<"g">, "children">;
|
|
|
83
80
|
* </ProgressDonut.Root>
|
|
84
81
|
* ```
|
|
85
82
|
*/
|
|
86
|
-
declare const Indicator$1: {
|
|
87
|
-
({ className, ...props }: ProgressDonutIndicatorProps): import("react").JSX.Element;
|
|
88
|
-
displayName: string;
|
|
89
|
-
};
|
|
83
|
+
declare const Indicator$1: ({ className, ...props }: ProgressDonutIndicatorProps) => import("react").JSX.Element;
|
|
90
84
|
/**
|
|
91
85
|
* A simple circular progress bar which shows the completion progress of a task.
|
|
92
86
|
*
|
package/dist/progress.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./types-D85fCNV3.js";import{t as n}from"./clsx-DUGZgXfJ.js";import{createContext as r,useContext as i,useId as a,useMemo as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import*as l from"@radix-ui/react-progress";function u(e,{min:t,max:n}){return Math.min(n,Math.max(t,e))}function d(e){return typeof e==`number`}function f(e,t){return d(e)&&!Number.isNaN(e)&&e<=t&&e>=0}function p(e){return d(e)&&!Number.isNaN(e)&&e>0}const m={max:100,strokeWidth:`0.25rem`,value:0},h=r(m),g=({children:n,className:r,max:i=100,strokeWidth:a=4,value:l,indeterminateRotationSpeed:u,...g})=>{let
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./types-D85fCNV3.js";import{t as n}from"./clsx-DUGZgXfJ.js";import{createContext as r,useContext as i,useId as a,useMemo as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import*as l from"@radix-ui/react-progress";function u(e,{min:t,max:n}){return Math.min(n,Math.max(t,e))}function d(e){return typeof e==`number`}function f(e,t){return d(e)&&!Number.isNaN(e)&&e<=t&&e>=0}function p(e){return d(e)&&!Number.isNaN(e)&&e>0}const m={max:100,strokeWidth:`0.25rem`,value:0},h=r(m),g={Root:({children:n,className:r,max:i=100,strokeWidth:a=4,value:l,indeterminateRotationSpeed:u,...g})=>{let y=p(i)?i:100,b=f(l,y)?l:l==null?0:`indeterminate`,x=_(a??m.strokeWidth),S=d(b)?b:void 0,C=v(x),w=o(()=>({max:y,strokeWidth:x,value:b}),[y,x,b]);return s(h.Provider,{value:w,children:c(`svg`,{"data-slot":`progress-donut`,"aria-valuemax":y,"aria-valuemin":0,"aria-valuenow":S,className:e(`size-6 text-gray-200 dark:text-gray-300`,b===`indeterminate`&&[`animate-spin`,u??`animation-duration-[15s]`],r),"data-max":y,"data-min":0,"data-value":S,height:`100%`,role:`progressbar`,width:`100%`,...g,children:[s(`circle`,{className:`[r:var(--radius)]`,cx:`50%`,cy:`50%`,fill:`transparent`,stroke:`currentColor`,strokeWidth:x,style:t({"--radius":C})}),n]})})},Indicator:({className:r,...o})=>{let l=a(),u=i(h)??m,d=(u.value===`indeterminate`?.6:u.value/u.max)*100,f=_(u.strokeWidth),p=v(f);return c(`g`,{"data-slot":`progress-donut-indicator`,className:e(`text-accent-600`,r),...o,children:[u.value===`indeterminate`&&s(`defs`,{children:c(`linearGradient`,{id:l,children:[s(`stop`,{className:`stop-opacity-100 stop-color-current`,offset:`0%`}),s(`stop`,{className:`stop-opacity-0 stop-color-current`,offset:`95%`})]})}),s(`circle`,{className:n(`[r:var(--radius)]`,`origin-center`),cx:`50%`,cy:`50%`,fill:`transparent`,pathLength:100,stroke:u.value===`indeterminate`?`url(#${l})`:`currentColor`,strokeDasharray:100,strokeDashoffset:100-d,strokeLinecap:`round`,strokeWidth:f,style:t({"--radius":p}),transform:`rotate(-90)`})]})}};function _(e){let t=4;return e==null?t:(t=typeof e==`number`?e:e.endsWith(`rem`)?Number(e.replace(`rem`,``))*16:Number(e),u(Number.isNaN(t)?4:t,{min:1,max:12}))}function v(e){return`calc(50% - ${e/2}px)`}const y=r({max:100,value:0});function b({className:t,children:n,max:r=100,value:i,...a}){let c=p(r)?r:100,u=f(i,c)?i:i==null?0:`indeterminate`,m=d(u)?u:void 0,h=o(()=>({max:c,value:u}),[c,u]);return s(y.Provider,{value:h,children:s(l.Root,{"data-slot":`progress-bar`,className:e(`bg-base-hover dark:bg-base shadow-inner relative h-3 w-full overflow-hidden rounded-md`,t),value:m,max:c,...a,children:n})})}function x({className:t,style:n,...r}){let a=i(y),{max:o}=a,c=(o-(a.value===`indeterminate`?0:a.value))/o*100;return s(l.Indicator,{"data-slot":`progress-bar-indicator`,className:e(`bg-accent-600 h-full w-full flex-1 transition-all`,t),style:{...n,transform:`translateX(-${c}%)`},...r})}const S={Root:b,Indicator:x};export{S as ProgressBar,g as ProgressDonut};
|