@panneau/ui 5.0.0-alpha.6 → 5.0.0-alpha.7
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 +24 -1
- package/dist/alert/Alert.js +108 -40
- package/dist/alert/Alert.js.map +1 -1
- package/dist/alert/tokens.js.map +1 -1
- package/dist/badge/Badge.js +34 -6
- package/dist/badge/Badge.js.map +1 -1
- package/dist/badge/tokens.js.map +1 -1
- package/dist/button/Button.js +111 -17
- package/dist/button/Button.js.map +1 -1
- package/dist/button/tokens.js.map +1 -1
- package/dist/card/Card.js +76 -23
- package/dist/card/Card.js.map +1 -1
- package/dist/card/tokens.js.map +1 -1
- package/dist/checkbox/Checkbox.js +86 -25
- package/dist/checkbox/Checkbox.js.map +1 -1
- package/dist/checkbox/ChoiceChrome.js +82 -21
- package/dist/checkbox/ChoiceChrome.js.map +1 -1
- package/dist/checkbox/tokens.js.map +1 -1
- package/dist/combo-box/ComboBox.js +291 -79
- package/dist/combo-box/ComboBox.js.map +1 -1
- package/dist/command-palette/CommandPalette.js +463 -160
- package/dist/command-palette/CommandPalette.js.map +1 -1
- package/dist/command-palette/match.js.map +1 -1
- package/dist/command-palette/tokens.js.map +1 -1
- package/dist/command-palette/useCommandShortcut.js +31 -12
- package/dist/command-palette/useCommandShortcut.js.map +1 -1
- package/dist/container/Container.js +48 -5
- package/dist/container/Container.js.map +1 -1
- package/dist/container/tokens.js.map +1 -1
- package/dist/date-picker/DatePicker.js +234 -73
- package/dist/date-picker/DatePicker.js.map +1 -1
- package/dist/date-picker/calendarTokens.js.map +1 -1
- package/dist/dialog/Dialog.js +161 -45
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/tokens.js.map +1 -1
- package/dist/disclosure/Disclosure.js +132 -28
- package/dist/disclosure/Disclosure.js.map +1 -1
- package/dist/disclosure/tokens.js.map +1 -1
- package/dist/divider/Divider.js +55 -11
- package/dist/divider/Divider.js.map +1 -1
- package/dist/divider/tokens.js.map +1 -1
- package/dist/field/FieldParts.js +69 -15
- package/dist/field/FieldParts.js.map +1 -1
- package/dist/field/Fieldset.js +99 -32
- package/dist/field/Fieldset.js.map +1 -1
- package/dist/field/inputTokens.js.map +1 -1
- package/dist/field/tokens.js.map +1 -1
- package/dist/grid/Grid.js +123 -14
- package/dist/grid/Grid.js.map +1 -1
- package/dist/grid/tokens.js.map +1 -1
- package/dist/heading/Heading.js +41 -6
- package/dist/heading/Heading.js.map +1 -1
- package/dist/heading/tokens.js.map +1 -1
- package/dist/icon/Icon.js +36 -11
- package/dist/icon/Icon.js.map +1 -1
- package/dist/icon/lucideIconLoader.js.map +1 -1
- package/dist/icon/namedIcons.js +87 -26
- package/dist/icon/namedIcons.js.map +1 -1
- package/dist/icon-button/IconButton.js +70 -13
- package/dist/icon-button/IconButton.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/inline/Inline.js +65 -7
- package/dist/inline/Inline.js.map +1 -1
- package/dist/inline/tokens.js.map +1 -1
- package/dist/intl/usePanneauIntl.js.map +1 -1
- package/dist/layout/responsive.js.map +1 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/menu/Menu.js +170 -44
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/tokens.js.map +1 -1
- package/dist/number-input/NumberInput.js +232 -60
- package/dist/number-input/NumberInput.js.map +1 -1
- package/dist/number-input/tokens.js.map +1 -1
- package/dist/pill-trigger/PillTrigger.js +76 -20
- package/dist/pill-trigger/PillTrigger.js.map +1 -1
- package/dist/pill-trigger/tokens.js.map +1 -1
- package/dist/popover/Popover.js +109 -18
- package/dist/popover/Popover.js.map +1 -1
- package/dist/popover/tokens.js.map +1 -1
- package/dist/prose/Prose.js +36 -5
- package/dist/prose/Prose.js.map +1 -1
- package/dist/prose/tokens.js.map +1 -1
- package/dist/radio-group/RadioGroup.js +211 -61
- package/dist/radio-group/RadioGroup.js.map +1 -1
- package/dist/radio-group/tokens.js.map +1 -1
- package/dist/root/PanneauRoot.js +197 -49
- package/dist/root/PanneauRoot.js.map +1 -1
- package/dist/root/ThemeScope.js +107 -26
- package/dist/root/ThemeScope.js.map +1 -1
- package/dist/segmented-control/SegmentedControl.js +120 -22
- package/dist/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/segmented-control/tokens.js.map +1 -1
- package/dist/select/Select.js +298 -92
- package/dist/select/Select.js.map +1 -1
- package/dist/select/listBoxTokens.js.map +1 -1
- package/dist/skeleton/LoadingRegion.d.ts +16 -0
- package/dist/skeleton/LoadingRegion.d.ts.map +1 -0
- package/dist/skeleton/LoadingRegion.js +65 -0
- package/dist/skeleton/LoadingRegion.js.map +1 -0
- package/dist/skeleton/Skeleton.css +62 -0
- package/dist/skeleton/Skeleton.d.ts +25 -0
- package/dist/skeleton/Skeleton.d.ts.map +1 -0
- package/dist/skeleton/Skeleton.js +106 -0
- package/dist/skeleton/Skeleton.js.map +1 -0
- package/dist/skeleton/Skeleton.module.js +22 -0
- package/dist/skeleton/Skeleton.module.js.map +1 -0
- package/dist/skeleton/tokens.d.ts +3 -0
- package/dist/skeleton/tokens.d.ts.map +1 -0
- package/dist/skeleton/tokens.js +15 -0
- package/dist/skeleton/tokens.js.map +1 -0
- package/dist/slider/Slider.js +222 -44
- package/dist/slider/Slider.js.map +1 -1
- package/dist/spinner/Spinner.js +49 -9
- package/dist/spinner/Spinner.js.map +1 -1
- package/dist/spinner/tokens.js.map +1 -1
- package/dist/stack/Stack.js +60 -7
- package/dist/stack/Stack.js.map +1 -1
- package/dist/stack/tokens.js.map +1 -1
- package/dist/switch/Switch.js +68 -11
- package/dist/switch/Switch.js.map +1 -1
- package/dist/switch/tokens.js.map +1 -1
- package/dist/tabs/Tabs.js +1 -1
- package/dist/tabs/Tabs.js.map +1 -1
- package/dist/tabs/tokens.js.map +1 -1
- package/dist/tags-input/TagsInput.js +277 -121
- package/dist/tags-input/TagsInput.js.map +1 -1
- package/dist/text/Text.js +70 -5
- package/dist/text/Text.js.map +1 -1
- package/dist/text/tokens.js.map +1 -1
- package/dist/text-area/TextArea.js +135 -28
- package/dist/text-area/TextArea.js.map +1 -1
- package/dist/text-input/TextInput.js +164 -49
- package/dist/text-input/TextInput.js.map +1 -1
- package/dist/theme/bootstrap.js.map +1 -1
- package/dist/theme/chartColors.js.map +1 -1
- package/dist/theme/checkTheme.js.map +1 -1
- package/dist/theme/cli.js.map +1 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/colorVision.js.map +1 -1
- package/dist/theme/componentTokens.js.map +1 -1
- package/dist/theme/components.d.ts +1 -0
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +2 -0
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/defineTheme.js.map +1 -1
- package/dist/theme/fonts.js.map +1 -1
- package/dist/theme/semanticTokens.js.map +1 -1
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/toneClass.js.map +1 -1
- package/dist/theme/tones.js.map +1 -1
- package/dist/time-input/TimeInput.js +138 -31
- package/dist/time-input/TimeInput.js.map +1 -1
- package/dist/toast/Toast.js +1 -1
- package/dist/toast/Toast.js.map +1 -1
- package/dist/toast/tokens.js.map +1 -1
- package/dist/tooltip/Tooltip.js +38 -8
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/tokens.js.map +1 -1
- package/dist/utils/cx.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["allFr"],"sources":["../../src/locales/index.ts"],"sourcesContent":["import { fr as allFr, getDefaultMessages } from '@panneau/intl';\n\nimport { messages } from '../intl/messages';\n\n/**\n * The English messages of `@panneau/ui`, by id. They are also the default messages.\n *\n * @deprecated Use `en`, or `withPanneauMessages()`, from `@panneau/intl`: they have the messages\n * of every package.\n */\nexport const en: Record<string, string> = getDefaultMessages(messages);\n\n/**\n * The French messages of `@panneau/ui`, by id.\n *\n * @deprecated Use `fr`, or `withPanneauMessages()`, from `@panneau/intl`: they have the messages\n * of every package.\n */\nexport const fr: Record<string, string> = Object.fromEntries(\n Object.entries(allFr).filter(([id]) => id in en),\n);\n"],"mappings":";;;;;;;;;AAUA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["fr","allFr","getDefaultMessages","messages","en","Record","Object","fromEntries","entries","filter","id","allFr"],"sources":["../../src/locales/index.ts"],"sourcesContent":["import { fr as allFr, getDefaultMessages } from '@panneau/intl';\n\nimport { messages } from '../intl/messages';\n\n/**\n * The English messages of `@panneau/ui`, by id. They are also the default messages.\n *\n * @deprecated Use `en`, or `withPanneauMessages()`, from `@panneau/intl`: they have the messages\n * of every package.\n */\nexport const en: Record<string, string> = getDefaultMessages(messages);\n\n/**\n * The French messages of `@panneau/ui`, by id.\n *\n * @deprecated Use `fr`, or `withPanneauMessages()`, from `@panneau/intl`: they have the messages\n * of every package.\n */\nexport const fr: Record<string, string> = Object.fromEntries(\n Object.entries(allFr).filter(([id]) => id in en),\n);\n"],"mappings":";;;;;;;;;AAUA,IAAaI,KAA6BF,mBAAmBC,QAAQ;;;;;;;AAQrE,IAAaH,KAA6BM,OAAOC,YAC7CD,OAAOE,QAAQP,IAAK,CAAC,CAACQ,QAAQ,CAACC,QAAQA,MAAMN,EAAE,CACnD"}
|
package/dist/menu/Menu.js
CHANGED
|
@@ -3,74 +3,200 @@ import { Icon } from "../icon/Icon.js";
|
|
|
3
3
|
import { PopoverSurface } from "../popover/Popover.js";
|
|
4
4
|
import ListBox_module_default from "../select/ListBox.module.js";
|
|
5
5
|
import Menu_module_default from "./Menu.module.js";
|
|
6
|
+
import { c } from "react/compiler-runtime";
|
|
6
7
|
import { Check } from "lucide-react";
|
|
7
8
|
import { Header, Menu, MenuItem, MenuSection, MenuTrigger, Separator, Text } from "react-aria-components";
|
|
8
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { useId } from "react";
|
|
10
|
-
import { c } from "react/compiler-runtime";
|
|
11
11
|
//#region src/menu/Menu.tsx
|
|
12
12
|
/**
|
|
13
13
|
* A menu of actions, inside a `MenuTrigger` with its button as the first child. Arrow keys move
|
|
14
14
|
* between items, and typing a letter jumps to an item. With `selectionMode` (`single` or
|
|
15
15
|
* `multiple`) and `selectedKeys`, its items are choices, and the selected ones have a check.
|
|
16
16
|
*/
|
|
17
|
-
function Menu$1(
|
|
17
|
+
function Menu$1(t0) {
|
|
18
|
+
const $ = c(27);
|
|
19
|
+
let className;
|
|
20
|
+
let footer;
|
|
21
|
+
let footerClassName;
|
|
22
|
+
let popoverClassName;
|
|
23
|
+
let props;
|
|
24
|
+
let t1;
|
|
25
|
+
if ($[0] !== t0) {
|
|
26
|
+
({className, popoverClassName, placement: t1, footer, footerClassName, ...props} = t0);
|
|
27
|
+
$[0] = t0;
|
|
28
|
+
$[1] = className;
|
|
29
|
+
$[2] = footer;
|
|
30
|
+
$[3] = footerClassName;
|
|
31
|
+
$[4] = popoverClassName;
|
|
32
|
+
$[5] = props;
|
|
33
|
+
$[6] = t1;
|
|
34
|
+
} else {
|
|
35
|
+
className = $[1];
|
|
36
|
+
footer = $[2];
|
|
37
|
+
footerClassName = $[3];
|
|
38
|
+
popoverClassName = $[4];
|
|
39
|
+
props = $[5];
|
|
40
|
+
t1 = $[6];
|
|
41
|
+
}
|
|
42
|
+
const placement = t1 === void 0 ? "bottom start" : t1;
|
|
18
43
|
const footerId = useId();
|
|
19
44
|
const hasFooter = footer !== void 0 && footer !== null;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[7] !== footerId || $[8] !== hasFooter || $[9] !== props) {
|
|
47
|
+
t2 = hasFooter ? [props["aria-describedby"], footerId].filter(Boolean).join(" ") : props["aria-describedby"];
|
|
48
|
+
$[7] = footerId;
|
|
49
|
+
$[8] = hasFooter;
|
|
50
|
+
$[9] = props;
|
|
51
|
+
$[10] = t2;
|
|
52
|
+
} else t2 = $[10];
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[11] !== className) {
|
|
55
|
+
t3 = cx("panneau-menu", ListBox_module_default.listBox, className);
|
|
56
|
+
$[11] = className;
|
|
57
|
+
$[12] = t3;
|
|
58
|
+
} else t3 = $[12];
|
|
59
|
+
let t4;
|
|
60
|
+
if ($[13] !== props || $[14] !== t2 || $[15] !== t3) {
|
|
61
|
+
t4 = /* @__PURE__ */ jsx(Menu, {
|
|
62
|
+
...props,
|
|
63
|
+
"aria-describedby": t2,
|
|
64
|
+
className: t3
|
|
65
|
+
});
|
|
66
|
+
$[13] = props;
|
|
67
|
+
$[14] = t2;
|
|
68
|
+
$[15] = t3;
|
|
69
|
+
$[16] = t4;
|
|
70
|
+
} else t4 = $[16];
|
|
71
|
+
const menu = t4;
|
|
72
|
+
let t5;
|
|
73
|
+
if ($[17] !== footer || $[18] !== footerClassName || $[19] !== footerId || $[20] !== hasFooter || $[21] !== menu) {
|
|
74
|
+
t5 = hasFooter ? /* @__PURE__ */ jsxs("div", {
|
|
29
75
|
className: Menu_module_default.layout,
|
|
30
76
|
children: [menu, /* @__PURE__ */ jsx("div", {
|
|
31
77
|
id: footerId,
|
|
32
78
|
className: cx(Menu_module_default.footer, footerClassName),
|
|
33
79
|
children: footer
|
|
34
80
|
})]
|
|
35
|
-
}) : menu
|
|
36
|
-
|
|
81
|
+
}) : menu;
|
|
82
|
+
$[17] = footer;
|
|
83
|
+
$[18] = footerClassName;
|
|
84
|
+
$[19] = footerId;
|
|
85
|
+
$[20] = hasFooter;
|
|
86
|
+
$[21] = menu;
|
|
87
|
+
$[22] = t5;
|
|
88
|
+
} else t5 = $[22];
|
|
89
|
+
let t6;
|
|
90
|
+
if ($[23] !== placement || $[24] !== popoverClassName || $[25] !== t5) {
|
|
91
|
+
t6 = /* @__PURE__ */ jsx(PopoverSurface, {
|
|
92
|
+
placement,
|
|
93
|
+
className: popoverClassName,
|
|
94
|
+
children: t5
|
|
95
|
+
});
|
|
96
|
+
$[23] = placement;
|
|
97
|
+
$[24] = popoverClassName;
|
|
98
|
+
$[25] = t5;
|
|
99
|
+
$[26] = t6;
|
|
100
|
+
} else t6 = $[26];
|
|
101
|
+
return t6;
|
|
37
102
|
}
|
|
38
103
|
/**
|
|
39
104
|
* An item of a `Menu`. In a menu with a `selectionMode`, a selected item has a check at its end,
|
|
40
105
|
* and the role of a radio (single) or a checkbox (multiple) item.
|
|
41
106
|
*/
|
|
42
|
-
function MenuItem$1(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
107
|
+
function MenuItem$1(t0) {
|
|
108
|
+
const $ = c(22);
|
|
109
|
+
let children;
|
|
110
|
+
let className;
|
|
111
|
+
let description;
|
|
112
|
+
let icon;
|
|
113
|
+
let media;
|
|
114
|
+
let props;
|
|
115
|
+
let t1;
|
|
116
|
+
let textValue;
|
|
117
|
+
if ($[0] !== t0) {
|
|
118
|
+
({children, icon, media, description, isDanger: t1, className, textValue, ...props} = t0);
|
|
119
|
+
$[0] = t0;
|
|
120
|
+
$[1] = children;
|
|
121
|
+
$[2] = className;
|
|
122
|
+
$[3] = description;
|
|
123
|
+
$[4] = icon;
|
|
124
|
+
$[5] = media;
|
|
125
|
+
$[6] = props;
|
|
126
|
+
$[7] = t1;
|
|
127
|
+
$[8] = textValue;
|
|
128
|
+
} else {
|
|
129
|
+
children = $[1];
|
|
130
|
+
className = $[2];
|
|
131
|
+
description = $[3];
|
|
132
|
+
icon = $[4];
|
|
133
|
+
media = $[5];
|
|
134
|
+
props = $[6];
|
|
135
|
+
t1 = $[7];
|
|
136
|
+
textValue = $[8];
|
|
137
|
+
}
|
|
138
|
+
const isDanger = t1 === void 0 ? false : t1;
|
|
139
|
+
const t2 = textValue ?? (typeof children === "string" ? children : void 0);
|
|
140
|
+
let t3;
|
|
141
|
+
if ($[9] !== className) {
|
|
142
|
+
t3 = cx("panneau-menu-item", ListBox_module_default.item, Menu_module_default.item, className);
|
|
143
|
+
$[9] = className;
|
|
144
|
+
$[10] = t3;
|
|
145
|
+
} else t3 = $[10];
|
|
146
|
+
const t4 = isDanger || void 0;
|
|
147
|
+
let t5;
|
|
148
|
+
if ($[11] !== children || $[12] !== description || $[13] !== icon || $[14] !== media) {
|
|
149
|
+
t5 = (t6) => {
|
|
150
|
+
const { isSelected, selectionMode } = t6;
|
|
151
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
152
|
+
media !== void 0 && media !== null ? /* @__PURE__ */ jsx("span", {
|
|
153
|
+
className: Menu_module_default.media,
|
|
154
|
+
children: media
|
|
155
|
+
}) : icon !== void 0 ? /* @__PURE__ */ jsx(Icon, { icon }) : null,
|
|
156
|
+
/* @__PURE__ */ jsxs("span", {
|
|
157
|
+
className: ListBox_module_default.itemText,
|
|
158
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
159
|
+
slot: "label",
|
|
160
|
+
className: ListBox_module_default.itemLabel,
|
|
161
|
+
children
|
|
162
|
+
}), description !== void 0 ? /* @__PURE__ */ jsx(Text, {
|
|
163
|
+
slot: "description",
|
|
164
|
+
className: ListBox_module_default.itemDescription,
|
|
165
|
+
children: description
|
|
166
|
+
}) : null]
|
|
167
|
+
}),
|
|
168
|
+
selectionMode !== "none" ? /* @__PURE__ */ jsx("span", {
|
|
169
|
+
className: Menu_module_default.check,
|
|
170
|
+
children: isSelected ? /* @__PURE__ */ jsx(Icon, {
|
|
171
|
+
icon: Check,
|
|
172
|
+
size: "sm"
|
|
173
|
+
}) : null
|
|
70
174
|
}) : null
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
|
|
175
|
+
] });
|
|
176
|
+
};
|
|
177
|
+
$[11] = children;
|
|
178
|
+
$[12] = description;
|
|
179
|
+
$[13] = icon;
|
|
180
|
+
$[14] = media;
|
|
181
|
+
$[15] = t5;
|
|
182
|
+
} else t5 = $[15];
|
|
183
|
+
let t6;
|
|
184
|
+
if ($[16] !== props || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5) {
|
|
185
|
+
t6 = /* @__PURE__ */ jsx(MenuItem, {
|
|
186
|
+
...props,
|
|
187
|
+
textValue: t2,
|
|
188
|
+
className: t3,
|
|
189
|
+
"data-danger": t4,
|
|
190
|
+
children: t5
|
|
191
|
+
});
|
|
192
|
+
$[16] = props;
|
|
193
|
+
$[17] = t2;
|
|
194
|
+
$[18] = t3;
|
|
195
|
+
$[19] = t4;
|
|
196
|
+
$[20] = t5;
|
|
197
|
+
$[21] = t6;
|
|
198
|
+
} else t6 = $[21];
|
|
199
|
+
return t6;
|
|
74
200
|
}
|
|
75
201
|
/** A group of items of a `Menu`, with a header. */
|
|
76
202
|
function MenuSection$1(t0) {
|
package/dist/menu/Menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","names":["title","children","Menu","AriaMenu","listBoxStyles","styles","MenuItem","AriaMenuItem","_Fragment","MenuSection","_c","AriaMenuSection"],"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["import { Check } from 'lucide-react';\nimport { type ReactNode, useId } from 'react';\nimport {\n Menu as AriaMenu,\n MenuItem as AriaMenuItem,\n type MenuItemProps as AriaMenuItemProps,\n type MenuProps as AriaMenuProps,\n MenuSection as AriaMenuSection,\n type MenuSectionProps as AriaMenuSectionProps,\n Header,\n Separator,\n Text,\n} from 'react-aria-components';\n\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { PopoverSurface } from '../popover/Popover';\nimport listBoxStyles from '../select/ListBox.module.css';\nimport { cx } from '../utils/cx';\nimport styles from './Menu.module.css';\n\nexport interface MenuProps<T extends object> extends Omit<AriaMenuProps<T>, 'className' | 'style'> {\n className?: string;\n popoverClassName?: string;\n placement?: 'bottom start' | 'bottom end' | 'top start' | 'top end';\n /**\n * A short note under the items, after a line, such as \"Only this step changes.\". It isn't an\n * item and can't be focused: the menu is described by it.\n */\n footer?: ReactNode;\n footerClassName?: string;\n}\n\n/**\n * A menu of actions, inside a `MenuTrigger` with its button as the first child. Arrow keys move\n * between items, and typing a letter jumps to an item. With `selectionMode` (`single` or\n * `multiple`) and `selectedKeys`, its items are choices, and the selected ones have a check.\n */\nexport function Menu<T extends object>({\n className,\n popoverClassName,\n placement = 'bottom start',\n footer,\n footerClassName,\n ...props\n}: MenuProps<T>) {\n const footerId = useId();\n const hasFooter = footer !== undefined && footer !== null;\n const menu = (\n <AriaMenu\n {...props}\n aria-describedby={\n hasFooter\n ? [props['aria-describedby'], footerId].filter(Boolean).join(' ')\n : props['aria-describedby']\n }\n className={cx('panneau-menu', listBoxStyles.listBox, className)}\n />\n );\n return (\n <PopoverSurface placement={placement} className={popoverClassName}>\n {hasFooter ? (\n <div className={styles.layout}>\n {menu}\n <div id={footerId} className={cx(styles.footer, footerClassName)}>\n {footer}\n </div>\n </div>\n ) : (\n menu\n )}\n </PopoverSurface>\n );\n}\n\nexport interface MenuItemProps extends Omit<AriaMenuItemProps, 'className' | 'style' | 'children'> {\n children?: ReactNode;\n icon?: IconComponent;\n /**\n * Leading media instead of an icon, such as an avatar or an image, sized with the item: larger\n * when the item has a description.\n */\n media?: ReactNode;\n description?: string;\n /** Styles the item as destructive. */\n isDanger?: boolean;\n className?: string;\n}\n\n/**\n * An item of a `Menu`. In a menu with a `selectionMode`, a selected item has a check at its end,\n * and the role of a radio (single) or a checkbox (multiple) item.\n */\nexport function MenuItem({\n children,\n icon,\n media,\n description,\n isDanger = false,\n className,\n textValue,\n ...props\n}: MenuItemProps) {\n return (\n <AriaMenuItem\n {...props}\n textValue={textValue ?? (typeof children === 'string' ? children : undefined)}\n className={cx('panneau-menu-item', listBoxStyles.item, styles.item, className)}\n data-danger={isDanger || undefined}\n >\n {({ isSelected, selectionMode }) => (\n <>\n {media !== undefined && media !== null ? (\n <span className={styles.media}>{media}</span>\n ) : icon !== undefined ? (\n <Icon icon={icon} />\n ) : null}\n <span className={listBoxStyles.itemText}>\n <Text slot=\"label\" className={listBoxStyles.itemLabel}>\n {children}\n </Text>\n {description !== undefined ? (\n <Text slot=\"description\" className={listBoxStyles.itemDescription}>\n {description}\n </Text>\n ) : null}\n </span>\n {selectionMode !== 'none' ? (\n <span className={styles.check}>\n {isSelected ? <Icon icon={Check} size=\"sm\" /> : null}\n </span>\n ) : null}\n </>\n )}\n </AriaMenuItem>\n );\n}\n\nexport interface MenuSectionProps<T extends object> extends Omit<\n AriaMenuSectionProps<T>,\n 'className' | 'style' | 'children' | 'items'\n> {\n /**\n * The header of the section, a small muted eyebrow above its items, such as \"Publish on\". It\n * labels the group. Without it, give the section an `aria-label`.\n */\n title?: ReactNode;\n children?: ReactNode;\n className?: string;\n headerClassName?: string;\n}\n\n/** A group of items of a `Menu`, with a header. */\nexport function MenuSection<T extends object>({\n title,\n children,\n className,\n headerClassName,\n ...props\n}: MenuSectionProps<T>) {\n return (\n <AriaMenuSection {...props} className={cx(styles.section, className)}>\n {title !== undefined && title !== null ? (\n <Header className={cx(styles.header, headerClassName)}>{title}</Header>\n ) : null}\n {children}\n </AriaMenuSection>\n );\n}\n\n/** A line between groups of menu items. */\nexport function MenuSeparator() {\n return <Separator className={listBoxStyles.separator} />;\n}\n\nexport { MenuTrigger } from 'react-aria-components';\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,SAAgBE,OAAuB,EACnC,WACA,kBACA,YAAY,gBACZ,QACA,iBACA,GAAG,SACU;CACb,MAAM,WAAW,MAAM;CACvB,MAAM,YAAY,WAAW,KAAA,KAAa,WAAW;CACrD,MAAM,OACF,oB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K1B,SAAO,gBAAA;CAAA,MAAA,IAAAD,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EACI,KAAA,oBAAC,WAAD,EAAsB,WAAAN,uBAAa,UAAU,CAAA;EAAI,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAAjD;AAAiD"}
|
|
1
|
+
{"version":3,"file":"Menu.js","names":["Check","ReactNode","useId","Menu","AriaMenu","MenuItem","AriaMenuItem","MenuItemProps","AriaMenuItemProps","MenuProps","AriaMenuProps","MenuSection","AriaMenuSection","MenuSectionProps","AriaMenuSectionProps","Header","Separator","Text","Icon","IconComponent","PopoverSurface","listBoxStyles","cx","styles","Omit","T","className","popoverClassName","placement","footer","footerClassName","t0","$","_c","props","t1","undefined","footerId","hasFooter","t2","filter","Boolean","join","t3","listBox","t4","menu","t5","layout","t6","children","icon","media","description","isDanger","textValue","item","isSelected","selectionMode","itemText","itemLabel","itemDescription","check","title","headerClassName","section","header","MenuSeparator","Symbol","for","separator","MenuTrigger","Menu","_c","listBoxStyles","AriaMenu","styles","MenuItem","_Fragment","AriaMenuItem","MenuSection","AriaMenuSection"],"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["import { Check } from 'lucide-react';\nimport { type ReactNode, useId } from 'react';\nimport {\n Menu as AriaMenu,\n MenuItem as AriaMenuItem,\n type MenuItemProps as AriaMenuItemProps,\n type MenuProps as AriaMenuProps,\n MenuSection as AriaMenuSection,\n type MenuSectionProps as AriaMenuSectionProps,\n Header,\n Separator,\n Text,\n} from 'react-aria-components';\n\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { PopoverSurface } from '../popover/Popover';\nimport listBoxStyles from '../select/ListBox.module.css';\nimport { cx } from '../utils/cx';\nimport styles from './Menu.module.css';\n\nexport interface MenuProps<T extends object> extends Omit<AriaMenuProps<T>, 'className' | 'style'> {\n className?: string;\n popoverClassName?: string;\n placement?: 'bottom start' | 'bottom end' | 'top start' | 'top end';\n /**\n * A short note under the items, after a line, such as \"Only this step changes.\". It isn't an\n * item and can't be focused: the menu is described by it.\n */\n footer?: ReactNode;\n footerClassName?: string;\n}\n\n/**\n * A menu of actions, inside a `MenuTrigger` with its button as the first child. Arrow keys move\n * between items, and typing a letter jumps to an item. With `selectionMode` (`single` or\n * `multiple`) and `selectedKeys`, its items are choices, and the selected ones have a check.\n */\nexport function Menu<T extends object>({\n className,\n popoverClassName,\n placement = 'bottom start',\n footer,\n footerClassName,\n ...props\n}: MenuProps<T>) {\n const footerId = useId();\n const hasFooter = footer !== undefined && footer !== null;\n const menu = (\n <AriaMenu\n {...props}\n aria-describedby={\n hasFooter\n ? [props['aria-describedby'], footerId].filter(Boolean).join(' ')\n : props['aria-describedby']\n }\n className={cx('panneau-menu', listBoxStyles.listBox, className)}\n />\n );\n return (\n <PopoverSurface placement={placement} className={popoverClassName}>\n {hasFooter ? (\n <div className={styles.layout}>\n {menu}\n <div id={footerId} className={cx(styles.footer, footerClassName)}>\n {footer}\n </div>\n </div>\n ) : (\n menu\n )}\n </PopoverSurface>\n );\n}\n\nexport interface MenuItemProps extends Omit<AriaMenuItemProps, 'className' | 'style' | 'children'> {\n children?: ReactNode;\n icon?: IconComponent;\n /**\n * Leading media instead of an icon, such as an avatar or an image, sized with the item: larger\n * when the item has a description.\n */\n media?: ReactNode;\n description?: string;\n /** Styles the item as destructive. */\n isDanger?: boolean;\n className?: string;\n}\n\n/**\n * An item of a `Menu`. In a menu with a `selectionMode`, a selected item has a check at its end,\n * and the role of a radio (single) or a checkbox (multiple) item.\n */\nexport function MenuItem({\n children,\n icon,\n media,\n description,\n isDanger = false,\n className,\n textValue,\n ...props\n}: MenuItemProps) {\n return (\n <AriaMenuItem\n {...props}\n textValue={textValue ?? (typeof children === 'string' ? children : undefined)}\n className={cx('panneau-menu-item', listBoxStyles.item, styles.item, className)}\n data-danger={isDanger || undefined}\n >\n {({ isSelected, selectionMode }) => (\n <>\n {media !== undefined && media !== null ? (\n <span className={styles.media}>{media}</span>\n ) : icon !== undefined ? (\n <Icon icon={icon} />\n ) : null}\n <span className={listBoxStyles.itemText}>\n <Text slot=\"label\" className={listBoxStyles.itemLabel}>\n {children}\n </Text>\n {description !== undefined ? (\n <Text slot=\"description\" className={listBoxStyles.itemDescription}>\n {description}\n </Text>\n ) : null}\n </span>\n {selectionMode !== 'none' ? (\n <span className={styles.check}>\n {isSelected ? <Icon icon={Check} size=\"sm\" /> : null}\n </span>\n ) : null}\n </>\n )}\n </AriaMenuItem>\n );\n}\n\nexport interface MenuSectionProps<T extends object> extends Omit<\n AriaMenuSectionProps<T>,\n 'className' | 'style' | 'children' | 'items'\n> {\n /**\n * The header of the section, a small muted eyebrow above its items, such as \"Publish on\". It\n * labels the group. Without it, give the section an `aria-label`.\n */\n title?: ReactNode;\n children?: ReactNode;\n className?: string;\n headerClassName?: string;\n}\n\n/** A group of items of a `Menu`, with a header. */\nexport function MenuSection<T extends object>({\n title,\n children,\n className,\n headerClassName,\n ...props\n}: MenuSectionProps<T>) {\n return (\n <AriaMenuSection {...props} className={cx(styles.section, className)}>\n {title !== undefined && title !== null ? (\n <Header className={cx(styles.header, headerClassName)}>{title}</Header>\n ) : null}\n {children}\n </AriaMenuSection>\n );\n}\n\n/** A line between groups of menu items. */\nexport function MenuSeparator() {\n return <Separator className={listBoxStyles.separator} />;\n}\n\nexport { MenuTrigger } from 'react-aria-components';\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,SAAOG,OAAA4B,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAP;CAAA,IAAAG;CAAA,IAAAC;CAAA,IAAAH;CAAA,IAAAO;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAgC,CAAA,CAAAL,WAAAC,kBAAAC,WAAAO,IAAAN,QAAAC,iBAAA,GAAAI,SAAAH;EAOxBC,EAAA,KAAAD;EAAAC,EAAA,KAAAN;EAAAM,EAAA,KAAAH;EAAAG,EAAA,KAA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KAAAH,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAgC,mBAAAhC,EAAA,OAAA+B,OAAA;EAC/DxB,KAAAwB,UAAU3B,KAAAA,KAAa2B,UAAU,OAC9B,oBAAC,QAAD;GAAmB,WAAAzC,GAAGC,oBAAM2C,QAASF,eAAe;GAAID,UAAAA;EAAjD,CAAA,IADV;EAEO/B,EAAA,KAAAgC;EAAAhC,EAAA,KAAA+B;EAAA/B,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,QAAAkB,YAAAlB,EAAA,QAAAE,SAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAO,IAAA;EAHZI,KAAA,qBAACsC,aAAD;GAAgB,GAAK/C;GAAkB,WAAAC;GAAvC,UAAA,CACKI,IAGAW,QAJW;;EAKElB,EAAA,MAAAkB;EAAAlB,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAO;EAAAP,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OALlBW;AAKkB;;AAK1B,SAAOwB,gBAAA;CAAA,MAAAnC,IAAAC,EAAA,CAAA;CAAA,IAAAF;CAAA,IAAAC,EAAA,OAAAoC,OAAAC,IAAA,2BAAA,GAAA;EACItC,KAAA,oBAAC,WAAD,EAAsB,WAAAV,uBAAaiD,UAAU,CAAA;EAAItC,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CAAA,OAAjDD;AAAiD"}
|
package/dist/menu/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/menu/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Menu: its sections, its footer, and the media and selection of its items. */\nexport const menuTokens = defineComponentTokens('menu', {\n /** Font size of the header of a section. */\n 'header-font-size': 'var(--panneau-font-size-xs)',\n /** Font weight of the header of a section. */\n 'header-font-weight': 'var(--panneau-font-weight-medium)',\n /** Color of the header of a section. */\n 'header-color': 'var(--panneau-color-text-muted)',\n /** Case of the header of a section: `uppercase` makes it an eyebrow, `none` keeps its text. */\n 'header-text-transform': 'uppercase',\n /** Letter spacing of the header of a section. */\n 'header-letter-spacing': '0.04em',\n /** Font size of the footer note. */\n 'footer-font-size': 'var(--panneau-font-size-xs)',\n /** Color of the footer note. */\n 'footer-color': 'var(--panneau-color-text-muted)',\n /** Size of the leading media of an item. */\n 'media-size': '1.5rem',\n /** Size of the leading media of an item with a description, on two lines. */\n 'media-size-described': '2rem',\n /** Corner radius of the leading media of an item: its content is clipped to it. */\n 'media-radius': 'var(--panneau-radius-full)',\n /** Background of a selected item. */\n 'item-bg-selected': 'var(--panneau-color-surface-sunken)',\n});\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","menuTokens"],"sources":["../../src/menu/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Menu: its sections, its footer, and the media and selection of its items. */\nexport const menuTokens = defineComponentTokens('menu', {\n /** Font size of the header of a section. */\n 'header-font-size': 'var(--panneau-font-size-xs)',\n /** Font weight of the header of a section. */\n 'header-font-weight': 'var(--panneau-font-weight-medium)',\n /** Color of the header of a section. */\n 'header-color': 'var(--panneau-color-text-muted)',\n /** Case of the header of a section: `uppercase` makes it an eyebrow, `none` keeps its text. */\n 'header-text-transform': 'uppercase',\n /** Letter spacing of the header of a section. */\n 'header-letter-spacing': '0.04em',\n /** Font size of the footer note. */\n 'footer-font-size': 'var(--panneau-font-size-xs)',\n /** Color of the footer note. */\n 'footer-color': 'var(--panneau-color-text-muted)',\n /** Size of the leading media of an item. */\n 'media-size': '1.5rem',\n /** Size of the leading media of an item with a description, on two lines. */\n 'media-size-described': '2rem',\n /** Corner radius of the leading media of an item: its content is clipped to it. */\n 'media-radius': 'var(--panneau-radius-full)',\n /** Background of a selected item. */\n 'item-bg-selected': 'var(--panneau-color-surface-sunken)',\n});\n"],"mappings":";;;AAGA,IAAaC,aAAaD,sBAAsB,QAAQ;;CAEpD,oBAAoB;;CAEpB,sBAAsB;;CAEtB,gBAAgB;;CAEhB,yBAAyB;;CAEzB,yBAAyB;;CAEzB,oBAAoB;;CAEpB,gBAAgB;;CAEhB,cAAc;;CAEd,wBAAwB;;CAExB,gBAAgB;;CAEhB,oBAAoB;AACxB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { Icon } from "../icon/Icon.js";
|
|
|
3
3
|
import Field_module_default from "../field/Field.module.js";
|
|
4
4
|
import { FieldDescription, FieldErrors, FieldLabel } from "../field/FieldParts.js";
|
|
5
5
|
import NumberInput_module_default from "./NumberInput.module.js";
|
|
6
|
+
import { c } from "react/compiler-runtime";
|
|
6
7
|
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
7
8
|
import { Button, Group, Input, NumberField } from "react-aria-components";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -14,67 +15,238 @@ function toAria(value) {
|
|
|
14
15
|
* A number input, formatted for the locale, with steppers and arrow keys. An empty input is
|
|
15
16
|
* `null`, not `NaN`.
|
|
16
17
|
*/
|
|
17
|
-
function NumberInput(
|
|
18
|
+
function NumberInput(t0) {
|
|
19
|
+
const $ = c(69);
|
|
20
|
+
let className;
|
|
21
|
+
let controlClassName;
|
|
22
|
+
let defaultValue;
|
|
23
|
+
let description;
|
|
24
|
+
let descriptionClassName;
|
|
25
|
+
let errorsClassName;
|
|
26
|
+
let inputClassName;
|
|
27
|
+
let isReadOnly;
|
|
28
|
+
let isRequired;
|
|
29
|
+
let label;
|
|
30
|
+
let labelClassName;
|
|
31
|
+
let onChange;
|
|
32
|
+
let placeholder;
|
|
33
|
+
let props;
|
|
34
|
+
let suffix;
|
|
35
|
+
let t1;
|
|
36
|
+
let value;
|
|
37
|
+
if ($[0] !== t0) {
|
|
38
|
+
({label, description, errors: t1, value, defaultValue, onChange, placeholder, suffix, className, labelClassName, descriptionClassName, errorsClassName, controlClassName, inputClassName, isRequired, isReadOnly, ...props} = t0);
|
|
39
|
+
$[0] = t0;
|
|
40
|
+
$[1] = className;
|
|
41
|
+
$[2] = controlClassName;
|
|
42
|
+
$[3] = defaultValue;
|
|
43
|
+
$[4] = description;
|
|
44
|
+
$[5] = descriptionClassName;
|
|
45
|
+
$[6] = errorsClassName;
|
|
46
|
+
$[7] = inputClassName;
|
|
47
|
+
$[8] = isReadOnly;
|
|
48
|
+
$[9] = isRequired;
|
|
49
|
+
$[10] = label;
|
|
50
|
+
$[11] = labelClassName;
|
|
51
|
+
$[12] = onChange;
|
|
52
|
+
$[13] = placeholder;
|
|
53
|
+
$[14] = props;
|
|
54
|
+
$[15] = suffix;
|
|
55
|
+
$[16] = t1;
|
|
56
|
+
$[17] = value;
|
|
57
|
+
} else {
|
|
58
|
+
className = $[1];
|
|
59
|
+
controlClassName = $[2];
|
|
60
|
+
defaultValue = $[3];
|
|
61
|
+
description = $[4];
|
|
62
|
+
descriptionClassName = $[5];
|
|
63
|
+
errorsClassName = $[6];
|
|
64
|
+
inputClassName = $[7];
|
|
65
|
+
isReadOnly = $[8];
|
|
66
|
+
isRequired = $[9];
|
|
67
|
+
label = $[10];
|
|
68
|
+
labelClassName = $[11];
|
|
69
|
+
onChange = $[12];
|
|
70
|
+
placeholder = $[13];
|
|
71
|
+
props = $[14];
|
|
72
|
+
suffix = $[15];
|
|
73
|
+
t1 = $[16];
|
|
74
|
+
value = $[17];
|
|
75
|
+
}
|
|
76
|
+
let t2;
|
|
77
|
+
if ($[18] !== t1) {
|
|
78
|
+
t2 = t1 === void 0 ? [] : t1;
|
|
79
|
+
$[18] = t1;
|
|
80
|
+
$[19] = t2;
|
|
81
|
+
} else t2 = $[19];
|
|
82
|
+
const errors = t2;
|
|
18
83
|
const invalid = errors.length > 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
]
|
|
77
|
-
|
|
84
|
+
let t3;
|
|
85
|
+
if ($[20] !== value) {
|
|
86
|
+
t3 = toAria(value);
|
|
87
|
+
$[20] = value;
|
|
88
|
+
$[21] = t3;
|
|
89
|
+
} else t3 = $[21];
|
|
90
|
+
let t4;
|
|
91
|
+
if ($[22] !== defaultValue) {
|
|
92
|
+
t4 = toAria(defaultValue);
|
|
93
|
+
$[22] = defaultValue;
|
|
94
|
+
$[23] = t4;
|
|
95
|
+
} else t4 = $[23];
|
|
96
|
+
let t5;
|
|
97
|
+
if ($[24] !== onChange) {
|
|
98
|
+
t5 = (next) => onChange?.(Number.isNaN(next) ? null : next);
|
|
99
|
+
$[24] = onChange;
|
|
100
|
+
$[25] = t5;
|
|
101
|
+
} else t5 = $[25];
|
|
102
|
+
let t6;
|
|
103
|
+
if ($[26] !== className) {
|
|
104
|
+
t6 = cx("panneau-number-input", Field_module_default.field, className);
|
|
105
|
+
$[26] = className;
|
|
106
|
+
$[27] = t6;
|
|
107
|
+
} else t6 = $[27];
|
|
108
|
+
let t7;
|
|
109
|
+
if ($[28] !== isRequired || $[29] !== label || $[30] !== labelClassName) {
|
|
110
|
+
t7 = /* @__PURE__ */ jsx(FieldLabel, {
|
|
111
|
+
isRequired,
|
|
112
|
+
className: labelClassName,
|
|
113
|
+
children: label
|
|
114
|
+
});
|
|
115
|
+
$[28] = isRequired;
|
|
116
|
+
$[29] = label;
|
|
117
|
+
$[30] = labelClassName;
|
|
118
|
+
$[31] = t7;
|
|
119
|
+
} else t7 = $[31];
|
|
120
|
+
let t8;
|
|
121
|
+
if ($[32] !== controlClassName) {
|
|
122
|
+
t8 = cx(Field_module_default.control, NumberInput_module_default.control, controlClassName);
|
|
123
|
+
$[32] = controlClassName;
|
|
124
|
+
$[33] = t8;
|
|
125
|
+
} else t8 = $[33];
|
|
126
|
+
const t9 = invalid || void 0;
|
|
127
|
+
const t10 = isReadOnly || void 0;
|
|
128
|
+
let t11;
|
|
129
|
+
if ($[34] !== inputClassName) {
|
|
130
|
+
t11 = cx(Field_module_default.bare, NumberInput_module_default.input, inputClassName);
|
|
131
|
+
$[34] = inputClassName;
|
|
132
|
+
$[35] = t11;
|
|
133
|
+
} else t11 = $[35];
|
|
134
|
+
let t12;
|
|
135
|
+
if ($[36] !== placeholder || $[37] !== t11) {
|
|
136
|
+
t12 = /* @__PURE__ */ jsx(Input, {
|
|
137
|
+
placeholder,
|
|
138
|
+
className: t11
|
|
139
|
+
});
|
|
140
|
+
$[36] = placeholder;
|
|
141
|
+
$[37] = t11;
|
|
142
|
+
$[38] = t12;
|
|
143
|
+
} else t12 = $[38];
|
|
144
|
+
let t13;
|
|
145
|
+
if ($[39] !== suffix) {
|
|
146
|
+
t13 = suffix !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
147
|
+
className: cx(Field_module_default.adornment, NumberInput_module_default.suffix),
|
|
148
|
+
children: suffix
|
|
149
|
+
}) : null;
|
|
150
|
+
$[39] = suffix;
|
|
151
|
+
$[40] = t13;
|
|
152
|
+
} else t13 = $[40];
|
|
153
|
+
let t14;
|
|
154
|
+
if ($[41] !== isReadOnly) {
|
|
155
|
+
t14 = isReadOnly !== true ? /* @__PURE__ */ jsxs("span", {
|
|
156
|
+
className: NumberInput_module_default.steppers,
|
|
157
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
158
|
+
slot: "increment",
|
|
159
|
+
className: NumberInput_module_default.stepper,
|
|
160
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
161
|
+
icon: ChevronUp,
|
|
162
|
+
size: "xs"
|
|
163
|
+
})
|
|
164
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
165
|
+
slot: "decrement",
|
|
166
|
+
className: NumberInput_module_default.stepper,
|
|
167
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
168
|
+
icon: ChevronDown,
|
|
169
|
+
size: "xs"
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
}) : null;
|
|
173
|
+
$[41] = isReadOnly;
|
|
174
|
+
$[42] = t14;
|
|
175
|
+
} else t14 = $[42];
|
|
176
|
+
let t15;
|
|
177
|
+
if ($[43] !== t10 || $[44] !== t12 || $[45] !== t13 || $[46] !== t14 || $[47] !== t8 || $[48] !== t9) {
|
|
178
|
+
t15 = /* @__PURE__ */ jsxs(Group, {
|
|
179
|
+
className: t8,
|
|
180
|
+
"data-invalid": t9,
|
|
181
|
+
"data-readonly": t10,
|
|
182
|
+
children: [
|
|
183
|
+
t12,
|
|
184
|
+
t13,
|
|
185
|
+
t14
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
$[43] = t10;
|
|
189
|
+
$[44] = t12;
|
|
190
|
+
$[45] = t13;
|
|
191
|
+
$[46] = t14;
|
|
192
|
+
$[47] = t8;
|
|
193
|
+
$[48] = t9;
|
|
194
|
+
$[49] = t15;
|
|
195
|
+
} else t15 = $[49];
|
|
196
|
+
let t16;
|
|
197
|
+
if ($[50] !== description || $[51] !== descriptionClassName) {
|
|
198
|
+
t16 = /* @__PURE__ */ jsx(FieldDescription, {
|
|
199
|
+
className: descriptionClassName,
|
|
200
|
+
children: description
|
|
201
|
+
});
|
|
202
|
+
$[50] = description;
|
|
203
|
+
$[51] = descriptionClassName;
|
|
204
|
+
$[52] = t16;
|
|
205
|
+
} else t16 = $[52];
|
|
206
|
+
let t17;
|
|
207
|
+
if ($[53] !== errors || $[54] !== errorsClassName) {
|
|
208
|
+
t17 = /* @__PURE__ */ jsx(FieldErrors, {
|
|
209
|
+
errors,
|
|
210
|
+
className: errorsClassName
|
|
211
|
+
});
|
|
212
|
+
$[53] = errors;
|
|
213
|
+
$[54] = errorsClassName;
|
|
214
|
+
$[55] = t17;
|
|
215
|
+
} else t17 = $[55];
|
|
216
|
+
let t18;
|
|
217
|
+
if ($[56] !== invalid || $[57] !== isReadOnly || $[58] !== isRequired || $[59] !== props || $[60] !== t15 || $[61] !== t16 || $[62] !== t17 || $[63] !== t3 || $[64] !== t4 || $[65] !== t5 || $[66] !== t6 || $[67] !== t7) {
|
|
218
|
+
t18 = /* @__PURE__ */ jsxs(NumberField, {
|
|
219
|
+
...props,
|
|
220
|
+
value: t3,
|
|
221
|
+
defaultValue: t4,
|
|
222
|
+
onChange: t5,
|
|
223
|
+
isRequired,
|
|
224
|
+
isReadOnly,
|
|
225
|
+
isInvalid: invalid,
|
|
226
|
+
validationBehavior: "aria",
|
|
227
|
+
className: t6,
|
|
228
|
+
children: [
|
|
229
|
+
t7,
|
|
230
|
+
t15,
|
|
231
|
+
t16,
|
|
232
|
+
t17
|
|
233
|
+
]
|
|
234
|
+
});
|
|
235
|
+
$[56] = invalid;
|
|
236
|
+
$[57] = isReadOnly;
|
|
237
|
+
$[58] = isRequired;
|
|
238
|
+
$[59] = props;
|
|
239
|
+
$[60] = t15;
|
|
240
|
+
$[61] = t16;
|
|
241
|
+
$[62] = t17;
|
|
242
|
+
$[63] = t3;
|
|
243
|
+
$[64] = t4;
|
|
244
|
+
$[65] = t5;
|
|
245
|
+
$[66] = t6;
|
|
246
|
+
$[67] = t7;
|
|
247
|
+
$[68] = t18;
|
|
248
|
+
} else t18 = $[68];
|
|
249
|
+
return t18;
|
|
78
250
|
}
|
|
79
251
|
//#endregion
|
|
80
252
|
export { NumberInput };
|