@dxos/react-ui-pickers 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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,251 +1,281 @@
|
|
|
1
1
|
// packages/ui/react-ui-pickers/src/components/EmojiPicker/EmojiPicker.tsx
|
|
2
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
2
3
|
import emojiData from "@emoji-mart/data";
|
|
3
4
|
import EmojiMart from "@emoji-mart/react";
|
|
4
5
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
5
|
-
import React, {
|
|
6
|
+
import React, { useState } from "react";
|
|
6
7
|
import { Button, Popover, Toolbar, Tooltip, useMediaQuery, useThemeContext, useTranslation, Icon, ButtonGroup } from "@dxos/react-ui";
|
|
7
8
|
var EmojiPickerToolbarButton = ({ classNames, emoji, disabled, defaultEmoji, onChangeEmoji }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
24
|
-
asChild: true,
|
|
25
|
-
content: t("select emoji label"),
|
|
26
|
-
side: "bottom",
|
|
27
|
-
suppressNextTooltip
|
|
28
|
-
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
29
|
-
asChild: true
|
|
30
|
-
}, /* @__PURE__ */ React.createElement(Toolbar.Button, {
|
|
31
|
-
classNames: [
|
|
32
|
-
"gap-2 text-2xl plb-1",
|
|
33
|
-
classNames
|
|
34
|
-
],
|
|
35
|
-
disabled
|
|
36
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
37
|
-
className: "sr-only"
|
|
38
|
-
}, t("select emoji label")), /* @__PURE__ */ React.createElement(Icon, {
|
|
39
|
-
icon: "ph--user-circle--regular",
|
|
40
|
-
size: 5
|
|
41
|
-
})))), /* @__PURE__ */ React.createElement(Popover.Portal, null, /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
42
|
-
side: "bottom",
|
|
43
|
-
onKeyDownCapture: (event) => {
|
|
44
|
-
if (event.key === "Escape") {
|
|
45
|
-
event.stopPropagation();
|
|
46
|
-
setEmojiPickerOpen(false);
|
|
47
|
-
suppressNextTooltip.current = true;
|
|
9
|
+
var _effect = _useSignals();
|
|
10
|
+
try {
|
|
11
|
+
const { t } = useTranslation("os");
|
|
12
|
+
const { themeMode } = useThemeContext();
|
|
13
|
+
const [_emojiValue, setEmojiValue] = useControllableState({
|
|
14
|
+
prop: emoji,
|
|
15
|
+
onChange: onChangeEmoji,
|
|
16
|
+
defaultProp: defaultEmoji
|
|
17
|
+
});
|
|
18
|
+
const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
|
|
19
|
+
return /* @__PURE__ */ React.createElement(Popover.Root, {
|
|
20
|
+
open: emojiPickerOpen,
|
|
21
|
+
onOpenChange: (nextOpen) => {
|
|
22
|
+
setEmojiPickerOpen(nextOpen);
|
|
48
23
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
24
|
+
}, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
25
|
+
asChild: true,
|
|
26
|
+
content: t("select emoji label"),
|
|
27
|
+
side: "bottom"
|
|
28
|
+
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
29
|
+
asChild: true
|
|
30
|
+
}, /* @__PURE__ */ React.createElement(Toolbar.Button, {
|
|
31
|
+
classNames: [
|
|
32
|
+
"gap-2 text-2xl plb-1",
|
|
33
|
+
classNames
|
|
34
|
+
],
|
|
35
|
+
disabled
|
|
36
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
37
|
+
className: "sr-only"
|
|
38
|
+
}, t("select emoji label")), /* @__PURE__ */ React.createElement(Icon, {
|
|
39
|
+
icon: "ph--user-circle--regular",
|
|
40
|
+
size: 5
|
|
41
|
+
})))), /* @__PURE__ */ React.createElement(Popover.Portal, null, /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
42
|
+
side: "bottom",
|
|
43
|
+
onKeyDownCapture: (event) => {
|
|
44
|
+
if (event.key === "Escape") {
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
setEmojiPickerOpen(false);
|
|
47
|
+
}
|
|
56
48
|
}
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
}, /* @__PURE__ */ React.createElement(EmojiMart, {
|
|
50
|
+
data: emojiData,
|
|
51
|
+
onEmojiSelect: ({ native }) => {
|
|
52
|
+
if (native) {
|
|
53
|
+
setEmojiValue(native);
|
|
54
|
+
setEmojiPickerOpen(false);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
autoFocus: true,
|
|
58
|
+
maxFrequentRows: 0,
|
|
59
|
+
noCountryFlags: true,
|
|
60
|
+
theme: themeMode
|
|
61
|
+
}), /* @__PURE__ */ React.createElement(Popover.Arrow, null))));
|
|
62
|
+
} finally {
|
|
63
|
+
_effect.f();
|
|
64
|
+
}
|
|
63
65
|
};
|
|
64
66
|
var EmojiPickerBlock = ({ disabled, defaultEmoji, emoji, onChangeEmoji, onClickClear, triggerVariant = "ghost", classNames }) => {
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
data: emojiData,
|
|
102
|
-
onEmojiSelect: ({ native }) => {
|
|
103
|
-
if (native) {
|
|
104
|
-
setEmojiValue(native);
|
|
105
|
-
setEmojiPickerOpen(false);
|
|
67
|
+
var _effect = _useSignals();
|
|
68
|
+
try {
|
|
69
|
+
const { t } = useTranslation("os");
|
|
70
|
+
const [isMd] = useMediaQuery("md", {
|
|
71
|
+
ssr: false
|
|
72
|
+
});
|
|
73
|
+
const [emojiValue, setEmojiValue] = useControllableState({
|
|
74
|
+
prop: emoji,
|
|
75
|
+
onChange: onChangeEmoji,
|
|
76
|
+
defaultProp: defaultEmoji
|
|
77
|
+
});
|
|
78
|
+
const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
|
|
79
|
+
return /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
80
|
+
classNames
|
|
81
|
+
}, /* @__PURE__ */ React.createElement(Popover.Root, {
|
|
82
|
+
open: emojiPickerOpen,
|
|
83
|
+
onOpenChange: setEmojiPickerOpen
|
|
84
|
+
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
85
|
+
asChild: true
|
|
86
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
87
|
+
variant: triggerVariant,
|
|
88
|
+
classNames: "grow gap-2 text-2xl plb-1",
|
|
89
|
+
disabled
|
|
90
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
91
|
+
className: "sr-only"
|
|
92
|
+
}, t("select emoji label")), /* @__PURE__ */ React.createElement("span", null, emojiValue), /* @__PURE__ */ React.createElement(Icon, {
|
|
93
|
+
icon: "ph--caret-down--bold",
|
|
94
|
+
size: 3
|
|
95
|
+
}))), /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
96
|
+
side: "right",
|
|
97
|
+
sideOffset: isMd ? 0 : -310,
|
|
98
|
+
onKeyDownCapture: (event) => {
|
|
99
|
+
if (event.key === "Escape") {
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
setEmojiPickerOpen(false);
|
|
102
|
+
}
|
|
106
103
|
}
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
104
|
+
}, /* @__PURE__ */ React.createElement(EmojiMart, {
|
|
105
|
+
data: emojiData,
|
|
106
|
+
onEmojiSelect: ({ native }) => {
|
|
107
|
+
if (native) {
|
|
108
|
+
setEmojiValue(native);
|
|
109
|
+
setEmojiPickerOpen(false);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
autoFocus: true,
|
|
113
|
+
maxFrequentRows: 0,
|
|
114
|
+
noCountryFlags: true
|
|
115
|
+
}), /* @__PURE__ */ React.createElement(Popover.Arrow, null))), /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
116
|
+
asChild: true,
|
|
117
|
+
content: t("clear label"),
|
|
118
|
+
side: "right"
|
|
119
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
120
|
+
variant: triggerVariant,
|
|
121
|
+
onClick: onClickClear,
|
|
122
|
+
disabled
|
|
123
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
124
|
+
className: "sr-only"
|
|
125
|
+
}, t("clear label")), /* @__PURE__ */ React.createElement(Icon, {
|
|
126
|
+
icon: "ph--arrow-counter-clockwise--regular",
|
|
127
|
+
size: 5
|
|
128
|
+
}))));
|
|
129
|
+
} finally {
|
|
130
|
+
_effect.f();
|
|
131
|
+
}
|
|
125
132
|
};
|
|
126
133
|
|
|
127
134
|
// packages/ui/react-ui-pickers/src/components/HuePicker/HuePicker.tsx
|
|
135
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
128
136
|
import React3 from "react";
|
|
129
137
|
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
130
138
|
import { hues } from "@dxos/react-ui-theme";
|
|
131
139
|
|
|
132
140
|
// packages/ui/react-ui-pickers/src/components/PickerButton/PickerButton.tsx
|
|
141
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
133
142
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
134
|
-
import React2, { useEffect,
|
|
143
|
+
import React2, { useEffect, useState as useState2 } from "react";
|
|
135
144
|
import { Button as Button2, DropdownMenu, Icon as Icon2, Toolbar as Toolbar2, Tooltip as Tooltip2 } from "@dxos/react-ui";
|
|
136
145
|
var PickerButton = ({ Component, disabled, classNames, defaultValue: _defaultValue, value: _value, values, label, icon, onChange, onReset, rootVariant = "button", iconSize = 5 }) => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
setOpen
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
className: "sr-only"
|
|
170
|
-
}, label), value && /* @__PURE__ */ React2.createElement(Component, {
|
|
171
|
-
value,
|
|
172
|
-
iconSize
|
|
173
|
-
}) || /* @__PURE__ */ React2.createElement(Icon2, {
|
|
174
|
-
icon,
|
|
175
|
-
size: iconSize
|
|
176
|
-
}), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
177
|
-
icon: "ph--caret-down--bold",
|
|
178
|
-
size: 3
|
|
179
|
-
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
180
|
-
side: "bottom",
|
|
181
|
-
classNames: "!is-min"
|
|
182
|
-
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, {
|
|
183
|
-
classNames: "grid grid-cols-[repeat(6,min-content)]"
|
|
184
|
-
}, values.map((_value2) => {
|
|
185
|
-
return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
186
|
-
key: _value2,
|
|
187
|
-
checked: _value2 === value,
|
|
188
|
-
onCheckedChange: () => setValue(_value2),
|
|
189
|
-
classNames: "p-1 items-center justify-center aspect-square"
|
|
190
|
-
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
191
|
-
value: _value2,
|
|
146
|
+
var _effect = _useSignals2();
|
|
147
|
+
try {
|
|
148
|
+
const [value, setValue] = useControllableState2({
|
|
149
|
+
prop: _value,
|
|
150
|
+
defaultProp: _defaultValue,
|
|
151
|
+
onChange
|
|
152
|
+
});
|
|
153
|
+
useEffect(() => setValue(_value), [
|
|
154
|
+
_value
|
|
155
|
+
]);
|
|
156
|
+
const [open, setOpen] = useState2(false);
|
|
157
|
+
const TriggerRoot = rootVariant === "toolbar-button" ? Toolbar2.Button : Button2;
|
|
158
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
|
|
159
|
+
modal: false,
|
|
160
|
+
open,
|
|
161
|
+
onOpenChange: setOpen
|
|
162
|
+
}, /* @__PURE__ */ React2.createElement(Tooltip2.Trigger, {
|
|
163
|
+
asChild: true,
|
|
164
|
+
content: label,
|
|
165
|
+
side: "bottom"
|
|
166
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
|
|
167
|
+
asChild: true
|
|
168
|
+
}, /* @__PURE__ */ React2.createElement(TriggerRoot, {
|
|
169
|
+
classNames: [
|
|
170
|
+
"gap-2 plb-1",
|
|
171
|
+
classNames
|
|
172
|
+
],
|
|
173
|
+
disabled
|
|
174
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
175
|
+
className: "sr-only"
|
|
176
|
+
}, label), value && /* @__PURE__ */ React2.createElement(Component, {
|
|
177
|
+
value,
|
|
192
178
|
iconSize
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
179
|
+
}) || /* @__PURE__ */ React2.createElement(Icon2, {
|
|
180
|
+
icon,
|
|
181
|
+
size: iconSize
|
|
182
|
+
}), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
183
|
+
icon: "ph--caret-down--bold",
|
|
184
|
+
size: 3
|
|
185
|
+
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
186
|
+
side: "bottom",
|
|
187
|
+
classNames: "!is-min"
|
|
188
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, {
|
|
189
|
+
classNames: "grid grid-cols-[repeat(6,min-content)]"
|
|
190
|
+
}, values.map((_value2) => {
|
|
191
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
192
|
+
key: _value2,
|
|
193
|
+
checked: _value2 === value,
|
|
194
|
+
onCheckedChange: () => setValue(_value2),
|
|
195
|
+
classNames: "p-1 items-center justify-center aspect-square"
|
|
196
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
197
|
+
value: _value2,
|
|
198
|
+
iconSize
|
|
199
|
+
}));
|
|
200
|
+
}), onReset && /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
201
|
+
onCheckedChange: () => onReset(),
|
|
202
|
+
classNames: "p-1 items-center justify-center aspect-square"
|
|
203
|
+
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
204
|
+
icon: "ph--x--regular",
|
|
205
|
+
size: iconSize
|
|
206
|
+
}))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null))));
|
|
207
|
+
} finally {
|
|
208
|
+
_effect.f();
|
|
209
|
+
}
|
|
201
210
|
};
|
|
202
211
|
|
|
203
212
|
// packages/ui/react-ui-pickers/src/components/HuePicker/HuePicker.tsx
|
|
204
213
|
var HuePicker = (props) => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
var _effect = _useSignals3();
|
|
215
|
+
try {
|
|
216
|
+
const { t } = useTranslation2("os");
|
|
217
|
+
return /* @__PURE__ */ React3.createElement(PickerButton, {
|
|
218
|
+
Component: HuePreview,
|
|
219
|
+
label: t("select hue label"),
|
|
220
|
+
icon: "ph--palette--regular",
|
|
221
|
+
values: hues,
|
|
222
|
+
...props
|
|
223
|
+
});
|
|
224
|
+
} finally {
|
|
225
|
+
_effect.f();
|
|
226
|
+
}
|
|
213
227
|
};
|
|
214
228
|
var HuePreview = ({ value }) => {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
var _effect = _useSignals3();
|
|
230
|
+
try {
|
|
231
|
+
const size = 16;
|
|
232
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
233
|
+
className: "flex p-[2px] justify-center items-center"
|
|
234
|
+
}, /* @__PURE__ */ React3.createElement("svg", {
|
|
235
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
236
|
+
className: "is-[var(--hue-preview-size,1rem)] bs-[var(--hue-preview-size,1rem)]"
|
|
237
|
+
}, /* @__PURE__ */ React3.createElement("rect", {
|
|
238
|
+
x: 0,
|
|
239
|
+
y: 0,
|
|
240
|
+
width: size,
|
|
241
|
+
height: size,
|
|
242
|
+
fill: `var(--dx-${value}Fill)`,
|
|
243
|
+
strokeWidth: 4
|
|
244
|
+
})));
|
|
245
|
+
} finally {
|
|
246
|
+
_effect.f();
|
|
247
|
+
}
|
|
229
248
|
};
|
|
230
249
|
|
|
231
250
|
// packages/ui/react-ui-pickers/src/components/IconPicker/IconPicker.tsx
|
|
251
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
232
252
|
import React4 from "react";
|
|
233
253
|
import { Icon as Icon3, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
234
254
|
var IconPicker = ({ ...props }) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
255
|
+
var _effect = _useSignals4();
|
|
256
|
+
try {
|
|
257
|
+
const { t } = useTranslation3("os");
|
|
258
|
+
return /* @__PURE__ */ React4.createElement(PickerButton, {
|
|
259
|
+
Component: IconPreview,
|
|
260
|
+
label: t("select icon label"),
|
|
261
|
+
icon: "ph--selection--regular",
|
|
262
|
+
values: iconValues,
|
|
263
|
+
...props
|
|
264
|
+
});
|
|
265
|
+
} finally {
|
|
266
|
+
_effect.f();
|
|
267
|
+
}
|
|
243
268
|
};
|
|
244
269
|
var IconPreview = ({ value, iconSize = 5 }) => {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
270
|
+
var _effect = _useSignals4();
|
|
271
|
+
try {
|
|
272
|
+
return /* @__PURE__ */ React4.createElement(Icon3, {
|
|
273
|
+
icon: `ph--${value}--regular`,
|
|
274
|
+
size: iconSize
|
|
275
|
+
});
|
|
276
|
+
} finally {
|
|
277
|
+
_effect.f();
|
|
278
|
+
}
|
|
249
279
|
};
|
|
250
280
|
var icons = [
|
|
251
281
|
"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,cAAChB,QAAQiB,QAAM,MACb,sBAAA,cAACjB,QAAQkB,SAAO;MACdT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ACA;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
|
}
|