@cloudscape-design/components 3.0.671 → 3.0.672
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 +7 -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 +3 -3
- package/checkbox/internal.js.map +1 -1
- package/date-picker/interfaces.d.ts +1 -1
- package/date-picker/interfaces.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +1 -3
- package/date-range-picker/index.js.map +1 -1
- package/input/interfaces.d.ts +1 -1
- package/input/interfaces.js.map +1 -1
- package/internal/base-component/styles.scoped.css +5 -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 +2 -2
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/components/button-trigger/index.d.ts.map +1 -1
- package/internal/components/button-trigger/index.js +5 -2
- package/internal/components/button-trigger/index.js.map +1 -1
- package/internal/components/button-trigger/styles.css.js +11 -11
- package/internal/components/button-trigger/styles.scoped.css +26 -26
- package/internal/components/button-trigger/styles.selectors.js +11 -11
- package/internal/components/checkbox-icon/index.d.ts +2 -1
- package/internal/components/checkbox-icon/index.d.ts.map +1 -1
- package/internal/components/checkbox-icon/index.js +6 -2
- package/internal/components/checkbox-icon/index.js.map +1 -1
- package/internal/components/checkbox-icon/styles.css.js +9 -7
- package/internal/components/checkbox-icon/styles.scoped.css +11 -8
- package/internal/components/checkbox-icon/styles.selectors.js +9 -7
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.d.ts +1 -0
- package/internal/generated/styles/tokens.js +1 -0
- package/internal/generated/theming/index.cjs +33 -0
- package/internal/generated/theming/index.cjs.d.ts +8 -0
- package/internal/generated/theming/index.d.ts +8 -0
- package/internal/generated/theming/index.js +33 -0
- package/internal/manifest.json +1 -1
- package/multiselect/internal.d.ts.map +1 -1
- package/multiselect/internal.js +3 -3
- package/multiselect/internal.js.map +1 -1
- package/package.json +1 -1
- package/radio-group/interfaces.d.ts +6 -0
- package/radio-group/interfaces.d.ts.map +1 -1
- package/radio-group/interfaces.js.map +1 -1
- package/radio-group/internal.d.ts.map +1 -1
- package/radio-group/internal.js +3 -3
- package/radio-group/internal.js.map +1 -1
- package/radio-group/radio-button.d.ts +1 -0
- package/radio-group/radio-button.d.ts.map +1 -1
- package/radio-group/radio-button.js +7 -3
- package/radio-group/radio-button.js.map +1 -1
- package/radio-group/styles.css.js +10 -9
- package/radio-group/styles.scoped.css +19 -15
- package/radio-group/styles.selectors.js +10 -9
- package/select/interfaces.d.ts +5 -0
- package/select/interfaces.d.ts.map +1 -1
- package/select/interfaces.js.map +1 -1
- package/select/internal.d.ts.map +1 -1
- package/select/internal.js +2 -2
- package/select/internal.js.map +1 -1
- package/select/parts/trigger.d.ts +1 -0
- package/select/parts/trigger.d.ts.map +1 -1
- package/select/parts/trigger.js +2 -2
- package/select/parts/trigger.js.map +1 -1
- package/slider/interfaces.d.ts +6 -0
- package/slider/interfaces.d.ts.map +1 -1
- package/slider/interfaces.js.map +1 -1
- package/slider/internal.d.ts +1 -1
- package/slider/internal.d.ts.map +1 -1
- package/slider/internal.js +15 -6
- package/slider/internal.js.map +1 -1
- package/slider/styles.css.js +27 -25
- package/slider/styles.scoped.css +129 -62
- package/slider/styles.selectors.js +27 -25
- package/slider/tick-marks.d.ts +1 -0
- package/slider/tick-marks.d.ts.map +1 -1
- package/slider/tick-marks.js +2 -1
- package/slider/tick-marks.js.map +1 -1
- package/slider/utils.d.ts +1 -0
- package/slider/utils.d.ts.map +1 -1
- package/slider/utils.js +1 -0
- package/slider/utils.js.map +1 -1
- package/tiles/interfaces.d.ts +6 -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 +3 -3
- package/tiles/internal.js.map +1 -1
- package/tiles/styles.css.js +30 -29
- package/tiles/styles.scoped.css +75 -70
- package/tiles/styles.selectors.js +30 -29
- package/tiles/tile.d.ts +1 -0
- package/tiles/tile.d.ts.map +1 -1
- package/tiles/tile.js +4 -4
- package/tiles/tile.js.map +1 -1
- package/toggle/internal.d.ts.map +1 -1
- package/toggle/internal.js +4 -2
- package/toggle/internal.js.map +1 -1
- package/toggle/styles.css.js +10 -8
- package/toggle/styles.scoped.css +23 -14
- package/toggle/styles.selectors.js +10 -8
- package/token-group/dismiss-button.d.ts +1 -0
- package/token-group/dismiss-button.d.ts.map +1 -1
- package/token-group/dismiss-button.js +7 -2
- package/token-group/dismiss-button.js.map +1 -1
- package/token-group/interfaces.d.ts +5 -0
- package/token-group/interfaces.d.ts.map +1 -1
- package/token-group/interfaces.js.map +1 -1
- package/token-group/internal.d.ts +1 -1
- package/token-group/internal.d.ts.map +1 -1
- package/token-group/internal.js +2 -2
- package/token-group/internal.js.map +1 -1
- package/token-group/styles.css.js +10 -9
- package/token-group/styles.scoped.css +33 -19
- package/token-group/styles.selectors.js +10 -9
- package/token-group/token.d.ts +2 -1
- package/token-group/token.d.ts.map +1 -1
- package/token-group/token.js +3 -3
- package/token-group/token.js.map +1 -1
- package/top-navigation/1.0-beta/interfaces.d.ts +1 -1
- package/top-navigation/1.0-beta/interfaces.js.map +1 -1
- package/top-navigation/interfaces.d.ts +1 -1
- package/top-navigation/interfaces.js.map +1 -1
|
@@ -18,6 +18,13 @@ export interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlP
|
|
|
18
18
|
* receive focus.
|
|
19
19
|
*/
|
|
20
20
|
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies if the control is read-only, which prevents the
|
|
23
|
+
* user from modifying the value. Should be used only inside forms.
|
|
24
|
+
* A read-only control is still focusable.
|
|
25
|
+
* If both `readOnly` and `disabled` are set, `disabled` takes precedence.
|
|
26
|
+
*/
|
|
27
|
+
readOnly?: boolean;
|
|
21
28
|
/**
|
|
22
29
|
* Specifies the ID of the native form element. By default, it uses an automatically generated ID.
|
|
23
30
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-checkbox.d.ts","sourceRoot":"","sources":["../../../src/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
|
+
{"version":3,"file":"base-checkbox.d.ts","sourceRoot":"","sources":["../../../src/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;;;;;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":"","sources":["../../../src/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
|
+
{"version":3,"file":"base-checkbox.js","sourceRoot":"","sources":["../../../src/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 if the control is read-only, which prevents the\n * user from modifying the value. Should be used only inside forms.\n * A read-only control is still focusable.\n * If both `readOnly` and `disabled` are set, `disabled` takes precedence.\n */\n readOnly?: 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":"","sources":["../../../src/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;AAIlF,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":"","sources":["../../../src/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;AAIlF,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,gBAAgB,yFAoFrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/checkbox/internal.js
CHANGED
|
@@ -12,7 +12,7 @@ import CheckboxIcon from '../internal/components/checkbox-icon';
|
|
|
12
12
|
import { useFormFieldContext } from '../internal/context/form-field-context';
|
|
13
13
|
import { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';
|
|
14
14
|
const InternalCheckbox = React.forwardRef((_a, ref) => {
|
|
15
|
-
var { controlId, name, checked, disabled, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex: explicitTabIndex, showOutline, ariaControls, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "ariaRequired", "indeterminate", "children", "description", "ariaLabel", "onFocus", "onBlur", "onChange", "tabIndex", "showOutline", "ariaControls", "__internalRootRef"]);
|
|
15
|
+
var { controlId, name, checked, disabled, readOnly, ariaRequired, indeterminate, children, description, ariaLabel, onFocus, onBlur, onChange, tabIndex: explicitTabIndex, showOutline, ariaControls, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "readOnly", "ariaRequired", "indeterminate", "children", "description", "ariaLabel", "onFocus", "onBlur", "onChange", "tabIndex", "showOutline", "ariaControls", "__internalRootRef"]);
|
|
16
16
|
const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);
|
|
17
17
|
const baseProps = getBaseProps(rest);
|
|
18
18
|
const checkboxRef = useRef(null);
|
|
@@ -23,7 +23,7 @@ const InternalCheckbox = React.forwardRef((_a, ref) => {
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const { tabIndex } = useSingleTabStopNavigation(checkboxRef, { tabIndex: explicitTabIndex });
|
|
26
|
-
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),
|
|
26
|
+
return (React.createElement(AbstractSwitch, Object.assign({}, baseProps, { className: clsx(styles.root, baseProps.className), controlClassName: styles['checkbox-control'], outlineClassName: styles.outline, controlId: controlId, disabled: disabled, readOnly: readOnly, 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, "aria-disabled": readOnly && !disabled ? 'true' : undefined, tabIndex: tabIndex, onFocus: () => fireNonCancelableEvent(onFocus), onBlur: () => fireNonCancelableEvent(onBlur),
|
|
27
27
|
// empty handler to suppress React controllability warning
|
|
28
28
|
onChange: () => { } }))), onClick: () => {
|
|
29
29
|
var _a;
|
|
@@ -31,7 +31,7 @@ const InternalCheckbox = React.forwardRef((_a, ref) => {
|
|
|
31
31
|
fireNonCancelableEvent(onChange,
|
|
32
32
|
// for deterministic transitions "indeterminate" -> "checked" -> "unchecked"
|
|
33
33
|
indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false });
|
|
34
|
-
}, styledControl: React.createElement(CheckboxIcon, { checked: checked, indeterminate: indeterminate, disabled: disabled }), __internalRootRef: __internalRootRef })));
|
|
34
|
+
}, styledControl: React.createElement(CheckboxIcon, { checked: checked, indeterminate: indeterminate, disabled: disabled, readOnly: readOnly }), __internalRootRef: __internalRootRef })));
|
|
35
35
|
});
|
|
36
36
|
export default InternalCheckbox;
|
|
37
37
|
//# sourceMappingURL=internal.js.map
|
package/checkbox/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAA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+CACM,kBAAkB,IACtB,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,mBACK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,mBACjC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACzD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,MAAM,CAAC;YAC5C,0DAA0D;YAC1D,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,IAClB,CACH,EACD,OAAO,EAAE,GAAG,EAAE;;YACZ,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;YAC7B,sBAAsB,CACpB,QAAQ;YACR,4EAA4E;YAC5E,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CACtG,CAAC;QACJ,CAAC,EACD,aAAa,EACX,oBAAC,YAAY,IAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,EAE1G,iBAAiB,EAAE,iBAAiB,IACpC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. 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';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-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 readOnly,\n ariaRequired,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n tabIndex: explicitTabIndex,\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 const { tabIndex } = useSingleTabStopNavigation(checkboxRef, { tabIndex: explicitTabIndex });\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 readOnly={readOnly}\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 aria-disabled={readOnly && !disabled ? '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={\n <CheckboxIcon checked={checked} indeterminate={indeterminate} disabled={disabled} readOnly={readOnly} />\n }\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
|
|
@@ -26,7 +26,7 @@ export interface DatePickerProps extends BaseComponentProps, FormFieldValidation
|
|
|
26
26
|
*/
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
/**
|
|
29
|
-
* Specifies if the control is read
|
|
29
|
+
* Specifies if the control is read-only, which prevents the
|
|
30
30
|
* user from modifying the value but includes it in a form
|
|
31
31
|
* submission. A read-only control can receive focus.
|
|
32
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-picker/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 { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { CalendarProps } from '../calendar/interfaces';\n\nexport interface DatePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n CalendarProps {\n /**\n * Specifies the placeholder text rendered when the value is an empty string.\n */\n placeholder?: string;\n\n /**\n * Specifies a function that generates the `aria-label` for the 'open calendar' button. The `selectedDate` parameter is\n * a human-readable localised string representing the current value of the input.\n * (for example, ``selectedDate => 'Choose Date' + (selectedDate ? `, selected date is ${selectedDate}` : '')``)\n */\n openCalendarAriaLabel?: DatePickerProps.OpenCalendarAriaLabel;\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 if the control is read
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-picker/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 { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { CalendarProps } from '../calendar/interfaces';\n\nexport interface DatePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n CalendarProps {\n /**\n * Specifies the placeholder text rendered when the value is an empty string.\n */\n placeholder?: string;\n\n /**\n * Specifies a function that generates the `aria-label` for the 'open calendar' button. The `selectedDate` parameter is\n * a human-readable localised string representing the current value of the input.\n * (for example, ``selectedDate => 'Choose Date' + (selectedDate ? `, selected date is ${selectedDate}` : '')``)\n */\n openCalendarAriaLabel?: DatePickerProps.OpenCalendarAriaLabel;\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 if the control is read-only, which prevents the\n * user from modifying the value but includes it in a form\n * submission. A read-only control can receive focus.\n *\n * Do not use read-only inputs outside of a form.\n */\n readOnly?: boolean;\n\n /**\n * Indicates whether the control should be focused as\n * soon as the page loads, which enables the user to\n * start typing without having to manually focus the control. Don't\n * use this option on pages where the control may be\n * scrolled out of the viewport.\n */\n autoFocus?: boolean;\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 * Specifies whether to add `aria-required` to the native control.\n */\n ariaRequired?: boolean;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * An object containing all the necessary localized strings required by\n * the component.\n * @i18n\n */\n i18nStrings?: DatePickerProps.I18nStrings;\n}\n\nexport namespace DatePickerProps {\n export interface ChangeDetail {\n /**\n * The new value of this date-picker.\n */\n value: string;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface OpenCalendarAriaLabel {\n (selectedDate: string | null): string;\n }\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export type I18nStrings = CalendarProps.I18nStrings;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA8BpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAuEhC,QAAA,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA8BpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAuEhC,QAAA,MAAM,eAAe,uGA4PpB,CAAC;AAGF,eAAe,eAAe,CAAC"}
|
|
@@ -162,9 +162,7 @@ const DateRangePicker = React.forwardRef((_a, ref) => {
|
|
|
162
162
|
React.createElement(ButtonTrigger, { ref: triggerRef, id: controlId, invalid: invalid, warning: warning, ariaLabelledby: joinStrings(ariaLabelledby, triggerContentId), ariaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.ariaLabel, ariaDescribedby: ariaDescribedby, className: clsx(styles.label, {
|
|
163
163
|
[styles['label-enabled']]: !readOnly && !disabled,
|
|
164
164
|
}), hideCaret: true, onClick: () => {
|
|
165
|
-
|
|
166
|
-
setIsDropDownOpen(true);
|
|
167
|
-
}
|
|
165
|
+
setIsDropDownOpen(true);
|
|
168
166
|
}, disabled: disabled, readOnly: readOnly, ariaHasPopup: "dialog" },
|
|
169
167
|
React.createElement("span", { className: styles['trigger-flexbox'] },
|
|
170
168
|
React.createElement("span", { className: styles['icon-wrapper'] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CA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MAAM,CAAC,IAAI,CAChE,EACD,SAAS,EAAE,uBAAuB;QAElC,oBAAC,QAAQ,IACP,YAAY,EAAE,IAAI,EAClB,aAAa,EAAE,IAAI,EACnB,IAAI,EAAE,cAAc,EACpB,eAAe,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,EACtC,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,KAAK,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU;YAGtB,oBAAC,qBAAqB,QACnB,cAAc,IAAI,CACjB,oBAAC,uBAAuB,IACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAC1C,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,0BAA0B,EAAE,0BAA0B,GACtD,CACH,CACqB,CACf,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,eAAe,eAAe,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useEffect, useRef, useState } from 'react';\nimport styles from './styles.css.js';\nimport { DateRangePickerProps } from './interfaces';\nimport { normalizeLocale } from '../internal/utils/locale';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { KeyCode } from '../internal/keycode';\nimport clsx from 'clsx';\nimport { getBaseProps } from '../internal/base-component';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport InternalBox from '../box/internal';\nimport { DateRangePickerDropdown } from './dropdown';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport Dropdown from '../internal/components/dropdown';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport ButtonTrigger from '../internal/components/button-trigger';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport InternalIcon from '../icon/internal';\nimport { normalizeTimeOffset, shiftTimeOffset } from './time-offset';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { isDevelopment } from '../internal/is-development.js';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings/join-strings';\nimport { formatDateRange, isIsoDateOnly } from '../internal/utils/date-time';\nimport { useInternalI18n } from '../i18n/context';\nimport { formatValue } from './utils';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal.js';\n\nexport { DateRangePickerProps };\n\nfunction renderDateRange({\n locale,\n range,\n placeholder = '',\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset,\n timeOffset,\n}: {\n locale?: string;\n range: null | DateRangePickerProps.Value;\n placeholder?: string;\n formatRelativeRange: DateRangePickerProps.I18nStrings['formatRelativeRange'];\n absoluteFormat: DateRangePickerProps.AbsoluteFormat;\n hideTimeOffset?: boolean;\n timeOffset: { startDate?: number; endDate?: number };\n}) {\n if (!range) {\n return (\n <span className={styles['label-text']} aria-disabled={true}>\n {placeholder}\n </span>\n );\n }\n\n const formatted =\n range.type === 'relative' ? (\n formatRelativeRange?.(range) ?? ''\n ) : (\n <BreakSpaces\n text={formatDateRange({\n startDate: range.startDate,\n endDate: range.endDate,\n timeOffset,\n hideTimeOffset,\n format: absoluteFormat,\n locale,\n })}\n />\n );\n\n return (\n <InternalBox fontWeight=\"normal\" display=\"inline\" color=\"inherit\" variant=\"span\">\n {formatted}\n </InternalBox>\n );\n}\n\nfunction BreakSpaces({ text }: { text: string }) {\n const tokens = text.split(/( )/);\n return (\n <>\n {tokens.map((token, index) => (\n <React.Fragment key={index}>\n {token.length > 1 ? <span className={styles['label-token-nowrap']}>{token}</span> : token}\n {token === ' ' && <wbr />}\n </React.Fragment>\n ))}\n </>\n );\n}\n\nfunction isDateOnly(value: null | DateRangePickerProps.Value) {\n if (!value || value.type !== 'absolute') {\n return false;\n }\n return isIsoDateOnly(value.startDate) && isIsoDateOnly(value.endDate);\n}\n\nconst DateRangePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n value,\n placeholder,\n readOnly = false,\n disabled = false,\n onChange,\n onBlur,\n onFocus,\n relativeOptions = [],\n i18nStrings,\n isValidRange = () => ({ valid: true }),\n showClearButton = true,\n dateOnly = false,\n timeOffset,\n getTimeOffset,\n timeInputFormat = 'hh:mm:ss',\n expandToViewport = false,\n rangeSelectorMode = 'default',\n customAbsoluteRangeControl,\n absoluteFormat = 'iso',\n hideTimeOffset,\n ...rest\n }: DateRangePickerProps,\n ref: Ref<DateRangePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DateRangePicker', {\n props: {\n absoluteFormat,\n dateOnly,\n expandToViewport,\n rangeSelectorMode,\n readOnly,\n showClearButton,\n timeInputFormat,\n hideTimeOffset,\n },\n });\n checkControlled('DateRangePicker', 'value', value, 'onChange', onChange);\n\n const normalizedTimeOffset = normalizeTimeOffset(value, getTimeOffset, timeOffset);\n value = isDateOnly(value) ? value : shiftTimeOffset(value, normalizedTimeOffset);\n\n const baseProps = getBaseProps(rest);\n const { invalid, warning, controlId, ariaDescribedby, ariaLabelledby } = useFormFieldContext({\n ariaLabelledby: rest.ariaLabelledby ?? i18nStrings?.ariaLabelledby,\n ariaDescribedby: rest.ariaDescribedby ?? i18nStrings?.ariaDescribedby,\n ...rest,\n });\n const isSingleGrid = useMobile();\n\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n useForwardFocus(ref, triggerRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('date-range-picker-dropdown');\n const triggerContentId = useUniqueId('date-range-picker-trigger');\n\n useFocusTracker({ rootRef, onBlur, onFocus });\n\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n\n const normalizedLocale = normalizeLocale('DateRangePicker', locale);\n\n const closeDropdown = (focusTrigger = false) => {\n setIsDropDownOpen(false);\n if (focusTrigger) {\n triggerRef.current?.focus();\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape) {\n if (isDropDownOpen) {\n event.stopPropagation();\n }\n closeDropdown(true);\n }\n };\n\n const onClear = () => {\n fireNonCancelableEvent(onChange, { value: null });\n };\n\n const onApply = (newValue: null | DateRangePickerProps.Value): DateRangePickerProps.ValidationResult => {\n const validationResult = isValidRange(newValue);\n if (validationResult?.valid === false) {\n return validationResult;\n }\n\n if (isDevelopment) {\n if (newValue?.type === 'absolute') {\n const [startDateWithoutTime] = newValue.startDate.split('T');\n const [endDateWithoutTime] = newValue.endDate.split('T');\n if (!startDateWithoutTime || !endDateWithoutTime) {\n warnOnce(\n 'DateRangePicker',\n 'You have provided an `isValidRange` prop that did not catch a missing start or end date.'\n );\n }\n }\n }\n fireNonCancelableEvent(onChange, {\n value: formatValue(newValue, {\n dateOnly,\n timeOffset: normalizeTimeOffset(newValue, getTimeOffset, timeOffset),\n }),\n });\n return validationResult || { valid: true };\n };\n\n const prevDateOnly = usePrevious(dateOnly);\n useEffect(() => {\n if (prevDateOnly !== undefined && prevDateOnly !== dateOnly) {\n warnOnce(\n 'DateRangePicker',\n `The provided \\`dateOnly\\` flag has been changed from \"${prevDateOnly}\" to \"${dateOnly}\" which can lead to unexpected value format. Consider using separate components.`\n );\n }\n }, [prevDateOnly, dateOnly]);\n\n if (value && value.type !== 'absolute' && value.type !== 'relative') {\n warnOnce('DateRangePicker', 'You provided an invalid value. Reverting back to default.');\n value = null;\n }\n\n if (\n (value?.type === 'absolute' && rangeSelectorMode === 'relative-only') ||\n (value?.type === 'relative' && rangeSelectorMode === 'absolute-only')\n ) {\n warnOnce(\n 'DateRangePicker',\n 'The provided value does not correspond to the current range selector mode. Reverting back to default.'\n );\n value = null;\n }\n\n const i18n = useInternalI18n('date-range-picker');\n const formatRelativeRange = i18n(\n 'i18nStrings.formatRelativeRange',\n i18nStrings?.formatRelativeRange,\n format =>\n ({ amount, unit }) =>\n format({ amount, unit })\n );\n\n if (isDevelopment) {\n if (!formatRelativeRange && rangeSelectorMode !== 'absolute-only') {\n warnOnce(\n 'DateRangePicker',\n 'A function for i18nStrings.formatRelativeRange was not provided. Relative ranges will not be correctly rendered.'\n );\n }\n }\n\n const formattedDate: string | JSX.Element = renderDateRange({\n locale: normalizedLocale,\n range: value,\n placeholder,\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset,\n timeOffset: normalizedTimeOffset,\n });\n\n const trigger = (\n <div className={styles['trigger-wrapper']}>\n <ButtonTrigger\n ref={triggerRef}\n id={controlId}\n invalid={invalid}\n warning={warning}\n ariaLabelledby={joinStrings(ariaLabelledby, triggerContentId)}\n ariaLabel={i18nStrings?.ariaLabel}\n ariaDescribedby={ariaDescribedby}\n className={clsx(styles.label, {\n [styles['label-enabled']]: !readOnly && !disabled,\n })}\n hideCaret={true}\n onClick={() => {\n if (!readOnly && !disabled) {\n setIsDropDownOpen(true);\n }\n }}\n disabled={disabled}\n readOnly={readOnly}\n ariaHasPopup=\"dialog\"\n >\n <span className={styles['trigger-flexbox']}>\n <span className={styles['icon-wrapper']}>\n <InternalIcon name=\"calendar\" variant={disabled || readOnly ? 'disabled' : 'normal'} />\n </span>\n <span id={triggerContentId}>{formattedDate}</span>\n </span>\n </ButtonTrigger>\n </div>\n );\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(\n baseProps.className,\n styles.root,\n absoluteFormat === 'long-localized' && !dateOnly && styles.wide\n )}\n onKeyDown={onWrapperKeyDownHandler}\n >\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={() => closeDropdown()}\n trigger={trigger}\n stretchToTriggerWidth={false}\n expandToViewport={expandToViewport}\n dropdownId={dropdownId}\n >\n {/* Reset form field context to prevent a wrapper form field from labelling all inputs inside the dropdown. */}\n <ResetContextsForModal>\n {isDropDownOpen && (\n <DateRangePickerDropdown\n startOfWeek={startOfWeek}\n locale={normalizedLocale}\n isSingleGrid={isSingleGrid}\n onDropdownClose={() => closeDropdown(true)}\n value={value}\n showClearButton={showClearButton}\n isDateEnabled={isDateEnabled}\n i18nStrings={i18nStrings}\n onClear={onClear}\n onApply={onApply}\n relativeOptions={relativeOptions}\n isValidRange={isValidRange}\n dateOnly={dateOnly}\n timeInputFormat={timeInputFormat}\n rangeSelectorMode={rangeSelectorMode}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n customAbsoluteRangeControl={customAbsoluteRangeControl}\n />\n )}\n </ResetContextsForModal>\n </Dropdown>\n </div>\n );\n }\n);\n\napplyDisplayName(DateRangePicker, 'DateRangePicker');\nexport default DateRangePicker;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,eAAe,MAAM,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,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,eAAe,eAAe,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useEffect, useRef, useState } from 'react';\nimport styles from './styles.css.js';\nimport { DateRangePickerProps } from './interfaces';\nimport { normalizeLocale } from '../internal/utils/locale';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { KeyCode } from '../internal/keycode';\nimport clsx from 'clsx';\nimport { getBaseProps } from '../internal/base-component';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport InternalBox from '../box/internal';\nimport { DateRangePickerDropdown } from './dropdown';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport Dropdown from '../internal/components/dropdown';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport ButtonTrigger from '../internal/components/button-trigger';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport InternalIcon from '../icon/internal';\nimport { normalizeTimeOffset, shiftTimeOffset } from './time-offset';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { isDevelopment } from '../internal/is-development.js';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings/join-strings';\nimport { formatDateRange, isIsoDateOnly } from '../internal/utils/date-time';\nimport { useInternalI18n } from '../i18n/context';\nimport { formatValue } from './utils';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal.js';\n\nexport { DateRangePickerProps };\n\nfunction renderDateRange({\n locale,\n range,\n placeholder = '',\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset,\n timeOffset,\n}: {\n locale?: string;\n range: null | DateRangePickerProps.Value;\n placeholder?: string;\n formatRelativeRange: DateRangePickerProps.I18nStrings['formatRelativeRange'];\n absoluteFormat: DateRangePickerProps.AbsoluteFormat;\n hideTimeOffset?: boolean;\n timeOffset: { startDate?: number; endDate?: number };\n}) {\n if (!range) {\n return (\n <span className={styles['label-text']} aria-disabled={true}>\n {placeholder}\n </span>\n );\n }\n\n const formatted =\n range.type === 'relative' ? (\n formatRelativeRange?.(range) ?? ''\n ) : (\n <BreakSpaces\n text={formatDateRange({\n startDate: range.startDate,\n endDate: range.endDate,\n timeOffset,\n hideTimeOffset,\n format: absoluteFormat,\n locale,\n })}\n />\n );\n\n return (\n <InternalBox fontWeight=\"normal\" display=\"inline\" color=\"inherit\" variant=\"span\">\n {formatted}\n </InternalBox>\n );\n}\n\nfunction BreakSpaces({ text }: { text: string }) {\n const tokens = text.split(/( )/);\n return (\n <>\n {tokens.map((token, index) => (\n <React.Fragment key={index}>\n {token.length > 1 ? <span className={styles['label-token-nowrap']}>{token}</span> : token}\n {token === ' ' && <wbr />}\n </React.Fragment>\n ))}\n </>\n );\n}\n\nfunction isDateOnly(value: null | DateRangePickerProps.Value) {\n if (!value || value.type !== 'absolute') {\n return false;\n }\n return isIsoDateOnly(value.startDate) && isIsoDateOnly(value.endDate);\n}\n\nconst DateRangePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n value,\n placeholder,\n readOnly = false,\n disabled = false,\n onChange,\n onBlur,\n onFocus,\n relativeOptions = [],\n i18nStrings,\n isValidRange = () => ({ valid: true }),\n showClearButton = true,\n dateOnly = false,\n timeOffset,\n getTimeOffset,\n timeInputFormat = 'hh:mm:ss',\n expandToViewport = false,\n rangeSelectorMode = 'default',\n customAbsoluteRangeControl,\n absoluteFormat = 'iso',\n hideTimeOffset,\n ...rest\n }: DateRangePickerProps,\n ref: Ref<DateRangePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DateRangePicker', {\n props: {\n absoluteFormat,\n dateOnly,\n expandToViewport,\n rangeSelectorMode,\n readOnly,\n showClearButton,\n timeInputFormat,\n hideTimeOffset,\n },\n });\n checkControlled('DateRangePicker', 'value', value, 'onChange', onChange);\n\n const normalizedTimeOffset = normalizeTimeOffset(value, getTimeOffset, timeOffset);\n value = isDateOnly(value) ? value : shiftTimeOffset(value, normalizedTimeOffset);\n\n const baseProps = getBaseProps(rest);\n const { invalid, warning, controlId, ariaDescribedby, ariaLabelledby } = useFormFieldContext({\n ariaLabelledby: rest.ariaLabelledby ?? i18nStrings?.ariaLabelledby,\n ariaDescribedby: rest.ariaDescribedby ?? i18nStrings?.ariaDescribedby,\n ...rest,\n });\n const isSingleGrid = useMobile();\n\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n useForwardFocus(ref, triggerRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('date-range-picker-dropdown');\n const triggerContentId = useUniqueId('date-range-picker-trigger');\n\n useFocusTracker({ rootRef, onBlur, onFocus });\n\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n\n const normalizedLocale = normalizeLocale('DateRangePicker', locale);\n\n const closeDropdown = (focusTrigger = false) => {\n setIsDropDownOpen(false);\n if (focusTrigger) {\n triggerRef.current?.focus();\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape) {\n if (isDropDownOpen) {\n event.stopPropagation();\n }\n closeDropdown(true);\n }\n };\n\n const onClear = () => {\n fireNonCancelableEvent(onChange, { value: null });\n };\n\n const onApply = (newValue: null | DateRangePickerProps.Value): DateRangePickerProps.ValidationResult => {\n const validationResult = isValidRange(newValue);\n if (validationResult?.valid === false) {\n return validationResult;\n }\n\n if (isDevelopment) {\n if (newValue?.type === 'absolute') {\n const [startDateWithoutTime] = newValue.startDate.split('T');\n const [endDateWithoutTime] = newValue.endDate.split('T');\n if (!startDateWithoutTime || !endDateWithoutTime) {\n warnOnce(\n 'DateRangePicker',\n 'You have provided an `isValidRange` prop that did not catch a missing start or end date.'\n );\n }\n }\n }\n fireNonCancelableEvent(onChange, {\n value: formatValue(newValue, {\n dateOnly,\n timeOffset: normalizeTimeOffset(newValue, getTimeOffset, timeOffset),\n }),\n });\n return validationResult || { valid: true };\n };\n\n const prevDateOnly = usePrevious(dateOnly);\n useEffect(() => {\n if (prevDateOnly !== undefined && prevDateOnly !== dateOnly) {\n warnOnce(\n 'DateRangePicker',\n `The provided \\`dateOnly\\` flag has been changed from \"${prevDateOnly}\" to \"${dateOnly}\" which can lead to unexpected value format. Consider using separate components.`\n );\n }\n }, [prevDateOnly, dateOnly]);\n\n if (value && value.type !== 'absolute' && value.type !== 'relative') {\n warnOnce('DateRangePicker', 'You provided an invalid value. Reverting back to default.');\n value = null;\n }\n\n if (\n (value?.type === 'absolute' && rangeSelectorMode === 'relative-only') ||\n (value?.type === 'relative' && rangeSelectorMode === 'absolute-only')\n ) {\n warnOnce(\n 'DateRangePicker',\n 'The provided value does not correspond to the current range selector mode. Reverting back to default.'\n );\n value = null;\n }\n\n const i18n = useInternalI18n('date-range-picker');\n const formatRelativeRange = i18n(\n 'i18nStrings.formatRelativeRange',\n i18nStrings?.formatRelativeRange,\n format =>\n ({ amount, unit }) =>\n format({ amount, unit })\n );\n\n if (isDevelopment) {\n if (!formatRelativeRange && rangeSelectorMode !== 'absolute-only') {\n warnOnce(\n 'DateRangePicker',\n 'A function for i18nStrings.formatRelativeRange was not provided. Relative ranges will not be correctly rendered.'\n );\n }\n }\n\n const formattedDate: string | JSX.Element = renderDateRange({\n locale: normalizedLocale,\n range: value,\n placeholder,\n formatRelativeRange,\n absoluteFormat,\n hideTimeOffset,\n timeOffset: normalizedTimeOffset,\n });\n\n const trigger = (\n <div className={styles['trigger-wrapper']}>\n <ButtonTrigger\n ref={triggerRef}\n id={controlId}\n invalid={invalid}\n warning={warning}\n ariaLabelledby={joinStrings(ariaLabelledby, triggerContentId)}\n ariaLabel={i18nStrings?.ariaLabel}\n ariaDescribedby={ariaDescribedby}\n className={clsx(styles.label, {\n [styles['label-enabled']]: !readOnly && !disabled,\n })}\n hideCaret={true}\n onClick={() => {\n setIsDropDownOpen(true);\n }}\n disabled={disabled}\n readOnly={readOnly}\n ariaHasPopup=\"dialog\"\n >\n <span className={styles['trigger-flexbox']}>\n <span className={styles['icon-wrapper']}>\n <InternalIcon name=\"calendar\" variant={disabled || readOnly ? 'disabled' : 'normal'} />\n </span>\n <span id={triggerContentId}>{formattedDate}</span>\n </span>\n </ButtonTrigger>\n </div>\n );\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n return (\n <div\n {...baseProps}\n ref={mergedRef}\n className={clsx(\n baseProps.className,\n styles.root,\n absoluteFormat === 'long-localized' && !dateOnly && styles.wide\n )}\n onKeyDown={onWrapperKeyDownHandler}\n >\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={() => closeDropdown()}\n trigger={trigger}\n stretchToTriggerWidth={false}\n expandToViewport={expandToViewport}\n dropdownId={dropdownId}\n >\n {/* Reset form field context to prevent a wrapper form field from labelling all inputs inside the dropdown. */}\n <ResetContextsForModal>\n {isDropDownOpen && (\n <DateRangePickerDropdown\n startOfWeek={startOfWeek}\n locale={normalizedLocale}\n isSingleGrid={isSingleGrid}\n onDropdownClose={() => closeDropdown(true)}\n value={value}\n showClearButton={showClearButton}\n isDateEnabled={isDateEnabled}\n i18nStrings={i18nStrings}\n onClear={onClear}\n onApply={onApply}\n relativeOptions={relativeOptions}\n isValidRange={isValidRange}\n dateOnly={dateOnly}\n timeInputFormat={timeInputFormat}\n rangeSelectorMode={rangeSelectorMode}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n customAbsoluteRangeControl={customAbsoluteRangeControl}\n />\n )}\n </ResetContextsForModal>\n </Dropdown>\n </div>\n );\n }\n);\n\napplyDisplayName(DateRangePicker, 'DateRangePicker');\nexport default DateRangePicker;\n"]}
|
package/input/interfaces.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface BaseInputProps {
|
|
|
22
22
|
*/
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Specifies if the control is read
|
|
25
|
+
* Specifies if the control is read-only, which prevents the
|
|
26
26
|
* user from modifying the value but includes it in a form
|
|
27
27
|
* submission. A read-only control can receive focus.
|
|
28
28
|
*
|
package/input/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/input/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 { BaseKeyDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseInputProps {\n /**\n * Specifies the text entered into the form element.\n */\n value: string;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies the placeholder text rendered when the value is an empty string.\n */\n placeholder?: 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 if the control is read
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/input/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 { BaseKeyDetail, CancelableEventHandler, NonCancelableEventHandler } from '../internal/events';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseInputProps {\n /**\n * Specifies the text entered into the form element.\n */\n value: string;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies the placeholder text rendered when the value is an empty string.\n */\n placeholder?: 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 if the control is read-only, which prevents the\n * user from modifying the value but includes it in a form\n * submission. A read-only control can receive focus.\n *\n * Don't use read-only inputs outside a form.\n */\n readOnly?: boolean;\n\n /**\n * Indicates whether the control should be focused as\n * soon as the page loads, which enables the user to\n * start typing without having to manually focus the control. Don't\n * use this option on pages where the control may be\n * scrolled out of the viewport.\n */\n autoFocus?: boolean;\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 * Specifies whether to add `aria-required` to the native control.\n */\n ariaRequired?: boolean;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Called whenever a user changes the input value (by typing or pasting).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<InputProps.ChangeDetail>;\n}\n\nexport interface InputAutoCorrect {\n /**\n * Specifies whether to disable browser autocorrect and related features.\n * If you set this to `true`, it disables any native browser capabilities\n * that automatically correct user input, such as `autocorrect` and\n * `autocapitalize`. If you don't set it, the behavior follows the default behavior\n * of the user's browser.\n */\n disableBrowserAutocorrect?: boolean;\n}\n\nexport interface InputAutoComplete {\n /**\n * Specifies whether to enable a browser's autocomplete functionality for this input.\n * In some cases it might be appropriate to disable autocomplete (for example, for security-sensitive fields).\n * To use it correctly, set the `name` property.\n *\n * You can either provide a boolean value to set the property to \"on\" or \"off\", or specify a string value\n * for the [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) attribute.\n */\n autoComplete?: boolean | string;\n}\n\nexport interface InputSpellcheck {\n /**\n * Specifies the value of the `spellcheck` attribute on the native control.\n * This value controls the native browser capability to check for spelling/grammar errors.\n * If not set, the browser default behavior is to perform spellchecking.\n * For more details, check the [spellcheck MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck).\n *\n * Enhanced spellchecking features of your browser and/or operating system may send input values to external parties.\n * Make sure it’s deactivated for fields with sensitive information to prevent\n * inadvertently sending data (such as user passwords) to third parties.\n */\n spellcheck?: boolean;\n}\n\nexport interface InputKeyEvents {\n /**\n * Called when the underlying native textarea emits a `keydown` event.\n * The event `detail` contains the `keyCode` and information\n * about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).\n */\n onKeyDown?: CancelableEventHandler<InputProps.KeyDetail>;\n\n /**\n * Called when the underlying native textarea emits a `keyup` event.\n * The event `detail` contains the `keyCode` and information\n * about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).\n */\n onKeyUp?: CancelableEventHandler<InputProps.KeyDetail>;\n}\n\nexport interface InputClearLabel {\n /**\n * Adds an `aria-label` to the clear button inside the search input.\n * @i18n\n */\n clearAriaLabel?: string;\n}\n\nexport interface InputProps\n extends BaseComponentProps,\n BaseInputProps,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n InputSpellcheck,\n InputClearLabel,\n FormFieldValidationControlProps {\n /**\n * Specifies the type of control to render.\n * Inputs with a `number` type use the native element behavior, which might\n * be slightly different across browsers.\n */\n type?: InputProps.Type;\n\n /**\n * Adds a hint to the browser about the type of data a user may enter into this field.\n * Some devices may render a different virtual keyboard depending on this value.\n * This value may not be supported by all browsers or devices.\n */\n inputMode?: InputProps.InputMode;\n\n /**\n * The step attribute is a number that specifies the granularity that the value\n * must adhere to or the keyword \"any\". It is valid for the numeric input types,\n * including the date, month, week, time, datetime-local, number and range types.\n */\n step?: InputProps.Step;\n}\n\nexport namespace InputProps {\n export type Type = 'text' | 'password' | 'search' | 'number' | 'email' | 'url';\n export type InputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n export type Step = number | 'any';\n\n export type ChangeDetail = BaseChangeDetail;\n export type KeyDetail = BaseKeyDetail;\n\n export interface Ref {\n /**\n * Sets input focus onto the UI control.\n */\n focus(): void;\n\n /**\n * Selects all text in the input control.\n */\n select(): void;\n }\n}\nexport interface BaseChangeDetail {\n value: string;\n}\n"]}
|
|
@@ -289,6 +289,7 @@
|
|
|
289
289
|
--color-border-tutorial-kk53ya:#d1d5db;
|
|
290
290
|
--color-foreground-control-default-wq2gpa:#ffffff;
|
|
291
291
|
--color-foreground-control-disabled-zmz2k2:#ffffff;
|
|
292
|
+
--color-foreground-control-read-only-ibiswj:#5f6b7a;
|
|
292
293
|
--color-shadow-default-8jp634:rgba(0, 7, 22, 0.12);
|
|
293
294
|
--color-stroke-chart-line-ppq5nh:#7d8998;
|
|
294
295
|
--color-text-accent-n2acxv:#0972d3;
|
|
@@ -890,6 +891,7 @@
|
|
|
890
891
|
--color-border-tutorial-kk53ya:#414d5c;
|
|
891
892
|
--color-foreground-control-default-wq2gpa:#000716;
|
|
892
893
|
--color-foreground-control-disabled-zmz2k2:#0f1b2a;
|
|
894
|
+
--color-foreground-control-read-only-ibiswj:#8d99a8;
|
|
893
895
|
--color-shadow-default-8jp634:rgba(0, 7, 22, 1);
|
|
894
896
|
--color-text-accent-n2acxv:#539fe5;
|
|
895
897
|
--color-text-body-default-at06ol:#b6bec9;
|
|
@@ -1187,6 +1189,7 @@
|
|
|
1187
1189
|
--color-border-tutorial-kk53ya:#414d5c;
|
|
1188
1190
|
--color-foreground-control-default-wq2gpa:#000716;
|
|
1189
1191
|
--color-foreground-control-disabled-zmz2k2:#0f1b2a;
|
|
1192
|
+
--color-foreground-control-read-only-ibiswj:#8d99a8;
|
|
1190
1193
|
--color-shadow-default-8jp634:rgba(0, 7, 22, 1);
|
|
1191
1194
|
--color-text-accent-n2acxv:#539fe5;
|
|
1192
1195
|
--color-text-body-default-at06ol:#b6bec9;
|
|
@@ -1382,6 +1385,7 @@
|
|
|
1382
1385
|
--color-border-tutorial-kk53ya:#414d5c;
|
|
1383
1386
|
--color-foreground-control-default-wq2gpa:#000716;
|
|
1384
1387
|
--color-foreground-control-disabled-zmz2k2:#0f1b2a;
|
|
1388
|
+
--color-foreground-control-read-only-ibiswj:#8d99a8;
|
|
1385
1389
|
--color-shadow-default-8jp634:rgba(0, 7, 22, 1);
|
|
1386
1390
|
--color-text-accent-n2acxv:#539fe5;
|
|
1387
1391
|
--color-text-body-default-at06ol:#b6bec9;
|
|
@@ -1675,6 +1679,7 @@
|
|
|
1675
1679
|
--color-border-tutorial-kk53ya:#414d5c;
|
|
1676
1680
|
--color-foreground-control-default-wq2gpa:#000716;
|
|
1677
1681
|
--color-foreground-control-disabled-zmz2k2:#0f1b2a;
|
|
1682
|
+
--color-foreground-control-read-only-ibiswj:#8d99a8;
|
|
1678
1683
|
--color-shadow-default-8jp634:rgba(0, 7, 22, 1);
|
|
1679
1684
|
--color-text-accent-n2acxv:#539fe5;
|
|
1680
1685
|
--color-text-body-default-at06ol:#b6bec9;
|
|
@@ -6,6 +6,7 @@ export interface AbstractSwitchProps extends React.HTMLAttributes<HTMLElement>,
|
|
|
6
6
|
outlineClassName: string;
|
|
7
7
|
showOutline?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
9
10
|
nativeControl: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactElement;
|
|
10
11
|
styledControl: React.ReactElement;
|
|
11
12
|
label?: React.ReactNode;
|
|
@@ -17,5 +18,5 @@ export interface AbstractSwitchProps extends React.HTMLAttributes<HTMLElement>,
|
|
|
17
18
|
ariaControls?: string;
|
|
18
19
|
onClick: () => void;
|
|
19
20
|
}
|
|
20
|
-
export default function AbstractSwitch({ controlId, controlClassName, outlineClassName, showOutline, disabled, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, ariaControls, onClick, __internalRootRef, ...rest }: AbstractSwitchProps): JSX.Element;
|
|
21
|
+
export default function AbstractSwitch({ controlId, controlClassName, outlineClassName, showOutline, disabled, readOnly, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, ariaControls, onClick, __internalRootRef, ...rest }: AbstractSwitchProps): JSX.Element;
|
|
21
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/abstract-switch/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,0BAA0B;IACxG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;IAC1F,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,KAAK,EACL,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,eAgErB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/abstract-switch/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,0BAA0B;IACxG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;IAC1F,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,aAAa,EACb,KAAK,EACL,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,mBAAmB,eAgErB"}
|
|
@@ -9,7 +9,7 @@ function joinString(values) {
|
|
|
9
9
|
return values.filter((value) => !!value).join(' ');
|
|
10
10
|
}
|
|
11
11
|
export default function AbstractSwitch(_a) {
|
|
12
|
-
var { controlId, controlClassName, outlineClassName, showOutline, disabled, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, ariaControls, onClick, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "controlClassName", "outlineClassName", "showOutline", "disabled", "nativeControl", "styledControl", "label", "description", "descriptionBottomPadding", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "ariaControls", "onClick", "__internalRootRef"]);
|
|
12
|
+
var { controlId, controlClassName, outlineClassName, showOutline, disabled, readOnly, nativeControl, styledControl, label, description, descriptionBottomPadding, ariaLabel, ariaLabelledby, ariaDescribedby, ariaControls, onClick, __internalRootRef } = _a, rest = __rest(_a, ["controlId", "controlClassName", "outlineClassName", "showOutline", "disabled", "readOnly", "nativeControl", "styledControl", "label", "description", "descriptionBottomPadding", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "ariaControls", "onClick", "__internalRootRef"]);
|
|
13
13
|
const uniqueId = useUniqueId();
|
|
14
14
|
const id = controlId || uniqueId;
|
|
15
15
|
const labelId = `${id}-label`;
|
|
@@ -29,7 +29,7 @@ export default function AbstractSwitch(_a) {
|
|
|
29
29
|
ariaDescriptions.push(descriptionId);
|
|
30
30
|
}
|
|
31
31
|
return (React.createElement("span", Object.assign({}, rest, { className: clsx(styles.wrapper, rest.className), ref: __internalRootRef }),
|
|
32
|
-
React.createElement("span", { className: styles['label-wrapper'], "aria-disabled": disabled ? 'true' : undefined, onClick: disabled ? undefined : onClick },
|
|
32
|
+
React.createElement("span", { className: styles['label-wrapper'], "aria-disabled": disabled ? 'true' : undefined, onClick: disabled || readOnly ? undefined : onClick },
|
|
33
33
|
React.createElement("span", { className: clsx(styles.control, controlClassName) },
|
|
34
34
|
styledControl,
|
|
35
35
|
nativeControl({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/abstract-switch/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/abstract-switch/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAsBxD,SAAS,UAAU,CAAC,MAA8B;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAmBjB;QAnBiB,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,aAAa,EACb,KAAK,EACL,WAAW,EACX,wBAAwB,EACxB,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,OAAO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C,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;oBACtF,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS;oBACvF,YAAY,EAAE,SAAS;oBACvB,eAAe,EAAE,YAAY;iBAC9B,CAAC;gBACF,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,GAAI,CAC7F;YACP,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;gBACrF,KAAK,IAAI,CACR,8BAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,IACvF,KAAK,CACD,CACR;gBACA,WAAW,IAAI,CACd,8BACE,EAAE,EAAE,aAAa,EACjB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;wBAClC,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,QAAQ;wBAC1C,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,EAAE,wBAAwB;qBACjE,CAAC,IAED,WAAW,CACP,CACR,CACI,CACF,CACF,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { useUniqueId } from '../../hooks/use-unique-id';\nimport { InternalBaseComponentProps } from '../../hooks/use-base-component/index.js';\n\nexport interface AbstractSwitchProps extends React.HTMLAttributes<HTMLElement>, InternalBaseComponentProps {\n controlId?: string;\n controlClassName: string;\n outlineClassName: string;\n showOutline?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n nativeControl: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactElement;\n styledControl: React.ReactElement;\n label?: React.ReactNode;\n description?: React.ReactNode;\n descriptionBottomPadding?: boolean;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n ariaControls?: string;\n onClick: () => void;\n}\n\nfunction joinString(values: (string | undefined)[]) {\n return values.filter((value): value is string => !!value).join(' ');\n}\n\nexport default function AbstractSwitch({\n controlId,\n controlClassName,\n outlineClassName,\n showOutline,\n disabled,\n readOnly,\n nativeControl,\n styledControl,\n label,\n description,\n descriptionBottomPadding,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaControls,\n onClick,\n __internalRootRef,\n ...rest\n}: AbstractSwitchProps) {\n const uniqueId = useUniqueId();\n const id = controlId || uniqueId;\n\n const labelId = `${id}-label`;\n const descriptionId = `${id}-description`;\n\n const ariaLabelledByIds = [];\n if (label && !ariaLabel) {\n ariaLabelledByIds.push(labelId);\n }\n if (ariaLabelledby) {\n ariaLabelledByIds.push(ariaLabelledby);\n }\n\n const ariaDescriptions = [];\n if (ariaDescribedby) {\n ariaDescriptions.push(ariaDescribedby);\n }\n if (description) {\n ariaDescriptions.push(descriptionId);\n }\n\n return (\n <span {...rest} className={clsx(styles.wrapper, rest.className)} ref={__internalRootRef}>\n <span\n className={styles['label-wrapper']}\n aria-disabled={disabled ? 'true' : undefined}\n onClick={disabled || readOnly ? undefined : onClick}\n >\n <span className={clsx(styles.control, controlClassName)}>\n {styledControl}\n {nativeControl({\n id,\n disabled,\n className: styles['native-input'],\n 'aria-describedby': ariaDescriptions.length ? joinString(ariaDescriptions) : undefined,\n 'aria-labelledby': ariaLabelledByIds.length ? joinString(ariaLabelledByIds) : undefined,\n 'aria-label': ariaLabel,\n 'aria-controls': ariaControls,\n })}\n <span className={clsx(styles.outline, outlineClassName, showOutline && styles['show-outline'])} />\n </span>\n <span className={clsx(styles.content, !label && !description && styles['empty-content'])}>\n {label && (\n <span id={labelId} className={clsx(styles.label, { [styles['label-disabled']]: disabled })}>\n {label}\n </span>\n )}\n {description && (\n <span\n id={descriptionId}\n className={clsx(styles.description, {\n [styles['description-disabled']]: disabled,\n [styles['description-bottom-padding']]: descriptionBottomPadding,\n })}\n >\n {description}\n </span>\n )}\n </span>\n </span>\n </span>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AAGxE,OAAO,EAA0C,sBAAsB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7G,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAClD,OAAO,CAAC,EA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C,aAAa,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,MAAM,CAAC,EAAE,sBAAsB,CAAC;QAAE,aAAa,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAChE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAoFD,yBAAiB,kBAAkB,CAAC;IAClC,UAAiB,GAAG;QAClB,KAAK,IAAI,IAAI,CAAC;KACf;CACF;;AAED,wBAA+C"}
|
|
@@ -10,14 +10,17 @@ import { fireKeyboardEvent, fireCancelableEvent } from '../../events';
|
|
|
10
10
|
const ButtonTrigger = (_a, ref) => {
|
|
11
11
|
var { children, pressed = false, hideCaret = false, disabled = false, readOnly = false, invalid = false, warning = false, inlineTokens, inFilteringToken, ariaHasPopup, ariaLabel, ariaLabelledby, ariaDescribedby, ariaControls, onKeyDown, onKeyUp, onMouseDown, onClick, onFocus, onBlur, autoFocus } = _a, restProps = __rest(_a, ["children", "pressed", "hideCaret", "disabled", "readOnly", "invalid", "warning", "inlineTokens", "inFilteringToken", "ariaHasPopup", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "ariaControls", "onKeyDown", "onKeyUp", "onMouseDown", "onClick", "onFocus", "onBlur", "autoFocus"]);
|
|
12
12
|
const baseProps = getBaseProps(restProps);
|
|
13
|
-
|
|
13
|
+
let attributes = Object.assign(Object.assign({}, baseProps), { type: 'button', className: clsx(styles['button-trigger'], baseProps.className, pressed && styles.pressed, disabled && styles.disabled, invalid && styles.invalid, warning && !invalid && styles.warning, !hideCaret && styles['has-caret'], readOnly && styles.readonly, inFilteringToken && styles['in-filtering-token'], inlineTokens && styles['inline-tokens']), disabled: disabled, 'aria-expanded': pressed, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'aria-haspopup': ariaHasPopup !== null && ariaHasPopup !== void 0 ? ariaHasPopup : 'listbox', 'aria-controls': ariaControls, 'aria-disabled': readOnly && !disabled ? 'true' : undefined, autoFocus });
|
|
14
|
+
if (!readOnly) {
|
|
15
|
+
attributes = Object.assign(Object.assign({}, attributes), { onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)), onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)), onMouseDown: onMouseDown && (event => fireCancelableEvent(onMouseDown, {}, event)), onClick: onClick && (event => fireCancelableEvent(onClick, {}, event)), onFocus: onFocus && (event => fireCancelableEvent(onFocus, {}, event)), onBlur: onBlur && (event => fireCancelableEvent(onBlur, { relatedTarget: event.relatedTarget }, event)) });
|
|
16
|
+
}
|
|
14
17
|
if (invalid) {
|
|
15
18
|
attributes['aria-invalid'] = invalid;
|
|
16
19
|
}
|
|
17
20
|
return (React.createElement("button", Object.assign({ ref: ref }, attributes),
|
|
18
21
|
children,
|
|
19
22
|
!hideCaret && (React.createElement("span", { className: styles.arrow },
|
|
20
|
-
React.createElement(InternalIcon, { name: "caret-down-filled", variant: disabled ? 'disabled' : 'normal' })))));
|
|
23
|
+
React.createElement(InternalIcon, { name: "caret-down-filled", variant: disabled || readOnly ? 'disabled' : 'normal' })))));
|
|
21
24
|
};
|
|
22
25
|
export default React.forwardRef(ButtonTrigger);
|
|
23
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAyC,MAAM,cAAc,CAAC;AA0B7G,MAAM,aAAa,GAAG,CACpB,EAuBqB,EACrB,GAAiC,EACjC,EAAE;QAzBF,EACE,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,KAAK,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,SAAS,EACT,OAAO,EACP,WAAW,EACX,OAAO,EACP,OAAO,EACP,MAAM,EACN,SAAS,OAEU,EADhB,SAAS,cAtBd,4RAuBC,CADa;IAId,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/button-trigger/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAyC,MAAM,cAAc,CAAC;AA0B7G,MAAM,aAAa,GAAG,CACpB,EAuBqB,EACrB,GAAiC,EACjC,EAAE;QAzBF,EACE,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,KAAK,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,SAAS,EACT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AChE,WAAW,EAAE,WAAW,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,WAAW,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EAClF,OAAO,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EACtE,OAAO,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EACtE,MAAM,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC,GACxG,CAAC;KACH;IAED,IAAI,OAAO,EAAE;QACX,UAAU,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC;KACtC;IAED,OAAO,CACL,8CAAQ,GAAG,EAAE,GAAG,IAAM,UAAU;QAC7B,QAAQ;QACR,CAAC,SAAS,IAAI,CACb,8BAAM,SAAS,EAAE,MAAM,CAAC,KAAK;YAC3B,oBAAC,YAAY,IAAC,IAAI,EAAC,mBAAmB,EAAC,OAAO,EAAE,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,GAAI,CAC3F,CACR,CACM,CACV,CAAC;AACJ,CAAC,CAAC;AAQF,eAAe,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ButtonHTMLAttributes } from 'react';\nimport clsx from 'clsx';\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport InternalIcon from '../../../icon/internal';\nimport styles from './styles.css.js';\nimport { fireKeyboardEvent, fireCancelableEvent, CancelableEventHandler, BaseKeyDetail } from '../../events';\n\nexport interface ButtonTriggerProps extends BaseComponentProps {\n children?: React.ReactNode;\n pressed?: boolean;\n hideCaret?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n warning?: boolean;\n inFilteringToken?: boolean;\n inlineTokens?: boolean;\n ariaHasPopup?: 'true' | 'listbox' | 'dialog';\n ariaControls?: string;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n onKeyDown?: CancelableEventHandler<BaseKeyDetail>;\n onKeyUp?: CancelableEventHandler<BaseKeyDetail>;\n onMouseDown?: CancelableEventHandler;\n onClick?: CancelableEventHandler;\n onFocus?: CancelableEventHandler;\n onBlur?: CancelableEventHandler<{ relatedTarget: Node | null }>;\n autoFocus?: boolean;\n}\n\nconst ButtonTrigger = (\n {\n children,\n pressed = false,\n hideCaret = false,\n disabled = false,\n readOnly = false,\n invalid = false,\n warning = false,\n inlineTokens,\n inFilteringToken,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaControls,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onClick,\n onFocus,\n onBlur,\n autoFocus,\n ...restProps\n }: ButtonTriggerProps,\n ref: React.Ref<HTMLButtonElement>\n) => {\n const baseProps = getBaseProps(restProps);\n let attributes: ButtonHTMLAttributes<HTMLButtonElement> = {\n ...baseProps,\n type: 'button',\n className: clsx(\n styles['button-trigger'],\n baseProps.className,\n pressed && styles.pressed,\n disabled && styles.disabled,\n invalid && styles.invalid,\n warning && !invalid && styles.warning,\n !hideCaret && styles['has-caret'],\n readOnly && styles.readonly,\n inFilteringToken && styles['in-filtering-token'],\n inlineTokens && styles['inline-tokens']\n ),\n disabled: disabled,\n 'aria-expanded': pressed,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-haspopup': ariaHasPopup ?? 'listbox',\n 'aria-controls': ariaControls,\n 'aria-disabled': readOnly && !disabled ? 'true' : undefined,\n autoFocus,\n };\n\n if (!readOnly) {\n attributes = {\n ...attributes,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n onMouseDown: onMouseDown && (event => fireCancelableEvent(onMouseDown, {}, event)),\n onClick: onClick && (event => fireCancelableEvent(onClick, {}, event)),\n onFocus: onFocus && (event => fireCancelableEvent(onFocus, {}, event)),\n onBlur: onBlur && (event => fireCancelableEvent(onBlur, { relatedTarget: event.relatedTarget }, event)),\n };\n }\n\n if (invalid) {\n attributes['aria-invalid'] = invalid;\n }\n\n return (\n <button ref={ref} {...attributes}>\n {children}\n {!hideCaret && (\n <span className={styles.arrow}>\n <InternalIcon name=\"caret-down-filled\" variant={disabled || readOnly ? 'disabled' : 'normal'} />\n </span>\n )}\n </button>\n );\n};\n\nexport namespace ButtonTriggerProps {\n export interface Ref {\n focus(): void;\n }\n}\n\nexport default React.forwardRef(ButtonTrigger);\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"button-trigger": "awsui_button-
|
|
5
|
-
"arrow": "
|
|
6
|
-
"has-caret": "awsui_has-
|
|
7
|
-
"placeholder": "
|
|
8
|
-
"pressed": "
|
|
9
|
-
"disabled": "
|
|
10
|
-
"in-filtering-token": "awsui_in-filtering-
|
|
11
|
-
"
|
|
12
|
-
"invalid": "
|
|
13
|
-
"warning": "
|
|
14
|
-
"inline-tokens": "awsui_inline-
|
|
4
|
+
"button-trigger": "awsui_button-trigger_18eso_m2fj5_101",
|
|
5
|
+
"arrow": "awsui_arrow_18eso_m2fj5_101",
|
|
6
|
+
"has-caret": "awsui_has-caret_18eso_m2fj5_168",
|
|
7
|
+
"placeholder": "awsui_placeholder_18eso_m2fj5_171",
|
|
8
|
+
"pressed": "awsui_pressed_18eso_m2fj5_184",
|
|
9
|
+
"disabled": "awsui_disabled_18eso_m2fj5_187",
|
|
10
|
+
"in-filtering-token": "awsui_in-filtering-token_18eso_m2fj5_197",
|
|
11
|
+
"readonly": "awsui_readonly_18eso_m2fj5_203",
|
|
12
|
+
"invalid": "awsui_invalid_18eso_m2fj5_225",
|
|
13
|
+
"warning": "awsui_warning_18eso_m2fj5_236",
|
|
14
|
+
"inline-tokens": "awsui_inline-tokens_18eso_m2fj5_274"
|
|
15
15
|
};
|
|
16
16
|
|