@dxos/react-ui-pickers 0.8.4-main.fffef41 → 0.8.4-staging.ac66bdf99f
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 +2 -2
- package/dist/lib/browser/index.css.map +2 -2
- package/dist/lib/browser/index.mjs +192 -284
- 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 +2 -2
- package/dist/lib/node-esm/index.css.map +2 -2
- package/dist/lib/node-esm/index.mjs +191 -284
- 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 +1 -1
- package/dist/types/src/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/dist/types/src/components/HuePicker/HuePicker.stories.d.ts +1 -1
- package/dist/types/src/components/IconPicker/IconPicker.d.ts +0 -6
- package/dist/types/src/components/IconPicker/IconPicker.d.ts.map +1 -1
- package/dist/types/src/components/IconPicker/IconPicker.stories.d.ts +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 +31 -18
- package/src/components/EmojiPicker/EmojiPicker.stories.tsx +1 -1
- package/src/components/EmojiPicker/EmojiPicker.tsx +9 -8
- package/src/components/EmojiPicker/emoji.css +5 -21
- package/src/components/HuePicker/HuePicker.stories.tsx +1 -1
- package/src/components/HuePicker/HuePicker.tsx +4 -4
- package/src/components/IconPicker/IconPicker.stories.tsx +1 -1
- package/src/components/IconPicker/IconPicker.tsx +4 -65
- package/src/components/IconPicker/icons.ts +66 -0
- package/src/components/PickerButton/PickerButton.tsx +8 -8
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-pickers",
|
|
3
|
-
"version": "0.8.4-
|
|
3
|
+
"version": "0.8.4-staging.ac66bdf99f",
|
|
4
4
|
"description": "A collection of picker components.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"type": "module",
|
|
@@ -13,11 +17,21 @@
|
|
|
13
17
|
"types": "./dist/types/src/index.d.ts",
|
|
14
18
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
19
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./icons": {
|
|
22
|
+
"source": "./src/components/IconPicker/icons.ts",
|
|
23
|
+
"types": "./dist/types/src/components/IconPicker/icons.d.ts",
|
|
24
|
+
"browser": "./dist/lib/browser/components/IconPicker/icons.mjs",
|
|
25
|
+
"node": "./dist/lib/node-esm/components/IconPicker/icons.mjs"
|
|
16
26
|
}
|
|
17
27
|
},
|
|
18
28
|
"types": "dist/types/src/index.d.ts",
|
|
19
29
|
"typesVersions": {
|
|
20
|
-
"*": {
|
|
30
|
+
"*": {
|
|
31
|
+
"icons": [
|
|
32
|
+
"./dist/types/src/components/IconPicker/icons.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
21
35
|
},
|
|
22
36
|
"files": [
|
|
23
37
|
"dist",
|
|
@@ -26,28 +40,27 @@
|
|
|
26
40
|
"dependencies": {
|
|
27
41
|
"@emoji-mart/data": "^1.1.2",
|
|
28
42
|
"@emoji-mart/react": "^1.1.1",
|
|
29
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
30
43
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
31
44
|
"react-resize-detector": "^11.0.1",
|
|
32
|
-
"@dxos/log": "0.8.4-
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/util": "0.8.4-
|
|
45
|
+
"@dxos/log": "0.8.4-staging.ac66bdf99f",
|
|
46
|
+
"@dxos/ui-types": "0.8.4-staging.ac66bdf99f",
|
|
47
|
+
"@dxos/util": "0.8.4-staging.ac66bdf99f"
|
|
35
48
|
},
|
|
36
49
|
"devDependencies": {
|
|
37
|
-
"@types/react": "~19.2.
|
|
38
|
-
"@types/react-dom": "~19.2.
|
|
39
|
-
"react": "~19.2.
|
|
40
|
-
"react-dom": "~19.2.
|
|
41
|
-
"vite": "7.1.
|
|
42
|
-
"@dxos/react-ui": "0.8.4-
|
|
43
|
-
"@dxos/storybook-utils": "0.8.4-
|
|
44
|
-
"@dxos/
|
|
50
|
+
"@types/react": "~19.2.7",
|
|
51
|
+
"@types/react-dom": "~19.2.3",
|
|
52
|
+
"react": "~19.2.3",
|
|
53
|
+
"react-dom": "~19.2.3",
|
|
54
|
+
"vite": "^7.1.11",
|
|
55
|
+
"@dxos/react-ui": "0.8.4-staging.ac66bdf99f",
|
|
56
|
+
"@dxos/storybook-utils": "0.8.4-staging.ac66bdf99f",
|
|
57
|
+
"@dxos/ui-theme": "0.8.4-staging.ac66bdf99f"
|
|
45
58
|
},
|
|
46
59
|
"peerDependencies": {
|
|
47
|
-
"react": "
|
|
48
|
-
"react-dom": "
|
|
49
|
-
"@dxos/react-ui": "0.8.4-
|
|
50
|
-
"@dxos/
|
|
60
|
+
"react": "~19.2.3",
|
|
61
|
+
"react-dom": "~19.2.3",
|
|
62
|
+
"@dxos/react-ui": "0.8.4-staging.ac66bdf99f",
|
|
63
|
+
"@dxos/ui-theme": "0.8.4-staging.ac66bdf99f"
|
|
51
64
|
},
|
|
52
65
|
"publishConfig": {
|
|
53
66
|
"access": "public"
|
|
@@ -14,7 +14,7 @@ import { EmojiPickerBlock, type EmojiPickerProps, EmojiPickerToolbarButton } fro
|
|
|
14
14
|
const meta = {
|
|
15
15
|
title: 'ui/react-ui-pickers/EmojiPicker',
|
|
16
16
|
component: EmojiPicker,
|
|
17
|
-
decorators: [withTheme, withLayout({
|
|
17
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
18
18
|
} satisfies Meta<typeof EmojiPicker>;
|
|
19
19
|
|
|
20
20
|
export default meta;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import './emoji.css';
|
|
6
|
+
|
|
5
7
|
import emojiData from '@emoji-mart/data';
|
|
6
8
|
import EmojiMart from '@emoji-mart/react';
|
|
7
9
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
@@ -20,8 +22,7 @@ import {
|
|
|
20
22
|
useThemeContext,
|
|
21
23
|
useTranslation,
|
|
22
24
|
} from '@dxos/react-ui';
|
|
23
|
-
|
|
24
|
-
import './emoji.css';
|
|
25
|
+
import { osTranslations } from '@dxos/ui-theme';
|
|
25
26
|
|
|
26
27
|
export type EmojiPickerProps = ThemedClassName<{
|
|
27
28
|
disabled?: boolean;
|
|
@@ -42,7 +43,7 @@ export const EmojiPickerToolbarButton = ({
|
|
|
42
43
|
defaultEmoji,
|
|
43
44
|
onChangeEmoji,
|
|
44
45
|
}: Omit<EmojiPickerProps, 'onClickClear'>) => {
|
|
45
|
-
const { t } = useTranslation(
|
|
46
|
+
const { t } = useTranslation(osTranslations);
|
|
46
47
|
const { themeMode } = useThemeContext();
|
|
47
48
|
|
|
48
49
|
const [_emojiValue, setEmojiValue] = useControllableState<string>({
|
|
@@ -63,7 +64,7 @@ export const EmojiPickerToolbarButton = ({
|
|
|
63
64
|
<Popover.Trigger asChild>
|
|
64
65
|
<Toolbar.IconButton
|
|
65
66
|
icon='ph--user-circle--regular'
|
|
66
|
-
label={t('select
|
|
67
|
+
label={t('select-emoji.label')}
|
|
67
68
|
iconOnly
|
|
68
69
|
tooltipSide='bottom'
|
|
69
70
|
disabled={disabled}
|
|
@@ -112,7 +113,7 @@ export const EmojiPickerBlock = ({
|
|
|
112
113
|
triggerVariant = 'ghost',
|
|
113
114
|
classNames,
|
|
114
115
|
}: EmojiPickerProps) => {
|
|
115
|
-
const { t } = useTranslation(
|
|
116
|
+
const { t } = useTranslation(osTranslations);
|
|
116
117
|
const [isMd] = useMediaQuery('md');
|
|
117
118
|
|
|
118
119
|
const [emojiValue, setEmojiValue] = useControllableState<string>({
|
|
@@ -127,8 +128,8 @@ export const EmojiPickerBlock = ({
|
|
|
127
128
|
<ButtonGroup classNames={classNames}>
|
|
128
129
|
<Popover.Root open={emojiPickerOpen} onOpenChange={setEmojiPickerOpen}>
|
|
129
130
|
<Popover.Trigger asChild>
|
|
130
|
-
<Button variant={triggerVariant} classNames='grow gap-2 text-2xl
|
|
131
|
-
<span className='sr-only'>{t('select
|
|
131
|
+
<Button variant={triggerVariant} classNames='grow gap-2 text-2xl py-1' disabled={disabled}>
|
|
132
|
+
<span className='sr-only'>{t('select-emoji.label')}</span>
|
|
132
133
|
<span>{emojiValue}</span>
|
|
133
134
|
<Icon icon='ph--caret-down--bold' size={3} />
|
|
134
135
|
</Button>
|
|
@@ -161,7 +162,7 @@ export const EmojiPickerBlock = ({
|
|
|
161
162
|
<IconButton
|
|
162
163
|
icon='ph--arrow-counter-clockwise--regular'
|
|
163
164
|
iconOnly
|
|
164
|
-
label={t('clear
|
|
165
|
+
label={t('clear.label')}
|
|
165
166
|
tooltipSide='right'
|
|
166
167
|
variant={triggerVariant}
|
|
167
168
|
onClick={onClickClear}
|
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* https://github.com/missive/emoji-mart/blob/main/packages/emoji-mart-website/example-custom-styles.html
|
|
3
3
|
*/
|
|
4
|
-
[data-theme=
|
|
5
|
-
/* TODO(burdon):
|
|
6
|
-
--background-rgb: #
|
|
7
|
-
--rgb-background: #
|
|
8
|
-
|
|
9
|
-
--font-family: "Inter Variable", ui-sans-serif;
|
|
10
|
-
|
|
11
|
-
/*--font-size: 16px;*/
|
|
12
|
-
/*--color-border-over: rgba(0, 0, 0, 0.1);*/
|
|
13
|
-
/*--color-border: rgba(0, 0, 0, 0.05);*/
|
|
14
|
-
/*--category-icon-size: 24px;*/
|
|
15
|
-
/*--border-radius: 24px;*/
|
|
16
|
-
/*--font-family: 'Comic Sans MS', 'Chalkboard SE', cursive;*/
|
|
17
|
-
/*--rgb-accent: 255, 105, 180;*/
|
|
18
|
-
/*--rgb-color: 102, 51, 153;*/
|
|
19
|
-
/*--rgb-input: 255, 235, 235;*/
|
|
20
|
-
/*--shadow: 5px 5px 15px -8px rebeccapurple;*/
|
|
21
|
-
|
|
22
|
-
/*height: 50vh;*/
|
|
23
|
-
/*min-height: 400px;*/
|
|
24
|
-
/*max-height: 800px;*/
|
|
4
|
+
[data-theme='dark'] em-emoji-picker {
|
|
5
|
+
/* TODO(burdon): Use tailwind tokens. */
|
|
6
|
+
--background-rgb: #3b3b3f;
|
|
7
|
+
--rgb-background: #3b3b3f;
|
|
8
|
+
--font-family: 'Inter Variable', ui-sans-serif;
|
|
25
9
|
}
|
|
@@ -30,7 +30,7 @@ const meta = {
|
|
|
30
30
|
title: 'ui/react-ui-pickers/HuePicker',
|
|
31
31
|
component: HuePicker,
|
|
32
32
|
render: DefaultStory,
|
|
33
|
-
decorators: [withTheme, withLayout({
|
|
33
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
34
34
|
} satisfies Meta<typeof HuePicker>;
|
|
35
35
|
|
|
36
36
|
export default meta;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { type ButtonProps, type IconProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { getSize, hues } from '@dxos/
|
|
8
|
+
import { getSize, hues, osTranslations } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
10
|
import { PickerButton, type PickerButtonProps } from '../PickerButton';
|
|
11
11
|
|
|
@@ -18,12 +18,12 @@ export type HuePickerProps = {
|
|
|
18
18
|
} & Pick<PickerButtonProps, 'disabled' | 'defaultValue' | 'value' | 'onChange' | 'onReset' | 'rootVariant'>;
|
|
19
19
|
|
|
20
20
|
export const HuePicker = (props: ThemedClassName<HuePickerProps>) => {
|
|
21
|
-
const { t } = useTranslation(
|
|
21
|
+
const { t } = useTranslation(osTranslations);
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<PickerButton
|
|
25
25
|
Component={HuePreview}
|
|
26
|
-
label={t('select
|
|
26
|
+
label={t('select-hue.label')}
|
|
27
27
|
icon='ph--palette--regular'
|
|
28
28
|
values={hues}
|
|
29
29
|
{...props}
|
|
@@ -35,7 +35,7 @@ const HuePreview = ({ value, size = 5 }: { value: string; size?: IconProps['size
|
|
|
35
35
|
return (
|
|
36
36
|
<div role='none' className='flex justify-center items-center'>
|
|
37
37
|
<svg viewBox={`0 0 ${size} ${size}`} className={getSize(size)}>
|
|
38
|
-
<rect x={0} y={0} width={size} height={size} fill={`var(--
|
|
38
|
+
<rect x={0} y={0} width={size} height={size} fill={`var(--color-${value}-surface)`} strokeWidth={4} />
|
|
39
39
|
</svg>
|
|
40
40
|
</div>
|
|
41
41
|
);
|
|
@@ -25,7 +25,7 @@ const meta = {
|
|
|
25
25
|
title: 'ui/react-ui-pickers/IconPicker',
|
|
26
26
|
component: IconPicker,
|
|
27
27
|
render: DefaultStory,
|
|
28
|
-
decorators: [withTheme, withLayout({
|
|
28
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
29
29
|
} satisfies Meta<typeof IconPicker>;
|
|
30
30
|
|
|
31
31
|
export default meta;
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { type ButtonProps, Icon, type IconProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { osTranslations } from '@dxos/ui-theme';
|
|
8
9
|
|
|
9
10
|
import { PickerButton, type PickerButtonProps } from '../PickerButton';
|
|
11
|
+
import { iconValues } from './icons';
|
|
10
12
|
|
|
11
13
|
export type IconPickerProps = {
|
|
12
14
|
disabled?: boolean;
|
|
@@ -20,12 +22,12 @@ export type IconPickerProps = {
|
|
|
20
22
|
>;
|
|
21
23
|
|
|
22
24
|
export const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {
|
|
23
|
-
const { t } = useTranslation(
|
|
25
|
+
const { t } = useTranslation(osTranslations);
|
|
24
26
|
|
|
25
27
|
return (
|
|
26
28
|
<PickerButton
|
|
27
29
|
Component={IconPreview}
|
|
28
|
-
label={t('select
|
|
30
|
+
label={t('select-icon.label')}
|
|
29
31
|
icon='ph--selection--regular'
|
|
30
32
|
values={iconValues}
|
|
31
33
|
{...props}
|
|
@@ -36,66 +38,3 @@ export const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {
|
|
|
36
38
|
const IconPreview = ({ value, size }: { value: string; size?: IconProps['size'] }) => {
|
|
37
39
|
return <Icon icon={`ph--${value}--regular`} size={size} />;
|
|
38
40
|
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* https://phosphoricons.com
|
|
42
|
-
* NOTE: Select icons that we are unlikely to use for the UI.
|
|
43
|
-
*/
|
|
44
|
-
export const icons = [
|
|
45
|
-
'ph--house-line--regular',
|
|
46
|
-
'ph--planet--regular',
|
|
47
|
-
'ph--castle-turret--regular',
|
|
48
|
-
'ph--snowflake--regular',
|
|
49
|
-
'ph--virus--regular',
|
|
50
|
-
'ph--graph--regular',
|
|
51
|
-
'ph--air-traffic-control--regular',
|
|
52
|
-
'ph--asterisk--regular',
|
|
53
|
-
'ph--atom--regular',
|
|
54
|
-
'ph--basketball--regular',
|
|
55
|
-
'ph--butterfly--regular',
|
|
56
|
-
'ph--cactus--regular',
|
|
57
|
-
'ph--cake--regular',
|
|
58
|
-
'ph--calendar-dots--regular',
|
|
59
|
-
'ph--campfire--regular',
|
|
60
|
-
'ph--command--regular',
|
|
61
|
-
'ph--confetti--regular',
|
|
62
|
-
'ph--detective--regular',
|
|
63
|
-
'ph--disco-ball--regular',
|
|
64
|
-
'ph--dna--regular',
|
|
65
|
-
'ph--factory--regular',
|
|
66
|
-
'ph--flag-banner-fold--regular',
|
|
67
|
-
'ph--flask--regular',
|
|
68
|
-
'ph--flower-lotus--regular',
|
|
69
|
-
'ph--flying-saucer--regular',
|
|
70
|
-
'ph--game-controller--regular',
|
|
71
|
-
'ph--gavel--regular',
|
|
72
|
-
'ph--gift--regular',
|
|
73
|
-
'ph--guitar--regular',
|
|
74
|
-
'ph--hamburger--regular',
|
|
75
|
-
'ph--handshake--regular',
|
|
76
|
-
'ph--heart--regular',
|
|
77
|
-
'ph--lightbulb--regular',
|
|
78
|
-
'ph--lock--regular',
|
|
79
|
-
'ph--martini--regular',
|
|
80
|
-
'ph--medal-military--regular',
|
|
81
|
-
'ph--moped-front--regular',
|
|
82
|
-
'ph--office-chair--regular',
|
|
83
|
-
'ph--paint-brush-household--regular',
|
|
84
|
-
'ph--peace--regular',
|
|
85
|
-
'ph--person-simple-hike--regular',
|
|
86
|
-
'ph--piggy-bank--regular',
|
|
87
|
-
'ph--potted-plant--regular',
|
|
88
|
-
'ph--radioactive--regular',
|
|
89
|
-
'ph--rocket-launch--regular',
|
|
90
|
-
'ph--shield-star--regular',
|
|
91
|
-
'ph--shopping-cart--regular',
|
|
92
|
-
'ph--stethoscope--regular',
|
|
93
|
-
'ph--student--regular',
|
|
94
|
-
'ph--sun--regular',
|
|
95
|
-
'ph--tote--regular',
|
|
96
|
-
'ph--tree--regular',
|
|
97
|
-
'ph--users-three--regular',
|
|
98
|
-
'ph--yin-yang--regular',
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
export const iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* https://phosphoricons.com
|
|
7
|
+
* NOTE: Select icons that we are unlikely to use for the UI.
|
|
8
|
+
*/
|
|
9
|
+
export const icons = [
|
|
10
|
+
'ph--house-line--regular',
|
|
11
|
+
'ph--planet--regular',
|
|
12
|
+
'ph--castle-turret--regular',
|
|
13
|
+
'ph--snowflake--regular',
|
|
14
|
+
'ph--virus--regular',
|
|
15
|
+
'ph--graph--regular',
|
|
16
|
+
'ph--air-traffic-control--regular',
|
|
17
|
+
'ph--asterisk--regular',
|
|
18
|
+
'ph--atom--regular',
|
|
19
|
+
'ph--basketball--regular',
|
|
20
|
+
'ph--butterfly--regular',
|
|
21
|
+
'ph--cactus--regular',
|
|
22
|
+
'ph--cake--regular',
|
|
23
|
+
'ph--calendar-dots--regular',
|
|
24
|
+
'ph--campfire--regular',
|
|
25
|
+
'ph--command--regular',
|
|
26
|
+
'ph--confetti--regular',
|
|
27
|
+
'ph--detective--regular',
|
|
28
|
+
'ph--disco-ball--regular',
|
|
29
|
+
'ph--dna--regular',
|
|
30
|
+
'ph--factory--regular',
|
|
31
|
+
'ph--flag-banner-fold--regular',
|
|
32
|
+
'ph--flask--regular',
|
|
33
|
+
'ph--flower-lotus--regular',
|
|
34
|
+
'ph--flying-saucer--regular',
|
|
35
|
+
'ph--game-controller--regular',
|
|
36
|
+
'ph--gavel--regular',
|
|
37
|
+
'ph--gift--regular',
|
|
38
|
+
'ph--guitar--regular',
|
|
39
|
+
'ph--hamburger--regular',
|
|
40
|
+
'ph--handshake--regular',
|
|
41
|
+
'ph--heart--regular',
|
|
42
|
+
'ph--lightbulb--regular',
|
|
43
|
+
'ph--lock--regular',
|
|
44
|
+
'ph--martini--regular',
|
|
45
|
+
'ph--medal-military--regular',
|
|
46
|
+
'ph--moped-front--regular',
|
|
47
|
+
'ph--office-chair--regular',
|
|
48
|
+
'ph--paint-brush-household--regular',
|
|
49
|
+
'ph--peace--regular',
|
|
50
|
+
'ph--person-simple-hike--regular',
|
|
51
|
+
'ph--piggy-bank--regular',
|
|
52
|
+
'ph--potted-plant--regular',
|
|
53
|
+
'ph--radioactive--regular',
|
|
54
|
+
'ph--rocket-launch--regular',
|
|
55
|
+
'ph--shield-star--regular',
|
|
56
|
+
'ph--shopping-cart--regular',
|
|
57
|
+
'ph--stethoscope--regular',
|
|
58
|
+
'ph--student--regular',
|
|
59
|
+
'ph--sun--regular',
|
|
60
|
+
'ph--tote--regular',
|
|
61
|
+
'ph--tree--regular',
|
|
62
|
+
'ph--users-three--regular',
|
|
63
|
+
'ph--yin-yang--regular',
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
export const iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);
|
|
@@ -11,7 +11,7 @@ export type PickerButtonProps = ThemedClassName<{
|
|
|
11
11
|
Component: FC<{ value: string; size?: IconProps['size'] }>;
|
|
12
12
|
label: string;
|
|
13
13
|
icon: string;
|
|
14
|
-
values: string[];
|
|
14
|
+
values: readonly string[];
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
defaultValue?: string;
|
|
17
17
|
value?: string;
|
|
@@ -25,8 +25,8 @@ export const PickerButton = ({
|
|
|
25
25
|
Component,
|
|
26
26
|
disabled,
|
|
27
27
|
classNames,
|
|
28
|
-
defaultValue:
|
|
29
|
-
value:
|
|
28
|
+
defaultValue: defaultValueProp,
|
|
29
|
+
value: valueProp,
|
|
30
30
|
values,
|
|
31
31
|
label,
|
|
32
32
|
icon,
|
|
@@ -36,12 +36,12 @@ export const PickerButton = ({
|
|
|
36
36
|
iconSize = 5,
|
|
37
37
|
}: PickerButtonProps) => {
|
|
38
38
|
const [value, setValue] = useControllableState<string>({
|
|
39
|
-
prop:
|
|
40
|
-
defaultProp:
|
|
39
|
+
prop: valueProp,
|
|
40
|
+
defaultProp: defaultValueProp,
|
|
41
41
|
onChange,
|
|
42
42
|
});
|
|
43
43
|
// TODO(burdon): useControllableState doesn't update the prop when the value is changed. Replace it.
|
|
44
|
-
useEffect(() => setValue(
|
|
44
|
+
useEffect(() => setValue(valueProp), [valueProp]);
|
|
45
45
|
|
|
46
46
|
const [open, setOpen] = useState<boolean>(false);
|
|
47
47
|
const TriggerRoot = rootVariant === 'toolbar-button' ? Toolbar.Button : Button;
|
|
@@ -50,7 +50,7 @@ export const PickerButton = ({
|
|
|
50
50
|
<DropdownMenu.Root modal={false} open={open} onOpenChange={setOpen}>
|
|
51
51
|
<Tooltip.Trigger asChild content={label} side='bottom'>
|
|
52
52
|
<DropdownMenu.Trigger asChild>
|
|
53
|
-
<TriggerRoot classNames={['gap-2
|
|
53
|
+
<TriggerRoot classNames={['gap-2 py-1', classNames]} disabled={disabled}>
|
|
54
54
|
<span className='sr-only'>{label}</span>
|
|
55
55
|
{(value && <Component value={value} size={iconSize} />) || <Icon icon={icon} size={iconSize} />}
|
|
56
56
|
<Icon icon='ph--caret-down--bold' size={3} />
|
|
@@ -58,7 +58,7 @@ export const PickerButton = ({
|
|
|
58
58
|
</DropdownMenu.Trigger>
|
|
59
59
|
</Tooltip.Trigger>
|
|
60
60
|
<DropdownMenu.Portal>
|
|
61
|
-
<DropdownMenu.Content side='bottom' classNames='!
|
|
61
|
+
<DropdownMenu.Content side='bottom' classNames='!w-min'>
|
|
62
62
|
<DropdownMenu.Viewport classNames='grid grid-cols-[repeat(6,min-content)]'>
|
|
63
63
|
{values.map((_value) => {
|
|
64
64
|
return (
|