@dxos/react-ui-pickers 0.8.4-main.7ace549 → 0.8.4-main.8360d9e660

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.
Files changed (38) hide show
  1. package/dist/lib/browser/chunk-IEOELSPW.mjs +64 -0
  2. package/dist/lib/browser/chunk-IEOELSPW.mjs.map +7 -0
  3. package/dist/lib/browser/components/IconPicker/icons.mjs +9 -0
  4. package/dist/lib/browser/components/IconPicker/icons.mjs.map +7 -0
  5. package/dist/lib/browser/index.css +2 -2
  6. package/dist/lib/browser/index.css.map +2 -2
  7. package/dist/lib/browser/index.mjs +192 -284
  8. package/dist/lib/browser/index.mjs.map +3 -3
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/node-esm/chunk-OLGXN23I.mjs +66 -0
  11. package/dist/lib/node-esm/chunk-OLGXN23I.mjs.map +7 -0
  12. package/dist/lib/node-esm/components/IconPicker/icons.mjs +10 -0
  13. package/dist/lib/node-esm/components/IconPicker/icons.mjs.map +7 -0
  14. package/dist/lib/node-esm/index.css +2 -2
  15. package/dist/lib/node-esm/index.css.map +2 -2
  16. package/dist/lib/node-esm/index.mjs +191 -284
  17. package/dist/lib/node-esm/index.mjs.map +3 -3
  18. package/dist/lib/node-esm/meta.json +1 -1
  19. package/dist/types/src/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  20. package/dist/types/src/components/HuePicker/HuePicker.stories.d.ts +1 -1
  21. package/dist/types/src/components/IconPicker/IconPicker.d.ts +0 -6
  22. package/dist/types/src/components/IconPicker/IconPicker.d.ts.map +1 -1
  23. package/dist/types/src/components/IconPicker/IconPicker.stories.d.ts +1 -1
  24. package/dist/types/src/components/IconPicker/icons.d.ts +7 -0
  25. package/dist/types/src/components/IconPicker/icons.d.ts.map +1 -0
  26. package/dist/types/src/components/PickerButton/PickerButton.d.ts +2 -2
  27. package/dist/types/src/components/PickerButton/PickerButton.d.ts.map +1 -1
  28. package/dist/types/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +31 -18
  30. package/src/components/EmojiPicker/EmojiPicker.stories.tsx +1 -1
  31. package/src/components/EmojiPicker/EmojiPicker.tsx +4 -3
  32. package/src/components/EmojiPicker/emoji.css +5 -21
  33. package/src/components/HuePicker/HuePicker.stories.tsx +1 -1
  34. package/src/components/HuePicker/HuePicker.tsx +3 -3
  35. package/src/components/IconPicker/IconPicker.stories.tsx +1 -1
  36. package/src/components/IconPicker/IconPicker.tsx +4 -64
  37. package/src/components/IconPicker/icons.ts +66 -0
  38. 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-main.7ace549",
3
+ "version": "0.8.4-main.8360d9e660",
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-main.7ace549",
33
- "@dxos/react-ui-types": "0.8.4-main.7ace549",
34
- "@dxos/util": "0.8.4-main.7ace549"
45
+ "@dxos/util": "0.8.4-main.8360d9e660",
46
+ "@dxos/ui-types": "0.8.4-main.8360d9e660",
47
+ "@dxos/log": "0.8.4-main.8360d9e660"
35
48
  },
36
49
  "devDependencies": {
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": "0.8.4-main.7ace549",
43
- "@dxos/react-ui-theme": "0.8.4-main.7ace549",
44
- "@dxos/storybook-utils": "0.8.4-main.7ace549"
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-main.8360d9e660",
56
+ "@dxos/storybook-utils": "0.8.4-main.8360d9e660",
57
+ "@dxos/ui-theme": "0.8.4-main.8360d9e660"
45
58
  },
46
59
  "peerDependencies": {
47
- "react": "^19.0.0",
48
- "react-dom": "^19.0.0",
49
- "@dxos/react-ui": "0.8.4-main.7ace549",
50
- "@dxos/react-ui-theme": "0.8.4-main.7ace549"
60
+ "react": "~19.2.3",
61
+ "react-dom": "~19.2.3",
62
+ "@dxos/react-ui": "0.8.4-main.8360d9e660",
63
+ "@dxos/ui-theme": "0.8.4-main.8360d9e660"
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({ container: 'column' })],
17
+ decorators: [withTheme(), withLayout({ layout: 'column' })],
18
18
  } satisfies Meta<typeof EmojiPicker>;
19
19
 
20
20
  export default meta;
@@ -20,6 +20,7 @@ import {
20
20
  useThemeContext,
21
21
  useTranslation,
22
22
  } from '@dxos/react-ui';
23
+ import { osTranslations } from '@dxos/ui-theme';
23
24
 
24
25
  import './emoji.css';
25
26
 
@@ -42,7 +43,7 @@ export const EmojiPickerToolbarButton = ({
42
43
  defaultEmoji,
43
44
  onChangeEmoji,
44
45
  }: Omit<EmojiPickerProps, 'onClickClear'>) => {
45
- const { t } = useTranslation('os');
46
+ const { t } = useTranslation(osTranslations);
46
47
  const { themeMode } = useThemeContext();
47
48
 
48
49
  const [_emojiValue, setEmojiValue] = useControllableState<string>({
@@ -112,7 +113,7 @@ export const EmojiPickerBlock = ({
112
113
  triggerVariant = 'ghost',
113
114
  classNames,
114
115
  }: EmojiPickerProps) => {
115
- const { t } = useTranslation('os');
116
+ const { t } = useTranslation(osTranslations);
116
117
  const [isMd] = useMediaQuery('md');
117
118
 
118
119
  const [emojiValue, setEmojiValue] = useControllableState<string>({
@@ -127,7 +128,7 @@ 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 plb-1' disabled={disabled}>
131
+ <Button variant={triggerVariant} classNames='grow gap-2 text-2xl py-1' disabled={disabled}>
131
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} />
@@ -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="dark"] em-emoji-picker {
5
- /* TODO(burdon): Get from TW defs: modal-surface? */
6
- --background-rgb: #3B3B3F;
7
- --rgb-background: #3B3B3F;
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({ container: 'column' })],
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/react-ui-theme';
8
+ import { getSize, hues, osTranslations } from '@dxos/ui-theme';
9
9
 
10
10
  import { PickerButton, type PickerButtonProps } from '../PickerButton';
11
11
 
@@ -18,7 +18,7 @@ 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('os');
21
+ const { t } = useTranslation(osTranslations);
22
22
 
23
23
  return (
24
24
  <PickerButton
@@ -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(--dx-${value}Fill)`} strokeWidth={4} />
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({ container: 'column' })],
28
+ decorators: [withTheme(), withLayout({ layout: 'column' })],
29
29
  } satisfies Meta<typeof IconPicker>;
30
30
 
31
31
  export default meta;
@@ -5,9 +5,12 @@
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';
10
11
 
12
+ import { iconValues } from './icons';
13
+
11
14
  export type IconPickerProps = {
12
15
  disabled?: boolean;
13
16
  defaultValue?: string;
@@ -20,7 +23,7 @@ export type IconPickerProps = {
20
23
  >;
21
24
 
22
25
  export const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {
23
- const { t } = useTranslation('os');
26
+ const { t } = useTranslation(osTranslations);
24
27
 
25
28
  return (
26
29
  <PickerButton
@@ -36,66 +39,3 @@ export const IconPicker = ({ ...props }: ThemedClassName<IconPickerProps>) => {
36
39
  const IconPreview = ({ value, size }: { value: string; size?: IconProps['size'] }) => {
37
40
  return <Icon icon={`ph--${value}--regular`} size={size} />;
38
41
  };
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: defaultValueParam,
29
- value: valueParam,
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: valueParam,
40
- defaultProp: defaultValueParam,
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(valueParam), [valueParam]);
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 plb-1', classNames]} disabled={disabled}>
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='!is-min'>
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 (