@salt-ds/core 1.15.0 → 1.16.1

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 (77) hide show
  1. package/css/salt-core.css +43 -11
  2. package/dist-cjs/accordion/AccordionHeader.css.js +1 -1
  3. package/dist-cjs/card/Card.css.js +1 -1
  4. package/dist-cjs/checkbox/Checkbox.js +9 -1
  5. package/dist-cjs/checkbox/Checkbox.js.map +1 -1
  6. package/dist-cjs/file-drop-zone/FileDropZone.css.js +6 -0
  7. package/dist-cjs/file-drop-zone/FileDropZone.css.js.map +1 -0
  8. package/dist-cjs/file-drop-zone/FileDropZone.js +99 -0
  9. package/dist-cjs/file-drop-zone/FileDropZone.js.map +1 -0
  10. package/dist-cjs/file-drop-zone/FileDropZoneIcon.js +25 -0
  11. package/dist-cjs/file-drop-zone/FileDropZoneIcon.js.map +1 -0
  12. package/dist-cjs/file-drop-zone/FileDropZoneTrigger.js +58 -0
  13. package/dist-cjs/file-drop-zone/FileDropZoneTrigger.js.map +1 -0
  14. package/dist-cjs/file-drop-zone/internal/utils.js +30 -0
  15. package/dist-cjs/file-drop-zone/internal/utils.js.map +1 -0
  16. package/dist-cjs/index.js +6 -0
  17. package/dist-cjs/index.js.map +1 -1
  18. package/dist-cjs/link/Link.js +1 -1
  19. package/dist-cjs/link/Link.js.map +1 -1
  20. package/dist-cjs/panel/Panel.css.js +1 -1
  21. package/dist-cjs/radio-button/RadioButton.js.map +1 -1
  22. package/dist-cjs/radio-button/RadioButtonGroup.js +2 -0
  23. package/dist-cjs/radio-button/RadioButtonGroup.js.map +1 -1
  24. package/dist-cjs/switch/Switch.js +1 -0
  25. package/dist-cjs/switch/Switch.js.map +1 -1
  26. package/dist-cjs/toggle-button/ToggleButton.css.js +1 -1
  27. package/dist-cjs/toggle-button/ToggleButton.js +3 -2
  28. package/dist-cjs/toggle-button/ToggleButton.js.map +1 -1
  29. package/dist-cjs/tooltip/Tooltip.js +2 -1
  30. package/dist-cjs/tooltip/Tooltip.js.map +1 -1
  31. package/dist-cjs/tooltip/useTooltip.js +3 -12
  32. package/dist-cjs/tooltip/useTooltip.js.map +1 -1
  33. package/dist-cjs/utils/useFloatingUI/useFloatingUI.js +17 -2
  34. package/dist-cjs/utils/useFloatingUI/useFloatingUI.js.map +1 -1
  35. package/dist-es/accordion/AccordionHeader.css.js +1 -1
  36. package/dist-es/card/Card.css.js +1 -1
  37. package/dist-es/checkbox/Checkbox.js +10 -2
  38. package/dist-es/checkbox/Checkbox.js.map +1 -1
  39. package/dist-es/file-drop-zone/FileDropZone.css.js +4 -0
  40. package/dist-es/file-drop-zone/FileDropZone.css.js.map +1 -0
  41. package/dist-es/file-drop-zone/FileDropZone.js +95 -0
  42. package/dist-es/file-drop-zone/FileDropZone.js.map +1 -0
  43. package/dist-es/file-drop-zone/FileDropZoneIcon.js +21 -0
  44. package/dist-es/file-drop-zone/FileDropZoneIcon.js.map +1 -0
  45. package/dist-es/file-drop-zone/FileDropZoneTrigger.js +54 -0
  46. package/dist-es/file-drop-zone/FileDropZoneTrigger.js.map +1 -0
  47. package/dist-es/file-drop-zone/internal/utils.js +25 -0
  48. package/dist-es/file-drop-zone/internal/utils.js.map +1 -0
  49. package/dist-es/index.js +3 -0
  50. package/dist-es/index.js.map +1 -1
  51. package/dist-es/link/Link.js +1 -1
  52. package/dist-es/link/Link.js.map +1 -1
  53. package/dist-es/panel/Panel.css.js +1 -1
  54. package/dist-es/radio-button/RadioButton.js.map +1 -1
  55. package/dist-es/radio-button/RadioButtonGroup.js +2 -0
  56. package/dist-es/radio-button/RadioButtonGroup.js.map +1 -1
  57. package/dist-es/switch/Switch.js +1 -0
  58. package/dist-es/switch/Switch.js.map +1 -1
  59. package/dist-es/toggle-button/ToggleButton.css.js +1 -1
  60. package/dist-es/toggle-button/ToggleButton.js +3 -2
  61. package/dist-es/toggle-button/ToggleButton.js.map +1 -1
  62. package/dist-es/tooltip/Tooltip.js +2 -1
  63. package/dist-es/tooltip/Tooltip.js.map +1 -1
  64. package/dist-es/tooltip/useTooltip.js +3 -12
  65. package/dist-es/tooltip/useTooltip.js.map +1 -1
  66. package/dist-es/utils/useFloatingUI/useFloatingUI.js +18 -3
  67. package/dist-es/utils/useFloatingUI/useFloatingUI.js.map +1 -1
  68. package/dist-types/checkbox/Checkbox.d.ts +1 -3
  69. package/dist-types/file-drop-zone/FileDropZone.d.ts +17 -0
  70. package/dist-types/file-drop-zone/FileDropZoneIcon.d.ts +9 -0
  71. package/dist-types/file-drop-zone/FileDropZoneTrigger.d.ts +22 -0
  72. package/dist-types/file-drop-zone/index.d.ts +3 -0
  73. package/dist-types/file-drop-zone/internal/utils.d.ts +3 -0
  74. package/dist-types/index.d.ts +1 -0
  75. package/dist-types/radio-button/RadioButton.d.ts +1 -0
  76. package/dist-types/utils/useFloatingUI/useFloatingUI.d.ts +6 -2
  77. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useFloatingUI.js","sources":["../src/utils/useFloatingUI/useFloatingUI.tsx"],"sourcesContent":["import {\n Middleware,\n Placement,\n Platform,\n Strategy,\n autoUpdate,\n flip,\n limitShift,\n platform,\n shift,\n useFloating,\n FloatingPortal,\n} from \"@floating-ui/react\";\n\nimport {\n createContext,\n ReactNode,\n useContext,\n useMemo,\n forwardRef,\n ComponentPropsWithoutRef,\n} from \"react\";\n\nimport { SaltProvider } from \"../../salt-provider\";\n\nexport interface FloatingComponentProps\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Whether the floating component is open (used for determinig whether to show the component)\n * We pass this as a prop rather than not rendering the component to allow more advanced use-cases e.g.\n * for caching windows and reusing them, rather than always spawning a new one\n */\n open: boolean;\n /**\n * Position props for the floating component\n */\n top: number;\n left: number;\n width?: number;\n height?: number;\n position: Strategy;\n}\n\nconst DefaultFloatingComponent = forwardRef<\n HTMLDivElement,\n FloatingComponentProps\n>(function DefaultFloatingComponent(props, ref) {\n const {\n open,\n top,\n left,\n position,\n /* eslint-disable @typescript-eslint/no-unused-vars */\n width,\n height,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...rest\n } = props;\n const style = {\n top,\n left,\n position,\n };\n return open ? (\n <FloatingPortal>\n <SaltProvider>\n <div style={style} {...rest} ref={ref} />\n </SaltProvider>\n </FloatingPortal>\n ) : null;\n});\n\nexport interface FloatingComponentContextType {\n Component: typeof DefaultFloatingComponent;\n}\n\nconst FloatingComponentContext = createContext<FloatingComponentContextType>({\n Component: DefaultFloatingComponent,\n});\n\nif (process.env.NODE_ENV !== \"production\") {\n FloatingComponentContext.displayName = \"FloatingComponentContext\";\n}\n\nexport interface FloatingComponentProviderProps\n extends FloatingComponentContextType {\n children: ReactNode;\n}\n\nexport function FloatingComponentProvider(\n props: FloatingComponentProviderProps\n) {\n const { Component, children } = props;\n const value = useMemo(() => ({ Component }), [Component]);\n\n return (\n <FloatingComponentContext.Provider value={value}>\n {children}\n </FloatingComponentContext.Provider>\n );\n}\n\nexport function useFloatingComponent() {\n return useContext(FloatingComponentContext);\n}\n\nexport interface UseFloatingUIProps {\n /**\n * Sets position relative to trigger.\n */\n placement?: Placement;\n strategy?: Strategy;\n /**\n * Function to update the default middleware used to extend or replace it\n */\n middleware?: Middleware[];\n /**\n * Sets visible state.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n}\n\ntype GetMiddleware = (middleware: Middleware[]) => Middleware[];\n\nconst defaultGetMiddleware: GetMiddleware = (defaultMiddleware) =>\n defaultMiddleware;\n\ninterface FloatingPlatformContextType {\n platform: Platform;\n middleware: GetMiddleware;\n animationFrame: boolean;\n}\n\nconst defaultFloatingPlaform: FloatingPlatformContextType = {\n platform,\n middleware: defaultGetMiddleware,\n animationFrame: false,\n};\n\nconst FloatingPlatformContext = createContext<FloatingPlatformContextType>(\n defaultFloatingPlaform\n);\n\nexport interface FloatingPlatformProviderProps {\n platform?: Platform;\n middleware?: GetMiddleware;\n children: ReactNode;\n animationFrame?: boolean;\n}\n\nexport function FloatingPlatformProvider(props: FloatingPlatformProviderProps) {\n const {\n platform: platformProp,\n middleware,\n animationFrame,\n children,\n } = props;\n\n const floatingPlatformContextValue = useMemo<FloatingPlatformContextType>(\n () => ({\n platform: platformProp ?? platform,\n middleware: middleware ?? defaultGetMiddleware,\n animationFrame: animationFrame || false,\n }),\n [platformProp, middleware, animationFrame]\n );\n\n return (\n <FloatingPlatformContext.Provider value={floatingPlatformContextValue}>\n {children}\n </FloatingPlatformContext.Provider>\n );\n}\n\nexport function useFloatingPlatform() {\n return useContext(FloatingPlatformContext);\n}\n\nexport const DEFAULT_FLOATING_UI_MIDDLEWARE = [\n flip(),\n shift({ limiter: limitShift() }),\n];\n\ntype UseFloatingRefs = ReturnType<typeof useFloating>[\"refs\"];\n\nexport interface UseFloatingUIReturn extends ReturnType<typeof useFloating> {\n reference: UseFloatingRefs[\"setReference\"];\n floating: UseFloatingRefs[\"setFloating\"];\n}\n\nexport function useFloatingUI(props: UseFloatingUIProps): UseFloatingUIReturn {\n const {\n placement,\n strategy,\n middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,\n open = false,\n onOpenChange,\n } = props;\n\n const handleOpenChange = (open: boolean) => {\n update();\n onOpenChange?.(open);\n };\n\n const {\n platform: contextPlaform,\n middleware: contextMiddleware,\n animationFrame,\n } = useFloatingPlatform();\n\n const { refs, update, ...rest } = useFloating({\n placement,\n strategy,\n middleware: contextMiddleware(middleware),\n open,\n onOpenChange: handleOpenChange,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, { animationFrame });\n\n return cleanup;\n },\n platform: contextPlaform,\n });\n\n return {\n reference: refs.setReference,\n floating: refs.setFloating,\n refs,\n update,\n ...rest,\n };\n}\n"],"names":["DefaultFloatingComponent","open"],"mappings":";;;;;AA2CA,MAAM,wBAA2B,GAAA,UAAA,CAG/B,SAASA,yBAAAA,CAAyB,OAAO,GAAK,EAAA;AAC9C,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IAC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,IAAO,MAAA,EAAA,CAAA;AACP,IAAeA,YAAAA,IAAAA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,YAAAA,CAAAA,KAAAA,CAAAA,CAAAA;AAAA,GACjB,CAAA;AAEA,EAAM,MAAA;AAAA,IACJ,QAAU,EAAA,cAAA;AAAA,IACV,UAAY,EAAA,iBAAA;AAAA,IACZ,cAAA;AAAA,MACE,mBAAoB,EAAA,CAAA;AAExB,EAAA,MAAM,EAAE,IAAA,EAAM,MAAW,EAAA,GAAA,IAAA,KAAS,WAAY,CAAA;AAAA,IAC5C,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA,EAAY,kBAAkB,UAAU,CAAA;AAAA,IACxC,IAAA;AAAA,IACA,YAAc,EAAA,gBAAA;AAAA,IACd,oBAAA,EAAsB,IAAI,IAAS,KAAA;AACjC,MAAA,MAAM,UAAU,UAAW,CAAA,GAAG,IAAM,EAAA,EAAE,gBAAgB,CAAA,CAAA;AAEtD,MAAO,OAAA,OAAA,CAAA;AAAA,KACT;AAAA,IACA,QAAU,EAAA,cAAA;AAAA,GACX,CAAA,CAAA;AAED,EAAO,OAAA;AAAA,IACL,WAAW,IAAK,CAAA,YAAA;AAAA,IAChB,UAAU,IAAK,CAAA,WAAA;AAAA,IACf,IAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAG,IAAA;AAAA,GACL,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"useFloatingUI.js","sources":["../src/utils/useFloatingUI/useFloatingUI.tsx"],"sourcesContent":["import {\n Middleware,\n Placement,\n Platform,\n Strategy,\n autoUpdate,\n flip,\n limitShift,\n platform,\n shift,\n useFloating,\n FloatingPortal,\n FloatingFocusManager,\n FloatingFocusManagerProps,\n} from \"@floating-ui/react\";\n\nimport {\n createContext,\n ReactNode,\n useContext,\n useMemo,\n forwardRef,\n ComponentPropsWithoutRef,\n} from \"react\";\n\nimport { SaltProvider } from \"../../salt-provider\";\n\nexport interface FloatingComponentProps\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Whether the floating component is open (used for determining whether to show the component)\n * We pass this as a prop rather than not rendering the component to allow more advanced use-cases e.g.\n * for caching windows and reusing them, rather than always spawning a new one\n */\n open: boolean;\n /**\n * Use this prop when `FloatingFocusManager` is needed for floating component\n */\n focusManagerProps?: Omit<FloatingFocusManagerProps, \"children\">;\n /**\n * Position props for the floating component\n */\n top: number;\n left: number;\n width?: number;\n height?: number;\n position: Strategy;\n}\n\nconst DefaultFloatingComponent = forwardRef<\n HTMLDivElement,\n FloatingComponentProps\n>(function DefaultFloatingComponent(props, ref) {\n const {\n open,\n top,\n left,\n position,\n /* eslint-disable @typescript-eslint/no-unused-vars */\n width,\n height,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n focusManagerProps,\n ...rest\n } = props;\n const style = {\n top,\n left,\n position,\n };\n\n if (focusManagerProps) {\n return (\n <FloatingPortal>\n <SaltProvider>\n <FloatingFocusManager {...focusManagerProps}>\n <div style={style} {...rest} ref={ref} />\n </FloatingFocusManager>\n </SaltProvider>\n </FloatingPortal>\n );\n }\n\n return open ? (\n <FloatingPortal>\n <SaltProvider>\n <div style={style} {...rest} ref={ref} />\n </SaltProvider>\n </FloatingPortal>\n ) : null;\n});\n\nexport interface FloatingComponentContextType {\n Component: typeof DefaultFloatingComponent;\n}\n\nconst FloatingComponentContext = createContext<FloatingComponentContextType>({\n Component: DefaultFloatingComponent,\n});\n\nif (process.env.NODE_ENV !== \"production\") {\n FloatingComponentContext.displayName = \"FloatingComponentContext\";\n}\n\nexport interface FloatingComponentProviderProps\n extends FloatingComponentContextType {\n children: ReactNode;\n}\n\nexport function FloatingComponentProvider(\n props: FloatingComponentProviderProps\n) {\n const { Component, children } = props;\n const value = useMemo(() => ({ Component }), [Component]);\n\n return (\n <FloatingComponentContext.Provider value={value}>\n {children}\n </FloatingComponentContext.Provider>\n );\n}\n\nexport function useFloatingComponent() {\n return useContext(FloatingComponentContext);\n}\n\nexport interface UseFloatingUIProps {\n /**\n * Sets position relative to trigger.\n */\n placement?: Placement;\n strategy?: Strategy;\n /**\n * Function to update the default middleware used to extend or replace it\n */\n middleware?: Middleware[];\n /**\n * Sets visible state.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n}\n\ntype GetMiddleware = (middleware: Middleware[]) => Middleware[];\n\nconst defaultGetMiddleware: GetMiddleware = (defaultMiddleware) =>\n defaultMiddleware;\n\ninterface FloatingPlatformContextType {\n platform: Platform;\n middleware: GetMiddleware;\n animationFrame: boolean;\n}\n\nconst defaultFloatingPlaform: FloatingPlatformContextType = {\n platform,\n middleware: defaultGetMiddleware,\n animationFrame: false,\n};\n\nconst FloatingPlatformContext = createContext<FloatingPlatformContextType>(\n defaultFloatingPlaform\n);\n\nexport interface FloatingPlatformProviderProps {\n platform?: Platform;\n middleware?: GetMiddleware;\n children: ReactNode;\n animationFrame?: boolean;\n}\n\nexport function FloatingPlatformProvider(props: FloatingPlatformProviderProps) {\n const {\n platform: platformProp,\n middleware,\n animationFrame,\n children,\n } = props;\n\n const floatingPlatformContextValue = useMemo<FloatingPlatformContextType>(\n () => ({\n platform: platformProp ?? platform,\n middleware: middleware ?? defaultGetMiddleware,\n animationFrame: animationFrame || false,\n }),\n [platformProp, middleware, animationFrame]\n );\n\n return (\n <FloatingPlatformContext.Provider value={floatingPlatformContextValue}>\n {children}\n </FloatingPlatformContext.Provider>\n );\n}\n\nexport function useFloatingPlatform() {\n return useContext(FloatingPlatformContext);\n}\n\nexport const DEFAULT_FLOATING_UI_MIDDLEWARE = [\n flip(),\n shift({ limiter: limitShift() }),\n];\n\ntype UseFloatingRefs = ReturnType<typeof useFloating>[\"refs\"];\n\nexport interface UseFloatingUIReturn extends ReturnType<typeof useFloating> {\n reference: UseFloatingRefs[\"setReference\"];\n floating: UseFloatingRefs[\"setFloating\"];\n}\n\nexport function useFloatingUI(props: UseFloatingUIProps): UseFloatingUIReturn {\n const {\n placement,\n strategy,\n middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,\n open = false,\n onOpenChange,\n } = props;\n\n const handleOpenChange = (open: boolean) => {\n update();\n onOpenChange?.(open);\n };\n\n const {\n platform: contextPlatform,\n middleware: contextMiddleware,\n animationFrame,\n } = useFloatingPlatform();\n\n const { refs, update, ...rest } = useFloating({\n placement,\n strategy,\n middleware: contextMiddleware(middleware),\n open,\n onOpenChange: handleOpenChange,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, { animationFrame });\n\n return cleanup;\n },\n platform: contextPlatform,\n });\n\n return {\n reference: refs.setReference,\n floating: refs.setFloating,\n refs,\n update,\n ...rest,\n };\n}\n"],"names":["DefaultFloatingComponent","open"],"mappings":";;;;;AAiDA,MAAM,wBAA2B,GAAA,UAAA,CAG/B,SAASA,yBAAAA,CAAyB,OAAO,GAAK,EAAA;AAC9C,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,GAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IAEA,KAAA;AAAA,IACA,MAAA;AAAA,IAEA,iBAAA;AAAA,IACG,GAAA,IAAA;AAAA,GACD,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,KAAQ,GAAA;AAAA,IACZ,GAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,GACF,CAAA;AAEA,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAA,uBACG,GAAA,CAAA,cAAA,EAAA;AAAA,MACC,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA;AAAA,QACC,QAAC,kBAAA,GAAA,CAAA,oBAAA,EAAA;AAAA,UAAsB,GAAG,iBAAA;AAAA,UACxB,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA;AAAA,YAAI,KAAA;AAAA,YAAe,GAAG,IAAA;AAAA,YAAM,GAAA;AAAA,WAAU,CAAA;AAAA,SACzC,CAAA;AAAA,OACF,CAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,OAAO,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E,mBAAoB,EAAA,CAAA;AAExB,EAAA,MAAM,EAAE,IAAA,EAAM,MAAW,EAAA,GAAA,IAAA,KAAS,WAAY,CAAA;AAAA,IAC5C,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA,EAAY,kBAAkB,UAAU,CAAA;AAAA,IACxC,IAAA;AAAA,IACA,YAAc,EAAA,gBAAA;AAAA,IACd,oBAAA,EAAsB,IAAI,IAAS,KAAA;AACjC,MAAA,MAAM,UAAU,UAAW,CAAA,GAAG,IAAM,EAAA,EAAE,gBAAgB,CAAA,CAAA;AAEtD,MAAO,OAAA,OAAA,CAAA;AAAA,KACT;AAAA,IACA,QAAU,EAAA,eAAA;AAAA,GACX,CAAA,CAAA;AAED,EAAO,OAAA;AAAA,IACL,WAAW,IAAK,CAAA,YAAA;AAAA,IAChB,UAAU,IAAK,CAAA,WAAA;AAAA,IACf,IAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAG,IAAA;AAAA,GACL,CAAA;AACF;;;;"}
@@ -20,9 +20,7 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLLabelElement
20
20
  */
21
21
  error?: boolean;
22
22
  /**
23
- * If true, the checkbox appears indeterminate. This does not set the native
24
- * input element to indeterminate due to the inconsistent behaviour across browsers
25
- * However, a data-indeterminate attribute is set on the input.
23
+ * If true, the checkbox appears indeterminate. A data-indeterminate attribute is set on the input.
26
24
  */
27
25
  indeterminate?: boolean;
28
26
  /**
@@ -0,0 +1,17 @@
1
+ import { DragEvent, ComponentPropsWithoutRef } from "react";
2
+ import { ValidationStatus } from "../status-indicator";
3
+ export interface FileDropZoneProps extends Omit<ComponentPropsWithoutRef<"div">, "onDrop"> {
4
+ /**
5
+ * If `true`, the file drop zone will be disabled.
6
+ */
7
+ disabled?: boolean;
8
+ /**
9
+ * Status indicator to be displayed.
10
+ */
11
+ status?: Omit<ValidationStatus, "info" | "warning">;
12
+ /**
13
+ * Callback for on drop event
14
+ */
15
+ onDrop?: (event: DragEvent<HTMLDivElement>, files: File[]) => void;
16
+ }
17
+ export declare const FileDropZone: import("react").ForwardRefExoticComponent<FileDropZoneProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,9 @@
1
+ import { IconProps } from "@salt-ds/icons";
2
+ import { ValidationStatus } from "../status-indicator";
3
+ export interface FileDropZoneIconProps extends IconProps {
4
+ /**
5
+ * Status indicator to be displayed.
6
+ */
7
+ status?: ValidationStatus;
8
+ }
9
+ export declare const FileDropZoneIcon: import("react").ForwardRefExoticComponent<FileDropZoneIconProps & import("react").RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,22 @@
1
+ import { HTMLAttributes, SyntheticEvent } from "react";
2
+ export interface FileDropZoneTriggerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange"> {
3
+ /**
4
+ * `accept` attribute for HTML <input>.
5
+ *
6
+ * A comma separated list of file types the user can pick from the file input dialog box.
7
+ */
8
+ accept?: string;
9
+ /**
10
+ * Disable all trigger elements.
11
+ */
12
+ disabled?: boolean;
13
+ /**
14
+ * Allows multiple files to be uploaded.
15
+ */
16
+ multiple?: boolean;
17
+ /**
18
+ * Callback for input change event
19
+ */
20
+ onChange?: (event: SyntheticEvent<HTMLInputElement>, files: File[]) => void;
21
+ }
22
+ export declare const FileDropZoneTrigger: import("react").ForwardRefExoticComponent<FileDropZoneTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,3 @@
1
+ export * from "./FileDropZone";
2
+ export * from "./FileDropZoneIcon";
3
+ export * from "./FileDropZoneTrigger";
@@ -0,0 +1,3 @@
1
+ import { DragEvent } from "react";
2
+ export declare const containsFiles: (e: DragEvent) => boolean | FileList | null;
3
+ export declare const extractFiles: (e: DragEvent) => File[];
@@ -9,6 +9,7 @@ export * from "./breakpoints";
9
9
  export * from "./button";
10
10
  export * from "./card";
11
11
  export * from "./checkbox";
12
+ export * from "./file-drop-zone";
12
13
  export * from "./flex-item";
13
14
  export * from "./flex-layout";
14
15
  export * from "./flow-layout";
@@ -40,6 +40,7 @@ export interface RadioButtonProps extends Omit<ComponentPropsWithoutRef<"label">
40
40
  onFocus?: FocusEventHandler<HTMLInputElement>;
41
41
  /**
42
42
  * Set the read only state.
43
+ * **Note**: Setting a standalone radio button as read-only is not accessible. The whole radio buttton group should be set as read-only instead.
43
44
  */
44
45
  readOnly?: boolean;
45
46
  /**
@@ -1,12 +1,16 @@
1
- import { Middleware, Placement, Platform, Strategy, useFloating } from "@floating-ui/react";
1
+ import { Middleware, Placement, Platform, Strategy, useFloating, FloatingFocusManagerProps } from "@floating-ui/react";
2
2
  import { ReactNode, ComponentPropsWithoutRef } from "react";
3
3
  export interface FloatingComponentProps extends ComponentPropsWithoutRef<"div"> {
4
4
  /**
5
- * Whether the floating component is open (used for determinig whether to show the component)
5
+ * Whether the floating component is open (used for determining whether to show the component)
6
6
  * We pass this as a prop rather than not rendering the component to allow more advanced use-cases e.g.
7
7
  * for caching windows and reusing them, rather than always spawning a new one
8
8
  */
9
9
  open: boolean;
10
+ /**
11
+ * Use this prop when `FloatingFocusManager` is needed for floating component
12
+ */
13
+ focusManagerProps?: Omit<FloatingFocusManagerProps, "children">;
10
14
  /**
11
15
  * Position props for the floating component
12
16
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salt-ds/core",
3
- "version": "1.15.0",
3
+ "version": "1.16.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",