@dxos/react-ui-pickers 0.8.4-main.dedc0f3 → 0.8.4-main.e8ec1fe
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 +44 -52
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +44 -52
- 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 +0 -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 +0 -4
- package/dist/types/src/components/HuePicker/HuePicker.stories.d.ts.map +1 -1
- package/dist/types/src/components/IconPicker/IconPicker.d.ts +7 -1
- package/dist/types/src/components/IconPicker/IconPicker.d.ts.map +1 -1
- package/dist/types/src/components/IconPicker/IconPicker.stories.d.ts +0 -4
- package/dist/types/src/components/IconPicker/IconPicker.stories.d.ts.map +1 -1
- 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 +16 -16
- package/src/components/EmojiPicker/EmojiPicker.stories.tsx +3 -8
- package/src/components/EmojiPicker/EmojiPicker.tsx +20 -16
- package/src/components/HuePicker/HuePicker.stories.tsx +2 -7
- package/src/components/HuePicker/HuePicker.tsx +5 -9
- package/src/components/IconPicker/IconPicker.stories.tsx +2 -7
- package/src/components/IconPicker/IconPicker.tsx +11 -5
- package/src/components/PickerButton/PickerButton.tsx +8 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-pickers",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.e8ec1fe",
|
|
4
4
|
"description": "A collection of picker components.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
"@preact-signals/safe-react": "^0.9.0",
|
|
30
30
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
31
31
|
"react-resize-detector": "^11.0.1",
|
|
32
|
-
"@dxos/log": "0.8.4-main.
|
|
33
|
-
"@dxos/react-ui-types": "0.8.4-main.
|
|
34
|
-
"@dxos/util": "0.8.4-main.
|
|
32
|
+
"@dxos/log": "0.8.4-main.e8ec1fe",
|
|
33
|
+
"@dxos/react-ui-types": "0.8.4-main.e8ec1fe",
|
|
34
|
+
"@dxos/util": "0.8.4-main.e8ec1fe"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/react": "~
|
|
38
|
-
"@types/react-dom": "~
|
|
39
|
-
"react": "~
|
|
40
|
-
"react-dom": "~
|
|
41
|
-
"vite": "7.1.
|
|
42
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
43
|
-
"@dxos/react-ui
|
|
44
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
37
|
+
"@types/react": "~19.2.2",
|
|
38
|
+
"@types/react-dom": "~19.2.2",
|
|
39
|
+
"react": "~19.2.0",
|
|
40
|
+
"react-dom": "~19.2.0",
|
|
41
|
+
"vite": "7.1.9",
|
|
42
|
+
"@dxos/react-ui-theme": "0.8.4-main.e8ec1fe",
|
|
43
|
+
"@dxos/react-ui": "0.8.4-main.e8ec1fe",
|
|
44
|
+
"@dxos/storybook-utils": "0.8.4-main.e8ec1fe"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"react": "
|
|
48
|
-
"react-dom": "
|
|
49
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
50
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
47
|
+
"react": "^19.0.0",
|
|
48
|
+
"react-dom": "^19.0.0",
|
|
49
|
+
"@dxos/react-ui": "0.8.4-main.e8ec1fe",
|
|
50
|
+
"@dxos/react-ui-theme": "0.8.4-main.e8ec1fe"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
@@ -2,24 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import EmojiPicker from '@emoji-mart/react';
|
|
8
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
9
7
|
import React, { useState } from 'react';
|
|
10
8
|
|
|
11
9
|
import { Toolbar } from '@dxos/react-ui';
|
|
12
|
-
import { withLayout, withTheme } from '@dxos/
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
11
|
|
|
14
12
|
import { EmojiPickerBlock, type EmojiPickerProps, EmojiPickerToolbarButton } from './EmojiPicker';
|
|
15
13
|
|
|
16
14
|
const meta = {
|
|
17
15
|
title: 'ui/react-ui-pickers/EmojiPicker',
|
|
18
16
|
component: EmojiPicker,
|
|
19
|
-
decorators: [withTheme, withLayout()],
|
|
20
|
-
parameters: {
|
|
21
|
-
layout: 'centered',
|
|
22
|
-
},
|
|
17
|
+
decorators: [withTheme, withLayout({ container: 'column' })],
|
|
23
18
|
} satisfies Meta<typeof EmojiPicker>;
|
|
24
19
|
|
|
25
20
|
export default meta;
|
|
@@ -38,7 +33,7 @@ const BlockStory = (props: EmojiPickerProps) => {
|
|
|
38
33
|
const [emoji, setEmoji] = useState<string>(props.defaultEmoji ?? '😀');
|
|
39
34
|
|
|
40
35
|
return (
|
|
41
|
-
<div
|
|
36
|
+
<div>
|
|
42
37
|
<EmojiPickerBlock
|
|
43
38
|
{...props}
|
|
44
39
|
emoji={emoji}
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
ButtonGroup,
|
|
13
13
|
type ButtonProps,
|
|
14
14
|
Icon,
|
|
15
|
+
IconButton,
|
|
15
16
|
Popover,
|
|
16
17
|
type ThemedClassName,
|
|
17
18
|
Toolbar,
|
|
18
|
-
Tooltip,
|
|
19
19
|
useMediaQuery,
|
|
20
20
|
useThemeContext,
|
|
21
21
|
useTranslation,
|
|
@@ -60,14 +60,15 @@ export const EmojiPickerToolbarButton = ({
|
|
|
60
60
|
setEmojiPickerOpen(nextOpen);
|
|
61
61
|
}}
|
|
62
62
|
>
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
<Popover.Trigger asChild>
|
|
64
|
+
<Toolbar.IconButton
|
|
65
|
+
icon='ph--user-circle--regular'
|
|
66
|
+
label={t('select emoji label')}
|
|
67
|
+
iconOnly
|
|
68
|
+
tooltipSide='bottom'
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
/>
|
|
71
|
+
</Popover.Trigger>
|
|
71
72
|
<Popover.Portal>
|
|
72
73
|
<Popover.Content
|
|
73
74
|
side='bottom'
|
|
@@ -112,7 +113,7 @@ export const EmojiPickerBlock = ({
|
|
|
112
113
|
classNames,
|
|
113
114
|
}: EmojiPickerProps) => {
|
|
114
115
|
const { t } = useTranslation('os');
|
|
115
|
-
const [isMd] = useMediaQuery('md'
|
|
116
|
+
const [isMd] = useMediaQuery('md');
|
|
116
117
|
|
|
117
118
|
const [emojiValue, setEmojiValue] = useControllableState<string>({
|
|
118
119
|
prop: emoji,
|
|
@@ -157,12 +158,15 @@ export const EmojiPickerBlock = ({
|
|
|
157
158
|
<Popover.Arrow />
|
|
158
159
|
</Popover.Content>
|
|
159
160
|
</Popover.Root>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
<IconButton
|
|
162
|
+
icon='ph--arrow-counter-clockwise--regular'
|
|
163
|
+
iconOnly
|
|
164
|
+
label={t('clear label')}
|
|
165
|
+
tooltipSide='right'
|
|
166
|
+
variant={triggerVariant}
|
|
167
|
+
onClick={onClickClear}
|
|
168
|
+
disabled={disabled}
|
|
169
|
+
/>
|
|
166
170
|
</ButtonGroup>
|
|
167
171
|
);
|
|
168
172
|
};
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { Toolbar } from '@dxos/react-ui';
|
|
11
|
-
import { withLayout, withTheme } from '@dxos/
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
10
|
|
|
13
11
|
import { HuePicker, type HuePickerProps } from './HuePicker';
|
|
14
12
|
|
|
@@ -32,10 +30,7 @@ const meta = {
|
|
|
32
30
|
title: 'ui/react-ui-pickers/HuePicker',
|
|
33
31
|
component: HuePicker,
|
|
34
32
|
render: DefaultStory,
|
|
35
|
-
decorators: [withTheme, withLayout()],
|
|
36
|
-
parameters: {
|
|
37
|
-
layout: 'centered',
|
|
38
|
-
},
|
|
33
|
+
decorators: [withTheme, withLayout({ container: 'column' })],
|
|
39
34
|
} satisfies Meta<typeof HuePicker>;
|
|
40
35
|
|
|
41
36
|
export default meta;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type ButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { hues } from '@dxos/react-ui-theme';
|
|
7
|
+
import { type ButtonProps, type IconProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { getSize, hues } from '@dxos/react-ui-theme';
|
|
9
9
|
|
|
10
10
|
import { PickerButton, type PickerButtonProps } from '../PickerButton';
|
|
11
11
|
|
|
@@ -31,14 +31,10 @@ export const HuePicker = (props: ThemedClassName<HuePickerProps>) => {
|
|
|
31
31
|
);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const HuePreview = ({ value }: { value: string }) => {
|
|
35
|
-
const size = 16;
|
|
34
|
+
const HuePreview = ({ value, size = 5 }: { value: string; size?: IconProps['size'] }) => {
|
|
36
35
|
return (
|
|
37
|
-
<div className='flex
|
|
38
|
-
<svg
|
|
39
|
-
viewBox={`0 0 ${size} ${size}`}
|
|
40
|
-
className='is-[var(--hue-preview-size,1rem)] bs-[var(--hue-preview-size,1rem)]'
|
|
41
|
-
>
|
|
36
|
+
<div role='none' className='flex justify-center items-center'>
|
|
37
|
+
<svg viewBox={`0 0 ${size} ${size}`} className={getSize(size)}>
|
|
42
38
|
<rect x={0} y={0} width={size} height={size} fill={`var(--dx-${value}Fill)`} strokeWidth={4} />
|
|
43
39
|
</svg>
|
|
44
40
|
</div>
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { Toolbar } from '@dxos/react-ui';
|
|
11
|
-
import { withLayout, withTheme } from '@dxos/
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
10
|
|
|
13
11
|
import { IconPicker, type IconPickerProps } from './IconPicker';
|
|
14
12
|
|
|
@@ -27,10 +25,7 @@ const meta = {
|
|
|
27
25
|
title: 'ui/react-ui-pickers/IconPicker',
|
|
28
26
|
component: IconPicker,
|
|
29
27
|
render: DefaultStory,
|
|
30
|
-
decorators: [withTheme, withLayout()],
|
|
31
|
-
parameters: {
|
|
32
|
-
layout: 'centered',
|
|
33
|
-
},
|
|
28
|
+
decorators: [withTheme, withLayout({ container: 'column' })],
|
|
34
29
|
} satisfies Meta<typeof IconPicker>;
|
|
35
30
|
|
|
36
31
|
export default meta;
|
|
@@ -16,7 +16,7 @@ export type IconPickerProps = {
|
|
|
16
16
|
onReset?: ButtonProps['onClick'];
|
|
17
17
|
} & Pick<
|
|
18
18
|
PickerButtonProps,
|
|
19
|
-
'disabled' | '
|
|
19
|
+
'disabled' | 'rootVariant' | 'iconSize' | 'defaultValue' | 'value' | 'onChange' | 'onReset'
|
|
20
20
|
>;
|
|
21
21
|
|
|
22
22
|
export const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {
|
|
@@ -33,15 +33,21 @@ export const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {
|
|
|
33
33
|
);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const IconPreview = ({ value,
|
|
37
|
-
return <Icon icon={`ph--${value}--regular`} size={
|
|
36
|
+
const IconPreview = ({ value, size }: { value: string; size?: IconProps['size'] }) => {
|
|
37
|
+
return <Icon icon={`ph--${value}--regular`} size={size} />;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* https://phosphoricons.com
|
|
42
42
|
* NOTE: Select icons that we are unlikely to use for the UI.
|
|
43
43
|
*/
|
|
44
|
-
const icons = [
|
|
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',
|
|
45
51
|
'ph--air-traffic-control--regular',
|
|
46
52
|
'ph--asterisk--regular',
|
|
47
53
|
'ph--atom--regular',
|
|
@@ -92,4 +98,4 @@ const icons = [
|
|
|
92
98
|
'ph--yin-yang--regular',
|
|
93
99
|
];
|
|
94
100
|
|
|
95
|
-
const iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);
|
|
101
|
+
export const iconValues = icons.map((icon) => icon.match(/ph--(.+)--regular/)?.[1] ?? icon);
|
|
@@ -8,7 +8,7 @@ import React, { type FC, useEffect, useState } from 'react';
|
|
|
8
8
|
import { Button, DropdownMenu, Icon, type IconProps, type ThemedClassName, Toolbar, Tooltip } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
export type PickerButtonProps = ThemedClassName<{
|
|
11
|
-
Component: FC<{ value: string;
|
|
11
|
+
Component: FC<{ value: string; size?: IconProps['size'] }>;
|
|
12
12
|
label: string;
|
|
13
13
|
icon: string;
|
|
14
14
|
values: string[];
|
|
@@ -25,8 +25,8 @@ export const PickerButton = ({
|
|
|
25
25
|
Component,
|
|
26
26
|
disabled,
|
|
27
27
|
classNames,
|
|
28
|
-
defaultValue:
|
|
29
|
-
value:
|
|
28
|
+
defaultValue: defaultValueParam,
|
|
29
|
+
value: valueParam,
|
|
30
30
|
values,
|
|
31
31
|
label,
|
|
32
32
|
icon,
|
|
@@ -36,15 +36,14 @@ export const PickerButton = ({
|
|
|
36
36
|
iconSize = 5,
|
|
37
37
|
}: PickerButtonProps) => {
|
|
38
38
|
const [value, setValue] = useControllableState<string>({
|
|
39
|
-
prop:
|
|
40
|
-
defaultProp:
|
|
39
|
+
prop: valueParam,
|
|
40
|
+
defaultProp: defaultValueParam,
|
|
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(valueParam), [valueParam]);
|
|
45
45
|
|
|
46
46
|
const [open, setOpen] = useState<boolean>(false);
|
|
47
|
-
|
|
48
47
|
const TriggerRoot = rootVariant === 'toolbar-button' ? Toolbar.Button : Button;
|
|
49
48
|
|
|
50
49
|
return (
|
|
@@ -53,7 +52,7 @@ export const PickerButton = ({
|
|
|
53
52
|
<DropdownMenu.Trigger asChild>
|
|
54
53
|
<TriggerRoot classNames={['gap-2 plb-1', classNames]} disabled={disabled}>
|
|
55
54
|
<span className='sr-only'>{label}</span>
|
|
56
|
-
{(value && <Component value={value}
|
|
55
|
+
{(value && <Component value={value} size={iconSize} />) || <Icon icon={icon} size={iconSize} />}
|
|
57
56
|
<Icon icon='ph--caret-down--bold' size={3} />
|
|
58
57
|
</TriggerRoot>
|
|
59
58
|
</DropdownMenu.Trigger>
|
|
@@ -69,7 +68,7 @@ export const PickerButton = ({
|
|
|
69
68
|
onCheckedChange={() => setValue(_value)}
|
|
70
69
|
classNames={'p-1 items-center justify-center aspect-square'}
|
|
71
70
|
>
|
|
72
|
-
<Component value={_value}
|
|
71
|
+
<Component value={_value} size={iconSize} />
|
|
73
72
|
</DropdownMenu.CheckboxItem>
|
|
74
73
|
);
|
|
75
74
|
})}
|