@jobber/components 6.17.3 → 6.17.4-CLEANUPfi-cccea22.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 (42) hide show
  1. package/dist/Checkbox/Checkbox.d.ts +2 -53
  2. package/dist/Checkbox/Checkbox.rebuilt.d.ts +2 -0
  3. package/dist/Checkbox/Checkbox.types.d.ts +91 -0
  4. package/dist/Checkbox/index.cjs +82 -8
  5. package/dist/Checkbox/index.d.ts +4 -1
  6. package/dist/Checkbox/index.mjs +85 -7
  7. package/dist/DataList/DataList.types.d.ts +4 -0
  8. package/dist/DataList/components/DataListHeader/index.cjs +1 -1
  9. package/dist/DataList/components/DataListHeader/index.mjs +1 -1
  10. package/dist/DataList/components/DataListItem/index.cjs +1 -1
  11. package/dist/DataList/components/DataListItem/index.mjs +1 -1
  12. package/dist/DataList/components/DataListItems/index.cjs +1 -1
  13. package/dist/DataList/components/DataListItems/index.mjs +1 -1
  14. package/dist/DataList/components/DataListLayout/index.cjs +1 -1
  15. package/dist/DataList/components/DataListLayout/index.mjs +1 -1
  16. package/dist/DataList/index.cjs +1 -1
  17. package/dist/DataList/index.mjs +1 -1
  18. package/dist/DataList.utils-cjs.js +5 -2
  19. package/dist/DataList.utils-es.js +5 -2
  20. package/dist/DataListActions-cjs.js +11 -3
  21. package/dist/DataListActions-es.js +11 -3
  22. package/dist/DataListHeader-cjs.js +2 -2
  23. package/dist/DataListHeader-es.js +1 -1
  24. package/dist/DataListItem-cjs.js +2 -2
  25. package/dist/DataListItem-es.js +1 -1
  26. package/dist/LightBox/LightBox.d.ts +2 -1
  27. package/dist/LightBox/index.cjs +1 -1
  28. package/dist/LightBox/index.mjs +1 -1
  29. package/dist/LightBox-cjs.js +33 -13
  30. package/dist/LightBox-es.js +33 -13
  31. package/dist/Menu-cjs.js +6 -7
  32. package/dist/Menu-es.js +6 -7
  33. package/dist/MultiSelect/index.cjs +1 -1
  34. package/dist/MultiSelect/index.mjs +1 -1
  35. package/dist/MultiSelect-cjs.js +2 -2
  36. package/dist/MultiSelect-es.js +1 -1
  37. package/dist/index.cjs +2 -2
  38. package/dist/index.mjs +1 -1
  39. package/dist/styles.css +136 -28
  40. package/package.json +2 -2
  41. package/dist/Checkbox-cjs.js +0 -55
  42. package/dist/Checkbox-es.js +0 -53
@@ -1,53 +1,2 @@
1
- import { ReactElement } from "react";
2
- import { XOR } from "ts-xor";
3
- interface BaseCheckboxProps {
4
- /**
5
- * Determines if the checkbox is checked or not.
6
- */
7
- readonly checked?: boolean;
8
- /**
9
- * Initial checked value of the checkbox. Only use this when you need to
10
- * pre-populate the checked attribute that is not controlled by the component's
11
- * state. If a state is controlling it, use the `checked` prop instead.
12
- */
13
- readonly defaultChecked?: boolean;
14
- /**
15
- * Disables the checkbox.
16
- */
17
- readonly disabled?: boolean;
18
- /**
19
- * When `true` the checkbox to appears in indeterminate.
20
- *
21
- * @default false
22
- */
23
- readonly indeterminate?: boolean;
24
- /**
25
- * Checkbox input name
26
- */
27
- readonly name?: string;
28
- /**
29
- * Value of the checkbox.
30
- */
31
- readonly value?: string;
32
- /**
33
- * Further description of the label
34
- */
35
- readonly description?: string;
36
- onChange?(newValue: boolean): void;
37
- onFocus?(): void;
38
- }
39
- interface CheckboxLabelProps extends BaseCheckboxProps {
40
- /**
41
- * Label that shows up beside the checkbox.
42
- */
43
- readonly label?: string;
44
- }
45
- interface CheckboxChildrenProps extends BaseCheckboxProps {
46
- /**
47
- * Component children, which shows up as a label
48
- */
49
- readonly children?: ReactElement;
50
- }
51
- type CheckboxProps = XOR<CheckboxLabelProps, CheckboxChildrenProps>;
52
- export declare function Checkbox({ checked, defaultChecked, disabled, label, name, value, indeterminate, description, children, onChange, onFocus, }: CheckboxProps): JSX.Element;
53
- export {};
1
+ import { CheckboxLegacyProps } from "./Checkbox.types";
2
+ export declare function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value, indeterminate, description, children, onBlur, onChange, onFocus, }: CheckboxLegacyProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { CheckboxRebuiltProps } from "./Checkbox.types";
2
+ export declare function CheckboxRebuilt({ checked, defaultChecked, disabled, label, name, value, indeterminate, description, id, onBlur, onChange, onFocus, }: CheckboxRebuiltProps): JSX.Element;
@@ -0,0 +1,91 @@
1
+ import { ReactElement } from "react";
2
+ import { XOR } from "ts-xor";
3
+ export interface BaseCheckboxProps {
4
+ /**
5
+ * Determines if the checkbox is checked or not.
6
+ */
7
+ readonly checked?: boolean;
8
+ /**
9
+ * Initial checked value of the checkbox. Only use this when you need to
10
+ * pre-populate the checked attribute that is not controlled by the component's
11
+ * state. If a state is controlling it, use the `checked` prop instead.
12
+ */
13
+ readonly defaultChecked?: boolean;
14
+ /**
15
+ * Disables the checkbox.
16
+ */
17
+ readonly disabled?: boolean;
18
+ /**
19
+ * When `true` the checkbox to appears in indeterminate.
20
+ *
21
+ * @default false
22
+ */
23
+ readonly indeterminate?: boolean;
24
+ /**
25
+ * Checkbox input name
26
+ */
27
+ readonly name?: string;
28
+ /**
29
+ * Value of the checkbox.
30
+ */
31
+ readonly value?: string;
32
+ /**
33
+ * Further description of the label
34
+ */
35
+ readonly description?: string;
36
+ /**
37
+ * ID for the checkbox input
38
+ */
39
+ readonly id?: string;
40
+ /**
41
+ * Called when the checkbox value changes
42
+ */
43
+ onChange?(newValue: boolean): void;
44
+ /**
45
+ * Called when the checkbox is focused
46
+ */
47
+ onFocus?(event: React.FocusEvent<HTMLInputElement>): void;
48
+ /**
49
+ * Called when the checkbox loses focus
50
+ */
51
+ onBlur?(event: React.FocusEvent<HTMLInputElement>): void;
52
+ }
53
+ interface CheckboxLabelProps extends BaseCheckboxProps {
54
+ /**
55
+ * Label that shows up beside the checkbox.
56
+ */
57
+ readonly label?: string;
58
+ }
59
+ interface CheckboxChildrenProps extends BaseCheckboxProps {
60
+ /**
61
+ * Component children, which shows up as a label
62
+ */
63
+ readonly children?: ReactElement;
64
+ }
65
+ export type CheckboxRebuiltProps = Omit<BaseCheckboxProps, "label" | "description" | "children" | "onChange"> & {
66
+ /**
67
+ * Label that shows up beside the checkbox.
68
+ * String will be rendered with the default markup.
69
+ * ReactElement will be rendered with provided positionining.
70
+ */
71
+ label?: string | ReactElement;
72
+ /**
73
+ * Additional description of the checkbox.
74
+ * String will be rendered with the default markup.
75
+ * ReactElement will be rendered with provided positioning.
76
+ */
77
+ description?: string | ReactElement;
78
+ /**
79
+ * Called when the checkbox value changes.
80
+ * Includes the change event as a second argument.
81
+ */
82
+ onChange?(newValue: boolean, event: React.ChangeEvent<HTMLInputElement>): void;
83
+ /**
84
+ * Version 2 is highly experimental, avoid using it unless you have talked with Atlantis first.
85
+ */
86
+ version: 2;
87
+ };
88
+ export type CheckboxLegacyProps = XOR<CheckboxLabelProps, CheckboxChildrenProps> & {
89
+ version?: 1;
90
+ };
91
+ export {};
@@ -1,15 +1,89 @@
1
1
  'use strict';
2
2
 
3
- var Checkbox = require('../Checkbox-cjs.js');
4
- require('../tslib.es6-cjs.js');
5
- require('react');
6
- require('classnames');
7
- require('react-hook-form');
8
- require('../Icon-cjs.js');
3
+ var React = require('react');
4
+ var tslib_es6 = require('../tslib.es6-cjs.js');
5
+ var classnames = require('classnames');
6
+ var reactHookForm = require('react-hook-form');
7
+ var Icon = require('../Icon-cjs.js');
8
+ var Text = require('../Text-cjs.js');
9
9
  require('@jobber/design');
10
- require('../Text-cjs.js');
11
10
  require('../Typography-cjs.js');
12
11
 
12
+ var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
13
13
 
14
+ function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, children, onBlur, onChange, onFocus, }) {
15
+ const { control, setValue, watch } = reactHookForm.useFormContext() != undefined
16
+ ? reactHookForm.useFormContext()
17
+ : // If there isn't a Form Context being provided, get a form for this field.
18
+ reactHookForm.useForm({ mode: "onTouched" });
19
+ const [identifier] = React.useState(React.useId());
20
+ /**
21
+ * Generate a name if one is not supplied, this is the name
22
+ * that will be used for react-hook-form and not neccessarily
23
+ * attached to the DOM
24
+ */
25
+ const [controlledName] = React.useState(name ? name : `generatedName--${identifier}`);
26
+ React.useEffect(() => {
27
+ if (value != undefined) {
28
+ setValue(controlledName, value);
29
+ }
30
+ }, [value, watch(controlledName)]);
31
+ const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
32
+ const inputClassName = classnames(styles.input, {
33
+ [styles.indeterminate]: indeterminate,
34
+ });
35
+ const iconName = indeterminate ? "minus2" : "checkmark";
36
+ const labelText = label ? React.createElement(Text.Text, null, label) : children;
37
+ return (React.createElement(reactHookForm.Controller, { control: control, name: controlledName, defaultValue: defaultChecked, render: (_a) => {
38
+ var _b = _a.field, { onChange: onControllerChange, name: controllerName } = _b, rest = tslib_es6.__rest(_b, ["onChange", "name"]);
39
+ const fieldProps = Object.assign(Object.assign({}, rest), { id: identifier, className: inputClassName, name: name && controllerName, onChange: handleChange, disabled: disabled });
40
+ return (React.createElement("div", { className: styles.checkBoxParent },
41
+ React.createElement("label", { className: wrapperClassName },
42
+ React.createElement("span", { className: styles.checkHolder },
43
+ React.createElement("input", Object.assign({}, fieldProps, { type: "checkbox", checked: checked, defaultChecked: defaultChecked, "aria-label": label, onChange: handleChange, onFocus: onFocus, onBlur: onBlur })),
44
+ React.createElement("span", { className: styles.checkBox },
45
+ React.createElement(Icon.Icon, { name: iconName, color: "surface" }))),
46
+ labelText && React.createElement("span", { className: styles.label }, labelText)),
47
+ description && (React.createElement("div", { className: styles.description },
48
+ React.createElement(Text.Text, { variation: "subdued", size: "small" }, description)))));
49
+ function handleChange(event) {
50
+ const newChecked = event.currentTarget.checked;
51
+ onChange && onChange(newChecked);
52
+ onControllerChange(event);
53
+ }
54
+ } }));
55
+ }
14
56
 
15
- exports.Checkbox = Checkbox.Checkbox;
57
+ function CheckboxRebuilt({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, }) {
58
+ const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
59
+ const inputClassName = classnames(styles.input, {
60
+ [styles.indeterminate]: indeterminate,
61
+ });
62
+ const iconName = indeterminate ? "minus2" : "checkmark";
63
+ const labelContent = typeof label === "string" ? React.createElement(Text.Text, null, label) : label;
64
+ const descriptionContent = typeof description === "string" ? (React.createElement(Text.Text, { size: "small", variation: "subdued" }, description)) : (description);
65
+ function handleChange(event) {
66
+ const newChecked = event.currentTarget.checked;
67
+ onChange === null || onChange === void 0 ? void 0 : onChange(newChecked, event);
68
+ }
69
+ return (React.createElement("div", { className: styles.checkBoxParent },
70
+ React.createElement("label", { className: wrapperClassName },
71
+ React.createElement("span", { className: styles.checkHolder },
72
+ React.createElement("input", { type: "checkbox", id: id, className: inputClassName, name: name, checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }),
73
+ React.createElement("span", { className: styles.checkBox },
74
+ React.createElement(Icon.Icon, { name: iconName, color: "surface" }))),
75
+ labelContent && React.createElement("span", { className: styles.label }, labelContent)),
76
+ description && (React.createElement("div", { className: styles.description }, descriptionContent))));
77
+ }
78
+
79
+ function isNewCheckboxProps(props) {
80
+ return props.version === 2;
81
+ }
82
+ function Checkbox(props) {
83
+ if (isNewCheckboxProps(props)) {
84
+ return React.createElement(CheckboxRebuilt, Object.assign({}, props));
85
+ }
86
+ return React.createElement(CheckboxLegacy, Object.assign({}, props));
87
+ }
88
+
89
+ exports.Checkbox = Checkbox;
@@ -1 +1,4 @@
1
- export { Checkbox } from "./Checkbox";
1
+ import { CheckboxLegacyProps, CheckboxRebuiltProps } from "./Checkbox.types";
2
+ type CheckboxShimProps = CheckboxLegacyProps | CheckboxRebuiltProps;
3
+ export declare function Checkbox(props: CheckboxShimProps): JSX.Element;
4
+ export type { CheckboxLegacyProps, CheckboxRebuiltProps };
@@ -1,9 +1,87 @@
1
- export { C as Checkbox } from '../Checkbox-es.js';
2
- import '../tslib.es6-es.js';
3
- import 'react';
4
- import 'classnames';
5
- import 'react-hook-form';
6
- import '../Icon-es.js';
1
+ import React, { useState, useId, useEffect } from 'react';
2
+ import { _ as __rest } from '../tslib.es6-es.js';
3
+ import classnames from 'classnames';
4
+ import { useFormContext, useForm, Controller } from 'react-hook-form';
5
+ import { I as Icon } from '../Icon-es.js';
6
+ import { T as Text } from '../Text-es.js';
7
7
  import '@jobber/design';
8
- import '../Text-es.js';
9
8
  import '../Typography-es.js';
9
+
10
+ var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
11
+
12
+ function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, children, onBlur, onChange, onFocus, }) {
13
+ const { control, setValue, watch } = useFormContext() != undefined
14
+ ? useFormContext()
15
+ : // If there isn't a Form Context being provided, get a form for this field.
16
+ useForm({ mode: "onTouched" });
17
+ const [identifier] = useState(useId());
18
+ /**
19
+ * Generate a name if one is not supplied, this is the name
20
+ * that will be used for react-hook-form and not neccessarily
21
+ * attached to the DOM
22
+ */
23
+ const [controlledName] = useState(name ? name : `generatedName--${identifier}`);
24
+ useEffect(() => {
25
+ if (value != undefined) {
26
+ setValue(controlledName, value);
27
+ }
28
+ }, [value, watch(controlledName)]);
29
+ const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
30
+ const inputClassName = classnames(styles.input, {
31
+ [styles.indeterminate]: indeterminate,
32
+ });
33
+ const iconName = indeterminate ? "minus2" : "checkmark";
34
+ const labelText = label ? React.createElement(Text, null, label) : children;
35
+ return (React.createElement(Controller, { control: control, name: controlledName, defaultValue: defaultChecked, render: (_a) => {
36
+ var _b = _a.field, { onChange: onControllerChange, name: controllerName } = _b, rest = __rest(_b, ["onChange", "name"]);
37
+ const fieldProps = Object.assign(Object.assign({}, rest), { id: identifier, className: inputClassName, name: name && controllerName, onChange: handleChange, disabled: disabled });
38
+ return (React.createElement("div", { className: styles.checkBoxParent },
39
+ React.createElement("label", { className: wrapperClassName },
40
+ React.createElement("span", { className: styles.checkHolder },
41
+ React.createElement("input", Object.assign({}, fieldProps, { type: "checkbox", checked: checked, defaultChecked: defaultChecked, "aria-label": label, onChange: handleChange, onFocus: onFocus, onBlur: onBlur })),
42
+ React.createElement("span", { className: styles.checkBox },
43
+ React.createElement(Icon, { name: iconName, color: "surface" }))),
44
+ labelText && React.createElement("span", { className: styles.label }, labelText)),
45
+ description && (React.createElement("div", { className: styles.description },
46
+ React.createElement(Text, { variation: "subdued", size: "small" }, description)))));
47
+ function handleChange(event) {
48
+ const newChecked = event.currentTarget.checked;
49
+ onChange && onChange(newChecked);
50
+ onControllerChange(event);
51
+ }
52
+ } }));
53
+ }
54
+
55
+ function CheckboxRebuilt({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, }) {
56
+ const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
57
+ const inputClassName = classnames(styles.input, {
58
+ [styles.indeterminate]: indeterminate,
59
+ });
60
+ const iconName = indeterminate ? "minus2" : "checkmark";
61
+ const labelContent = typeof label === "string" ? React.createElement(Text, null, label) : label;
62
+ const descriptionContent = typeof description === "string" ? (React.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description);
63
+ function handleChange(event) {
64
+ const newChecked = event.currentTarget.checked;
65
+ onChange === null || onChange === void 0 ? void 0 : onChange(newChecked, event);
66
+ }
67
+ return (React.createElement("div", { className: styles.checkBoxParent },
68
+ React.createElement("label", { className: wrapperClassName },
69
+ React.createElement("span", { className: styles.checkHolder },
70
+ React.createElement("input", { type: "checkbox", id: id, className: inputClassName, name: name, checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }),
71
+ React.createElement("span", { className: styles.checkBox },
72
+ React.createElement(Icon, { name: iconName, color: "surface" }))),
73
+ labelContent && React.createElement("span", { className: styles.label }, labelContent)),
74
+ description && (React.createElement("div", { className: styles.description }, descriptionContent))));
75
+ }
76
+
77
+ function isNewCheckboxProps(props) {
78
+ return props.version === 2;
79
+ }
80
+ function Checkbox(props) {
81
+ if (isNewCheckboxProps(props)) {
82
+ return React.createElement(CheckboxRebuilt, Object.assign({}, props));
83
+ }
84
+ return React.createElement(CheckboxLegacy, Object.assign({}, props));
85
+ }
86
+
87
+ export { Checkbox };
@@ -285,6 +285,10 @@ export interface DataListActionProps<T extends DataListObject> {
285
285
  * The URL to navigate to when the action is clicked.
286
286
  */
287
287
  readonly actionUrl?: string;
288
+ /**
289
+ * Determine if the action is always visible. It is not recommended to set this to true on more then one action.
290
+ */
291
+ readonly alwaysVisible?: boolean;
288
292
  }
289
293
  export interface DataListActionsProps<T extends DataListObject> {
290
294
  /**
@@ -29,7 +29,7 @@ require('../../../AnimatedSwitcher-cjs.js');
29
29
  require('framer-motion');
30
30
  require('../../../Button-cjs.js');
31
31
  require('react-router-dom');
32
- require('../../../Checkbox-cjs.js');
32
+ require('../../../Checkbox/index.cjs');
33
33
  require('../../../tslib.es6-cjs.js');
34
34
  require('react-hook-form');
35
35
  require('../../../DataList.module-cjs.js');
@@ -27,7 +27,7 @@ import '../../../AnimatedSwitcher-es.js';
27
27
  import 'framer-motion';
28
28
  import '../../../Button-es.js';
29
29
  import 'react-router-dom';
30
- import '../../../Checkbox-es.js';
30
+ import '../../../Checkbox/index.mjs';
31
31
  import '../../../tslib.es6-es.js';
32
32
  import 'react-hook-form';
33
33
  import '../../../DataList.module-es.js';
@@ -38,7 +38,7 @@ require('../../../Heading-cjs.js');
38
38
  require('../../../DataListLayoutContext-cjs2.js');
39
39
  require('../../../DataListItemActionsOverflow-cjs.js');
40
40
  require('../../../DataListActionsMenu-cjs.js');
41
- require('../../../Checkbox-cjs.js');
41
+ require('../../../Checkbox/index.cjs');
42
42
  require('../../../tslib.es6-cjs.js');
43
43
  require('react-hook-form');
44
44
  require('../../../useBatchSelect-cjs.js');
@@ -36,7 +36,7 @@ import '../../../Heading-es.js';
36
36
  import '../../../DataListLayoutContext-es2.js';
37
37
  import '../../../DataListItemActionsOverflow-es.js';
38
38
  import '../../../DataListActionsMenu-es.js';
39
- import '../../../Checkbox-es.js';
39
+ import '../../../Checkbox/index.mjs';
40
40
  import '../../../tslib.es6-es.js';
41
41
  import 'react-hook-form';
42
42
  import '../../../useBatchSelect-es.js';
@@ -39,7 +39,7 @@ require('../../../Heading-cjs.js');
39
39
  require('../../../DataListLayoutContext-cjs2.js');
40
40
  require('../../../DataListItemActionsOverflow-cjs.js');
41
41
  require('../../../DataListActionsMenu-cjs.js');
42
- require('../../../Checkbox-cjs.js');
42
+ require('../../../Checkbox/index.cjs');
43
43
  require('../../../tslib.es6-cjs.js');
44
44
  require('react-hook-form');
45
45
  require('../../../useBatchSelect-cjs.js');
@@ -37,7 +37,7 @@ import '../../../Heading-es.js';
37
37
  import '../../../DataListLayoutContext-es2.js';
38
38
  import '../../../DataListItemActionsOverflow-es.js';
39
39
  import '../../../DataListActionsMenu-es.js';
40
- import '../../../Checkbox-es.js';
40
+ import '../../../Checkbox/index.mjs';
41
41
  import '../../../tslib.es6-es.js';
42
42
  import 'react-hook-form';
43
43
  import '../../../useBatchSelect-es.js';
@@ -40,7 +40,7 @@ require('../../../Heading-cjs.js');
40
40
  require('../../../DataListLayoutContext-cjs2.js');
41
41
  require('../../../DataListItemActionsOverflow-cjs.js');
42
42
  require('../../../DataListActionsMenu-cjs.js');
43
- require('../../../Checkbox-cjs.js');
43
+ require('../../../Checkbox/index.cjs');
44
44
  require('../../../tslib.es6-cjs.js');
45
45
  require('react-hook-form');
46
46
  require('../../../useBatchSelect-cjs.js');
@@ -38,7 +38,7 @@ import '../../../Heading-es.js';
38
38
  import '../../../DataListLayoutContext-es2.js';
39
39
  import '../../../DataListItemActionsOverflow-es.js';
40
40
  import '../../../DataListActionsMenu-es.js';
41
- import '../../../Checkbox-es.js';
41
+ import '../../../Checkbox/index.mjs';
42
42
  import '../../../tslib.es6-es.js';
43
43
  import 'react-hook-form';
44
44
  import '../../../useBatchSelect-es.js';
@@ -49,7 +49,7 @@ require('../Heading-cjs.js');
49
49
  require('../DataListLayoutContext-cjs2.js');
50
50
  require('../DataListItemActionsOverflow-cjs.js');
51
51
  require('../DataListActionsMenu-cjs.js');
52
- require('../Checkbox-cjs.js');
52
+ require('../Checkbox/index.cjs');
53
53
  require('react-hook-form');
54
54
  require('../useBatchSelect-cjs.js');
55
55
  require('../DataListItemClickable-cjs.js');
@@ -47,7 +47,7 @@ import '../Heading-es.js';
47
47
  import '../DataListLayoutContext-es2.js';
48
48
  import '../DataListItemActionsOverflow-es.js';
49
49
  import '../DataListActionsMenu-es.js';
50
- import '../Checkbox-es.js';
50
+ import '../Checkbox/index.mjs';
51
51
  import 'react-hook-form';
52
52
  import '../useBatchSelect-es.js';
53
53
  import '../DataListItemClickable-es.js';
@@ -150,8 +150,11 @@ function getExposedActions(childrenArray, childCount = 2) {
150
150
  const firstNChildren = childrenArray.slice(0, childCount);
151
151
  return firstNChildren.reduce((result, child, i) => {
152
152
  const hasIcon = Boolean(child.props.icon);
153
- if (!hasIcon)
154
- return result; // If the child does not have an icon, continue.
153
+ const isAlwaysVisible = child.props.alwaysVisible; // If true, the child action will always be visible and not nested in the dropdown.
154
+ if (isAlwaysVisible === false ||
155
+ (isAlwaysVisible === undefined && !hasIcon)) {
156
+ return result;
157
+ }
155
158
  const isLastChildAdded = result.length === i;
156
159
  // If it's the first child or if the previous child was added, then add this child.
157
160
  if (i === 0 || (i < childCount && isLastChildAdded)) {
@@ -148,8 +148,11 @@ function getExposedActions(childrenArray, childCount = 2) {
148
148
  const firstNChildren = childrenArray.slice(0, childCount);
149
149
  return firstNChildren.reduce((result, child, i) => {
150
150
  const hasIcon = Boolean(child.props.icon);
151
- if (!hasIcon)
152
- return result; // If the child does not have an icon, continue.
151
+ const isAlwaysVisible = child.props.alwaysVisible; // If true, the child action will always be visible and not nested in the dropdown.
152
+ if (isAlwaysVisible === false ||
153
+ (isAlwaysVisible === undefined && !hasIcon)) {
154
+ return result;
155
+ }
153
156
  const isLastChildAdded = result.length === i;
154
157
  // If it's the first child or if the previous child was added, then add this child.
155
158
  if (i === 0 || (i < childCount && isLastChildAdded)) {
@@ -14,10 +14,11 @@ function DataListActions({ children, itemsToExpose = 2, }) {
14
14
  childrenArray.splice(0, exposedActions.length);
15
15
  return (React.createElement(React.Fragment, null,
16
16
  exposedActions.map(({ props }) => {
17
- if (props.visible && !props.visible(activeItem))
18
- return null;
19
- if (!props.icon)
17
+ const isVisible = props.visible ? props.visible(activeItem) : true;
18
+ const hasIconOrAlwaysVisible = props.icon || props.alwaysVisible;
19
+ if (!isVisible || !hasIconOrAlwaysVisible) {
20
20
  return null;
21
+ }
21
22
  function getActionLabel() {
22
23
  if (typeof props.label === "string") {
23
24
  return props.label;
@@ -27,6 +28,13 @@ function DataListActions({ children, itemsToExpose = 2, }) {
27
28
  }
28
29
  }
29
30
  const actionLabel = getActionLabel();
31
+ // If the action is always visible, we don't want a tooltip.
32
+ if (props.alwaysVisibled) {
33
+ return (React.createElement(Button.Button, { ariaLabel: actionLabel, key: props.label, icon: props.icon, label: actionLabel, onClick: () => {
34
+ var _a;
35
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
36
+ }, type: "secondary", variation: "subtle" }));
37
+ }
30
38
  return (React.createElement(Tooltip.Tooltip, { key: actionLabel, message: actionLabel },
31
39
  React.createElement(Button.Button, { icon: props.icon, ariaLabel: actionLabel, onClick: () => {
32
40
  var _a, _b;
@@ -12,10 +12,11 @@ function DataListActions({ children, itemsToExpose = 2, }) {
12
12
  childrenArray.splice(0, exposedActions.length);
13
13
  return (React.createElement(React.Fragment, null,
14
14
  exposedActions.map(({ props }) => {
15
- if (props.visible && !props.visible(activeItem))
16
- return null;
17
- if (!props.icon)
15
+ const isVisible = props.visible ? props.visible(activeItem) : true;
16
+ const hasIconOrAlwaysVisible = props.icon || props.alwaysVisible;
17
+ if (!isVisible || !hasIconOrAlwaysVisible) {
18
18
  return null;
19
+ }
19
20
  function getActionLabel() {
20
21
  if (typeof props.label === "string") {
21
22
  return props.label;
@@ -25,6 +26,13 @@ function DataListActions({ children, itemsToExpose = 2, }) {
25
26
  }
26
27
  }
27
28
  const actionLabel = getActionLabel();
29
+ // If the action is always visible, we don't want a tooltip.
30
+ if (props.alwaysVisibled) {
31
+ return (React.createElement(Button, { ariaLabel: actionLabel, key: props.label, icon: props.icon, label: actionLabel, onClick: () => {
32
+ var _a;
33
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
34
+ }, type: "secondary", variation: "subtle" }));
35
+ }
28
36
  return (React.createElement(Tooltip, { key: actionLabel, message: actionLabel },
29
37
  React.createElement(Button, { icon: props.icon, ariaLabel: actionLabel, onClick: () => {
30
38
  var _a, _b;
@@ -8,7 +8,7 @@ var classnames = require('classnames');
8
8
  var AnimatedSwitcher = require('./AnimatedSwitcher-cjs.js');
9
9
  var Text = require('./Text-cjs.js');
10
10
  var Button = require('./Button-cjs.js');
11
- var Checkbox = require('./Checkbox-cjs.js');
11
+ var Checkbox_index = require('./Checkbox/index.cjs');
12
12
  var DataList_module = require('./DataList.module-cjs.js');
13
13
  var DataListBulkActions = require('./DataListBulkActions-cjs.js');
14
14
  var useBatchSelect = require('./useBatchSelect-cjs.js');
@@ -27,7 +27,7 @@ function DataListHeaderCheckbox({ children }) {
27
27
  React.createElement("div", { className: classnames(DataList_module.styles.selectAllCheckbox, {
28
28
  [DataList_module.styles.visible]: canSelectAll,
29
29
  }) },
30
- React.createElement(Checkbox.Checkbox, { checked: isAllSelected(), indeterminate: isIndeterminate(), onChange: handleSelectAll },
30
+ React.createElement(Checkbox_index.Checkbox, { checked: isAllSelected(), indeterminate: isIndeterminate(), onChange: handleSelectAll },
31
31
  React.createElement("div", { className: DataList_module.styles.srOnly }, selectedLabel))),
32
32
  React.createElement(AnimatedSwitcher.AnimatedSwitcher, { switched: hasAtLeastOneSelected, initialChild: children, switchTo: React.createElement("div", { className: DataList_module.styles.batchSelectContainer },
33
33
  React.createElement("div", { className: DataList_module.styles.headerBatchSelect },
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  import { A as AnimatedSwitcher } from './AnimatedSwitcher-es.js';
7
7
  import { T as Text } from './Text-es.js';
8
8
  import { B as Button } from './Button-es.js';
9
- import { C as Checkbox } from './Checkbox-es.js';
9
+ import { Checkbox } from './Checkbox/index.mjs';
10
10
  import { s as styles } from './DataList.module-es.js';
11
11
  import { I as InternalDataListBulkActions } from './DataListBulkActions-es.js';
12
12
  import { u as useBatchSelect } from './useBatchSelect-es.js';
@@ -8,7 +8,7 @@ var DataListItemActions = require('./DataListItemActions-cjs.js');
8
8
  var DataListActionsMenu = require('./DataListActionsMenu-cjs.js');
9
9
  var DataListLayoutContext$1 = require('./DataListLayoutContext-cjs2.js');
10
10
  var DataList_utils = require('./DataList.utils-cjs.js');
11
- var Checkbox = require('./Checkbox-cjs.js');
11
+ var Checkbox_index = require('./Checkbox/index.cjs');
12
12
  var useBatchSelect = require('./useBatchSelect-cjs.js');
13
13
  var DataList_module = require('./DataList.module-cjs.js');
14
14
  var DataListItemClickable = require('./DataListItemClickable-cjs.js');
@@ -22,7 +22,7 @@ function DataListItemInternal({ children, item, }) {
22
22
  [DataList_module.styles.selected]: hasAtLeastOneSelected,
23
23
  }) },
24
24
  children,
25
- React.createElement(Checkbox.Checkbox, { checked: getIsChecked(), onChange: handleChange })));
25
+ React.createElement(Checkbox_index.Checkbox, { checked: getIsChecked(), onChange: handleChange })));
26
26
  function getIsChecked() {
27
27
  const isItemInSelectedIDs = selectedIDs.includes(item.id);
28
28
  // If we're in a "select all" state, the selectedID's becomes a list of
@@ -6,7 +6,7 @@ import { I as InternalDataListItemActions } from './DataListItemActions-es.js';
6
6
  import { D as DataListActionsMenu } from './DataListActionsMenu-es.js';
7
7
  import { D as DataListLayoutActionsContext } from './DataListLayoutContext-es2.js';
8
8
  import { d as generateListItemElement } from './DataList.utils-es.js';
9
- import { C as Checkbox } from './Checkbox-es.js';
9
+ import { Checkbox } from './Checkbox/index.mjs';
10
10
  import { u as useBatchSelect } from './useBatchSelect-es.js';
11
11
  import { s as styles } from './DataList.module-es.js';
12
12
  import { D as DataListItemClickable } from './DataListItemClickable-es.js';
@@ -1,6 +1,7 @@
1
1
  interface PresentedImage {
2
2
  title?: string;
3
3
  caption?: string;
4
+ alt?: string;
4
5
  url: string;
5
6
  }
6
7
  interface RequestCloseOptions {
@@ -13,7 +14,7 @@ interface LightBoxProps {
13
14
  readonly open: boolean;
14
15
  /**
15
16
  * Images is an array of objects defining a LightBox image. This object consists of
16
- * `title`, `caption` and `url`. `title` and `caption` are optional, `url` is
17
+ * `title`, `caption`, `alt` and `url`. `title`, `alt` and `caption` are optional, `url` is
17
18
  * required, for each image.
18
19
  */
19
20
  readonly images: PresentedImage[];