@dxos/react-ui-pickers 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +241 -211
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +239 -209
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +241 -211
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/dist/types/src/components/PickerButton/PickerButton.d.ts.map +1 -1
- package/package.json +10 -9
- package/src/components/EmojiPicker/EmojiPicker.tsx +2 -10
- package/src/components/PickerButton/PickerButton.tsx +3 -12
|
@@ -1,253 +1,283 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// packages/ui/react-ui-pickers/src/components/EmojiPicker/EmojiPicker.tsx
|
|
4
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
4
5
|
import emojiData from "@emoji-mart/data";
|
|
5
6
|
import EmojiMart from "@emoji-mart/react";
|
|
6
7
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
7
|
-
import React, {
|
|
8
|
+
import React, { useState } from "react";
|
|
8
9
|
import { Button, Popover, Toolbar, Tooltip, useMediaQuery, useThemeContext, useTranslation, Icon, ButtonGroup } from "@dxos/react-ui";
|
|
9
10
|
var EmojiPickerToolbarButton = ({ classNames, emoji, disabled, defaultEmoji, onChangeEmoji }) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
26
|
-
asChild: true,
|
|
27
|
-
content: t("select emoji label"),
|
|
28
|
-
side: "bottom",
|
|
29
|
-
suppressNextTooltip
|
|
30
|
-
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
31
|
-
asChild: true
|
|
32
|
-
}, /* @__PURE__ */ React.createElement(Toolbar.Button, {
|
|
33
|
-
classNames: [
|
|
34
|
-
"gap-2 text-2xl plb-1",
|
|
35
|
-
classNames
|
|
36
|
-
],
|
|
37
|
-
disabled
|
|
38
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
39
|
-
className: "sr-only"
|
|
40
|
-
}, t("select emoji label")), /* @__PURE__ */ React.createElement(Icon, {
|
|
41
|
-
icon: "ph--user-circle--regular",
|
|
42
|
-
size: 5
|
|
43
|
-
})))), /* @__PURE__ */ React.createElement(Popover.Portal, null, /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
44
|
-
side: "bottom",
|
|
45
|
-
onKeyDownCapture: (event) => {
|
|
46
|
-
if (event.key === "Escape") {
|
|
47
|
-
event.stopPropagation();
|
|
48
|
-
setEmojiPickerOpen(false);
|
|
49
|
-
suppressNextTooltip.current = true;
|
|
11
|
+
var _effect = _useSignals();
|
|
12
|
+
try {
|
|
13
|
+
const { t } = useTranslation("os");
|
|
14
|
+
const { themeMode } = useThemeContext();
|
|
15
|
+
const [_emojiValue, setEmojiValue] = useControllableState({
|
|
16
|
+
prop: emoji,
|
|
17
|
+
onChange: onChangeEmoji,
|
|
18
|
+
defaultProp: defaultEmoji
|
|
19
|
+
});
|
|
20
|
+
const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
|
|
21
|
+
return /* @__PURE__ */ React.createElement(Popover.Root, {
|
|
22
|
+
open: emojiPickerOpen,
|
|
23
|
+
onOpenChange: (nextOpen) => {
|
|
24
|
+
setEmojiPickerOpen(nextOpen);
|
|
50
25
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
26
|
+
}, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
27
|
+
asChild: true,
|
|
28
|
+
content: t("select emoji label"),
|
|
29
|
+
side: "bottom"
|
|
30
|
+
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
31
|
+
asChild: true
|
|
32
|
+
}, /* @__PURE__ */ React.createElement(Toolbar.Button, {
|
|
33
|
+
classNames: [
|
|
34
|
+
"gap-2 text-2xl plb-1",
|
|
35
|
+
classNames
|
|
36
|
+
],
|
|
37
|
+
disabled
|
|
38
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
39
|
+
className: "sr-only"
|
|
40
|
+
}, t("select emoji label")), /* @__PURE__ */ React.createElement(Icon, {
|
|
41
|
+
icon: "ph--user-circle--regular",
|
|
42
|
+
size: 5
|
|
43
|
+
})))), /* @__PURE__ */ React.createElement(Popover.Portal, null, /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
44
|
+
side: "bottom",
|
|
45
|
+
onKeyDownCapture: (event) => {
|
|
46
|
+
if (event.key === "Escape") {
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
setEmojiPickerOpen(false);
|
|
49
|
+
}
|
|
58
50
|
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
}, /* @__PURE__ */ React.createElement(EmojiMart, {
|
|
52
|
+
data: emojiData,
|
|
53
|
+
onEmojiSelect: ({ native }) => {
|
|
54
|
+
if (native) {
|
|
55
|
+
setEmojiValue(native);
|
|
56
|
+
setEmojiPickerOpen(false);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
autoFocus: true,
|
|
60
|
+
maxFrequentRows: 0,
|
|
61
|
+
noCountryFlags: true,
|
|
62
|
+
theme: themeMode
|
|
63
|
+
}), /* @__PURE__ */ React.createElement(Popover.Arrow, null))));
|
|
64
|
+
} finally {
|
|
65
|
+
_effect.f();
|
|
66
|
+
}
|
|
65
67
|
};
|
|
66
68
|
var EmojiPickerBlock = ({ disabled, defaultEmoji, emoji, onChangeEmoji, onClickClear, triggerVariant = "ghost", classNames }) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
data: emojiData,
|
|
104
|
-
onEmojiSelect: ({ native }) => {
|
|
105
|
-
if (native) {
|
|
106
|
-
setEmojiValue(native);
|
|
107
|
-
setEmojiPickerOpen(false);
|
|
69
|
+
var _effect = _useSignals();
|
|
70
|
+
try {
|
|
71
|
+
const { t } = useTranslation("os");
|
|
72
|
+
const [isMd] = useMediaQuery("md", {
|
|
73
|
+
ssr: false
|
|
74
|
+
});
|
|
75
|
+
const [emojiValue, setEmojiValue] = useControllableState({
|
|
76
|
+
prop: emoji,
|
|
77
|
+
onChange: onChangeEmoji,
|
|
78
|
+
defaultProp: defaultEmoji
|
|
79
|
+
});
|
|
80
|
+
const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
|
|
81
|
+
return /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
82
|
+
classNames
|
|
83
|
+
}, /* @__PURE__ */ React.createElement(Popover.Root, {
|
|
84
|
+
open: emojiPickerOpen,
|
|
85
|
+
onOpenChange: setEmojiPickerOpen
|
|
86
|
+
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
87
|
+
asChild: true
|
|
88
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
89
|
+
variant: triggerVariant,
|
|
90
|
+
classNames: "grow gap-2 text-2xl plb-1",
|
|
91
|
+
disabled
|
|
92
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
93
|
+
className: "sr-only"
|
|
94
|
+
}, t("select emoji label")), /* @__PURE__ */ React.createElement("span", null, emojiValue), /* @__PURE__ */ React.createElement(Icon, {
|
|
95
|
+
icon: "ph--caret-down--bold",
|
|
96
|
+
size: 3
|
|
97
|
+
}))), /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
98
|
+
side: "right",
|
|
99
|
+
sideOffset: isMd ? 0 : -310,
|
|
100
|
+
onKeyDownCapture: (event) => {
|
|
101
|
+
if (event.key === "Escape") {
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
setEmojiPickerOpen(false);
|
|
104
|
+
}
|
|
108
105
|
}
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
106
|
+
}, /* @__PURE__ */ React.createElement(EmojiMart, {
|
|
107
|
+
data: emojiData,
|
|
108
|
+
onEmojiSelect: ({ native }) => {
|
|
109
|
+
if (native) {
|
|
110
|
+
setEmojiValue(native);
|
|
111
|
+
setEmojiPickerOpen(false);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
autoFocus: true,
|
|
115
|
+
maxFrequentRows: 0,
|
|
116
|
+
noCountryFlags: true
|
|
117
|
+
}), /* @__PURE__ */ React.createElement(Popover.Arrow, null))), /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
118
|
+
asChild: true,
|
|
119
|
+
content: t("clear label"),
|
|
120
|
+
side: "right"
|
|
121
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
122
|
+
variant: triggerVariant,
|
|
123
|
+
onClick: onClickClear,
|
|
124
|
+
disabled
|
|
125
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
126
|
+
className: "sr-only"
|
|
127
|
+
}, t("clear label")), /* @__PURE__ */ React.createElement(Icon, {
|
|
128
|
+
icon: "ph--arrow-counter-clockwise--regular",
|
|
129
|
+
size: 5
|
|
130
|
+
}))));
|
|
131
|
+
} finally {
|
|
132
|
+
_effect.f();
|
|
133
|
+
}
|
|
127
134
|
};
|
|
128
135
|
|
|
129
136
|
// packages/ui/react-ui-pickers/src/components/HuePicker/HuePicker.tsx
|
|
137
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
130
138
|
import React3 from "react";
|
|
131
139
|
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
132
140
|
import { hues } from "@dxos/react-ui-theme";
|
|
133
141
|
|
|
134
142
|
// packages/ui/react-ui-pickers/src/components/PickerButton/PickerButton.tsx
|
|
143
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
135
144
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
136
|
-
import React2, { useEffect,
|
|
145
|
+
import React2, { useEffect, useState as useState2 } from "react";
|
|
137
146
|
import { Button as Button2, DropdownMenu, Icon as Icon2, Toolbar as Toolbar2, Tooltip as Tooltip2 } from "@dxos/react-ui";
|
|
138
147
|
var PickerButton = ({ Component, disabled, classNames, defaultValue: _defaultValue, value: _value, values, label, icon, onChange, onReset, rootVariant = "button", iconSize = 5 }) => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
setOpen
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
className: "sr-only"
|
|
172
|
-
}, label), value && /* @__PURE__ */ React2.createElement(Component, {
|
|
173
|
-
value,
|
|
174
|
-
iconSize
|
|
175
|
-
}) || /* @__PURE__ */ React2.createElement(Icon2, {
|
|
176
|
-
icon,
|
|
177
|
-
size: iconSize
|
|
178
|
-
}), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
179
|
-
icon: "ph--caret-down--bold",
|
|
180
|
-
size: 3
|
|
181
|
-
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
182
|
-
side: "bottom",
|
|
183
|
-
classNames: "!is-min"
|
|
184
|
-
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, {
|
|
185
|
-
classNames: "grid grid-cols-[repeat(6,min-content)]"
|
|
186
|
-
}, values.map((_value2) => {
|
|
187
|
-
return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
188
|
-
key: _value2,
|
|
189
|
-
checked: _value2 === value,
|
|
190
|
-
onCheckedChange: () => setValue(_value2),
|
|
191
|
-
classNames: "p-1 items-center justify-center aspect-square"
|
|
192
|
-
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
193
|
-
value: _value2,
|
|
148
|
+
var _effect = _useSignals2();
|
|
149
|
+
try {
|
|
150
|
+
const [value, setValue] = useControllableState2({
|
|
151
|
+
prop: _value,
|
|
152
|
+
defaultProp: _defaultValue,
|
|
153
|
+
onChange
|
|
154
|
+
});
|
|
155
|
+
useEffect(() => setValue(_value), [
|
|
156
|
+
_value
|
|
157
|
+
]);
|
|
158
|
+
const [open, setOpen] = useState2(false);
|
|
159
|
+
const TriggerRoot = rootVariant === "toolbar-button" ? Toolbar2.Button : Button2;
|
|
160
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
|
|
161
|
+
modal: false,
|
|
162
|
+
open,
|
|
163
|
+
onOpenChange: setOpen
|
|
164
|
+
}, /* @__PURE__ */ React2.createElement(Tooltip2.Trigger, {
|
|
165
|
+
asChild: true,
|
|
166
|
+
content: label,
|
|
167
|
+
side: "bottom"
|
|
168
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
|
|
169
|
+
asChild: true
|
|
170
|
+
}, /* @__PURE__ */ React2.createElement(TriggerRoot, {
|
|
171
|
+
classNames: [
|
|
172
|
+
"gap-2 plb-1",
|
|
173
|
+
classNames
|
|
174
|
+
],
|
|
175
|
+
disabled
|
|
176
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
177
|
+
className: "sr-only"
|
|
178
|
+
}, label), value && /* @__PURE__ */ React2.createElement(Component, {
|
|
179
|
+
value,
|
|
194
180
|
iconSize
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
181
|
+
}) || /* @__PURE__ */ React2.createElement(Icon2, {
|
|
182
|
+
icon,
|
|
183
|
+
size: iconSize
|
|
184
|
+
}), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
185
|
+
icon: "ph--caret-down--bold",
|
|
186
|
+
size: 3
|
|
187
|
+
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
188
|
+
side: "bottom",
|
|
189
|
+
classNames: "!is-min"
|
|
190
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, {
|
|
191
|
+
classNames: "grid grid-cols-[repeat(6,min-content)]"
|
|
192
|
+
}, values.map((_value2) => {
|
|
193
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
194
|
+
key: _value2,
|
|
195
|
+
checked: _value2 === value,
|
|
196
|
+
onCheckedChange: () => setValue(_value2),
|
|
197
|
+
classNames: "p-1 items-center justify-center aspect-square"
|
|
198
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
199
|
+
value: _value2,
|
|
200
|
+
iconSize
|
|
201
|
+
}));
|
|
202
|
+
}), onReset && /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
203
|
+
onCheckedChange: () => onReset(),
|
|
204
|
+
classNames: "p-1 items-center justify-center aspect-square"
|
|
205
|
+
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
206
|
+
icon: "ph--x--regular",
|
|
207
|
+
size: iconSize
|
|
208
|
+
}))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null))));
|
|
209
|
+
} finally {
|
|
210
|
+
_effect.f();
|
|
211
|
+
}
|
|
203
212
|
};
|
|
204
213
|
|
|
205
214
|
// packages/ui/react-ui-pickers/src/components/HuePicker/HuePicker.tsx
|
|
206
215
|
var HuePicker = (props) => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
var _effect = _useSignals3();
|
|
217
|
+
try {
|
|
218
|
+
const { t } = useTranslation2("os");
|
|
219
|
+
return /* @__PURE__ */ React3.createElement(PickerButton, {
|
|
220
|
+
Component: HuePreview,
|
|
221
|
+
label: t("select hue label"),
|
|
222
|
+
icon: "ph--palette--regular",
|
|
223
|
+
values: hues,
|
|
224
|
+
...props
|
|
225
|
+
});
|
|
226
|
+
} finally {
|
|
227
|
+
_effect.f();
|
|
228
|
+
}
|
|
215
229
|
};
|
|
216
230
|
var HuePreview = ({ value }) => {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
+
var _effect = _useSignals3();
|
|
232
|
+
try {
|
|
233
|
+
const size = 16;
|
|
234
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
235
|
+
className: "flex p-[2px] justify-center items-center"
|
|
236
|
+
}, /* @__PURE__ */ React3.createElement("svg", {
|
|
237
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
238
|
+
className: "is-[var(--hue-preview-size,1rem)] bs-[var(--hue-preview-size,1rem)]"
|
|
239
|
+
}, /* @__PURE__ */ React3.createElement("rect", {
|
|
240
|
+
x: 0,
|
|
241
|
+
y: 0,
|
|
242
|
+
width: size,
|
|
243
|
+
height: size,
|
|
244
|
+
fill: `var(--dx-${value}Fill)`,
|
|
245
|
+
strokeWidth: 4
|
|
246
|
+
})));
|
|
247
|
+
} finally {
|
|
248
|
+
_effect.f();
|
|
249
|
+
}
|
|
231
250
|
};
|
|
232
251
|
|
|
233
252
|
// packages/ui/react-ui-pickers/src/components/IconPicker/IconPicker.tsx
|
|
253
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
234
254
|
import React4 from "react";
|
|
235
255
|
import { Icon as Icon3, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
236
256
|
var IconPicker = ({ ...props }) => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
257
|
+
var _effect = _useSignals4();
|
|
258
|
+
try {
|
|
259
|
+
const { t } = useTranslation3("os");
|
|
260
|
+
return /* @__PURE__ */ React4.createElement(PickerButton, {
|
|
261
|
+
Component: IconPreview,
|
|
262
|
+
label: t("select icon label"),
|
|
263
|
+
icon: "ph--selection--regular",
|
|
264
|
+
values: iconValues,
|
|
265
|
+
...props
|
|
266
|
+
});
|
|
267
|
+
} finally {
|
|
268
|
+
_effect.f();
|
|
269
|
+
}
|
|
245
270
|
};
|
|
246
271
|
var IconPreview = ({ value, iconSize = 5 }) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
272
|
+
var _effect = _useSignals4();
|
|
273
|
+
try {
|
|
274
|
+
return /* @__PURE__ */ React4.createElement(Icon3, {
|
|
275
|
+
icon: `ph--${value}--regular`,
|
|
276
|
+
size: iconSize
|
|
277
|
+
});
|
|
278
|
+
} finally {
|
|
279
|
+
_effect.f();
|
|
280
|
+
}
|
|
251
281
|
};
|
|
252
282
|
var icons = [
|
|
253
283
|
"ph--air-traffic-control--regular",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/EmojiPicker/EmojiPicker.tsx", "../../../src/components/HuePicker/HuePicker.tsx", "../../../src/components/PickerButton/PickerButton.tsx", "../../../src/components/IconPicker/IconPicker.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport emojiData from '@emoji-mart/data';\nimport EmojiMart from '@emoji-mart/react';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { useRef, useState } from 'react';\n\nimport {\n Button,\n type ButtonProps,\n Popover,\n type ThemedClassName,\n Toolbar,\n Tooltip,\n useMediaQuery,\n useThemeContext,\n useTranslation,\n Icon,\n ButtonGroup,\n} from '@dxos/react-ui';\n\nimport './emoji.css';\n\nexport type EmojiPickerProps = ThemedClassName<{\n disabled?: boolean;\n defaultEmoji?: string;\n emoji?: string;\n onChangeEmoji?: (nextEmoji: string) => void;\n onClickClear?: ButtonProps['onClick'];\n triggerVariant?: ButtonProps['variant'];\n}>;\n\n/**\n * A toolbar button for picking an emoji. Use only in `role=toolbar` elements. Unable to unset the value.\n */\nexport const EmojiPickerToolbarButton = ({\n classNames,\n emoji,\n disabled,\n defaultEmoji,\n onChangeEmoji,\n}: Omit<EmojiPickerProps, 'onClickClear'>) => {\n const { t } = useTranslation('os');\n const { themeMode } = useThemeContext();\n\n const [_emojiValue, setEmojiValue] = useControllableState<string>({\n prop: emoji,\n onChange: onChangeEmoji,\n defaultProp: defaultEmoji,\n });\n\n const [emojiPickerOpen, setEmojiPickerOpen] = useState<boolean>(false);\n const suppressNextTooltip = useRef<boolean>(false);\n\n return (\n <Popover.Root\n open={emojiPickerOpen}\n onOpenChange={(nextOpen) => {\n setEmojiPickerOpen(nextOpen);\n suppressNextTooltip.current = true;\n }}\n >\n <Tooltip.Trigger\n asChild\n content={t('select emoji label')}\n side='bottom'\n suppressNextTooltip={suppressNextTooltip}\n >\n <Popover.Trigger asChild>\n <Toolbar.Button classNames={['gap-2 text-2xl plb-1', classNames]} disabled={disabled}>\n <span className='sr-only'>{t('select emoji label')}</span>\n <Icon icon='ph--user-circle--regular' size={5} />\n </Toolbar.Button>\n </Popover.Trigger>\n </Tooltip.Trigger>\n <Popover.Portal>\n <Popover.Content\n side='bottom'\n onKeyDownCapture={(event) => {\n if (event.key === 'Escape') {\n event.stopPropagation();\n setEmojiPickerOpen(false);\n suppressNextTooltip.current = true;\n }\n }}\n >\n {/* https://github.com/missive/emoji-mart?tab=readme-ov-file#options--props */}\n <EmojiMart\n data={emojiData}\n onEmojiSelect={({ native }: { native?: string }) => {\n if (native) {\n setEmojiValue(native);\n setEmojiPickerOpen(false);\n }\n }}\n autoFocus={true}\n maxFrequentRows={0}\n noCountryFlags={true}\n theme={themeMode}\n />\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n\n/**\n * A button for picking an emoji alongside a button for unsetting it.\n */\nexport const EmojiPickerBlock = ({\n disabled,\n defaultEmoji,\n emoji,\n onChangeEmoji,\n onClickClear,\n triggerVariant = 'ghost',\n classNames,\n}: EmojiPickerProps) => {\n const { t } = useTranslation('os');\n const [isMd] = useMediaQuery('md', { ssr: false });\n\n const [emojiValue, setEmojiValue] = useControllableState<string>({\n prop: emoji,\n onChange: onChangeEmoji,\n defaultProp: defaultEmoji,\n });\n\n const [emojiPickerOpen, setEmojiPickerOpen] = useState<boolean>(false);\n\n return (\n <ButtonGroup classNames={classNames}>\n <Popover.Root open={emojiPickerOpen} onOpenChange={setEmojiPickerOpen}>\n <Popover.Trigger asChild>\n <Button variant={triggerVariant} classNames='grow gap-2 text-2xl plb-1' disabled={disabled}>\n <span className='sr-only'>{t('select emoji label')}</span>\n <span>{emojiValue}</span>\n <Icon icon='ph--caret-down--bold' size={3} />\n </Button>\n </Popover.Trigger>\n <Popover.Content\n side='right'\n sideOffset={isMd ? 0 : -310}\n onKeyDownCapture={(event) => {\n if (event.key === 'Escape') {\n event.stopPropagation();\n setEmojiPickerOpen(false);\n }\n }}\n >\n <EmojiMart\n data={emojiData}\n onEmojiSelect={({ native }: { native?: string }) => {\n if (native) {\n setEmojiValue(native);\n setEmojiPickerOpen(false);\n }\n }}\n autoFocus={true}\n maxFrequentRows={0}\n noCountryFlags={true}\n />\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Root>\n <Tooltip.Trigger asChild content={t('clear label')} side='right'>\n <Button variant={triggerVariant} onClick={onClickClear} disabled={disabled}>\n <span className='sr-only'>{t('clear label')}</span>\n <Icon icon='ph--arrow-counter-clockwise--regular' size={5} />\n </Button>\n </Tooltip.Trigger>\n </ButtonGroup>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { hues } from '@dxos/react-ui-theme';\n\nimport { PickerButton, type PickerButtonProps } from '../PickerButton';\n\nexport type HuePickerProps = {\n disabled?: boolean;\n defaultValue?: string;\n value?: string;\n onChange?: (nextHue: string) => void;\n onReset?: ButtonProps['onClick'];\n} & Pick<PickerButtonProps, 'disabled' | 'defaultValue' | 'value' | 'onChange' | 'onReset' | 'rootVariant'>;\n\nexport const HuePicker = (props: ThemedClassName<HuePickerProps>) => {\n const { t } = useTranslation('os');\n\n return (\n <PickerButton\n Component={HuePreview}\n label={t('select hue label')}\n icon='ph--palette--regular'\n values={hues}\n {...props}\n />\n );\n};\n\nconst HuePreview = ({ value }: { value: string }) => {\n const size = 16;\n return (\n <div className='flex p-[2px] justify-center items-center'>\n <svg\n viewBox={`0 0 ${size} ${size}`}\n className='is-[var(--hue-preview-size,1rem)] bs-[var(--hue-preview-size,1rem)]'\n >\n <rect x={0} y={0} width={size} height={size} fill={`var(--dx-${value}Fill)`} strokeWidth={4} />\n </svg>\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type FC, useEffect, useRef, useState } from 'react';\n\nimport { Button, DropdownMenu, Icon, type IconProps, type ThemedClassName, Toolbar, Tooltip } from '@dxos/react-ui';\n\nexport type PickerButtonProps = ThemedClassName<{\n Component: FC<{ value: string; iconSize?: IconProps['size'] }>;\n label: string;\n icon: string;\n values: string[];\n disabled?: boolean;\n defaultValue?: string;\n value?: string;\n onChange?: (value: string) => void;\n onReset?: () => void;\n rootVariant?: 'button' | 'toolbar-button';\n iconSize?: IconProps['size'];\n}>;\n\nexport const PickerButton = ({\n Component,\n disabled,\n classNames,\n defaultValue: _defaultValue,\n value: _value,\n values,\n label,\n icon,\n onChange,\n onReset,\n rootVariant = 'button',\n iconSize = 5,\n}: PickerButtonProps) => {\n const [value, setValue] = useControllableState<string>({\n prop: _value,\n defaultProp: _defaultValue,\n onChange,\n });\n // TODO(burdon): useControllableState doesn't update the prop when the value is changed. Replace it.\n useEffect(() => setValue(_value), [_value]);\n\n const [open, setOpen] = useState<boolean>(false);\n\n const suppressNextTooltip = useRef<boolean>(false);\n\n const TriggerRoot = rootVariant === 'toolbar-button' ? Toolbar.Button : Button;\n\n return (\n <DropdownMenu.Root\n modal={false}\n open={open}\n onOpenChange={(nextOpen) => {\n setOpen(nextOpen);\n suppressNextTooltip.current = true;\n }}\n >\n <Tooltip.Trigger asChild content={label} side='bottom' suppressNextTooltip={suppressNextTooltip}>\n <DropdownMenu.Trigger asChild>\n <TriggerRoot classNames={['gap-2 plb-1', classNames]} disabled={disabled}>\n <span className='sr-only'>{label}</span>\n {(value && <Component value={value} iconSize={iconSize} />) || <Icon icon={icon} size={iconSize} />}\n <Icon icon='ph--caret-down--bold' size={3} />\n </TriggerRoot>\n </DropdownMenu.Trigger>\n </Tooltip.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content side='bottom' classNames='!is-min'>\n <DropdownMenu.Viewport classNames='grid grid-cols-[repeat(6,min-content)]'>\n {values.map((_value) => {\n return (\n <DropdownMenu.CheckboxItem\n key={_value}\n checked={_value === value}\n onCheckedChange={() => setValue(_value)}\n classNames={'p-1 items-center justify-center aspect-square'}\n >\n <Component value={_value} iconSize={iconSize} />\n </DropdownMenu.CheckboxItem>\n );\n })}\n {onReset && (\n <DropdownMenu.CheckboxItem\n onCheckedChange={() => onReset()}\n classNames={'p-1 items-center justify-center aspect-square'}\n >\n <Icon icon='ph--x--regular' size={iconSize} />\n </DropdownMenu.CheckboxItem>\n )}\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ButtonProps, Icon, type IconProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';\n\nimport { PickerButton, type PickerButtonProps } from '../PickerButton';\n\nexport type IconPickerProps = {\n disabled?: boolean;\n defaultValue?: string;\n value?: string;\n onChange?: (nextHue: string) => void;\n onReset?: ButtonProps['onClick'];\n} & Pick<\n PickerButtonProps,\n 'disabled' | 'defaultValue' | 'value' | 'onChange' | 'onReset' | 'rootVariant' | 'iconSize'\n>;\n\nexport const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {\n const { t } = useTranslation('os');\n\n return (\n <PickerButton\n Component={IconPreview}\n label={t('select icon label')}\n icon='ph--selection--regular'\n values={iconValues}\n {...props}\n />\n );\n};\n\nconst IconPreview = ({ value, iconSize = 5 }: { value: string; iconSize?: IconProps['size'] }) => {\n return <Icon icon={`ph--${value}--regular`} size={iconSize} />;\n};\n\n/**\n * https://phosphoricons.com\n * NOTE: Select icons that we are unlikely to use for the UI.\n */\nconst icons = [\n 'ph--air-traffic-control--regular',\n 'ph--asterisk--regular',\n 'ph--atom--regular',\n 'ph--basketball--regular',\n 'ph--butterfly--regular',\n 'ph--cactus--regular',\n 'ph--cake--regular',\n 'ph--calendar-dots--regular',\n 'ph--campfire--regular',\n 'ph--command--regular',\n 'ph--confetti--regular',\n 'ph--detective--regular',\n 'ph--disco-ball--regular',\n 'ph--dna--regular',\n 'ph--factory--regular',\n 'ph--flag-banner-fold--regular',\n 'ph--flask--regular',\n 'ph--flower-lotus--regular',\n 'ph--flying-saucer--regular',\n 'ph--game-controller--regular',\n 'ph--gavel--regular',\n 'ph--gift--regular',\n 'ph--guitar--regular',\n 'ph--hamburger--regular',\n 'ph--handshake--regular',\n 'ph--heart--regular',\n 'ph--lightbulb--regular',\n 'ph--lock--regular',\n 'ph--martini--regular',\n 'ph--medal-military--regular',\n 'ph--moped-front--regular',\n 'ph--office-chair--regular',\n 'ph--paint-brush-household--regular',\n 'ph--peace--regular',\n 'ph--person-simple-hike--regular',\n 'ph--piggy-bank--regular',\n 'ph--potted-plant--regular',\n 'ph--radioactive--regular',\n 'ph--rocket-launch--regular',\n 'ph--shield-star--regular',\n 'ph--shopping-cart--regular',\n 'ph--stethoscope--regular',\n 'ph--student--regular',\n 'ph--sun--regular',\n 'ph--tote--regular',\n 'ph--tree--regular',\n 'ph--users-three--regular',\n 'ph--yin-yang--regular',\n];\n\nconst iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["emojiData", "EmojiMart", "useControllableState", "React", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport emojiData from '@emoji-mart/data';\nimport EmojiMart from '@emoji-mart/react';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { useState } from 'react';\n\nimport {\n Button,\n type ButtonProps,\n Popover,\n type ThemedClassName,\n Toolbar,\n Tooltip,\n useMediaQuery,\n useThemeContext,\n useTranslation,\n Icon,\n ButtonGroup,\n} from '@dxos/react-ui';\n\nimport './emoji.css';\n\nexport type EmojiPickerProps = ThemedClassName<{\n disabled?: boolean;\n defaultEmoji?: string;\n emoji?: string;\n onChangeEmoji?: (nextEmoji: string) => void;\n onClickClear?: ButtonProps['onClick'];\n triggerVariant?: ButtonProps['variant'];\n}>;\n\n/**\n * A toolbar button for picking an emoji. Use only in `role=toolbar` elements. Unable to unset the value.\n */\nexport const EmojiPickerToolbarButton = ({\n classNames,\n emoji,\n disabled,\n defaultEmoji,\n onChangeEmoji,\n}: Omit<EmojiPickerProps, 'onClickClear'>) => {\n const { t } = useTranslation('os');\n const { themeMode } = useThemeContext();\n\n const [_emojiValue, setEmojiValue] = useControllableState<string>({\n prop: emoji,\n onChange: onChangeEmoji,\n defaultProp: defaultEmoji,\n });\n\n const [emojiPickerOpen, setEmojiPickerOpen] = useState<boolean>(false);\n\n return (\n <Popover.Root\n open={emojiPickerOpen}\n onOpenChange={(nextOpen) => {\n setEmojiPickerOpen(nextOpen);\n }}\n >\n <Tooltip.Trigger asChild content={t('select emoji label')} side='bottom'>\n <Popover.Trigger asChild>\n <Toolbar.Button classNames={['gap-2 text-2xl plb-1', classNames]} disabled={disabled}>\n <span className='sr-only'>{t('select emoji label')}</span>\n <Icon icon='ph--user-circle--regular' size={5} />\n </Toolbar.Button>\n </Popover.Trigger>\n </Tooltip.Trigger>\n <Popover.Portal>\n <Popover.Content\n side='bottom'\n onKeyDownCapture={(event) => {\n if (event.key === 'Escape') {\n event.stopPropagation();\n setEmojiPickerOpen(false);\n }\n }}\n >\n {/* https://github.com/missive/emoji-mart?tab=readme-ov-file#options--props */}\n <EmojiMart\n data={emojiData}\n onEmojiSelect={({ native }: { native?: string }) => {\n if (native) {\n setEmojiValue(native);\n setEmojiPickerOpen(false);\n }\n }}\n autoFocus={true}\n maxFrequentRows={0}\n noCountryFlags={true}\n theme={themeMode}\n />\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n\n/**\n * A button for picking an emoji alongside a button for unsetting it.\n */\nexport const EmojiPickerBlock = ({\n disabled,\n defaultEmoji,\n emoji,\n onChangeEmoji,\n onClickClear,\n triggerVariant = 'ghost',\n classNames,\n}: EmojiPickerProps) => {\n const { t } = useTranslation('os');\n const [isMd] = useMediaQuery('md', { ssr: false });\n\n const [emojiValue, setEmojiValue] = useControllableState<string>({\n prop: emoji,\n onChange: onChangeEmoji,\n defaultProp: defaultEmoji,\n });\n\n const [emojiPickerOpen, setEmojiPickerOpen] = useState<boolean>(false);\n\n return (\n <ButtonGroup classNames={classNames}>\n <Popover.Root open={emojiPickerOpen} onOpenChange={setEmojiPickerOpen}>\n <Popover.Trigger asChild>\n <Button variant={triggerVariant} classNames='grow gap-2 text-2xl plb-1' disabled={disabled}>\n <span className='sr-only'>{t('select emoji label')}</span>\n <span>{emojiValue}</span>\n <Icon icon='ph--caret-down--bold' size={3} />\n </Button>\n </Popover.Trigger>\n <Popover.Content\n side='right'\n sideOffset={isMd ? 0 : -310}\n onKeyDownCapture={(event) => {\n if (event.key === 'Escape') {\n event.stopPropagation();\n setEmojiPickerOpen(false);\n }\n }}\n >\n <EmojiMart\n data={emojiData}\n onEmojiSelect={({ native }: { native?: string }) => {\n if (native) {\n setEmojiValue(native);\n setEmojiPickerOpen(false);\n }\n }}\n autoFocus={true}\n maxFrequentRows={0}\n noCountryFlags={true}\n />\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Root>\n <Tooltip.Trigger asChild content={t('clear label')} side='right'>\n <Button variant={triggerVariant} onClick={onClickClear} disabled={disabled}>\n <span className='sr-only'>{t('clear label')}</span>\n <Icon icon='ph--arrow-counter-clockwise--regular' size={5} />\n </Button>\n </Tooltip.Trigger>\n </ButtonGroup>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { hues } from '@dxos/react-ui-theme';\n\nimport { PickerButton, type PickerButtonProps } from '../PickerButton';\n\nexport type HuePickerProps = {\n disabled?: boolean;\n defaultValue?: string;\n value?: string;\n onChange?: (nextHue: string) => void;\n onReset?: ButtonProps['onClick'];\n} & Pick<PickerButtonProps, 'disabled' | 'defaultValue' | 'value' | 'onChange' | 'onReset' | 'rootVariant'>;\n\nexport const HuePicker = (props: ThemedClassName<HuePickerProps>) => {\n const { t } = useTranslation('os');\n\n return (\n <PickerButton\n Component={HuePreview}\n label={t('select hue label')}\n icon='ph--palette--regular'\n values={hues}\n {...props}\n />\n );\n};\n\nconst HuePreview = ({ value }: { value: string }) => {\n const size = 16;\n return (\n <div className='flex p-[2px] justify-center items-center'>\n <svg\n viewBox={`0 0 ${size} ${size}`}\n className='is-[var(--hue-preview-size,1rem)] bs-[var(--hue-preview-size,1rem)]'\n >\n <rect x={0} y={0} width={size} height={size} fill={`var(--dx-${value}Fill)`} strokeWidth={4} />\n </svg>\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type FC, useEffect, useState } from 'react';\n\nimport { Button, DropdownMenu, Icon, type IconProps, type ThemedClassName, Toolbar, Tooltip } from '@dxos/react-ui';\n\nexport type PickerButtonProps = ThemedClassName<{\n Component: FC<{ value: string; iconSize?: IconProps['size'] }>;\n label: string;\n icon: string;\n values: string[];\n disabled?: boolean;\n defaultValue?: string;\n value?: string;\n onChange?: (value: string) => void;\n onReset?: () => void;\n rootVariant?: 'button' | 'toolbar-button';\n iconSize?: IconProps['size'];\n}>;\n\nexport const PickerButton = ({\n Component,\n disabled,\n classNames,\n defaultValue: _defaultValue,\n value: _value,\n values,\n label,\n icon,\n onChange,\n onReset,\n rootVariant = 'button',\n iconSize = 5,\n}: PickerButtonProps) => {\n const [value, setValue] = useControllableState<string>({\n prop: _value,\n defaultProp: _defaultValue,\n onChange,\n });\n // TODO(burdon): useControllableState doesn't update the prop when the value is changed. Replace it.\n useEffect(() => setValue(_value), [_value]);\n\n const [open, setOpen] = useState<boolean>(false);\n\n const TriggerRoot = rootVariant === 'toolbar-button' ? Toolbar.Button : Button;\n\n return (\n <DropdownMenu.Root modal={false} open={open} onOpenChange={setOpen}>\n <Tooltip.Trigger asChild content={label} side='bottom'>\n <DropdownMenu.Trigger asChild>\n <TriggerRoot classNames={['gap-2 plb-1', classNames]} disabled={disabled}>\n <span className='sr-only'>{label}</span>\n {(value && <Component value={value} iconSize={iconSize} />) || <Icon icon={icon} size={iconSize} />}\n <Icon icon='ph--caret-down--bold' size={3} />\n </TriggerRoot>\n </DropdownMenu.Trigger>\n </Tooltip.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content side='bottom' classNames='!is-min'>\n <DropdownMenu.Viewport classNames='grid grid-cols-[repeat(6,min-content)]'>\n {values.map((_value) => {\n return (\n <DropdownMenu.CheckboxItem\n key={_value}\n checked={_value === value}\n onCheckedChange={() => setValue(_value)}\n classNames={'p-1 items-center justify-center aspect-square'}\n >\n <Component value={_value} iconSize={iconSize} />\n </DropdownMenu.CheckboxItem>\n );\n })}\n {onReset && (\n <DropdownMenu.CheckboxItem\n onCheckedChange={() => onReset()}\n classNames={'p-1 items-center justify-center aspect-square'}\n >\n <Icon icon='ph--x--regular' size={iconSize} />\n </DropdownMenu.CheckboxItem>\n )}\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ButtonProps, Icon, type IconProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';\n\nimport { PickerButton, type PickerButtonProps } from '../PickerButton';\n\nexport type IconPickerProps = {\n disabled?: boolean;\n defaultValue?: string;\n value?: string;\n onChange?: (nextHue: string) => void;\n onReset?: ButtonProps['onClick'];\n} & Pick<\n PickerButtonProps,\n 'disabled' | 'defaultValue' | 'value' | 'onChange' | 'onReset' | 'rootVariant' | 'iconSize'\n>;\n\nexport const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {\n const { t } = useTranslation('os');\n\n return (\n <PickerButton\n Component={IconPreview}\n label={t('select icon label')}\n icon='ph--selection--regular'\n values={iconValues}\n {...props}\n />\n );\n};\n\nconst IconPreview = ({ value, iconSize = 5 }: { value: string; iconSize?: IconProps['size'] }) => {\n return <Icon icon={`ph--${value}--regular`} size={iconSize} />;\n};\n\n/**\n * https://phosphoricons.com\n * NOTE: Select icons that we are unlikely to use for the UI.\n */\nconst icons = [\n 'ph--air-traffic-control--regular',\n 'ph--asterisk--regular',\n 'ph--atom--regular',\n 'ph--basketball--regular',\n 'ph--butterfly--regular',\n 'ph--cactus--regular',\n 'ph--cake--regular',\n 'ph--calendar-dots--regular',\n 'ph--campfire--regular',\n 'ph--command--regular',\n 'ph--confetti--regular',\n 'ph--detective--regular',\n 'ph--disco-ball--regular',\n 'ph--dna--regular',\n 'ph--factory--regular',\n 'ph--flag-banner-fold--regular',\n 'ph--flask--regular',\n 'ph--flower-lotus--regular',\n 'ph--flying-saucer--regular',\n 'ph--game-controller--regular',\n 'ph--gavel--regular',\n 'ph--gift--regular',\n 'ph--guitar--regular',\n 'ph--hamburger--regular',\n 'ph--handshake--regular',\n 'ph--heart--regular',\n 'ph--lightbulb--regular',\n 'ph--lock--regular',\n 'ph--martini--regular',\n 'ph--medal-military--regular',\n 'ph--moped-front--regular',\n 'ph--office-chair--regular',\n 'ph--paint-brush-household--regular',\n 'ph--peace--regular',\n 'ph--person-simple-hike--regular',\n 'ph--piggy-bank--regular',\n 'ph--potted-plant--regular',\n 'ph--radioactive--regular',\n 'ph--rocket-launch--regular',\n 'ph--shield-star--regular',\n 'ph--shopping-cart--regular',\n 'ph--stethoscope--regular',\n 'ph--student--regular',\n 'ph--sun--regular',\n 'ph--tote--regular',\n 'ph--tree--regular',\n 'ph--users-three--regular',\n 'ph--yin-yang--regular',\n];\n\nconst iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);\n"],
|
|
5
|
+
"mappings": ";;;;AAIA,OAAOA,eAAe;AACtB,OAAOC,eAAe;AACtB,SAASC,4BAA4B;AACrC,OAAOC,SAASC,gBAAgB;AAEhC,SACEC,QAEAC,SAEAC,SACAC,SACAC,eACAC,iBACAC,gBACAC,MACAC,mBACK;AAgBA,IAAMC,2BAA2B,CAAC,EACvCC,YACAC,OACAC,UACAC,cACAC,cAAa,MAC0B;;;AACvC,UAAM,EAAEC,EAAC,IAAKC,eAAe,IAAA;AAC7B,UAAM,EAAEC,UAAS,IAAKC,gBAAAA;AAEtB,UAAM,CAACC,aAAaC,aAAAA,IAAiBC,qBAA6B;MAChEC,MAAMX;MACNY,UAAUT;MACVU,aAAaX;IACf,CAAA;AAEA,UAAM,CAACY,iBAAiBC,kBAAAA,IAAsBC,SAAkB,KAAA;AAEhE,WACE,sBAAA,cAACC,QAAQC,MAAI;MACXC,MAAML;MACNM,cAAc,CAACC,aAAAA;AACbN,2BAAmBM,QAAAA;MACrB;OAEA,sBAAA,cAACC,QAAQC,SAAO;MAACC,SAAAA;MAAQC,SAASrB,EAAE,oBAAA;MAAuBsB,MAAK;OAC9D,sBAAA,cAACT,QAAQM,SAAO;MAACC,SAAAA;OACf,sBAAA,cAACG,QAAQC,QAAM;MAAC7B,YAAY;QAAC;QAAwBA;;MAAaE;OAChE,sBAAA,cAAC4B,QAAAA;MAAKC,WAAU;OAAW1B,EAAE,oBAAA,CAAA,GAC7B,sBAAA,cAAC2B,MAAAA;MAAKC,MAAK;MAA2BC,MAAM;WAIlD,sBAAA,cA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ACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF,IAAML,aAAaK,MAAMC,IAAI,CAACR,SAASA,KAAKS,MAAM,mBAAA,IAAuB,CAAA,KAAMT,IAAAA;",
|
|
6
|
+
"names": ["emojiData", "EmojiMart", "useControllableState", "React", "useState", "Button", "Popover", "Toolbar", "Tooltip", "useMediaQuery", "useThemeContext", "useTranslation", "Icon", "ButtonGroup", "EmojiPickerToolbarButton", "classNames", "emoji", "disabled", "defaultEmoji", "onChangeEmoji", "t", "useTranslation", "themeMode", "useThemeContext", "_emojiValue", "setEmojiValue", "useControllableState", "prop", "onChange", "defaultProp", "emojiPickerOpen", "setEmojiPickerOpen", "useState", "Popover", "Root", "open", "onOpenChange", "nextOpen", "Tooltip", "Trigger", "asChild", "content", "side", "Toolbar", "Button", "span", "className", "Icon", "icon", "size", "Portal", "Content", "onKeyDownCapture", "event", "key", "stopPropagation", "EmojiMart", "data", "emojiData", "onEmojiSelect", "native", "autoFocus", "maxFrequentRows", "noCountryFlags", "theme", "Arrow", "EmojiPickerBlock", "onClickClear", "triggerVariant", "isMd", "useMediaQuery", "ssr", "emojiValue", "ButtonGroup", "variant", "sideOffset", "onClick", "React", "useTranslation", "hues", "useControllableState", "React", "useEffect", "useState", "Button", "DropdownMenu", "Icon", "Toolbar", "Tooltip", "PickerButton", "Component", "disabled", "classNames", "defaultValue", "_defaultValue", "value", "_value", "values", "label", "icon", "onChange", "onReset", "rootVariant", "iconSize", "setValue", "useControllableState", "prop", "defaultProp", "useEffect", "open", "setOpen", "useState", "TriggerRoot", "Toolbar", "Button", "React", "DropdownMenu", "Root", "modal", "onOpenChange", "Tooltip", "Trigger", "asChild", "content", "side", "span", "className", "Icon", "size", "Portal", "Content", "Viewport", "map", "CheckboxItem", "key", "checked", "onCheckedChange", "Arrow", "HuePicker", "props", "t", "useTranslation", "React", "PickerButton", "Component", "HuePreview", "label", "icon", "values", "hues", "value", "size", "div", "className", "svg", "viewBox", "rect", "x", "y", "width", "height", "fill", "strokeWidth", "React", "Icon", "useTranslation", "IconPicker", "props", "t", "useTranslation", "React", "PickerButton", "Component", "IconPreview", "label", "icon", "values", "iconValues", "value", "iconSize", "Icon", "size", "icons", "map", "match"]
|
|
7
7
|
}
|