@exsto/ds 0.0.1-rc.17 → 0.0.1-rc.18
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/README.md +34 -0
- package/dist/ds/src/file-input.d.ts +9 -0
- package/dist/ds/src/time-field.d.ts +9 -0
- package/dist/file-input.js +2 -0
- package/dist/index.js +4 -3
- package/dist/source-hash.txt +1 -1
- package/dist/styles.css +143 -38
- package/dist/time-field.js +2 -0
- package/dist/ui/src/components/edyn/file-input/file-input.d.ts +90 -0
- package/dist/ui/src/components/edyn/file-input/file-input.js +261 -0
- package/dist/ui/src/components/edyn/file-input/file-input.js.map +1 -0
- package/dist/ui/src/components/edyn/file-input/file-input.test.d.ts +8 -0
- package/dist/ui/src/components/edyn/file-input/index.d.ts +1 -0
- package/dist/ui/src/components/edyn/multi-select/multi-select.d.ts +12 -1
- package/dist/ui/src/components/edyn/multi-select/multi-select.js +11 -7
- package/dist/ui/src/components/edyn/multi-select/multi-select.js.map +1 -1
- package/dist/ui/src/components/edyn/time-field/index.d.ts +1 -0
- package/dist/ui/src/components/edyn/time-field/time-field.d.ts +85 -0
- package/dist/ui/src/components/edyn/time-field/time-field.js +330 -0
- package/dist/ui/src/components/edyn/time-field/time-field.js.map +1 -0
- package/dist/ui/src/components/edyn/time-field/time-field.test.d.ts +8 -0
- package/dist/ui/src/components/ui/combobox/combobox.d.ts +10 -0
- package/dist/ui/src/components/ui/combobox/combobox.js +37 -5
- package/dist/ui/src/components/ui/combobox/combobox.js.map +1 -1
- package/dist/ui/src/components/ui/context-menu/context-menu.d.ts +1 -1
- package/dist/ui/src/components/ui/context-menu/context-menu.js +23 -10
- package/dist/ui/src/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/ui/src/components/ui/dropdown-menu/dropdown-menu.js +5 -4
- package/dist/ui/src/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/ui/src/components/ui/menubar/menubar.js +1 -1
- package/dist/ui/src/components/ui/menubar/menubar.js.map +1 -1
- package/dist/ui/src/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/ui/src/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/ui/src/components/ui/select/select.js +7 -6
- package/dist/ui/src/components/ui/select/select.js.map +1 -1
- package/dist/ui/src/components/ui/sheet/sheet.d.ts +8 -0
- package/dist/ui/src/components/ui/sheet/sheet.js +11 -3
- package/dist/ui/src/components/ui/sheet/sheet.js.map +1 -1
- package/dist/ui/src/components/ui/table/table.d.ts +9 -2
- package/dist/ui/src/components/ui/table/table.js +19 -6
- package/dist/ui/src/components/ui/table/table.js.map +1 -1
- package/dist/ui/src/index.d.ts +1 -0
- package/dist/ui/src/lib/popup-list.d.ts +29 -4
- package/dist/ui/src/lib/popup-list.js +30 -5
- package/dist/ui/src/lib/popup-list.js.map +1 -1
- package/package.json +9 -1
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
2
|
export interface ITableProps extends React.ComponentProps<'table'> {
|
|
3
3
|
/**
|
|
4
|
-
* The box around the table
|
|
5
|
-
*
|
|
4
|
+
* The box around the table. A table wider than it scrolls sideways inside it, in a design system ScrollArea: the bar is the
|
|
5
|
+
* kit's, not the browser's, and the room it takes at the foot is kept clear of the last row. `overflow-visible` turns that
|
|
6
|
+
* scroll off, for a table whose page or parent scrolls it, or whose sticky header would otherwise stick to this box instead
|
|
7
|
+
* of that one.
|
|
6
8
|
*/
|
|
7
9
|
containerClassName?: string;
|
|
8
10
|
}
|
|
9
11
|
export declare const Table: ({ className, containerClassName, ...props }: ITableProps) => React.JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* The header row names the columns, it is not a row to point at: TableRow's hover fill would make it light up like the data
|
|
14
|
+
* under it, and read as clickable. The rule sits here, one level above the row, so it holds for any row put in a header and
|
|
15
|
+
* outranks the row's own hover fill.
|
|
16
|
+
*/
|
|
10
17
|
export declare const TableHeader: ({ className, ...props }: React.ComponentProps<"thead">) => React.JSX.Element;
|
|
11
18
|
export declare const TableBody: ({ className, ...props }: React.ComponentProps<"tbody">) => React.JSX.Element;
|
|
12
19
|
export declare const TableFooter: ({ className, ...props }: React.ComponentProps<"tfoot">) => React.JSX.Element;
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
|
+
import { ScrollArea } from "../scroll-area/scroll-area.js";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
//#region ../ui/src/components/ui/table/table.tsx
|
|
5
|
+
/** `overflow-visible` (or its sideways form) among the classes: how a table has always switched its own scrolling off. */
|
|
6
|
+
var SCROLL_OFF = /(?:^|\s)overflow-(?:x-)?visible(?:\s|$)/;
|
|
4
7
|
var Table = ({ className, containerClassName, ...props }) => {
|
|
8
|
+
const table = /* @__PURE__ */ jsx("table", {
|
|
9
|
+
"data-slot": "table",
|
|
10
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
5
13
|
return /* @__PURE__ */ jsx("div", {
|
|
6
14
|
"data-slot": "table-container",
|
|
7
15
|
"data-focus": "inset",
|
|
8
|
-
className: cn("relative w-full
|
|
9
|
-
children: /* @__PURE__ */ jsx(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
className: cn("relative w-full", containerClassName),
|
|
17
|
+
children: SCROLL_OFF.test(containerClassName ?? "") ? table : /* @__PURE__ */ jsx(ScrollArea, {
|
|
18
|
+
orientation: "horizontal",
|
|
19
|
+
type: "always",
|
|
20
|
+
children: table
|
|
13
21
|
})
|
|
14
22
|
});
|
|
15
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* The header row names the columns, it is not a row to point at: TableRow's hover fill would make it light up like the data
|
|
26
|
+
* under it, and read as clickable. The rule sits here, one level above the row, so it holds for any row put in a header and
|
|
27
|
+
* outranks the row's own hover fill.
|
|
28
|
+
*/
|
|
16
29
|
var TableHeader = ({ className, ...props }) => {
|
|
17
30
|
return /* @__PURE__ */ jsx("thead", {
|
|
18
31
|
"data-slot": "table-header",
|
|
19
|
-
className: cn("[&_tr]:border-b", className),
|
|
32
|
+
className: cn("[&_tr]:border-b [&_tr]:hover:bg-transparent", className),
|
|
20
33
|
...props
|
|
21
34
|
});
|
|
22
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":[],"sources":["../../../../../../../ui/src/components/ui/table/table.tsx"],"sourcesContent":["import { cn } from '@edyn/ui/lib/utils';\nimport type * as React from 'react';\n\nexport interface ITableProps extends React.ComponentProps<'table'> {\n /**\n * The box around the table
|
|
1
|
+
{"version":3,"file":"table.js","names":[],"sources":["../../../../../../../ui/src/components/ui/table/table.tsx"],"sourcesContent":["import { cn } from '@edyn/ui/lib/utils';\nimport type * as React from 'react';\nimport { ScrollArea } from '../scroll-area';\n\nexport interface ITableProps extends React.ComponentProps<'table'> {\n /**\n * The box around the table. A table wider than it scrolls sideways inside it, in a design system ScrollArea: the bar is the\n * kit's, not the browser's, and the room it takes at the foot is kept clear of the last row. `overflow-visible` turns that\n * scroll off, for a table whose page or parent scrolls it, or whose sticky header would otherwise stick to this box instead\n * of that one.\n */\n containerClassName?: string;\n}\n\n/** `overflow-visible` (or its sideways form) among the classes: how a table has always switched its own scrolling off. */\nconst SCROLL_OFF = /(?:^|\\s)overflow-(?:x-)?visible(?:\\s|$)/;\n\nexport const Table = ({ className, containerClassName, ...props }: ITableProps) => {\n const table = <table data-slot=\"table\" className={cn('w-full caption-bottom text-sm', className)} {...props} />;\n return (\n <div data-slot=\"table-container\" data-focus=\"inset\" className={cn('relative w-full', containerClassName)}>\n {SCROLL_OFF.test(containerClassName ?? '') ? (\n table\n ) : (\n // The bar stays on while the table overflows, as in the popup lists: scrolling a table sideways is otherwise\n // something a person finds out by accident.\n <ScrollArea orientation=\"horizontal\" type=\"always\">\n {table}\n </ScrollArea>\n )}\n </div>\n );\n};\n\n/**\n * The header row names the columns, it is not a row to point at: TableRow's hover fill would make it light up like the data\n * under it, and read as clickable. The rule sits here, one level above the row, so it holds for any row put in a header and\n * outranks the row's own hover fill.\n */\nexport const TableHeader = ({ className, ...props }: React.ComponentProps<'thead'>) => {\n return <thead data-slot=\"table-header\" className={cn('[&_tr]:border-b [&_tr]:hover:bg-transparent', className)} {...props} />;\n};\n\nexport const TableBody = ({ className, ...props }: React.ComponentProps<'tbody'>) => {\n return <tbody data-slot=\"table-body\" className={cn('[&_tr:last-child]:border-0', className)} {...props} />;\n};\n\nexport const TableFooter = ({ className, ...props }: React.ComponentProps<'tfoot'>) => {\n return <tfoot data-slot=\"table-footer\" className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)} {...props} />;\n};\n\nexport const TableRow = ({ className, ...props }: React.ComponentProps<'tr'>) => {\n return (\n <tr data-slot=\"table-row\" className={cn('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className)} {...props} />\n );\n};\n\nexport const TableHead = ({ className, ...props }: React.ComponentProps<'th'>) => {\n return (\n <th\n data-slot=\"table-head\"\n className={cn('h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0', className)}\n {...props}\n />\n );\n};\n\nexport const TableCell = ({ className, ...props }: React.ComponentProps<'td'>) => {\n return <td data-slot=\"table-cell\" className={cn('p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0', className)} {...props} />;\n};\n\nexport const TableCaption = ({ className, ...props }: React.ComponentProps<'caption'>) => {\n return <caption data-slot=\"table-caption\" className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />;\n};\n"],"mappings":";;;;;AAeA,IAAM,aAAa;AAEnB,IAAa,SAAS,EAAE,WAAW,oBAAoB,GAAG,YAAyB;CACjF,MAAM,QAAQ,oBAAC,SAAD;EAAO,aAAU;EAAQ,WAAW,GAAG,iCAAiC,SAAS;EAAG,GAAI;CAAQ,CAAA;CAC9G,OACE,oBAAC,OAAD;EAAK,aAAU;EAAkB,cAAW;EAAQ,WAAW,GAAG,mBAAmB,kBAAkB;EACpG,UAAA,WAAW,KAAK,sBAAsB,EAAE,IACvC,QAIA,oBAAC,YAAD;GAAY,aAAY;GAAa,MAAK;GACvC,UAAA;EACS,CAAA;CAEX,CAAA;AAET;;;;;;AAOA,IAAa,eAAe,EAAE,WAAW,GAAG,YAA2C;CACrF,OAAO,oBAAC,SAAD;EAAO,aAAU;EAAe,WAAW,GAAG,+CAA+C,SAAS;EAAG,GAAI;CAAQ,CAAA;AAC9H;AAEA,IAAa,aAAa,EAAE,WAAW,GAAG,YAA2C;CACnF,OAAO,oBAAC,SAAD;EAAO,aAAU;EAAa,WAAW,GAAG,8BAA8B,SAAS;EAAG,GAAI;CAAQ,CAAA;AAC3G;AAEA,IAAa,eAAe,EAAE,WAAW,GAAG,YAA2C;CACrF,OAAO,oBAAC,SAAD;EAAO,aAAU;EAAe,WAAW,GAAG,2DAA2D,SAAS;EAAG,GAAI;CAAQ,CAAA;AAC1I;AAEA,IAAa,YAAY,EAAE,WAAW,GAAG,YAAwC;CAC/E,OACE,oBAAC,MAAD;EAAI,aAAU;EAAY,WAAW,GAAG,+EAA+E,SAAS;EAAG,GAAI;CAAQ,CAAA;AAEnJ;AAEA,IAAa,aAAa,EAAE,WAAW,GAAG,YAAwC;CAChF,OACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GAAG,gHAAgH,SAAS;EACvI,GAAI;CACL,CAAA;AAEL;AAEA,IAAa,aAAa,EAAE,WAAW,GAAG,YAAwC;CAChF,OAAO,oBAAC,MAAD;EAAI,aAAU;EAAa,WAAW,GAAG,oEAAoE,SAAS;EAAG,GAAI;CAAQ,CAAA;AAC9I;AAEA,IAAa,gBAAgB,EAAE,WAAW,GAAG,YAA6C;CACxF,OAAO,oBAAC,WAAD;EAAS,aAAU;EAAgB,WAAW,GAAG,sCAAsC,SAAS;EAAG,GAAI;CAAQ,CAAA;AACxH"}
|
package/dist/ui/src/index.d.ts
CHANGED
|
@@ -72,4 +72,5 @@ export * from './components/ui/tooltip';
|
|
|
72
72
|
export * from './hooks/use-media-player';
|
|
73
73
|
export * from './hooks/use-merged-refs';
|
|
74
74
|
export * from './hooks/use-mobile';
|
|
75
|
+
export { POPUP_FRAME_CLASS, POPUP_GROUP_LABEL_CLASS, POPUP_ITEM_INDICATOR_CLASS, POPUP_LIST_HEIGHT_CLASS, POPUP_LIST_WIDTH_CLASS, popupItemClass, type TPopupItemFlavor, } from './lib/popup-list';
|
|
75
76
|
export { cn } from './lib/utils';
|
|
@@ -46,8 +46,33 @@ export declare const POPUP_ITEM_INDICATOR_CLASS = "pointer-events-none absolute
|
|
|
46
46
|
/** A group's heading in any of these lists. */
|
|
47
47
|
export declare const POPUP_GROUP_LABEL_CLASS = "px-2 py-1.5 text-xs font-medium text-muted-foreground";
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
49
|
+
* The frame of every popup that holds a list: Select, Combobox, MultiSelect and the menus. One radius, and one outline, the
|
|
50
|
+
* 1px ring of the text colour at 10% that the menus, Popover and the dialogs already wear. It is a ring and not a border so
|
|
51
|
+
* the frame takes no room: the popup is exactly as tall as its rows, which is what lets a list end on a whole row (see
|
|
52
|
+
* POPUP_LIST_HEIGHT_CLASS). Select used to draw a 14px border, Combobox a 10px one, and the menus a ring.
|
|
53
|
+
*
|
|
54
|
+
* `outline-none` is the popup's own focus outline, switched off: a popup is a container, and the highlighted row is where
|
|
55
|
+
* focus is shown.
|
|
56
|
+
*/
|
|
57
|
+
export declare const POPUP_FRAME_CLASS = "rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-none";
|
|
58
|
+
/**
|
|
59
|
+
* How wide a popup is, for every popup alike: never narrower than the control it opens from (and never under 8rem, for a
|
|
60
|
+
* control that is only an icon), as wide as its longest row up to 28rem or what the window leaves from the control's start
|
|
61
|
+
* (the popup is aligned to that start), whichever is less. A control wider than that cap keeps its own width. Longer rows
|
|
62
|
+
* are cut by their item, they do not widen the popup.
|
|
63
|
+
*
|
|
64
|
+
* The popups used to disagree: the menus were the control's width, MultiSelect at least 16rem and at most 24rem, Combobox
|
|
65
|
+
* followed the control, and an app's command palette in a popover was 18rem whatever it held.
|
|
66
|
+
*/
|
|
67
|
+
export declare const POPUP_LIST_WIDTH_CLASS = "w-max min-w-[max(8rem,var(--anchor-width))] max-w-[max(var(--anchor-width),min(28rem,var(--available-width)))]";
|
|
68
|
+
/**
|
|
69
|
+
* How tall the scrolling part of a popup grows, so that it ends on a whole row. The list scrolls inside its popup and shows
|
|
70
|
+
* at most eight rows (the 2rem each of popupItemClass, and the 0.5rem of padding the list holds above and below them), or
|
|
71
|
+
* as many whole rows as the room the positioner measured allows, whichever is less. `round(down, ...)` is what makes the
|
|
72
|
+
* second case end on a row too: a bare `max-h-(--available-height)` ends wherever the window ends, which cut a row in half
|
|
73
|
+
* at the foot of a short window, and a fixed `max-h-60` cut the eighth row of a long list.
|
|
74
|
+
*
|
|
75
|
+
* It goes on the ScrollArea, which must hold the list's own 0.25rem of padding inside it (the viewport scrolls it with the
|
|
76
|
+
* rows) and sit in a popup that is a flex column.
|
|
52
77
|
*/
|
|
53
|
-
export declare const
|
|
78
|
+
export declare const POPUP_LIST_HEIGHT_CLASS = "min-h-0 max-h-[min(16.5rem,round(down,var(--available-height,100dvh)_-_0.5rem,2rem)_+_0.5rem)]";
|
|
@@ -15,12 +15,37 @@ var POPUP_ITEM_INDICATOR_CLASS = "pointer-events-none absolute right-2 flex size
|
|
|
15
15
|
/** A group's heading in any of these lists. */
|
|
16
16
|
var POPUP_GROUP_LABEL_CLASS = "px-2 py-1.5 text-xs font-medium text-muted-foreground";
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The frame of every popup that holds a list: Select, Combobox, MultiSelect and the menus. One radius, and one outline, the
|
|
19
|
+
* 1px ring of the text colour at 10% that the menus, Popover and the dialogs already wear. It is a ring and not a border so
|
|
20
|
+
* the frame takes no room: the popup is exactly as tall as its rows, which is what lets a list end on a whole row (see
|
|
21
|
+
* POPUP_LIST_HEIGHT_CLASS). Select used to draw a 14px border, Combobox a 10px one, and the menus a ring.
|
|
22
|
+
*
|
|
23
|
+
* `outline-none` is the popup's own focus outline, switched off: a popup is a container, and the highlighted row is where
|
|
24
|
+
* focus is shown.
|
|
21
25
|
*/
|
|
22
|
-
var
|
|
26
|
+
var POPUP_FRAME_CLASS = "rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-none";
|
|
27
|
+
/**
|
|
28
|
+
* How wide a popup is, for every popup alike: never narrower than the control it opens from (and never under 8rem, for a
|
|
29
|
+
* control that is only an icon), as wide as its longest row up to 28rem or what the window leaves from the control's start
|
|
30
|
+
* (the popup is aligned to that start), whichever is less. A control wider than that cap keeps its own width. Longer rows
|
|
31
|
+
* are cut by their item, they do not widen the popup.
|
|
32
|
+
*
|
|
33
|
+
* The popups used to disagree: the menus were the control's width, MultiSelect at least 16rem and at most 24rem, Combobox
|
|
34
|
+
* followed the control, and an app's command palette in a popover was 18rem whatever it held.
|
|
35
|
+
*/
|
|
36
|
+
var POPUP_LIST_WIDTH_CLASS = "w-max min-w-[max(8rem,var(--anchor-width))] max-w-[max(var(--anchor-width),min(28rem,var(--available-width)))]";
|
|
37
|
+
/**
|
|
38
|
+
* How tall the scrolling part of a popup grows, so that it ends on a whole row. The list scrolls inside its popup and shows
|
|
39
|
+
* at most eight rows (the 2rem each of popupItemClass, and the 0.5rem of padding the list holds above and below them), or
|
|
40
|
+
* as many whole rows as the room the positioner measured allows, whichever is less. `round(down, ...)` is what makes the
|
|
41
|
+
* second case end on a row too: a bare `max-h-(--available-height)` ends wherever the window ends, which cut a row in half
|
|
42
|
+
* at the foot of a short window, and a fixed `max-h-60` cut the eighth row of a long list.
|
|
43
|
+
*
|
|
44
|
+
* It goes on the ScrollArea, which must hold the list's own 0.25rem of padding inside it (the viewport scrolls it with the
|
|
45
|
+
* rows) and sit in a popup that is a flex column.
|
|
46
|
+
*/
|
|
47
|
+
var POPUP_LIST_HEIGHT_CLASS = "min-h-0 max-h-[min(16.5rem,round(down,var(--available-height,100dvh)_-_0.5rem,2rem)_+_0.5rem)]";
|
|
23
48
|
//#endregion
|
|
24
|
-
export { POPUP_GROUP_LABEL_CLASS, POPUP_ITEM_INDICATOR_CLASS, POPUP_LIST_WIDTH_CLASS, popupItemClass };
|
|
49
|
+
export { POPUP_FRAME_CLASS, POPUP_GROUP_LABEL_CLASS, POPUP_ITEM_INDICATOR_CLASS, POPUP_LIST_HEIGHT_CLASS, POPUP_LIST_WIDTH_CLASS, popupItemClass };
|
|
25
50
|
|
|
26
51
|
//# sourceMappingURL=popup-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popup-list.js","names":[],"sources":["../../../../../ui/src/lib/popup-list.ts"],"sourcesContent":["import { cn } from '@edyn/ui/lib/utils';\n\n/**\n * The one look for a list in a popup or a menu: the command palette, Select,\n * Combobox, MultiSelect and the dropdown menus.\n *\n * These lists used to disagree with each other in every detail that shows:\n * three different radii, two different paddings, a grey fill for the highlight\n * in one and the accent in another, and the chosen item marked by a check on\n * the left in Select and on the right in the menus. Picking something from one\n * list then felt like a different product from picking something in the next.\n *\n * It lives here as classes rather than as a stylesheet so a caller's own\n * className still wins: an unlayered rule would beat every utility, including\n * the one someone passes for a single list.\n *\n * ONE ITEM: transparent at rest, 32px tall, 6px radius (--radius-sm), 6px by\n * 8px of padding, text-sm, its own icons 16px and muted. Under the pointer or\n * the keyboard it takes one translucent fill of the text colour, and its icons\n * the text colour. Chosen is medium weight with a check at the END, never a\n * fill, so \"where I am\" and \"what I picked\" can be told apart at a glance.\n */\n\n/**\n * Which primitive renders the item, because the two disagree about the same\n * attribute names in a way that silently breaks the styling:\n *\n * - cmdk writes `data-selected=\"false\"` and `data-disabled=\"false\"` on items\n * that are neither, so a bare `data-selected:` variant matches EVERY item and\n * highlights the whole list. Its states have to be matched by value.\n * - Base UI omits the attribute instead, so presence is the test there. That\n * needs the BRACKET form for `selected`: shadcn redefines the bare\n * `data-selected:` variant to match only data-selected=\"true\" (for the\n * calendar), and Base UI writes it as an empty string, so the bare form\n * compiles and silently never applies. `highlighted` and `disabled` have no\n * such override, so those stay bare.\n * - And the same name means different things: cmdk's `data-selected` is the\n * keyboard cursor, Base UI's is the chosen value. In cmdk the chosen state is\n * `data-checked`, which the DS's own CommandItem sets.\n */\nexport type TPopupItemFlavor = 'base-ui' | 'cmdk';\n\nconst ITEM_BASE =\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-foreground outline-none select-none [&>svg]:pointer-events-none [&>svg]:shrink-0 [&>svg]:text-muted-foreground [&>svg:not([class*='size-'])]:size-4\";\n\nconst ITEM_STATES: Record<TPopupItemFlavor, string> = {\n 'base-ui':\n 'data-highlighted:bg-foreground/6 data-highlighted:[&>svg]:text-foreground data-[selected]:font-medium data-disabled:pointer-events-none data-disabled:opacity-50',\n cmdk: 'data-[selected=true]:bg-foreground/6 data-[selected=true]:[&>svg]:text-foreground data-[checked=true]:font-medium data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n};\n\n/** The shared item look. `checkable` leaves room at the end for the check. */\nexport const popupItemClass = (flavor: TPopupItemFlavor = 'base-ui', checkable = false): string =>\n cn(ITEM_BASE, ITEM_STATES[flavor], checkable && 'pr-8');\n\n/**\n * The check's slot, at the end of the item and the same size whether or not the\n * check is in it, so a list does not shift as the choice moves.\n */\nexport const POPUP_ITEM_INDICATOR_CLASS = 'pointer-events-none absolute right-2 flex size-4 items-center justify-center text-foreground';\n\n/** A group's heading in any of these lists. */\nexport const POPUP_GROUP_LABEL_CLASS = 'px-2 py-1.5 text-xs font-medium text-muted-foreground';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"popup-list.js","names":[],"sources":["../../../../../ui/src/lib/popup-list.ts"],"sourcesContent":["import { cn } from '@edyn/ui/lib/utils';\n\n/**\n * The one look for a list in a popup or a menu: the command palette, Select,\n * Combobox, MultiSelect and the dropdown menus.\n *\n * These lists used to disagree with each other in every detail that shows:\n * three different radii, two different paddings, a grey fill for the highlight\n * in one and the accent in another, and the chosen item marked by a check on\n * the left in Select and on the right in the menus. Picking something from one\n * list then felt like a different product from picking something in the next.\n *\n * It lives here as classes rather than as a stylesheet so a caller's own\n * className still wins: an unlayered rule would beat every utility, including\n * the one someone passes for a single list.\n *\n * ONE ITEM: transparent at rest, 32px tall, 6px radius (--radius-sm), 6px by\n * 8px of padding, text-sm, its own icons 16px and muted. Under the pointer or\n * the keyboard it takes one translucent fill of the text colour, and its icons\n * the text colour. Chosen is medium weight with a check at the END, never a\n * fill, so \"where I am\" and \"what I picked\" can be told apart at a glance.\n */\n\n/**\n * Which primitive renders the item, because the two disagree about the same\n * attribute names in a way that silently breaks the styling:\n *\n * - cmdk writes `data-selected=\"false\"` and `data-disabled=\"false\"` on items\n * that are neither, so a bare `data-selected:` variant matches EVERY item and\n * highlights the whole list. Its states have to be matched by value.\n * - Base UI omits the attribute instead, so presence is the test there. That\n * needs the BRACKET form for `selected`: shadcn redefines the bare\n * `data-selected:` variant to match only data-selected=\"true\" (for the\n * calendar), and Base UI writes it as an empty string, so the bare form\n * compiles and silently never applies. `highlighted` and `disabled` have no\n * such override, so those stay bare.\n * - And the same name means different things: cmdk's `data-selected` is the\n * keyboard cursor, Base UI's is the chosen value. In cmdk the chosen state is\n * `data-checked`, which the DS's own CommandItem sets.\n */\nexport type TPopupItemFlavor = 'base-ui' | 'cmdk';\n\nconst ITEM_BASE =\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-foreground outline-none select-none [&>svg]:pointer-events-none [&>svg]:shrink-0 [&>svg]:text-muted-foreground [&>svg:not([class*='size-'])]:size-4\";\n\nconst ITEM_STATES: Record<TPopupItemFlavor, string> = {\n 'base-ui':\n 'data-highlighted:bg-foreground/6 data-highlighted:[&>svg]:text-foreground data-[selected]:font-medium data-disabled:pointer-events-none data-disabled:opacity-50',\n cmdk: 'data-[selected=true]:bg-foreground/6 data-[selected=true]:[&>svg]:text-foreground data-[checked=true]:font-medium data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n};\n\n/** The shared item look. `checkable` leaves room at the end for the check. */\nexport const popupItemClass = (flavor: TPopupItemFlavor = 'base-ui', checkable = false): string =>\n cn(ITEM_BASE, ITEM_STATES[flavor], checkable && 'pr-8');\n\n/**\n * The check's slot, at the end of the item and the same size whether or not the\n * check is in it, so a list does not shift as the choice moves.\n */\nexport const POPUP_ITEM_INDICATOR_CLASS = 'pointer-events-none absolute right-2 flex size-4 items-center justify-center text-foreground';\n\n/** A group's heading in any of these lists. */\nexport const POPUP_GROUP_LABEL_CLASS = 'px-2 py-1.5 text-xs font-medium text-muted-foreground';\n\n/**\n * The frame of every popup that holds a list: Select, Combobox, MultiSelect and the menus. One radius, and one outline, the\n * 1px ring of the text colour at 10% that the menus, Popover and the dialogs already wear. It is a ring and not a border so\n * the frame takes no room: the popup is exactly as tall as its rows, which is what lets a list end on a whole row (see\n * POPUP_LIST_HEIGHT_CLASS). Select used to draw a 14px border, Combobox a 10px one, and the menus a ring.\n *\n * `outline-none` is the popup's own focus outline, switched off: a popup is a container, and the highlighted row is where\n * focus is shown.\n */\nexport const POPUP_FRAME_CLASS = 'rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-none';\n\n/**\n * How wide a popup is, for every popup alike: never narrower than the control it opens from (and never under 8rem, for a\n * control that is only an icon), as wide as its longest row up to 28rem or what the window leaves from the control's start\n * (the popup is aligned to that start), whichever is less. A control wider than that cap keeps its own width. Longer rows\n * are cut by their item, they do not widen the popup.\n *\n * The popups used to disagree: the menus were the control's width, MultiSelect at least 16rem and at most 24rem, Combobox\n * followed the control, and an app's command palette in a popover was 18rem whatever it held.\n */\nexport const POPUP_LIST_WIDTH_CLASS =\n 'w-max min-w-[max(8rem,var(--anchor-width))] max-w-[max(var(--anchor-width),min(28rem,var(--available-width)))]';\n\n/**\n * How tall the scrolling part of a popup grows, so that it ends on a whole row. The list scrolls inside its popup and shows\n * at most eight rows (the 2rem each of popupItemClass, and the 0.5rem of padding the list holds above and below them), or\n * as many whole rows as the room the positioner measured allows, whichever is less. `round(down, ...)` is what makes the\n * second case end on a row too: a bare `max-h-(--available-height)` ends wherever the window ends, which cut a row in half\n * at the foot of a short window, and a fixed `max-h-60` cut the eighth row of a long list.\n *\n * It goes on the ScrollArea, which must hold the list's own 0.25rem of padding inside it (the viewport scrolls it with the\n * rows) and sit in a popup that is a flex column.\n */\nexport const POPUP_LIST_HEIGHT_CLASS = 'min-h-0 max-h-[min(16.5rem,round(down,var(--available-height,100dvh)_-_0.5rem,2rem)_+_0.5rem)]';\n"],"mappings":";;AA0CA,IAAM,YACJ;AAEF,IAAM,cAAgD;CACpD,WACE;CACF,MAAM;AACR;;AAGA,IAAa,kBAAkB,SAA2B,WAAW,YAAY,UAC/E,GAAG,WAAW,YAAY,SAAS,aAAa,MAAM;;;;;AAMxD,IAAa,6BAA6B;;AAG1C,IAAa,0BAA0B;;;;;;;;;;AAWvC,IAAa,oBAAoB;;;;;;;;;;AAWjC,IAAa,yBACX;;;;;;;;;;;AAYF,IAAa,0BAA0B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exsto/ds",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.18",
|
|
4
4
|
"description": "The eDynamix design system: React components and design tokens.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -31,6 +31,14 @@
|
|
|
31
31
|
"types": "./dist/ds/src/date-picker.d.ts",
|
|
32
32
|
"default": "./dist/date-picker.js"
|
|
33
33
|
},
|
|
34
|
+
"./time-field": {
|
|
35
|
+
"types": "./dist/ds/src/time-field.d.ts",
|
|
36
|
+
"default": "./dist/time-field.js"
|
|
37
|
+
},
|
|
38
|
+
"./file-input": {
|
|
39
|
+
"types": "./dist/ds/src/file-input.d.ts",
|
|
40
|
+
"default": "./dist/file-input.js"
|
|
41
|
+
},
|
|
34
42
|
"./rich-text-editor": {
|
|
35
43
|
"types": "./dist/ds/src/rich-text-editor.d.ts",
|
|
36
44
|
"default": "./dist/rich-text-editor.js"
|