@allxsmith/bestax-bulma 5.57.5 → 5.59.0

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 (112) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Avatars.js +2 -2
  4. package/dist/esm/components/Avatars.js.map +1 -1
  5. package/dist/esm/components/Badge.js +2 -2
  6. package/dist/esm/components/Badge.js.map +1 -1
  7. package/dist/esm/components/Pagination.js +2 -2
  8. package/dist/esm/components/Pagination.js.map +1 -1
  9. package/dist/esm/components/Steps.js +2 -2
  10. package/dist/esm/components/Steps.js.map +1 -1
  11. package/dist/esm/components/TreeView.js +7 -5
  12. package/dist/esm/components/TreeView.js.map +1 -1
  13. package/dist/esm/components/useDataTable.js +2 -2
  14. package/dist/esm/components/useDataTable.js.map +1 -1
  15. package/dist/esm/elements/Buttons.js +2 -0
  16. package/dist/esm/elements/Buttons.js.map +1 -1
  17. package/dist/esm/elements/IconButton.js +114 -0
  18. package/dist/esm/elements/IconButton.js.map +1 -0
  19. package/dist/esm/elements/NumberFormatter.js +42 -0
  20. package/dist/esm/elements/NumberFormatter.js.map +1 -0
  21. package/dist/esm/elements/RingProgress.js +2 -2
  22. package/dist/esm/elements/RingProgress.js.map +1 -1
  23. package/dist/esm/form/Dropzone.js +2 -2
  24. package/dist/esm/form/Dropzone.js.map +1 -1
  25. package/dist/esm/form/File.js +2 -2
  26. package/dist/esm/form/File.js.map +1 -1
  27. package/dist/esm/form/Rate.js +2 -2
  28. package/dist/esm/form/Rate.js.map +1 -1
  29. package/dist/esm/form/Slider.js +2 -2
  30. package/dist/esm/form/Slider.js.map +1 -1
  31. package/dist/esm/form/Taginput.js +2 -2
  32. package/dist/esm/form/Taginput.js.map +1 -1
  33. package/dist/esm/form/_colorInternals/pickerState.js +2 -2
  34. package/dist/esm/form/_colorInternals/pickerState.js.map +1 -1
  35. package/dist/esm/helpers/LocaleProvider.js +13 -6
  36. package/dist/esm/helpers/LocaleProvider.js.map +1 -1
  37. package/dist/esm/helpers/containerBreakpoints.js +14 -0
  38. package/dist/esm/helpers/containerBreakpoints.js.map +1 -0
  39. package/dist/esm/helpers/localeFormat.js +196 -36
  40. package/dist/esm/helpers/localeFormat.js.map +1 -1
  41. package/dist/esm/helpers/polymorphic.js.map +1 -1
  42. package/dist/esm/helpers/stackLayout.js +30 -0
  43. package/dist/esm/helpers/stackLayout.js.map +1 -0
  44. package/dist/esm/helpers/useBulmaClasses.js +8 -2
  45. package/dist/esm/helpers/useBulmaClasses.js.map +1 -1
  46. package/dist/esm/helpers/useFlexboxClasses.js +17 -4
  47. package/dist/esm/helpers/useFlexboxClasses.js.map +1 -1
  48. package/dist/esm/helpers/useTreeView.js +54 -20
  49. package/dist/esm/helpers/useTreeView.js.map +1 -1
  50. package/dist/esm/layout/Center.js +33 -0
  51. package/dist/esm/layout/Center.js.map +1 -0
  52. package/dist/esm/layout/Container.js +2 -6
  53. package/dist/esm/layout/Container.js.map +1 -1
  54. package/dist/esm/layout/Flex.js +34 -0
  55. package/dist/esm/layout/Flex.js.map +1 -0
  56. package/dist/esm/layout/Group.js +43 -0
  57. package/dist/esm/layout/Group.js.map +1 -0
  58. package/dist/esm/layout/Stack.js +34 -0
  59. package/dist/esm/layout/Stack.js.map +1 -0
  60. package/dist/extras.css +1 -1
  61. package/dist/extras.css.map +1 -1
  62. package/dist/index.cjs +712 -212
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.esm.js +7 -0
  65. package/dist/index.esm.js.map +1 -1
  66. package/dist/types/components/TreeView.d.ts +20 -11
  67. package/dist/types/elements/Buttons.d.ts +1 -0
  68. package/dist/types/elements/IconButton.d.ts +110 -0
  69. package/dist/types/elements/NumberFormatter.d.ts +62 -0
  70. package/dist/types/helpers/LocaleProvider.d.ts +7 -0
  71. package/dist/types/helpers/containerBreakpoints.d.ts +2 -0
  72. package/dist/types/helpers/localeFormat.d.ts +30 -8
  73. package/dist/types/helpers/polymorphic.d.ts +19 -0
  74. package/dist/types/helpers/stackLayout.d.ts +62 -0
  75. package/dist/types/helpers/useBulmaClasses.d.ts +8 -2
  76. package/dist/types/helpers/useFlexboxClasses.d.ts +26 -3
  77. package/dist/types/helpers/useTreeView.d.ts +12 -6
  78. package/dist/types/index.d.ts +10 -1
  79. package/dist/types/layout/Center.d.ts +54 -0
  80. package/dist/types/layout/Flex.d.ts +92 -0
  81. package/dist/types/layout/Group.d.ts +86 -0
  82. package/dist/types/layout/Stack.d.ts +63 -0
  83. package/dist/types-cjs/components/TreeView.d.ts +20 -11
  84. package/dist/types-cjs/elements/Buttons.d.ts +1 -0
  85. package/dist/types-cjs/elements/IconButton.d.ts +110 -0
  86. package/dist/types-cjs/elements/NumberFormatter.d.ts +62 -0
  87. package/dist/types-cjs/helpers/LocaleProvider.d.ts +7 -0
  88. package/dist/types-cjs/helpers/containerBreakpoints.d.ts +2 -0
  89. package/dist/types-cjs/helpers/localeFormat.d.ts +30 -8
  90. package/dist/types-cjs/helpers/polymorphic.d.ts +19 -0
  91. package/dist/types-cjs/helpers/stackLayout.d.ts +62 -0
  92. package/dist/types-cjs/helpers/useBulmaClasses.d.ts +8 -2
  93. package/dist/types-cjs/helpers/useFlexboxClasses.d.ts +26 -3
  94. package/dist/types-cjs/helpers/useTreeView.d.ts +12 -6
  95. package/dist/types-cjs/index.d.ts +10 -1
  96. package/dist/types-cjs/layout/Center.d.ts +54 -0
  97. package/dist/types-cjs/layout/Flex.d.ts +92 -0
  98. package/dist/types-cjs/layout/Group.d.ts +86 -0
  99. package/dist/types-cjs/layout/Stack.d.ts +63 -0
  100. package/dist/versions/bestax-no-dark-mode.css +1 -1
  101. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  102. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  103. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  104. package/dist/versions/bestax-no-helpers.css +1 -1
  105. package/dist/versions/bestax-no-helpers.css.map +1 -1
  106. package/dist/versions/bestax-prefixed.css +1 -1
  107. package/dist/versions/bestax-prefixed.css.map +1 -1
  108. package/package.json +1 -1
  109. package/src/scss/elements/_iconbutton.scss +36 -0
  110. package/src/scss/elements/_index.scss +1 -0
  111. package/src/scss/layout/_index.scss +1 -0
  112. package/src/scss/layout/_stack.scss +145 -0
@@ -0,0 +1,114 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ 'use client';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import React, { forwardRef, useEffect } from 'react';
5
+ import { Button } from './Button.js';
6
+ import { Icon } from './Icon.js';
7
+ import { buttonType } from '../helpers/buttonType.js';
8
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
9
+ import { isDev, warnOnce } from '../helpers/devWarnings.js';
10
+ import { flattenChildren } from '../helpers/flattenChildren.js';
11
+
12
+ /** Whether a string has something in it besides spaces. */
13
+ const hasText = (value) => typeof value === 'string' && value.trim() !== '';
14
+ /** Whether a string is only spaces, which JSX leaves between elements. */
15
+ const isBlank = (node) => typeof node === 'string' && node.trim() === '';
16
+ /**
17
+ * The glyph in one `.icon`, which is what Bulma keeps square: an `<Icon>` as
18
+ * given, Fragments opened up and blank text left out, and anything else
19
+ * inside an `Icon`. Null when there's nothing to draw, so an empty Fragment
20
+ * or array counts as no glyph.
21
+ */
22
+ function iconOf(node) {
23
+ const items = flattenChildren(node).filter(item => !isBlank(item));
24
+ if (items.length === 0)
25
+ return null;
26
+ const [only] = items;
27
+ if (items.length === 1 && React.isValidElement(only) && only.type === Icon) {
28
+ return only;
29
+ }
30
+ return jsx(Icon, { children: items });
31
+ }
32
+ /** The glyph `icon` draws: a string is an `Icon` name, the rest as `iconOf`. */
33
+ function iconFromProp(icon) {
34
+ if (typeof icon !== 'string')
35
+ return iconOf(icon);
36
+ return hasText(icon) ? jsx(Icon, { name: icon }) : null;
37
+ }
38
+ /**
39
+ * The `IconButton` component renders a button that shows only an icon, and requires a name for it.
40
+ *
41
+ * It renders through `Button`, so it takes everything `Button` takes, and
42
+ * adds the icon and a name the types require: `aria-label`, or
43
+ * `aria-labelledby` in its place. Bulma keeps a button whose only child is an
44
+ * `.icon` square at every size, and `isRounded` makes it a circle. It has no
45
+ * tooltip of its own: wrap it in `Tooltip` for a description.
46
+ *
47
+ * @function
48
+ * @param {IconButtonProps} props - Props for the IconButton component.
49
+ * @param {React.Ref} ref - Forwarded ref to the element `as` renders.
50
+ * @returns {JSX.Element} The rendered button, anchor, or custom element.
51
+ * @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}
52
+ *
53
+ * @example
54
+ * <IconButton icon="trash" aria-label="Delete" color="danger" />
55
+ *
56
+ * @example
57
+ * <IconButton aria-label="Settings">
58
+ * <Icon name="cog" />
59
+ * </IconButton>
60
+ */
61
+ const IconButton = forwardRef(function IconButton(props, ref) {
62
+ const { icon, children, className, ...rest } = props;
63
+ const iconButtonClass = usePrefixedClassNames('icon-button');
64
+ const unnamed = !hasText(rest['aria-label']) && !hasText(rest['aria-labelledby']);
65
+ // Each way of giving the glyph counts only if it draws something, so an
66
+ // empty Fragment or array as `icon` doesn't hide real children, and an
67
+ // empty one as children doesn't warn.
68
+ const fromIcon = iconFromProp(icon);
69
+ const fromChildren = iconOf(children);
70
+ const both = fromIcon !== null && fromChildren !== null;
71
+ // One glyph, from `icon` or else from `children`, so the button's only
72
+ // child is one `.icon`, which Bulma keeps square, and round with
73
+ // `isRounded`.
74
+ const glyph = fromIcon ?? fromChildren;
75
+ const empty = glyph === null;
76
+ // Only top-level text, Fragments opened up, and only in development, where
77
+ // the warning below can say something about it.
78
+ const textInside = isDev() &&
79
+ flattenChildren(children).some(child => typeof child === 'number' || hasText(child));
80
+ useEffect(() => {
81
+ if (unnamed) {
82
+ warnOnce('IconButton:unnamed', '[bestax-bulma] <IconButton> has no accessible name. Pass ' +
83
+ 'aria-label naming what it does ("Delete"), or aria-labelledby, ' +
84
+ 'so a screen reader has something to announce.');
85
+ }
86
+ if (empty) {
87
+ warnOnce('IconButton:no-glyph', '[bestax-bulma] <IconButton> has no glyph: neither icon nor ' +
88
+ 'children draws one, so it renders an empty square. Pass an icon ' +
89
+ 'name, an <Icon> or another node.');
90
+ }
91
+ if (both) {
92
+ warnOnce('IconButton:icon-and-children', '[bestax-bulma] <IconButton> was given both icon and children. It ' +
93
+ 'draws icon and leaves the children out: give the glyph one way.');
94
+ }
95
+ if (textInside) {
96
+ warnOnce('IconButton:text', '[bestax-bulma] <IconButton> was given text as children. Its ' +
97
+ 'aria-label replaces the text as its name, so a button with text ' +
98
+ 'is a <Button>.');
99
+ }
100
+ }, [unnamed, empty, both, textInside]);
101
+ // `type` is a button's only on a `<button>`. On an `<a>` it's the MIME hint,
102
+ // and a custom component owns what it means, so those get it as given.
103
+ const tag = rest.as ?? 'button';
104
+ const typeProp = tag === 'button' ? { type: buttonType(rest.type) } : undefined;
105
+ return (jsx(Button
106
+ // IconButton is polymorphic through to Button, which resolves the
107
+ // element from `as`. TS can't infer that through the spread, so the
108
+ // props and the ref are read at Button's default element.
109
+ , { ...rest, ...typeProp, ref: ref, className: classNames(iconButtonClass, className), children: glyph }));
110
+ });
111
+ IconButton.displayName = 'IconButton';
112
+
113
+ export { IconButton };
114
+ //# sourceMappingURL=IconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconButton.js","sources":["../../../src/elements/IconButton.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport { Button, type ButtonOwnProps, type ButtonProps } from './Button';\nimport { Icon } from './Icon';\nimport { buttonType } from '../helpers/buttonType';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { isDev, warnOnce } from '../helpers/devWarnings';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport type { PolymorphicComponent } from '../helpers/polymorphic';\n\n/**\n * The IconButton component's own props: everything `Button` takes, plus the\n * icon.\n */\nexport interface IconButtonOwnProps extends ButtonOwnProps {\n /**\n * The glyph. A string is an `Icon` name, drawn from the icon library\n * `ConfigProvider` sets. An `<Icon>` renders as given, so it can carry its\n * own `variant` or `library`. Any other node, such as an SVG or a component\n * from an icon package, goes inside an `Icon`, which gives it the `.icon`\n * wrapper Bulma keeps square. It's decorative: the button's name says what\n * it does. Give the glyph here or as `children`, not both: with both, it\n * draws `icon` and warns in development. With neither, such as an empty\n * string from `cond ? 'trash' : ''`, the button is an empty square, and that\n * warns in development too.\n */\n icon?: React.ReactNode;\n /**\n * The glyph as children, the way Mantine, MUI and Chakra take it: an\n * `<Icon>` renders as given, and any other node, such as an SVG, goes\n * inside an `Icon`, as with `icon`. Left out when `icon` is given, which\n * warns in development. Text warns too, since `aria-label` replaces it as\n * the name: a button with text is a `Button`.\n */\n children?: React.ReactNode;\n /**\n * Makes the button a circle the size of its square. The circle comes from\n * bestax's CSS, in `bestax.css` and its variants, or in `extras.css` next\n * to your own Bulma. Without it, Bulma's `is-rounded` draws a pill a little\n * wider than it is tall.\n */\n isRounded?: boolean;\n}\n\n/** Names an IconButton by the text of another element. */\nexport interface IconButtonLabelledBy {\n /** The id of the element whose text names the button, in place of `aria-label`. */\n 'aria-labelledby': string;\n /**\n * @internal Not with `aria-labelledby`, which already names the button.\n * Declared so the two can't be passed together.\n */\n 'aria-label'?: undefined;\n}\n\n/** Names an IconButton with `aria-label`, the usual way. */\nexport interface IconButtonLabel {\n /**\n * The button's name: what a screen reader announces and what a voice\n * control user says to press it. Required, or `aria-labelledby` in its\n * place, since an icon has no text to name it by. Name the action\n * (\"Delete\"), not the picture (\"Trash\"). An empty or blank one warns in\n * development.\n */\n 'aria-label': string;\n /**\n * @internal Not with `aria-label`. Declared so the two can't be passed\n * together.\n */\n 'aria-labelledby'?: undefined;\n}\n\n/**\n * How an IconButton gets its name: `aria-label`, or `aria-labelledby` in its\n * place. `IconButtonLabel` comes last because TypeScript names the union's\n * last member when neither is given: under \"No overload matches this call\",\n * each overload's error ends \"Property ''aria-label'' is missing … but\n * required in type 'IconButtonLabel'\".\n */\nexport type IconButtonName = IconButtonLabelledBy | IconButtonLabel;\n\n/**\n * Props for the IconButton component. The DOM attributes and the `ref` follow\n * `as`, exactly as they do on `Button`.\n *\n * @extraProp {string} [type='button'] - On a `<button>`, `'button'`, `'submit'` or `'reset'`, and `'button'` unless you pass one of the other two, so it never submits a form by accident. With another `as`, whatever that element or component takes, passed through as given, such as an `<a>`'s MIME type.\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`.\n */\nexport type IconButtonProps<T extends React.ElementType = 'button'> =\n IconButtonOwnProps &\n IconButtonName &\n Omit<\n React.ComponentPropsWithoutRef<T>,\n keyof IconButtonOwnProps | 'aria-label' | 'aria-labelledby' | 'as'\n > & {\n /**\n * Render as a `<button>`, an `<a>`, or a custom component such as a\n * router `Link`, as on `Button`.\n * @defaultValue 'button'\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the\n * generic `IconButtonProps<T>` above, and the body can't see through `T`, so\n * it reads the widest form of the props it touches.\n */\ntype IconButtonImplProps = IconButtonOwnProps & {\n as?: React.ElementType;\n type?: unknown;\n 'aria-label'?: unknown;\n 'aria-labelledby'?: unknown;\n};\n\n/** Whether a string has something in it besides spaces. */\nconst hasText = (value: unknown) =>\n typeof value === 'string' && value.trim() !== '';\n\n/** Whether a string is only spaces, which JSX leaves between elements. */\nconst isBlank = (node: React.ReactNode) =>\n typeof node === 'string' && node.trim() === '';\n\n/**\n * The glyph in one `.icon`, which is what Bulma keeps square: an `<Icon>` as\n * given, Fragments opened up and blank text left out, and anything else\n * inside an `Icon`. Null when there's nothing to draw, so an empty Fragment\n * or array counts as no glyph.\n */\nfunction iconOf(node: React.ReactNode) {\n const items = flattenChildren(node).filter(item => !isBlank(item));\n if (items.length === 0) return null;\n const [only] = items;\n if (items.length === 1 && React.isValidElement(only) && only.type === Icon) {\n return only;\n }\n return <Icon>{items}</Icon>;\n}\n\n/** The glyph `icon` draws: a string is an `Icon` name, the rest as `iconOf`. */\nfunction iconFromProp(icon: React.ReactNode) {\n if (typeof icon !== 'string') return iconOf(icon);\n return hasText(icon) ? <Icon name={icon} /> : null;\n}\n\n/**\n * The `IconButton` component renders a button that shows only an icon, and requires a name for it.\n *\n * It renders through `Button`, so it takes everything `Button` takes, and\n * adds the icon and a name the types require: `aria-label`, or\n * `aria-labelledby` in its place. Bulma keeps a button whose only child is an\n * `.icon` square at every size, and `isRounded` makes it a circle. It has no\n * tooltip of its own: wrap it in `Tooltip` for a description.\n *\n * @function\n * @param {IconButtonProps} props - Props for the IconButton component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered button, anchor, or custom element.\n * @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}\n *\n * @example\n * <IconButton icon=\"trash\" aria-label=\"Delete\" color=\"danger\" />\n *\n * @example\n * <IconButton aria-label=\"Settings\">\n * <Icon name=\"cog\" />\n * </IconButton>\n */\nexport const IconButton = forwardRef(function IconButton(\n props: IconButtonProps,\n ref: React.Ref<HTMLElement>\n) {\n const { icon, children, className, ...rest } = props as IconButtonImplProps;\n\n const iconButtonClass = usePrefixedClassNames('icon-button');\n\n const unnamed =\n !hasText(rest['aria-label']) && !hasText(rest['aria-labelledby']);\n // Each way of giving the glyph counts only if it draws something, so an\n // empty Fragment or array as `icon` doesn't hide real children, and an\n // empty one as children doesn't warn.\n const fromIcon = iconFromProp(icon);\n const fromChildren = iconOf(children);\n const both = fromIcon !== null && fromChildren !== null;\n // One glyph, from `icon` or else from `children`, so the button's only\n // child is one `.icon`, which Bulma keeps square, and round with\n // `isRounded`.\n const glyph = fromIcon ?? fromChildren;\n const empty = glyph === null;\n // Only top-level text, Fragments opened up, and only in development, where\n // the warning below can say something about it.\n const textInside =\n isDev() &&\n flattenChildren(children).some(\n child => typeof child === 'number' || hasText(child)\n );\n useEffect(() => {\n if (unnamed) {\n warnOnce(\n 'IconButton:unnamed',\n '[bestax-bulma] <IconButton> has no accessible name. Pass ' +\n 'aria-label naming what it does (\"Delete\"), or aria-labelledby, ' +\n 'so a screen reader has something to announce.'\n );\n }\n if (empty) {\n warnOnce(\n 'IconButton:no-glyph',\n '[bestax-bulma] <IconButton> has no glyph: neither icon nor ' +\n 'children draws one, so it renders an empty square. Pass an icon ' +\n 'name, an <Icon> or another node.'\n );\n }\n if (both) {\n warnOnce(\n 'IconButton:icon-and-children',\n '[bestax-bulma] <IconButton> was given both icon and children. It ' +\n 'draws icon and leaves the children out: give the glyph one way.'\n );\n }\n if (textInside) {\n warnOnce(\n 'IconButton:text',\n '[bestax-bulma] <IconButton> was given text as children. Its ' +\n 'aria-label replaces the text as its name, so a button with text ' +\n 'is a <Button>.'\n );\n }\n }, [unnamed, empty, both, textInside]);\n\n // `type` is a button's only on a `<button>`. On an `<a>` it's the MIME hint,\n // and a custom component owns what it means, so those get it as given.\n const tag = rest.as ?? 'button';\n const typeProp =\n tag === 'button' ? { type: buttonType(rest.type) } : undefined;\n\n return (\n <Button\n // IconButton is polymorphic through to Button, which resolves the\n // element from `as`. TS can't infer that through the spread, so the\n // props and the ref are read at Button's default element.\n {...(rest as ButtonProps)}\n {...typeProp}\n ref={ref as React.Ref<HTMLButtonElement>}\n className={classNames(iconButtonClass, className)}\n >\n {glyph}\n </Button>\n );\n}) as PolymorphicComponent<IconButtonOwnProps & IconButtonName, 'button'>;\n\nIconButton.displayName = 'IconButton';\n\nexport default IconButton;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;AAkHA;AACA,MAAM,OAAO,GAAG,CAAC,KAAc,KAC7B,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;AAElD;AACA,MAAM,OAAO,GAAG,CAAC,IAAqB,KACpC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;AAEhD;;;;;AAKG;AACH,SAAS,MAAM,CAAC,IAAqB,EAAA;AACnC,IAAA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b,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -0,0 +1,42 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ 'use client';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { forwardRef } from 'react';
5
+ import { classNames } from '../helpers/classNames.js';
6
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
7
+ import { useNumberFormat } from '../helpers/localeFormat.js';
8
+
9
+ /**
10
+ * The `NumberFormatter` component writes a number the way a locale writes it, such as a price, a percentage or a count, in a `<data>` element that keeps the number itself in its `value`.
11
+ *
12
+ * It formats with `Intl.NumberFormat`, in its own `locale`, else the
13
+ * `LocaleProvider`'s around it, else the runtime's, with `format` as the
14
+ * options. The `<data>` has no role and no class of its own, so a screen
15
+ * reader reads the formatted text and it takes the look of the text around
16
+ * it. For text outside JSX, such as an `aria-label`, `useNumberFormat`
17
+ * gives the same formatting as a function.
18
+ *
19
+ * @function
20
+ * @param {NumberFormatterProps} props - Props for the NumberFormatter component.
21
+ * @param {React.Ref<HTMLDataElement>} ref - Forwarded ref to the `<data>`.
22
+ * @returns {JSX.Element} The rendered number.
23
+ *
24
+ * @example
25
+ * <NumberFormatter
26
+ * value={8456.4}
27
+ * format={{ style: 'currency', currency: 'USD' }}
28
+ * />
29
+ */
30
+ const NumberFormatter = forwardRef(({ className, textColor, bgColor, value, format, locale, ...props }, ref) => {
31
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
32
+ color: textColor,
33
+ backgroundColor: bgColor,
34
+ ...props,
35
+ });
36
+ const formatNumber = useNumberFormat(locale);
37
+ return (jsx("data", { ref: ref, className: classNames(bulmaHelperClasses, className) || undefined, ...rest, value: Object.is(value, -0) ? '-0' : String(value), children: formatNumber(value, format) }));
38
+ });
39
+ NumberFormatter.displayName = 'NumberFormatter';
40
+
41
+ export { NumberFormatter };
42
+ //# sourceMappingURL=NumberFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberFormatter.js","sources":["../../../src/elements/NumberFormatter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { classNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { useNumberFormat } from '../helpers/localeFormat';\n\n/**\n * Props for the NumberFormatter component. The helper props, the other\n * attributes and the `ref` land on the `<data>`.\n *\n * @extraProp {React.Ref<HTMLDataElement>} [ref] - Ref forwarded to the `<data>`.\n */\nexport interface NumberFormatterProps\n extends\n Omit<\n React.DataHTMLAttributes<HTMLDataElement>,\n 'value' | 'color' | 'children'\n >,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * The number. The text is what `Intl.NumberFormat` writes for it, `NaN`\n * and `Infinity` included. The `<data>` element's `value` attribute holds\n * it as `String()` writes it, except that `-0` keeps its sign, so\n * `Number()` reads it back: `1234.5`, `1e+21` for a very large one and\n * `1e-7` for a very small one, `NaN`, `Infinity` and `-0`.\n */\n value: number;\n /**\n * `Intl.NumberFormat` options: a currency, a percentage, a unit, compact\n * notation, the fraction digits, the sign. Options `Intl` refuses, such as\n * `style: 'currency'` with no `currency`, throw its error.\n */\n format?: Intl.NumberFormatOptions;\n /**\n * BCP 47 locale tag. Unset, it's the `locale` of a `LocaleProvider` around\n * it, and with neither, the runtime's own. On a server render that's the\n * server's, so give it a locale, here or through a `LocaleProvider`, where\n * the server's and the browser's can differ. A tag `Intl` refuses, such as\n * `\"en_US\"`, is ignored, with a warning in development, as\n * `LocaleProvider` ignores one.\n */\n locale?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/**\n * The `NumberFormatter` component writes a number the way a locale writes it, such as a price, a percentage or a count, in a `<data>` element that keeps the number itself in its `value`.\n *\n * It formats with `Intl.NumberFormat`, in its own `locale`, else the\n * `LocaleProvider`'s around it, else the runtime's, with `format` as the\n * options. The `<data>` has no role and no class of its own, so a screen\n * reader reads the formatted text and it takes the look of the text around\n * it. For text outside JSX, such as an `aria-label`, `useNumberFormat`\n * gives the same formatting as a function.\n *\n * @function\n * @param {NumberFormatterProps} props - Props for the NumberFormatter component.\n * @param {React.Ref<HTMLDataElement>} ref - Forwarded ref to the `<data>`.\n * @returns {JSX.Element} The rendered number.\n *\n * @example\n * <NumberFormatter\n * value={8456.4}\n * format={{ style: 'currency', currency: 'USD' }}\n * />\n */\nexport const NumberFormatter = forwardRef<\n HTMLDataElement,\n NumberFormatterProps\n>(({ className, textColor, bgColor, value, format, locale, ...props }, ref) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n const formatNumber = useNumberFormat(locale);\n return (\n <data\n ref={ref}\n className={classNames(bulmaHelperClasses, className) || undefined}\n {...rest}\n value={Object.is(value, -0) ? '-0' : String(value)}\n >\n {formatNumber(value, format)}\n </data>\n );\n});\n\nNumberFormatter.displayName = 'NumberFormatter';\n\nexport default NumberFormatter;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAqDA;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,eAAe,GAAG,UAAU,CAGvC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC5E,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AACF,IAAA,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC;IAC5C,QACEA,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,SAAS,CAAC,IAAI,SAAS,EAAA,GAC7D,IAAI,EACR,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,EAAA,QAAA,EAEjD,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,EAAA,CACvB;AAEX,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB;;"}
@@ -4,7 +4,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { forwardRef, useEffect } from 'react';
5
5
  import { usePrefixedClassNames, classNames, prefixedClassNames } from '../helpers/classNames.js';
6
6
  import { useClassPrefix } from '../helpers/Config.js';
7
- import { useNumberFormat } from '../helpers/localeFormat.js';
7
+ import { useScopedNumberFormat } from '../helpers/localeFormat.js';
8
8
  import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
9
9
  import { warnOnce } from '../helpers/devWarnings.js';
10
10
 
@@ -87,7 +87,7 @@ const RingProgress = forwardRef(({ className, textColor, bgColor, value, max = 1
87
87
  const labelClass = usePrefixedClassNames('ring-progress-label');
88
88
  // A section's color class, prefixed like the rest.
89
89
  const classPrefix = useClassPrefix();
90
- const formatNumber = useNumberFormat();
90
+ const formatNumber = useScopedNumberFormat();
91
91
  const writeShare = (share) => formatNumber
92
92
  ? formatNumber(share / 100, { style: 'percent' })
93
93
  : `${share}%`;
@@ -1 +1 @@
1
- {"version":3,"file":"RingProgress.js","sources":["../../../src/elements/RingProgress.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport { useNumberFormat } from '../helpers/localeFormat';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnOnce } from '../helpers/devWarnings';\n\nconst validRingProgressColors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n] as const;\n/** The Bulma colors an arc takes, the ones `Progress` takes. */\nexport type RingProgressColor = (typeof validRingProgressColors)[number];\n\nconst validRingProgressSizes = ['small', 'medium', 'large'] as const;\n\n/** One colored part of a ring drawn in sections. */\nexport interface RingProgressSection {\n /** Its size, in the same units as the ring's `max`. */\n value: number;\n /** Its color. Without one, it takes the ring's. */\n color?: RingProgressColor;\n /** What it is, such as \"Photos\", read in the ring's name with its share. */\n label: string;\n}\n\n/**\n * Props for the RingProgress component. The helper props, the other\n * attributes and the `ref` land on its root `<div>`.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the root `<div>`.\n * @extraProp {string} [aria-labelledby] - The id of a visible heading that names the ring, in place of `label`. With `sections`, use `label`, since a name from here replaces the one that lists the values.\n * @extraProp {string} [aria-valuetext] - What a screen reader says for the value, such as \"7 of 10 tasks\". Without it, the value is read as a percentage.\n */\nexport interface RingProgressProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * How far along it is, from 0 to `max`. Values outside that range are\n * drawn, and read, at the nearest end. Ignored with `sections`.\n */\n value?: number;\n /** The value that fills the ring. */\n max?: number;\n /**\n * Several values around one ring, in order clockwise from the top, each\n * with its own color and label. The ring is then an image whose name\n * writes them out, such as \"Storage: Documents 40%, Photos 15%\", since a\n * screen reader can't take several values from one element. Inside a\n * `LocaleProvider` with a `locale`, the shares are written as that locale\n * writes a percentage. A total over `max` fills the ring and stops.\n */\n sections?: RingProgressSection[];\n /**\n * What it shows, such as \"Upload\" or \"Storage\". It names the ring, so it's\n * read with the value. A development build warns when the ring has no\n * name.\n */\n label?: string;\n /**\n * A level within a range, such as storage used or a score, rather than a\n * task moving toward done: `role=\"meter\"` in place of `role=\"progressbar\"`.\n * Ignored with `sections`.\n */\n isMeter?: boolean;\n /** The arc's color, and the color of sections without one. */\n color?: RingProgressColor;\n /** The ring's size. */\n size?: (typeof validRingProgressSizes)[number];\n /** Rounds the ends of the arc. */\n isRounded?: boolean;\n /**\n * What sits in the middle of the ring, such as the value as text. It's\n * hidden from assistive tech, which reads the value from the ring itself,\n * so the value isn't heard twice. Say anything more, such as \"7 of 10\n * tasks\", in `aria-valuetext`.\n */\n children?: React.ReactNode;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/** An arc's place on the ring, in percent of the way round. */\ninterface Arc {\n start: number;\n length: number;\n color?: RingProgressColor;\n}\n\nconst clamp = (value: number, low: number, high: number) =>\n Math.min(Math.max(value, low), high);\n\n/**\n * The `RingProgress` component draws a value as a ring that fills as it grows, with anything you pass shown in the middle.\n *\n * It's a `progressbar` for a task moving toward done, or a `meter` with\n * `isMeter` for a level within a range, named by `label`. With `sections`\n * it draws several values around one ring and is an image whose name lists\n * them. It has no state for work with no value: that's `Loader`.\n *\n * @function\n * @param {RingProgressProps} props - Props for the RingProgress component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root `<div>`.\n * @returns {JSX.Element} The rendered ring.\n *\n * @example\n * <RingProgress value={72} label=\"Upload\" color=\"success\">\n * 72%\n * </RingProgress>\n */\nexport const RingProgress = forwardRef<HTMLDivElement, RingProgressProps>(\n (\n {\n className,\n textColor,\n bgColor,\n value,\n max = 100,\n sections,\n label,\n isMeter,\n color,\n size,\n isRounded,\n children,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const named = Boolean(\n label || rest['aria-label'] || rest['aria-labelledby']\n );\n const mixed = sections !== undefined && value !== undefined;\n useEffect(() => {\n if (!named) {\n warnOnce(\n 'RingProgress:unnamed',\n '[bestax-bulma] <RingProgress> has no accessible name. Pass ' +\n 'label, so a screen reader can say what the ring shows.'\n );\n }\n if (mixed) {\n warnOnce(\n 'RingProgress:value-and-sections',\n '[bestax-bulma] <RingProgress> was given both value and sections. ' +\n 'It draws the sections and ignores value.'\n );\n }\n }, [named, mixed]);\n\n const total = max > 0 ? max : 100;\n const share = (part: number) => (clamp(part, 0, total) / total) * 100;\n\n // Each arc starts where the one before ended, and the last stops at the\n // top, so a total over max fills the ring and no more.\n const arcs: Arc[] = [];\n if (sections) {\n let start = 0;\n for (const section of sections) {\n const length = Math.min(share(section.value), 100 - start);\n arcs.push({ start, length, color: section.color });\n start += length;\n }\n } else {\n arcs.push({ start: 0, length: share(value ?? 0) });\n }\n\n const rootClass = usePrefixedClassNames('ring-progress', {\n [`is-${size}`]:\n !!size && (validRingProgressSizes as readonly string[]).includes(size),\n [`is-${color}`]:\n !!color &&\n (validRingProgressColors as readonly string[]).includes(color),\n 'is-rounded': !!isRounded,\n 'has-sections': !!sections,\n });\n const ringClass = usePrefixedClassNames('ring-progress-ring');\n const trackClass = usePrefixedClassNames('ring-progress-track');\n const arcClass = usePrefixedClassNames('ring-progress-arc');\n const labelClass = usePrefixedClassNames('ring-progress-label');\n // A section's color class, prefixed like the rest.\n const classPrefix = useClassPrefix();\n const formatNumber = useNumberFormat();\n const writeShare = (share: number) =>\n formatNumber\n ? formatNumber(share / 100, { style: 'percent' })\n : `${share}%`;\n\n const roleProps = sections\n ? {\n role: 'img',\n 'aria-label': [\n label || rest['aria-label'],\n sections\n .map(\n (section, i) =>\n `${section.label} ${writeShare(Math.round(arcs[i].length))}`\n )\n .join(', '),\n ]\n .filter(Boolean)\n .join(': '),\n }\n : {\n role: isMeter ? 'meter' : 'progressbar',\n 'aria-valuenow': clamp(value ?? 0, 0, total),\n 'aria-valuemin': 0,\n 'aria-valuemax': total,\n 'aria-label': label || rest['aria-label'],\n };\n\n return (\n <div\n ref={ref}\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n {...roleProps}\n >\n <svg className={ringClass} viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <circle className={trackClass} cx=\"50\" cy=\"50\" r=\"42\" />\n {arcs.map(\n (arc, i) =>\n arc.length > 0 && (\n <circle\n key={i}\n className={classNames(\n arcClass,\n arc.color &&\n (validRingProgressColors as readonly string[]).includes(\n arc.color\n ) &&\n prefixedClassNames(classPrefix, `is-${arc.color}`)\n )}\n cx=\"50\"\n cy=\"50\"\n r=\"42\"\n pathLength={100}\n style={\n {\n '--ring-progress-length': arc.length,\n '--ring-progress-start': arc.start,\n } as React.CSSProperties\n }\n />\n )\n )}\n </svg>\n {children !== undefined && children !== null && (\n // The ring's value is already read from its role, and not every\n // browser keeps a meter's content out of the tree, so the middle\n // is for the eye only.\n <div className={labelClass} aria-hidden=\"true\">\n {children}\n </div>\n )}\n </div>\n );\n }\n);\n\nRingProgress.displayName = 'RingProgress';\n\nexport default RingProgress;\n"],"names":["clamp","_jsxs","_jsx"],"mappings":";;;;;;;;;;AAeA,MAAM,uBAAuB,GAAG;IAC9B,SAAS;IACT,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;CACC;AAIV,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAgFpE,MAAMA,OAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,IAAY,KACrD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC;AAEtC;;;;;;;;;;;;;;;;;AAiBG;AACI,MAAM,YAAY,GAAG,UAAU,CACpC,CACE,EACE,SAAS,EACT,SAAS,EACT,OAAO,EACP,KAAK,EACL,GAAG,GAAG,GAAG,EACT,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,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AA,GAAA,EAAM,GAAG,CAAC,KAAK,CAAA,CAAE,CAAC,CACrD,EACD,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,CAAC,EAAC,IAAI,EACN,UAAU,EAAE,GAAG,EACf,KAAK,EACH;4BACE,wBAAwB,EAAE,GAAG,CAAC,MAAM;4BACpC,uBAAuB,EAAE,GAAG,CAAC,KAAK;yBACZ,EAAA,EAjBrB,CAAC,CAmBN,CACH,CACJ,CAAA,EAAA,CACG,EACL,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,KAI1CA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,EAAA,aAAA,EAAc,MAAM,EAAA,QAAA,EAC3C,QAAQ,EAAA,CACL,CACP,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,YAAY,CAAC,WAAW,GAAG,cAAc;;"}
1
+ {"version":3,"file":"RingProgress.js","sources":["../../../src/elements/RingProgress.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport { useScopedNumberFormat } from '../helpers/localeFormat';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnOnce } from '../helpers/devWarnings';\n\nconst validRingProgressColors = [\n 'primary',\n 'link',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'black',\n 'dark',\n 'light',\n 'white',\n] as const;\n/** The Bulma colors an arc takes, the ones `Progress` takes. */\nexport type RingProgressColor = (typeof validRingProgressColors)[number];\n\nconst validRingProgressSizes = ['small', 'medium', 'large'] as const;\n\n/** One colored part of a ring drawn in sections. */\nexport interface RingProgressSection {\n /** Its size, in the same units as the ring's `max`. */\n value: number;\n /** Its color. Without one, it takes the ring's. */\n color?: RingProgressColor;\n /** What it is, such as \"Photos\", read in the ring's name with its share. */\n label: string;\n}\n\n/**\n * Props for the RingProgress component. The helper props, the other\n * attributes and the `ref` land on its root `<div>`.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the root `<div>`.\n * @extraProp {string} [aria-labelledby] - The id of a visible heading that names the ring, in place of `label`. With `sections`, use `label`, since a name from here replaces the one that lists the values.\n * @extraProp {string} [aria-valuetext] - What a screen reader says for the value, such as \"7 of 10 tasks\". Without it, the value is read as a percentage.\n */\nexport interface RingProgressProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * How far along it is, from 0 to `max`. Values outside that range are\n * drawn, and read, at the nearest end. Ignored with `sections`.\n */\n value?: number;\n /** The value that fills the ring. */\n max?: number;\n /**\n * Several values around one ring, in order clockwise from the top, each\n * with its own color and label. The ring is then an image whose name\n * writes them out, such as \"Storage: Documents 40%, Photos 15%\", since a\n * screen reader can't take several values from one element. Inside a\n * `LocaleProvider` with a `locale`, the shares are written as that locale\n * writes a percentage. A total over `max` fills the ring and stops.\n */\n sections?: RingProgressSection[];\n /**\n * What it shows, such as \"Upload\" or \"Storage\". It names the ring, so it's\n * read with the value. A development build warns when the ring has no\n * name.\n */\n label?: string;\n /**\n * A level within a range, such as storage used or a score, rather than a\n * task moving toward done: `role=\"meter\"` in place of `role=\"progressbar\"`.\n * Ignored with `sections`.\n */\n isMeter?: boolean;\n /** The arc's color, and the color of sections without one. */\n color?: RingProgressColor;\n /** The ring's size. */\n size?: (typeof validRingProgressSizes)[number];\n /** Rounds the ends of the arc. */\n isRounded?: boolean;\n /**\n * What sits in the middle of the ring, such as the value as text. It's\n * hidden from assistive tech, which reads the value from the ring itself,\n * so the value isn't heard twice. Say anything more, such as \"7 of 10\n * tasks\", in `aria-valuetext`.\n */\n children?: React.ReactNode;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/** An arc's place on the ring, in percent of the way round. */\ninterface Arc {\n start: number;\n length: number;\n color?: RingProgressColor;\n}\n\nconst clamp = (value: number, low: number, high: number) =>\n Math.min(Math.max(value, low), high);\n\n/**\n * The `RingProgress` component draws a value as a ring that fills as it grows, with anything you pass shown in the middle.\n *\n * It's a `progressbar` for a task moving toward done, or a `meter` with\n * `isMeter` for a level within a range, named by `label`. With `sections`\n * it draws several values around one ring and is an image whose name lists\n * them. It has no state for work with no value: that's `Loader`.\n *\n * @function\n * @param {RingProgressProps} props - Props for the RingProgress component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root `<div>`.\n * @returns {JSX.Element} The rendered ring.\n *\n * @example\n * <RingProgress value={72} label=\"Upload\" color=\"success\">\n * 72%\n * </RingProgress>\n */\nexport const RingProgress = forwardRef<HTMLDivElement, RingProgressProps>(\n (\n {\n className,\n textColor,\n bgColor,\n value,\n max = 100,\n sections,\n label,\n isMeter,\n color,\n size,\n isRounded,\n children,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const named = Boolean(\n label || rest['aria-label'] || rest['aria-labelledby']\n );\n const mixed = sections !== undefined && value !== undefined;\n useEffect(() => {\n if (!named) {\n warnOnce(\n 'RingProgress:unnamed',\n '[bestax-bulma] <RingProgress> has no accessible name. Pass ' +\n 'label, so a screen reader can say what the ring shows.'\n );\n }\n if (mixed) {\n warnOnce(\n 'RingProgress:value-and-sections',\n '[bestax-bulma] <RingProgress> was given both value and sections. ' +\n 'It draws the sections and ignores value.'\n );\n }\n }, [named, mixed]);\n\n const total = max > 0 ? max : 100;\n const share = (part: number) => (clamp(part, 0, total) / total) * 100;\n\n // Each arc starts where the one before ended, and the last stops at the\n // top, so a total over max fills the ring and no more.\n const arcs: Arc[] = [];\n if (sections) {\n let start = 0;\n for (const section of sections) {\n const length = Math.min(share(section.value), 100 - start);\n arcs.push({ start, length, color: section.color });\n start += length;\n }\n } else {\n arcs.push({ start: 0, length: share(value ?? 0) });\n }\n\n const rootClass = usePrefixedClassNames('ring-progress', {\n [`is-${size}`]:\n !!size && (validRingProgressSizes as readonly string[]).includes(size),\n [`is-${color}`]:\n !!color &&\n (validRingProgressColors as readonly string[]).includes(color),\n 'is-rounded': !!isRounded,\n 'has-sections': !!sections,\n });\n const ringClass = usePrefixedClassNames('ring-progress-ring');\n const trackClass = usePrefixedClassNames('ring-progress-track');\n const arcClass = usePrefixedClassNames('ring-progress-arc');\n const labelClass = usePrefixedClassNames('ring-progress-label');\n // A section's color class, prefixed like the rest.\n const classPrefix = useClassPrefix();\n const formatNumber = useScopedNumberFormat();\n const writeShare = (share: number) =>\n formatNumber\n ? formatNumber(share / 100, { style: 'percent' })\n : `${share}%`;\n\n const roleProps = sections\n ? {\n role: 'img',\n 'aria-label': [\n label || rest['aria-label'],\n sections\n .map(\n (section, i) =>\n `${section.label} ${writeShare(Math.round(arcs[i].length))}`\n )\n .join(', '),\n ]\n .filter(Boolean)\n .join(': '),\n }\n : {\n role: isMeter ? 'meter' : 'progressbar',\n 'aria-valuenow': clamp(value ?? 0, 0, total),\n 'aria-valuemin': 0,\n 'aria-valuemax': total,\n 'aria-label': label || rest['aria-label'],\n };\n\n return (\n <div\n ref={ref}\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n {...roleProps}\n >\n <svg className={ringClass} viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <circle className={trackClass} cx=\"50\" cy=\"50\" r=\"42\" />\n {arcs.map(\n (arc, i) =>\n arc.length > 0 && (\n <circle\n key={i}\n className={classNames(\n arcClass,\n arc.color &&\n (validRingProgressColors as readonly string[]).includes(\n arc.color\n ) &&\n prefixedClassNames(classPrefix, `is-${arc.color}`)\n )}\n cx=\"50\"\n cy=\"50\"\n r=\"42\"\n pathLength={100}\n style={\n {\n '--ring-progress-length': arc.length,\n '--ring-progress-start': arc.start,\n } as React.CSSProperties\n }\n />\n )\n )}\n </svg>\n {children !== undefined && children !== null && (\n // The ring's value is already read from its role, and not every\n // browser keeps a meter's content out of the tree, so the middle\n // is for the eye only.\n <div className={labelClass} aria-hidden=\"true\">\n {children}\n </div>\n )}\n </div>\n );\n }\n);\n\nRingProgress.displayName = 'RingProgress';\n\nexport default RingProgress;\n"],"names":["clamp","_jsxs","_jsx"],"mappings":";;;;;;;;;;AAeA,MAAM,uBAAuB,GAAG;IAC9B,SAAS;IACT,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;CACC;AAIV,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAgFpE,MAAMA,OAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,IAAY,KACrD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC;AAEtC;;;;;;;;;;;;;;;;;AAiBG;AACI,MAAM,YAAY,GAAG,UAAU,CACpC,CACE,EACE,SAAS,EACT,SAAS,EACT,OAAO,EACP,KAAK,EACL,GAAG,GAAG,GAAG,EACT,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EACD,GAAG,KACD;AACF,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,KAAK,GAAG,OAAO,CACnB,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,CACvD;IACD,MAAM,KAAK,GAAG,QAAQ,KAAK,SA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,KAAK,IAAI,KAI1CA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,EAAA,aAAA,EAAc,MAAM,EAAA,QAAA,EAC3C,QAAQ,EAAA,CACL,CACP,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,YAAY,CAAC,WAAW,GAAG,cAAc;;"}
@@ -5,7 +5,7 @@ import { forwardRef, useState, useReducer, useRef, useCallback, useEffect, useId
5
5
  import { usePrefixedClassNames, classNames, prefixedClassNames } from '../helpers/classNames.js';
6
6
  import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
7
7
  import { useConfig } from '../helpers/Config.js';
8
- import { useNumberFormat } from '../helpers/localeFormat.js';
8
+ import { useScopedNumberFormat } from '../helpers/localeFormat.js';
9
9
  import { StatusRegion } from '../helpers/statusRegion.js';
10
10
  import { warnOnce } from '../helpers/devWarnings.js';
11
11
  import { Delete } from '../elements/Delete.js';
@@ -190,7 +190,7 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
190
190
  node;
191
191
  }
192
192
  }, [ref]);
193
- const formatNumber = useNumberFormat();
193
+ const formatNumber = useScopedNumberFormat();
194
194
  const tokens = acceptTokens(accept);
195
195
  const sizeText = (bytes) => formatFileSize(bytes, formatNumber);
196
196
  const countText = (count) => formatNumber ? formatNumber(count) : String(count);
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","sources":["../../../src/form/Dropzone.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useReducer,\n useRef,\n useState,\n} from 'react';\nimport {\n classNames,\n usePrefixedClassNames,\n prefixedClassNames,\n} from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useConfig } from '../helpers/Config';\nimport { useNumberFormat, NumberFormatter } from '../helpers/localeFormat';\nimport { StatusRegion } from '../helpers/statusRegion';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { Delete } from '../elements/Delete';\nimport {\n useInsideField,\n useInsideControl,\n rendersOwnField,\n useFieldsetDisabled,\n} from './FormContext';\nimport { Field } from './Field';\nimport { FormFieldProps } from './fieldProps';\nimport { useAutoLabelId } from './useAutoLabelId';\n\n/** Why a Dropzone refused a file. */\nexport type DropzoneRejectionCode =\n 'file-invalid-type' | 'file-too-large' | 'too-many-files';\n\n/** A file a Dropzone refused, and why. */\nexport interface DropzoneRejection {\n /** The file. */\n file: File;\n /**\n * Why it was refused: `file-invalid-type` when `accept` doesn't take it, or\n * it's a folder; `file-too-large` when it's over `maxSize`; `too-many-files`\n * when the list is full.\n */\n code: DropzoneRejectionCode;\n}\n\n/**\n * Props for the Dropzone component.\n *\n * @helperProps Helper props go on the `.dropzone` root `<div>`, with\n * `className`. The other attributes go on the `<input>`.\n * @extraProp {string} [accept] - File types it takes, as the native attribute writes them (`.pdf`, `image/*`, `application/pdf`). The picker offers them, and Dropzone checks every pick, drop and paste against them by the same rules, since browsers don't check a dropped file. It goes by a file's name and type, not its contents.\n * @extraProp {boolean} [multiple=false] - Takes several files, and each pick, drop or paste adds to the list. Without it, a new file replaces the one chosen.\n * @extraProp {string} [name] - The files' name in the form's data. The input holds the chosen files, so a plain form submit, `FormData` and React 19 actions all carry them.\n * @extraProp {boolean} [required=false] - The browser's own check: a form won't submit with no file chosen.\n * @extraProp {boolean} [disabled=false] - Disables the input, hides the remove buttons and takes no drops. A disabled `Fieldset` around it does the same.\n * @extraProp {(event: React.ChangeEvent<HTMLInputElement>) => void} [onChange] - Called on the input's `change`, after each pick, drop, paste or removal that changes the files, with `event.target.files` holding the new list.\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the `<input>`, so `ref.current.showPicker()` opens the picker from a button of your own. A script that writes the input through it, such as `value = ''` to clear it or a form library setting `files`, changes what the input holds and what the next pick, drop or paste adds to, but no event reports the write, so the list shows it only from the next change. To clear the list at once, reset the form, or control it with `files` and set that to `[]`.\n */\nexport interface DropzoneProps\n extends\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'color' | 'type' | 'children' | 'value' | 'defaultValue'\n >,\n Omit<BulmaClassesProps, 'color'>,\n FormFieldProps {\n /** Field label, rendered above the zone. It names the input along with the zone's own text, through `htmlFor` (your `id` when you pass one). Inside an outer `Field` it's dropped, and that `Field`'s label names the input. */\n label?: React.ReactNode;\n /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */\n labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {\n [key: string]: unknown;\n };\n /** Bulma color modifier for the zone, as `File` takes it. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Size modifier for the zone. */\n size?: 'small' | 'medium' | 'large';\n /**\n * The zone's text. It's the input's accessible name, so keep it short, and\n * put details such as \"PDF up to 5 MB\" in `hint`. Default: \"Choose or drop\n * a file\", or \"Choose or drop files\" with `multiple`.\n */\n buttonLabel?: React.ReactNode;\n /**\n * An icon above the zone's text. It sits inside the `<label>` that names\n * the input, so leave an `Icon` here unnamed (`<Icon name=\"upload\" />`).\n */\n icon?: React.ReactNode;\n /**\n * A line under the zone that describes the input through\n * `aria-describedby`, such as \"PDF up to 5 MB\".\n */\n hint?: React.ReactNode;\n /** The largest file it takes, in bytes. A bigger one is refused with `file-too-large`. */\n maxSize?: number;\n /**\n * With `multiple`, how many files the list holds at most. A drop that would\n * go over adds files up to the limit and refuses the rest with\n * `too-many-files`.\n */\n maxFiles?: number;\n /**\n * The chosen files, to control the list. The input and the list follow it,\n * and a change you don't take through `onFilesChange` is undone. Setting it\n * to `[]` clears both.\n */\n files?: File[];\n /** Called with the whole list of chosen files each time it changes. */\n onFilesChange?: (files: File[]) => void;\n /** Called with the files a pick, drop or paste refused, and why. */\n onReject?: (rejections: DropzoneRejection[]) => void;\n /**\n * Shows the chosen files under the zone, each with its size and a remove\n * button. Turn it off to show them your own way from `onFilesChange`. The\n * refusals still show.\n */\n showFileList?: boolean;\n /** Takes files pasted while the input has focus, through the same checks as a drop. */\n allowPaste?: boolean;\n /**\n * While it's on the page, stops the browser opening a file dropped outside\n * any drop target, which would leave the page. Drops on other file inputs\n * and on editable fields are left alone.\n */\n preventDocumentDrop?: boolean;\n /** Names a file's remove button, for localization. Default: `` `Remove ${file.name}` ``. */\n removeLabel?: (file: File) => string;\n /**\n * The text shown and announced for a refused file, for localization.\n * Default: the file's name and the reason, such as \"photo.png: only PDF\n * files\".\n */\n rejectionMessage?: (rejection: DropzoneRejection) => string;\n /**\n * What's announced when files are added, for localization. Default: the\n * file's name and \"added\", or a count (\"2 files added\").\n */\n addedMessage?: (files: File[]) => string;\n /** What's announced when a file is removed, for localization. Default: `` `${file.name} removed` ``. */\n removedMessage?: (file: File) => string;\n /**\n * Help or validation message under the Dropzone. It describes the input\n * through `aria-describedby`, after the hint and any refusals.\n */\n message?: React.ReactNode;\n /** Additional CSS classes for the root. */\n className?: string;\n}\n\n/** A file on its way in, and whether it's really a folder. */\ninterface Incoming {\n file: File;\n folder: boolean;\n}\n\n/** A refusal, with whether the file was a folder, which the default message says. */\ninterface Refusal extends DropzoneRejection {\n folder: boolean;\n}\n\n/** Something the status region says, with an id that's new each time. */\ninterface Announcement {\n id: string;\n text: string;\n}\n\nconst noFiles: File[] = [];\nconst noRefusals: Refusal[] = [];\nconst noAnnouncements: Announcement[] = [];\n\nconst describeAnnouncement = (announcement: Announcement) => announcement.text;\n\n/**\n * The tokens of an `accept` attribute that HTML recognizes, lowercased: an\n * extension (`.pdf`), a wildcard (`image/*`) or a MIME type. Others are\n * ignored, as browsers ignore them.\n */\nconst acceptTokens = (accept: string | undefined): string[] =>\n (accept ?? '')\n .split(',')\n .map(token => token.trim().toLowerCase())\n .filter(\n token => token.length > 1 && (token[0] === '.' || token.includes('/'))\n );\n\n/** Whether `accept`'s tokens take a file with this name and type. */\nconst accepts = (tokens: string[], name: string, type: string): boolean => {\n if (tokens.length === 0) return true;\n const lowerName = name.toLowerCase();\n const lowerType = type.toLowerCase();\n return tokens.some(token =>\n token[0] === '.'\n ? lowerName.endsWith(token)\n : token.endsWith('/*')\n ? lowerType.startsWith(token.slice(0, -1))\n : lowerType === token\n );\n};\n\n/** Whether a drag or a clipboard carries files. */\nconst carriesFiles = (data: DataTransfer | null): data is DataTransfer =>\n !!data && Array.from(data.types ?? []).includes('Files');\n\n/** The files a drop or a paste brings, with folders marked. */\nconst incomingFrom = (data: DataTransfer | null): Incoming[] => {\n if (!data) return [];\n const items = Array.from(data.items ?? []).filter(\n item => item.kind === 'file'\n );\n if (items.length === 0) {\n return Array.from(data.files ?? [], file => ({ file, folder: false }));\n }\n const incoming: Incoming[] = [];\n for (const item of items) {\n const file = item.getAsFile();\n if (!file) continue;\n const entry = item.webkitGetAsEntry?.();\n incoming.push({ file, folder: !!entry?.isDirectory });\n }\n return incoming;\n};\n\n/** The same file: one object, or one picked again with the same details. */\nconst sameFile = (a: File, b: File): boolean =>\n a === b ||\n (a.name === b.name && a.size === b.size && a.lastModified === b.lastModified);\n\n/** Whether two lists hold the same files in the same order. */\nconst sameFiles = (\n a: ArrayLike<File> | null | undefined,\n b: readonly File[]\n): boolean =>\n !!a && a.length === b.length && b.every((file, i) => sameFile(a[i], file));\n\n/**\n * Writes files to a file input, through a `DataTransfer`, the one way script\n * can build a `FileList`. Where there's no `DataTransfer` the input is left as\n * it is.\n */\nconst writeFiles = (input: HTMLInputElement, files: readonly File[]) => {\n if (typeof DataTransfer !== 'function') return;\n const transfer = new DataTransfer();\n for (const file of files) transfer.items.add(file);\n input.files = transfer.files;\n};\n\n/** The units a file size is written in, largest first. */\nconst sizeUnits = [\n ['gigabyte', 1e9, 'GB'],\n ['megabyte', 1e6, 'MB'],\n ['kilobyte', 1e3, 'kB'],\n] as const;\n\n/**\n * A file size for display, in decimal units (\"1.2 MB\"), in the locale of a\n * `LocaleProvider` around it, or as English writes it outside one.\n */\nconst formatFileSize = (\n bytes: number,\n formatNumber: NumberFormatter | null\n): string => {\n for (const [unit, factor, symbol] of sizeUnits) {\n if (bytes >= factor) {\n const value = bytes / factor;\n return formatNumber\n ? formatNumber(value, {\n style: 'unit',\n unit,\n unitDisplay: 'short',\n maximumFractionDigits: 1,\n })\n : `${Math.round(value * 10) / 10} ${symbol}`;\n }\n }\n return formatNumber\n ? formatNumber(bytes, { style: 'unit', unit: 'byte', unitDisplay: 'long' })\n : `${bytes} ${bytes === 1 ? 'byte' : 'bytes'}`;\n};\n\n/** A word for each kind of file `accept` names: \"PDF\", \"image\". */\nconst typeNames = (tokens: string[]): string[] => {\n const names: string[] = [];\n for (const token of tokens) {\n let name = token;\n if (token[0] === '.') {\n name = token.slice(1).toUpperCase();\n } else {\n const [type, subtype] = token.split('/');\n const core = subtype.split('+')[0];\n if (subtype === '*') name = type;\n else if (core === 'plain') name = 'text';\n else if (/^[a-z0-9]+$/.test(core)) name = core.toUpperCase();\n }\n if (!names.includes(name)) names.push(name);\n }\n return names;\n};\n\n/** \"A\", \"A or B\", \"A, B, or C\". */\nconst orList = (items: string[]): string =>\n items.length <= 2\n ? items.join(' or ')\n : `${items.slice(0, -1).join(', ')}, or ${items[items.length - 1]}`;\n\n/**\n * The `Dropzone` component is an area to drop files on or click to pick\n * them, which checks each file and lists the chosen ones with a way to remove\n * each.\n *\n * It's Bulma's boxed, full-width file widget with the real\n * `<input type=\"file\">` lying over it, so the input is the one tab stop, the\n * click target and the drop target, and Enter and Space open the picker. The\n * input holds the chosen files: a pick, drop or paste that passes the checks\n * is written to it, so a form submits the files under `name`. It doesn't\n * upload anything.\n *\n * @function\n * @param {DropzoneProps} props - Props for the Dropzone component.\n * @returns {JSX.Element} The rendered dropzone.\n *\n * @example\n * <Dropzone\n * label=\"CV\"\n * name=\"cv\"\n * accept=\".pdf,application/pdf\"\n * maxSize={5_000_000}\n * hint=\"PDF up to 5 MB\"\n * />\n */\nexport const Dropzone = forwardRef<HTMLInputElement, DropzoneProps>(\n (\n {\n // Field props\n label,\n labelSize,\n labelProps,\n horizontal,\n message,\n messageColor,\n fieldClassName,\n color,\n size,\n buttonLabel,\n icon,\n hint,\n maxSize,\n maxFiles,\n files: filesProp,\n onFilesChange,\n onReject,\n showFileList = true,\n allowPaste = true,\n preventDocumentDrop = true,\n removeLabel,\n rejectionMessage,\n addedMessage,\n removedMessage,\n className,\n accept,\n multiple,\n disabled: disabledProp,\n onChange,\n onClick,\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop,\n onPaste,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref\n ) => {\n const disabled = useFieldsetDisabled(disabledProp);\n const controlled = filesProp !== undefined;\n const [ownFiles, setOwnFiles] = useState<File[]>(noFiles);\n const files = filesProp ?? ownFiles;\n // A render the controlled list needs after a change, so that one the app\n // didn't take is undone.\n const [, rerender] = useReducer((n: number) => n + 1, 0);\n const [refusals, setRefusals] = useState<Refusal[]>(noRefusals);\n const [drag, setDrag] = useState<'over' | 'reject' | null>(null);\n const [announcements, setAnnouncements] =\n useState<Announcement[]>(noAnnouncements);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const listRef = useRef<HTMLUListElement>(null);\n // Set while Dropzone dispatches the input's own events, so its change\n // handler hands them on rather than reading them as a pick.\n const dispatchingRef = useRef(false);\n // The row a removal emptied, whose neighbour takes focus.\n const removedRowRef = useRef<number | null>(null);\n const announcedRef = useRef(0);\n // What the input held when it was last clicked (Enter and Space click it\n // too), which a pick adds to: by the time the pick's change arrives, the\n // browser has replaced the input's files with the picked ones.\n const pickBaseRef = useRef<File[] | null>(null);\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) {\n (ref as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n }\n },\n [ref]\n );\n\n const formatNumber = useNumberFormat();\n const tokens = acceptTokens(accept);\n const sizeText = (bytes: number) => formatFileSize(bytes, formatNumber);\n const countText = (count: number) =>\n formatNumber ? formatNumber(count) : String(count);\n\n // The files a pick, drop or paste builds on, and a removal takes one from.\n // Controlled, that's `files`. Uncontrolled, it's the input itself rather\n // than the list: a script can rewrite the input through the ref, emptying\n // it with `value = ''` or setting its `files`, and no event reports that,\n // so the list catches up only at the next change. Where there's no\n // DataTransfer to write the input with, the list is all there is.\n const current = (): File[] =>\n controlled || typeof DataTransfer !== 'function'\n ? files\n : Array.from((inputRef.current as HTMLInputElement).files as FileList);\n\n const messageFor = (refusal: Refusal): string => {\n const { file, code } = refusal;\n if (rejectionMessage) return rejectionMessage({ file, code });\n if (code === 'file-too-large') {\n return `${file.name}: larger than ${sizeText(maxSize as number)}`;\n }\n if (code === 'too-many-files') {\n const most = multiple ? (maxFiles as number) : 1;\n return `${file.name}: only ${most === 1 ? 'one file' : `${countText(most)} files`}`;\n }\n return refusal.folder\n ? `${file.name}: folders can't be added`\n : `${file.name}: only ${orList(typeNames(tokens))} files`;\n };\n\n const announce = (texts: string[]) => {\n if (texts.length === 0) return;\n const batch = ++announcedRef.current;\n setAnnouncements(texts.map((text, i) => ({ id: `${batch}-${i}`, text })));\n };\n\n /**\n * Makes `next` the chosen files: writes them to the input, and when they\n * differ from the list, dispatches the input's `input` and `change` and\n * reports the new list.\n */\n const commit = (next: File[]) => {\n pickBaseRef.current = null;\n const input = inputRef.current as HTMLInputElement;\n if (!sameFiles(input.files, next)) writeFiles(input, next);\n if (sameFiles(files, next)) return;\n if (controlled) rerender();\n else setOwnFiles(next);\n onFilesChange?.(next);\n dispatchingRef.current = true;\n try {\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n } finally {\n dispatchingRef.current = false;\n }\n };\n\n /** Checks the files a pick, drop or paste brings, and takes those that pass. */\n const take = (incoming: Incoming[], base: File[] = current()) => {\n const kept = multiple ? base : noFiles;\n const room = multiple ? (maxFiles ?? Infinity) - kept.length : 1;\n const added: File[] = [];\n const refused: Refusal[] = [];\n for (const { file, folder } of incoming) {\n const code: DropzoneRejectionCode | null =\n folder || !accepts(tokens, file.name, file.type)\n ? 'file-invalid-type'\n : maxSize !== undefined && file.size > maxSize\n ? 'file-too-large'\n : null;\n if (code) {\n refused.push({ file, code, folder });\n } else if (\n multiple &&\n [...kept, ...added].some(f => sameFile(f, file))\n ) {\n // Already in the list: nothing to add, and nothing wrong.\n } else if (added.length >= room) {\n refused.push({ file, code: 'too-many-files', folder });\n } else {\n added.push(file);\n }\n }\n setRefusals(refused.length > 0 ? refused : noRefusals);\n if (refused.length > 0) {\n onReject?.(refused.map(({ file, code }) => ({ file, code })));\n }\n commit(added.length > 0 ? [...kept, ...added] : base);\n const addedText =\n added.length === 0\n ? []\n : [\n addedMessage\n ? addedMessage(added)\n : added.length === 1\n ? `${added[0].name} added`\n : `${countText(added.length)} files added`,\n ];\n announce([...addedText, ...refused.map(messageFor)]);\n };\n\n const remove = (index: number) => {\n const file = files[index];\n removedRowRef.current = index;\n commit(current().filter(held => !sameFile(held, file)));\n announce([\n removedMessage ? removedMessage(file) : `${file.name} removed`,\n ]);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (dispatchingRef.current) {\n onChange?.(event);\n return;\n }\n // A pick: the browser has put the picked files in the input. They're\n // added to what it held when it was clicked, or, for a picker opened\n // with showPicker(), which clicks nothing, to the list. With none (a\n // cancelled pick, in a browser that clears it), that stays.\n const base = pickBaseRef.current ?? files;\n const picked = Array.from(event.target.files ?? []);\n if (picked.length === 0) commit(base);\n else\n take(\n picked.map(file => ({ file, folder: false })),\n base\n );\n };\n\n const handleClick = (event: React.MouseEvent<HTMLInputElement>) => {\n onClick?.(event);\n pickBaseRef.current = current();\n };\n\n // While files are dragged over the input it's cancelled, which makes the\n // input the drop target and keeps the browser's own drop from running.\n // Disabled, it refuses the drop, so the browser doesn't open the file.\n const handleDragOver = (event: React.DragEvent<HTMLInputElement>) => {\n (event.type === 'dragenter' ? onDragEnter : onDragOver)?.(event);\n if (!carriesFiles(event.dataTransfer)) return;\n event.preventDefault();\n if (disabled) {\n event.dataTransfer.dropEffect = 'none';\n return;\n }\n event.dataTransfer.dropEffect = 'copy';\n // Only the dragged files' types can be read, so a file is known to be\n // refused only when `accept` names no extension and its type is known.\n const room = multiple ? (maxFiles ?? Infinity) - current().length : 1;\n const types = Array.from(event.dataTransfer.items ?? [])\n .filter(item => item.kind === 'file')\n .map(item => item.type);\n const refused =\n room <= 0 ||\n (types.length > 0 &&\n tokens.length > 0 &&\n !tokens.some(token => token[0] === '.') &&\n types.every(type => type !== '' && !accepts(tokens, '', type)));\n setDrag(refused ? 'reject' : 'over');\n };\n\n const handleDragLeave = (event: React.DragEvent<HTMLInputElement>) => {\n onDragLeave?.(event);\n setDrag(null);\n };\n\n const handleDrop = (event: React.DragEvent<HTMLInputElement>) => {\n onDrop?.(event);\n setDrag(null);\n if (!carriesFiles(event.dataTransfer)) return;\n event.preventDefault();\n if (!disabled) take(incomingFrom(event.dataTransfer));\n };\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n onPaste?.(event);\n if (!allowPaste || disabled) return;\n const incoming = incomingFrom(event.clipboardData);\n if (incoming.length === 0) return;\n event.preventDefault();\n take(incoming);\n };\n\n // A controlled list: the input follows `files`, and a change the app\n // didn't take is undone.\n useEffect(() => {\n const input = inputRef.current;\n if (controlled && input && !sameFiles(input.files, files)) {\n writeFiles(input, files);\n }\n });\n\n // After a removal, focus goes to the remove button that took the removed\n // one's place, else the one before, else the input.\n useEffect(() => {\n const row = removedRowRef.current;\n if (row === null) return;\n removedRowRef.current = null;\n const buttons = listRef.current?.querySelectorAll('button') ?? [];\n const next = buttons[Math.min(row, buttons.length - 1)];\n (next ?? inputRef.current)?.focus();\n });\n\n // A reset of the input's form empties the input, so the list and the\n // refusals go too. The reset event fires before the form resets, and a\n // listener after this one can still cancel it, so the list is cleared a\n // task later, and only if the reset went ahead.\n const latestRef = useRef({ files, controlled, onFilesChange });\n useEffect(() => {\n latestRef.current = { files, controlled, onFilesChange };\n });\n const formAttribute = props.form;\n useEffect(() => {\n const form = inputRef.current?.form;\n if (!form) return undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const onReset = (event: Event) => {\n timer = setTimeout(() => {\n if (event.defaultPrevented) return;\n const latest = latestRef.current;\n pickBaseRef.current = null;\n setRefusals(noRefusals);\n if (latest.files.length === 0) return;\n if (latest.controlled) rerender();\n else setOwnFiles(noFiles);\n latest.onFilesChange?.(noFiles);\n });\n };\n form.addEventListener('reset', onReset);\n return () => {\n form.removeEventListener('reset', onReset);\n clearTimeout(timer);\n };\n }, [formAttribute]);\n\n // A file dropped just outside the zone would open in the tab. The guard\n // cancels a file drag anywhere nothing else takes it, leaving alone\n // enabled file inputs and editable fields, which take drops of their own,\n // and drops something else already handled. It reads the event's real\n // target, so a file input inside a shadow root is left alone too.\n useEffect(() => {\n if (!preventDocumentDrop) return undefined;\n const guard = (event: DragEvent) => {\n if (event.defaultPrevented || !carriesFiles(event.dataTransfer)) {\n return;\n }\n const target = event.composedPath()[0];\n if (\n target instanceof Element &&\n target.closest(\n 'input[type=\"file\"]:not(:disabled), textarea, [contenteditable]:not([contenteditable=\"false\"])'\n )\n ) {\n return;\n }\n event.preventDefault();\n if (event.type === 'dragover') event.dataTransfer.dropEffect = 'none';\n };\n document.addEventListener('dragover', guard);\n document.addEventListener('drop', guard);\n return () => {\n document.removeEventListener('dragover', guard);\n document.removeEventListener('drop', guard);\n };\n }, [preventDocumentDrop]);\n\n const warnsMaxFiles = maxFiles !== undefined && !multiple;\n useEffect(() => {\n if (warnsMaxFiles) {\n warnOnce(\n 'Dropzone:maxFiles-without-multiple',\n '[bestax-bulma] <Dropzone maxFiles> takes effect only with ' +\n 'multiple. Without it, each new file replaces the one chosen.'\n );\n }\n }, [warnsMaxFiles]);\n\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('Dropzone', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n const { controlId, fieldLabelProps } = useAutoLabelId({\n label,\n id: props.id,\n labelProps,\n rendersLabel: ownField,\n });\n const { classPrefix } = useConfig();\n const pcn = (...args: Parameters<typeof classNames>) =>\n prefixedClassNames(classPrefix, ...args);\n // The input takes `controlId`, so `id` stays out of the spread, where an\n // undefined `id` key would wipe the id the label points at.\n const { id: _id, ...inputProps } = props;\n const { bulmaHelperClasses, rest } = useBulmaClasses(inputProps);\n\n const baseId = useId();\n const hintId = `${baseId}-hint`;\n const refusalsId = `${baseId}-refusals`;\n const messageId = `${baseId}-message`;\n const describedBy =\n [\n ariaDescribedBy,\n hint ? hintId : undefined,\n refusals.length > 0 ? refusalsId : undefined,\n message ? messageId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const rootClass = usePrefixedClassNames('dropzone', {\n 'is-dragover': drag === 'over',\n 'is-drag-reject': drag === 'reject',\n 'is-disabled': disabled,\n });\n const zoneClass = usePrefixedClassNames(\n 'file',\n 'is-boxed',\n 'is-fullwidth',\n {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n }\n );\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // Each row's key, from the file's details, which the list keeps unique.\n const seen = new Map<string, number>();\n const keyOf = (file: File) => {\n const key = `${file.name}:${file.size}:${file.lastModified}`;\n const count = seen.get(key) ?? 0;\n seen.set(key, count + 1);\n return count === 0 ? key : `${key}:${count}`;\n };\n\n const dropzoneElement = (\n <div className={classNames(rootClass, bulmaHelperClasses, className)}>\n <div className={zoneClass}>\n <label className={pcn('file-label')}>\n <input\n {...rest}\n ref={setInputRef}\n className={pcn('file-input')}\n type=\"file\"\n id={controlId}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n aria-describedby={describedBy}\n onChange={handleChange}\n onClick={handleClick}\n onDragEnter={handleDragOver}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onPaste={handlePaste}\n />\n <span className={pcn('file-cta')}>\n {icon && <span className={pcn('file-icon')}>{icon}</span>}\n <span className={pcn('file-label')}>\n {buttonLabel ||\n (multiple ? 'Choose or drop files' : 'Choose or drop a file')}\n </span>\n </span>\n </label>\n </div>\n {hint && (\n <p id={hintId} className={pcn('help', 'dropzone-hint')}>\n {hint}\n </p>\n )}\n {showFileList && files.length > 0 && (\n <ul ref={listRef} className={pcn('dropzone-list')}>\n {files.map((file, index) => (\n <li key={keyOf(file)} className={pcn('dropzone-item')}>\n <span className={pcn('dropzone-name')}>{file.name}</span>\n <span className={pcn('dropzone-size')}>\n {sizeText(file.size)}\n </span>\n {!disabled && (\n <Delete\n size=\"small\"\n ariaLabel={\n removeLabel ? removeLabel(file) : `Remove ${file.name}`\n }\n onClick={() => remove(index)}\n />\n )}\n </li>\n ))}\n </ul>\n )}\n {refusals.length > 0 && (\n <div id={refusalsId} className={pcn('dropzone-rejections')}>\n {refusals.map((refusal, index) => (\n <p key={index} className={pcn('help', 'is-danger')}>\n {messageFor(refusal)}\n </p>\n ))}\n </div>\n )}\n <StatusRegion items={announcements} describe={describeAnnouncement} />\n </div>\n );\n\n const messageEl = message ? (\n <p id={messageId} className={helpClass}>\n {message}\n </p>\n ) : null;\n\n if (ownField) {\n return (\n <Field\n label={label}\n labelSize={labelSize}\n labelProps={fieldLabelProps}\n horizontal={horizontal}\n className={fieldClassName}\n >\n {dropzoneElement}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {dropzoneElement}\n {messageEl}\n </>\n );\n }\n);\n\nDropzone.displayName = 'Dropzone';\n\nexport default Dropzone;\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;AAgLA,MAAM,OAAO,GAAW,EAAE;AAC1B,MAAM,UAAU,GAAc,EAAE;AAChC,MAAM,eAAe,GAAmB,EAAE;AAE1C,MAAM,oBAAoB,GAAG,CAAC,YAA0B,KAAK,YAAY,CAAC,IAAI;AAE9E;;;;AAIG;AACH,MAAM,YAAY,GAAG,CAAC,MAA0B,KAC9C,CAAC,MAAM,IAAI,E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,WAAW,GAAG,UAAU;;"}
1
+ {"version":3,"file":"Dropzone.js","sources":["../../../src/form/Dropzone.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useReducer,\n useRef,\n useState,\n} from 'react';\nimport {\n classNames,\n usePrefixedClassNames,\n prefixedClassNames,\n} from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useConfig } from '../helpers/Config';\nimport {\n useScopedNumberFormat,\n NumberFormatFunction,\n} from '../helpers/localeFormat';\nimport { StatusRegion } from '../helpers/statusRegion';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { Delete } from '../elements/Delete';\nimport {\n useInsideField,\n useInsideControl,\n rendersOwnField,\n useFieldsetDisabled,\n} from './FormContext';\nimport { Field } from './Field';\nimport { FormFieldProps } from './fieldProps';\nimport { useAutoLabelId } from './useAutoLabelId';\n\n/** Why a Dropzone refused a file. */\nexport type DropzoneRejectionCode =\n 'file-invalid-type' | 'file-too-large' | 'too-many-files';\n\n/** A file a Dropzone refused, and why. */\nexport interface DropzoneRejection {\n /** The file. */\n file: File;\n /**\n * Why it was refused: `file-invalid-type` when `accept` doesn't take it, or\n * it's a folder; `file-too-large` when it's over `maxSize`; `too-many-files`\n * when the list is full.\n */\n code: DropzoneRejectionCode;\n}\n\n/**\n * Props for the Dropzone component.\n *\n * @helperProps Helper props go on the `.dropzone` root `<div>`, with\n * `className`. The other attributes go on the `<input>`.\n * @extraProp {string} [accept] - File types it takes, as the native attribute writes them (`.pdf`, `image/*`, `application/pdf`). The picker offers them, and Dropzone checks every pick, drop and paste against them by the same rules, since browsers don't check a dropped file. It goes by a file's name and type, not its contents.\n * @extraProp {boolean} [multiple=false] - Takes several files, and each pick, drop or paste adds to the list. Without it, a new file replaces the one chosen.\n * @extraProp {string} [name] - The files' name in the form's data. The input holds the chosen files, so a plain form submit, `FormData` and React 19 actions all carry them.\n * @extraProp {boolean} [required=false] - The browser's own check: a form won't submit with no file chosen.\n * @extraProp {boolean} [disabled=false] - Disables the input, hides the remove buttons and takes no drops. A disabled `Fieldset` around it does the same.\n * @extraProp {(event: React.ChangeEvent<HTMLInputElement>) => void} [onChange] - Called on the input's `change`, after each pick, drop, paste or removal that changes the files, with `event.target.files` holding the new list.\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the `<input>`, so `ref.current.showPicker()` opens the picker from a button of your own. A script that writes the input through it, such as `value = ''` to clear it or a form library setting `files`, changes what the input holds and what the next pick, drop or paste adds to, but no event reports the write, so the list shows it only from the next change. To clear the list at once, reset the form, or control it with `files` and set that to `[]`.\n */\nexport interface DropzoneProps\n extends\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'color' | 'type' | 'children' | 'value' | 'defaultValue'\n >,\n Omit<BulmaClassesProps, 'color'>,\n FormFieldProps {\n /** Field label, rendered above the zone. It names the input along with the zone's own text, through `htmlFor` (your `id` when you pass one). Inside an outer `Field` it's dropped, and that `Field`'s label names the input. */\n label?: React.ReactNode;\n /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */\n labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {\n [key: string]: unknown;\n };\n /** Bulma color modifier for the zone, as `File` takes it. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Size modifier for the zone. */\n size?: 'small' | 'medium' | 'large';\n /**\n * The zone's text. It's the input's accessible name, so keep it short, and\n * put details such as \"PDF up to 5 MB\" in `hint`. Default: \"Choose or drop\n * a file\", or \"Choose or drop files\" with `multiple`.\n */\n buttonLabel?: React.ReactNode;\n /**\n * An icon above the zone's text. It sits inside the `<label>` that names\n * the input, so leave an `Icon` here unnamed (`<Icon name=\"upload\" />`).\n */\n icon?: React.ReactNode;\n /**\n * A line under the zone that describes the input through\n * `aria-describedby`, such as \"PDF up to 5 MB\".\n */\n hint?: React.ReactNode;\n /** The largest file it takes, in bytes. A bigger one is refused with `file-too-large`. */\n maxSize?: number;\n /**\n * With `multiple`, how many files the list holds at most. A drop that would\n * go over adds files up to the limit and refuses the rest with\n * `too-many-files`.\n */\n maxFiles?: number;\n /**\n * The chosen files, to control the list. The input and the list follow it,\n * and a change you don't take through `onFilesChange` is undone. Setting it\n * to `[]` clears both.\n */\n files?: File[];\n /** Called with the whole list of chosen files each time it changes. */\n onFilesChange?: (files: File[]) => void;\n /** Called with the files a pick, drop or paste refused, and why. */\n onReject?: (rejections: DropzoneRejection[]) => void;\n /**\n * Shows the chosen files under the zone, each with its size and a remove\n * button. Turn it off to show them your own way from `onFilesChange`. The\n * refusals still show.\n */\n showFileList?: boolean;\n /** Takes files pasted while the input has focus, through the same checks as a drop. */\n allowPaste?: boolean;\n /**\n * While it's on the page, stops the browser opening a file dropped outside\n * any drop target, which would leave the page. Drops on other file inputs\n * and on editable fields are left alone.\n */\n preventDocumentDrop?: boolean;\n /** Names a file's remove button, for localization. Default: `` `Remove ${file.name}` ``. */\n removeLabel?: (file: File) => string;\n /**\n * The text shown and announced for a refused file, for localization.\n * Default: the file's name and the reason, such as \"photo.png: only PDF\n * files\".\n */\n rejectionMessage?: (rejection: DropzoneRejection) => string;\n /**\n * What's announced when files are added, for localization. Default: the\n * file's name and \"added\", or a count (\"2 files added\").\n */\n addedMessage?: (files: File[]) => string;\n /** What's announced when a file is removed, for localization. Default: `` `${file.name} removed` ``. */\n removedMessage?: (file: File) => string;\n /**\n * Help or validation message under the Dropzone. It describes the input\n * through `aria-describedby`, after the hint and any refusals.\n */\n message?: React.ReactNode;\n /** Additional CSS classes for the root. */\n className?: string;\n}\n\n/** A file on its way in, and whether it's really a folder. */\ninterface Incoming {\n file: File;\n folder: boolean;\n}\n\n/** A refusal, with whether the file was a folder, which the default message says. */\ninterface Refusal extends DropzoneRejection {\n folder: boolean;\n}\n\n/** Something the status region says, with an id that's new each time. */\ninterface Announcement {\n id: string;\n text: string;\n}\n\nconst noFiles: File[] = [];\nconst noRefusals: Refusal[] = [];\nconst noAnnouncements: Announcement[] = [];\n\nconst describeAnnouncement = (announcement: Announcement) => announcement.text;\n\n/**\n * The tokens of an `accept` attribute that HTML recognizes, lowercased: an\n * extension (`.pdf`), a wildcard (`image/*`) or a MIME type. Others are\n * ignored, as browsers ignore them.\n */\nconst acceptTokens = (accept: string | undefined): string[] =>\n (accept ?? '')\n .split(',')\n .map(token => token.trim().toLowerCase())\n .filter(\n token => token.length > 1 && (token[0] === '.' || token.includes('/'))\n );\n\n/** Whether `accept`'s tokens take a file with this name and type. */\nconst accepts = (tokens: string[], name: string, type: string): boolean => {\n if (tokens.length === 0) return true;\n const lowerName = name.toLowerCase();\n const lowerType = type.toLowerCase();\n return tokens.some(token =>\n token[0] === '.'\n ? lowerName.endsWith(token)\n : token.endsWith('/*')\n ? lowerType.startsWith(token.slice(0, -1))\n : lowerType === token\n );\n};\n\n/** Whether a drag or a clipboard carries files. */\nconst carriesFiles = (data: DataTransfer | null): data is DataTransfer =>\n !!data && Array.from(data.types ?? []).includes('Files');\n\n/** The files a drop or a paste brings, with folders marked. */\nconst incomingFrom = (data: DataTransfer | null): Incoming[] => {\n if (!data) return [];\n const items = Array.from(data.items ?? []).filter(\n item => item.kind === 'file'\n );\n if (items.length === 0) {\n return Array.from(data.files ?? [], file => ({ file, folder: false }));\n }\n const incoming: Incoming[] = [];\n for (const item of items) {\n const file = item.getAsFile();\n if (!file) continue;\n const entry = item.webkitGetAsEntry?.();\n incoming.push({ file, folder: !!entry?.isDirectory });\n }\n return incoming;\n};\n\n/** The same file: one object, or one picked again with the same details. */\nconst sameFile = (a: File, b: File): boolean =>\n a === b ||\n (a.name === b.name && a.size === b.size && a.lastModified === b.lastModified);\n\n/** Whether two lists hold the same files in the same order. */\nconst sameFiles = (\n a: ArrayLike<File> | null | undefined,\n b: readonly File[]\n): boolean =>\n !!a && a.length === b.length && b.every((file, i) => sameFile(a[i], file));\n\n/**\n * Writes files to a file input, through a `DataTransfer`, the one way script\n * can build a `FileList`. Where there's no `DataTransfer` the input is left as\n * it is.\n */\nconst writeFiles = (input: HTMLInputElement, files: readonly File[]) => {\n if (typeof DataTransfer !== 'function') return;\n const transfer = new DataTransfer();\n for (const file of files) transfer.items.add(file);\n input.files = transfer.files;\n};\n\n/** The units a file size is written in, largest first. */\nconst sizeUnits = [\n ['gigabyte', 1e9, 'GB'],\n ['megabyte', 1e6, 'MB'],\n ['kilobyte', 1e3, 'kB'],\n] as const;\n\n/**\n * A file size for display, in decimal units (\"1.2 MB\"), in the locale of a\n * `LocaleProvider` around it, or as English writes it outside one.\n */\nconst formatFileSize = (\n bytes: number,\n formatNumber: NumberFormatFunction | null\n): string => {\n for (const [unit, factor, symbol] of sizeUnits) {\n if (bytes >= factor) {\n const value = bytes / factor;\n return formatNumber\n ? formatNumber(value, {\n style: 'unit',\n unit,\n unitDisplay: 'short',\n maximumFractionDigits: 1,\n })\n : `${Math.round(value * 10) / 10} ${symbol}`;\n }\n }\n return formatNumber\n ? formatNumber(bytes, { style: 'unit', unit: 'byte', unitDisplay: 'long' })\n : `${bytes} ${bytes === 1 ? 'byte' : 'bytes'}`;\n};\n\n/** A word for each kind of file `accept` names: \"PDF\", \"image\". */\nconst typeNames = (tokens: string[]): string[] => {\n const names: string[] = [];\n for (const token of tokens) {\n let name = token;\n if (token[0] === '.') {\n name = token.slice(1).toUpperCase();\n } else {\n const [type, subtype] = token.split('/');\n const core = subtype.split('+')[0];\n if (subtype === '*') name = type;\n else if (core === 'plain') name = 'text';\n else if (/^[a-z0-9]+$/.test(core)) name = core.toUpperCase();\n }\n if (!names.includes(name)) names.push(name);\n }\n return names;\n};\n\n/** \"A\", \"A or B\", \"A, B, or C\". */\nconst orList = (items: string[]): string =>\n items.length <= 2\n ? items.join(' or ')\n : `${items.slice(0, -1).join(', ')}, or ${items[items.length - 1]}`;\n\n/**\n * The `Dropzone` component is an area to drop files on or click to pick\n * them, which checks each file and lists the chosen ones with a way to remove\n * each.\n *\n * It's Bulma's boxed, full-width file widget with the real\n * `<input type=\"file\">` lying over it, so the input is the one tab stop, the\n * click target and the drop target, and Enter and Space open the picker. The\n * input holds the chosen files: a pick, drop or paste that passes the checks\n * is written to it, so a form submits the files under `name`. It doesn't\n * upload anything.\n *\n * @function\n * @param {DropzoneProps} props - Props for the Dropzone component.\n * @returns {JSX.Element} The rendered dropzone.\n *\n * @example\n * <Dropzone\n * label=\"CV\"\n * name=\"cv\"\n * accept=\".pdf,application/pdf\"\n * maxSize={5_000_000}\n * hint=\"PDF up to 5 MB\"\n * />\n */\nexport const Dropzone = forwardRef<HTMLInputElement, DropzoneProps>(\n (\n {\n // Field props\n label,\n labelSize,\n labelProps,\n horizontal,\n message,\n messageColor,\n fieldClassName,\n color,\n size,\n buttonLabel,\n icon,\n hint,\n maxSize,\n maxFiles,\n files: filesProp,\n onFilesChange,\n onReject,\n showFileList = true,\n allowPaste = true,\n preventDocumentDrop = true,\n removeLabel,\n rejectionMessage,\n addedMessage,\n removedMessage,\n className,\n accept,\n multiple,\n disabled: disabledProp,\n onChange,\n onClick,\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop,\n onPaste,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref\n ) => {\n const disabled = useFieldsetDisabled(disabledProp);\n const controlled = filesProp !== undefined;\n const [ownFiles, setOwnFiles] = useState<File[]>(noFiles);\n const files = filesProp ?? ownFiles;\n // A render the controlled list needs after a change, so that one the app\n // didn't take is undone.\n const [, rerender] = useReducer((n: number) => n + 1, 0);\n const [refusals, setRefusals] = useState<Refusal[]>(noRefusals);\n const [drag, setDrag] = useState<'over' | 'reject' | null>(null);\n const [announcements, setAnnouncements] =\n useState<Announcement[]>(noAnnouncements);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const listRef = useRef<HTMLUListElement>(null);\n // Set while Dropzone dispatches the input's own events, so its change\n // handler hands them on rather than reading them as a pick.\n const dispatchingRef = useRef(false);\n // The row a removal emptied, whose neighbour takes focus.\n const removedRowRef = useRef<number | null>(null);\n const announcedRef = useRef(0);\n // What the input held when it was last clicked (Enter and Space click it\n // too), which a pick adds to: by the time the pick's change arrives, the\n // browser has replaced the input's files with the picked ones.\n const pickBaseRef = useRef<File[] | null>(null);\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) {\n (ref as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n }\n },\n [ref]\n );\n\n const formatNumber = useScopedNumberFormat();\n const tokens = acceptTokens(accept);\n const sizeText = (bytes: number) => formatFileSize(bytes, formatNumber);\n const countText = (count: number) =>\n formatNumber ? formatNumber(count) : String(count);\n\n // The files a pick, drop or paste builds on, and a removal takes one from.\n // Controlled, that's `files`. Uncontrolled, it's the input itself rather\n // than the list: a script can rewrite the input through the ref, emptying\n // it with `value = ''` or setting its `files`, and no event reports that,\n // so the list catches up only at the next change. Where there's no\n // DataTransfer to write the input with, the list is all there is.\n const current = (): File[] =>\n controlled || typeof DataTransfer !== 'function'\n ? files\n : Array.from((inputRef.current as HTMLInputElement).files as FileList);\n\n const messageFor = (refusal: Refusal): string => {\n const { file, code } = refusal;\n if (rejectionMessage) return rejectionMessage({ file, code });\n if (code === 'file-too-large') {\n return `${file.name}: larger than ${sizeText(maxSize as number)}`;\n }\n if (code === 'too-many-files') {\n const most = multiple ? (maxFiles as number) : 1;\n return `${file.name}: only ${most === 1 ? 'one file' : `${countText(most)} files`}`;\n }\n return refusal.folder\n ? `${file.name}: folders can't be added`\n : `${file.name}: only ${orList(typeNames(tokens))} files`;\n };\n\n const announce = (texts: string[]) => {\n if (texts.length === 0) return;\n const batch = ++announcedRef.current;\n setAnnouncements(texts.map((text, i) => ({ id: `${batch}-${i}`, text })));\n };\n\n /**\n * Makes `next` the chosen files: writes them to the input, and when they\n * differ from the list, dispatches the input's `input` and `change` and\n * reports the new list.\n */\n const commit = (next: File[]) => {\n pickBaseRef.current = null;\n const input = inputRef.current as HTMLInputElement;\n if (!sameFiles(input.files, next)) writeFiles(input, next);\n if (sameFiles(files, next)) return;\n if (controlled) rerender();\n else setOwnFiles(next);\n onFilesChange?.(next);\n dispatchingRef.current = true;\n try {\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n } finally {\n dispatchingRef.current = false;\n }\n };\n\n /** Checks the files a pick, drop or paste brings, and takes those that pass. */\n const take = (incoming: Incoming[], base: File[] = current()) => {\n const kept = multiple ? base : noFiles;\n const room = multiple ? (maxFiles ?? Infinity) - kept.length : 1;\n const added: File[] = [];\n const refused: Refusal[] = [];\n for (const { file, folder } of incoming) {\n const code: DropzoneRejectionCode | null =\n folder || !accepts(tokens, file.name, file.type)\n ? 'file-invalid-type'\n : maxSize !== undefined && file.size > maxSize\n ? 'file-too-large'\n : null;\n if (code) {\n refused.push({ file, code, folder });\n } else if (\n multiple &&\n [...kept, ...added].some(f => sameFile(f, file))\n ) {\n // Already in the list: nothing to add, and nothing wrong.\n } else if (added.length >= room) {\n refused.push({ file, code: 'too-many-files', folder });\n } else {\n added.push(file);\n }\n }\n setRefusals(refused.length > 0 ? refused : noRefusals);\n if (refused.length > 0) {\n onReject?.(refused.map(({ file, code }) => ({ file, code })));\n }\n commit(added.length > 0 ? [...kept, ...added] : base);\n const addedText =\n added.length === 0\n ? []\n : [\n addedMessage\n ? addedMessage(added)\n : added.length === 1\n ? `${added[0].name} added`\n : `${countText(added.length)} files added`,\n ];\n announce([...addedText, ...refused.map(messageFor)]);\n };\n\n const remove = (index: number) => {\n const file = files[index];\n removedRowRef.current = index;\n commit(current().filter(held => !sameFile(held, file)));\n announce([\n removedMessage ? removedMessage(file) : `${file.name} removed`,\n ]);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (dispatchingRef.current) {\n onChange?.(event);\n return;\n }\n // A pick: the browser has put the picked files in the input. They're\n // added to what it held when it was clicked, or, for a picker opened\n // with showPicker(), which clicks nothing, to the list. With none (a\n // cancelled pick, in a browser that clears it), that stays.\n const base = pickBaseRef.current ?? files;\n const picked = Array.from(event.target.files ?? []);\n if (picked.length === 0) commit(base);\n else\n take(\n picked.map(file => ({ file, folder: false })),\n base\n );\n };\n\n const handleClick = (event: React.MouseEvent<HTMLInputElement>) => {\n onClick?.(event);\n pickBaseRef.current = current();\n };\n\n // While files are dragged over the input it's cancelled, which makes the\n // input the drop target and keeps the browser's own drop from running.\n // Disabled, it refuses the drop, so the browser doesn't open the file.\n const handleDragOver = (event: React.DragEvent<HTMLInputElement>) => {\n (event.type === 'dragenter' ? onDragEnter : onDragOver)?.(event);\n if (!carriesFiles(event.dataTransfer)) return;\n event.preventDefault();\n if (disabled) {\n event.dataTransfer.dropEffect = 'none';\n return;\n }\n event.dataTransfer.dropEffect = 'copy';\n // Only the dragged files' types can be read, so a file is known to be\n // refused only when `accept` names no extension and its type is known.\n const room = multiple ? (maxFiles ?? Infinity) - current().length : 1;\n const types = Array.from(event.dataTransfer.items ?? [])\n .filter(item => item.kind === 'file')\n .map(item => item.type);\n const refused =\n room <= 0 ||\n (types.length > 0 &&\n tokens.length > 0 &&\n !tokens.some(token => token[0] === '.') &&\n types.every(type => type !== '' && !accepts(tokens, '', type)));\n setDrag(refused ? 'reject' : 'over');\n };\n\n const handleDragLeave = (event: React.DragEvent<HTMLInputElement>) => {\n onDragLeave?.(event);\n setDrag(null);\n };\n\n const handleDrop = (event: React.DragEvent<HTMLInputElement>) => {\n onDrop?.(event);\n setDrag(null);\n if (!carriesFiles(event.dataTransfer)) return;\n event.preventDefault();\n if (!disabled) take(incomingFrom(event.dataTransfer));\n };\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n onPaste?.(event);\n if (!allowPaste || disabled) return;\n const incoming = incomingFrom(event.clipboardData);\n if (incoming.length === 0) return;\n event.preventDefault();\n take(incoming);\n };\n\n // A controlled list: the input follows `files`, and a change the app\n // didn't take is undone.\n useEffect(() => {\n const input = inputRef.current;\n if (controlled && input && !sameFiles(input.files, files)) {\n writeFiles(input, files);\n }\n });\n\n // After a removal, focus goes to the remove button that took the removed\n // one's place, else the one before, else the input.\n useEffect(() => {\n const row = removedRowRef.current;\n if (row === null) return;\n removedRowRef.current = null;\n const buttons = listRef.current?.querySelectorAll('button') ?? [];\n const next = buttons[Math.min(row, buttons.length - 1)];\n (next ?? inputRef.current)?.focus();\n });\n\n // A reset of the input's form empties the input, so the list and the\n // refusals go too. The reset event fires before the form resets, and a\n // listener after this one can still cancel it, so the list is cleared a\n // task later, and only if the reset went ahead.\n const latestRef = useRef({ files, controlled, onFilesChange });\n useEffect(() => {\n latestRef.current = { files, controlled, onFilesChange };\n });\n const formAttribute = props.form;\n useEffect(() => {\n const form = inputRef.current?.form;\n if (!form) return undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const onReset = (event: Event) => {\n timer = setTimeout(() => {\n if (event.defaultPrevented) return;\n const latest = latestRef.current;\n pickBaseRef.current = null;\n setRefusals(noRefusals);\n if (latest.files.length === 0) return;\n if (latest.controlled) rerender();\n else setOwnFiles(noFiles);\n latest.onFilesChange?.(noFiles);\n });\n };\n form.addEventListener('reset', onReset);\n return () => {\n form.removeEventListener('reset', onReset);\n clearTimeout(timer);\n };\n }, [formAttribute]);\n\n // A file dropped just outside the zone would open in the tab. The guard\n // cancels a file drag anywhere nothing else takes it, leaving alone\n // enabled file inputs and editable fields, which take drops of their own,\n // and drops something else already handled. It reads the event's real\n // target, so a file input inside a shadow root is left alone too.\n useEffect(() => {\n if (!preventDocumentDrop) return undefined;\n const guard = (event: DragEvent) => {\n if (event.defaultPrevented || !carriesFiles(event.dataTransfer)) {\n return;\n }\n const target = event.composedPath()[0];\n if (\n target instanceof Element &&\n target.closest(\n 'input[type=\"file\"]:not(:disabled), textarea, [contenteditable]:not([contenteditable=\"false\"])'\n )\n ) {\n return;\n }\n event.preventDefault();\n if (event.type === 'dragover') event.dataTransfer.dropEffect = 'none';\n };\n document.addEventListener('dragover', guard);\n document.addEventListener('drop', guard);\n return () => {\n document.removeEventListener('dragover', guard);\n document.removeEventListener('drop', guard);\n };\n }, [preventDocumentDrop]);\n\n const warnsMaxFiles = maxFiles !== undefined && !multiple;\n useEffect(() => {\n if (warnsMaxFiles) {\n warnOnce(\n 'Dropzone:maxFiles-without-multiple',\n '[bestax-bulma] <Dropzone maxFiles> takes effect only with ' +\n 'multiple. Without it, each new file replaces the one chosen.'\n );\n }\n }, [warnsMaxFiles]);\n\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('Dropzone', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n const { controlId, fieldLabelProps } = useAutoLabelId({\n label,\n id: props.id,\n labelProps,\n rendersLabel: ownField,\n });\n const { classPrefix } = useConfig();\n const pcn = (...args: Parameters<typeof classNames>) =>\n prefixedClassNames(classPrefix, ...args);\n // The input takes `controlId`, so `id` stays out of the spread, where an\n // undefined `id` key would wipe the id the label points at.\n const { id: _id, ...inputProps } = props;\n const { bulmaHelperClasses, rest } = useBulmaClasses(inputProps);\n\n const baseId = useId();\n const hintId = `${baseId}-hint`;\n const refusalsId = `${baseId}-refusals`;\n const messageId = `${baseId}-message`;\n const describedBy =\n [\n ariaDescribedBy,\n hint ? hintId : undefined,\n refusals.length > 0 ? refusalsId : undefined,\n message ? messageId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const rootClass = usePrefixedClassNames('dropzone', {\n 'is-dragover': drag === 'over',\n 'is-drag-reject': drag === 'reject',\n 'is-disabled': disabled,\n });\n const zoneClass = usePrefixedClassNames(\n 'file',\n 'is-boxed',\n 'is-fullwidth',\n {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n }\n );\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // Each row's key, from the file's details, which the list keeps unique.\n const seen = new Map<string, number>();\n const keyOf = (file: File) => {\n const key = `${file.name}:${file.size}:${file.lastModified}`;\n const count = seen.get(key) ?? 0;\n seen.set(key, count + 1);\n return count === 0 ? key : `${key}:${count}`;\n };\n\n const dropzoneElement = (\n <div className={classNames(rootClass, bulmaHelperClasses, className)}>\n <div className={zoneClass}>\n <label className={pcn('file-label')}>\n <input\n {...rest}\n ref={setInputRef}\n className={pcn('file-input')}\n type=\"file\"\n id={controlId}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n aria-describedby={describedBy}\n onChange={handleChange}\n onClick={handleClick}\n onDragEnter={handleDragOver}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onPaste={handlePaste}\n />\n <span className={pcn('file-cta')}>\n {icon && <span className={pcn('file-icon')}>{icon}</span>}\n <span className={pcn('file-label')}>\n {buttonLabel ||\n (multiple ? 'Choose or drop files' : 'Choose or drop a file')}\n </span>\n </span>\n </label>\n </div>\n {hint && (\n <p id={hintId} className={pcn('help', 'dropzone-hint')}>\n {hint}\n </p>\n )}\n {showFileList && files.length > 0 && (\n <ul ref={listRef} className={pcn('dropzone-list')}>\n {files.map((file, index) => (\n <li key={keyOf(file)} className={pcn('dropzone-item')}>\n <span className={pcn('dropzone-name')}>{file.name}</span>\n <span className={pcn('dropzone-size')}>\n {sizeText(file.size)}\n </span>\n {!disabled && (\n <Delete\n size=\"small\"\n ariaLabel={\n removeLabel ? removeLabel(file) : `Remove ${file.name}`\n }\n onClick={() => remove(index)}\n />\n )}\n </li>\n ))}\n </ul>\n )}\n {refusals.length > 0 && (\n <div id={refusalsId} className={pcn('dropzone-rejections')}>\n {refusals.map((refusal, index) => (\n <p key={index} className={pcn('help', 'is-danger')}>\n {messageFor(refusal)}\n </p>\n ))}\n </div>\n )}\n <StatusRegion items={announcements} describe={describeAnnouncement} />\n </div>\n );\n\n const messageEl = message ? (\n <p id={messageId} className={helpClass}>\n {message}\n </p>\n ) : null;\n\n if (ownField) {\n return (\n <Field\n label={label}\n labelSize={labelSize}\n labelProps={fieldLabelProps}\n horizontal={horizontal}\n className={fieldClassName}\n >\n {dropzoneElement}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {dropzoneElement}\n {messageEl}\n </>\n );\n }\n);\n\nDropzone.displayName = 'Dropzone';\n\nexport default Dropzone;\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;AAmLA,MAAM,OAAO,GAAW,EAAE;AAC1B,MAAM,UAAU,GAAc,EAAE;AAChC,MAAM,eAAe,GAAmB,EAAE;AAE1C,MAAM,oBAAoB,GAAG,CAAC,YAA0B,KAAK,YAAY,CAAC,IAAI;AAE9E;;;;AAIG;AACH,MAAM,YAAY,GAAG,CAAC,MAA0B,KAC9C,CAAC,MAAM,IAAI,EAAE;KACV,KAAK,CAAC,GAAG;AACT,KAAA,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE;KACvC,MAAM,CACL,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CACvE;AAEL;AACA,MAAM,OAAO,GAAG,CAAC,MAAgB,EAAE,IAAY,EAAE,IAAY,KAAa;AACxE,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AACpC,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE;AACpC,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE;AACpC,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,IACtB,KAAK,CAAC,CAAC,CAAC,KAAK;AACX,UAAE,SAAS,CAAC,QAAQ,CAAC,KAAK;AAC1B,UAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;AACnB,cAAE,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AACzC,cAAE,SAAS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AE,SAAS,EAAE,SAAS,EAAA,QAAA,EACnC,OAAO,EAAA,CACN,IACF,IAAI;IAER,IAAI,QAAQ,EAAE;AACZ,QAAA,QACED,IAAA,CAAC,KAAK,EAAA,EACJ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,cAAc,EAAA,QAAA,EAAA,CAExB,eAAe,EACf,SAAS,CAAA,EAAA,CACJ;IAEZ;AAEA,IAAA,QACEA,IAAA,CAAAE,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,eAAe,EACf,SAAS,CAAA,EAAA,CACT;AAEP,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
@@ -5,7 +5,7 @@ import { forwardRef, useState, useEffect } from 'react';
5
5
  import { prefixedClassNames, usePrefixedClassNames, classNames } from '../helpers/classNames.js';
6
6
  import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
7
7
  import { useConfig } from '../helpers/Config.js';
8
- import { useNumberFormat } from '../helpers/localeFormat.js';
8
+ import { useScopedNumberFormat } from '../helpers/localeFormat.js';
9
9
  import { useInsideField, useInsideControl, rendersOwnField } from './FormContext.js';
10
10
  import { Field } from './Field.js';
11
11
  import { useAutoLabelId } from './useAutoLabelId.js';
@@ -49,7 +49,7 @@ label, labelSize, labelProps, horizontal, message, messageColor, fieldClassName,
49
49
  : undefined);
50
50
  onChange?.(event);
51
51
  };
52
- const formatNumber = useNumberFormat();
52
+ const formatNumber = useScopedNumberFormat();
53
53
  const pickedText = picked &&
54
54
  (picked.count === 1
55
55
  ? picked.firstName