@salt-ds/lab 1.0.0-alpha.30 → 1.0.0-alpha.32

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 (147) hide show
  1. package/css/salt-lab.css +126 -176
  2. package/dist-cjs/app-header/AppHeader.css.js +1 -1
  3. package/dist-cjs/combo-box-next/ComboBoxNext.js +286 -291
  4. package/dist-cjs/combo-box-next/ComboBoxNext.js.map +1 -1
  5. package/dist-cjs/combo-box-next/useComboBoxNext.js +21 -9
  6. package/dist-cjs/combo-box-next/useComboBoxNext.js.map +1 -1
  7. package/dist-cjs/content-status/internal/StatusIndicator.js +1 -3
  8. package/dist-cjs/content-status/internal/StatusIndicator.js.map +1 -1
  9. package/dist-cjs/dialog/Dialog.css.js +1 -1
  10. package/dist-cjs/dialog/Dialog.js +70 -48
  11. package/dist-cjs/dialog/Dialog.js.map +1 -1
  12. package/dist-cjs/dialog/DialogActions.js.map +1 -1
  13. package/dist-cjs/dialog/DialogContent.css.js +1 -1
  14. package/dist-cjs/dialog/DialogContent.js +17 -8
  15. package/dist-cjs/dialog/DialogContent.js.map +1 -1
  16. package/dist-cjs/dialog/DialogContext.js +4 -1
  17. package/dist-cjs/dialog/DialogContext.js.map +1 -1
  18. package/dist-cjs/dialog/DialogTitle.css.js +1 -1
  19. package/dist-cjs/dialog/DialogTitle.js +21 -8
  20. package/dist-cjs/dialog/DialogTitle.js.map +1 -1
  21. package/dist-cjs/drawer/Drawer.css.js +1 -1
  22. package/dist-cjs/drawer/Drawer.js +61 -36
  23. package/dist-cjs/drawer/Drawer.js.map +1 -1
  24. package/dist-cjs/drawer/DrawerCloseButton.css.js +6 -0
  25. package/dist-cjs/drawer/DrawerCloseButton.css.js.map +1 -0
  26. package/dist-cjs/drawer/DrawerCloseButton.js +44 -0
  27. package/dist-cjs/drawer/DrawerCloseButton.js.map +1 -0
  28. package/dist-cjs/dropdown-next/DropdownNext.js +294 -308
  29. package/dist-cjs/dropdown-next/DropdownNext.js.map +1 -1
  30. package/dist-cjs/index.js +3 -9
  31. package/dist-cjs/index.js.map +1 -1
  32. package/dist-cjs/list-control/ListControlContext.js.map +1 -1
  33. package/dist-cjs/list-control/ListControlState.js +21 -20
  34. package/dist-cjs/list-control/ListControlState.js.map +1 -1
  35. package/dist-cjs/option/Option.js +0 -4
  36. package/dist-cjs/option/Option.js.map +1 -1
  37. package/dist-cjs/option/OptionList.css.js +1 -1
  38. package/dist-cjs/parent-child-layout/ParentChildLayout.css.js +1 -1
  39. package/dist-cjs/parent-child-layout/ParentChildLayout.js +30 -38
  40. package/dist-cjs/parent-child-layout/ParentChildLayout.js.map +1 -1
  41. package/dist-cjs/slider/Slider.css.js +1 -1
  42. package/dist-cjs/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
  43. package/dist-cjs/tabs-next/TabNext.css.js +1 -1
  44. package/dist-cjs/tabs-next/TabstripNext.css.js +1 -1
  45. package/dist-es/app-header/AppHeader.css.js +1 -1
  46. package/dist-es/combo-box-next/ComboBoxNext.js +287 -292
  47. package/dist-es/combo-box-next/ComboBoxNext.js.map +1 -1
  48. package/dist-es/combo-box-next/useComboBoxNext.js +21 -9
  49. package/dist-es/combo-box-next/useComboBoxNext.js.map +1 -1
  50. package/dist-es/content-status/internal/StatusIndicator.js +1 -3
  51. package/dist-es/content-status/internal/StatusIndicator.js.map +1 -1
  52. package/dist-es/dialog/Dialog.css.js +1 -1
  53. package/dist-es/dialog/Dialog.js +73 -52
  54. package/dist-es/dialog/Dialog.js.map +1 -1
  55. package/dist-es/dialog/DialogActions.js.map +1 -1
  56. package/dist-es/dialog/DialogContent.css.js +1 -1
  57. package/dist-es/dialog/DialogContent.js +19 -10
  58. package/dist-es/dialog/DialogContent.js.map +1 -1
  59. package/dist-es/dialog/DialogContext.js +4 -1
  60. package/dist-es/dialog/DialogContext.js.map +1 -1
  61. package/dist-es/dialog/DialogTitle.css.js +1 -1
  62. package/dist-es/dialog/DialogTitle.js +22 -9
  63. package/dist-es/dialog/DialogTitle.js.map +1 -1
  64. package/dist-es/drawer/Drawer.css.js +1 -1
  65. package/dist-es/drawer/Drawer.js +65 -39
  66. package/dist-es/drawer/Drawer.js.map +1 -1
  67. package/dist-es/drawer/DrawerCloseButton.css.js +4 -0
  68. package/dist-es/drawer/DrawerCloseButton.css.js.map +1 -0
  69. package/dist-es/drawer/DrawerCloseButton.js +36 -0
  70. package/dist-es/drawer/DrawerCloseButton.js.map +1 -0
  71. package/dist-es/dropdown-next/DropdownNext.js +295 -309
  72. package/dist-es/dropdown-next/DropdownNext.js.map +1 -1
  73. package/dist-es/index.js +3 -6
  74. package/dist-es/index.js.map +1 -1
  75. package/dist-es/list-control/ListControlContext.js.map +1 -1
  76. package/dist-es/list-control/ListControlState.js +21 -20
  77. package/dist-es/list-control/ListControlState.js.map +1 -1
  78. package/dist-es/option/Option.js +0 -4
  79. package/dist-es/option/Option.js.map +1 -1
  80. package/dist-es/option/OptionList.css.js +1 -1
  81. package/dist-es/parent-child-layout/ParentChildLayout.css.js +1 -1
  82. package/dist-es/parent-child-layout/ParentChildLayout.js +32 -40
  83. package/dist-es/parent-child-layout/ParentChildLayout.js.map +1 -1
  84. package/dist-es/slider/Slider.css.js +1 -1
  85. package/dist-es/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
  86. package/dist-es/tabs-next/TabNext.css.js +1 -1
  87. package/dist-es/tabs-next/TabstripNext.css.js +1 -1
  88. package/dist-types/combo-box-next/ComboBoxNext.d.ts +13 -3
  89. package/dist-types/combo-box-next/useComboBoxNext.d.ts +13 -16
  90. package/dist-types/content-status/internal/StatusIndicator.d.ts +1 -1
  91. package/dist-types/dialog/Dialog.d.ts +25 -2
  92. package/dist-types/dialog/DialogContext.d.ts +2 -2
  93. package/dist-types/dialog/DialogTitle.d.ts +19 -5
  94. package/dist-types/drawer/Drawer.d.ts +13 -7
  95. package/dist-types/drawer/DrawerCloseButton.d.ts +2 -0
  96. package/dist-types/drawer/index.d.ts +1 -1
  97. package/dist-types/dropdown-next/DropdownNext.d.ts +13 -3
  98. package/dist-types/index.d.ts +0 -2
  99. package/dist-types/list-control/ListControlContext.d.ts +12 -11
  100. package/dist-types/list-control/ListControlState.d.ts +21 -21
  101. package/dist-types/option/Option.d.ts +1 -1
  102. package/dist-types/parent-child-layout/ParentChildLayout.d.ts +8 -13
  103. package/package.json +2 -2
  104. package/dist-cjs/dialog/useDialog.js +0 -31
  105. package/dist-cjs/dialog/useDialog.js.map +0 -1
  106. package/dist-cjs/drawer/useDrawer.js +0 -31
  107. package/dist-cjs/drawer/useDrawer.js.map +0 -1
  108. package/dist-cjs/parent-child-item/ParentChildItem.css.js +0 -6
  109. package/dist-cjs/parent-child-item/ParentChildItem.css.js.map +0 -1
  110. package/dist-cjs/parent-child-item/ParentChildItem.js +0 -48
  111. package/dist-cjs/parent-child-item/ParentChildItem.js.map +0 -1
  112. package/dist-cjs/progress/CircularProgress/CircularProgress.css.js +0 -6
  113. package/dist-cjs/progress/CircularProgress/CircularProgress.css.js.map +0 -1
  114. package/dist-cjs/progress/CircularProgress/CircularProgress.js +0 -89
  115. package/dist-cjs/progress/CircularProgress/CircularProgress.js.map +0 -1
  116. package/dist-cjs/progress/Info.js +0 -20
  117. package/dist-cjs/progress/Info.js.map +0 -1
  118. package/dist-cjs/progress/LinearProgress/LinearProgress.css.js +0 -6
  119. package/dist-cjs/progress/LinearProgress/LinearProgress.css.js.map +0 -1
  120. package/dist-cjs/progress/LinearProgress/LinearProgress.js +0 -63
  121. package/dist-cjs/progress/LinearProgress/LinearProgress.js.map +0 -1
  122. package/dist-es/dialog/useDialog.js +0 -27
  123. package/dist-es/dialog/useDialog.js.map +0 -1
  124. package/dist-es/drawer/useDrawer.js +0 -27
  125. package/dist-es/drawer/useDrawer.js.map +0 -1
  126. package/dist-es/parent-child-item/ParentChildItem.css.js +0 -4
  127. package/dist-es/parent-child-item/ParentChildItem.css.js.map +0 -1
  128. package/dist-es/parent-child-item/ParentChildItem.js +0 -44
  129. package/dist-es/parent-child-item/ParentChildItem.js.map +0 -1
  130. package/dist-es/progress/CircularProgress/CircularProgress.css.js +0 -4
  131. package/dist-es/progress/CircularProgress/CircularProgress.css.js.map +0 -1
  132. package/dist-es/progress/CircularProgress/CircularProgress.js +0 -85
  133. package/dist-es/progress/CircularProgress/CircularProgress.js.map +0 -1
  134. package/dist-es/progress/Info.js +0 -16
  135. package/dist-es/progress/Info.js.map +0 -1
  136. package/dist-es/progress/LinearProgress/LinearProgress.css.js +0 -4
  137. package/dist-es/progress/LinearProgress/LinearProgress.css.js.map +0 -1
  138. package/dist-es/progress/LinearProgress/LinearProgress.js +0 -59
  139. package/dist-es/progress/LinearProgress/LinearProgress.js.map +0 -1
  140. package/dist-types/dialog/useDialog.d.ts +0 -25
  141. package/dist-types/drawer/useDrawer.d.ts +0 -25
  142. package/dist-types/parent-child-item/ParentChildItem.d.ts +0 -31
  143. package/dist-types/parent-child-item/index.d.ts +0 -1
  144. package/dist-types/progress/CircularProgress/CircularProgress.d.ts +0 -25
  145. package/dist-types/progress/Info.d.ts +0 -6
  146. package/dist-types/progress/LinearProgress/LinearProgress.d.ts +0 -26
  147. package/dist-types/progress/index.d.ts +0 -2
@@ -1,10 +1,20 @@
1
- import { ReactNode } from "react";
1
+ import { ReactNode, Ref } from "react";
2
2
  import { InputProps } from "@salt-ds/core";
3
3
  import { ListControlProps } from "../list-control/ListControlState";
4
- export interface ComboBoxNextProps extends InputProps, Omit<ListControlProps, "value" | "defaultValue"> {
4
+ export interface ComboBoxNextProps<Item = string> extends InputProps, Omit<ListControlProps<Item>, "value" | "defaultValue"> {
5
5
  /**
6
6
  * The options to display in the combo box.
7
7
  */
8
8
  children?: ReactNode;
9
+ /**
10
+ * The default value of the input.
11
+ */
12
+ defaultValue?: string | readonly string[] | number | undefined;
13
+ /**
14
+ * The value of the input. The component will be controlled if this prop is provided.
15
+ */
16
+ value?: string | readonly string[] | number | undefined;
9
17
  }
10
- export declare const ComboBoxNext: import("react").ForwardRefExoticComponent<ComboBoxNextProps & import("react").RefAttributes<HTMLDivElement>>;
18
+ export declare const ComboBoxNext: <Item = string>(props: ComboBoxNextProps<Item> & {
19
+ ref?: Ref<HTMLDivElement> | undefined;
20
+ }) => JSX.Element;
@@ -1,19 +1,16 @@
1
1
  import { ListControlProps } from "../list-control/ListControlState";
2
2
  import { SyntheticEvent } from "react";
3
3
  import { OptionValue } from "../list-control/ListControlContext";
4
- export declare function useComboBoxNext(props: ListControlProps): {
5
- select: (event: SyntheticEvent, option: OptionValue) => void;
4
+ export declare function useComboBoxNext<Item>(props: ListControlProps<Item>): {
5
+ select: (event: SyntheticEvent, option: OptionValue<Item>) => void;
6
6
  multiselect: boolean;
7
7
  openState: boolean;
8
- setOpen: (event: SyntheticEvent<Element, Event>, newOpen: boolean) => void;
9
- openKey: import("react").MutableRefObject<{
10
- key: string;
11
- altKey: boolean;
12
- }>;
13
- activeState: OptionValue | undefined;
14
- setActive: (option?: OptionValue | undefined) => void;
15
- selectedState: string[];
16
- setSelectedState: import("react").Dispatch<import("react").SetStateAction<string[]>>;
8
+ setOpen: (newOpen: boolean, reason?: import("../list-control/ListControlState").OpenChangeReason | undefined, key?: string | undefined) => void;
9
+ openKey: import("react").MutableRefObject<string | undefined>;
10
+ activeState: OptionValue<Item> | undefined;
11
+ setActive: (option?: OptionValue<Item> | undefined) => void;
12
+ selectedState: Item[];
13
+ setSelectedState: import("react").Dispatch<import("react").SetStateAction<Item[]>>;
17
14
  clear: (event: SyntheticEvent<Element, Event>) => void;
18
15
  valueState: string | number | readonly string[] | undefined;
19
16
  setValueState: import("react").Dispatch<import("react").SetStateAction<string | number | readonly string[] | undefined>>;
@@ -23,9 +20,9 @@ export declare function useComboBoxNext(props: ListControlProps): {
23
20
  setFocusedState: import("react").Dispatch<import("react").SetStateAction<boolean>>;
24
21
  listRef: import("react").RefObject<HTMLDivElement>;
25
22
  options: HTMLElement[];
26
- register: (optionValue: OptionValue, element: HTMLElement) => () => void;
27
- getOptionAtIndex: (index: number) => OptionValue;
28
- getIndexOfOption: (option: OptionValue) => number;
29
- getOptionsMatching: (predicate: (option: OptionValue) => boolean) => OptionValue[];
30
- getOptionFromSearch: (search: string, startFrom?: OptionValue | undefined) => OptionValue | undefined;
23
+ register: (optionValue: OptionValue<Item>, element: HTMLElement) => () => void;
24
+ getOptionAtIndex: (index: number) => OptionValue<Item>;
25
+ getIndexOfOption: (option: OptionValue<Item>) => number;
26
+ getOptionsMatching: (predicate: (option: OptionValue<Item>) => boolean) => OptionValue<Item>[];
27
+ getOptionFromSearch: (search: string, startFrom?: OptionValue<Item> | undefined) => OptionValue<Item> | undefined;
31
28
  };
@@ -1,6 +1,6 @@
1
1
  import { StatusIndicatorProps as BaseStatusIndicatorProps, SpinnerProps } from "@salt-ds/core";
2
2
  import { ReactElement } from "react";
3
- import { CircularProgressProps } from "../../progress";
3
+ import { CircularProgressProps } from "@salt-ds/core";
4
4
  export interface StatusIndicatorProps extends Pick<SpinnerProps, "disableAnnouncer">, Pick<CircularProgressProps, "value"> {
5
5
  title?: string;
6
6
  message?: string;
@@ -1,6 +1,11 @@
1
- import { HTMLAttributes, ComponentProps } from "react";
1
+ import { HTMLAttributes, ComponentProps, ReactNode } from "react";
2
2
  import { FloatingFocusManager } from "@floating-ui/react";
3
3
  import { ValidationStatus } from "@salt-ds/core";
4
+ interface ConditionalScrimWrapperProps {
5
+ children?: ReactNode;
6
+ condition: boolean;
7
+ }
8
+ export declare const ConditionalScrimWrapper: ({ condition, children, }: ConditionalScrimWrapperProps) => JSX.Element;
4
9
  export interface DialogProps extends HTMLAttributes<HTMLDivElement> {
5
10
  /**
6
11
  * Display or hide the component.
@@ -11,7 +16,7 @@ export interface DialogProps extends HTMLAttributes<HTMLDivElement> {
11
16
  */
12
17
  onOpenChange?: (open: boolean) => void;
13
18
  /**
14
- * Status indicator
19
+ * The status of the Dialog
15
20
  * */
16
21
  status?: ValidationStatus;
17
22
  /**
@@ -19,5 +24,23 @@ export interface DialogProps extends HTMLAttributes<HTMLDivElement> {
19
24
  * Default value is 0 (first tabbable element).
20
25
  * */
21
26
  initialFocus?: ComponentProps<typeof FloatingFocusManager>["initialFocus"];
27
+ /**
28
+ * Size of the Dialog
29
+ * */
30
+ size?: "small" | "medium" | "large";
31
+ /**
32
+ * Prevent the dialog closing on click away
33
+ * */
34
+ disableDismiss?: boolean;
35
+ /**
36
+ * Prevent Scrim from rendering
37
+ * */
38
+ disableScrim?: boolean;
39
+ /**
40
+ * Optional id prop
41
+ * Used for accessibility purposes to announce the title and subtitle when using a screen reader
42
+ * */
43
+ idProp?: string;
22
44
  }
23
45
  export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLDivElement>>;
46
+ export {};
@@ -1,8 +1,8 @@
1
1
  export declare const DialogContext: import("react").Context<{
2
- dialogId?: string | undefined;
3
2
  status?: "error" | "warning" | "success" | "info" | undefined;
3
+ id: string | undefined;
4
4
  }>;
5
5
  export declare const useDialogContext: () => {
6
- dialogId?: string | undefined;
7
6
  status?: "error" | "warning" | "success" | "info" | undefined;
7
+ id: string | undefined;
8
8
  };
@@ -1,8 +1,22 @@
1
- import { ComponentPropsWithoutRef } from "react";
1
+ import { ReactNode, ComponentPropsWithoutRef } from "react";
2
2
  import { ValidationStatus } from "@salt-ds/core";
3
- interface DialogTitleProps extends ComponentPropsWithoutRef<"h2"> {
4
- status?: ValidationStatus;
5
- accent?: boolean;
3
+ interface DialogTitleProps extends Omit<ComponentPropsWithoutRef<"div">, "title"> {
4
+ /**
5
+ * The status of the Dialog
6
+ */
7
+ status?: ValidationStatus | undefined;
8
+ /**
9
+ * Displays the accent bar in the Dialog Title */
10
+ disableAccent?: boolean;
11
+ /**
12
+ * Displays the Dialog Title in a H2 component
13
+ */
14
+ title: ReactNode;
15
+ /**
16
+ * Displays the Dialog Subtitle in a Label component
17
+ **/
18
+ subtitle?: ReactNode;
19
+ className?: string;
6
20
  }
7
- export declare const DialogTitle: ({ children, className, accent, status: statusProp, ...rest }: DialogTitleProps) => JSX.Element;
21
+ export declare const DialogTitle: ({ className, title, subtitle, disableAccent, status: statusProp, ...rest }: DialogTitleProps) => JSX.Element;
8
22
  export {};
@@ -1,11 +1,9 @@
1
- import { HTMLAttributes } from "react";
2
- export declare const DRAWER_POSITIONS: readonly ["left", "top", "right", "bottom"];
3
- export declare type DrawerPositions = (typeof DRAWER_POSITIONS)[number];
4
- export interface DrawerProps extends HTMLAttributes<HTMLDivElement> {
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ export interface DrawerProps extends ComponentPropsWithoutRef<"div"> {
5
3
  /**
6
- * Defines the drawer position within the screen.
4
+ * Defines the drawer position within the screen. Defaults to `left`.
7
5
  */
8
- position?: DrawerPositions;
6
+ position?: "left" | "top" | "right" | "bottom";
9
7
  /**
10
8
  * Display or hide the component.
11
9
  */
@@ -13,10 +11,18 @@ export interface DrawerProps extends HTMLAttributes<HTMLDivElement> {
13
11
  /**
14
12
  * Callback function triggered when open state changes.
15
13
  */
16
- onOpenChange?: (open: boolean) => void;
14
+ onOpenChange?: (newOpen: boolean) => void;
17
15
  /**
18
16
  * Change background color palette
19
17
  */
20
18
  variant?: "primary" | "secondary";
19
+ /**
20
+ * Prevent the dialog closing on click away
21
+ * */
22
+ disableDismiss?: boolean;
23
+ /**
24
+ * Prevent Scrim from rendering
25
+ * */
26
+ disableScrim?: boolean;
21
27
  }
22
28
  export declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ import { ButtonProps } from "@salt-ds/core";
2
+ export declare const DrawerCloseButton: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,2 +1,2 @@
1
1
  export * from "./Drawer";
2
- export * from "./useDrawer";
2
+ export * from "./DrawerCloseButton";
@@ -1,7 +1,7 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
1
+ import { ComponentPropsWithoutRef, ReactNode, Ref } from "react";
2
2
  import { ListControlProps } from "../list-control/ListControlState";
3
3
  import { ValidationStatus } from "@salt-ds/core";
4
- export interface DropdownNextProps extends Omit<ComponentPropsWithoutRef<"button">, "value" | "defaultValue">, ListControlProps {
4
+ export interface DropdownNextProps<Item = string> extends Omit<ComponentPropsWithoutRef<"button">, "value" | "defaultValue">, ListControlProps<Item> {
5
5
  /**
6
6
  * If `true`, the dropdown will be disabled.
7
7
  */
@@ -39,9 +39,19 @@ export interface DropdownNextProps extends Omit<ComponentPropsWithoutRef<"button
39
39
  * Styling variant. Defaults to "primary".
40
40
  */
41
41
  variant?: "primary" | "secondary";
42
+ /**
43
+ * The default content of the dropdown shown in the button.
44
+ */
45
+ defaultValue?: string | readonly string[] | number | undefined;
46
+ /**
47
+ * The content of the dropdown shown in the button. The component will be controlled if this prop is provided.
48
+ */
49
+ value?: string | readonly string[] | number | undefined;
42
50
  /**
43
51
  * Validation status, one of "error" | "warning" | "success".
44
52
  */
45
53
  validationStatus?: Exclude<ValidationStatus, "info">;
46
54
  }
47
- export declare const DropdownNext: import("react").ForwardRefExoticComponent<DropdownNextProps & import("react").RefAttributes<HTMLButtonElement>>;
55
+ export declare const DropdownNext: <Item = string>(props: DropdownNextProps<Item> & {
56
+ ref?: Ref<HTMLButtonElement> | undefined;
57
+ }) => JSX.Element;
@@ -33,10 +33,8 @@ export * from "./menu-button";
33
33
  export * from "./metric";
34
34
  export * from "./option";
35
35
  export * from "./overlay";
36
- export * from "./parent-child-item";
37
36
  export * from "./parent-child-layout";
38
37
  export * from "./portal";
39
- export * from "./progress";
40
38
  export * from "./query-input";
41
39
  export * from "./responsive";
42
40
  export * from "./search-input";
@@ -1,20 +1,21 @@
1
1
  import { SyntheticEvent } from "react";
2
- export interface OptionValue {
2
+ export interface OptionValue<Item> {
3
3
  id: string;
4
4
  disabled: boolean;
5
- value: string;
5
+ value: Item;
6
6
  text: string;
7
7
  }
8
- export interface ListControlContextValue {
8
+ export declare type OpenChangeReason = "input" | "manual";
9
+ export interface ListControlContextValue<Item> {
9
10
  openState: boolean;
10
- setOpen: (event: SyntheticEvent, newOpen: boolean) => void;
11
- register: (optionValue: OptionValue, element: HTMLElement) => () => void;
12
- selectedState: string[];
13
- select: (event: SyntheticEvent, option: OptionValue) => void;
14
- activeState?: OptionValue;
15
- setActive: (option: OptionValue) => void;
11
+ setOpen: (newOpen: boolean, openChangeReason?: OpenChangeReason) => void;
12
+ register: (optionValue: OptionValue<Item>, element: HTMLElement) => () => void;
13
+ selectedState: unknown[];
14
+ select: (event: SyntheticEvent, option: OptionValue<Item>) => void;
15
+ activeState?: OptionValue<Item>;
16
+ setActive: (option: OptionValue<Item>) => void;
16
17
  multiselect: boolean;
17
18
  focusVisibleState: boolean;
18
19
  }
19
- export declare const ListControlContext: import("react").Context<ListControlContextValue>;
20
- export declare function useListControlContext(): ListControlContextValue;
20
+ export declare const ListControlContext: import("react").Context<ListControlContextValue<any>>;
21
+ export declare function useListControlContext<Item>(): ListControlContextValue<Item>;
@@ -1,6 +1,9 @@
1
1
  import { SyntheticEvent } from "react";
2
2
  import { OptionValue } from "./ListControlContext";
3
- export interface ListControlProps {
3
+ export declare type OpenChangeReason = "input" | "manual";
4
+ export interface ListControlProps<Item> {
5
+ disabled?: boolean;
6
+ readOnly?: boolean;
4
7
  /**
5
8
  * If true, the list will be open by default.
6
9
  */
@@ -12,19 +15,19 @@ export interface ListControlProps {
12
15
  /**
13
16
  * Callback fired when the open state changes.
14
17
  */
15
- onOpenChange?: (event: SyntheticEvent, newOpen: boolean) => void;
18
+ onOpenChange?: (newOpen: boolean, reason?: OpenChangeReason) => void;
16
19
  /**
17
20
  * The default selected options. If this is provided `defaultValue` should be provided as well.
18
21
  */
19
- defaultSelected?: string[];
22
+ defaultSelected?: Item[];
20
23
  /**
21
24
  * The selected options. The component will be controlled if this prop is provided.
22
25
  */
23
- selected?: string[];
26
+ selected?: Item[];
24
27
  /**
25
28
  * Callback fired when the selected options change.
26
29
  */
27
- onSelectionChange?: (event: SyntheticEvent, newSelected: string[]) => void;
30
+ onSelectionChange?: (event: SyntheticEvent, newSelected: Item[]) => void;
28
31
  /**
29
32
  * The default value.
30
33
  */
@@ -38,19 +41,16 @@ export interface ListControlProps {
38
41
  */
39
42
  multiselect?: boolean;
40
43
  }
41
- export declare function useListControl(props: ListControlProps): {
44
+ export declare function useListControl<Item>(props: ListControlProps<Item>): {
42
45
  multiselect: boolean;
43
46
  openState: boolean;
44
- setOpen: (event: SyntheticEvent, newOpen: boolean) => void;
45
- openKey: import("react").MutableRefObject<{
46
- key: string;
47
- altKey: boolean;
48
- }>;
49
- activeState: OptionValue | undefined;
50
- setActive: (option?: OptionValue | undefined) => void;
51
- selectedState: string[];
52
- setSelectedState: import("react").Dispatch<import("react").SetStateAction<string[]>>;
53
- select: (event: SyntheticEvent, option: OptionValue) => void;
47
+ setOpen: (newOpen: boolean, reason?: OpenChangeReason | undefined, key?: string | undefined) => void;
48
+ openKey: import("react").MutableRefObject<string | undefined>;
49
+ activeState: OptionValue<Item> | undefined;
50
+ setActive: (option?: OptionValue<Item> | undefined) => void;
51
+ selectedState: Item[];
52
+ setSelectedState: import("react").Dispatch<import("react").SetStateAction<Item[]>>;
53
+ select: (event: SyntheticEvent, option: OptionValue<Item>) => void;
54
54
  clear: (event: SyntheticEvent) => void;
55
55
  valueState: string | number | readonly string[] | undefined;
56
56
  setValueState: import("react").Dispatch<import("react").SetStateAction<string | number | readonly string[] | undefined>>;
@@ -60,9 +60,9 @@ export declare function useListControl(props: ListControlProps): {
60
60
  setFocusedState: import("react").Dispatch<import("react").SetStateAction<boolean>>;
61
61
  listRef: import("react").RefObject<HTMLDivElement>;
62
62
  options: HTMLElement[];
63
- register: (optionValue: OptionValue, element: HTMLElement) => () => void;
64
- getOptionAtIndex: (index: number) => OptionValue;
65
- getIndexOfOption: (option: OptionValue) => number;
66
- getOptionsMatching: (predicate: (option: OptionValue) => boolean) => OptionValue[];
67
- getOptionFromSearch: (search: string, startFrom?: OptionValue | undefined) => OptionValue | undefined;
63
+ register: (optionValue: OptionValue<Item>, element: HTMLElement) => () => void;
64
+ getOptionAtIndex: (index: number) => OptionValue<Item>;
65
+ getIndexOfOption: (option: OptionValue<Item>) => number;
66
+ getOptionsMatching: (predicate: (option: OptionValue<Item>) => boolean) => OptionValue<Item>[];
67
+ getOptionFromSearch: (search: string, startFrom?: OptionValue<Item> | undefined) => OptionValue<Item> | undefined;
68
68
  };
@@ -7,7 +7,7 @@ export interface OptionProps extends ComponentPropsWithoutRef<"div"> {
7
7
  /**
8
8
  * The value of the option.
9
9
  */
10
- value: string;
10
+ value: unknown;
11
11
  /**
12
12
  * The text value of the option. If not provided, the text value will be inferred from the children.
13
13
  */
@@ -1,28 +1,23 @@
1
1
  import { Breakpoints, FlexLayoutProps } from "@salt-ds/core";
2
- import { ElementType, HTMLAttributes, ReactNode } from "react";
2
+ import { ReactNode } from "react";
3
3
  export declare type StackedViewElement = "parent" | "child";
4
- declare type Orientation = "horizontal" | "vertical";
5
- export interface ParentChildLayoutProps extends HTMLAttributes<HTMLDivElement> {
4
+ export interface ParentChildLayoutProps extends FlexLayoutProps<"div"> {
6
5
  /**
7
6
  * Breakpoint at which the parent and child will stack.
8
7
  */
9
- stackedAtBreakpoint?: keyof Breakpoints;
8
+ collapseAtBreakpoint?: keyof Breakpoints;
10
9
  /**
11
10
  * Change element that is displayed when in staked view.
12
11
  */
13
- stackedViewElement?: StackedViewElement;
12
+ collapsedViewElement?: StackedViewElement;
14
13
  /**
15
14
  * Disable all animations.
16
15
  */
17
16
  disableAnimations?: boolean;
18
17
  /**
19
- * Orientation for slide animations.
18
+ * Position of the parent component within the layout.
20
19
  */
21
- orientation?: Orientation;
22
- /**
23
- * Controls the space between columns.
24
- */
25
- gap?: FlexLayoutProps<ElementType>["gap"];
20
+ parentPosition?: "left" | "right";
26
21
  /**
27
22
  * Parent component to be rendered
28
23
  */
@@ -31,6 +26,6 @@ export interface ParentChildLayoutProps extends HTMLAttributes<HTMLDivElement> {
31
26
  * Child component to be rendered
32
27
  */
33
28
  child: ReactNode;
29
+ onCollapseChange?: (isCollapsed: boolean) => void;
34
30
  }
35
- export declare const ParentChildLayout: import("react").ForwardRefExoticComponent<ParentChildLayoutProps & import("react").RefAttributes<HTMLDivElement>>;
36
- export {};
31
+ export declare const ParentChildLayout: import("react").ForwardRefExoticComponent<Omit<ParentChildLayoutProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salt-ds/lab",
3
- "version": "1.0.0-alpha.30",
3
+ "version": "1.0.0-alpha.32",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "react-window": "^1.8.6",
27
27
  "rifm": "^0.12.0",
28
28
  "tinycolor2": "^1.4.2",
29
- "@salt-ds/core": "^1.16.1",
29
+ "@salt-ds/core": "^1.18.0",
30
30
  "@salt-ds/window": "^0.1.1",
31
31
  "@salt-ds/styles": "^0.2.1",
32
32
  "@salt-ds/icons": "^1.9.1"
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var react = require('@floating-ui/react');
6
- var core = require('@salt-ds/core');
7
-
8
- function useDialog(props) {
9
- const { open, onOpenChange } = props;
10
- const { context, floating } = core.useFloatingUI({
11
- open,
12
- onOpenChange
13
- });
14
- const click = react.useClick(context);
15
- const role = react.useRole(context);
16
- const dismiss = react.useDismiss(context);
17
- const { getFloatingProps, getReferenceProps } = react.useInteractions([
18
- role,
19
- dismiss,
20
- click
21
- ]);
22
- return {
23
- getFloatingProps,
24
- getReferenceProps,
25
- floating,
26
- context
27
- };
28
- }
29
-
30
- exports.useDialog = useDialog;
31
- //# sourceMappingURL=useDialog.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDialog.js","sources":["../src/dialog/useDialog.ts"],"sourcesContent":["import {\n useClick,\n useDismiss,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport { useFloatingUI, UseFloatingUIProps } from \"@salt-ds/core\";\n\nexport type UseDialogProps = Partial<\n Pick<UseFloatingUIProps, \"onOpenChange\" | \"open\">\n>;\n\nexport function useDialog(props: UseDialogProps) {\n const { open, onOpenChange } = props;\n\n const { context, floating } = useFloatingUI({\n open,\n onOpenChange,\n });\n\n const click = useClick(context);\n const role = useRole(context);\n const dismiss = useDismiss(context);\n\n const { getFloatingProps, getReferenceProps } = useInteractions([\n role,\n dismiss,\n click,\n ]);\n\n return {\n getFloatingProps,\n getReferenceProps,\n floating,\n context,\n };\n}\n"],"names":["useFloatingUI","useClick","useRole","useDismiss","useInteractions"],"mappings":";;;;;;;AAYO,SAAS,UAAU,KAAuB,EAAA;AAC/C,EAAM,MAAA,EAAE,IAAM,EAAA,YAAA,EAAiB,GAAA,KAAA,CAAA;AAE/B,EAAA,MAAM,EAAE,OAAA,EAAS,QAAS,EAAA,GAAIA,kBAAc,CAAA;AAAA,IAC1C,IAAA;AAAA,IACA,YAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAM,MAAA,KAAA,GAAQC,eAAS,OAAO,CAAA,CAAA;AAC9B,EAAM,MAAA,IAAA,GAAOC,cAAQ,OAAO,CAAA,CAAA;AAC5B,EAAM,MAAA,OAAA,GAAUC,iBAAW,OAAO,CAAA,CAAA;AAElC,EAAA,MAAM,EAAE,gBAAA,EAAkB,iBAAkB,EAAA,GAAIC,qBAAgB,CAAA;AAAA,IAC9D,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA;AAAA,IACL,gBAAA;AAAA,IACA,iBAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var react = require('@floating-ui/react');
6
- var core = require('@salt-ds/core');
7
-
8
- function useDrawer(props) {
9
- const { open, onOpenChange } = props;
10
- const { context, floating } = core.useFloatingUI({
11
- open,
12
- onOpenChange
13
- });
14
- const click = react.useClick(context);
15
- const role = react.useRole(context);
16
- const dismiss = react.useDismiss(context);
17
- const { getFloatingProps, getReferenceProps } = react.useInteractions([
18
- role,
19
- dismiss,
20
- click
21
- ]);
22
- return {
23
- getFloatingProps,
24
- getReferenceProps,
25
- floating,
26
- context
27
- };
28
- }
29
-
30
- exports.useDrawer = useDrawer;
31
- //# sourceMappingURL=useDrawer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDrawer.js","sources":["../src/drawer/useDrawer.ts"],"sourcesContent":["import {\n useClick,\n useDismiss,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport { useFloatingUI, UseFloatingUIProps } from \"@salt-ds/core\";\n\nexport type UseDrawerProps = Partial<\n Pick<UseFloatingUIProps, \"onOpenChange\" | \"open\">\n>;\n\nexport function useDrawer(props: UseDrawerProps) {\n const { open, onOpenChange } = props;\n\n const { context, floating } = useFloatingUI({\n open,\n onOpenChange,\n });\n\n const click = useClick(context);\n const role = useRole(context);\n const dismiss = useDismiss(context);\n\n const { getFloatingProps, getReferenceProps } = useInteractions([\n role,\n dismiss,\n click,\n ]);\n\n return {\n getFloatingProps,\n getReferenceProps,\n floating,\n context,\n };\n}\n"],"names":["useFloatingUI","useClick","useRole","useDismiss","useInteractions"],"mappings":";;;;;;;AAYO,SAAS,UAAU,KAAuB,EAAA;AAC/C,EAAM,MAAA,EAAE,IAAM,EAAA,YAAA,EAAiB,GAAA,KAAA,CAAA;AAE/B,EAAA,MAAM,EAAE,OAAA,EAAS,QAAS,EAAA,GAAIA,kBAAc,CAAA;AAAA,IAC1C,IAAA;AAAA,IACA,YAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAM,MAAA,KAAA,GAAQC,eAAS,OAAO,CAAA,CAAA;AAC9B,EAAM,MAAA,IAAA,GAAOC,cAAQ,OAAO,CAAA,CAAA;AAC5B,EAAM,MAAA,OAAA,GAAUC,iBAAW,OAAO,CAAA,CAAA;AAElC,EAAA,MAAM,EAAE,gBAAA,EAAkB,iBAAkB,EAAA,GAAIC,qBAAgB,CAAA;AAAA,IAC9D,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA;AAAA,IACL,gBAAA;AAAA,IACA,iBAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var css_248z = ".saltParentChildItem-slide-top {\n animation: var(--salt-animation-slide-in-top);\n}\n.saltParentChildItem-slide-bottom {\n animation: var(--salt-animation-slide-in-bottom);\n}\n.saltParentChildItem-slide-left {\n animation: var(--salt-animation-slide-in-left);\n}\n.saltParentChildItem-slide-right {\n animation: var(--salt-animation-slide-in-right);\n}\n";
4
-
5
- module.exports = css_248z;
6
- //# sourceMappingURL=ParentChildItem.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ParentChildItem.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,48 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var React = require('react');
7
- var clsx = require('clsx');
8
- var core = require('@salt-ds/core');
9
- var window = require('@salt-ds/window');
10
- var styles = require('@salt-ds/styles');
11
- var ParentChildItem$1 = require('./ParentChildItem.css.js');
12
-
13
- const withBaseName = core.makePrefixer("saltParentChildItem");
14
- const ParentChildItem = React.forwardRef(
15
- function ParentChildItem2({
16
- disableAnimations = false,
17
- direction,
18
- isStacked,
19
- children,
20
- className,
21
- ...rest
22
- }, ref) {
23
- const targetWindow = window.useWindow();
24
- styles.useComponentCssInjection({
25
- testId: "salt-parent-child-item",
26
- css: ParentChildItem$1,
27
- window: targetWindow
28
- });
29
- return /* @__PURE__ */ jsxRuntime.jsx(core.FlexItem, {
30
- className: clsx.clsx(
31
- withBaseName(),
32
- {
33
- ...direction && {
34
- [withBaseName(`slide-${direction}`)]: !disableAnimations
35
- },
36
- "saltFlexItem-stacked": isStacked
37
- },
38
- className
39
- ),
40
- ref,
41
- ...rest,
42
- children
43
- });
44
- }
45
- );
46
-
47
- exports.ParentChildItem = ParentChildItem;
48
- //# sourceMappingURL=ParentChildItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ParentChildItem.js","sources":["../src/parent-child-item/ParentChildItem.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes } from \"react\";\nimport { clsx } from \"clsx\";\nimport {\n FlexItem,\n flexItemAlignment,\n makePrefixer,\n ResponsiveProp,\n} from \"@salt-ds/core\";\n\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport parentChildItemCss from \"./ParentChildItem.css\";\n\nexport type SlideDirection = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport interface ParentChildItemProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Allows the alignment specified by parent to be overridden for individual items, default is \"start\".\n */\n align?: flexItemAlignment;\n /**\n * Disable all animations.\n */\n disableAnimations?: boolean;\n /**\n * Direction for slide animations.\n */\n direction?: SlideDirection;\n /**\n * Defines the ability for an item to grow x times more compared to it's siblings, default is 0.\n */\n grow?: ResponsiveProp<number>;\n /**\n * Determines whether the component is stacked\n */\n isStacked?: boolean;\n /**\n * Defines the ability for an item to shrink x times more compared to it's siblings, default is 1.\n\n */\n shrink?: ResponsiveProp<number>;\n}\n\nconst withBaseName = makePrefixer(\"saltParentChildItem\");\nexport const ParentChildItem = forwardRef<HTMLDivElement, ParentChildItemProps>(\n function ParentChildItem(\n {\n disableAnimations = false,\n direction,\n isStacked,\n children,\n className,\n ...rest\n },\n ref\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-parent-child-item\",\n css: parentChildItemCss,\n window: targetWindow,\n });\n\n return (\n <FlexItem\n className={clsx(\n withBaseName(),\n {\n ...(direction && {\n [withBaseName(`slide-${direction}`)]: !disableAnimations,\n }),\n \"saltFlexItem-stacked\": isStacked,\n },\n className\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </FlexItem>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","ParentChildItem","useWindow","useComponentCssInjection","parentChildItemCss","jsx","FlexItem","clsx"],"mappings":";;;;;;;;;;;;AA4CA,MAAM,YAAA,GAAeA,kBAAa,qBAAqB,CAAA,CAAA;AAChD,MAAM,eAAkB,GAAAC,gBAAA;AAAA,EAC7B,SAASC,gBACP,CAAA;AAAA,IACE,iBAAoB,GAAA,KAAA;AAAA,IACpB,SAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACA,EAAA;AACA,IAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,wBAAA;AAAA,MACR,GAAK,EAAAC,iBAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,uBACGC,cAAA,CAAAC,aAAA,EAAA;AAAA,MACC,SAAW,EAAAC,SAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb;AAAA,UACE,GAAI,SAAa,IAAA;AAAA,YACf,CAAC,YAAA,CAAa,CAAS,MAAA,EAAA,SAAA,CAAA,CAAW,IAAI,CAAC,iBAAA;AAAA,WACzC;AAAA,UACA,sBAAwB,EAAA,SAAA;AAAA,SAC1B;AAAA,QACA,SAAA;AAAA,OACF;AAAA,MACA,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var css_248z = ".saltCircularProgress {\n color: var(--salt-content-primary-foreground);\n display: inline-flex;\n position: relative;\n}\n\n.saltCircularProgress-progressValue {\n align-items: center;\n color: var(--salt-content-primary-foreground);\n display: flex;\n font-family: var(--salt-text-fontFamily);\n font-size: var(--salt-text-label-fontSize);\n font-weight: var(--salt-text-label-fontWeight-strong);\n height: 100%;\n justify-content: center;\n left: 0;\n position: absolute;\n width: 100%;\n}\n\n.saltCircularProgress-track {\n inline-size: calc(var(--salt-size-base) * 3);\n block-size: calc(var(--salt-size-base) * 3);\n border-style: var(--salt-track-borderStyle);\n border-width: var(--salt-size-bar-small);\n border-radius: calc(var(--salt-size-base) * 3);\n border-color: var(--salt-palette-neutral-secondary-border);\n}\n\n.saltCircularProgress-bar {\n inline-size: calc(var(--salt-size-base) * 3);\n block-size: calc(var(--salt-size-base) * 3);\n border-style: var(--salt-track-borderStyle);\n border-width: var(--salt-size-bar-strong);\n border-radius: calc(var(--salt-size-base) * 3);\n border-color: var(--salt-accent-background);\n}\n\n.saltCircularProgress-bars {\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n inline-size: 100%;\n block-size: 100%;\n}\n\n.saltCircularProgress-barOverlayRight,\n.saltCircularProgress-barOverlayLeft {\n inline-size: 50%;\n block-size: 100%;\n transform-origin: 100% center;\n transform: rotate(180deg);\n overflow: hidden;\n position: absolute;\n}\n\n.saltCircularProgress-barSubOverlayRight,\n.saltCircularProgress-barSubOverlayLeft {\n inline-size: 100%;\n block-size: 100%;\n transform-origin: 100% center;\n overflow: hidden;\n transform: rotate(-180deg);\n}\n\n.saltCircularProgress-barOverlayLeft {\n transform: rotate(0deg);\n}\n";
4
-
5
- module.exports = css_248z;
6
- //# sourceMappingURL=CircularProgress.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CircularProgress.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}