@ngrok/mantle 0.25.1 → 0.26.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.
@@ -1 +1,42 @@
1
+ import { HeaderContext } from '@tanstack/react-table';
1
2
  export * from '@tanstack/react-table';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { ComponentProps, ReactNode } from 'react';
5
+ import { S as SortingMode } from './direction-A0wepfUT.js';
6
+ import { TableHeader } from './table.js';
7
+
8
+ declare const sortDirections: readonly ["asc", "desc", "unsorted"];
9
+ type SortDirection = (typeof sortDirections)[number];
10
+ type DataTableColumnHeaderProps<TData, TValue> = ComponentProps<typeof TableHeader> & Pick<HeaderContext<TData, TValue>, "column"> & {
11
+ /**
12
+ * Use this to render a custom sort icon for the column if it is sortable
13
+ * and you want to override the default sort icon
14
+ */
15
+ sortIcon?: (sortDirection: SortDirection) => ReactNode;
16
+ /**
17
+ * The sorting mode of the column, whether it is alphanumeric or time based.
18
+ */
19
+ sortingMode: SortingMode;
20
+ };
21
+ /**
22
+ * The header for a column in a data table.
23
+ * If the column is sortable, clicking the header will toggle the sorting
24
+ * direction.
25
+ *
26
+ * @example
27
+ * ```md
28
+ * Each click cycles through...
29
+ *
30
+ * For alphanumeric sorting:
31
+ * unsorted ➡️ ascending ➡️ descending ➡️ unsorted ➡️ ...
32
+ *
33
+ * For time sorting:
34
+ * unsorted ➡️ newest-to-oldest ➡️ oldest-to-newest ➡️ unsorted ➡️ ...
35
+ *
36
+ * this is equivalent to the inverse of alphanumeric sorting, or
37
+ * unsorted ➡️ descending ➡️ ascending ➡️ unsorted ➡️ ...
38
+ * ```
39
+ */
40
+ declare function DataTableHeader<TData, TValue>({ children, className, column, sortIcon: propsSortIcon, sortingMode, ...props }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
41
+
42
+ export { DataTableHeader };
@@ -1,2 +1,2 @@
1
- export*from"@tanstack/react-table";
1
+ import{f as D}from"./chunk-QMAGKYIX.js";import{a as f}from"./chunk-FHW7SSNY.js";import{d as l}from"./chunk-GYPSB3OK.js";import{b as p}from"./chunk-J3NVDJIE.js";import"./chunk-4LSFAAZW.js";import"./chunk-3C5O3AQA.js";import"./chunk-72TJUKMV.js";import"./chunk-7O36LG52.js";import"./chunk-HDPLH5HC.js";import{a as u}from"./chunk-AZ56JGNY.js";export*from"@tanstack/react-table";import{jsx as s,jsxs as S}from"react/jsx-runtime";var V=[...l,"unsorted"];function m({children:t,className:o,column:e,sortIcon:i,sortingMode:r,...a}){let c=e.getIsSorted(),d=e.getCanSort(),n=d&&typeof c=="string"?c:"unsorted",g=i?.(n)??s(T,{mode:r,direction:n});return s(D,{className:u("px-0",o),...a,children:S(p,{className:"flex justify-start w-full h-full rounded-none",type:"button",appearance:"ghost",priority:"neutral",iconPlacement:"end","data-sort-direction":n,icon:g,onClick:()=>{d&&x(e,r)},children:[n!=="unsorted"&&S("span",{className:"sr-only",children:["Sorted in ",n==="asc"?"ascending":"descending"," ","order"]}),t]})})}function T({direction:t,mode:o,...e}){return t==="unsorted"?null:s(f,{mode:o,direction:t,...e})}function x(t,o){if(!t.getCanSort())return;let e=t.getIsSorted();switch(y(typeof e=="string"?e:"unsorted",o)){case"unsorted":t.clearSorting();return;case"asc":t.toggleSorting(!1);return;case"desc":t.toggleSorting(!0);return;default:return}}function y(t,o){return b(o==="alphanumeric"?["unsorted","asc","desc"]:["unsorted","desc","asc"],t)??"unsorted"}function b(t,o,e){let r=(t.findIndex(a=>a===o)+1)%t.length;return t.at(r)??e}export{m as DataTableHeader};
2
2
  //# sourceMappingURL=data-table.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/data-table/index.ts"],"sourcesContent":["export * from \"@tanstack/react-table\";\n"],"mappings":"AAAA,WAAc","names":[]}
1
+ {"version":3,"sources":["../src/components/data-table/index.ts","../src/components/data-table/data-table.tsx"],"sourcesContent":["export * from \"@tanstack/react-table\";\n\nexport {\n\t//,\n\tDataTableHeader,\n} from \"./data-table.js\";\n","import type { Column, HeaderContext } from \"@tanstack/react-table\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport {\n\ttype SortingMode,\n\tsortingDirections as baseSortingDirections,\n} from \"../../utils/sorting/direction.js\";\nimport { Button } from \"../button/button.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { Sort } from \"../icons/sort.js\";\nimport { TableHeader } from \"../table/table.js\";\n\nconst sortDirections = [...baseSortingDirections, \"unsorted\"] as const;\ntype SortDirection = (typeof sortDirections)[number];\n\ntype DataTableColumnHeaderProps<TData, TValue> = ComponentProps<\n\ttypeof TableHeader\n> &\n\tPick<HeaderContext<TData, TValue>, \"column\"> & {\n\t\t/**\n\t\t * Use this to render a custom sort icon for the column if it is sortable\n\t\t * and you want to override the default sort icon\n\t\t */\n\t\tsortIcon?: (sortDirection: SortDirection) => ReactNode;\n\t\t/**\n\t\t * The sorting mode of the column, whether it is alphanumeric or time based.\n\t\t */\n\t\tsortingMode: SortingMode;\n\t};\n\n/**\n * The header for a column in a data table.\n * If the column is sortable, clicking the header will toggle the sorting\n * direction.\n *\n * @example\n * ```md\n * Each click cycles through...\n *\n * For alphanumeric sorting:\n * unsorted ➡️ ascending ➡️ descending ➡️ unsorted ➡️ ...\n *\n * For time sorting:\n * unsorted ➡️ newest-to-oldest ➡️ oldest-to-newest ➡️ unsorted ➡️ ...\n *\n * this is equivalent to the inverse of alphanumeric sorting, or\n * unsorted ➡️ descending ➡️ ascending ➡️ unsorted ➡️ ...\n * ```\n */\nfunction DataTableHeader<TData, TValue>({\n\tchildren,\n\tclassName,\n\tcolumn,\n\tsortIcon: propsSortIcon,\n\tsortingMode,\n\t...props\n}: DataTableColumnHeaderProps<TData, TValue>) {\n\tconst _sortDirection = column.getIsSorted();\n\tconst canSort = column.getCanSort();\n\n\tconst sortDirection: SortDirection =\n\t\tcanSort && typeof _sortDirection === \"string\" ? _sortDirection : \"unsorted\";\n\n\tconst sortIcon = propsSortIcon?.(sortDirection) ?? (\n\t\t<DefaultSortIcon mode={sortingMode} direction={sortDirection} />\n\t);\n\n\treturn (\n\t\t<TableHeader className={cx(\"px-0\", className)} {...props}>\n\t\t\t<Button\n\t\t\t\tclassName=\"flex justify-start w-full h-full rounded-none\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tappearance=\"ghost\"\n\t\t\t\tpriority=\"neutral\"\n\t\t\t\ticonPlacement=\"end\"\n\t\t\t\tdata-sort-direction={sortDirection}\n\t\t\t\ticon={sortIcon}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tif (!canSort) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\ttoggleNextSortingDirection(column, sortingMode);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{sortDirection !== \"unsorted\" && (\n\t\t\t\t\t<span className=\"sr-only\">\n\t\t\t\t\t\tSorted in {sortDirection === \"asc\" ? \"ascending\" : \"descending\"}{\" \"}\n\t\t\t\t\t\torder\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</Button>\n\t\t</TableHeader>\n\t);\n}\n\nexport {\n\t//,\n\tDataTableHeader,\n};\n\ntype DefaultSortIconProps = SvgAttributes & {\n\tdirection: SortDirection;\n\tmode: SortingMode;\n};\n\nfunction DefaultSortIcon({ direction, mode, ...props }: DefaultSortIconProps) {\n\tif (direction === \"unsorted\") {\n\t\treturn null;\n\t}\n\n\treturn <Sort mode={mode} direction={direction} {...props} />;\n}\n\n/**\n * Toggle the sorting direction of a column.\n * This ordering is typically toggled by clicking the column header.\n *\n * @example\n * ```md\n * Each click cycles through...\n *\n * For alphanumeric sorting:\n * unsorted ➡️ ascending ➡️ descending ➡️ unsorted ➡️ ...\n *\n * For time sorting:\n * unsorted ➡️ newest-to-oldest ➡️ oldest-to-newest ➡️ unsorted ➡️ ...\n *\n * this is equivalent to the inverse of alphanumeric sorting, or\n * unsorted ➡️ descending ➡️ ascending ➡️ unsorted ➡️ ...\n * ```\n */\nfunction toggleNextSortingDirection<TData, TValue>(\n\tcolumn: Column<TData, TValue>,\n\tsortingMode: SortingMode,\n) {\n\tif (!column.getCanSort()) {\n\t\treturn;\n\t}\n\n\tconst _sortDirection = column.getIsSorted();\n\tconst sortDirection: SortDirection =\n\t\ttypeof _sortDirection === \"string\" ? _sortDirection : \"unsorted\";\n\n\tconst nextSortDirection = getNextSortDirection(sortDirection, sortingMode);\n\n\tswitch (nextSortDirection) {\n\t\tcase \"unsorted\":\n\t\t\tcolumn.clearSorting();\n\t\t\treturn;\n\t\tcase \"asc\":\n\t\t\tcolumn.toggleSorting(false);\n\t\t\treturn;\n\t\tcase \"desc\":\n\t\t\tcolumn.toggleSorting(true);\n\t\t\treturn;\n\t\tdefault:\n\t\t\treturn;\n\t}\n}\n\nfunction getNextSortDirection(\n\tcurrentSortDirection: SortDirection,\n\tsortingMode: SortingMode,\n) {\n\tconst sortOrder =\n\t\tsortingMode === \"alphanumeric\"\n\t\t\t? ([\"unsorted\", \"asc\", \"desc\"] as const satisfies SortDirection[])\n\t\t\t: ([\"unsorted\", \"desc\", \"asc\"] as const satisfies SortDirection[]);\n\n\treturn getNextInCircularList(sortOrder, currentSortDirection) ?? \"unsorted\";\n}\n\nfunction getNextInCircularList<T>(\n\tlist: T[],\n\tcurrentItem: T,\n\tfallback?: T | undefined,\n) {\n\tconst currentIndex = list.findIndex((item) => item === currentItem);\n\tconst nextIndex = (currentIndex + 1) % list.length;\n\treturn list.at(nextIndex) ?? fallback;\n}\n"],"mappings":"oVAAA,WAAc,wBCgEZ,cAAAA,EAqBG,QAAAC,MArBH,oBApDF,IAAMC,EAAiB,CAAC,GAAGC,EAAuB,UAAU,EAqC5D,SAASC,EAA+B,CACvC,SAAAC,EACA,UAAAC,EACA,OAAAC,EACA,SAAUC,EACV,YAAAC,EACA,GAAGC,CACJ,EAA8C,CAC7C,IAAMC,EAAiBJ,EAAO,YAAY,EACpCK,EAAUL,EAAO,WAAW,EAE5BM,EACLD,GAAW,OAAOD,GAAmB,SAAWA,EAAiB,WAE5DG,EAAWN,IAAgBK,CAAa,GAC7Cb,EAACe,EAAA,CAAgB,KAAMN,EAAa,UAAWI,EAAe,EAG/D,OACCb,EAACgB,EAAA,CAAY,UAAWC,EAAG,OAAQX,CAAS,EAAI,GAAGI,EAClD,SAAAT,EAACiB,EAAA,CACA,UAAU,gDACV,KAAK,SACL,WAAW,QACX,SAAS,UACT,cAAc,MACd,sBAAqBL,EACrB,KAAMC,EACN,QAAS,IAAM,CACTF,GAGLO,EAA2BZ,EAAQE,CAAW,CAC/C,EAEC,UAAAI,IAAkB,YAClBZ,EAAC,QAAK,UAAU,UAAU,uBACdY,IAAkB,MAAQ,YAAc,aAAc,IAAI,SAEtE,EAEAR,GACF,EACD,CAEF,CAYA,SAASe,EAAgB,CAAE,UAAAC,EAAW,KAAAC,EAAM,GAAGC,CAAM,EAAyB,CAC7E,OAAIF,IAAc,WACV,KAGDG,EAACC,EAAA,CAAK,KAAMH,EAAM,UAAWD,EAAY,GAAGE,EAAO,CAC3D,CAoBA,SAASG,EACRC,EACAC,EACC,CACD,GAAI,CAACD,EAAO,WAAW,EACtB,OAGD,IAAME,EAAiBF,EAAO,YAAY,EAM1C,OAF0BG,EAFzB,OAAOD,GAAmB,SAAWA,EAAiB,WAEOD,CAAW,EAE9C,CAC1B,IAAK,WACJD,EAAO,aAAa,EACpB,OACD,IAAK,MACJA,EAAO,cAAc,EAAK,EAC1B,OACD,IAAK,OACJA,EAAO,cAAc,EAAI,EACzB,OACD,QACC,MACF,CACD,CAEA,SAASG,EACRC,EACAH,EACC,CAMD,OAAOI,EAJNJ,IAAgB,eACZ,CAAC,WAAY,MAAO,MAAM,EAC1B,CAAC,WAAY,OAAQ,KAAK,EAESG,CAAoB,GAAK,UAClE,CAEA,SAASC,EACRC,EACAC,EACAC,EACC,CAED,IAAMC,GADeH,EAAK,UAAWI,GAASA,IAASH,CAAW,EAChC,GAAKD,EAAK,OAC5C,OAAOA,EAAK,GAAGG,CAAS,GAAKD,CAC9B","names":["jsx","jsxs","sortDirections","sortingDirections","DataTableHeader","children","className","column","propsSortIcon","sortingMode","props","_sortDirection","canSort","sortDirection","sortIcon","DefaultSortIcon","TableHeader","cx","Button","toggleNextSortingDirection","DefaultSortIcon","direction","mode","props","jsx","Sort","toggleNextSortingDirection","column","sortingMode","_sortDirection","getNextSortDirection","currentSortDirection","getNextInCircularList","list","currentItem","fallback","nextIndex","item"]}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Sorting modes
3
+ * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)
4
+ * - time: Sort by time (newest-to-oldest, oldest-to-newest)
5
+ */
6
+ declare const sortingModes: readonly ["alphanumeric", "time"];
7
+ /**
8
+ * Sorting modes
9
+ * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)
10
+ * - time: Sort by time (newest-to-oldest, oldest-to-newest)
11
+ */
12
+ type SortingMode = (typeof sortingModes)[number];
13
+ /**
14
+ * Type guard for sorting modes
15
+ * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)
16
+ * - time: Sort by time (newest-to-oldest, oldest-to-newest)
17
+ *
18
+ * @example isSortingMode("alphanumeric") // true
19
+ * @example isSortingMode("time") // true
20
+ * @example isSortingMode("foo") // false
21
+ */
22
+ declare const isSortingMode: (value: unknown) => value is SortingMode;
23
+ /**
24
+ * Runtime type-to-value helper for sorting modes
25
+ * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)
26
+ * - time: Sort by time (newest-to-oldest, oldest-to-newest)
27
+ *
28
+ * @example $sortingMode("alphanumeric") // "alphanumeric"
29
+ * @example $sortingMode("time") // "time"
30
+ */
31
+ declare const $sortingMode: <T extends SortingMode = SortingMode>(value: T) => T;
32
+ /**
33
+ * Sorting directions
34
+ * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)
35
+ * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)
36
+ */
37
+ declare const sortingDirections: readonly ["asc", "desc"];
38
+ /**
39
+ * Sorting directions
40
+ * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)
41
+ * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)
42
+ */
43
+ type SortingDirection = (typeof sortingDirections)[number];
44
+ /**
45
+ * Type guard for sorting directions
46
+ * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)
47
+ * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)
48
+ *
49
+ * @example isSortingDirection("asc") // true
50
+ * @example isSortingDirection("desc") // true
51
+ * @example isSortingDirection("foo") // false
52
+ */
53
+ declare const isSortingDirection: (value: unknown) => value is SortingDirection;
54
+ /**
55
+ * Runtime type-to-value helper for sorting directions
56
+ * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)
57
+ * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)
58
+ *
59
+ * @example $sortingDirection("asc") // "asc"
60
+ * @example $sortingDirection("desc") // "desc"
61
+ */
62
+ declare const $sortingDirection: <T extends SortingDirection = SortingDirection>(value: T) => T;
63
+ /**
64
+ * Alphanumeric sorting directions
65
+ * - asc: Ascending order (A-Z, 0-9)
66
+ * - desc: Descending order (Z-A, 9-0)
67
+ */
68
+ declare const alphanumericSortingDirections: readonly ["asc", "desc"];
69
+ /**
70
+ * Alphanumeric sorting directions
71
+ * - asc: Ascending order (A-Z, 0-9)
72
+ * - desc: Descending order (Z-A, 9-0)
73
+ */
74
+ type AlphanumericSortingDirection = (typeof alphanumericSortingDirections)[number];
75
+ /**
76
+ * Type guard for alphanumeric sorting directions
77
+ * - asc: Ascending order (A-Z, 0-9)
78
+ * - desc: Descending order (Z-A, 9-0)
79
+ *
80
+ * @example isAlphanumericSortingDirection("asc") // true
81
+ * @example isAlphanumericSortingDirection("desc") // true
82
+ * @example isAlphanumericSortingDirection("foo") // false
83
+ */
84
+ declare const isAlphanumericSortingDirection: (value: unknown) => value is AlphanumericSortingDirection;
85
+ /**
86
+ * Runtime type-to-value helper for alphanumeric sorting directions
87
+ * - asc: Ascending order (A-Z, 0-9)
88
+ * - desc: Descending order (Z-A, 9-0)
89
+ *
90
+ * @example $alphanumericSortingDirection("asc") // "asc"
91
+ * @example $alphanumericSortingDirection("desc") // "desc"
92
+ */
93
+ declare const $alphanumericSortingDirection: <T extends AlphanumericSortingDirection = AlphanumericSortingDirection>(value: T) => T;
94
+ /**
95
+ * Time sorting directions
96
+ * - newest-to-oldest: Descending order (newest first, oldest last)
97
+ * - oldest-to-newest: Ascending order (oldest first, newest last)
98
+ */
99
+ declare const timeSortingDirections: readonly ["newest-to-oldest", "oldest-to-newest"];
100
+ /**
101
+ * Time sorting directions
102
+ * - newest-to-oldest: Descending order (newest first, oldest last)
103
+ * - oldest-to-newest: Ascending order (oldest first, newest last)
104
+ */
105
+ type TimeSortingDirection = (typeof timeSortingDirections)[number];
106
+ /**
107
+ * Type guard for time sorting directions
108
+ * - newest-to-oldest: Descending order (newest first, oldest last)
109
+ * - oldest-to-newest: Ascending order (oldest first, newest last)
110
+ *
111
+ * @example isTimeSortingDirection("newest-to-oldest") // true
112
+ * @example isTimeSortingDirection("oldest-to-newest") // true
113
+ * @example isTimeSortingDirection("foo") // false
114
+ * @example isTimeSortingDirection("asc") // false
115
+ * @example isTimeSortingDirection("desc") // false
116
+ */
117
+ declare const isTimeSortingDirection: (value: unknown) => value is TimeSortingDirection;
118
+ /**
119
+ * Converts a sorting direction to a time sorting direction
120
+ * - asc -> oldest-to-newest
121
+ * - desc -> newest-to-oldest
122
+ */
123
+ declare const timeSortingByDirection: {
124
+ readonly asc: "oldest-to-newest";
125
+ readonly desc: "newest-to-oldest";
126
+ };
127
+ /**
128
+ * Runtime type-to-value helper for time sorting directions.
129
+ * If given a sorting direction, it will convert it to a time sorting direction.
130
+ * - newest-to-oldest: Descending order (desc; newest first, oldest last)
131
+ * - oldest-to-newest: Ascending order (asc; oldest first, newest last)
132
+ *
133
+ * @example $timeSortingDirection("asc") // "oldest-to-newest"
134
+ * @example $timeSortingDirection("desc") // "newest-to-oldest"
135
+ * @example $timeSortingDirection("oldest-to-newest") // "oldest-to-newest"
136
+ * @example $timeSortingDirection("newest-to-oldest") // "newest-to-oldest"
137
+ */
138
+ declare function $timeSortingDirection<T extends TimeSortingDirection | SortingDirection>(value: T): {
139
+ readonly asc: "oldest-to-newest";
140
+ readonly desc: "newest-to-oldest";
141
+ }[(T & "asc") | (T & "desc")] | (T & "newest-to-oldest") | (T & "oldest-to-newest");
142
+
143
+ export { $alphanumericSortingDirection as $, type AlphanumericSortingDirection as A, type SortingMode as S, type TimeSortingDirection as T, $sortingDirection as a, $sortingMode as b, $timeSortingDirection as c, alphanumericSortingDirections as d, isSortingDirection as e, isSortingMode as f, isTimeSortingDirection as g, sortingModes as h, isAlphanumericSortingDirection as i, timeSortingDirections as j, type SortingDirection as k, sortingDirections as s, timeSortingByDirection as t };
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { S as SortingMode, A as AlphanumericSortingDirection, T as TimeSortingDirection, k as SortingDirection } from './direction-A0wepfUT.js';
3
+ import { S as SvgAttributes } from './types-BuKAGhC-.js';
4
+ import 'react';
5
+
6
+ type Props = SvgAttributes & ({
7
+ mode: Extract<SortingMode, "alphanumeric">;
8
+ /**
9
+ * Sort by alphanumeric order in "ascending" (asc) or "descending" (desc) order.
10
+ * @example "asc" for A-Z, 0-9
11
+ * @example "desc" for Z-A, 0-9
12
+ */
13
+ direction: AlphanumericSortingDirection;
14
+ } | {
15
+ mode: Extract<SortingMode, "time">;
16
+ /**
17
+ * Sort by time in "newest-to-oldest" (descending, desc) or "oldest-to-newest" (ascending, asc) order.
18
+ * @example "newest-to-oldest" for newest first (aka descending, desc)
19
+ * @example "oldest-to-newest" for oldest first (aka ascending, asc)
20
+ */
21
+ direction: TimeSortingDirection | SortingDirection;
22
+ });
23
+ /**
24
+ * A sorting icon that can be used to indicate the sorting direction of a table column or list.
25
+ * It is aware of the sorting mode (alphanumeric or time) and the sorting direction (ascending or descending).
26
+ */
27
+ declare const Sort: {
28
+ ({ mode, direction, ...props }: Props): react_jsx_runtime.JSX.Element;
29
+ displayName: string;
30
+ };
31
+
32
+ /**
33
+ * An icon representing a traffic policy file.
34
+ */
35
+ declare function TrafficPolicyFile(props: SvgAttributes): react_jsx_runtime.JSX.Element;
36
+
37
+ export { Sort, TrafficPolicyFile };
package/dist/icons.js ADDED
@@ -0,0 +1,2 @@
1
+ import{a as o}from"./chunk-GOXG4BVJ.js";import{a as r}from"./chunk-FHW7SSNY.js";import"./chunk-GYPSB3OK.js";export{r as Sort,o as TrafficPolicyFile};
2
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{a as b,c as v,d as x,e as y,g as h}from"./chunk-7FIV4E5C.js";import"./chunk-MF2QITTY.js";import{b as z}from"./chunk-UXH22BMO.js";import{a as d}from"./chunk-7XIZZ4HQ.js";import{a as l}from"./chunk-XBVAQ3DV.js";import"./chunk-J3NVDJIE.js";import"./chunk-4LSFAAZW.js";import"./chunk-3C5O3AQA.js";import"./chunk-72TJUKMV.js";import"./chunk-7O36LG52.js";import"./chunk-HDPLH5HC.js";import{a as p}from"./chunk-AZ56JGNY.js";import{CaretLeft as k}from"@phosphor-icons/react/CaretLeft";import{CaretRight as A}from"@phosphor-icons/react/CaretRight";import{Slot as E}from"@radix-ui/react-slot";import{createContext as F,forwardRef as m,useContext as N,useState as W}from"react";import P from"tiny-invariant";import{jsx as s,jsxs as f}from"react/jsx-runtime";var c=F(void 0),O=m(({className:n,children:e,defaultPageSize:a,...t},i)=>{let[o,r]=W(a);return s(c.Provider,{value:{defaultPageSize:a,pageSize:o,setPageSize:r},children:s("div",{className:p("inline-flex items-center justify-between gap-2",n),ref:i,...t,children:e})})});O.displayName="CursorPagination";var T=m(({hasNextPage:n,hasPreviousPage:e,onNextPage:a,onPreviousPage:t,...i},o)=>f(d,{appearance:"panel",ref:o,...i,children:[s(l,{appearance:"ghost",disabled:!e,icon:s(k,{}),label:"Previous page",onClick:t,size:"sm",type:"button"}),s(z,{orientation:"vertical",className:"min-h-5"}),s(l,{appearance:"ghost",disabled:!n,icon:s(A,{}),label:"Next page",onClick:a,size:"sm",type:"button"})]}));T.displayName="CursorButtons";var $=[5,10,20,50,100],B=m(({className:n,pageSizes:e=$,onChangePageSize:a,...t},i)=>{let o=N(c);return P(o,"CursorPageSizeSelect must be used as a child of a CursorPagination component"),P(e.includes(o.defaultPageSize),"CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes"),P(e.includes(o.pageSize),"CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes"),f(b,{defaultValue:`${o.pageSize}`,onChange:r=>{let g=Number.parseInt(r,10);Number.isNaN(g)&&(g=o.defaultPageSize),o.setPageSize(g),a?.(g)},children:[s(x,{ref:i,className:p("w-auto min-w-36",n),value:o.pageSize,...t,children:s(v,{})}),s(y,{width:"trigger",children:e.map(r=>f(h,{value:`${r}`,children:[r," per page"]},r))})]})});B.displayName="CursorPageSizeSelect";function D({asChild:n=!1,className:e,...a}){let t=N(c);return P(t,"CursorPageSizeValue must be used as a child of a CursorPagination component"),f(n?E:"span",{className:p("text-muted text-sm font-normal",e),...a,children:[t.pageSize," per page"]})}import{useEffect as V,useState as w}from"react";function H({listSize:n,pageSize:e}){let[a,t]=w(1),[i,o]=w(e);V(()=>{o(e),t(1)},[e]),V(()=>{t(1)},[n]);let r=Math.ceil(n/i),g=(a-1)*i,S=a>1,C=a<r;function M(u){let j=Math.max(1,Math.min(u,r));t(j)}function R(){C&&t(u=>Math.min(u+1,r))}function G(){S&&t(u=>Math.max(u-1,1))}function I(u){o(u),t(1)}function L(){t(r)}function U(){t(1)}return{currentPage:a,goToFirstPage:U,goToLastPage:L,goToPage:M,hasNextPage:C,hasPreviousPage:S,nextPage:R,offset:g,pageSize:i,previousPage:G,setPageSize:I,totalPages:r}}function q(n,e){return n.slice(e.offset,e.offset+e.pageSize)}export{T as CursorButtons,B as CursorPageSizeSelect,D as CursorPageSizeValue,O as CursorPagination,q as getOffsetPaginatedSlice,H as useOffsetPagination};
1
+ import{a as b,c as v,d as x,e as y,g as h}from"./chunk-WGF5NYWL.js";import"./chunk-MF2QITTY.js";import{b as z}from"./chunk-UXH22BMO.js";import{a as d}from"./chunk-7XIZZ4HQ.js";import{a as l}from"./chunk-XBVAQ3DV.js";import"./chunk-J3NVDJIE.js";import"./chunk-4LSFAAZW.js";import"./chunk-3C5O3AQA.js";import"./chunk-72TJUKMV.js";import"./chunk-7O36LG52.js";import"./chunk-HDPLH5HC.js";import{a as p}from"./chunk-AZ56JGNY.js";import{CaretLeft as k}from"@phosphor-icons/react/CaretLeft";import{CaretRight as A}from"@phosphor-icons/react/CaretRight";import{Slot as E}from"@radix-ui/react-slot";import{createContext as F,forwardRef as m,useContext as N,useState as W}from"react";import P from"tiny-invariant";import{jsx as s,jsxs as f}from"react/jsx-runtime";var c=F(void 0),O=m(({className:n,children:e,defaultPageSize:a,...t},i)=>{let[o,r]=W(a);return s(c.Provider,{value:{defaultPageSize:a,pageSize:o,setPageSize:r},children:s("div",{className:p("inline-flex items-center justify-between gap-2",n),ref:i,...t,children:e})})});O.displayName="CursorPagination";var T=m(({hasNextPage:n,hasPreviousPage:e,onNextPage:a,onPreviousPage:t,...i},o)=>f(d,{appearance:"panel",ref:o,...i,children:[s(l,{appearance:"ghost",disabled:!e,icon:s(k,{}),label:"Previous page",onClick:t,size:"sm",type:"button"}),s(z,{orientation:"vertical",className:"min-h-5"}),s(l,{appearance:"ghost",disabled:!n,icon:s(A,{}),label:"Next page",onClick:a,size:"sm",type:"button"})]}));T.displayName="CursorButtons";var $=[5,10,20,50,100],B=m(({className:n,pageSizes:e=$,onChangePageSize:a,...t},i)=>{let o=N(c);return P(o,"CursorPageSizeSelect must be used as a child of a CursorPagination component"),P(e.includes(o.defaultPageSize),"CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes"),P(e.includes(o.pageSize),"CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes"),f(b,{defaultValue:`${o.pageSize}`,onChange:r=>{let g=Number.parseInt(r,10);Number.isNaN(g)&&(g=o.defaultPageSize),o.setPageSize(g),a?.(g)},children:[s(x,{ref:i,className:p("w-auto min-w-36",n),value:o.pageSize,...t,children:s(v,{})}),s(y,{width:"trigger",children:e.map(r=>f(h,{value:`${r}`,children:[r," per page"]},r))})]})});B.displayName="CursorPageSizeSelect";function D({asChild:n=!1,className:e,...a}){let t=N(c);return P(t,"CursorPageSizeValue must be used as a child of a CursorPagination component"),f(n?E:"span",{className:p("text-muted text-sm font-normal",e),...a,children:[t.pageSize," per page"]})}import{useEffect as V,useState as w}from"react";function H({listSize:n,pageSize:e}){let[a,t]=w(1),[i,o]=w(e);V(()=>{o(e),t(1)},[e]),V(()=>{t(1)},[n]);let r=Math.ceil(n/i),g=(a-1)*i,S=a>1,C=a<r;function M(u){let j=Math.max(1,Math.min(u,r));t(j)}function R(){C&&t(u=>Math.min(u+1,r))}function G(){S&&t(u=>Math.max(u-1,1))}function I(u){o(u),t(1)}function L(){t(r)}function U(){t(1)}return{currentPage:a,goToFirstPage:U,goToLastPage:L,goToPage:M,hasNextPage:C,hasPreviousPage:S,nextPage:R,offset:g,pageSize:i,previousPage:G,setPageSize:I,totalPages:r}}function q(n,e){return n.slice(e.offset,e.offset+e.pageSize)}export{T as CursorButtons,B as CursorPageSizeSelect,D as CursorPageSizeValue,O as CursorPagination,q as getOffsetPaginatedSlice,H as useOffsetPagination};
2
2
  //# sourceMappingURL=pagination.js.map
package/dist/popover.d.ts CHANGED
@@ -47,6 +47,16 @@ declare const PopoverClose: react.ForwardRefExoticComponent<PopoverPrimitive.Pop
47
47
  *
48
48
  * https://github.com/ngrok-oss/mantle/issues
49
49
  */
50
- declare const PopoverContent: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
50
+ declare const PopoverContent: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & {
51
+ /**
52
+ * The preferred width of the `PopoverContent` as a tailwind `max-w-` class.
53
+ *
54
+ * By default, a `Popover`'s content width is responsive with a default
55
+ * preferred width: the maximum width of the `PopoverContent`
56
+ *
57
+ * @default `max-w-72`
58
+ */
59
+ preferredWidth?: `max-w-${string}`;
60
+ } & react.RefAttributes<HTMLDivElement>>;
51
61
 
52
62
  export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger };
package/dist/popover.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-AZ56JGNY.js";import*as o from"@radix-ui/react-popover";import{forwardRef as c}from"react";import{jsx as r}from"react/jsx-runtime";var i=o.Root;i.displayName="Popover";var p=o.Trigger;p.displayName="PopoverTrigger";var a=o.Anchor;a.displayName="PopoverAnchor";var n=o.Close;n.displayName="PopoverClose";var m=c(({align:P="center",className:s,onClick:d,sideOffset:v=4,...f},l)=>r(o.Portal,{children:r(o.Content,{align:P,className:t("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 w-72 rounded-md border p-4 shadow-md outline-none",s),onClick:e=>{e.stopPropagation(),d?.(e)},ref:l,sideOffset:v,...f})}));m.displayName="PopoverContent";export{i as Popover,a as PopoverAnchor,n as PopoverClose,m as PopoverContent,p as PopoverTrigger};
1
+ import{a as t}from"./chunk-AZ56JGNY.js";import*as o from"@radix-ui/react-popover";import{forwardRef as C}from"react";import{jsx as r}from"react/jsx-runtime";var i=o.Root;i.displayName="Popover";var p=o.Trigger;p.displayName="PopoverTrigger";var a=o.Anchor;a.displayName="PopoverAnchor";var n=o.Close;n.displayName="PopoverClose";var s=C(({align:P="center",className:d,onClick:m,preferredWidth:v="max-w-72",sideOffset:f=4,...l},c)=>r(o.Portal,{children:r(o.Content,{align:P,className:t("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-none",v,d),onClick:e=>{e.stopPropagation(),m?.(e)},ref:c,sideOffset:f,...l})}));s.displayName="PopoverContent";export{i as Popover,a as PopoverAnchor,n as PopoverClose,s as PopoverContent,p as PopoverTrigger};
2
2
  //# sourceMappingURL=popover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/popover/popover.tsx"],"sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\n\n/**\n * A popover is a floating overlay that appears above other elements on the page.\n * Displays rich content in a portal, triggered by a button.\n * This is the root, stateful component that manages the open/closed state of the popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst Popover = PopoverPrimitive.Root;\nPopover.displayName = \"Popover\";\n\n/**\n * The trigger button that opens the popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverTrigger = PopoverPrimitive.Trigger;\nPopoverTrigger.displayName = \"PopoverTrigger\";\n\n/**\n * An optional element to position the PopoverContent against. If this part is not used, the content will position alongside the PopoverTrigger.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverAnchor = PopoverPrimitive.Anchor;\nPopoverAnchor.displayName = \"PopoverAnchor\";\n\n/**\n * A button that closes an open popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverClose = PopoverPrimitive.Close;\nPopoverClose.displayName = \"PopoverClose\";\n\n/**\n * The content to render inside the popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverContent = forwardRef<\n\tComponentRef<typeof PopoverPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\talign = \"center\",\n\t\t\tclassName,\n\t\t\tonClick,\n\t\t\tsideOffset = 4,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<PopoverPrimitive.Portal>\n\t\t\t<PopoverPrimitive.Content\n\t\t\t\talign={align}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"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 w-72 rounded-md border p-4 shadow-md outline-none\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\t/**\n\t\t\t\t\t * Prevent the click event from propagating up to parent/containing elements\n\t\t\t\t\t * of the PopoverContent\n\t\t\t\t\t */\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t\tref={ref}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</PopoverPrimitive.Portal>\n\t),\n);\nPopoverContent.displayName = \"PopoverContent\";\n\nexport {\n\t//,\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverTrigger,\n};\n"],"mappings":"wCAAA,UAAYA,MAAsB,0BAClC,OAAS,cAAAC,MAAkB,QA0ExB,cAAAC,MAAA,oBA5DH,IAAMC,EAA2B,OACjCA,EAAQ,YAAc,UAUtB,IAAMC,EAAkC,UACxCA,EAAe,YAAc,iBAU7B,IAAMC,EAAiC,SACvCA,EAAc,YAAc,gBAU5B,IAAMC,EAAgC,QACtCA,EAAa,YAAc,eAU3B,IAAMC,EAAiBC,EAItB,CACC,CAEC,MAAAC,EAAQ,SACR,UAAAC,EACA,QAAAC,EACA,WAAAC,EAAa,EACb,GAAGC,CACJ,EACAC,IAEAZ,EAAkB,SAAjB,CACA,SAAAA,EAAkB,UAAjB,CACA,MAAOO,EACP,UAAWM,EACV,waACAL,CACD,EACA,QAAUM,GAAU,CAKnBA,EAAM,gBAAgB,EACtBL,IAAUK,CAAK,CAChB,EACA,IAAKF,EACL,WAAYF,EACX,GAAGC,EACL,EACD,CAEF,EACAN,EAAe,YAAc","names":["PopoverPrimitive","forwardRef","jsx","Popover","PopoverTrigger","PopoverAnchor","PopoverClose","PopoverContent","forwardRef","align","className","onClick","sideOffset","props","ref","cx","event"]}
1
+ {"version":3,"sources":["../src/components/popover/popover.tsx"],"sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\n\n/**\n * A popover is a floating overlay that appears above other elements on the page.\n * Displays rich content in a portal, triggered by a button.\n * This is the root, stateful component that manages the open/closed state of the popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst Popover = PopoverPrimitive.Root;\nPopover.displayName = \"Popover\";\n\n/**\n * The trigger button that opens the popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverTrigger = PopoverPrimitive.Trigger;\nPopoverTrigger.displayName = \"PopoverTrigger\";\n\n/**\n * An optional element to position the PopoverContent against. If this part is not used, the content will position alongside the PopoverTrigger.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverAnchor = PopoverPrimitive.Anchor;\nPopoverAnchor.displayName = \"PopoverAnchor\";\n\n/**\n * A button that closes an open popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverClose = PopoverPrimitive.Close;\nPopoverClose.displayName = \"PopoverClose\";\n\ntype PopoverContentProps = ComponentPropsWithoutRef<\n\ttypeof PopoverPrimitive.Content\n> & {\n\t/**\n\t * The preferred width of the `PopoverContent` as a tailwind `max-w-` class.\n\t *\n\t * By default, a `Popover`'s content width is responsive with a default\n\t * preferred width: the maximum width of the `PopoverContent`\n\t *\n\t * @default `max-w-72`\n\t */\n\tpreferredWidth?: `max-w-${string}`;\n};\n\n/**\n * The content to render inside the popover.\n *\n * @preview This component is in `preview` mode which means the API is not stable and may change.\n * There may also be bugs! Please file an issue if you find any! <3\n *\n * https://github.com/ngrok-oss/mantle/issues\n */\nconst PopoverContent = forwardRef<ComponentRef<\"div\">, PopoverContentProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\talign = \"center\",\n\t\t\tclassName,\n\t\t\tonClick,\n\t\t\tpreferredWidth = \"max-w-72\",\n\t\t\tsideOffset = 4,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<PopoverPrimitive.Portal>\n\t\t\t<PopoverPrimitive.Content\n\t\t\t\talign={align}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"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-none\",\n\t\t\t\t\tpreferredWidth,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\t/**\n\t\t\t\t\t * Prevent the click event from propagating up to parent/containing elements\n\t\t\t\t\t * of the PopoverContent\n\t\t\t\t\t */\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t\tref={ref}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</PopoverPrimitive.Portal>\n\t),\n);\nPopoverContent.displayName = \"PopoverContent\";\n\nexport {\n\t//,\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverTrigger,\n};\n"],"mappings":"wCAAA,UAAYA,MAAsB,0BAClC,OAAS,cAAAC,MAAkB,QAsFxB,cAAAC,MAAA,oBAxEH,IAAMC,EAA2B,OACjCA,EAAQ,YAAc,UAUtB,IAAMC,EAAkC,UACxCA,EAAe,YAAc,iBAU7B,IAAMC,EAAiC,SACvCA,EAAc,YAAc,gBAU5B,IAAMC,EAAgC,QACtCA,EAAa,YAAc,eAwB3B,IAAMC,EAAiBC,EACtB,CACC,CAEC,MAAAC,EAAQ,SACR,UAAAC,EACA,QAAAC,EACA,eAAAC,EAAiB,WACjB,WAAAC,EAAa,EACb,GAAGC,CACJ,EACAC,IAEAb,EAAkB,SAAjB,CACA,SAAAA,EAAkB,UAAjB,CACA,MAAOO,EACP,UAAWO,EACV,maACAJ,EACAF,CACD,EACA,QAAUO,GAAU,CAKnBA,EAAM,gBAAgB,EACtBN,IAAUM,CAAK,CAChB,EACA,IAAKF,EACL,WAAYF,EACX,GAAGC,EACL,EACD,CAEF,EACAP,EAAe,YAAc","names":["PopoverPrimitive","forwardRef","jsx","Popover","PopoverTrigger","PopoverAnchor","PopoverClose","PopoverContent","forwardRef","align","className","onClick","preferredWidth","sideOffset","props","ref","cx","event"]}
package/dist/select.d.ts CHANGED
@@ -31,17 +31,33 @@ type WithAriaInvalid = Pick<SelectHTMLAttributes<HTMLSelectElement>, "aria-inval
31
31
  *
32
32
  * @see https://mantle.ngrok.com/components/select#api-select
33
33
  */
34
- declare const Select: react.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectProps, "onValueChange"> & WithValidation & WithAriaInvalid & {
35
- /**
36
- * Event handler called when the value changes.
37
- */
38
- onChange?: (value: string) => void;
34
+ declare const Select: react.ForwardRefExoticComponent<{
35
+ children?: react.ReactNode | undefined;
36
+ } & {
37
+ autoComplete?: string;
38
+ defaultOpen?: boolean;
39
+ defaultValue?: string;
40
+ dir?: "ltr" | "rtl";
41
+ disabled?: boolean;
42
+ form?: string;
43
+ id?: string;
44
+ name?: string;
39
45
  /**
40
46
  * Event handler called when Select blurs.
41
47
  * @note this is a no-op for now until we can guarantee that it works identically to a native select onBlur
42
48
  */
43
49
  onBlur?: (event: FocusEvent<HTMLButtonElement>) => void;
44
- } & Pick<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "id"> & react.RefAttributes<HTMLButtonElement>>;
50
+ /**
51
+ * Event handler called when the value changes.
52
+ * @deprecated Use `onValueChange` instead.
53
+ */
54
+ onChange?: (value: string) => void;
55
+ onOpenChange?(open: boolean): void;
56
+ onValueChange?(value: string): void;
57
+ open?: boolean;
58
+ required?: boolean;
59
+ value?: string;
60
+ } & WithValidation & WithAriaInvalid & react.RefAttributes<HTMLButtonElement>>;
45
61
  /**
46
62
  * A group of related options within a select menu. Similar to an html `<optgroup>` element.
47
63
  * Use in conjunction with SelectLabel to ensure good accessibility via automatic labelling.
package/dist/select.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as e,b as t,c as l,d as S,e as c,f as r,g as o,h as a}from"./chunk-7FIV4E5C.js";import"./chunk-MF2QITTY.js";import"./chunk-UXH22BMO.js";import"./chunk-AZ56JGNY.js";export{e as Select,c as SelectContent,t as SelectGroup,o as SelectItem,r as SelectLabel,a as SelectSeparator,S as SelectTrigger,l as SelectValue};
1
+ import{a as e,b as t,c as l,d as S,e as c,f as r,g as o,h as a}from"./chunk-WGF5NYWL.js";import"./chunk-MF2QITTY.js";import"./chunk-UXH22BMO.js";import"./chunk-AZ56JGNY.js";export{e as Select,c as SelectContent,t as SelectGroup,o as SelectItem,r as SelectLabel,a as SelectSeparator,S as SelectTrigger,l as SelectValue};
2
2
  //# sourceMappingURL=select.js.map
@@ -0,0 +1,18 @@
1
+ export { $ as $alphanumericSortingDirection, a as $sortingDirection, b as $sortingMode, c as $timeSortingDirection, A as AlphanumericSortingDirection, k as SortingDirection, S as SortingMode, T as TimeSortingDirection, d as alphanumericSortingDirections, i as isAlphanumericSortingDirection, e as isSortingDirection, f as isSortingMode, g as isTimeSortingDirection, s as sortingDirections, h as sortingModes, t as timeSortingByDirection, j as timeSortingDirections } from './direction-A0wepfUT.js';
2
+
3
+ /**
4
+ * Compare dates in newest-to-oldest (descending) order.
5
+ * Used for chronological sorting use cases.
6
+ *
7
+ * @returns A negative number if `b` comes earlier in time than `a`; positive if `b` comes later in time than `a`; 0 if they are equivalent.
8
+ */
9
+ declare function compareDatesNewestToOldest(a: Date, b: Date): number;
10
+ /**
11
+ * Compare dates in oldest-to-newest (ascending) order.
12
+ * Used for chronological sorting use cases.
13
+ *
14
+ * @returns A negative number if `a` comes earlier in time than `b`; positive if `a` comes later in time than `b`; 0 if they are equivalent.
15
+ */
16
+ declare function compareDatesOldestToNewest(a: Date, b: Date): number;
17
+
18
+ export { compareDatesNewestToOldest, compareDatesOldestToNewest };
@@ -0,0 +1,2 @@
1
+ import{a as t,b as o,c as r,d as n,e as s,f as c,g,h as m,i as D,j as a,k as p,l as S,m as u}from"./chunk-GYPSB3OK.js";function T(e,i){return Math.sign(i.getTime()-e.getTime())}function d(e,i){return Math.sign(e.getTime()-i.getTime())}export{D as $alphanumericSortingDirection,c as $sortingDirection,r as $sortingMode,u as $timeSortingDirection,g as alphanumericSortingDirections,T as compareDatesNewestToOldest,d as compareDatesOldestToNewest,m as isAlphanumericSortingDirection,s as isSortingDirection,o as isSortingMode,p as isTimeSortingDirection,n as sortingDirections,t as sortingModes,S as timeSortingByDirection,a as timeSortingDirections};
2
+ //# sourceMappingURL=sorting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/sorting/compare.ts"],"sourcesContent":["/**\n * Compare dates in newest-to-oldest (descending) order.\n * Used for chronological sorting use cases.\n *\n * @returns A negative number if `b` comes earlier in time than `a`; positive if `b` comes later in time than `a`; 0 if they are equivalent.\n */\nfunction compareDatesNewestToOldest(a: Date, b: Date): number {\n\treturn Math.sign(b.getTime() - a.getTime());\n}\n\n/**\n * Compare dates in oldest-to-newest (ascending) order.\n * Used for chronological sorting use cases.\n *\n * @returns A negative number if `a` comes earlier in time than `b`; positive if `a` comes later in time than `b`; 0 if they are equivalent.\n */\nfunction compareDatesOldestToNewest(a: Date, b: Date): number {\n\treturn Math.sign(a.getTime() - b.getTime());\n}\n\nexport {\n\t//,\n\tcompareDatesNewestToOldest,\n\tcompareDatesOldestToNewest,\n};\n"],"mappings":"uHAMA,SAASA,EAA2BC,EAASC,EAAiB,CAC7D,OAAO,KAAK,KAAKA,EAAE,QAAQ,EAAID,EAAE,QAAQ,CAAC,CAC3C,CAQA,SAASE,EAA2BF,EAASC,EAAiB,CAC7D,OAAO,KAAK,KAAKD,EAAE,QAAQ,EAAIC,EAAE,QAAQ,CAAC,CAC3C","names":["compareDatesNewestToOldest","a","b","compareDatesOldestToNewest"]}