@cloudscape-design/components-themeable 3.0.157 → 3.0.158
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/select/parts/styles.scss +9 -0
- package/lib/internal/scss/table/body-cell/styles.scss +131 -29
- package/lib/internal/scss/table/header-cell/styles.scss +15 -7
- package/lib/internal/template/breadcrumb-group/internal.d.ts +1 -1
- package/lib/internal/template/breadcrumb-group/internal.d.ts.map +1 -1
- package/lib/internal/template/breadcrumb-group/internal.js.map +1 -1
- package/lib/internal/template/button/internal.d.ts +1 -0
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +2 -2
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/form-field/interfaces.d.ts +10 -0
- package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
- package/lib/internal/template/form-field/interfaces.js.map +1 -1
- package/lib/internal/template/form-field/internal.d.ts +1 -1
- package/lib/internal/template/form-field/internal.d.ts.map +1 -1
- package/lib/internal/template/form-field/internal.js +5 -4
- package/lib/internal/template/form-field/internal.js.map +1 -1
- package/lib/internal/template/input/internal.d.ts.map +1 -1
- package/lib/internal/template/input/internal.js +16 -4
- package/lib/internal/template/input/internal.js.map +1 -1
- package/lib/internal/template/internal/context/form-field-context.d.ts +6 -2
- package/lib/internal/template/internal/context/form-field-context.d.ts.map +1 -1
- package/lib/internal/template/internal/context/form-field-context.js +7 -1
- package/lib/internal/template/internal/context/form-field-context.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/types.d.ts +9 -0
- package/lib/internal/template/internal/types.d.ts.map +1 -1
- package/lib/internal/template/internal/types.js +0 -2
- package/lib/internal/template/internal/types.js.map +1 -1
- package/lib/internal/template/select/parts/styles.css.js +9 -9
- package/lib/internal/template/select/parts/styles.scoped.css +27 -9
- package/lib/internal/template/select/parts/styles.selectors.js +9 -9
- package/lib/internal/template/table/body-cell/click-away.d.ts +9 -0
- package/lib/internal/template/table/body-cell/click-away.d.ts.map +1 -0
- package/lib/internal/template/table/body-cell/click-away.js +38 -0
- package/lib/internal/template/table/body-cell/click-away.js.map +1 -0
- package/lib/internal/template/table/body-cell/index.d.ts +11 -20
- package/lib/internal/template/table/body-cell/index.d.ts.map +1 -1
- package/lib/internal/template/table/body-cell/index.js +48 -9
- package/lib/internal/template/table/body-cell/index.js.map +1 -1
- package/lib/internal/template/table/body-cell/inline-editor.d.ts +12 -0
- package/lib/internal/template/table/body-cell/inline-editor.d.ts.map +1 -0
- package/lib/internal/template/table/body-cell/inline-editor.js +88 -0
- package/lib/internal/template/table/body-cell/inline-editor.js.map +1 -0
- package/lib/internal/template/table/body-cell/styles.css.js +18 -12
- package/lib/internal/template/table/body-cell/styles.scoped.css +229 -46
- package/lib/internal/template/table/body-cell/styles.selectors.js +18 -12
- package/lib/internal/template/table/body-cell/td-element.d.ts +21 -0
- package/lib/internal/template/table/body-cell/td-element.d.ts.map +1 -0
- package/lib/internal/template/table/body-cell/td-element.js +11 -0
- package/lib/internal/template/table/body-cell/td-element.js.map +1 -0
- package/lib/internal/template/table/body-cell/use-stable-scroll-position.d.ts +17 -0
- package/lib/internal/template/table/body-cell/use-stable-scroll-position.d.ts.map +1 -0
- package/lib/internal/template/table/body-cell/use-stable-scroll-position.js +48 -0
- package/lib/internal/template/table/body-cell/use-stable-scroll-position.js.map +1 -0
- package/lib/internal/template/table/header-cell/index.d.ts +8 -7
- package/lib/internal/template/table/header-cell/index.d.ts.map +1 -1
- package/lib/internal/template/table/header-cell/index.js +6 -2
- package/lib/internal/template/table/header-cell/index.js.map +1 -1
- package/lib/internal/template/table/header-cell/styles.css.js +19 -18
- package/lib/internal/template/table/header-cell/styles.scoped.css +40 -35
- package/lib/internal/template/table/header-cell/styles.selectors.js +19 -18
- package/lib/internal/template/table/header-cell/utils.d.ts +1 -1
- package/lib/internal/template/table/header-cell/utils.d.ts.map +1 -1
- package/lib/internal/template/table/interfaces.d.ts +85 -10
- package/lib/internal/template/table/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table/interfaces.js.map +1 -1
- package/lib/internal/template/table/internal.d.ts.map +1 -1
- package/lib/internal/template/table/internal.js +68 -18
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/table/thead.d.ts.map +1 -1
- package/lib/internal/template/table/thead.js +1 -1
- package/lib/internal/template/table/thead.js.map +1 -1
- package/lib/internal/template/table/use-table-focus-navigation.d.ts +16 -0
- package/lib/internal/template/table/use-table-focus-navigation.d.ts.map +1 -0
- package/lib/internal/template/table/use-table-focus-navigation.js +131 -0
- package/lib/internal/template/table/use-table-focus-navigation.js.map +1 -0
- package/lib/internal/template/table/utils.d.ts +1 -1
- package/lib/internal/template/table/utils.d.ts.map +1 -1
- package/lib/internal/template/test-utils/dom/table/index.d.ts +4 -0
- package/lib/internal/template/test-utils/dom/table/index.js +21 -5
- package/lib/internal/template/test-utils/dom/table/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/table/index.d.ts +4 -0
- package/lib/internal/template/test-utils/selectors/table/index.js +21 -5
- package/lib/internal/template/test-utils/selectors/table/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React, { useRef } from 'react';
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
7
7
|
import InternalIcon from '../icon/internal';
|
|
@@ -31,8 +31,14 @@ function InternalInput(_a, ref) {
|
|
|
31
31
|
__rightIcon = __rightIcon !== null && __rightIcon !== void 0 ? __rightIcon : searchProps.__rightIcon;
|
|
32
32
|
__onRightIconClick = __onRightIconClick !== null && __onRightIconClick !== void 0 ? __onRightIconClick : searchProps.__onRightIconClick;
|
|
33
33
|
var formFieldContext = useFormFieldContext(rest);
|
|
34
|
-
var _g = __inheritFormFieldProps
|
|
35
|
-
|
|
34
|
+
var _g = __inheritFormFieldProps
|
|
35
|
+
? formFieldContext
|
|
36
|
+
: __assign({ __useReactAutofocus: undefined }, rest), ariaLabelledby = _g.ariaLabelledby, ariaDescribedby = _g.ariaDescribedby, controlId = _g.controlId, invalid = _g.invalid, __useReactAutofocus = _g.__useReactAutofocus;
|
|
37
|
+
var autoFocusEnabled = (__nativeAttributes === null || __nativeAttributes === void 0 ? void 0 : __nativeAttributes.autoFocus) || autoFocus;
|
|
38
|
+
var reactAutofocusProps = __useReactAutofocus
|
|
39
|
+
? { autoFocus: !autoFocusEnabled, 'data-awsui-react-autofocus': autoFocusEnabled }
|
|
40
|
+
: {};
|
|
41
|
+
var attributes = __assign(__assign({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, name: name, placeholder: placeholder, autoFocus: autoFocus, id: controlId, className: clsx(styles.input, type && styles["input-type-".concat(type)], __rightIcon && styles['input-has-icon-right'], __leftIcon && styles['input-has-icon-left'], __noBorderRadius && styles['input-has-no-border-radius'], (_b = {},
|
|
36
42
|
_b[styles['input-readonly']] = readOnly,
|
|
37
43
|
_b[styles['input-invalid']] = invalid,
|
|
38
44
|
_b)), autoComplete: convertAutoComplete(autoComplete), disabled: disabled, readOnly: readOnly, type: type, step: step, inputMode: inputMode, spellCheck: spellcheck, onKeyDown: onKeyDown && (function (event) { return fireKeyboardEvent(onKeyDown, event); }), onKeyUp: onKeyUp && (function (event) { return fireKeyboardEvent(onKeyUp, event); }),
|
|
@@ -40,7 +46,7 @@ function InternalInput(_a, ref) {
|
|
|
40
46
|
value: value !== null && value !== void 0 ? value : '', onChange: onChange && (function (event) { return handleChange(event.target.value); }), onBlur: function (e) {
|
|
41
47
|
onBlur && fireNonCancelableEvent(onBlur);
|
|
42
48
|
__onBlurWithDetail && fireNonCancelableEvent(__onBlurWithDetail, { relatedTarget: e.relatedTarget });
|
|
43
|
-
}, onFocus: onFocus && (function () { return fireNonCancelableEvent(onFocus); }) }, __nativeAttributes);
|
|
49
|
+
}, onFocus: onFocus && (function () { return fireNonCancelableEvent(onFocus); }) }, __nativeAttributes), reactAutofocusProps);
|
|
44
50
|
if (type === 'number') {
|
|
45
51
|
// Chrome and Safari have a weird built-in behavior of letting focused
|
|
46
52
|
// number inputs be controlled by scrolling on them. However, they don't
|
|
@@ -64,6 +70,12 @@ function InternalInput(_a, ref) {
|
|
|
64
70
|
if (attributes.type === 'visualSearch') {
|
|
65
71
|
attributes.type = 'text';
|
|
66
72
|
}
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
var _a;
|
|
75
|
+
if (__useReactAutofocus && autoFocusEnabled) {
|
|
76
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
77
|
+
}
|
|
78
|
+
}, [__useReactAutofocus, autoFocusEnabled]);
|
|
67
79
|
return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles['input-container']), ref: __internalRootRef }),
|
|
68
80
|
__leftIcon && (React.createElement("span", { onClick: __onLeftIconClick, className: iconClassName('left', !!__onLeftIconClick) },
|
|
69
81
|
React.createElement(InternalIcon, { name: __leftIcon, variant: disabled ? 'disabled' : __leftIconVariant }))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAA0B,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,YAAY,MAAM,kBA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AC,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,GAAI,CACjF,CACR;QACD,wCAAO,GAAG,EAAE,SAAS,IAAM,UAAU,EAAI;QACxC,WAAW,IAAI,CACd,8BACE,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,gBAAgB,EAC7B,SAAS,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,kBAAkB,CAAC;YAEvD,oBAAC,YAAY,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,GAAI,CACnF,CACR,CACG,CACP,CAAC;AACJ,CAAC;AAED,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, { MouseEventHandler, Ref, useRef } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent, fireKeyboardEvent, NonCancelableEventHandler } from '../internal/events';\nimport { InputProps, BaseInputProps, InputAutoCorrect, BaseChangeDetail } from './interfaces';\nimport { BaseComponentProps, getBaseProps } from '../internal/base-component';\nimport { useSearchProps, convertAutoComplete } from './utils';\nimport { useDebounceCallback } from '../internal/hooks/use-debounce-callback';\nimport { FormFieldValidationControlProps, useFormFieldContext } from '../internal/context/form-field-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface InternalInputProps\n extends BaseComponentProps,\n BaseInputProps,\n Omit<InputProps, 'type'>,\n InputAutoCorrect,\n FormFieldValidationControlProps,\n InternalBaseComponentProps {\n type?: InputProps['type'] | 'visualSearch';\n __leftIcon?: IconProps['name'];\n __leftIconVariant?: IconProps['variant'];\n __onLeftIconClick?: () => void;\n\n __rightIcon?: IconProps['name'];\n __rightIconVariant?: IconProps['variant'];\n __onRightIconClick?: () => void;\n\n __nativeAttributes?: Record<string, any>;\n __noBorderRadius?: boolean;\n\n __onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;\n __onBlurWithDetail?: NonCancelableEventHandler<{ relatedTarget: Node | null }>;\n\n __inheritFormFieldProps?: boolean;\n}\n\nconst iconClassName = (position: string, hasHandler: boolean) =>\n clsx(styles['input-icon'], styles[`input-icon-${position}`], { [styles['input-icon-hoverable']]: hasHandler });\nconst preventMouseDown: MouseEventHandler = e => e.preventDefault();\n\nfunction InternalInput(\n {\n type = 'text',\n step,\n inputMode,\n autoComplete = true,\n ariaLabel,\n name,\n value,\n placeholder,\n autoFocus,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n spellcheck,\n __noBorderRadius,\n\n __leftIcon,\n __leftIconVariant = 'subtle',\n __onLeftIconClick,\n\n ariaRequired,\n\n __rightIcon,\n __rightIconVariant = 'normal',\n __onRightIconClick,\n\n onKeyDown,\n onKeyUp,\n onChange,\n __onDelayedInput,\n __onBlurWithDetail,\n onBlur,\n onFocus,\n __nativeAttributes,\n __internalRootRef,\n __inheritFormFieldProps,\n ...rest\n }: InternalInputProps,\n ref: Ref<HTMLInputElement>\n) {\n const baseProps = getBaseProps(rest);\n const fireDelayedInput = useDebounceCallback((value: string) => fireNonCancelableEvent(__onDelayedInput, { value }));\n\n const handleChange = (value: string) => {\n fireDelayedInput(value);\n fireNonCancelableEvent(onChange, { value });\n };\n\n const inputRef = useRef<HTMLInputElement>(null);\n const searchProps = useSearchProps(type, disabled, readOnly, value, inputRef, handleChange);\n __leftIcon = __leftIcon ?? searchProps.__leftIcon;\n __rightIcon = __rightIcon ?? searchProps.__rightIcon;\n __onRightIconClick = __onRightIconClick ?? searchProps.__onRightIconClick;\n\n const formFieldContext = useFormFieldContext(rest);\n const { ariaLabelledby, ariaDescribedby, controlId, invalid } = __inheritFormFieldProps ? formFieldContext : rest;\n\n const attributes: React.InputHTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n name,\n placeholder,\n autoFocus,\n id: controlId,\n className: clsx(\n styles.input,\n type && styles[`input-type-${type}`],\n __rightIcon && styles['input-has-icon-right'],\n __leftIcon && styles['input-has-icon-left'],\n __noBorderRadius && styles['input-has-no-border-radius'],\n {\n [styles['input-readonly']]: readOnly,\n [styles['input-invalid']]: invalid,\n }\n ),\n autoComplete: convertAutoComplete(autoComplete),\n disabled,\n readOnly,\n type,\n step,\n inputMode,\n spellCheck: spellcheck,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value ?? '',\n onChange: onChange && (event => handleChange(event.target.value)),\n onBlur: e => {\n onBlur && fireNonCancelableEvent(onBlur);\n __onBlurWithDetail && fireNonCancelableEvent(__onBlurWithDetail, { relatedTarget: e.relatedTarget });\n },\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n ...__nativeAttributes,\n };\n\n if (type === 'number') {\n // Chrome and Safari have a weird built-in behavior of letting focused\n // number inputs be controlled by scrolling on them. However, they don't\n // lock the browser's scroll, so it's very easy to accidentally increment\n // the input while scrolling down the page.\n attributes.onWheel = event => event.currentTarget.blur();\n }\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n // ensure aria properties are string literal \"true\"\n if (ariaRequired) {\n attributes['aria-required'] = 'true';\n }\n if (invalid) {\n attributes['aria-invalid'] = 'true';\n }\n\n const mergedRef = useMergeRefs(ref, inputRef);\n\n // type = \"visualSearch\" renders a type=\"text' input\n if (attributes.type === 'visualSearch') {\n attributes.type = 'text';\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles['input-container'])} ref={__internalRootRef}>\n {__leftIcon && (\n <span onClick={__onLeftIconClick} className={iconClassName('left', !!__onLeftIconClick)}>\n <InternalIcon name={__leftIcon} variant={disabled ? 'disabled' : __leftIconVariant} />\n </span>\n )}\n <input ref={mergedRef} {...attributes} />\n {__rightIcon && (\n <span\n onClick={__onRightIconClick}\n onMouseDown={preventMouseDown}\n className={iconClassName('right', !!__onRightIconClick)}\n >\n <InternalIcon name={__rightIcon} variant={disabled ? 'disabled' : __rightIconVariant} />\n </span>\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(InternalInput);\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAA0B,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAA6B,MAAM,oBAAoB,CAAC;AAE1G,OAAO,EAAsB,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAmC,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AA4B9G,IAAM,aAAa,GAAG,UAAC,QAAgB,EAAE,UAAmB;;IAC1D,OAAA,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,qBAAc,QAAQ,CAAE,CAAC,YAAI,GAAC,MAAM,CAAC,sBAAsB,CAAC,IAAG,UAAU,MAAG;AAA9G,CAA8G,CAAC;AACjH,IAAM,gBAAgB,GAAsB,UAAA,CAAC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;QACD,wCAAO,GAAG,EAAE,SAAS,IAAM,UAAU,EAAI;QACxC,WAAW,IAAI,CACd,8BACE,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,gBAAgB,EAC7B,SAAS,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,kBAAkB,CAAC;YAEvD,oBAAC,YAAY,IAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,GAAI,CACnF,CACR,CACG,CACP,CAAC;AACJ,CAAC;AAED,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, { MouseEventHandler, Ref, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { IconProps } from '../icon/interfaces';\nimport InternalIcon from '../icon/internal';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent, fireKeyboardEvent, NonCancelableEventHandler } from '../internal/events';\nimport { InputProps, BaseInputProps, InputAutoCorrect, BaseChangeDetail } from './interfaces';\nimport { BaseComponentProps, getBaseProps } from '../internal/base-component';\nimport { useSearchProps, convertAutoComplete } from './utils';\nimport { useDebounceCallback } from '../internal/hooks/use-debounce-callback';\nimport { FormFieldValidationControlProps, useFormFieldContext } from '../internal/context/form-field-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nexport interface InternalInputProps\n extends BaseComponentProps,\n BaseInputProps,\n Omit<InputProps, 'type'>,\n InputAutoCorrect,\n FormFieldValidationControlProps,\n InternalBaseComponentProps {\n type?: InputProps['type'] | 'visualSearch';\n __leftIcon?: IconProps['name'];\n __leftIconVariant?: IconProps['variant'];\n __onLeftIconClick?: () => void;\n\n __rightIcon?: IconProps['name'];\n __rightIconVariant?: IconProps['variant'];\n __onRightIconClick?: () => void;\n\n __nativeAttributes?: Record<string, any>;\n __noBorderRadius?: boolean;\n\n __onDelayedInput?: NonCancelableEventHandler<BaseChangeDetail>;\n __onBlurWithDetail?: NonCancelableEventHandler<{ relatedTarget: Node | null }>;\n\n __inheritFormFieldProps?: boolean;\n}\n\nconst iconClassName = (position: string, hasHandler: boolean) =>\n clsx(styles['input-icon'], styles[`input-icon-${position}`], { [styles['input-icon-hoverable']]: hasHandler });\nconst preventMouseDown: MouseEventHandler = e => e.preventDefault();\n\nfunction InternalInput(\n {\n type = 'text',\n step,\n inputMode,\n autoComplete = true,\n ariaLabel,\n name,\n value,\n placeholder,\n autoFocus,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n spellcheck,\n __noBorderRadius,\n\n __leftIcon,\n __leftIconVariant = 'subtle',\n __onLeftIconClick,\n\n ariaRequired,\n\n __rightIcon,\n __rightIconVariant = 'normal',\n __onRightIconClick,\n\n onKeyDown,\n onKeyUp,\n onChange,\n __onDelayedInput,\n __onBlurWithDetail,\n onBlur,\n onFocus,\n __nativeAttributes,\n __internalRootRef,\n __inheritFormFieldProps,\n ...rest\n }: InternalInputProps,\n ref: Ref<HTMLInputElement>\n) {\n const baseProps = getBaseProps(rest);\n const fireDelayedInput = useDebounceCallback((value: string) => fireNonCancelableEvent(__onDelayedInput, { value }));\n\n const handleChange = (value: string) => {\n fireDelayedInput(value);\n fireNonCancelableEvent(onChange, { value });\n };\n\n const inputRef = useRef<HTMLInputElement>(null);\n const searchProps = useSearchProps(type, disabled, readOnly, value, inputRef, handleChange);\n __leftIcon = __leftIcon ?? searchProps.__leftIcon;\n __rightIcon = __rightIcon ?? searchProps.__rightIcon;\n __onRightIconClick = __onRightIconClick ?? searchProps.__onRightIconClick;\n\n const formFieldContext = useFormFieldContext(rest);\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, __useReactAutofocus } = __inheritFormFieldProps\n ? formFieldContext\n : { __useReactAutofocus: undefined, ...rest };\n\n const autoFocusEnabled = __nativeAttributes?.autoFocus || autoFocus;\n const reactAutofocusProps = __useReactAutofocus\n ? { autoFocus: !autoFocusEnabled, 'data-awsui-react-autofocus': autoFocusEnabled }\n : {};\n\n const attributes: React.InputHTMLAttributes<HTMLInputElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n name,\n placeholder,\n autoFocus,\n id: controlId,\n className: clsx(\n styles.input,\n type && styles[`input-type-${type}`],\n __rightIcon && styles['input-has-icon-right'],\n __leftIcon && styles['input-has-icon-left'],\n __noBorderRadius && styles['input-has-no-border-radius'],\n {\n [styles['input-readonly']]: readOnly,\n [styles['input-invalid']]: invalid,\n }\n ),\n autoComplete: convertAutoComplete(autoComplete),\n disabled,\n readOnly,\n type,\n step,\n inputMode,\n spellCheck: spellcheck,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value ?? '',\n onChange: onChange && (event => handleChange(event.target.value)),\n onBlur: e => {\n onBlur && fireNonCancelableEvent(onBlur);\n __onBlurWithDetail && fireNonCancelableEvent(__onBlurWithDetail, { relatedTarget: e.relatedTarget });\n },\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n ...__nativeAttributes,\n ...reactAutofocusProps,\n };\n\n if (type === 'number') {\n // Chrome and Safari have a weird built-in behavior of letting focused\n // number inputs be controlled by scrolling on them. However, they don't\n // lock the browser's scroll, so it's very easy to accidentally increment\n // the input while scrolling down the page.\n attributes.onWheel = event => event.currentTarget.blur();\n }\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n // ensure aria properties are string literal \"true\"\n if (ariaRequired) {\n attributes['aria-required'] = 'true';\n }\n if (invalid) {\n attributes['aria-invalid'] = 'true';\n }\n\n const mergedRef = useMergeRefs(ref, inputRef);\n\n // type = \"visualSearch\" renders a type=\"text' input\n if (attributes.type === 'visualSearch') {\n attributes.type = 'text';\n }\n\n useEffect(() => {\n if (__useReactAutofocus && autoFocusEnabled) {\n inputRef.current?.focus({ preventScroll: true });\n }\n }, [__useReactAutofocus, autoFocusEnabled]);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles['input-container'])} ref={__internalRootRef}>\n {__leftIcon && (\n <span onClick={__onLeftIconClick} className={iconClassName('left', !!__onLeftIconClick)}>\n <InternalIcon name={__leftIcon} variant={disabled ? 'disabled' : __leftIconVariant} />\n </span>\n )}\n <input ref={mergedRef} {...attributes} />\n {__rightIcon && (\n <span\n onClick={__onRightIconClick}\n onMouseDown={preventMouseDown}\n className={iconClassName('right', !!__onRightIconClick)}\n >\n <InternalIcon name={__rightIcon} variant={disabled ? 'disabled' : __rightIconVariant} />\n </span>\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(InternalInput);\n"]}
|
|
@@ -39,6 +39,10 @@ export interface FormFieldValidationControlProps extends FormFieldControlProps {
|
|
|
39
39
|
*/
|
|
40
40
|
invalid?: boolean;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
interface InternalFormFieldControlProps extends FormFieldValidationControlProps {
|
|
43
|
+
__useReactAutofocus?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare const FormFieldContext: import("react").Context<InternalFormFieldControlProps>;
|
|
46
|
+
export declare function useFormFieldContext(props: FormFieldValidationControlProps): InternalFormFieldControlProps;
|
|
47
|
+
export {};
|
|
44
48
|
//# sourceMappingURL=form-field-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,+BAAgC,SAAQ,qBAAqB;IAC5E;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"form-field-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,+BAAgC,SAAQ,qBAAqB;IAC5E;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,6BAA8B,SAAQ,+BAA+B;IAC7E,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,wDAAmD,CAAC;AAUjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,+BAA+B,iCASzE"}
|
|
@@ -11,6 +11,12 @@ function applyDefault(fields, defaults, keys) {
|
|
|
11
11
|
}
|
|
12
12
|
export function useFormFieldContext(props) {
|
|
13
13
|
var context = useContext(FormFieldContext);
|
|
14
|
-
return applyDefault(props, context, [
|
|
14
|
+
return applyDefault(props, context, [
|
|
15
|
+
'invalid',
|
|
16
|
+
'controlId',
|
|
17
|
+
'ariaLabelledby',
|
|
18
|
+
'ariaDescribedby',
|
|
19
|
+
'__useReactAutofocus',
|
|
20
|
+
]);
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=form-field-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field-context.js","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"form-field-context.js","sourceRoot":"","sources":["../../../../src/internal/context/form-field-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmDlD,MAAM,CAAC,IAAM,gBAAgB,GAAG,aAAa,CAAgC,EAAE,CAAC,CAAC;AAEjF,SAAS,YAAY,CAAI,MAAS,EAAE,QAAW,EAAE,IAAiB;IAChE,IAAM,MAAM,GAAM,EAAE,CAAC;IACrB,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;QACd,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAsC;IACxE,IAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC7C,OAAO,YAAY,CAAgC,KAAK,EAAE,OAAO,EAAE;QACjE,SAAS;QACT,WAAW;QACX,gBAAgB;QAChB,iBAAiB;QACjB,qBAAqB;KACtB,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useContext, createContext } from 'react';\n\nexport interface FormFieldControlProps {\n /**\n * Specifies the ID of the native form element. You can use it to relate\n * a label element's `for` attribute to this control.\n *\n * It defaults to an automatically generated ID that\n * is provided by its parent form field component.\n */\n controlId?: string;\n\n /**\n * Adds `aria-labelledby` to the component. If you're using this component within a form field,\n * don't set this property because the form field component automatically sets it.\n *\n * Use this property if the component isn't surrounded by a form field, or you want to override the value\n * automatically set by the form field (for example, if you have two components within a single form field).\n *\n * To use it correctly, define an ID for the element you want to use as label and set the property to that ID.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the component. If you're using this component within a form field,\n * don't set this property because the form field component automatically sets it.\n *\n * Use this property if the component isn't surrounded by a form field, or you want to override the value\n * automatically set by the form field (for example, if you have two components within a single form field).\n *\n * To use it correctly, define an ID for each element that you want to use as a description\n * and set the property to a string of each ID separated by spaces (for example, `\"id1 id2 id3\"`).\n */\n ariaDescribedby?: string;\n}\n\nexport interface FormFieldValidationControlProps extends FormFieldControlProps {\n /**\n * Overrides the invalidation state. Usually the invalid state\n * comes from the parent `FormField`component,\n * however sometimes you need to override its\n * state when you have more than one input within a\n * single form field.\n */\n invalid?: boolean;\n}\n\ninterface InternalFormFieldControlProps extends FormFieldValidationControlProps {\n __useReactAutofocus?: boolean;\n}\n\nexport const FormFieldContext = createContext<InternalFormFieldControlProps>({});\n\nfunction applyDefault<T>(fields: T, defaults: T, keys: (keyof T)[]) {\n const result = <T>{};\n keys.forEach(key => {\n result[key] = fields[key] === undefined ? defaults[key] : fields[key];\n });\n return result;\n}\n\nexport function useFormFieldContext(props: FormFieldValidationControlProps) {\n const context = useContext(FormFieldContext);\n return applyDefault<InternalFormFieldControlProps>(props, context, [\n 'invalid',\n 'controlId',\n 'ariaLabelledby',\n 'ariaDescribedby',\n '__useReactAutofocus',\n ]);\n}\n"]}
|
|
@@ -14,4 +14,13 @@
|
|
|
14
14
|
export type SomeRequired<Type, Keys extends keyof Type> = Type & {
|
|
15
15
|
[Key in Keys]-?: Type[Key];
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Utility type that makes a union of given type and undefined.
|
|
19
|
+
* @example
|
|
20
|
+
* ```
|
|
21
|
+
* type OptionalString = Optional<string>
|
|
22
|
+
* type OptionalStringOrNumber = Optional<string | number>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export type Optional<Type> = Type | undefined;
|
|
17
26
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,IAAI,GAAG;KAC9D,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;CAC3B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,CAAC,IAAI,IAAI,IAAI,GAAG,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Makes specified properties required.\n *\n * @example\n * ```\n * import { AlertProps } from '~components/alert/interfaces'\n *\n * type InternalAlertProps = SomeRequired<AlertProps, 'type'>\n *\n * function Alert(props: AlertProps) { ... }\n * function InternalAlert(props: InternalAlertProps) { ... }\n * ```\n */\nexport type SomeRequired<Type, Keys extends keyof Type> = Type & {\n [Key in Keys]-?: Type[Key];\n};\n\n/**\n * Utility type that makes a union of given type and undefined.\n * @example\n * ```\n * type OptionalString = Optional<string>\n * type OptionalStringOrNumber = Optional<string | number>\n * ```\n */\nexport type Optional<Type> = Type | undefined;\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"placeholder": "
|
|
5
|
-
"item": "
|
|
6
|
-
"checkbox": "
|
|
7
|
-
"filter": "
|
|
8
|
-
"trigger": "
|
|
9
|
-
"layout-strut": "awsui_layout-
|
|
10
|
-
"list-bottom": "awsui_list-
|
|
11
|
-
"selected-icon": "awsui_selected-
|
|
12
|
-
"show-label-tag": "awsui_show-label-
|
|
4
|
+
"placeholder": "awsui_placeholder_dwuol_1dfho_93",
|
|
5
|
+
"item": "awsui_item_dwuol_1dfho_98",
|
|
6
|
+
"checkbox": "awsui_checkbox_dwuol_1dfho_102",
|
|
7
|
+
"filter": "awsui_filter_dwuol_1dfho_111",
|
|
8
|
+
"trigger": "awsui_trigger_dwuol_1dfho_116",
|
|
9
|
+
"layout-strut": "awsui_layout-strut_dwuol_1dfho_140",
|
|
10
|
+
"list-bottom": "awsui_list-bottom_dwuol_1dfho_146",
|
|
11
|
+
"selected-icon": "awsui_selected-icon_dwuol_1dfho_150",
|
|
12
|
+
"show-label-tag": "awsui_show-label-tag_dwuol_1dfho_154"
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -90,16 +90,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
90
90
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
91
|
SPDX-License-Identifier: Apache-2.0
|
|
92
92
|
*/
|
|
93
|
-
.
|
|
93
|
+
.awsui_placeholder_dwuol_1dfho_93:not(#\9) {
|
|
94
94
|
color: var(--color-text-input-placeholder-rtvjp5, #687078);
|
|
95
95
|
font-style: italic;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.
|
|
98
|
+
.awsui_item_dwuol_1dfho_98:not(#\9) {
|
|
99
99
|
display: flex;
|
|
100
100
|
align-items: center;
|
|
101
101
|
}
|
|
102
|
-
.
|
|
102
|
+
.awsui_item_dwuol_1dfho_98 > .awsui_checkbox_dwuol_1dfho_102:not(#\9) {
|
|
103
103
|
position: relative;
|
|
104
104
|
min-height: var(--size-control-eyly4k, 14px);
|
|
105
105
|
min-width: var(--size-control-eyly4k, 14px);
|
|
@@ -108,31 +108,49 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
108
108
|
margin-right: var(--space-field-horizontal-z3i1c8, 8px);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
.
|
|
111
|
+
.awsui_filter_dwuol_1dfho_111:not(#\9) {
|
|
112
112
|
z-index: 4;
|
|
113
113
|
flex-shrink: 0;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.
|
|
116
|
+
.awsui_trigger_dwuol_1dfho_116:not(#\9) {
|
|
117
117
|
white-space: nowrap;
|
|
118
118
|
overflow: hidden;
|
|
119
119
|
text-overflow: ellipsis;
|
|
120
120
|
}
|
|
121
|
+
.awsui_trigger_dwuol_1dfho_116[data-awsui-focus-visible=true]:not(#\9):focus {
|
|
122
|
+
position: relative;
|
|
123
|
+
}
|
|
124
|
+
.awsui_trigger_dwuol_1dfho_116[data-awsui-focus-visible=true]:not(#\9):focus {
|
|
125
|
+
outline: 2px dotted transparent;
|
|
126
|
+
outline-offset: calc(calc(-1 * var(--space-scaled-xs-6859qs, 8px)) - 1px);
|
|
127
|
+
}
|
|
128
|
+
.awsui_trigger_dwuol_1dfho_116[data-awsui-focus-visible=true]:not(#\9):focus::before {
|
|
129
|
+
content: " ";
|
|
130
|
+
display: block;
|
|
131
|
+
position: absolute;
|
|
132
|
+
left: calc(-1 * calc(-1 * var(--space-scaled-xs-6859qs, 8px)));
|
|
133
|
+
top: calc(-1 * calc(-1 * var(--space-scaled-xxs-95dhkm, 4px)));
|
|
134
|
+
width: calc(100% + 2 * calc(-1 * var(--space-scaled-xs-6859qs, 8px)));
|
|
135
|
+
height: calc(100% + 2 * calc(-1 * var(--space-scaled-xxs-95dhkm, 4px)));
|
|
136
|
+
border-radius: var(--border-radius-control-default-focus-ring-hekmgc, 2px);
|
|
137
|
+
box-shadow: 0 0 0 2px var(--color-border-item-focused-n5kd8g, #0073bb);
|
|
138
|
+
}
|
|
121
139
|
|
|
122
|
-
.awsui_layout-
|
|
140
|
+
.awsui_layout-strut_dwuol_1dfho_140:not(#\9) {
|
|
123
141
|
width: 100%;
|
|
124
142
|
position: relative;
|
|
125
143
|
transform: translate3d(0, 0, 0);
|
|
126
144
|
}
|
|
127
145
|
|
|
128
|
-
.awsui_list-
|
|
146
|
+
.awsui_list-bottom_dwuol_1dfho_146:not(#\9) {
|
|
129
147
|
/* used in unit-tests */
|
|
130
148
|
}
|
|
131
149
|
|
|
132
|
-
.awsui_selected-
|
|
150
|
+
.awsui_selected-icon_dwuol_1dfho_150:not(#\9) {
|
|
133
151
|
color: var(--color-border-item-focused-n5kd8g, #0073bb);
|
|
134
152
|
}
|
|
135
153
|
|
|
136
|
-
.awsui_show-label-
|
|
154
|
+
.awsui_show-label-tag_dwuol_1dfho_154 > .awsui_selected-icon_dwuol_1dfho_150:not(#\9) {
|
|
137
155
|
padding-left: var(--space-scaled-s-cu1hzn, 12px);
|
|
138
156
|
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"placeholder": "
|
|
6
|
-
"item": "
|
|
7
|
-
"checkbox": "
|
|
8
|
-
"filter": "
|
|
9
|
-
"trigger": "
|
|
10
|
-
"layout-strut": "awsui_layout-
|
|
11
|
-
"list-bottom": "awsui_list-
|
|
12
|
-
"selected-icon": "awsui_selected-
|
|
13
|
-
"show-label-tag": "awsui_show-label-
|
|
5
|
+
"placeholder": "awsui_placeholder_dwuol_1dfho_93",
|
|
6
|
+
"item": "awsui_item_dwuol_1dfho_98",
|
|
7
|
+
"checkbox": "awsui_checkbox_dwuol_1dfho_102",
|
|
8
|
+
"filter": "awsui_filter_dwuol_1dfho_111",
|
|
9
|
+
"trigger": "awsui_trigger_dwuol_1dfho_116",
|
|
10
|
+
"layout-strut": "awsui_layout-strut_dwuol_1dfho_140",
|
|
11
|
+
"list-bottom": "awsui_list-bottom_dwuol_1dfho_146",
|
|
12
|
+
"selected-icon": "awsui_selected-icon_dwuol_1dfho_150",
|
|
13
|
+
"show-label-tag": "awsui_show-label-tag_dwuol_1dfho_154"
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function useClickAway(onClick: () => void): React.MutableRefObject<any>;
|
|
3
|
+
interface ClickAwayActive {
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function ClickAway({ onClick, children }: ClickAwayActive): JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=click-away.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"click-away.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/click-away.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,IAAI,+BAgB/C;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,eAAe,eAa/D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React, { useEffect, useRef } from 'react';
|
|
4
|
+
import { containsOrEqual } from '../../internal/utils/dom';
|
|
5
|
+
import { useStableEventHandler } from '../../internal/hooks/use-stable-event-handler';
|
|
6
|
+
export function useClickAway(onClick) {
|
|
7
|
+
var awayRef = useRef(null);
|
|
8
|
+
var onClickStable = useStableEventHandler(onClick);
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
function handleClick(event) {
|
|
11
|
+
if (!containsOrEqual(awayRef.current, event.target)) {
|
|
12
|
+
onClickStable();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
// contains returns wrong result if the next render would remove the element
|
|
16
|
+
// but capture phase happens before the render, so returns correct result
|
|
17
|
+
// Ref: https://github.com/facebook/react/issues/20325
|
|
18
|
+
document.addEventListener('click', handleClick, { capture: true });
|
|
19
|
+
return function () { return document.removeEventListener('click', handleClick, { capture: true }); };
|
|
20
|
+
}, [onClickStable]);
|
|
21
|
+
return awayRef;
|
|
22
|
+
}
|
|
23
|
+
export function ClickAway(_a) {
|
|
24
|
+
var onClick = _a.onClick, children = _a.children;
|
|
25
|
+
var onClickStable = useStableEventHandler(onClick);
|
|
26
|
+
var ref = useRef(null);
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
function handleClick(event) {
|
|
29
|
+
if (!containsOrEqual(ref.current, event.target)) {
|
|
30
|
+
onClickStable();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
document.addEventListener('click', handleClick, true);
|
|
34
|
+
return function () { return document.removeEventListener('click', handleClick, true); };
|
|
35
|
+
}, [onClickStable]);
|
|
36
|
+
return React.createElement("span", { ref: ref }, children);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=click-away.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"click-away.js","sourceRoot":"","sources":["../../../../src/table/body-cell/click-away.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,MAAM,UAAU,YAAY,CAAC,OAAmB;IAC9C,IAAM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B,OAAO,8BAAM,GAAG,EAAE,GAAG,IAAG,QAAQ,CAAQ,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport { containsOrEqual } from '../../internal/utils/dom';\nimport { useStableEventHandler } from '../../internal/hooks/use-stable-event-handler';\n\nexport function useClickAway(onClick: () => void) {\n const awayRef = useRef<any>(null);\n const onClickStable = useStableEventHandler(onClick);\n useEffect(() => {\n function handleClick(event: Event) {\n if (!containsOrEqual(awayRef.current, event.target as Node)) {\n onClickStable();\n }\n }\n // contains returns wrong result if the next render would remove the element\n // but capture phase happens before the render, so returns correct result\n // Ref: https://github.com/facebook/react/issues/20325\n document.addEventListener('click', handleClick, { capture: true });\n return () => document.removeEventListener('click', handleClick, { capture: true });\n }, [onClickStable]);\n return awayRef;\n}\n\ninterface ClickAwayActive {\n onClick: () => void;\n children: React.ReactNode;\n}\nexport function ClickAway({ onClick, children }: ClickAwayActive) {\n const onClickStable = useStableEventHandler(onClick);\n const ref = useRef<HTMLSpanElement>(null);\n useEffect(() => {\n function handleClick(event: Event) {\n if (!containsOrEqual(ref.current, event.target as Node)) {\n onClickStable();\n }\n }\n document.addEventListener('click', handleClick, true);\n return () => document.removeEventListener('click', handleClick, true);\n }, [onClickStable]);\n return <span ref={ref}>{children}</span>;\n}\n"]}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { TableProps } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
wrapLines: boolean | undefined;
|
|
7
|
-
isFirstRow: boolean;
|
|
8
|
-
isLastRow: boolean;
|
|
9
|
-
isEvenRow?: boolean;
|
|
10
|
-
stripedRows?: boolean;
|
|
11
|
-
isSelected: boolean;
|
|
12
|
-
isNextSelected: boolean;
|
|
13
|
-
isPrevSelected: boolean;
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
hasSelection?: boolean;
|
|
16
|
-
hasFooter?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare function TableBodyCell({ className, style, children, wrapLines, isFirstRow, isLastRow, isSelected, isNextSelected, isPrevSelected, isEvenRow, stripedRows, hasSelection, hasFooter, }: TableBodyCellProps): JSX.Element;
|
|
19
|
-
interface TableBodyCellContentProps<ItemType> extends TableBodyCellProps {
|
|
20
|
-
column: TableProps.ColumnDefinition<ItemType>;
|
|
2
|
+
import { TableTdElementProps } from './td-element';
|
|
3
|
+
interface TableBodyCellProps<ItemType, ValueType> extends TableTdElementProps {
|
|
4
|
+
column: TableProps.EditableColumnDefinition<ItemType, ValueType>;
|
|
21
5
|
item: ItemType;
|
|
6
|
+
isEditing: boolean;
|
|
7
|
+
onEditStart: () => void;
|
|
8
|
+
onEditEnd: () => void;
|
|
9
|
+
submitEdit?: TableProps.SubmitEditFunction<ItemType, ValueType>;
|
|
10
|
+
ariaLabels: TableProps['ariaLabels'];
|
|
22
11
|
}
|
|
23
|
-
export declare function
|
|
12
|
+
export declare function TableBodyCell<ItemType, ValueType>({ isEditable, ...rest }: TableBodyCellProps<ItemType, ValueType> & {
|
|
13
|
+
isEditable: boolean;
|
|
14
|
+
}): JSX.Element;
|
|
24
15
|
export {};
|
|
25
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAcnE,UAAU,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAE,SAAQ,mBAAmB;IAC3E,MAAM,EAAE,UAAU,CAAC,wBAAwB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACjE,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAChE,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;CACtC;AAsFD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,EACjD,UAAU,EACV,GAAG,IAAI,EACR,EAAE,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,eAMnE"}
|
|
@@ -3,15 +3,54 @@ import { __assign, __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import styles from './styles.css.js';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import React, { useCallback, useRef } from 'react';
|
|
7
|
+
import useFocusVisible from '../../internal/hooks/focus-visible';
|
|
8
|
+
import { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';
|
|
9
|
+
import Button from '../../button/internal';
|
|
10
|
+
import { TableTdElement } from './td-element';
|
|
11
|
+
import { InlineEditor } from './inline-editor';
|
|
12
|
+
import { useStableScrollPosition } from './use-stable-scroll-position';
|
|
13
|
+
var readonlyState = Object.freeze({
|
|
14
|
+
isEditing: false,
|
|
15
|
+
currentValue: undefined,
|
|
16
|
+
setValue: function () { }
|
|
17
|
+
});
|
|
18
|
+
var submitHandlerFallback = function () {
|
|
19
|
+
throw new Error('The function `handleSubmit` is required for editable columns');
|
|
20
|
+
};
|
|
21
|
+
function TableCellEditable(_a) {
|
|
22
|
+
var _b;
|
|
23
|
+
var className = _a.className, item = _a.item, column = _a.column, isEditing = _a.isEditing, onEditStart = _a.onEditStart, onEditEnd = _a.onEditEnd, submitEdit = _a.submitEdit, ariaLabels = _a.ariaLabels, isVisualRefresh = _a.isVisualRefresh, rest = __rest(_a, ["className", "item", "column", "isEditing", "onEditStart", "onEditEnd", "submitEdit", "ariaLabels", "isVisualRefresh"]);
|
|
24
|
+
var editActivateRef = useRef(null);
|
|
25
|
+
var cellRef = useRef(null);
|
|
26
|
+
var focusVisible = useFocusVisible();
|
|
27
|
+
var _c = useStableScrollPosition(cellRef), storeScrollPosition = _c.storeScrollPosition, restoreScrollPosition = _c.restoreScrollPosition;
|
|
28
|
+
var handleEditStart = function () {
|
|
29
|
+
storeScrollPosition();
|
|
30
|
+
if (!isEditing) {
|
|
31
|
+
onEditStart();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var scheduleRestoreScrollPosition = useCallback(function () { return setTimeout(restoreScrollPosition, 0); }, [restoreScrollPosition]);
|
|
35
|
+
var tdNativeAttributes = __assign(__assign({}, focusVisible), { onFocus: scheduleRestoreScrollPosition, 'data-inline-editing-active': isEditing.toString() });
|
|
36
|
+
useEffectOnUpdate(function () {
|
|
37
|
+
if (!isEditing && editActivateRef.current) {
|
|
38
|
+
editActivateRef.current.focus({ preventScroll: true });
|
|
39
|
+
}
|
|
40
|
+
var timer = scheduleRestoreScrollPosition();
|
|
41
|
+
return function () { return clearTimeout(timer); };
|
|
42
|
+
}, [isEditing, scheduleRestoreScrollPosition]);
|
|
43
|
+
return (React.createElement(TableTdElement, __assign({}, rest, { nativeAttributes: tdNativeAttributes, className: clsx(className, styles['body-cell-editable'], isEditing && styles['body-cell-edit-active'], isVisualRefresh && styles['is-visual-refresh']), onClick: handleEditStart, ref: cellRef }), isEditing ? (React.createElement(InlineEditor, { ariaLabels: ariaLabels, column: column, item: item, onEditEnd: onEditEnd, submitEdit: submitEdit !== null && submitEdit !== void 0 ? submitEdit : submitHandlerFallback, __onRender: restoreScrollPosition })) : (React.createElement(React.Fragment, null,
|
|
44
|
+
column.cell(item, readonlyState),
|
|
45
|
+
React.createElement("span", { className: styles['body-cell-editor'] },
|
|
46
|
+
React.createElement(Button, { __hideFocusOutline: true, __internalRootRef: editActivateRef, ariaLabel: (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.activateEditLabel) === null || _b === void 0 ? void 0 : _b.call(ariaLabels, column), formAction: "none", iconName: "edit", variant: "inline-icon" }))))));
|
|
12
47
|
}
|
|
13
|
-
export function
|
|
14
|
-
var
|
|
15
|
-
|
|
48
|
+
export function TableBodyCell(_a) {
|
|
49
|
+
var isEditable = _a.isEditable, rest = __rest(_a, ["isEditable"]);
|
|
50
|
+
if (isEditable || rest.isEditing) {
|
|
51
|
+
return React.createElement(TableCellEditable, __assign({}, rest));
|
|
52
|
+
}
|
|
53
|
+
var column = rest.column, item = rest.item;
|
|
54
|
+
return React.createElement(TableTdElement, __assign({}, rest), column.cell(item, readonlyState));
|
|
16
55
|
}
|
|
17
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,iBAA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E,iBAAiB,2DAAG,MAAM,CAAC,EAClD,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAC,MAAM,EACf,OAAO,EAAC,aAAa,GACrB,CACG,CACN,CACJ,CACc,CAClB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAsB,EAGiB;IAFlE,IAAA,UAAU,gBAAA,EACP,IAAI,cAF0C,cAGlD,CADQ;IAEP,IAAI,UAAU,IAAI,IAAI,CAAC,SAAS,EAAE;QAChC,OAAO,oBAAC,iBAAiB,eAAK,IAAI,EAAI,CAAC;KACxC;IACO,IAAA,MAAM,GAAW,IAAI,OAAf,EAAE,IAAI,GAAK,IAAI,KAAT,CAAU;IAC9B,OAAO,oBAAC,cAAc,eAAK,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAkB,CAAC;AACvF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport React, { useCallback, useRef } from 'react';\nimport useFocusVisible from '../../internal/hooks/focus-visible';\nimport { useEffectOnUpdate } from '../../internal/hooks/use-effect-on-update';\nimport Button from '../../button/internal';\nimport { ButtonProps } from '../../button/interfaces';\nimport { TableProps } from '../interfaces';\nimport { TableTdElement, TableTdElementProps } from './td-element';\nimport { InlineEditor } from './inline-editor';\nimport { useStableScrollPosition } from './use-stable-scroll-position';\n\nconst readonlyState = Object.freeze({\n isEditing: false,\n currentValue: undefined,\n setValue: () => {},\n});\n\nconst submitHandlerFallback = () => {\n throw new Error('The function `handleSubmit` is required for editable columns');\n};\n\ninterface TableBodyCellProps<ItemType, ValueType> extends TableTdElementProps {\n column: TableProps.EditableColumnDefinition<ItemType, ValueType>;\n item: ItemType;\n isEditing: boolean;\n onEditStart: () => void;\n onEditEnd: () => void;\n submitEdit?: TableProps.SubmitEditFunction<ItemType, ValueType>;\n ariaLabels: TableProps['ariaLabels'];\n}\n\nfunction TableCellEditable<ItemType, ValueType>({\n className,\n item,\n column,\n isEditing,\n onEditStart,\n onEditEnd,\n submitEdit,\n ariaLabels,\n isVisualRefresh,\n ...rest\n}: TableBodyCellProps<ItemType, ValueType>) {\n const editActivateRef = useRef<ButtonProps.Ref>(null);\n const cellRef = useRef<HTMLTableCellElement>(null);\n const focusVisible = useFocusVisible();\n const { storeScrollPosition, restoreScrollPosition } = useStableScrollPosition(cellRef);\n\n const handleEditStart = () => {\n storeScrollPosition();\n if (!isEditing) {\n onEditStart();\n }\n };\n\n const scheduleRestoreScrollPosition = useCallback(\n () => setTimeout(restoreScrollPosition, 0),\n [restoreScrollPosition]\n );\n\n const tdNativeAttributes = {\n ...(focusVisible as Record<string, string>),\n onFocus: scheduleRestoreScrollPosition,\n 'data-inline-editing-active': isEditing.toString(),\n };\n\n useEffectOnUpdate(() => {\n if (!isEditing && editActivateRef.current) {\n editActivateRef.current.focus({ preventScroll: true });\n }\n const timer = scheduleRestoreScrollPosition();\n return () => clearTimeout(timer);\n }, [isEditing, scheduleRestoreScrollPosition]);\n\n return (\n <TableTdElement\n {...rest}\n nativeAttributes={tdNativeAttributes as TableTdElementProps['nativeAttributes']}\n className={clsx(\n className,\n styles['body-cell-editable'],\n isEditing && styles['body-cell-edit-active'],\n isVisualRefresh && styles['is-visual-refresh']\n )}\n onClick={handleEditStart}\n ref={cellRef}\n >\n {isEditing ? (\n <InlineEditor\n ariaLabels={ariaLabels}\n column={column}\n item={item}\n onEditEnd={onEditEnd}\n submitEdit={submitEdit ?? submitHandlerFallback}\n __onRender={restoreScrollPosition}\n />\n ) : (\n <>\n {column.cell(item, readonlyState)}\n <span className={styles['body-cell-editor']}>\n <Button\n __hideFocusOutline={true}\n __internalRootRef={editActivateRef}\n ariaLabel={ariaLabels?.activateEditLabel?.(column)}\n formAction=\"none\"\n iconName=\"edit\"\n variant=\"inline-icon\"\n />\n </span>\n </>\n )}\n </TableTdElement>\n );\n}\n\nexport function TableBodyCell<ItemType, ValueType>({\n isEditable,\n ...rest\n}: TableBodyCellProps<ItemType, ValueType> & { isEditable: boolean }) {\n if (isEditable || rest.isEditing) {\n return <TableCellEditable {...rest} />;\n }\n const { column, item } = rest;\n return <TableTdElement {...rest}>{column.cell(item, readonlyState)}</TableTdElement>;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TableProps } from '../interfaces';
|
|
2
|
+
interface InlineEditorProps<ItemType, ValueType> {
|
|
3
|
+
ariaLabels: TableProps['ariaLabels'];
|
|
4
|
+
column: TableProps.EditableColumnDefinition<ItemType, ValueType>;
|
|
5
|
+
item: ItemType;
|
|
6
|
+
onEditEnd: () => void;
|
|
7
|
+
submitEdit: TableProps.SubmitEditFunction<ItemType, ValueType>;
|
|
8
|
+
__onRender?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function InlineEditor<ItemType, ValueType>({ ariaLabels, item, column, onEditEnd, submitEdit, __onRender, }: InlineEditorProps<ItemType, ValueType>): JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=inline-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-editor.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/inline-editor.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,UAAU,iBAAiB,CAAC,QAAQ,EAAE,SAAS;IAC7C,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IACrC,MAAM,EAAE,UAAU,CAAC,wBAAwB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACjE,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,EAChD,UAAU,EACV,IAAI,EACJ,MAAM,EACN,SAAS,EACT,UAAU,EACV,UAAU,GACX,EAAE,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,eAqGxC"}
|