@linyao.tw/ui 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/components/date-time/calendar.js +8 -6
- package/dist/components/date-time/calendar.js.map +1 -1
- package/dist/components/date-time/date-field.js +10 -8
- package/dist/components/date-time/date-field.js.map +1 -1
- package/dist/components/date-time/date-picker.js +8 -6
- package/dist/components/date-time/date-picker.js.map +1 -1
- package/dist/components/date-time/date-range-picker.js +8 -6
- package/dist/components/date-time/date-range-picker.js.map +1 -1
- package/dist/components/date-time/index.js +1 -1
- package/dist/components/date-time/shared.d.ts +0 -1
- package/dist/components/date-time/shared.js +7 -9
- package/dist/components/date-time/shared.js.map +1 -1
- package/dist/components/date-time/time-field.js +8 -6
- package/dist/components/date-time/time-field.js.map +1 -1
- package/dist/components/feedback/alert.js +35 -34
- package/dist/components/feedback/alert.js.map +1 -1
- package/dist/components/feedback/banner.js +15 -14
- package/dist/components/feedback/banner.js.map +1 -1
- package/dist/components/feedback/empty-state.d.ts +2 -1
- package/dist/components/feedback/empty-state.js +31 -31
- package/dist/components/feedback/empty-state.js.map +1 -1
- package/dist/components/feedback/feedback.types.d.ts +0 -1
- package/dist/components/feedback/feedback.types.js +3 -5
- package/dist/components/feedback/feedback.types.js.map +1 -1
- package/dist/components/feedback/index.d.ts +8 -8
- package/dist/components/feedback/meter.js +21 -21
- package/dist/components/feedback/meter.js.map +1 -1
- package/dist/components/feedback/progress.js +21 -21
- package/dist/components/feedback/progress.js.map +1 -1
- package/dist/components/feedback/skeleton.js +11 -11
- package/dist/components/feedback/skeleton.js.map +1 -1
- package/dist/components/feedback/spinner.js +25 -25
- package/dist/components/feedback/spinner.js.map +1 -1
- package/dist/components/feedback/toast.js +23 -21
- package/dist/components/feedback/toast.js.map +1 -1
- package/dist/components/forms/{CodeField.d.ts → code-field.d.ts} +1 -1
- package/dist/components/forms/code-field.js +66 -0
- package/dist/components/forms/code-field.js.map +1 -0
- package/dist/components/forms/{FileUpload.d.ts → file-upload.d.ts} +1 -1
- package/dist/components/forms/{FileUpload.js → file-upload.js} +128 -111
- package/dist/components/forms/file-upload.js.map +1 -0
- package/dist/components/forms/index.d.ts +6 -6
- package/dist/components/forms/{Input.js → input.js} +4 -3
- package/dist/components/forms/input.js.map +1 -0
- package/dist/components/forms/internal.d.ts +0 -2
- package/dist/components/forms/internal.js +22 -25
- package/dist/components/forms/internal.js.map +1 -1
- package/dist/components/forms/number-field.js +74 -0
- package/dist/components/forms/number-field.js.map +1 -0
- package/dist/components/forms/otp-field.js +58 -0
- package/dist/components/forms/otp-field.js.map +1 -0
- package/dist/components/forms/{TextField.d.ts → text-field.d.ts} +5 -0
- package/dist/components/forms/text-field.js +201 -0
- package/dist/components/forms/text-field.js.map +1 -0
- package/dist/components/foundations/{Avatar.js → avatar.js} +13 -10
- package/dist/components/foundations/avatar.js.map +1 -0
- package/dist/components/foundations/{Badge.d.ts → badge.d.ts} +1 -1
- package/dist/components/foundations/{Badge.js → badge.js} +4 -3
- package/dist/components/foundations/badge.js.map +1 -0
- package/dist/components/foundations/{Button.js → button.js} +4 -3
- package/dist/components/foundations/button.js.map +1 -0
- package/dist/components/foundations/{Card.d.ts → card.d.ts} +9 -2
- package/dist/components/foundations/{Card.js → card.js} +6 -5
- package/dist/components/foundations/card.js.map +1 -0
- package/dist/components/foundations/{IconButton.d.ts → icon-button.d.ts} +2 -8
- package/dist/components/foundations/{IconButton.js → icon-button.js} +5 -4
- package/dist/components/foundations/icon-button.js.map +1 -0
- package/dist/components/foundations/index.d.ts +9 -9
- package/dist/components/foundations/{Link.d.ts → link.d.ts} +1 -1
- package/dist/components/foundations/link.js +47 -0
- package/dist/components/foundations/link.js.map +1 -0
- package/dist/components/foundations/{ListCell.d.ts → list-cell.d.ts} +1 -8
- package/dist/components/foundations/{ListCell.js → list-cell.js} +4 -3
- package/dist/components/foundations/list-cell.js.map +1 -0
- package/dist/components/foundations/{SectionHeading.d.ts → section-heading.d.ts} +5 -2
- package/dist/components/foundations/{SectionHeading.js → section-heading.js} +4 -3
- package/dist/components/foundations/section-heading.js.map +1 -0
- package/dist/components/foundations/{Separator.js → separator.js} +4 -3
- package/dist/components/foundations/separator.js.map +1 -0
- package/dist/components/navigation-data/breadcrumb-pagination.js +89 -81
- package/dist/components/navigation-data/breadcrumb-pagination.js.map +1 -1
- package/dist/components/navigation-data/command-palette.d.ts +26 -0
- package/dist/components/navigation-data/command-palette.js +101 -72
- package/dist/components/navigation-data/command-palette.js.map +1 -1
- package/dist/components/navigation-data/header-tab-bar.js +50 -46
- package/dist/components/navigation-data/header-tab-bar.js.map +1 -1
- package/dist/components/navigation-data/index.d.ts +7 -7
- package/dist/components/navigation-data/menubar-toolbar.js +2 -1
- package/dist/components/navigation-data/menubar-toolbar.js.map +1 -1
- package/dist/components/navigation-data/navigation-menu.js +2 -1
- package/dist/components/navigation-data/navigation-menu.js.map +1 -1
- package/dist/components/navigation-data/scroll-area.js +2 -1
- package/dist/components/navigation-data/scroll-area.js.map +1 -1
- package/dist/components/navigation-data/table-collection.d.ts +12 -3
- package/dist/components/navigation-data/table-collection.js +12 -9
- package/dist/components/navigation-data/table-collection.js.map +1 -1
- package/dist/components/overlays/dialog.d.ts +23 -3
- package/dist/components/overlays/dialog.js +138 -130
- package/dist/components/overlays/dialog.js.map +1 -1
- package/dist/components/overlays/disclosure.js +2 -1
- package/dist/components/overlays/disclosure.js.map +1 -1
- package/dist/components/overlays/drawer.d.ts +9 -2
- package/dist/components/overlays/drawer.js +158 -151
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/floating.js +116 -113
- package/dist/components/overlays/floating.js.map +1 -1
- package/dist/components/overlays/index.d.ts +4 -4
- package/dist/components/selection/combobox.js +94 -93
- package/dist/components/selection/combobox.js.map +1 -1
- package/dist/components/selection/controls.d.ts +4 -1
- package/dist/components/selection/controls.js +141 -118
- package/dist/components/selection/controls.js.map +1 -1
- package/dist/components/selection/menu.js +121 -121
- package/dist/components/selection/menu.js.map +1 -1
- package/dist/components/selection/select.js +108 -107
- package/dist/components/selection/select.js.map +1 -1
- package/dist/fonts.css +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -33
- package/dist/internal/accessible-name.d.ts +12 -0
- package/dist/internal/class-names.d.ts +12 -0
- package/dist/{components/selection/classnames.js → internal/class-names.js} +4 -3
- package/dist/internal/class-names.js.map +1 -0
- package/dist/internal/index.d.ts +3 -0
- package/dist/{components/foundations/shared.d.ts → internal/render.d.ts} +2 -1
- package/dist/intl/index.d.ts +3 -0
- package/dist/intl/linyao-provider.d.ts +38 -0
- package/dist/intl/linyao-provider.js +27 -0
- package/dist/intl/linyao-provider.js.map +1 -0
- package/dist/intl/messages.d.ts +48 -0
- package/dist/intl/messages.js +81 -0
- package/dist/intl/messages.js.map +1 -0
- package/dist/intl/provider.d.ts +18 -0
- package/dist/intl/provider.js +31 -0
- package/dist/intl/provider.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -4
- package/dist/components/feedback/feedback.module.js +0 -42
- package/dist/components/feedback/feedback.module.js.map +0 -1
- package/dist/components/forms/CodeField.js +0 -63
- package/dist/components/forms/CodeField.js.map +0 -1
- package/dist/components/forms/FileUpload.js.map +0 -1
- package/dist/components/forms/Input.js.map +0 -1
- package/dist/components/forms/NumberField.js +0 -71
- package/dist/components/forms/NumberField.js.map +0 -1
- package/dist/components/forms/OTPField.js +0 -54
- package/dist/components/forms/OTPField.js.map +0 -1
- package/dist/components/forms/TextField.js +0 -199
- package/dist/components/forms/TextField.js.map +0 -1
- package/dist/components/foundations/Avatar.js.map +0 -1
- package/dist/components/foundations/Badge.js.map +0 -1
- package/dist/components/foundations/Button.js.map +0 -1
- package/dist/components/foundations/Card.js.map +0 -1
- package/dist/components/foundations/IconButton.js.map +0 -1
- package/dist/components/foundations/Link.js +0 -40
- package/dist/components/foundations/Link.js.map +0 -1
- package/dist/components/foundations/ListCell.js.map +0 -1
- package/dist/components/foundations/SectionHeading.js.map +0 -1
- package/dist/components/foundations/Separator.js.map +0 -1
- package/dist/components/foundations/shared.js +0 -8
- package/dist/components/foundations/shared.js.map +0 -1
- package/dist/components/navigation-data/utils.d.ts +0 -2
- package/dist/components/navigation-data/utils.js +0 -11
- package/dist/components/navigation-data/utils.js.map +0 -1
- package/dist/components/overlays/class-names.d.ts +0 -6
- package/dist/components/overlays/class-names.js +0 -11
- package/dist/components/overlays/class-names.js.map +0 -1
- package/dist/components/selection/classnames.d.ts +0 -4
- package/dist/components/selection/classnames.js.map +0 -1
- package/dist/components/selection/selection.module.js +0 -51
- package/dist/components/selection/selection.module.js.map +0 -1
- /package/dist/components/forms/{Input.d.ts → input.d.ts} +0 -0
- /package/dist/components/forms/{NumberField.d.ts → number-field.d.ts} +0 -0
- /package/dist/components/forms/{OTPField.d.ts → otp-field.d.ts} +0 -0
- /package/dist/components/foundations/{Avatar.d.ts → avatar.d.ts} +0 -0
- /package/dist/components/foundations/{Button.d.ts → button.d.ts} +0 -0
- /package/dist/components/foundations/{Separator.d.ts → separator.d.ts} +0 -0
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { Separator as
|
|
6
|
-
import { CheckIcon as
|
|
7
|
-
import { Menu as
|
|
8
|
-
import { ContextMenu as
|
|
1
|
+
"use client";
|
|
2
|
+
import { withStateClassName as e } from "../../internal/class-names.js";
|
|
3
|
+
import { forwardRef as t } from "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { Separator as r } from "@base-ui/react/separator";
|
|
6
|
+
import { CheckIcon as i } from "@phosphor-icons/react/dist/csr/Check";
|
|
7
|
+
import { Menu as a } from "@base-ui/react/menu";
|
|
8
|
+
import { ContextMenu as o } from "@base-ui/react/context-menu";
|
|
9
9
|
//#region src/components/selection/menu.tsx
|
|
10
|
-
var
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
...
|
|
13
|
-
className:
|
|
14
|
-
ref:
|
|
10
|
+
var s = t(function({ className: t, ...r }, i) {
|
|
11
|
+
return /* @__PURE__ */ n(a.Trigger, {
|
|
12
|
+
...r,
|
|
13
|
+
className: e("lyds-menu__trigger", t),
|
|
14
|
+
ref: i
|
|
15
15
|
});
|
|
16
|
-
}),
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
...
|
|
19
|
-
className:
|
|
20
|
-
ref:
|
|
16
|
+
}), c = t(function({ className: t, ...r }, i) {
|
|
17
|
+
return /* @__PURE__ */ n(a.Positioner, {
|
|
18
|
+
...r,
|
|
19
|
+
className: e("lyds-listbox__positioner", t),
|
|
20
|
+
ref: i
|
|
21
21
|
});
|
|
22
|
-
}),
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
...
|
|
25
|
-
className:
|
|
26
|
-
ref:
|
|
22
|
+
}), l = t(function({ className: t, ...r }, i) {
|
|
23
|
+
return /* @__PURE__ */ n(a.Popup, {
|
|
24
|
+
...r,
|
|
25
|
+
className: e("lyds-menu__popup", t),
|
|
26
|
+
ref: i
|
|
27
27
|
});
|
|
28
|
-
}),
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
...
|
|
31
|
-
className:
|
|
32
|
-
ref:
|
|
28
|
+
}), u = t(function({ className: t, ...r }, i) {
|
|
29
|
+
return /* @__PURE__ */ n(a.Item, {
|
|
30
|
+
...r,
|
|
31
|
+
className: e("lyds-menu__item", t),
|
|
32
|
+
ref: i
|
|
33
33
|
});
|
|
34
|
-
}),
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
...
|
|
37
|
-
className:
|
|
38
|
-
ref:
|
|
34
|
+
}), d = t(function({ className: t, ...r }, i) {
|
|
35
|
+
return /* @__PURE__ */ n(a.LinkItem, {
|
|
36
|
+
...r,
|
|
37
|
+
className: e("lyds-menu__item", t),
|
|
38
|
+
ref: i
|
|
39
39
|
});
|
|
40
|
-
}),
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
...
|
|
43
|
-
className:
|
|
44
|
-
ref:
|
|
40
|
+
}), f = t(function({ className: t, ...r }, i) {
|
|
41
|
+
return /* @__PURE__ */ n(a.CheckboxItem, {
|
|
42
|
+
...r,
|
|
43
|
+
className: e("lyds-menu__item", t),
|
|
44
|
+
ref: i
|
|
45
45
|
});
|
|
46
|
-
}),
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
...
|
|
49
|
-
className:
|
|
50
|
-
ref:
|
|
51
|
-
children:
|
|
46
|
+
}), p = t(function({ children: t, className: r, ...o }, s) {
|
|
47
|
+
return /* @__PURE__ */ n(a.CheckboxItemIndicator, {
|
|
48
|
+
...o,
|
|
49
|
+
className: e("lyds-menu__item-indicator", r),
|
|
50
|
+
ref: s,
|
|
51
|
+
children: t ?? /* @__PURE__ */ n(i, {
|
|
52
52
|
"aria-hidden": "true",
|
|
53
53
|
weight: "bold"
|
|
54
54
|
})
|
|
55
55
|
});
|
|
56
|
-
}),
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
...
|
|
59
|
-
className:
|
|
60
|
-
ref:
|
|
56
|
+
}), m = t(function({ className: t, ...r }, i) {
|
|
57
|
+
return /* @__PURE__ */ n(a.RadioItem, {
|
|
58
|
+
...r,
|
|
59
|
+
className: e("lyds-menu__item", t),
|
|
60
|
+
ref: i
|
|
61
61
|
});
|
|
62
|
-
}),
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
...
|
|
65
|
-
className:
|
|
66
|
-
ref:
|
|
67
|
-
children:
|
|
62
|
+
}), h = t(function({ children: t, className: r, ...o }, s) {
|
|
63
|
+
return /* @__PURE__ */ n(a.RadioItemIndicator, {
|
|
64
|
+
...o,
|
|
65
|
+
className: e("lyds-menu__item-indicator", r),
|
|
66
|
+
ref: s,
|
|
67
|
+
children: t ?? /* @__PURE__ */ n(i, {
|
|
68
68
|
"aria-hidden": "true",
|
|
69
69
|
"data-lyds-glyph": "check",
|
|
70
70
|
weight: "bold"
|
|
71
71
|
})
|
|
72
72
|
});
|
|
73
|
-
}),
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
-
...
|
|
76
|
-
className:
|
|
77
|
-
ref:
|
|
78
|
-
});
|
|
79
|
-
}), v = n(function({ className: n, ...a }, o) {
|
|
80
|
-
return /* @__PURE__ */ r(i, {
|
|
81
|
-
...a,
|
|
82
|
-
className: t(e.separator, n),
|
|
83
|
-
ref: o
|
|
73
|
+
}), g = t(function({ className: t, ...r }, i) {
|
|
74
|
+
return /* @__PURE__ */ n(a.GroupLabel, {
|
|
75
|
+
...r,
|
|
76
|
+
className: e("lyds-listbox__group-label", t),
|
|
77
|
+
ref: i
|
|
84
78
|
});
|
|
85
|
-
}),
|
|
86
|
-
return /* @__PURE__ */ r
|
|
79
|
+
}), _ = t(function({ className: t, ...i }, a) {
|
|
80
|
+
return /* @__PURE__ */ n(r, {
|
|
87
81
|
...i,
|
|
88
|
-
className:
|
|
82
|
+
className: e("lyds-listbox__separator", t),
|
|
89
83
|
ref: a
|
|
90
84
|
});
|
|
91
|
-
}),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
85
|
+
}), v = t(function({ className: t, ...r }, i) {
|
|
86
|
+
return /* @__PURE__ */ n(a.SubmenuTrigger, {
|
|
87
|
+
...r,
|
|
88
|
+
className: e("lyds-menu__item", t),
|
|
89
|
+
ref: i
|
|
90
|
+
});
|
|
91
|
+
}), y = {
|
|
92
|
+
Arrow: a.Arrow,
|
|
93
|
+
Backdrop: a.Backdrop,
|
|
94
|
+
CheckboxItem: f,
|
|
95
|
+
CheckboxItemIndicator: p,
|
|
96
|
+
Group: a.Group,
|
|
97
|
+
GroupLabel: g,
|
|
98
|
+
Handle: a.Handle,
|
|
99
|
+
Item: u,
|
|
100
|
+
LinkItem: d,
|
|
101
|
+
Popup: l,
|
|
102
|
+
Portal: a.Portal,
|
|
103
|
+
Positioner: c,
|
|
104
|
+
RadioGroup: a.RadioGroup,
|
|
105
|
+
RadioItem: m,
|
|
106
|
+
RadioItemIndicator: h,
|
|
107
|
+
Root: a.Root,
|
|
108
|
+
Separator: _,
|
|
109
|
+
SubmenuRoot: a.SubmenuRoot,
|
|
110
|
+
SubmenuTrigger: v,
|
|
111
|
+
Trigger: s,
|
|
112
|
+
Viewport: a.Viewport,
|
|
113
|
+
createHandle: a.createHandle
|
|
114
|
+
}, b = y, x = y, S = t(function({ className: t, onKeyDown: r, ...i }, a) {
|
|
115
|
+
let s = (e) => {
|
|
116
|
+
if (r?.(e), e.defaultPrevented || e.key !== "F10" || !e.shiftKey) return;
|
|
117
117
|
e.preventDefault();
|
|
118
118
|
let t = e.currentTarget, n = t.getBoundingClientRect();
|
|
119
119
|
t.dispatchEvent(new globalThis.MouseEvent("contextmenu", {
|
|
@@ -124,34 +124,34 @@ var c = n(function({ className: n, ...i }, a) {
|
|
|
124
124
|
clientY: n.top + n.height / 2
|
|
125
125
|
}));
|
|
126
126
|
};
|
|
127
|
-
return /* @__PURE__ */
|
|
128
|
-
...
|
|
129
|
-
className:
|
|
130
|
-
ref:
|
|
131
|
-
onKeyDown:
|
|
127
|
+
return /* @__PURE__ */ n(o.Trigger, {
|
|
128
|
+
...i,
|
|
129
|
+
className: e("lyds-context-menu__trigger", t),
|
|
130
|
+
ref: a,
|
|
131
|
+
onKeyDown: s
|
|
132
132
|
});
|
|
133
|
-
}),
|
|
134
|
-
Arrow:
|
|
135
|
-
Backdrop:
|
|
136
|
-
CheckboxItem:
|
|
137
|
-
CheckboxItemIndicator:
|
|
138
|
-
Group:
|
|
139
|
-
GroupLabel:
|
|
140
|
-
Item:
|
|
141
|
-
LinkItem:
|
|
142
|
-
Popup:
|
|
143
|
-
Portal:
|
|
144
|
-
Positioner:
|
|
145
|
-
RadioGroup:
|
|
146
|
-
RadioItem:
|
|
147
|
-
RadioItemIndicator:
|
|
148
|
-
Root:
|
|
149
|
-
Separator:
|
|
150
|
-
SubmenuRoot:
|
|
151
|
-
SubmenuTrigger:
|
|
152
|
-
Trigger:
|
|
133
|
+
}), C = {
|
|
134
|
+
Arrow: o.Arrow,
|
|
135
|
+
Backdrop: o.Backdrop,
|
|
136
|
+
CheckboxItem: f,
|
|
137
|
+
CheckboxItemIndicator: p,
|
|
138
|
+
Group: o.Group,
|
|
139
|
+
GroupLabel: g,
|
|
140
|
+
Item: u,
|
|
141
|
+
LinkItem: d,
|
|
142
|
+
Popup: l,
|
|
143
|
+
Portal: o.Portal,
|
|
144
|
+
Positioner: c,
|
|
145
|
+
RadioGroup: o.RadioGroup,
|
|
146
|
+
RadioItem: m,
|
|
147
|
+
RadioItemIndicator: h,
|
|
148
|
+
Root: o.Root,
|
|
149
|
+
Separator: _,
|
|
150
|
+
SubmenuRoot: o.SubmenuRoot,
|
|
151
|
+
SubmenuTrigger: v,
|
|
152
|
+
Trigger: S
|
|
153
153
|
};
|
|
154
154
|
//#endregion
|
|
155
|
-
export {
|
|
155
|
+
export { C as ContextMenu, S as ContextMenuTrigger, b as DropdownMenu, x as Menu, f as MenuCheckboxItem, p as MenuCheckboxItemIndicator, g as MenuGroupLabel, u as MenuItem, d as MenuLinkItem, l as MenuPopup, c as MenuPositioner, m as MenuRadioItem, h as MenuRadioItemIndicator, _ as MenuSeparator, v as MenuSubmenuTrigger, s as MenuTrigger };
|
|
156
156
|
|
|
157
157
|
//# sourceMappingURL=menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","names":[],"sources":["../../../src/components/selection/menu.tsx"],"sourcesContent":["import { ContextMenu as BaseContextMenu, type ContextMenuTriggerProps } from \"@base-ui/react/context-menu\";\nimport {\n\tMenu as BaseMenu,\n\ttype MenuCheckboxItemIndicatorProps,\n\ttype MenuCheckboxItemProps,\n\ttype MenuGroupLabelProps,\n\ttype MenuItemProps,\n\ttype MenuLinkItemProps,\n\ttype MenuPopupProps,\n\ttype MenuPositionerProps,\n\ttype MenuRadioItemIndicatorProps,\n\ttype MenuRadioItemProps,\n\ttype MenuSubmenuTriggerProps,\n\ttype MenuTriggerProps\n} from \"@base-ui/react/menu\";\nimport { Separator as BaseSeparator, type SeparatorProps } from \"@base-ui/react/separator\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef } from \"react\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"menu.js","names":[],"sources":["../../../src/components/selection/menu.tsx"],"sourcesContent":["import { ContextMenu as BaseContextMenu, type ContextMenuTriggerProps } from \"@base-ui/react/context-menu\";\nimport {\n\tMenu as BaseMenu,\n\ttype MenuCheckboxItemIndicatorProps,\n\ttype MenuCheckboxItemProps,\n\ttype MenuGroupLabelProps,\n\ttype MenuItemProps,\n\ttype MenuLinkItemProps,\n\ttype MenuPopupProps,\n\ttype MenuPositionerProps,\n\ttype MenuRadioItemIndicatorProps,\n\ttype MenuRadioItemProps,\n\ttype MenuSubmenuTriggerProps,\n\ttype MenuTriggerProps\n} from \"@base-ui/react/menu\";\nimport { Separator as BaseSeparator, type SeparatorProps } from \"@base-ui/react/separator\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef } from \"react\";\n\nimport { withStateClassName } from \"@/internal\";\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger({ className, ...props }, ref) {\n\treturn <BaseMenu.Trigger {...props} className={withStateClassName(\"lyds-menu__trigger\", className)} ref={ref} />;\n});\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(function MenuPositioner({ className, ...props }, ref) {\n\treturn <BaseMenu.Positioner {...props} className={withStateClassName(\"lyds-listbox__positioner\", className)} ref={ref} />;\n});\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup({ className, ...props }, ref) {\n\treturn <BaseMenu.Popup {...props} className={withStateClassName(\"lyds-menu__popup\", className)} ref={ref} />;\n});\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem({ className, ...props }, ref) {\n\treturn <BaseMenu.Item {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuLinkItem = forwardRef<HTMLAnchorElement, MenuLinkItemProps>(function MenuLinkItem({ className, ...props }, ref) {\n\treturn <BaseMenu.LinkItem {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuCheckboxItem = forwardRef<HTMLElement, MenuCheckboxItemProps>(function MenuCheckboxItem({ className, ...props }, ref) {\n\treturn <BaseMenu.CheckboxItem {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuCheckboxItemIndicator = forwardRef<HTMLSpanElement, MenuCheckboxItemIndicatorProps>(function MenuCheckboxItemIndicator({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseMenu.CheckboxItemIndicator {...props} className={withStateClassName(\"lyds-menu__item-indicator\", className)} ref={ref}>\n\t\t\t{children ?? <CheckIcon aria-hidden=\"true\" weight=\"bold\" />}\n\t\t</BaseMenu.CheckboxItemIndicator>\n\t);\n});\n\nexport const MenuRadioItem = forwardRef<HTMLElement, MenuRadioItemProps>(function MenuRadioItem({ className, ...props }, ref) {\n\treturn <BaseMenu.RadioItem {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuRadioItemIndicator = forwardRef<HTMLSpanElement, MenuRadioItemIndicatorProps>(function MenuRadioItemIndicator({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseMenu.RadioItemIndicator {...props} className={withStateClassName(\"lyds-menu__item-indicator\", className)} ref={ref}>\n\t\t\t{children ?? <CheckIcon aria-hidden=\"true\" data-lyds-glyph=\"check\" weight=\"bold\" />}\n\t\t</BaseMenu.RadioItemIndicator>\n\t);\n});\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(function MenuGroupLabel({ className, ...props }, ref) {\n\treturn <BaseMenu.GroupLabel {...props} className={withStateClassName(\"lyds-listbox__group-label\", className)} ref={ref} />;\n});\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, SeparatorProps>(function MenuSeparator({ className, ...props }, ref) {\n\treturn <BaseSeparator {...props} className={withStateClassName(\"lyds-listbox__separator\", className)} ref={ref} />;\n});\n\nexport const MenuSubmenuTrigger = forwardRef<HTMLElement, MenuSubmenuTriggerProps>(function MenuSubmenuTrigger({ className, ...props }, ref) {\n\treturn <BaseMenu.SubmenuTrigger {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nconst menuParts = {\n\tArrow: BaseMenu.Arrow,\n\tBackdrop: BaseMenu.Backdrop,\n\tCheckboxItem: MenuCheckboxItem,\n\tCheckboxItemIndicator: MenuCheckboxItemIndicator,\n\tGroup: BaseMenu.Group,\n\tGroupLabel: MenuGroupLabel,\n\tHandle: BaseMenu.Handle,\n\tItem: MenuItem,\n\tLinkItem: MenuLinkItem,\n\tPopup: MenuPopup,\n\tPortal: BaseMenu.Portal,\n\tPositioner: MenuPositioner,\n\tRadioGroup: BaseMenu.RadioGroup,\n\tRadioItem: MenuRadioItem,\n\tRadioItemIndicator: MenuRadioItemIndicator,\n\tRoot: BaseMenu.Root,\n\tSeparator: MenuSeparator,\n\tSubmenuRoot: BaseMenu.SubmenuRoot,\n\tSubmenuTrigger: MenuSubmenuTrigger,\n\tTrigger: MenuTrigger,\n\tViewport: BaseMenu.Viewport,\n\tcreateHandle: BaseMenu.createHandle\n} as const;\n\n/** 由按鈕觸發的應用程式選單。 */\nexport const DropdownMenu = menuParts;\n\n/** DropdownMenu 的別名,名稱與 Base UI 詞彙一致。 */\nexport const Menu = menuParts;\n\nexport const ContextMenuTrigger = forwardRef<HTMLDivElement, ContextMenuTriggerProps>(function ContextMenuTrigger({ className, onKeyDown, ...props }, ref) {\n\tconst handleKeyDown: NonNullable<ContextMenuTriggerProps[\"onKeyDown\"]> = event => {\n\t\tonKeyDown?.(event);\n\t\tif (event.defaultPrevented || event.key !== \"F10\" || !event.shiftKey) return;\n\n\t\tevent.preventDefault();\n\t\tconst target = event.currentTarget;\n\t\tconst bounds = target.getBoundingClientRect();\n\t\ttarget.dispatchEvent(\n\t\t\tnew globalThis.MouseEvent(\"contextmenu\", {\n\t\t\t\tbubbles: true,\n\t\t\t\tbutton: 2,\n\t\t\t\tcancelable: true,\n\t\t\t\tclientX: bounds.left + bounds.width / 2,\n\t\t\t\tclientY: bounds.top + bounds.height / 2\n\t\t\t})\n\t\t);\n\t};\n\n\treturn <BaseContextMenu.Trigger {...props} className={withStateClassName(\"lyds-context-menu__trigger\", className)} ref={ref} onKeyDown={handleKeyDown} />;\n});\n\nexport const ContextMenu = {\n\tArrow: BaseContextMenu.Arrow,\n\tBackdrop: BaseContextMenu.Backdrop,\n\tCheckboxItem: MenuCheckboxItem,\n\tCheckboxItemIndicator: MenuCheckboxItemIndicator,\n\tGroup: BaseContextMenu.Group,\n\tGroupLabel: MenuGroupLabel,\n\tItem: MenuItem,\n\tLinkItem: MenuLinkItem,\n\tPopup: MenuPopup,\n\tPortal: BaseContextMenu.Portal,\n\tPositioner: MenuPositioner,\n\tRadioGroup: BaseContextMenu.RadioGroup,\n\tRadioItem: MenuRadioItem,\n\tRadioItemIndicator: MenuRadioItemIndicator,\n\tRoot: BaseContextMenu.Root,\n\tSeparator: MenuSeparator,\n\tSubmenuRoot: BaseContextMenu.SubmenuRoot,\n\tSubmenuTrigger: MenuSubmenuTrigger,\n\tTrigger: ContextMenuTrigger\n} as const;\n"],"mappings":";;;;;;;;;AAqBA,IAAa,IAAc,EAAgD,SAAqB,EAAE,cAAW,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Ac,EAAS;AACxB,GAGa,IAAe,GAGf,IAAO,GAEP,IAAqB,EAAoD,SAA4B,EAAE,cAAW,cAAW,GAAG,KAAS,GAAK;CAC1J,IAAM,KAAmE,MAAS;EAEjF,IADA,IAAY,CAAK,GACb,EAAM,oBAAoB,EAAM,QAAQ,SAAS,CAAC,EAAM,UAAU;EAEtE,EAAM,eAAe;EACrB,IAAM,IAAS,EAAM,eACf,IAAS,EAAO,sBAAsB;EAC5C,EAAO,cACN,IAAI,WAAW,WAAW,eAAe;GACxC,SAAS;GACT,QAAQ;GACR,YAAY;GACZ,SAAS,EAAO,OAAO,EAAO,QAAQ;GACtC,SAAS,EAAO,MAAM,EAAO,SAAS;EACvC,CAAC,CACF;CACD;CAEA,OAAO,kBAAC,EAAgB,SAAjB;EAAyB,GAAI;EAAO,WAAW,EAAmB,8BAA8B,CAAS;EAAQ;EAAK,WAAW;CAAgB,CAAA;AACzJ,CAAC,GAEY,IAAc;CAC1B,OAAO,EAAgB;CACvB,UAAU,EAAgB;CAC1B,cAAc;CACd,uBAAuB;CACvB,OAAO,EAAgB;CACvB,YAAY;CACZ,MAAM;CACN,UAAU;CACV,OAAO;CACP,QAAQ,EAAgB;CACxB,YAAY;CACZ,YAAY,EAAgB;CAC5B,WAAW;CACX,oBAAoB;CACpB,MAAM,EAAgB;CACtB,WAAW;CACX,aAAa,EAAgB;CAC7B,gBAAgB;CAChB,SAAS;AACV"}
|
|
@@ -1,138 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
import { combineStateClassNames as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { combineStateClassNames as e, withStateClassName as t } from "../../internal/class-names.js";
|
|
3
|
+
import { useMessages as n } from "../../intl/provider.js";
|
|
4
|
+
import { forwardRef as r, useMemo as i } from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { CheckIcon as s } from "@phosphor-icons/react/dist/csr/Check";
|
|
7
|
+
import { CaretDownIcon as c } from "@phosphor-icons/react/dist/csr/CaretDown";
|
|
8
|
+
import { Select as l } from "@base-ui/react/select";
|
|
8
9
|
//#region src/components/selection/select.tsx
|
|
9
|
-
var
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
...
|
|
12
|
-
className:
|
|
13
|
-
ref:
|
|
10
|
+
var u = r(function({ className: e, ...n }, r) {
|
|
11
|
+
return /* @__PURE__ */ a(l.Trigger, {
|
|
12
|
+
...n,
|
|
13
|
+
className: t("lyds-select__trigger", e),
|
|
14
|
+
ref: r
|
|
14
15
|
});
|
|
15
|
-
}),
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
...
|
|
18
|
-
className:
|
|
19
|
-
ref:
|
|
16
|
+
}), d = r(function({ className: e, ...n }, r) {
|
|
17
|
+
return /* @__PURE__ */ a(l.Value, {
|
|
18
|
+
...n,
|
|
19
|
+
className: t("lyds-select__value", e),
|
|
20
|
+
ref: r
|
|
20
21
|
});
|
|
21
|
-
}),
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
...
|
|
24
|
-
className:
|
|
25
|
-
ref:
|
|
22
|
+
}), f = r(function({ className: e, ...n }, r) {
|
|
23
|
+
return /* @__PURE__ */ a(l.Positioner, {
|
|
24
|
+
...n,
|
|
25
|
+
className: t("lyds-listbox__positioner", e),
|
|
26
|
+
ref: r
|
|
26
27
|
});
|
|
27
|
-
}),
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
...
|
|
30
|
-
className:
|
|
31
|
-
ref:
|
|
28
|
+
}), p = r(function({ className: e, ...n }, r) {
|
|
29
|
+
return /* @__PURE__ */ a(l.Popup, {
|
|
30
|
+
...n,
|
|
31
|
+
className: t("lyds-listbox__popup", e),
|
|
32
|
+
ref: r
|
|
32
33
|
});
|
|
33
|
-
}),
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
...
|
|
36
|
-
className:
|
|
37
|
-
ref:
|
|
34
|
+
}), m = r(function({ className: e, ...n }, r) {
|
|
35
|
+
return /* @__PURE__ */ a(l.List, {
|
|
36
|
+
...n,
|
|
37
|
+
className: t("lyds-listbox__list", e),
|
|
38
|
+
ref: r
|
|
38
39
|
});
|
|
39
|
-
}),
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
...
|
|
42
|
-
className:
|
|
43
|
-
ref:
|
|
40
|
+
}), h = r(function({ className: e, ...n }, r) {
|
|
41
|
+
return /* @__PURE__ */ a(l.Item, {
|
|
42
|
+
...n,
|
|
43
|
+
className: t("lyds-listbox__option", e),
|
|
44
|
+
ref: r
|
|
44
45
|
});
|
|
45
|
-
}),
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
...
|
|
48
|
-
className:
|
|
49
|
-
ref:
|
|
46
|
+
}), g = r(function({ className: e, ...n }, r) {
|
|
47
|
+
return /* @__PURE__ */ a(l.ItemIndicator, {
|
|
48
|
+
...n,
|
|
49
|
+
className: t("lyds-listbox__option-indicator", e),
|
|
50
|
+
ref: r
|
|
50
51
|
});
|
|
51
|
-
}),
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
...
|
|
54
|
-
className:
|
|
55
|
-
ref:
|
|
52
|
+
}), _ = r(function({ className: e, ...n }, r) {
|
|
53
|
+
return /* @__PURE__ */ a(l.ItemText, {
|
|
54
|
+
...n,
|
|
55
|
+
className: t("lyds-listbox__option-text", e),
|
|
56
|
+
ref: r
|
|
56
57
|
});
|
|
57
|
-
}),
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
...
|
|
60
|
-
className:
|
|
61
|
-
ref:
|
|
58
|
+
}), v = r(function({ className: e, ...n }, r) {
|
|
59
|
+
return /* @__PURE__ */ a(l.GroupLabel, {
|
|
60
|
+
...n,
|
|
61
|
+
className: t("lyds-listbox__group-label", e),
|
|
62
|
+
ref: r
|
|
62
63
|
});
|
|
63
|
-
}),
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
...
|
|
66
|
-
className:
|
|
67
|
-
ref:
|
|
64
|
+
}), y = r(function({ className: e, ...n }, r) {
|
|
65
|
+
return /* @__PURE__ */ a(l.Separator, {
|
|
66
|
+
...n,
|
|
67
|
+
className: t("lyds-listbox__separator", e),
|
|
68
|
+
ref: r
|
|
68
69
|
});
|
|
69
70
|
});
|
|
70
|
-
function
|
|
71
|
-
let
|
|
71
|
+
function b({ "aria-describedby": t, "aria-label": r, "aria-labelledby": v, className: y, invalid: b = !1, options: x, placeholder: S, popupProps: C, positionerProps: w, triggerProps: T, ...E }) {
|
|
72
|
+
let D = n(), O = i(() => x.map((e) => ({
|
|
72
73
|
label: e.label,
|
|
73
74
|
value: e.value
|
|
74
|
-
}));
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
...
|
|
77
|
-
items:
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
...
|
|
80
|
-
"aria-describedby":
|
|
81
|
-
"aria-invalid":
|
|
82
|
-
"aria-label": r ??
|
|
83
|
-
"aria-labelledby":
|
|
84
|
-
className:
|
|
85
|
-
children: [/* @__PURE__ */
|
|
75
|
+
})), [x]);
|
|
76
|
+
return /* @__PURE__ */ o(l.Root, {
|
|
77
|
+
...E,
|
|
78
|
+
items: O,
|
|
79
|
+
children: [/* @__PURE__ */ o(u, {
|
|
80
|
+
...T,
|
|
81
|
+
"aria-describedby": t ?? T?.["aria-describedby"],
|
|
82
|
+
"aria-invalid": b || T?.["aria-invalid"] || void 0,
|
|
83
|
+
"aria-label": r ?? T?.["aria-label"],
|
|
84
|
+
"aria-labelledby": v ?? T?.["aria-labelledby"],
|
|
85
|
+
className: e(y, T?.className),
|
|
86
|
+
children: [/* @__PURE__ */ a(d, { placeholder: S ?? D.selectPlaceholder }), /* @__PURE__ */ a(l.Icon, {
|
|
86
87
|
"aria-hidden": "true",
|
|
87
|
-
className:
|
|
88
|
-
children: /* @__PURE__ */
|
|
88
|
+
className: "lyds-select__icon",
|
|
89
|
+
children: /* @__PURE__ */ a(c, {
|
|
89
90
|
"aria-hidden": "true",
|
|
90
91
|
weight: "bold"
|
|
91
92
|
})
|
|
92
93
|
})]
|
|
93
|
-
}), /* @__PURE__ */
|
|
94
|
+
}), /* @__PURE__ */ a(l.Portal, { children: /* @__PURE__ */ a(f, {
|
|
94
95
|
alignItemWithTrigger: !1,
|
|
95
|
-
...
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
-
...
|
|
98
|
-
children: /* @__PURE__ */
|
|
99
|
-
disabled:
|
|
100
|
-
label:
|
|
101
|
-
value:
|
|
102
|
-
children: [/* @__PURE__ */
|
|
96
|
+
...w,
|
|
97
|
+
children: /* @__PURE__ */ a(p, {
|
|
98
|
+
...C,
|
|
99
|
+
children: /* @__PURE__ */ a(m, { children: x.map((e, t) => /* @__PURE__ */ o(h, {
|
|
100
|
+
disabled: e.disabled,
|
|
101
|
+
label: e.textValue,
|
|
102
|
+
value: e.value,
|
|
103
|
+
children: [/* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(s, {
|
|
103
104
|
"aria-hidden": "true",
|
|
104
105
|
weight: "bold"
|
|
105
|
-
}) }), /* @__PURE__ */
|
|
106
|
-
className:
|
|
107
|
-
children:
|
|
106
|
+
}) }), /* @__PURE__ */ o(_, { children: [/* @__PURE__ */ a("span", { children: e.label }), e.description ? /* @__PURE__ */ a("span", {
|
|
107
|
+
className: "lyds-listbox__option-description",
|
|
108
|
+
children: e.description
|
|
108
109
|
}) : null] })]
|
|
109
|
-
},
|
|
110
|
+
}, e.key ?? e.textValue ?? t)) })
|
|
110
111
|
})
|
|
111
112
|
}) })]
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
var
|
|
115
|
-
Arrow:
|
|
116
|
-
Backdrop:
|
|
117
|
-
Group:
|
|
118
|
-
GroupLabel:
|
|
119
|
-
Icon:
|
|
120
|
-
Item:
|
|
121
|
-
ItemIndicator:
|
|
122
|
-
ItemText:
|
|
123
|
-
Label:
|
|
124
|
-
List:
|
|
125
|
-
Popup:
|
|
126
|
-
Portal:
|
|
127
|
-
Positioner:
|
|
128
|
-
Root:
|
|
129
|
-
ScrollDownArrow:
|
|
130
|
-
ScrollUpArrow:
|
|
131
|
-
Separator:
|
|
132
|
-
Trigger:
|
|
133
|
-
Value:
|
|
115
|
+
var x = Object.assign(b, {
|
|
116
|
+
Arrow: l.Arrow,
|
|
117
|
+
Backdrop: l.Backdrop,
|
|
118
|
+
Group: l.Group,
|
|
119
|
+
GroupLabel: v,
|
|
120
|
+
Icon: l.Icon,
|
|
121
|
+
Item: h,
|
|
122
|
+
ItemIndicator: g,
|
|
123
|
+
ItemText: _,
|
|
124
|
+
Label: l.Label,
|
|
125
|
+
List: m,
|
|
126
|
+
Popup: p,
|
|
127
|
+
Portal: l.Portal,
|
|
128
|
+
Positioner: f,
|
|
129
|
+
Root: l.Root,
|
|
130
|
+
ScrollDownArrow: l.ScrollDownArrow,
|
|
131
|
+
ScrollUpArrow: l.ScrollUpArrow,
|
|
132
|
+
Separator: y,
|
|
133
|
+
Trigger: u,
|
|
134
|
+
Value: d
|
|
134
135
|
});
|
|
135
136
|
//#endregion
|
|
136
|
-
export {
|
|
137
|
+
export { x as Select, v as SelectGroupLabel, h as SelectItem, g as SelectItemIndicator, _ as SelectItemText, m as SelectList, p as SelectPopup, f as SelectPositioner, y as SelectSeparator, u as SelectTrigger, d as SelectValue };
|
|
137
138
|
|
|
138
139
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":[],"sources":["../../../src/components/selection/select.tsx"],"sourcesContent":["import {\n\tSelect as BaseSelect,\n\ttype SelectGroupLabelProps,\n\ttype SelectItemIndicatorProps,\n\ttype SelectItemProps,\n\ttype SelectItemTextProps,\n\ttype SelectListProps,\n\ttype SelectPopupProps,\n\ttype SelectPositionerProps,\n\ttype SelectRootProps,\n\ttype SelectSeparatorProps,\n\ttype SelectTriggerProps,\n\ttype SelectValueProps\n} from \"@base-ui/react/select\";\nimport { CaretDownIcon } from \"@phosphor-icons/react/dist/csr/CaretDown\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef, type Key, type ReactNode } from \"react\";\n\nimport { combineStateClassNames,
|
|
1
|
+
{"version":3,"file":"select.js","names":[],"sources":["../../../src/components/selection/select.tsx"],"sourcesContent":["import {\n\tSelect as BaseSelect,\n\ttype SelectGroupLabelProps,\n\ttype SelectItemIndicatorProps,\n\ttype SelectItemProps,\n\ttype SelectItemTextProps,\n\ttype SelectListProps,\n\ttype SelectPopupProps,\n\ttype SelectPositionerProps,\n\ttype SelectRootProps,\n\ttype SelectSeparatorProps,\n\ttype SelectTriggerProps,\n\ttype SelectValueProps\n} from \"@base-ui/react/select\";\nimport { CaretDownIcon } from \"@phosphor-icons/react/dist/csr/CaretDown\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef, useMemo, type Key, type ReactNode } from \"react\";\n\nimport { combineStateClassNames, withStateClassName } from \"@/internal\";\nimport { useMessages } from \"@/intl\";\n\nexport const SelectTrigger = forwardRef<HTMLButtonElement, SelectTriggerProps>(function SelectTrigger({ className, ...props }, ref) {\n\treturn <BaseSelect.Trigger {...props} className={withStateClassName(\"lyds-select__trigger\", className)} ref={ref} />;\n});\n\nexport const SelectValue = forwardRef<HTMLSpanElement, SelectValueProps>(function SelectValue({ className, ...props }, ref) {\n\treturn <BaseSelect.Value {...props} className={withStateClassName(\"lyds-select__value\", className)} ref={ref} />;\n});\n\nexport const SelectPositioner = forwardRef<HTMLDivElement, SelectPositionerProps>(function SelectPositioner({ className, ...props }, ref) {\n\treturn <BaseSelect.Positioner {...props} className={withStateClassName(\"lyds-listbox__positioner\", className)} ref={ref} />;\n});\n\nexport const SelectPopup = forwardRef<HTMLDivElement, SelectPopupProps>(function SelectPopup({ className, ...props }, ref) {\n\treturn <BaseSelect.Popup {...props} className={withStateClassName(\"lyds-listbox__popup\", className)} ref={ref} />;\n});\n\nexport const SelectList = forwardRef<HTMLDivElement, SelectListProps>(function SelectList({ className, ...props }, ref) {\n\treturn <BaseSelect.List {...props} className={withStateClassName(\"lyds-listbox__list\", className)} ref={ref} />;\n});\n\nexport const SelectItem = forwardRef<HTMLElement, SelectItemProps>(function SelectItem({ className, ...props }, ref) {\n\treturn <BaseSelect.Item {...props} className={withStateClassName(\"lyds-listbox__option\", className)} ref={ref} />;\n});\n\nexport const SelectItemIndicator = forwardRef<HTMLSpanElement, SelectItemIndicatorProps>(function SelectItemIndicator({ className, ...props }, ref) {\n\treturn <BaseSelect.ItemIndicator {...props} className={withStateClassName(\"lyds-listbox__option-indicator\", className)} ref={ref} />;\n});\n\nexport const SelectItemText = forwardRef<HTMLDivElement, SelectItemTextProps>(function SelectItemText({ className, ...props }, ref) {\n\treturn <BaseSelect.ItemText {...props} className={withStateClassName(\"lyds-listbox__option-text\", className)} ref={ref} />;\n});\n\nexport const SelectGroupLabel = forwardRef<HTMLDivElement, SelectGroupLabelProps>(function SelectGroupLabel({ className, ...props }, ref) {\n\treturn <BaseSelect.GroupLabel {...props} className={withStateClassName(\"lyds-listbox__group-label\", className)} ref={ref} />;\n});\n\nexport const SelectSeparator = forwardRef<HTMLDivElement, SelectSeparatorProps>(function SelectSeparator({ className, ...props }, ref) {\n\treturn <BaseSelect.Separator {...props} className={withStateClassName(\"lyds-listbox__separator\", className)} ref={ref} />;\n});\n\nexport interface SelectOption<Value> {\n\tdescription?: ReactNode;\n\tdisabled?: boolean;\n\tkey?: Key;\n\tlabel: ReactNode;\n\ttextValue?: string;\n\tvalue: Value;\n}\n\nexport interface SelectProps<Value> extends Omit<SelectRootProps<Value, false>, \"children\" | \"items\" | \"multiple\"> {\n\t\"aria-describedby\"?: string;\n\t\"aria-label\"?: string;\n\t\"aria-labelledby\"?: string;\n\tclassName?: string;\n\tinvalid?: boolean;\n\toptions: readonly SelectOption<Value>[];\n\tplaceholder?: ReactNode;\n\tpopupProps?: SelectPopupProps;\n\tpositionerProps?: SelectPositionerProps;\n\ttriggerProps?: Omit<SelectTriggerProps, \"children\">;\n}\n\nfunction SelectComponent<Value>({\n\t\"aria-describedby\": ariaDescribedby,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledby,\n\tclassName,\n\tinvalid = false,\n\toptions,\n\tplaceholder,\n\tpopupProps,\n\tpositionerProps,\n\ttriggerProps,\n\t...rootProps\n}: SelectProps<Value>) {\n\tconst messages = useMessages();\n\t// A fresh array on every render resets Base UI's item collection, so keep the identity stable.\n\tconst items = useMemo(() => options.map(option => ({ label: option.label, value: option.value })), [options]);\n\n\treturn (\n\t\t<BaseSelect.Root {...rootProps} items={items}>\n\t\t\t<SelectTrigger\n\t\t\t\t{...triggerProps}\n\t\t\t\taria-describedby={ariaDescribedby ?? triggerProps?.[\"aria-describedby\"]}\n\t\t\t\taria-invalid={invalid || triggerProps?.[\"aria-invalid\"] || undefined}\n\t\t\t\taria-label={ariaLabel ?? triggerProps?.[\"aria-label\"]}\n\t\t\t\taria-labelledby={ariaLabelledby ?? triggerProps?.[\"aria-labelledby\"]}\n\t\t\t\tclassName={combineStateClassNames(className, triggerProps?.className)}\n\t\t\t>\n\t\t\t\t<SelectValue placeholder={placeholder ?? messages.selectPlaceholder} />\n\t\t\t\t<BaseSelect.Icon aria-hidden=\"true\" className={\"lyds-select__icon\"}>\n\t\t\t\t\t<CaretDownIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t\t</BaseSelect.Icon>\n\t\t\t</SelectTrigger>\n\t\t\t<BaseSelect.Portal>\n\t\t\t\t<SelectPositioner alignItemWithTrigger={false} {...positionerProps}>\n\t\t\t\t\t<SelectPopup {...popupProps}>\n\t\t\t\t\t\t<SelectList>\n\t\t\t\t\t\t\t{options.map((option, index) => (\n\t\t\t\t\t\t\t\t<SelectItem disabled={option.disabled} key={option.key ?? option.textValue ?? index} label={option.textValue} value={option.value}>\n\t\t\t\t\t\t\t\t\t<SelectItemIndicator>\n\t\t\t\t\t\t\t\t\t\t<CheckIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t\t\t\t\t\t\t</SelectItemIndicator>\n\t\t\t\t\t\t\t\t\t<SelectItemText>\n\t\t\t\t\t\t\t\t\t\t<span>{option.label}</span>\n\t\t\t\t\t\t\t\t\t\t{option.description ? <span className={\"lyds-listbox__option-description\"}>{option.description}</span> : null}\n\t\t\t\t\t\t\t\t\t</SelectItemText>\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SelectList>\n\t\t\t\t\t</SelectPopup>\n\t\t\t\t</SelectPositioner>\n\t\t\t</BaseSelect.Portal>\n\t\t</BaseSelect.Root>\n\t);\n}\n\nexport const Select = Object.assign(SelectComponent, {\n\tArrow: BaseSelect.Arrow,\n\tBackdrop: BaseSelect.Backdrop,\n\tGroup: BaseSelect.Group,\n\tGroupLabel: SelectGroupLabel,\n\tIcon: BaseSelect.Icon,\n\tItem: SelectItem,\n\tItemIndicator: SelectItemIndicator,\n\tItemText: SelectItemText,\n\tLabel: BaseSelect.Label,\n\tList: SelectList,\n\tPopup: SelectPopup,\n\tPortal: BaseSelect.Portal,\n\tPositioner: SelectPositioner,\n\tRoot: BaseSelect.Root,\n\tScrollDownArrow: BaseSelect.ScrollDownArrow,\n\tScrollUpArrow: BaseSelect.ScrollUpArrow,\n\tSeparator: SelectSeparator,\n\tTrigger: SelectTrigger,\n\tValue: SelectValue\n});\n"],"mappings":";;;;;;;;;AAqBA,IAAa,IAAgB,EAAkD,SAAuB,EAAE,cAAW,GAAG,KAAS,GAAK;CACnI,OAAO,kBAAC,EAAW,SAAZ;EAAoB,GAAI;EAAO,WAAW,EAAmB,wBAAwB,CAAS;EAAQ;CAAM,CAAA;AACpH,CAAC,GAEY,IAAc,EAA8C,SAAqB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC3H,OAAO,kBAAC,EAAW,OAAZ;EAAkB,GAAI;EAAO,WAAW,EAAmB,sBAAsB,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