@cloudscape-design/components 3.0.277 → 3.0.279
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.
- package/checkbox/base-checkbox.d.ts +5 -0
- package/checkbox/base-checkbox.d.ts.map +1 -1
- package/checkbox/base-checkbox.js.map +1 -1
- package/checkbox/internal.d.ts.map +1 -1
- package/checkbox/internal.js +2 -2
- package/checkbox/internal.js.map +1 -1
- package/collection-preferences/content-display/styles.css.js +11 -11
- package/collection-preferences/content-display/styles.scoped.css +17 -18
- package/collection-preferences/content-display/styles.selectors.js +11 -11
- package/collection-preferences/index.d.ts +1 -1
- package/collection-preferences/index.d.ts.map +1 -1
- package/collection-preferences/index.js +6 -4
- package/collection-preferences/index.js.map +1 -1
- package/collection-preferences/interfaces.d.ts +42 -12
- package/collection-preferences/interfaces.d.ts.map +1 -1
- package/collection-preferences/interfaces.js.map +1 -1
- package/collection-preferences/styles.css.js +37 -32
- package/collection-preferences/styles.scoped.css +44 -40
- package/collection-preferences/styles.selectors.js +37 -32
- package/collection-preferences/utils.d.ts +12 -1
- package/collection-preferences/utils.d.ts.map +1 -1
- package/collection-preferences/utils.js +15 -1
- package/collection-preferences/utils.js.map +1 -1
- package/internal/base-component/styles.scoped.css +8 -0
- package/internal/components/abstract-switch/index.d.ts +2 -1
- package/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/internal/components/abstract-switch/index.js +6 -5
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/progress-bar/internal.d.ts.map +1 -1
- package/progress-bar/internal.js +1 -1
- package/progress-bar/internal.js.map +1 -1
- package/table/body-cell/styles.css.js +28 -23
- package/table/body-cell/styles.scoped.css +111 -55
- package/table/body-cell/styles.selectors.js +28 -23
- package/table/body-cell/td-element.d.ts +3 -0
- package/table/body-cell/td-element.d.ts.map +1 -1
- package/table/body-cell/td-element.js +16 -2
- package/table/body-cell/td-element.js.map +1 -1
- package/table/header-cell/index.d.ts +4 -1
- package/table/header-cell/index.d.ts.map +1 -1
- package/table/header-cell/index.js +9 -2
- package/table/header-cell/index.js.map +1 -1
- package/table/header-cell/styles.css.js +24 -19
- package/table/header-cell/styles.scoped.css +67 -32
- package/table/header-cell/styles.selectors.js +24 -19
- package/table/interfaces.d.ts +14 -0
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +19 -6
- package/table/internal.js.map +1 -1
- package/table/thead.d.ts +2 -0
- package/table/thead.d.ts.map +1 -1
- package/table/thead.js +12 -4
- package/table/thead.js.map +1 -1
- package/table/use-sticky-columns.d.ts.map +1 -1
- package/table/use-sticky-columns.js +5 -1
- package/table/use-sticky-columns.js.map +1 -1
- package/table/utils.d.ts +4 -0
- package/table/utils.d.ts.map +1 -1
- package/table/utils.js +8 -0
- package/table/utils.js.map +1 -1
- package/test-utils/dom/collection-preferences/index.d.ts +2 -0
- package/test-utils/dom/collection-preferences/index.js +6 -1
- package/test-utils/dom/collection-preferences/index.js.map +1 -1
- package/test-utils/dom/collection-preferences/sticky-columns-preference.d.ts +9 -0
- package/test-utils/dom/collection-preferences/sticky-columns-preference.js +23 -0
- package/test-utils/dom/collection-preferences/sticky-columns-preference.js.map +1 -0
- package/test-utils/selectors/collection-preferences/index.d.ts +2 -0
- package/test-utils/selectors/collection-preferences/index.js +6 -1
- package/test-utils/selectors/collection-preferences/index.js.map +1 -1
- package/test-utils/selectors/collection-preferences/sticky-columns-preference.d.ts +9 -0
- package/test-utils/selectors/collection-preferences/sticky-columns-preference.js +23 -0
- package/test-utils/selectors/collection-preferences/sticky-columns-preference.js.map +1 -0
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/tiles/interfaces.d.ts +5 -0
- package/tiles/interfaces.d.ts.map +1 -1
- package/tiles/interfaces.js.map +1 -1
- package/tiles/internal.d.ts.map +1 -1
- package/tiles/internal.js +2 -2
- package/tiles/internal.js.map +1 -1
- package/toggle/internal.d.ts.map +1 -1
- package/toggle/internal.js +2 -2
- package/toggle/internal.js.map +1 -1
|
@@ -41,5 +41,10 @@ export interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlP
|
|
|
41
41
|
* Description that appears below the label.
|
|
42
42
|
*/
|
|
43
43
|
description?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Adds `aria-controls` attribute to the component.
|
|
46
|
+
* If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.
|
|
47
|
+
*/
|
|
48
|
+
ariaControls?: string;
|
|
44
49
|
}
|
|
45
50
|
//# sourceMappingURL=base-checkbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-checkbox.d.ts","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,EAAE,qBAAqB;IAClF;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAEpC;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IAEnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"base-checkbox.d.ts","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,EAAE,qBAAqB;IAClF;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;IAEpC;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IAEnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-checkbox.js","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specifies if the component is selected.\n */\n checked: boolean;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies the ID of the native form element. By default, it uses an automatically generated ID.\n */\n controlId?: string;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n\n children?: React.ReactNode;\n\n /**\n * Description that appears below the label.\n */\n description?: React.ReactNode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-checkbox.js","sourceRoot":"lib/default/","sources":["checkbox/base-checkbox.tsx"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specifies if the component is selected.\n */\n checked: boolean;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies the ID of the native form element. By default, it uses an automatically generated ID.\n */\n controlId?: string;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n\n children?: React.ReactNode;\n\n /**\n * Description that appears below the label.\n */\n description?: React.ReactNode;\n\n /**\n * Adds `aria-controls` attribute to the component.\n * If the component controls any secondary content (for example, another form field), use this to provide an ID referring to the secondary content.\n */\n ariaControls?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,gBAAgB,yFA6ErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/checkbox/internal.js
CHANGED
|
@@ -11,7 +11,7 @@ import styles from './styles.css.js';
|
|
|
11
11
|
import CheckboxIcon from '../internal/components/checkbox-icon';
|
|
12
12
|
import { useFormFieldContext } from '../internal/context/form-field-context';
|
|
13
13
|
const InternalCheckbox = React.forwardRef((_a, ref) => {
|
|
14
|
-
var { controlId, name, checked, disabled, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex, showOutline, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "ariaRequired", "indeterminate", "children", "description", "ariaLabel", "onFocus", "onBlur", "onChange", "tabIndex", "showOutline", "__internalRootRef"]);
|
|
14
|
+
var { controlId, name, checked, disabled, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex, showOutline, ariaControls, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "ariaRequired", "indeterminate", "children", "description", "ariaLabel", "onFocus", "onBlur", "onChange", "tabIndex", "showOutline", "ariaControls", "__internalRootRef"]);
|
|
15
15
|
const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);
|
|
16
16
|
const baseProps = getBaseProps(rest);
|
|
17
17
|
const checkboxRef = useRef(null);
|
|
@@ -21,7 +21,7 @@ const InternalCheckbox = React.forwardRef((_a, ref) => {
|
|
|
21
21
|
checkboxRef.current.indeterminate = Boolean(indeterminate);
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, label: children, description: description, descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
|
|
24
|
+
return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, label: children, description: description, descriptionBottomPadding: true, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, showOutline: showOutline, nativeControl: nativeControlProps => (React.createElement("input", Object.assign({}, nativeControlProps, { ref: checkboxRef, type: "checkbox", checked: checked, name: name, "aria-required": ariaRequired ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
|
|
25
25
|
// empty handler to suppress React controllability warning
|
|
26
26
|
onChange: () => { } }))), onClick: () => {
|
|
27
27
|
var _a;
|
package/checkbox/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAO7E,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CACvC,CACE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,s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. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useEffect, useRef } from 'react';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { CheckboxProps } from './interfaces';\nimport styles from './styles.css.js';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n tabIndex?: -1;\n showOutline?: boolean;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n ariaRequired,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n tabIndex,\n showOutline,\n ariaControls,\n __internalRootRef,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={styles['checkbox-control']}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n showOutline={showOutline}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-required={ariaRequired ? 'true' : undefined}\n tabIndex={tabIndex}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n );\n }}\n styledControl={<CheckboxIcon checked={checked} indeterminate={indeterminate} disabled={disabled} />}\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"content-display-option-toggle": "awsui_content-display-option-
|
|
5
|
-
"content-display-option-content": "awsui_content-display-option-
|
|
6
|
-
"content-display-option": "awsui_content-display-
|
|
7
|
-
"placeholder": "
|
|
8
|
-
"sorting": "
|
|
9
|
-
"content-display-option-label": "awsui_content-display-option-
|
|
10
|
-
"drag-overlay": "awsui_drag-
|
|
11
|
-
"content-display": "awsui_content-
|
|
12
|
-
"content-display-title": "awsui_content-display-
|
|
13
|
-
"content-display-description": "awsui_content-display-
|
|
14
|
-
"content-display-option-list": "awsui_content-display-option-
|
|
4
|
+
"content-display-option-toggle": "awsui_content-display-option-toggle_1f3h0_140t9_185",
|
|
5
|
+
"content-display-option-content": "awsui_content-display-option-content_1f3h0_140t9_189",
|
|
6
|
+
"content-display-option": "awsui_content-display-option_1f3h0_140t9_185",
|
|
7
|
+
"placeholder": "awsui_placeholder_1f3h0_140t9_212",
|
|
8
|
+
"sorting": "awsui_sorting_1f3h0_140t9_212",
|
|
9
|
+
"content-display-option-label": "awsui_content-display-option-label_1f3h0_140t9_239",
|
|
10
|
+
"drag-overlay": "awsui_drag-overlay_1f3h0_140t9_247",
|
|
11
|
+
"content-display": "awsui_content-display_1f3h0_140t9_185",
|
|
12
|
+
"content-display-title": "awsui_content-display-title_1f3h0_140t9_274",
|
|
13
|
+
"content-display-description": "awsui_content-display-description_1f3h0_140t9_282",
|
|
14
|
+
"content-display-option-list": "awsui_content-display-option-list_1f3h0_140t9_290"
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -182,11 +182,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
182
182
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
183
183
|
SPDX-License-Identifier: Apache-2.0
|
|
184
184
|
*/
|
|
185
|
-
.awsui_content-display-option-
|
|
185
|
+
.awsui_content-display-option-toggle_1f3h0_140t9_185:not(#\9) {
|
|
186
186
|
/* used in test-utils */
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
.awsui_content-display-option-
|
|
189
|
+
.awsui_content-display-option-content_1f3h0_140t9_189:not(#\9) {
|
|
190
190
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
191
191
|
border-collapse: separate;
|
|
192
192
|
border-spacing: 0;
|
|
@@ -230,29 +230,28 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
230
230
|
border-radius: var(--border-radius-item-u2ibpi, 8px);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.awsui_content-display-
|
|
233
|
+
.awsui_content-display-option_1f3h0_140t9_185:not(#\9) {
|
|
234
234
|
list-style: none;
|
|
235
235
|
position: relative;
|
|
236
236
|
border-top: var(--border-divider-list-width-hacikr, 1px) solid var(--color-border-divider-default-7s2wjw, #e9ebed);
|
|
237
237
|
}
|
|
238
|
-
.awsui_content-display-
|
|
238
|
+
.awsui_content-display-option_1f3h0_140t9_185:not(#\9):not(.awsui_placeholder_1f3h0_140t9_212).awsui_sorting_1f3h0_140t9_212 {
|
|
239
239
|
transition: transform var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear);
|
|
240
|
-
z-index: 1;
|
|
241
240
|
}
|
|
242
241
|
@media (prefers-reduced-motion: reduce) {
|
|
243
|
-
.awsui_content-display-
|
|
242
|
+
.awsui_content-display-option_1f3h0_140t9_185:not(#\9):not(.awsui_placeholder_1f3h0_140t9_212).awsui_sorting_1f3h0_140t9_212 {
|
|
244
243
|
animation: none;
|
|
245
244
|
transition: none;
|
|
246
245
|
}
|
|
247
246
|
}
|
|
248
|
-
.awsui-motion-disabled .awsui_content-display-
|
|
247
|
+
.awsui-motion-disabled .awsui_content-display-option_1f3h0_140t9_185:not(#\9):not(.awsui_placeholder_1f3h0_140t9_212).awsui_sorting_1f3h0_140t9_212, .awsui-mode-entering .awsui_content-display-option_1f3h0_140t9_185:not(#\9):not(.awsui_placeholder_1f3h0_140t9_212).awsui_sorting_1f3h0_140t9_212 {
|
|
249
248
|
animation: none;
|
|
250
249
|
transition: none;
|
|
251
250
|
}
|
|
252
|
-
.awsui_content-display-
|
|
251
|
+
.awsui_content-display-option_1f3h0_140t9_185.awsui_placeholder_1f3h0_140t9_212 > .awsui_content-display-option-content_1f3h0_140t9_189:not(#\9) {
|
|
253
252
|
position: relative;
|
|
254
253
|
}
|
|
255
|
-
.awsui_content-display-
|
|
254
|
+
.awsui_content-display-option_1f3h0_140t9_185.awsui_placeholder_1f3h0_140t9_212 > .awsui_content-display-option-content_1f3h0_140t9_189:not(#\9):after {
|
|
256
255
|
content: " ";
|
|
257
256
|
position: absolute;
|
|
258
257
|
top: 0;
|
|
@@ -263,7 +262,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
263
262
|
border-radius: var(--border-radius-item-u2ibpi, 8px);
|
|
264
263
|
}
|
|
265
264
|
|
|
266
|
-
.awsui_content-display-option-
|
|
265
|
+
.awsui_content-display-option-label_1f3h0_140t9_239:not(#\9) {
|
|
267
266
|
flex-grow: 1;
|
|
268
267
|
min-width: 0;
|
|
269
268
|
-ms-word-break: break-all;
|
|
@@ -271,18 +270,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
271
270
|
padding-right: var(--space-l-4vl6xu, 20px);
|
|
272
271
|
}
|
|
273
272
|
|
|
274
|
-
.awsui_drag-
|
|
273
|
+
.awsui_drag-overlay_1f3h0_140t9_247:not(#\9) {
|
|
275
274
|
box-shadow: var(--shadow-container-active-l4kuxc, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
|
|
276
275
|
border-radius: var(--border-radius-item-u2ibpi, 8px);
|
|
277
276
|
}
|
|
278
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
277
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_140t9_247:not(#\9) {
|
|
279
278
|
position: relative;
|
|
280
279
|
}
|
|
281
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
280
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_140t9_247:not(#\9) {
|
|
282
281
|
outline: 2px dotted transparent;
|
|
283
282
|
outline-offset: calc(0px - 1px);
|
|
284
283
|
}
|
|
285
|
-
body[data-awsui-focus-visible=true] .awsui_drag-
|
|
284
|
+
body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_140t9_247:not(#\9)::before {
|
|
286
285
|
content: " ";
|
|
287
286
|
display: block;
|
|
288
287
|
position: absolute;
|
|
@@ -294,11 +293,11 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_e9tk2_248:not(#\9)
|
|
|
294
293
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
|
|
295
294
|
}
|
|
296
295
|
|
|
297
|
-
.awsui_content-
|
|
296
|
+
.awsui_content-display_1f3h0_140t9_185:not(#\9) {
|
|
298
297
|
/* used in test-utils */
|
|
299
298
|
}
|
|
300
299
|
|
|
301
|
-
.awsui_content-display-
|
|
300
|
+
.awsui_content-display-title_1f3h0_140t9_274:not(#\9) {
|
|
302
301
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
303
302
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
304
303
|
font-weight: var(--font-display-label-weight-m18hjh, 700);
|
|
@@ -306,7 +305,7 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_e9tk2_248:not(#\9)
|
|
|
306
305
|
margin: 0;
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
.awsui_content-display-
|
|
308
|
+
.awsui_content-display-description_1f3h0_140t9_282:not(#\9) {
|
|
310
309
|
color: var(--color-text-form-secondary-ih9x7l, #5f6b7a);
|
|
311
310
|
font-size: var(--font-body-s-size-ukw2p9, 12px);
|
|
312
311
|
line-height: var(--font-body-s-line-height-kdsbrl, 16px);
|
|
@@ -314,7 +313,7 @@ body[data-awsui-focus-visible=true] .awsui_drag-overlay_1f3h0_e9tk2_248:not(#\9)
|
|
|
314
313
|
margin-top: var(--space-scaled-xxxs-lo883m, 2px);
|
|
315
314
|
}
|
|
316
315
|
|
|
317
|
-
.awsui_content-display-option-
|
|
316
|
+
.awsui_content-display-option-list_1f3h0_140t9_290:not(#\9) {
|
|
318
317
|
position: relative;
|
|
319
318
|
list-style: none;
|
|
320
319
|
padding: 0;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"content-display-option-toggle": "awsui_content-display-option-
|
|
6
|
-
"content-display-option-content": "awsui_content-display-option-
|
|
7
|
-
"content-display-option": "awsui_content-display-
|
|
8
|
-
"placeholder": "
|
|
9
|
-
"sorting": "
|
|
10
|
-
"content-display-option-label": "awsui_content-display-option-
|
|
11
|
-
"drag-overlay": "awsui_drag-
|
|
12
|
-
"content-display": "awsui_content-
|
|
13
|
-
"content-display-title": "awsui_content-display-
|
|
14
|
-
"content-display-description": "awsui_content-display-
|
|
15
|
-
"content-display-option-list": "awsui_content-display-option-
|
|
5
|
+
"content-display-option-toggle": "awsui_content-display-option-toggle_1f3h0_140t9_185",
|
|
6
|
+
"content-display-option-content": "awsui_content-display-option-content_1f3h0_140t9_189",
|
|
7
|
+
"content-display-option": "awsui_content-display-option_1f3h0_140t9_185",
|
|
8
|
+
"placeholder": "awsui_placeholder_1f3h0_140t9_212",
|
|
9
|
+
"sorting": "awsui_sorting_1f3h0_140t9_212",
|
|
10
|
+
"content-display-option-label": "awsui_content-display-option-label_1f3h0_140t9_239",
|
|
11
|
+
"drag-overlay": "awsui_drag-overlay_1f3h0_140t9_247",
|
|
12
|
+
"content-display": "awsui_content-display_1f3h0_140t9_185",
|
|
13
|
+
"content-display-title": "awsui_content-display-title_1f3h0_140t9_274",
|
|
14
|
+
"content-display-description": "awsui_content-display-description_1f3h0_140t9_282",
|
|
15
|
+
"content-display-option-list": "awsui_content-display-option-list_1f3h0_140t9_290"
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CollectionPreferencesProps } from './interfaces';
|
|
3
3
|
export { CollectionPreferencesProps };
|
|
4
|
-
export default function CollectionPreferences({ title, confirmLabel, cancelLabel, disabled, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, preferences, customPreference, ...rest }: CollectionPreferencesProps): JSX.Element;
|
|
4
|
+
export default function CollectionPreferences({ title, confirmLabel, cancelLabel, disabled, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference, ...rest }: CollectionPreferencesProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";AAwBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAO1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EAEvB,WAAW,EACX,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,0BAA0B,eAoK5B"}
|
|
@@ -9,7 +9,7 @@ import InternalBox from '../box/internal';
|
|
|
9
9
|
import { InternalButton } from '../button/internal';
|
|
10
10
|
import InternalModal from '../modal/internal';
|
|
11
11
|
import InternalSpaceBetween from '../space-between/internal';
|
|
12
|
-
import { copyPreferences, mergePreferences, ModalContentLayout, PageSizePreference, WrapLinesPreference, StripedRowsPreference, ContentDensityPreference, CustomPreference, } from './utils';
|
|
12
|
+
import { copyPreferences, mergePreferences, ModalContentLayout, PageSizePreference, WrapLinesPreference, StripedRowsPreference, ContentDensityPreference, StickyColumnsPreference, CustomPreference, } from './utils';
|
|
13
13
|
import VisibleContentPreference from './visible-content';
|
|
14
14
|
import checkControlled from '../internal/hooks/check-controlled';
|
|
15
15
|
import styles from './styles.css.js';
|
|
@@ -19,9 +19,9 @@ import ContentDisplayPreference from './content-display';
|
|
|
19
19
|
import { warnOnce } from '../internal/logging';
|
|
20
20
|
const componentName = 'CollectionPreferences';
|
|
21
21
|
export default function CollectionPreferences(_a) {
|
|
22
|
-
var { title, confirmLabel, cancelLabel, disabled = false, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, preferences, customPreference } = _a, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "contentDisplayPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "preferences", "customPreference"]);
|
|
23
|
-
const { __internalRootRef } = useBaseComponent(
|
|
24
|
-
checkControlled(
|
|
22
|
+
var { title, confirmLabel, cancelLabel, disabled = false, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference } = _a, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "contentDisplayPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "stickyColumnsPreference", "preferences", "customPreference"]);
|
|
23
|
+
const { __internalRootRef } = useBaseComponent('CollectionPreferences');
|
|
24
|
+
checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);
|
|
25
25
|
const baseProps = getBaseProps(rest);
|
|
26
26
|
const [modalVisible, setModalVisible] = useState(false);
|
|
27
27
|
const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));
|
|
@@ -48,6 +48,7 @@ export default function CollectionPreferences(_a) {
|
|
|
48
48
|
wrapLinesPreference ||
|
|
49
49
|
stripedRowsPreference ||
|
|
50
50
|
contentDensityPreference ||
|
|
51
|
+
stickyColumnsPreference ||
|
|
51
52
|
customPreference);
|
|
52
53
|
const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);
|
|
53
54
|
const onChange = (changedPreferences) => setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));
|
|
@@ -68,6 +69,7 @@ export default function CollectionPreferences(_a) {
|
|
|
68
69
|
wrapLinesPreference && (React.createElement(WrapLinesPreference, Object.assign({ value: temporaryPreferences.wrapLines }, wrapLinesPreference, { onChange: wrapLines => onChange({ wrapLines }) }))),
|
|
69
70
|
stripedRowsPreference && (React.createElement(StripedRowsPreference, Object.assign({ value: temporaryPreferences.stripedRows }, stripedRowsPreference, { onChange: stripedRows => onChange({ stripedRows }) }))),
|
|
70
71
|
contentDensityPreference && (React.createElement(ContentDensityPreference, Object.assign({ value: temporaryPreferences.contentDensity }, contentDensityPreference, { onChange: contentDensity => onChange({ contentDensity }) }))),
|
|
72
|
+
stickyColumnsPreference && (React.createElement(StickyColumnsPreference, Object.assign({ value: temporaryPreferences.stickyColumns }, stickyColumnsPreference, { onChange: stickyColumns => onChange({ stickyColumns }) }))),
|
|
71
73
|
customPreference && (React.createElement(CustomPreference, { value: temporaryPreferences.custom, customPreference: customPreference, onChange: custom => onChange({ custom }) })))), right: contentDisplayPreference ? (React.createElement(ContentDisplayPreference, Object.assign({}, contentDisplayPreference, { value: temporaryPreferences.contentDisplay, onChange: contentDisplay => onChange({ contentDisplay }) }))) : (visibleContentPreference && (React.createElement(VisibleContentPreference, Object.assign({ value: temporaryPreferences.visibleContent }, visibleContentPreference, { onChange: visibleItems => onChange({ visibleContent: visibleItems }) })))) })))));
|
|
72
74
|
}
|
|
73
75
|
applyDisplayName(CollectionPreferences, componentName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,eAA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B,KAAK,EAAE,oBAAoB,CAAC,cAAc,IACtC,wBAAwB,IAC5B,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IACpE,CACH,CACF,GAEH,CACY,CACjB,CACG,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport {\n copyPreferences,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n WrapLinesPreference,\n StripedRowsPreference,\n ContentDensityPreference,\n CustomPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport ContentDisplayPreference from './content-display';\nimport { warnOnce } from '../internal/logging';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n preferences,\n customPreference,\n ...rest\n}: CollectionPreferencesProps) {\n const { __internalRootRef } = useBaseComponent(componentName);\n checkControlled(componentName, 'preferences', preferences, 'onConfirm', onConfirm);\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalButton\n ref={triggerRef}\n className={styles['trigger-button']}\n disabled={disabled}\n ariaLabel={title}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n header={title}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n >\n {cancelLabel}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n >\n {confirmLabel}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAA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uB,kBACtB,KAAK,EAAE,oBAAoB,CAAC,aAAa,IACrC,uBAAuB,IAC3B,QAAQ,EAAE,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC,IACtD,CACH;oBACA,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,IACf,KAAK,EAAE,oBAAoB,CAAC,MAAM,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,GACxC,CACH,CACoB,CACxB,EAEH,KAAK,EACH,wBAAwB,CAAC,CAAC,CAAC,CACzB,oBAAC,wBAAwB,oBACnB,wBAAwB,IAC5B,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAC1C,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,IACxD,CACH,CAAC,CAAC,CAAC,CACF,wBAAwB,IAAI,CAC1B,oBAAC,wBAAwB,kBACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,IACtC,wBAAwB,IAC5B,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IACpE,CACH,CACF,GAEH,CACY,CACjB,CACG,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport {\n copyPreferences,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n WrapLinesPreference,\n StripedRowsPreference,\n ContentDensityPreference,\n StickyColumnsPreference,\n CustomPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { CollectionPreferencesProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport ContentDisplayPreference from './content-display';\nimport { warnOnce } from '../internal/logging';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n stickyColumnsPreference,\n\n preferences,\n customPreference,\n ...rest\n}: CollectionPreferencesProps) {\n const { __internalRootRef } = useBaseComponent('CollectionPreferences');\n checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n stickyColumnsPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <InternalButton\n ref={triggerRef}\n className={styles['trigger-button']}\n disabled={disabled}\n ariaLabel={title}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n header={title}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n >\n {cancelLabel}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n >\n {confirmLabel}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {stickyColumnsPreference && (\n <StickyColumnsPreference\n value={temporaryPreferences.stickyColumns}\n {...stickyColumnsPreference}\n onChange={stickyColumns => onChange({ stickyColumns })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
|
|
@@ -68,6 +68,18 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
|
|
|
68
68
|
* You must set the current value in the `preferences.contentDensity` property.
|
|
69
69
|
*/
|
|
70
70
|
contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;
|
|
71
|
+
/**
|
|
72
|
+
* Configures the sticky columns preference.
|
|
73
|
+
*
|
|
74
|
+
* You can set it for both left and right columns.
|
|
75
|
+
*
|
|
76
|
+
* It contains the following:
|
|
77
|
+
* - `label` (string) - Specifies the label for each radio group.
|
|
78
|
+
* - `description` (string) - Specifies the text displayed below each radio group label.
|
|
79
|
+
*
|
|
80
|
+
* You must set the current value in the `preferences.stickyColumns` property.
|
|
81
|
+
*/
|
|
82
|
+
stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;
|
|
71
83
|
/**
|
|
72
84
|
* Configures the built-in content display preference for order and visibility of columns in a table.
|
|
73
85
|
*
|
|
@@ -162,16 +174,17 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
|
|
|
162
174
|
onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;
|
|
163
175
|
}
|
|
164
176
|
export declare namespace CollectionPreferencesProps {
|
|
165
|
-
interface Preferences<CustomPreferenceType = any> {
|
|
177
|
+
export interface Preferences<CustomPreferenceType = any> {
|
|
166
178
|
pageSize?: number;
|
|
167
179
|
wrapLines?: boolean;
|
|
168
180
|
stripedRows?: boolean;
|
|
169
181
|
contentDensity?: 'comfortable' | 'compact';
|
|
170
182
|
visibleContent?: ReadonlyArray<string>;
|
|
183
|
+
stickyColumns?: StickyColumns;
|
|
171
184
|
contentDisplay?: ReadonlyArray<ContentDisplayItem>;
|
|
172
185
|
custom?: CustomPreferenceType;
|
|
173
186
|
}
|
|
174
|
-
interface ContentDisplayPreference {
|
|
187
|
+
export interface ContentDisplayPreference {
|
|
175
188
|
title: string;
|
|
176
189
|
description?: string;
|
|
177
190
|
options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;
|
|
@@ -182,47 +195,64 @@ export declare namespace CollectionPreferencesProps {
|
|
|
182
195
|
dragHandleAriaLabel?: string;
|
|
183
196
|
dragHandleAriaDescription?: string;
|
|
184
197
|
}
|
|
185
|
-
interface ContentDisplayOption {
|
|
198
|
+
export interface ContentDisplayOption {
|
|
186
199
|
id: string;
|
|
187
200
|
label: string;
|
|
188
201
|
alwaysVisible?: boolean;
|
|
189
202
|
}
|
|
190
|
-
interface ContentDisplayItem {
|
|
203
|
+
export interface ContentDisplayItem {
|
|
191
204
|
id: string;
|
|
192
205
|
visible: boolean;
|
|
193
206
|
}
|
|
194
|
-
interface VisibleContentPreference {
|
|
207
|
+
export interface VisibleContentPreference {
|
|
195
208
|
title: string;
|
|
196
209
|
options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;
|
|
197
210
|
}
|
|
198
|
-
interface VisibleContentOptionsGroup {
|
|
211
|
+
export interface VisibleContentOptionsGroup {
|
|
199
212
|
label: string;
|
|
200
213
|
options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;
|
|
201
214
|
}
|
|
202
|
-
interface VisibleContentOption {
|
|
215
|
+
export interface VisibleContentOption {
|
|
203
216
|
id: string;
|
|
204
217
|
label: string;
|
|
205
218
|
editable?: boolean;
|
|
206
219
|
}
|
|
207
|
-
interface PageSizePreference {
|
|
220
|
+
export interface PageSizePreference {
|
|
208
221
|
title: string;
|
|
209
222
|
options: ReadonlyArray<PageSizeOption>;
|
|
210
223
|
}
|
|
211
|
-
interface PageSizeOption {
|
|
224
|
+
export interface PageSizeOption {
|
|
212
225
|
value: number;
|
|
213
226
|
label: string;
|
|
214
227
|
}
|
|
215
|
-
interface WrapLinesPreference {
|
|
228
|
+
export interface WrapLinesPreference {
|
|
216
229
|
label: string;
|
|
217
230
|
description: string;
|
|
218
231
|
}
|
|
219
|
-
interface StripedRowsPreference {
|
|
232
|
+
export interface StripedRowsPreference {
|
|
220
233
|
label: string;
|
|
221
234
|
description: string;
|
|
222
235
|
}
|
|
223
|
-
interface ContentDensityPreference {
|
|
236
|
+
export interface ContentDensityPreference {
|
|
224
237
|
label: string;
|
|
225
238
|
description: string;
|
|
226
239
|
}
|
|
240
|
+
interface StickyColumns {
|
|
241
|
+
first?: number;
|
|
242
|
+
last?: number;
|
|
243
|
+
}
|
|
244
|
+
interface StickyColumnPreference {
|
|
245
|
+
title: string;
|
|
246
|
+
description: string;
|
|
247
|
+
options: ReadonlyArray<{
|
|
248
|
+
label: string;
|
|
249
|
+
value: number;
|
|
250
|
+
}>;
|
|
251
|
+
}
|
|
252
|
+
export interface StickyColumnsPreference {
|
|
253
|
+
firstColumns?: StickyColumnPreference;
|
|
254
|
+
lastColumns?: StickyColumnPreference;
|
|
255
|
+
}
|
|
256
|
+
export {};
|
|
227
257
|
}
|
|
228
258
|
//# sourceMappingURL=interfa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wBAAwB;QACvC,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB;IAED,UAAU,aAAa;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAU,sBAAsB;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,aAAa,CAAC;YACrB,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;KACJ;IACD,MAAM,WAAW,uBAAuB;QACtC,YAAY,CAAC,EAAE,sBAAsB,CAAC;QACtC,WAAW,CAAC,EAAE,sBAAsB,CAAC;KACtC;;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n */\n title: string;\n /**\n * Label of the confirm button in the modal footer.\n */\n confirmLabel: string;\n /**\n * Label of the cancel button in the modal footer.\n */\n cancelLabel: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the built-in content display preference for order and visibility of columns in a table.\n *\n * Once set, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in \"visible content selection\" preference (for example, visible columns in a table).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an aray of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference {\n title: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label: string;\n }\n\n export interface WrapLinesPreference {\n label: string;\n description: string;\n }\n\n export interface StripedRowsPreference {\n label: string;\n description: string;\n }\n\n export interface ContentDensityPreference {\n label: string;\n description: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n */\n title: string;\n /**\n * Label of the confirm button in the modal footer.\n */\n confirmLabel: string;\n /**\n * Label of the cancel button in the modal footer.\n */\n cancelLabel: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the sticky columns preference.\n *\n * You can set it for both left and right columns.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for each radio group.\n * - `description` (string) - Specifies the text displayed below each radio group label.\n *\n * You must set the current value in the `preferences.stickyColumns` property.\n */\n stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;\n /**\n * Configures the built-in content display preference for order and visibility of columns in a table.\n *\n * Once set, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in \"visible content selection\" preference (for example, visible columns in a table).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an aray of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n stickyColumns?: StickyColumns;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference {\n title: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label: string;\n }\n\n export interface WrapLinesPreference {\n label: string;\n description: string;\n }\n\n export interface StripedRowsPreference {\n label: string;\n description: string;\n }\n\n export interface ContentDensityPreference {\n label: string;\n description: string;\n }\n\n interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n interface StickyColumnPreference {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n }\n export interface StickyColumnsPreference {\n firstColumns?: StickyColumnPreference;\n lastColumns?: StickyColumnPreference;\n }\n}\n"]}
|