@dxos/react-ui-pickers 0.8.3 → 0.8.4-main.1068cf700f
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/chunk-IEOELSPW.mjs +64 -0
- package/dist/lib/browser/chunk-IEOELSPW.mjs.map +7 -0
- package/dist/lib/browser/components/IconPicker/icons.mjs +9 -0
- package/dist/lib/browser/components/IconPicker/icons.mjs.map +7 -0
- package/dist/lib/browser/index.css +1 -1
- package/dist/lib/browser/index.mjs +200 -300
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/chunk-OLGXN23I.mjs +66 -0
- package/dist/lib/node-esm/chunk-OLGXN23I.mjs.map +7 -0
- package/dist/lib/node-esm/components/IconPicker/icons.mjs +10 -0
- package/dist/lib/node-esm/components/IconPicker/icons.mjs.map +7 -0
- package/dist/lib/node-esm/index.css +1 -1
- package/dist/lib/node-esm/index.mjs +199 -300
- 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/EmojiPicker/EmojiPicker.stories.d.ts +8 -4
- package/dist/types/src/components/EmojiPicker/EmojiPicker.stories.d.ts.map +1 -1
- package/dist/types/src/components/HuePicker/HuePicker.d.ts.map +1 -1
- package/dist/types/src/components/HuePicker/HuePicker.stories.d.ts +10 -4
- package/dist/types/src/components/HuePicker/HuePicker.stories.d.ts.map +1 -1
- package/dist/types/src/components/IconPicker/IconPicker.d.ts +1 -1
- package/dist/types/src/components/IconPicker/IconPicker.d.ts.map +1 -1
- package/dist/types/src/components/IconPicker/IconPicker.stories.d.ts +10 -4
- package/dist/types/src/components/IconPicker/IconPicker.stories.d.ts.map +1 -1
- package/dist/types/src/components/IconPicker/icons.d.ts +7 -0
- package/dist/types/src/components/IconPicker/icons.d.ts.map +1 -0
- package/dist/types/src/components/PickerButton/PickerButton.d.ts +2 -2
- package/dist/types/src/components/PickerButton/PickerButton.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -18
- package/src/components/EmojiPicker/EmojiPicker.stories.tsx +13 -16
- package/src/components/EmojiPicker/EmojiPicker.tsx +25 -20
- package/src/components/HuePicker/HuePicker.stories.tsx +11 -13
- package/src/components/HuePicker/HuePicker.tsx +6 -10
- package/src/components/IconPicker/IconPicker.stories.tsx +11 -13
- package/src/components/IconPicker/IconPicker.tsx +7 -61
- package/src/components/IconPicker/icons.ts +66 -0
- package/src/components/PickerButton/PickerButton.tsx +8 -9
- package/dist/lib/node/index.cjs +0 -367
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/index.css +0 -7
- package/dist/lib/node/index.css.map +0 -7
- package/dist/lib/node/meta.json +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/components/IconPicker/icons.ts
|
|
2
|
+
var icons = [
|
|
3
|
+
"ph--house-line--regular",
|
|
4
|
+
"ph--planet--regular",
|
|
5
|
+
"ph--castle-turret--regular",
|
|
6
|
+
"ph--snowflake--regular",
|
|
7
|
+
"ph--virus--regular",
|
|
8
|
+
"ph--graph--regular",
|
|
9
|
+
"ph--air-traffic-control--regular",
|
|
10
|
+
"ph--asterisk--regular",
|
|
11
|
+
"ph--atom--regular",
|
|
12
|
+
"ph--basketball--regular",
|
|
13
|
+
"ph--butterfly--regular",
|
|
14
|
+
"ph--cactus--regular",
|
|
15
|
+
"ph--cake--regular",
|
|
16
|
+
"ph--calendar-dots--regular",
|
|
17
|
+
"ph--campfire--regular",
|
|
18
|
+
"ph--command--regular",
|
|
19
|
+
"ph--confetti--regular",
|
|
20
|
+
"ph--detective--regular",
|
|
21
|
+
"ph--disco-ball--regular",
|
|
22
|
+
"ph--dna--regular",
|
|
23
|
+
"ph--factory--regular",
|
|
24
|
+
"ph--flag-banner-fold--regular",
|
|
25
|
+
"ph--flask--regular",
|
|
26
|
+
"ph--flower-lotus--regular",
|
|
27
|
+
"ph--flying-saucer--regular",
|
|
28
|
+
"ph--game-controller--regular",
|
|
29
|
+
"ph--gavel--regular",
|
|
30
|
+
"ph--gift--regular",
|
|
31
|
+
"ph--guitar--regular",
|
|
32
|
+
"ph--hamburger--regular",
|
|
33
|
+
"ph--handshake--regular",
|
|
34
|
+
"ph--heart--regular",
|
|
35
|
+
"ph--lightbulb--regular",
|
|
36
|
+
"ph--lock--regular",
|
|
37
|
+
"ph--martini--regular",
|
|
38
|
+
"ph--medal-military--regular",
|
|
39
|
+
"ph--moped-front--regular",
|
|
40
|
+
"ph--office-chair--regular",
|
|
41
|
+
"ph--paint-brush-household--regular",
|
|
42
|
+
"ph--peace--regular",
|
|
43
|
+
"ph--person-simple-hike--regular",
|
|
44
|
+
"ph--piggy-bank--regular",
|
|
45
|
+
"ph--potted-plant--regular",
|
|
46
|
+
"ph--radioactive--regular",
|
|
47
|
+
"ph--rocket-launch--regular",
|
|
48
|
+
"ph--shield-star--regular",
|
|
49
|
+
"ph--shopping-cart--regular",
|
|
50
|
+
"ph--stethoscope--regular",
|
|
51
|
+
"ph--student--regular",
|
|
52
|
+
"ph--sun--regular",
|
|
53
|
+
"ph--tote--regular",
|
|
54
|
+
"ph--tree--regular",
|
|
55
|
+
"ph--users-three--regular",
|
|
56
|
+
"ph--yin-yang--regular"
|
|
57
|
+
];
|
|
58
|
+
var iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
icons,
|
|
62
|
+
iconValues
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=chunk-IEOELSPW.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/IconPicker/icons.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * https://phosphoricons.com\n * NOTE: Select icons that we are unlikely to use for the UI.\n */\nexport const icons = [\n 'ph--house-line--regular',\n 'ph--planet--regular',\n 'ph--castle-turret--regular',\n 'ph--snowflake--regular',\n 'ph--virus--regular',\n 'ph--graph--regular',\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\nexport const iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);\n"],
|
|
5
|
+
"mappings": ";AAQO,IAAMA,QAAQ;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGK,IAAMC,aAAaD,MAAME,IAAI,CAACC,SAASA,KAAKC,MAAM,mBAAA,IAAuB,CAAA,KAAMD,IAAAA;",
|
|
6
|
+
"names": ["icons", "iconValues", "map", "icon", "match"]
|
|
7
|
+
}
|
|
@@ -1,333 +1,233 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
iconValues
|
|
3
|
+
} from "./chunk-IEOELSPW.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/EmojiPicker/EmojiPicker.tsx
|
|
3
6
|
import emojiData from "@emoji-mart/data";
|
|
4
7
|
import EmojiMart from "@emoji-mart/react";
|
|
5
8
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
6
9
|
import React, { useState } from "react";
|
|
7
|
-
import { Button,
|
|
10
|
+
import { Button, ButtonGroup, Icon, IconButton, Popover, Toolbar, useMediaQuery, useThemeContext, useTranslation } from "@dxos/react-ui";
|
|
11
|
+
import { osTranslations } from "@dxos/ui-theme";
|
|
8
12
|
var EmojiPickerToolbarButton = ({ classNames, emoji, disabled, defaultEmoji, onChangeEmoji }) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const { t } = useTranslation(osTranslations);
|
|
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);
|
|
25
|
+
}
|
|
26
|
+
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
27
|
+
asChild: true
|
|
28
|
+
}, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
|
|
29
|
+
icon: "ph--user-circle--regular",
|
|
30
|
+
label: t("select emoji label"),
|
|
31
|
+
iconOnly: true,
|
|
32
|
+
tooltipSide: "bottom",
|
|
33
|
+
disabled
|
|
34
|
+
})), /* @__PURE__ */ React.createElement(Popover.Portal, null, /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
35
|
+
side: "bottom",
|
|
36
|
+
onKeyDownCapture: (event) => {
|
|
37
|
+
if (event.key === "Escape") {
|
|
38
|
+
event.stopPropagation();
|
|
39
|
+
setEmojiPickerOpen(false);
|
|
23
40
|
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
}
|
|
41
|
+
}
|
|
42
|
+
}, /* @__PURE__ */ React.createElement(EmojiMart, {
|
|
43
|
+
data: emojiData,
|
|
44
|
+
onEmojiSelect: ({ native }) => {
|
|
45
|
+
if (native) {
|
|
46
|
+
setEmojiValue(native);
|
|
47
|
+
setEmojiPickerOpen(false);
|
|
48
48
|
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
}
|
|
49
|
+
},
|
|
50
|
+
autoFocus: true,
|
|
51
|
+
maxFrequentRows: 0,
|
|
52
|
+
noCountryFlags: true,
|
|
53
|
+
theme: themeMode
|
|
54
|
+
}), /* @__PURE__ */ React.createElement(Popover.Arrow, null))));
|
|
65
55
|
};
|
|
66
56
|
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
|
-
|
|
57
|
+
const { t } = useTranslation(osTranslations);
|
|
58
|
+
const [isMd] = useMediaQuery("md");
|
|
59
|
+
const [emojiValue, setEmojiValue] = useControllableState({
|
|
60
|
+
prop: emoji,
|
|
61
|
+
onChange: onChangeEmoji,
|
|
62
|
+
defaultProp: defaultEmoji
|
|
63
|
+
});
|
|
64
|
+
const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
|
|
65
|
+
return /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
66
|
+
classNames
|
|
67
|
+
}, /* @__PURE__ */ React.createElement(Popover.Root, {
|
|
68
|
+
open: emojiPickerOpen,
|
|
69
|
+
onOpenChange: setEmojiPickerOpen
|
|
70
|
+
}, /* @__PURE__ */ React.createElement(Popover.Trigger, {
|
|
71
|
+
asChild: true
|
|
72
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
73
|
+
variant: triggerVariant,
|
|
74
|
+
classNames: "grow gap-2 text-2xl plb-1",
|
|
75
|
+
disabled
|
|
76
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
77
|
+
className: "sr-only"
|
|
78
|
+
}, t("select emoji label")), /* @__PURE__ */ React.createElement("span", null, emojiValue), /* @__PURE__ */ React.createElement(Icon, {
|
|
79
|
+
icon: "ph--caret-down--bold",
|
|
80
|
+
size: 3
|
|
81
|
+
}))), /* @__PURE__ */ React.createElement(Popover.Content, {
|
|
82
|
+
side: "right",
|
|
83
|
+
sideOffset: isMd ? 0 : -310,
|
|
84
|
+
onKeyDownCapture: (event) => {
|
|
85
|
+
if (event.key === "Escape") {
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
setEmojiPickerOpen(false);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, /* @__PURE__ */ React.createElement(EmojiMart, {
|
|
91
|
+
data: emojiData,
|
|
92
|
+
onEmojiSelect: ({ native }) => {
|
|
93
|
+
if (native) {
|
|
94
|
+
setEmojiValue(native);
|
|
95
|
+
setEmojiPickerOpen(false);
|
|
103
96
|
}
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
}
|
|
97
|
+
},
|
|
98
|
+
autoFocus: true,
|
|
99
|
+
maxFrequentRows: 0,
|
|
100
|
+
noCountryFlags: true
|
|
101
|
+
}), /* @__PURE__ */ React.createElement(Popover.Arrow, null))), /* @__PURE__ */ React.createElement(IconButton, {
|
|
102
|
+
icon: "ph--arrow-counter-clockwise--regular",
|
|
103
|
+
iconOnly: true,
|
|
104
|
+
label: t("clear label"),
|
|
105
|
+
tooltipSide: "right",
|
|
106
|
+
variant: triggerVariant,
|
|
107
|
+
onClick: onClickClear,
|
|
108
|
+
disabled
|
|
109
|
+
}));
|
|
132
110
|
};
|
|
133
111
|
|
|
134
|
-
//
|
|
135
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
112
|
+
// src/components/HuePicker/HuePicker.tsx
|
|
136
113
|
import React3 from "react";
|
|
137
114
|
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
138
|
-
import { hues } from "@dxos/
|
|
115
|
+
import { getSize, hues, osTranslations as osTranslations2 } from "@dxos/ui-theme";
|
|
139
116
|
|
|
140
|
-
//
|
|
141
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
117
|
+
// src/components/PickerButton/PickerButton.tsx
|
|
142
118
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
143
119
|
import React2, { useEffect, useState as useState2 } from "react";
|
|
144
|
-
import { Button as Button2, DropdownMenu, Icon as Icon2, Toolbar as Toolbar2, Tooltip
|
|
145
|
-
var PickerButton = ({ Component, disabled, classNames, defaultValue:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
classNames
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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(),
|
|
120
|
+
import { Button as Button2, DropdownMenu, Icon as Icon2, Toolbar as Toolbar2, Tooltip } from "@dxos/react-ui";
|
|
121
|
+
var PickerButton = ({ Component, disabled, classNames, defaultValue: defaultValueProp, value: valueProp, values, label, icon, onChange, onReset, rootVariant = "button", iconSize = 5 }) => {
|
|
122
|
+
const [value, setValue] = useControllableState2({
|
|
123
|
+
prop: valueProp,
|
|
124
|
+
defaultProp: defaultValueProp,
|
|
125
|
+
onChange
|
|
126
|
+
});
|
|
127
|
+
useEffect(() => setValue(valueProp), [
|
|
128
|
+
valueProp
|
|
129
|
+
]);
|
|
130
|
+
const [open, setOpen] = useState2(false);
|
|
131
|
+
const TriggerRoot = rootVariant === "toolbar-button" ? Toolbar2.Button : Button2;
|
|
132
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
|
|
133
|
+
modal: false,
|
|
134
|
+
open,
|
|
135
|
+
onOpenChange: setOpen
|
|
136
|
+
}, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
137
|
+
asChild: true,
|
|
138
|
+
content: label,
|
|
139
|
+
side: "bottom"
|
|
140
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
|
|
141
|
+
asChild: true
|
|
142
|
+
}, /* @__PURE__ */ React2.createElement(TriggerRoot, {
|
|
143
|
+
classNames: [
|
|
144
|
+
"gap-2 plb-1",
|
|
145
|
+
classNames
|
|
146
|
+
],
|
|
147
|
+
disabled
|
|
148
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
149
|
+
className: "sr-only"
|
|
150
|
+
}, label), value && /* @__PURE__ */ React2.createElement(Component, {
|
|
151
|
+
value,
|
|
152
|
+
size: iconSize
|
|
153
|
+
}) || /* @__PURE__ */ React2.createElement(Icon2, {
|
|
154
|
+
icon,
|
|
155
|
+
size: iconSize
|
|
156
|
+
}), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
157
|
+
icon: "ph--caret-down--bold",
|
|
158
|
+
size: 3
|
|
159
|
+
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
160
|
+
side: "bottom",
|
|
161
|
+
classNames: "!is-min"
|
|
162
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, {
|
|
163
|
+
classNames: "grid grid-cols-[repeat(6,min-content)]"
|
|
164
|
+
}, values.map((_value) => {
|
|
165
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
166
|
+
key: _value,
|
|
167
|
+
checked: _value === value,
|
|
168
|
+
onCheckedChange: () => setValue(_value),
|
|
202
169
|
classNames: "p-1 items-center justify-center aspect-square"
|
|
203
|
-
}, /* @__PURE__ */ React2.createElement(
|
|
204
|
-
|
|
170
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
171
|
+
value: _value,
|
|
205
172
|
size: iconSize
|
|
206
|
-
}))
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
173
|
+
}));
|
|
174
|
+
}), onReset && /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
175
|
+
onCheckedChange: () => onReset(),
|
|
176
|
+
classNames: "p-1 items-center justify-center aspect-square"
|
|
177
|
+
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
178
|
+
icon: "ph--x--regular",
|
|
179
|
+
size: iconSize
|
|
180
|
+
}))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null))));
|
|
210
181
|
};
|
|
211
182
|
|
|
212
|
-
//
|
|
183
|
+
// src/components/HuePicker/HuePicker.tsx
|
|
213
184
|
var HuePicker = (props) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
...props
|
|
223
|
-
});
|
|
224
|
-
} finally {
|
|
225
|
-
_effect.f();
|
|
226
|
-
}
|
|
185
|
+
const { t } = useTranslation2(osTranslations2);
|
|
186
|
+
return /* @__PURE__ */ React3.createElement(PickerButton, {
|
|
187
|
+
Component: HuePreview,
|
|
188
|
+
label: t("select hue label"),
|
|
189
|
+
icon: "ph--palette--regular",
|
|
190
|
+
values: hues,
|
|
191
|
+
...props
|
|
192
|
+
});
|
|
227
193
|
};
|
|
228
|
-
var HuePreview = ({ value }) => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
strokeWidth: 4
|
|
244
|
-
})));
|
|
245
|
-
} finally {
|
|
246
|
-
_effect.f();
|
|
247
|
-
}
|
|
194
|
+
var HuePreview = ({ value, size = 5 }) => {
|
|
195
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
196
|
+
role: "none",
|
|
197
|
+
className: "flex justify-center items-center"
|
|
198
|
+
}, /* @__PURE__ */ React3.createElement("svg", {
|
|
199
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
200
|
+
className: getSize(size)
|
|
201
|
+
}, /* @__PURE__ */ React3.createElement("rect", {
|
|
202
|
+
x: 0,
|
|
203
|
+
y: 0,
|
|
204
|
+
width: size,
|
|
205
|
+
height: size,
|
|
206
|
+
fill: `var(--dx-${value}Fill)`,
|
|
207
|
+
strokeWidth: 4
|
|
208
|
+
})));
|
|
248
209
|
};
|
|
249
210
|
|
|
250
|
-
//
|
|
251
|
-
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
211
|
+
// src/components/IconPicker/IconPicker.tsx
|
|
252
212
|
import React4 from "react";
|
|
253
213
|
import { Icon as Icon3, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
214
|
+
import { osTranslations as osTranslations3 } from "@dxos/ui-theme";
|
|
254
215
|
var IconPicker = ({ ...props }) => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
...props
|
|
264
|
-
});
|
|
265
|
-
} finally {
|
|
266
|
-
_effect.f();
|
|
267
|
-
}
|
|
216
|
+
const { t } = useTranslation3(osTranslations3);
|
|
217
|
+
return /* @__PURE__ */ React4.createElement(PickerButton, {
|
|
218
|
+
Component: IconPreview,
|
|
219
|
+
label: t("select icon label"),
|
|
220
|
+
icon: "ph--selection--regular",
|
|
221
|
+
values: iconValues,
|
|
222
|
+
...props
|
|
223
|
+
});
|
|
268
224
|
};
|
|
269
|
-
var IconPreview = ({ value,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
size: iconSize
|
|
275
|
-
});
|
|
276
|
-
} finally {
|
|
277
|
-
_effect.f();
|
|
278
|
-
}
|
|
225
|
+
var IconPreview = ({ value, size }) => {
|
|
226
|
+
return /* @__PURE__ */ React4.createElement(Icon3, {
|
|
227
|
+
icon: `ph--${value}--regular`,
|
|
228
|
+
size
|
|
229
|
+
});
|
|
279
230
|
};
|
|
280
|
-
var icons = [
|
|
281
|
-
"ph--air-traffic-control--regular",
|
|
282
|
-
"ph--asterisk--regular",
|
|
283
|
-
"ph--atom--regular",
|
|
284
|
-
"ph--basketball--regular",
|
|
285
|
-
"ph--butterfly--regular",
|
|
286
|
-
"ph--cactus--regular",
|
|
287
|
-
"ph--cake--regular",
|
|
288
|
-
"ph--calendar-dots--regular",
|
|
289
|
-
"ph--campfire--regular",
|
|
290
|
-
"ph--command--regular",
|
|
291
|
-
"ph--confetti--regular",
|
|
292
|
-
"ph--detective--regular",
|
|
293
|
-
"ph--disco-ball--regular",
|
|
294
|
-
"ph--dna--regular",
|
|
295
|
-
"ph--factory--regular",
|
|
296
|
-
"ph--flag-banner-fold--regular",
|
|
297
|
-
"ph--flask--regular",
|
|
298
|
-
"ph--flower-lotus--regular",
|
|
299
|
-
"ph--flying-saucer--regular",
|
|
300
|
-
"ph--game-controller--regular",
|
|
301
|
-
"ph--gavel--regular",
|
|
302
|
-
"ph--gift--regular",
|
|
303
|
-
"ph--guitar--regular",
|
|
304
|
-
"ph--hamburger--regular",
|
|
305
|
-
"ph--handshake--regular",
|
|
306
|
-
"ph--heart--regular",
|
|
307
|
-
"ph--lightbulb--regular",
|
|
308
|
-
"ph--lock--regular",
|
|
309
|
-
"ph--martini--regular",
|
|
310
|
-
"ph--medal-military--regular",
|
|
311
|
-
"ph--moped-front--regular",
|
|
312
|
-
"ph--office-chair--regular",
|
|
313
|
-
"ph--paint-brush-household--regular",
|
|
314
|
-
"ph--peace--regular",
|
|
315
|
-
"ph--person-simple-hike--regular",
|
|
316
|
-
"ph--piggy-bank--regular",
|
|
317
|
-
"ph--potted-plant--regular",
|
|
318
|
-
"ph--radioactive--regular",
|
|
319
|
-
"ph--rocket-launch--regular",
|
|
320
|
-
"ph--shield-star--regular",
|
|
321
|
-
"ph--shopping-cart--regular",
|
|
322
|
-
"ph--stethoscope--regular",
|
|
323
|
-
"ph--student--regular",
|
|
324
|
-
"ph--sun--regular",
|
|
325
|
-
"ph--tote--regular",
|
|
326
|
-
"ph--tree--regular",
|
|
327
|
-
"ph--users-three--regular",
|
|
328
|
-
"ph--yin-yang--regular"
|
|
329
|
-
];
|
|
330
|
-
var iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);
|
|
331
231
|
export {
|
|
332
232
|
EmojiPickerBlock,
|
|
333
233
|
EmojiPickerToolbarButton,
|