@cloudscape-design/components 3.0.128 → 3.0.130
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/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
- package/annotation-context/annotation/annotation-popover.js +8 -2
- package/annotation-context/annotation/annotation-popover.js.map +1 -1
- package/annotation-context/annotation/annotation-trigger.d.ts +2 -0
- package/annotation-context/annotation/annotation-trigger.d.ts.map +1 -1
- package/annotation-context/annotation/annotation-trigger.js +2 -2
- package/annotation-context/annotation/annotation-trigger.js.map +1 -1
- package/annotation-context/annotation/closed-annotation.d.ts +3 -1
- package/annotation-context/annotation/closed-annotation.d.ts.map +1 -1
- package/annotation-context/annotation/closed-annotation.js +2 -2
- package/annotation-context/annotation/closed-annotation.js.map +1 -1
- package/annotation-context/annotation/open-annotation.d.ts.map +1 -1
- package/annotation-context/annotation/open-annotation.js +1 -1
- package/annotation-context/annotation/open-annotation.js.map +1 -1
- package/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +30 -30
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/annotation-context/index.d.ts.map +1 -1
- package/annotation-context/index.js +3 -1
- package/annotation-context/index.js.map +1 -1
- package/annotation-context/interfaces.d.ts +1 -1
- package/annotation-context/interfaces.d.ts.map +1 -1
- package/annotation-context/interfaces.js.map +1 -1
- package/app-layout/visual-refresh/main.d.ts.map +1 -1
- package/app-layout/visual-refresh/main.js +8 -3
- package/app-layout/visual-refresh/main.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +60 -60
- package/app-layout/visual-refresh/styles.scoped.css +255 -237
- package/app-layout/visual-refresh/styles.selectors.js +60 -60
- package/area-chart/internal.d.ts.map +1 -1
- package/area-chart/internal.js +5 -0
- package/area-chart/internal.js.map +1 -1
- package/area-chart/model/index.d.ts +1 -0
- package/area-chart/model/index.d.ts.map +1 -1
- package/area-chart/model/index.js.map +1 -1
- package/area-chart/model/use-chart-model.d.ts.map +1 -1
- package/area-chart/model/use-chart-model.js +8 -1
- package/area-chart/model/use-chart-model.js.map +1 -1
- package/attribute-editor/row.d.ts.map +1 -1
- package/attribute-editor/row.js +4 -3
- package/attribute-editor/row.js.map +1 -1
- package/attribute-editor/styles.css.js +13 -12
- package/attribute-editor/styles.scoped.css +27 -23
- package/attribute-editor/styles.selectors.js +13 -12
- package/breadcrumb-group/interfaces.d.ts +1 -0
- package/breadcrumb-group/interfaces.d.ts.map +1 -1
- package/breadcrumb-group/interfaces.js.map +1 -1
- package/breadcrumb-group/internal.d.ts.map +1 -1
- package/breadcrumb-group/internal.js +1 -1
- package/breadcrumb-group/internal.js.map +1 -1
- package/breadcrumb-group/item/item.d.ts +1 -1
- package/breadcrumb-group/item/item.d.ts.map +1 -1
- package/breadcrumb-group/item/item.js +68 -8
- package/breadcrumb-group/item/item.js.map +1 -1
- package/breadcrumb-group/item/styles.css.js +9 -7
- package/breadcrumb-group/item/styles.scoped.css +26 -16
- package/breadcrumb-group/item/styles.selectors.js +9 -7
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +11 -16
- package/code-editor/index.js.map +1 -1
- package/code-editor/interfaces.d.ts +12 -1
- package/code-editor/interfaces.d.ts.map +1 -1
- package/code-editor/interfaces.js.map +1 -1
- package/code-editor/status-bar.d.ts.map +1 -1
- package/code-editor/status-bar.js +7 -1
- package/code-editor/status-bar.js.map +1 -1
- package/code-editor/util.js +1 -1
- package/code-editor/util.js.map +1 -1
- package/container/internal.d.ts.map +1 -1
- package/container/internal.js +7 -4
- package/container/internal.js.map +1 -1
- package/date-range-picker/calendar/grids/index.d.ts +0 -1
- package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/index.js +2 -14
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts +6 -4
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js +111 -123
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/calendar/utils.d.ts +4 -0
- package/date-range-picker/calendar/utils.d.ts.map +1 -0
- package/date-range-picker/calendar/utils.js +31 -0
- package/date-range-picker/calendar/utils.js.map +1 -0
- package/date-range-picker/dropdown.d.ts +2 -1
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js +8 -6
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +14 -4
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/date-range-picker/styles.css.js +38 -38
- package/date-range-picker/styles.scoped.css +45 -50
- package/date-range-picker/styles.selectors.js +38 -38
- package/date-range-picker/utils.d.ts +2 -8
- package/date-range-picker/utils.d.ts.map +1 -1
- package/date-range-picker/utils.js +17 -12
- package/date-range-picker/utils.js.map +1 -1
- package/flashbar/styles.css.js +33 -33
- package/flashbar/styles.scoped.css +121 -121
- package/flashbar/styles.selectors.js +33 -33
- package/internal/components/dropdown/index.d.ts.map +1 -1
- package/internal/components/dropdown/index.js +2 -9
- package/internal/components/dropdown/index.js.map +1 -1
- package/internal/components/dropdown-status/index.d.ts +1 -4
- package/internal/components/dropdown-status/index.d.ts.map +1 -1
- package/internal/components/dropdown-status/index.js +3 -5
- package/internal/components/dropdown-status/index.js.map +1 -1
- package/internal/components/filtering-token/index.d.ts +2 -1
- package/internal/components/filtering-token/index.d.ts.map +1 -1
- package/internal/components/filtering-token/index.js +2 -2
- package/internal/components/filtering-token/index.js.map +1 -1
- package/internal/components/option/index.js +4 -4
- package/internal/components/option/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +27 -26
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/hooks/use-analytics/index.d.ts +2 -0
- package/internal/hooks/use-analytics/index.d.ts.map +1 -0
- package/internal/hooks/use-analytics/index.js +16 -0
- package/internal/hooks/use-analytics/index.js.map +1 -0
- package/internal/manifest.json +1 -1
- package/internal/utils/date-time/format-date-time.d.ts +2 -0
- package/internal/utils/date-time/format-date-time.d.ts.map +1 -0
- package/internal/utils/date-time/format-date-time.js +8 -0
- package/internal/utils/date-time/format-date-time.js.map +1 -0
- package/internal/utils/date-time/index.d.ts +2 -1
- package/internal/utils/date-time/index.d.ts.map +1 -1
- package/internal/utils/date-time/index.js +2 -1
- package/internal/utils/date-time/index.js.map +1 -1
- package/internal/utils/date-time/join-date-time.d.ts +4 -0
- package/internal/utils/date-time/join-date-time.d.ts.map +1 -1
- package/internal/utils/date-time/join-date-time.js +4 -0
- package/internal/utils/date-time/join-date-time.js.map +1 -1
- package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
- package/mixed-line-bar-chart/chart-container.js +14 -5
- package/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/package.json +1 -1
- package/pie-chart/index.d.ts.map +1 -1
- package/pie-chart/index.js +1 -4
- package/pie-chart/index.js.map +1 -1
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js +10 -1
- package/pie-chart/pie-chart.js.map +1 -1
- package/popover/body.d.ts +2 -1
- package/popover/body.d.ts.map +1 -1
- package/popover/body.js +2 -2
- package/popover/body.js.map +1 -1
- package/property-filter/interfaces.d.ts +1 -0
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/token.d.ts.map +1 -1
- package/property-filter/token.js +1 -1
- package/property-filter/token.js.map +1 -1
- package/select/parts/filter.d.ts +1 -1
- package/select/utils/use-select.d.ts +1 -7
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +1 -1
- package/select/utils/use-select.js.map +1 -1
- package/table/interfaces.d.ts +20 -0
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +5 -3
- package/table/internal.js.map +1 -1
- package/table/styles.css.js +34 -34
- package/table/styles.scoped.css +42 -40
- package/table/styles.selectors.js +34 -34
- package/table/thead.js +1 -1
- package/table/thead.js.map +1 -1
- package/tabs/index.d.ts.map +1 -1
- package/tabs/index.js +9 -11
- package/tabs/index.js.map +1 -1
- package/tabs/styles.css.js +21 -21
- package/tabs/styles.scoped.css +48 -41
- package/tabs/styles.selectors.js +21 -21
- package/tabs/tab-header-bar.d.ts +4 -0
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +5 -1
- package/tabs/tab-header-bar.js.map +1 -1
- package/tag-editor/internal.d.ts.map +1 -1
- package/tag-editor/internal.js +6 -7
- package/tag-editor/internal.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/tutorial-panel/components/tutorial-detail-view/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/index.js +3 -1
- package/tutorial-panel/components/tutorial-detail-view/index.js.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/task.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/task.js +2 -1
- package/tutorial-panel/components/tutorial-detail-view/task.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js +2 -2
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/tutorial-panel/interfaces.d.ts +2 -0
- package/tutorial-panel/interfaces.d.ts.map +1 -1
- package/tutorial-panel/interfaces.js.map +1 -1
- package/wizard/index.d.ts.map +1 -1
- package/wizard/index.js +9 -5
- package/wizard/index.js.map +1 -1
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +7 -2
- package/wizard/wizard-form.js.map +1 -1
- package/date-range-picker/calendar/use-date-time.d.ts +0 -9
- package/date-range-picker/calendar/use-date-time.d.ts.map +0 -1
- package/date-range-picker/calendar/use-date-time.js +0 -16
- package/date-range-picker/calendar/use-date-time.js.map +0 -1
package/popover/body.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/popover/body.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAE1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/popover/body.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAE1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAgBrC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAUjB;;QATF,iBAAiB,mBAAA,EAChC,gBAAgB,sBAAA,EAChB,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,OAAO,aAAA,EACP,eAAe,qBAAA,EACf,SAAS,eAAA,EACT,cAAc,oBA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7D,EACF,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACnC,SAAS,EAAE,SAAS,gBACR,iBAAiB,IAAI,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,qBAC3D,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;QAEtE,oBAAC,SAAS,IAAC,QAAQ,EAAE,OAAO,KAAK,YAAY,IAAI,CAAC,iBAAiB,EAAE,SAAS,EAAE,KAAK;YAClF,MAAM,IAAI,CACT,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,iBAAiB,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;gBACnF,aAAa;gBACd,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,YAAY;oBAC7C,gCAAK,MAAM,CAAM,CACb,CACF,CACP;YACD,6BAAK,SAAS,EAAE,CAAC,MAAM,IAAI,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC7E,CAAC,MAAM,IAAI,aAAa;gBACzB,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,YAAI,GAAC,MAAM,CAAC,0BAA0B,CAAC,IAAG,CAAC,CAAC,eAAe,MAAG,IAC9F,QAAQ,CACL,CACF,CACI,CACR,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport FocusLock from '../internal/components/focus-lock';\n\nimport styles from './styles.css.js';\n\nexport interface PopoverBodyProps {\n dismissButton: boolean;\n dismissAriaLabel: string | undefined;\n onDismiss: () => void;\n\n header: React.ReactNode | undefined;\n children: React.ReactNode;\n variant?: 'annotation';\n overflowVisible?: 'content' | 'both';\n\n className?: string;\n ariaLabelledby?: string;\n}\n\nexport default function PopoverBody({\n dismissButton: showDismissButton,\n dismissAriaLabel,\n header,\n children,\n onDismiss,\n variant,\n overflowVisible,\n className,\n ariaLabelledby,\n}: PopoverBodyProps) {\n const labelledById = useUniqueId('awsui-popover-');\n const dismissButtonFocused = useRef(false);\n const dismissButtonRef = useRef<ButtonProps.Ref>(null);\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n onDismiss();\n }\n },\n [onDismiss]\n );\n\n // Implement our own auto-focus rather than using FocusLock's,\n // because we also want to focus the dismiss button when it\n // is added dyamically (e.g. in chart popovers)\n useEffect(() => {\n if (showDismissButton && !dismissButtonFocused.current) {\n dismissButtonRef.current?.focus({ preventScroll: true });\n }\n dismissButtonFocused.current = showDismissButton;\n }, [showDismissButton]);\n\n const dismissButton = (showDismissButton ?? null) && (\n <div className={styles.dismiss}>\n <InternalButton\n variant=\"icon\"\n formAction=\"none\"\n iconName=\"close\"\n className={styles['dismiss-control']}\n ariaLabel={dismissAriaLabel}\n onClick={() => onDismiss()}\n ref={dismissButtonRef}\n />\n </div>\n );\n\n return (\n <div\n className={clsx(styles.body, className, {\n [styles['body-overflow-visible']]: overflowVisible === 'both',\n })}\n role={header ? 'dialog' : undefined}\n onKeyDown={onKeyDown}\n aria-modal={showDismissButton && variant !== 'annotation' ? true : undefined}\n aria-labelledby={ariaLabelledby ?? (header ? labelledById : undefined)}\n >\n <FocusLock disabled={variant === 'annotation' || !showDismissButton} autoFocus={false}>\n {header && (\n <div className={clsx(styles['header-row'], showDismissButton && styles['has-dismiss'])}>\n {dismissButton}\n <div className={styles.header} id={labelledById}>\n <h2>{header}</h2>\n </div>\n </div>\n )}\n <div className={!header && showDismissButton ? styles['has-dismiss'] : undefined}>\n {!header && dismissButton}\n <div className={clsx(styles.content, { [styles['content-overflow-visible']]: !!overflowVisible })}>\n {children}\n </div>\n </div>\n </FocusLock>\n </div>\n );\n}\n"]}
|
|
@@ -192,6 +192,7 @@ export declare namespace PropertyFilterProps {
|
|
|
192
192
|
tokenLimitShowMore?: string;
|
|
193
193
|
tokenLimitShowFewer?: string;
|
|
194
194
|
clearFiltersText: string;
|
|
195
|
+
tokenOperatorAriaLabel?: string;
|
|
195
196
|
removeTokenButtonAriaLabel: (token: PropertyFilterProps.Token) => string;
|
|
196
197
|
enteredTextLabel: AutosuggestProps.EnteredTextLabel;
|
|
197
198
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAGA,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,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,qCAAqC,CAAC;AAE7C,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB,EAAE,gBAAgB;IAC/E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,WAAW,EAAE,mBAAmB,CAAC,WAAW,CAAC;IAC7C;;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,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport {\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterToken,\n} from '@cloudscape-design/collection-hooks';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n */\n countText?: string;\n /**\n * An object representing the current query displayed in the property filter. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=']: The operator which indicates how to filter the dataset using this token.\n *\n * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n */\n hideOperations?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronousely. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\n\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * Label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/system/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel: string;\n dismissAriaLabel: string;\n\n filteringPlaceholder?: string;\n groupValuesText: string;\n groupPropertiesText: string;\n operatorsText: string;\n\n operationAndText: string;\n operationOrText: string;\n\n operatorLessText: string;\n operatorLessOrEqualText: string;\n operatorGreaterText: string;\n operatorGreaterOrEqualText: string;\n operatorContainsText: string;\n operatorDoesNotContainText: string;\n operatorEqualsText: string;\n operatorDoesNotEqualText: string;\n\n editTokenHeader: string;\n propertyText: string;\n operatorText: string;\n valueText: string;\n cancelActionText: string;\n applyActionText: string;\n allPropertiesLabel: string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText: string;\n removeTokenButtonAriaLabel: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n\n// Re-exported namespace interfaces to use module-style imports internally\n\nexport type Token = PropertyFilterProps.Token;\nexport type JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\nexport type FilteringOption = PropertyFilterProps.FilteringOption;\nexport type FilteringProperty = PropertyFilterProps.FilteringProperty;\nexport type Query = PropertyFilterProps.Query;\nexport type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;\nexport type I18nStrings = PropertyFilterProps.I18nStrings;\nexport type GroupText = PropertyFilterProps.GroupText;\nexport type FilteringChangeDetail = PropertyFilterProps.FilteringChangeDetail;\nexport type Ref = PropertyFilterProps.Ref;\n\n// Utility types\n\nexport type ParsedText =\n | { step: 'property'; property: FilteringProperty; operator: ComparisonOperator; value: string }\n | { step: 'operator'; property: FilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: ComparisonOperator; value: string };\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/property-filter/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { AutosuggestProps } from '../autosuggest/interfaces';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport {\n PropertyFilterOperation,\n PropertyFilterOperator,\n PropertyFilterOperatorExtended,\n PropertyFilterOperatorForm,\n PropertyFilterOperatorFormat,\n PropertyFilterOperatorFormProps,\n PropertyFilterOption,\n PropertyFilterProperty,\n PropertyFilterToken,\n} from '@cloudscape-design/collection-hooks';\n\nexport interface PropertyFilterProps extends BaseComponentProps, ExpandToViewport {\n /**\n * If set to `true`, the filtering input will be disabled.\n * Use it, for example, if you are fetching new items upon filtering change\n * in order to prevent the user from changing the filtering query.\n */\n disabled?: boolean;\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: PropertyFilterProps.I18nStrings;\n /**\n * Accepts a human-readable, localized string that indicates the number of results. For example, \"1 match\" or \"165 matches.\"\n * If the total number of results is unknown, also include an indication that there may be more results than\n * the number listed. For example, \"25+ matches.\"\n *\n * The count text is only displayed when `query.tokens` isn't empty.\n */\n countText?: string;\n /**\n * An object representing the current query displayed in the property filter. Has two properties: `tokens` and `operation`.\n * `tokens` is an array of objects that will be displayed to the user beneath the filtering input.\n * Each token has the following properties:\n *\n * * value [string]: The string value of the token to be used as a filter.\n * * propertyKey [string]: The key of the corresponding property in filteringProperties.\n * * operator ['<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!=']: The operator which indicates how to filter the dataset using this token.\n *\n * `operation` has two valid values [and, or] and controls the join operation to be applied between tokens when filtering the items.\n */\n query: PropertyFilterProps.Query;\n /**\n * If hideOperations it set, the indicator of the operation (that is, `and` or `or`) and the selection of operations\n * (applied to the property and value token) are hidden from the user. Only use when you have a custom\n * filtering logic which combines tokens in different way than the default one. When used, ensure that\n * operations are communicated to the user in another way.\n */\n hideOperations?: boolean;\n /**\n * Fired when the `query` gets changed. Filter the dataset in response to this event using the values in the `detail` object.\n */\n onChange: NonCancelableEventHandler<PropertyFilterProps.Query>;\n /**\n * An array of properties by which the data set can be filtered. Each element has the following properties:\n *\n * * groupValuesLabel [string]: Localized string to display for the 'Values' group label for a specific property.\n * * key [string]: The identifier of this property.\n * * propertyLabel [string]: A human-readable string for the property.\n * * operators [Array]: A list of all operators supported by this property. If you omit the equals operator because your API does not support it, make sure to set `defaultOperator` to a supported operator from this list.\n * * group [string]: Optional identifier of a custom group that this filtering option is assigned to. Use to create additional groups below the default one. Make sure to also define labels for the group in the customGroupsText property. Notice that only one level of options nesting is supported.\n * * defaultOperator [ComparisonOperator]: Optional parameter that changes the default operator used with this filtering property. Use it only if your API does not support \"equals\" filtering terms with this property.\n */\n filteringProperties: ReadonlyArray<PropertyFilterProps.FilteringProperty>;\n /**\n * An array of possible values of the individual `filteringProperties`. Each element has the following properties:\n *\n * * `propertyKey` [string]: The key of the corresponding filtering property in the `filteringProperties` array.\n * * `value` [string]: The value that will be used as a suggestion when creating or modifying a filtering token.\n */\n filteringOptions?: ReadonlyArray<PropertyFilterProps.FilteringOption>;\n /**\n * An array of objects that contain localized, human-readable strings for the labels of custom groups within the filtering dropdown. Use group property to associate the strings with your custom group of options. Define the following values for each group:\n *\n * * properties [string]: The group label in the filtering dropdown that contains the list of properties from this group. For example: Tags.\n * * values [string]: The group label in the filtering dropdown that contains the list of values from this group. For example: Tags values.\n * * group [string]: The identifier of a custom group.\n */\n customGroupsText?: PropertyFilterProps.GroupText[];\n /**\n * Set `disableFreeTextFiltering` only if you can’t filter the dataset using a filter that is applied to every column,\n * instead of a specific property. This would stop the user from creating such tokens.\n */\n disableFreeTextFiltering?: boolean;\n /**\n * Use this event to asynchronously load filteringOptions, component currently needs. The detail object contains following properties:\n *\n * * `filteringProperty` - The property for which you need to fetch the options.\n * * `filteringOperator` - The operator for which you need to fetch the options.\n * * `filteringText` - The value that you need to use to fetch options.\n * * `firstPage` - Indicates that you should fetch the first page of options for a `filteringProperty` that match the `filteringText`.\n * * `samePage` - Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).\n */\n onLoadItems?: NonCancelableEventHandler<PropertyFilterProps.LoadItemsDetail>;\n /**\n * If you have more than 500 `filteringOptions`, enable this flag to apply a performance optimization that makes\n * the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options,\n * because the improvements to performance are offset by a visible scrolling lag. When you set this flag to true,\n * it removes options that are not currently in view from the DOM.\n */\n virtualScroll?: boolean;\n /**\n * A slot located before the filtering input. Use it if for a Select component if your dataset supports property\n * filter queries only after an initial filter is applied.\n */\n customControl?: React.ReactNode;\n /**\n * Set `asyncProperties` if you need to load `filteringProperties` asynchronousely. This would cause extra `onLoadMore`\n * events to fire calling for more properties.\n */\n asyncProperties?: boolean;\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * Displayed when there are no options to display.\n * This is only shown when `statusType` is set to `finished` or not set at all.\n */\n filteringEmpty?: React.ReactNode;\n /**\n * Specifies the text to display when in the loading state.\n **/\n filteringLoadingText?: string;\n /**\n * Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.\n **/\n filteringFinishedText?: string;\n /**\n * Specifies the text to display when a data fetching error occurs. Make sure that you provide `recoveryText`.\n **/\n filteringErrorText?: string;\n /**\n * Specifies the text for the recovery button. The text is displayed next to the error text.\n * Use the `onLoadItems` event to perform a recovery action (for example, retrying the request).\n **/\n filteringRecoveryText?: string;\n /**\n * Specifies the current status of loading more options.\n * * `pending` - Indicates that no request in progress, but more options may be loaded.\n * * `loading` - Indicates that data fetching is in progress.\n * * `finished` - Indicates that pagination has finished and no more requests are expected.\n * * `error` - Indicates that an error occurred during fetch. You should use `recoveryText` to enable the user to recover.\n **/\n filteringStatusType?: DropdownStatusProps.StatusType;\n}\n\nexport namespace PropertyFilterProps {\n export type Token = PropertyFilterToken;\n export type JoinOperation = PropertyFilterOperation;\n export type ComparisonOperator = PropertyFilterOperator;\n export type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\n export type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\n export type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\n export type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\n export type FilteringOption = PropertyFilterOption;\n export type FilteringProperty = PropertyFilterProperty;\n\n export interface Query {\n tokens: ReadonlyArray<PropertyFilterProps.Token>;\n operation: PropertyFilterProps.JoinOperation;\n }\n\n export interface LoadItemsDetail {\n filteringProperty?: FilteringProperty;\n filteringOperator?: ComparisonOperator;\n filteringText: string;\n firstPage: boolean;\n samePage: boolean;\n }\n\n export interface I18nStrings {\n /**\n * Label that will be passed down to the Autosuggest `ariaLabel` property.\n * See the [Autosuggest API](/system/components/autosuggest/?tabId=api) page for more details.\n */\n filteringAriaLabel: string;\n dismissAriaLabel: string;\n\n filteringPlaceholder?: string;\n groupValuesText: string;\n groupPropertiesText: string;\n operatorsText: string;\n\n operationAndText: string;\n operationOrText: string;\n\n operatorLessText: string;\n operatorLessOrEqualText: string;\n operatorGreaterText: string;\n operatorGreaterOrEqualText: string;\n operatorContainsText: string;\n operatorDoesNotContainText: string;\n operatorEqualsText: string;\n operatorDoesNotEqualText: string;\n\n editTokenHeader: string;\n propertyText: string;\n operatorText: string;\n valueText: string;\n cancelActionText: string;\n applyActionText: string;\n allPropertiesLabel: string;\n\n tokenLimitShowMore?: string;\n tokenLimitShowFewer?: string;\n clearFiltersText: string;\n tokenOperatorAriaLabel?: string;\n removeTokenButtonAriaLabel: (token: PropertyFilterProps.Token) => string;\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n }\n\n export interface GroupText {\n properties: string;\n values: string;\n group: string;\n }\n\n export interface FilteringChangeDetail {\n filteringText: string;\n filteringProperty?: FilteringProperty;\n }\n\n export interface Ref {\n /**\n * Sets focus on the underlying input control.\n */\n focus(): void;\n }\n}\n\n// Re-exported namespace interfaces to use module-style imports internally\n\nexport type Token = PropertyFilterProps.Token;\nexport type JoinOperation = PropertyFilterProps.JoinOperation;\nexport type ComparisonOperator = PropertyFilterProps.ComparisonOperator;\nexport type ExtendedOperator<TokenValue> = PropertyFilterOperatorExtended<TokenValue>;\nexport type ExtendedOperatorFormProps<TokenValue> = PropertyFilterOperatorFormProps<TokenValue>;\nexport type ExtendedOperatorForm<TokenValue> = PropertyFilterOperatorForm<TokenValue>;\nexport type ExtendedOperatorFormat<TokenValue> = PropertyFilterOperatorFormat<TokenValue>;\nexport type FilteringOption = PropertyFilterProps.FilteringOption;\nexport type FilteringProperty = PropertyFilterProps.FilteringProperty;\nexport type Query = PropertyFilterProps.Query;\nexport type LoadItemsDetail = PropertyFilterProps.LoadItemsDetail;\nexport type I18nStrings = PropertyFilterProps.I18nStrings;\nexport type GroupText = PropertyFilterProps.GroupText;\nexport type FilteringChangeDetail = PropertyFilterProps.FilteringChangeDetail;\nexport type Ref = PropertyFilterProps.Ref;\n\n// Utility types\n\nexport type ParsedText =\n | { step: 'property'; property: FilteringProperty; operator: ComparisonOperator; value: string }\n | { step: 'operator'; property: FilteringProperty; operatorPrefix: string }\n | { step: 'free-text'; operator?: ComparisonOperator; value: string };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,KAAK,EACN,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAExF,UAA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B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAC;IACzD,SAAS,EAAE,aAAa,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,EAAE,CAAC,YAAY,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,KAAK,EAAE,KAAK,CAAC;CACd;AAED,eAAO,MAAM,WAAW,4PAkBrB,UAAU,gBAsCZ,CAAC"}
|
package/property-filter/token.js
CHANGED
|
@@ -12,7 +12,7 @@ export var TokenButton = function (_a) {
|
|
|
12
12
|
var property = token.propertyKey && getPropertyByKey(filteringProperties, token.propertyKey);
|
|
13
13
|
var propertyLabel = property && property.propertyLabel;
|
|
14
14
|
var tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;
|
|
15
|
-
return (React.createElement(FilteringToken, { showOperation: !first && !hideOperations, operation: operation, andText: i18nStrings.operationAndText, orText: i18nStrings.operationOrText, dismissAriaLabel: i18nStrings.removeTokenButtonAriaLabel(token), onChange: setOperation, onDismiss: removeToken, disabled: disabled },
|
|
15
|
+
return (React.createElement(FilteringToken, { showOperation: !first && !hideOperations, operation: operation, andText: i18nStrings.operationAndText, orText: i18nStrings.operationOrText, dismissAriaLabel: i18nStrings.removeTokenButtonAriaLabel(token), operatorAriaLabel: i18nStrings.tokenOperatorAriaLabel, onChange: setOperation, onDismiss: removeToken, disabled: disabled },
|
|
16
16
|
React.createElement(TokenEditor, { setToken: setToken, triggerComponent: React.createElement("span", { className: styles['token-trigger'] },
|
|
17
17
|
React.createElement(TokenTrigger, { property: propertyLabel, operator: token.operator, value: tokenValue })), filteringOptions: filteringOptions, filteringProperties: filteringProperties, token: token, asyncProps: asyncProps, onLoadItems: onLoadItems, i18nStrings: i18nStrings, asyncProperties: asyncProperties, customGroupsText: customGroupsText, disableFreeTextFiltering: disableFreeTextFiltering, expandToViewport: expandToViewport })));
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAwBpE,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,EAkBf;;QAjBX,KAAK,WAAA,EACL,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,KAAK,WAAA,EACL,WAAW,iBAAA,EACX,QAAQ,cAAA,EACR,YAAY,kBAAA,EACZ,gBAAgB,sBAAA,EAChB,mBAAmB,yBAAA,EACnB,UAAU,gBAAA,EACV,WAAW,iBAAA,EACX,WAAW,iBAAA,EACX,eAAe,qBAAA,EACf,cAAc,oBAAA,EACd,gBAAgB,sBAAA,EAChB,QAAQ,cAAA,EACR,wBAAwB,8BAAA,EACxB,gBAAgB,sBAAA;IAEhB,IAAM,cAAc,GAClB,KAAK,CAAC,WAAW,KAAI,MAAA,mBAAmB,CAAC,mBAAmB,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,0CAAE,MAAM,CAAA,CAAC;IAC3G,IAAM,QAAQ,GAAG,K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QACZ,QAAQ,IAAI,GAAG,CAAC;KACjB;IACD,IAAM,qBAAqB,GAAG,QAAQ,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC5D,IAAM,YAAY,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC;IACjE,OAAO,CACL;QACG,QAAQ;QACT,8BAAM,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,YAAY,CAAQ;QAC/D,KAAK,CACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport {\n ComparisonOperator,\n FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n JoinOperation,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { TokenEditor } from './token-editor';\nimport { getExtendedOperator, getPropertyByKey } from './controller';\n\nimport FilteringToken from '../internal/components/filtering-token';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\n\ninterface TokenProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n disableFreeTextFiltering?: boolean;\n expandToViewport?: boolean;\n filteringOptions: readonly FilteringOption[];\n filteringProperties: readonly FilteringProperty[];\n first?: boolean;\n hideOperations?: boolean;\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operation: JoinOperation;\n removeToken: () => void;\n setOperation: (newOperation: JoinOperation) => void;\n setToken: (newToken: Token) => void;\n token: Token;\n}\n\nexport const TokenButton = ({\n token,\n operation = 'and',\n first,\n removeToken,\n setToken,\n setOperation,\n filteringOptions,\n filteringProperties,\n asyncProps,\n onLoadItems,\n i18nStrings,\n asyncProperties,\n hideOperations,\n customGroupsText,\n disabled,\n disableFreeTextFiltering,\n expandToViewport,\n}: TokenProps) => {\n const valueFormatter =\n token.propertyKey && getExtendedOperator(filteringProperties, token.propertyKey, token.operator)?.format;\n const property = token.propertyKey && getPropertyByKey(filteringProperties, token.propertyKey);\n const propertyLabel = property && property.propertyLabel;\n const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;\n return (\n <FilteringToken\n showOperation={!first && !hideOperations}\n operation={operation}\n andText={i18nStrings.operationAndText}\n orText={i18nStrings.operationOrText}\n dismissAriaLabel={i18nStrings.removeTokenButtonAriaLabel(token)}\n onChange={setOperation}\n onDismiss={removeToken}\n disabled={disabled}\n >\n <TokenEditor\n setToken={setToken}\n triggerComponent={\n <span className={styles['token-trigger']}>\n <TokenTrigger property={propertyLabel} operator={token.operator} value={tokenValue} />\n </span>\n }\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n token={token}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n expandToViewport={expandToViewport}\n />\n </FilteringToken>\n );\n};\n\nconst TokenTrigger = ({\n property,\n operator,\n value,\n}: {\n property?: string;\n operator?: ComparisonOperator;\n value: string;\n}) => {\n if (property) {\n property += ' ';\n }\n const freeTextContainsToken = operator === ':' && !property;\n const operatorText = freeTextContainsToken ? '' : operator + ' ';\n return (\n <>\n {property}\n <span className={styles['token-operator']}>{operatorText}</span>\n {value}\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/property-filter/token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MA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S,EAAE,WAAW,EACtB,QAAQ,EAAE,QAAQ;QAElB,oBAAC,WAAW,IACV,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EACd,8BAAM,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC;gBACtC,oBAAC,YAAY,IAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAI,CACjF,EAET,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,wBAAwB,EAAE,wBAAwB,EAClD,gBAAgB,EAAE,gBAAgB,GAClC,CACa,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,YAAY,GAAG,UAAC,EAQrB;QAPC,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,KAAK,WAAA;IAML,IAAI,QAAQ,EAAE;QACZ,QAAQ,IAAI,GAAG,CAAC;KACjB;IACD,IAAM,qBAAqB,GAAG,QAAQ,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC5D,IAAM,YAAY,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC;IACjE,OAAO,CACL;QACG,QAAQ;QACT,8BAAM,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,YAAY,CAAQ;QAC/D,KAAK,CACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport {\n ComparisonOperator,\n FilteringOption,\n FilteringProperty,\n GroupText,\n I18nStrings,\n JoinOperation,\n LoadItemsDetail,\n Token,\n} from './interfaces';\nimport styles from './styles.css.js';\nimport { TokenEditor } from './token-editor';\nimport { getExtendedOperator, getPropertyByKey } from './controller';\n\nimport FilteringToken from '../internal/components/filtering-token';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status/interfaces';\n\ninterface TokenProps {\n asyncProperties?: boolean;\n asyncProps: DropdownStatusProps;\n customGroupsText: readonly GroupText[];\n disabled?: boolean;\n disableFreeTextFiltering?: boolean;\n expandToViewport?: boolean;\n filteringOptions: readonly FilteringOption[];\n filteringProperties: readonly FilteringProperty[];\n first?: boolean;\n hideOperations?: boolean;\n i18nStrings: I18nStrings;\n onLoadItems?: NonCancelableEventHandler<LoadItemsDetail>;\n operation: JoinOperation;\n removeToken: () => void;\n setOperation: (newOperation: JoinOperation) => void;\n setToken: (newToken: Token) => void;\n token: Token;\n}\n\nexport const TokenButton = ({\n token,\n operation = 'and',\n first,\n removeToken,\n setToken,\n setOperation,\n filteringOptions,\n filteringProperties,\n asyncProps,\n onLoadItems,\n i18nStrings,\n asyncProperties,\n hideOperations,\n customGroupsText,\n disabled,\n disableFreeTextFiltering,\n expandToViewport,\n}: TokenProps) => {\n const valueFormatter =\n token.propertyKey && getExtendedOperator(filteringProperties, token.propertyKey, token.operator)?.format;\n const property = token.propertyKey && getPropertyByKey(filteringProperties, token.propertyKey);\n const propertyLabel = property && property.propertyLabel;\n const tokenValue = valueFormatter ? valueFormatter(token.value) : token.value;\n return (\n <FilteringToken\n showOperation={!first && !hideOperations}\n operation={operation}\n andText={i18nStrings.operationAndText}\n orText={i18nStrings.operationOrText}\n dismissAriaLabel={i18nStrings.removeTokenButtonAriaLabel(token)}\n operatorAriaLabel={i18nStrings.tokenOperatorAriaLabel}\n onChange={setOperation}\n onDismiss={removeToken}\n disabled={disabled}\n >\n <TokenEditor\n setToken={setToken}\n triggerComponent={\n <span className={styles['token-trigger']}>\n <TokenTrigger property={propertyLabel} operator={token.operator} value={tokenValue} />\n </span>\n }\n filteringOptions={filteringOptions}\n filteringProperties={filteringProperties}\n token={token}\n asyncProps={asyncProps}\n onLoadItems={onLoadItems}\n i18nStrings={i18nStrings}\n asyncProperties={asyncProperties}\n customGroupsText={customGroupsText}\n disableFreeTextFiltering={disableFreeTextFiltering}\n expandToViewport={expandToViewport}\n />\n </FilteringToken>\n );\n};\n\nconst TokenTrigger = ({\n property,\n operator,\n value,\n}: {\n property?: string;\n operator?: ComparisonOperator;\n value: string;\n}) => {\n if (property) {\n property += ' ';\n }\n const freeTextContainsToken = operator === ':' && !property;\n const operatorText = freeTextContainsToken ? '' : operator + ' ';\n return (\n <>\n {property}\n <span className={styles['token-operator']}>{operatorText}</span>\n {value}\n </>\n );\n};\n"]}
|
package/select/parts/filter.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export interface FilterProps extends InternalInputProps {
|
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
6
|
filteringType: SelectProps.FilteringType;
|
|
7
7
|
}
|
|
8
|
-
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "invalid" | "__internalRootRef" | "ariaLabel" | "__nativeAttributes" | "ariaLabelledby" | "ariaDescribedby" | "controlId" | "ariaRequired" | "disableBrowserAutocorrect" | "spellcheck" | "__leftIcon" | "__leftIconVariant" | "__onLeftIconClick" | "__rightIcon" | "__rightIconVariant" | "__onRightIconClick" | "__noBorderRadius" | "__onDelayedInput" | "__onBlurWithDetail" | "__inheritFormFieldProps"
|
|
8
|
+
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "invalid" | "__internalRootRef" | "ariaLabel" | "__nativeAttributes" | "ariaLabelledby" | "ariaDescribedby" | "controlId" | "filteringType" | "ariaRequired" | "disableBrowserAutocorrect" | "spellcheck" | "__leftIcon" | "__leftIconVariant" | "__onLeftIconClick" | "__rightIcon" | "__rightIconVariant" | "__onRightIconClick" | "__noBorderRadius" | "__onDelayedInput" | "__onBlurWithDetail" | "__inheritFormFieldProps"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export default Filter;
|
|
10
10
|
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { DropdownOption, OptionDefinition } from '../../internal/components/opti
|
|
|
4
4
|
import { OptionsListProps } from '../../internal/components/options-list';
|
|
5
5
|
import { FilterProps } from '../parts/filter';
|
|
6
6
|
import { ItemProps } from '../parts/item';
|
|
7
|
-
import { BaseKeyDetail, NonCancelableEventHandler
|
|
7
|
+
import { BaseKeyDetail, NonCancelableEventHandler } from '../../internal/events';
|
|
8
8
|
export declare type MenuProps = Omit<OptionsListProps, 'children'> & {
|
|
9
9
|
ref: React.RefObject<HTMLUListElement>;
|
|
10
10
|
};
|
|
@@ -28,12 +28,6 @@ export interface SelectTriggerProps {
|
|
|
28
28
|
onKeyDown?: (event: CustomEvent<BaseKeyDetail>) => void;
|
|
29
29
|
onFocus: NonCancelableEventHandler;
|
|
30
30
|
}
|
|
31
|
-
export interface RecoveryLinkProps {
|
|
32
|
-
ref: RefObject<HTMLAnchorElement>;
|
|
33
|
-
onBlur: CancelableEventHandler<{
|
|
34
|
-
relatedTarget: Node | null;
|
|
35
|
-
}>;
|
|
36
|
-
}
|
|
37
31
|
export declare function useSelect({ selectedOptions, updateSelectedOption, options, filteringType, onBlur, onFocus, externalRef, keepOpen, fireLoadItems, setFilteringValue, useInteractiveGroups, }: UseSelectProps): {
|
|
38
32
|
isOpen: boolean;
|
|
39
33
|
highlightedOption: DropdownOption | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-select.d.ts","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,6CAA6C,CAAC;AAS5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,
|
|
1
|
+
{"version":3,"file":"use-select.d.ts","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,6CAA6C,CAAC;AAS5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAA0B,MAAM,uBAAuB,CAAC;AAGzG,oBAAY,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG;IAAE,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;CAAE,CAAC;AACxG,oBAAY,cAAc,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;AAElF,UAAU,cAAc;IACtB,eAAe,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD,oBAAoB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzD,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,aAAa,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,iBAAiB,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,yBAAyB,CAAC;CACpC;AAED,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,MAAM,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,oBAA4B,GAC7B,EAAE,cAAc;;;;;;4BA+Ee,KAAK,aAAa,EAAE,SAAS,GAAG,QAAQ,CAAC;;0BAuB5C,QAAQ,WAAW,CAAC;6BAyDf,cAAc,SAAS,MAAM;;;;EA6D9D"}
|
|
@@ -7,7 +7,7 @@ import { getOptionId } from '../../internal/components/options-list/utils/use-id
|
|
|
7
7
|
import { connectOptionsByValue } from './connect-options';
|
|
8
8
|
import useForwardFocus from '../../internal/hooks/forward-focus';
|
|
9
9
|
import { usePrevious } from '../../internal/hooks/use-previous';
|
|
10
|
-
import { fireNonCancelableEvent
|
|
10
|
+
import { fireNonCancelableEvent } from '../../internal/events';
|
|
11
11
|
import { useUniqueId } from '../../internal/hooks/use-unique-id';
|
|
12
12
|
export function useSelect(_a) {
|
|
13
13
|
var selectedOptions = _a.selectedOptions, updateSelectedOption = _a.updateSelectedOption, options = _a.options, filteringType = _a.filteringType, onBlur = _a.onBlur, onFocus = _a.onFocus, externalRef = _a.externalRef, keepOpen = _a.keepOpen, fireLoadItems = _a.fireLoadItems, setFilteringValue = _a.setFilteringValue, _b = _a.useInteractiveGroups, useInteractiveGroups = _b === void 0 ? false : _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-select.js","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAC;AACnH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAChH,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAIjE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAIL,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AA+BjE,MAAM,UAAU,SAAS,CAAC,EAYT;QAXf,eAAe,qBAAA,EACf,oBAAoB,0BAAA,EACpB,OAAO,aAAA,EACP,aAAa,mBAAA,EACb,MAAM,YAAA,EACN,OAAO,aAAA,EACP,WAAW,iBAAA,EACX,QAAQ,c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,cAAc,gBAAA;QACd,cAAc,gBAAA;QACd,eAAe,EAAE,2BAA2B;QAC5C,YAAY,cAAA;QACZ,gBAAgB,kBAAA;KACjB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject } from 'react';\nimport { DropdownProps } from '../../internal/components/dropdown/interfaces';\nimport { DropdownOption, OptionDefinition, OptionGroup } from '../../internal/components/option/interfaces';\nimport { isInteractive, isGroupInteractive, isGroup } from '../../internal/components/option/utils/filter-options';\nimport { useEffect, useRef } from 'react';\nimport { useHighlightedOption } from '../../internal/components/options-list/utils/use-highlight-option';\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { useMenuKeyboard, useTriggerKeyboard } from '../../internal/components/options-list/utils/use-keyboard';\nimport { getOptionId } from '../../internal/components/options-list/utils/use-ids';\nimport { connectOptionsByValue } from './connect-options';\nimport useForwardFocus from '../../internal/hooks/forward-focus';\nimport { OptionsListProps } from '../../internal/components/options-list';\nimport { FilterProps } from '../parts/filter';\nimport { ItemProps } from '../parts/item';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport {\n BaseKeyDetail,\n NonCancelableEventHandler,\n CancelableEventHandler,\n fireNonCancelableEvent,\n} from '../../internal/events';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\n\nexport type MenuProps = Omit<OptionsListProps, 'children'> & { ref: React.RefObject<HTMLUListElement> };\nexport type GetOptionProps = (option: DropdownOption, index: number) => ItemProps;\n\ninterface UseSelectProps {\n selectedOptions: ReadonlyArray<OptionDefinition>;\n updateSelectedOption: (option: OptionDefinition) => void;\n options: ReadonlyArray<DropdownOption>;\n filteringType: string;\n keepOpen?: boolean;\n onBlur?: NonCancelableEventHandler;\n onFocus?: NonCancelableEventHandler;\n externalRef: React.Ref<any>;\n fireLoadItems: (filteringText: string) => void;\n setFilteringValue: (filteringText: string) => void;\n useInteractiveGroups?: boolean;\n}\n\nexport interface SelectTriggerProps {\n ref: RefObject<HTMLButtonElement>;\n onMouseDown?: (event: CustomEvent) => void;\n onKeyDown?: (event: CustomEvent<BaseKeyDetail>) => void;\n onFocus: NonCancelableEventHandler;\n}\n\nexport interface RecoveryLinkProps {\n ref: RefObject<HTMLAnchorElement>;\n onBlur: CancelableEventHandler<{ relatedTarget: Node | null }>;\n}\n\nexport function useSelect({\n selectedOptions,\n updateSelectedOption,\n options,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups = false,\n}: UseSelectProps) {\n const interactivityCheck = useInteractiveGroups ? isGroupInteractive : isInteractive;\n\n const isHighlightable = (option?: DropdownOption) => !!option && (useInteractiveGroups || option.type !== 'parent');\n\n const filterRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLUListElement>(null);\n const hasFilter = filteringType !== 'none';\n const activeRef = hasFilter ? filterRef : menuRef;\n const isSelectingUsingSpace = useRef<boolean>(false);\n const __selectedOptions = connectOptionsByValue(options, selectedOptions);\n const __selectedValuesSet = selectedOptions.reduce((selectedValuesSet: Set<string>, item: OptionDefinition) => {\n if (item.value) {\n selectedValuesSet.add(item.value);\n }\n return selectedValuesSet;\n }, new Set<string>());\n const [\n { highlightType, highlightedOption, highlightedIndex },\n {\n moveHighlightWithKeyboard,\n resetHighlightWithKeyboard,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n goHomeWithKeyboard,\n goEndWithKeyboard,\n },\n ] = useHighlightedOption({ options, isHighlightable });\n\n const { isOpen, openDropdown, closeDropdown, toggleDropdown } = useOpenState({\n onOpen: () => fireLoadItems(''),\n onClose: () => {\n resetHighlightWithKeyboard();\n setFilteringValue('');\n },\n });\n\n const handleFocus = () => {\n fireNonCancelableEvent(onFocus, {});\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, {});\n closeDropdown();\n };\n\n const hasSelectedOption = __selectedOptions.length > 0;\n const menuId = useUniqueId('option-list');\n const highlightedOptionId = getOptionId(menuId, highlightedIndex);\n\n const selectOption = (option?: DropdownOption) => {\n isSelectingUsingSpace.current = false;\n const optionToSelect = option || highlightedOption;\n if (!optionToSelect || !interactivityCheck(optionToSelect)) {\n return;\n }\n updateSelectedOption(optionToSelect.option);\n if (!keepOpen) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n };\n\n const activeKeyDownHandler = useMenuKeyboard({\n moveHighlight: moveHighlightWithKeyboard,\n selectOption,\n goHome: goHomeWithKeyboard,\n goEnd: goEndWithKeyboard,\n closeDropdown: () => {\n triggerRef.current?.focus();\n closeDropdown();\n },\n isSelectingUsingSpace,\n preventNativeSpace: !hasFilter,\n });\n\n const triggerKeyDownHandler = useTriggerKeyboard({ openDropdown, goHome: goHomeWithKeyboard });\n\n const getDropdownProps: () => Pick<DropdownProps, 'onFocus' | 'onBlur'> = () => ({\n onFocus: handleFocus,\n onBlur: handleBlur,\n });\n\n const getTriggerProps = (disabled = false) => {\n const triggerProps: SelectTriggerProps = {\n ref: triggerRef,\n onFocus: () => closeDropdown(),\n };\n if (!disabled) {\n triggerProps.onMouseDown = (event: CustomEvent) => {\n event.preventDefault(); // prevent current focus from blurring as it immediately closes the dropdown\n if (isOpen) {\n triggerRef.current?.focus();\n }\n toggleDropdown();\n };\n triggerProps.onKeyDown = triggerKeyDownHandler;\n }\n return triggerProps;\n };\n\n const getFilterProps = (): Partial<FilterProps> => {\n if (!hasFilter) {\n return {};\n }\n\n return {\n ref: filterRef,\n onKeyDown: activeKeyDownHandler,\n onChange: event => {\n setFilteringValue(event.detail.value);\n resetHighlightWithKeyboard();\n },\n __onDelayedInput: event => {\n fireLoadItems(event.detail.value);\n },\n __nativeAttributes: {\n 'aria-activedescendant': highlightedOptionId,\n ['aria-owns']: menuId,\n ['aria-controls']: menuId,\n },\n };\n };\n\n const getMenuProps = () => {\n const menuProps: MenuProps = {\n id: menuId,\n ref: menuRef,\n open: isOpen,\n onMouseUp: itemIndex => {\n if (itemIndex > -1) {\n selectOption(options[itemIndex]);\n }\n },\n onMouseMove: itemIndex => {\n if (itemIndex > -1) {\n setHighlightedIndexWithMouse(itemIndex);\n }\n },\n };\n if (!hasFilter) {\n menuProps.onKeyDown = activeKeyDownHandler;\n menuProps.nativeAttributes = {\n 'aria-activedescendant': highlightedOptionId,\n };\n }\n return menuProps;\n };\n const getGroupState = (option: OptionGroup) => {\n const totalSelected = option.options.filter(item => !!item.value && __selectedValuesSet.has(item.value)).length;\n const hasSelected = totalSelected > 0;\n const allSelected = totalSelected === option.options.length;\n return {\n selected: hasSelected && allSelected,\n indeterminate: hasSelected && !allSelected,\n };\n };\n\n const getOptionProps = (option: DropdownOption, index: number) => {\n const highlighted = option === highlightedOption;\n const groupState = isGroup(option.option) ? getGroupState(option.option) : undefined;\n const selected = __selectedOptions.indexOf(option) > -1 || !!groupState?.selected;\n const nextOption = options[index + 1]?.option;\n const isNextSelected =\n !!nextOption && isGroup(nextOption)\n ? getGroupState(nextOption).selected\n : __selectedOptions.indexOf(options[index + 1]) > -1;\n\n const optionProps: any = {\n key: index,\n option,\n highlighted,\n selected,\n isNextSelected,\n indeterminate: !!groupState?.indeterminate,\n ['data-mouse-target']: isHighlightable(option) ? index : -1,\n id: getOptionId(menuId, index),\n };\n\n return optionProps;\n };\n\n const prevOpen = usePrevious<boolean>(isOpen);\n useEffect(() => {\n // highlight the first selected option, when opening the Select component\n if (isOpen && !prevOpen && hasSelectedOption) {\n setHighlightedIndexWithMouse(options.indexOf(__selectedOptions[0]));\n }\n }, [isOpen, __selectedOptions, hasSelectedOption, setHighlightedIndexWithMouse, options, prevOpen]);\n\n useEffect(() => {\n if (isOpen) {\n // dropdown-fit calculations ensure that the dropdown will fit inside the current\n // viewport, so prevent the browser from trying to scroll it into view (e.g. if\n // scroll-padding-top is set on a parent)\n activeRef.current?.focus({ preventScroll: true });\n }\n }, [isOpen, activeRef]);\n\n useForwardFocus(externalRef, triggerRef as React.RefObject<HTMLElement>);\n const highlightedGroupSelected =\n !!highlightedOption && isGroup(highlightedOption.option) && getGroupState(highlightedOption.option).selected;\n const announceSelected =\n !!highlightedOption && (__selectedOptions.indexOf(highlightedOption) > -1 || highlightedGroupSelected);\n\n return {\n isOpen,\n highlightedOption,\n highlightedIndex,\n highlightType,\n getTriggerProps,\n getDropdownProps,\n getMenuProps,\n getFilterProps,\n getOptionProps,\n highlightOption: highlightOptionWithKeyboard,\n selectOption,\n announceSelected,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-select.js","sourceRoot":"","sources":["../../../../src/select/utils/use-select.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAC;AACnH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAChH,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAIjE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAA4C,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AA0BjE,MAAM,UAAU,SAAS,CAAC,EAYT;QAXf,eAAe,qBAAA,EACf,oBAAoB,0BAAA,EACpB,OAAO,aAAA,EACP,aAAa,mBAAA,EACb,MAAM,YAAA,EACN,OAAO,aAAA,EACP,WAAW,iBAAA,EACX,QAAQ,cAAA,EACR,aAAa,mBAAA,EACb,iBAAiB,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d,eAAe,EAAE,2BAA2B;QAC5C,YAAY,cAAA;QACZ,gBAAgB,kBAAA;KACjB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject } from 'react';\nimport { DropdownProps } from '../../internal/components/dropdown/interfaces';\nimport { DropdownOption, OptionDefinition, OptionGroup } from '../../internal/components/option/interfaces';\nimport { isInteractive, isGroupInteractive, isGroup } from '../../internal/components/option/utils/filter-options';\nimport { useEffect, useRef } from 'react';\nimport { useHighlightedOption } from '../../internal/components/options-list/utils/use-highlight-option';\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { useMenuKeyboard, useTriggerKeyboard } from '../../internal/components/options-list/utils/use-keyboard';\nimport { getOptionId } from '../../internal/components/options-list/utils/use-ids';\nimport { connectOptionsByValue } from './connect-options';\nimport useForwardFocus from '../../internal/hooks/forward-focus';\nimport { OptionsListProps } from '../../internal/components/options-list';\nimport { FilterProps } from '../parts/filter';\nimport { ItemProps } from '../parts/item';\nimport { usePrevious } from '../../internal/hooks/use-previous';\nimport { BaseKeyDetail, NonCancelableEventHandler, fireNonCancelableEvent } from '../../internal/events';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\n\nexport type MenuProps = Omit<OptionsListProps, 'children'> & { ref: React.RefObject<HTMLUListElement> };\nexport type GetOptionProps = (option: DropdownOption, index: number) => ItemProps;\n\ninterface UseSelectProps {\n selectedOptions: ReadonlyArray<OptionDefinition>;\n updateSelectedOption: (option: OptionDefinition) => void;\n options: ReadonlyArray<DropdownOption>;\n filteringType: string;\n keepOpen?: boolean;\n onBlur?: NonCancelableEventHandler;\n onFocus?: NonCancelableEventHandler;\n externalRef: React.Ref<any>;\n fireLoadItems: (filteringText: string) => void;\n setFilteringValue: (filteringText: string) => void;\n useInteractiveGroups?: boolean;\n}\n\nexport interface SelectTriggerProps {\n ref: RefObject<HTMLButtonElement>;\n onMouseDown?: (event: CustomEvent) => void;\n onKeyDown?: (event: CustomEvent<BaseKeyDetail>) => void;\n onFocus: NonCancelableEventHandler;\n}\n\nexport function useSelect({\n selectedOptions,\n updateSelectedOption,\n options,\n filteringType,\n onBlur,\n onFocus,\n externalRef,\n keepOpen,\n fireLoadItems,\n setFilteringValue,\n useInteractiveGroups = false,\n}: UseSelectProps) {\n const interactivityCheck = useInteractiveGroups ? isGroupInteractive : isInteractive;\n\n const isHighlightable = (option?: DropdownOption) => !!option && (useInteractiveGroups || option.type !== 'parent');\n\n const filterRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLUListElement>(null);\n const hasFilter = filteringType !== 'none';\n const activeRef = hasFilter ? filterRef : menuRef;\n const isSelectingUsingSpace = useRef<boolean>(false);\n const __selectedOptions = connectOptionsByValue(options, selectedOptions);\n const __selectedValuesSet = selectedOptions.reduce((selectedValuesSet: Set<string>, item: OptionDefinition) => {\n if (item.value) {\n selectedValuesSet.add(item.value);\n }\n return selectedValuesSet;\n }, new Set<string>());\n const [\n { highlightType, highlightedOption, highlightedIndex },\n {\n moveHighlightWithKeyboard,\n resetHighlightWithKeyboard,\n setHighlightedIndexWithMouse,\n highlightOptionWithKeyboard,\n goHomeWithKeyboard,\n goEndWithKeyboard,\n },\n ] = useHighlightedOption({ options, isHighlightable });\n\n const { isOpen, openDropdown, closeDropdown, toggleDropdown } = useOpenState({\n onOpen: () => fireLoadItems(''),\n onClose: () => {\n resetHighlightWithKeyboard();\n setFilteringValue('');\n },\n });\n\n const handleFocus = () => {\n fireNonCancelableEvent(onFocus, {});\n };\n\n const handleBlur = () => {\n fireNonCancelableEvent(onBlur, {});\n closeDropdown();\n };\n\n const hasSelectedOption = __selectedOptions.length > 0;\n const menuId = useUniqueId('option-list');\n const highlightedOptionId = getOptionId(menuId, highlightedIndex);\n\n const selectOption = (option?: DropdownOption) => {\n isSelectingUsingSpace.current = false;\n const optionToSelect = option || highlightedOption;\n if (!optionToSelect || !interactivityCheck(optionToSelect)) {\n return;\n }\n updateSelectedOption(optionToSelect.option);\n if (!keepOpen) {\n triggerRef.current?.focus();\n closeDropdown();\n }\n };\n\n const activeKeyDownHandler = useMenuKeyboard({\n moveHighlight: moveHighlightWithKeyboard,\n selectOption,\n goHome: goHomeWithKeyboard,\n goEnd: goEndWithKeyboard,\n closeDropdown: () => {\n triggerRef.current?.focus();\n closeDropdown();\n },\n isSelectingUsingSpace,\n preventNativeSpace: !hasFilter,\n });\n\n const triggerKeyDownHandler = useTriggerKeyboard({ openDropdown, goHome: goHomeWithKeyboard });\n\n const getDropdownProps: () => Pick<DropdownProps, 'onFocus' | 'onBlur'> = () => ({\n onFocus: handleFocus,\n onBlur: handleBlur,\n });\n\n const getTriggerProps = (disabled = false) => {\n const triggerProps: SelectTriggerProps = {\n ref: triggerRef,\n onFocus: () => closeDropdown(),\n };\n if (!disabled) {\n triggerProps.onMouseDown = (event: CustomEvent) => {\n event.preventDefault(); // prevent current focus from blurring as it immediately closes the dropdown\n if (isOpen) {\n triggerRef.current?.focus();\n }\n toggleDropdown();\n };\n triggerProps.onKeyDown = triggerKeyDownHandler;\n }\n return triggerProps;\n };\n\n const getFilterProps = (): Partial<FilterProps> => {\n if (!hasFilter) {\n return {};\n }\n\n return {\n ref: filterRef,\n onKeyDown: activeKeyDownHandler,\n onChange: event => {\n setFilteringValue(event.detail.value);\n resetHighlightWithKeyboard();\n },\n __onDelayedInput: event => {\n fireLoadItems(event.detail.value);\n },\n __nativeAttributes: {\n 'aria-activedescendant': highlightedOptionId,\n ['aria-owns']: menuId,\n ['aria-controls']: menuId,\n },\n };\n };\n\n const getMenuProps = () => {\n const menuProps: MenuProps = {\n id: menuId,\n ref: menuRef,\n open: isOpen,\n onMouseUp: itemIndex => {\n if (itemIndex > -1) {\n selectOption(options[itemIndex]);\n }\n },\n onMouseMove: itemIndex => {\n if (itemIndex > -1) {\n setHighlightedIndexWithMouse(itemIndex);\n }\n },\n };\n if (!hasFilter) {\n menuProps.onKeyDown = activeKeyDownHandler;\n menuProps.nativeAttributes = {\n 'aria-activedescendant': highlightedOptionId,\n };\n }\n return menuProps;\n };\n const getGroupState = (option: OptionGroup) => {\n const totalSelected = option.options.filter(item => !!item.value && __selectedValuesSet.has(item.value)).length;\n const hasSelected = totalSelected > 0;\n const allSelected = totalSelected === option.options.length;\n return {\n selected: hasSelected && allSelected,\n indeterminate: hasSelected && !allSelected,\n };\n };\n\n const getOptionProps = (option: DropdownOption, index: number) => {\n const highlighted = option === highlightedOption;\n const groupState = isGroup(option.option) ? getGroupState(option.option) : undefined;\n const selected = __selectedOptions.indexOf(option) > -1 || !!groupState?.selected;\n const nextOption = options[index + 1]?.option;\n const isNextSelected =\n !!nextOption && isGroup(nextOption)\n ? getGroupState(nextOption).selected\n : __selectedOptions.indexOf(options[index + 1]) > -1;\n\n const optionProps: any = {\n key: index,\n option,\n highlighted,\n selected,\n isNextSelected,\n indeterminate: !!groupState?.indeterminate,\n ['data-mouse-target']: isHighlightable(option) ? index : -1,\n id: getOptionId(menuId, index),\n };\n\n return optionProps;\n };\n\n const prevOpen = usePrevious<boolean>(isOpen);\n useEffect(() => {\n // highlight the first selected option, when opening the Select component\n if (isOpen && !prevOpen && hasSelectedOption) {\n setHighlightedIndexWithMouse(options.indexOf(__selectedOptions[0]));\n }\n }, [isOpen, __selectedOptions, hasSelectedOption, setHighlightedIndexWithMouse, options, prevOpen]);\n\n useEffect(() => {\n if (isOpen) {\n // dropdown-fit calculations ensure that the dropdown will fit inside the current\n // viewport, so prevent the browser from trying to scroll it into view (e.g. if\n // scroll-padding-top is set on a parent)\n activeRef.current?.focus({ preventScroll: true });\n }\n }, [isOpen, activeRef]);\n\n useForwardFocus(externalRef, triggerRef as React.RefObject<HTMLElement>);\n const highlightedGroupSelected =\n !!highlightedOption && isGroup(highlightedOption.option) && getGroupState(highlightedOption.option).selected;\n const announceSelected =\n !!highlightedOption && (__selectedOptions.indexOf(highlightedOption) > -1 || highlightedGroupSelected);\n\n return {\n isOpen,\n highlightedOption,\n highlightedIndex,\n highlightType,\n getTriggerProps,\n getDropdownProps,\n getMenuProps,\n getFilterProps,\n getOptionProps,\n highlightOption: highlightOptionWithKeyboard,\n selectOption,\n announceSelected,\n };\n}\n"]}
|
package/table/interfaces.d.ts
CHANGED
|
@@ -193,6 +193,21 @@ export interface TableProps<T = any> extends BaseComponentProps {
|
|
|
193
193
|
* @visualrefresh `embedded`, `stacked`, and `full-page` variants
|
|
194
194
|
*/
|
|
195
195
|
variant?: TableProps.Variant;
|
|
196
|
+
/**
|
|
197
|
+
* Use this property to inform screen readers how many items there are in a table.
|
|
198
|
+
* It specifies the total count of all items in a table.
|
|
199
|
+
* If there is an unknown total of items in a table, leave this property undefined. */
|
|
200
|
+
totalItemsCount?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Use this property to inform screen readers which range of items is currently displayed in the table.
|
|
203
|
+
* It specifies the index (1-based) of the first item in the table.
|
|
204
|
+
* If the table has no pagination, leave this property undefined. */
|
|
205
|
+
firstIndex?: number;
|
|
206
|
+
/**
|
|
207
|
+
* Use this function to announce page changes to screen reader users.
|
|
208
|
+
* Requires the properties firstIndex and totalItemsCount to be set correctly.
|
|
209
|
+
*/
|
|
210
|
+
renderAriaLive?: (data: TableProps.LiveAnnouncement) => string;
|
|
196
211
|
}
|
|
197
212
|
export declare namespace TableProps {
|
|
198
213
|
type TrackBy<T> = string | ((item: T) => string);
|
|
@@ -246,6 +261,11 @@ export declare namespace TableProps {
|
|
|
246
261
|
interface ColumnWidthsChangeDetail {
|
|
247
262
|
widths: ReadonlyArray<number>;
|
|
248
263
|
}
|
|
264
|
+
interface LiveAnnouncement {
|
|
265
|
+
totalItemsCount?: number;
|
|
266
|
+
firstIndex: number;
|
|
267
|
+
lastIndex: number;
|
|
268
|
+
}
|
|
249
269
|
interface Ref {
|
|
250
270
|
/**
|
|
251
271
|
* When the sticky header is enabled and you call this function, the table
|
|
@@ -1 +1 @@
|
|
|
1
|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,CAAC;KAC/B;IAED,UAAiB,gBAAgB;QAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,GAAG;QAClB;;;WAGG;QACH,WAAW,IAAI,IAAI,CAAC;KACrB;CACF"}
|
package/table/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/table/interfaces.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, CancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface TableForwardRefType {\n <T>(props: TableProps<T> & { ref?: React.Ref<TableProps.Ref> }): JSX.Element;\n}\nexport interface TableProps<T = any> extends BaseComponentProps {\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Footer of the table container.\n */\n footer?: React.ReactNode;\n\n /**\n * Displayed when the `items` property is an empty array. Use it to render an empty or no-match state.\n */\n empty?: React.ReactNode;\n\n /**\n * Specifies the data that's displayed in the table rows. Each item contains the data for one row. The display of a row is handled\n * by the `cell` property of each column definition in the `columnDefinitions` property.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the table in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text that's displayed when the table is in a loading state.\n */\n loadingText?: string;\n\n /**\n * Specifies a property that uniquely identifies an individual item.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used to connect `items` and `selectedItems` values when they reference different objects.\n */\n trackBy?: TableProps.TrackBy<T>;\n\n /**\n * The columns configuration object\n * * `id` (string) - Specifies a unique column identifier. The property is used 1) as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering,\n * and 2) to match entries in the `visibleColumns` property, if defined.\n * * `header` (ReactNode) - Determines the display of the column header.\n * * `cell` ((item) => ReactNode) - Determines the display of a cell's content. You receive the current table row\n * item as an argument.\n * * `width` (string | number) - Specifies the column width. Corresponds to the `width` css-property. If the width is not set,\n * the browser automatically adjusts the column width based on the content. When `resizableColumns` property is\n * set to `true`, additional constraints apply: 1) string values are not allowed, and 2) the last visible column always\n * fills the remaining space of the table so the specified width is ignored.\n * * `minWidth` (string | number) - Specifies the minimum column width. Corresponds to the `min-width` css-property. When\n * `resizableColumns` property is set to `true`, additional constraints apply: 1) string values are not allowed,\n * and 2) the column can't resize below than the specified width (defaults to \"120px\").\n * * `maxWidth` (string | number) - Specifies the maximum column width. Corresponds to the `max-width` css-property.\n * Note that when the `resizableColumns` property is set to `true` this property is ignored.\n * * `ariaLabel` (LabelData => string) - An optional function that's called to provide an `aria-label` for the cell header.\n * It receives the current sorting state of this column, the direction it's sorted in, and an indication of\n * whether the sorting is disabled, as three Boolean values: `sorted`, `descending` and `disabled`.\n * We recommend that you use this for sortable columns to provide more meaningful labels based on the\n * current sorting direction.\n * * `sortingField` (string) - Enables default column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. Provide the name of the property within each item that should be used for sorting by this column.\n * For more complex sorting use `sortingComparator` instead.\n * * `sortingComparator` ((T, T) => number) - Enables custom column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. This property accepts a custom comparator that is used to compare two items.\n * The comparator must implement ascending ordering, and the output is inverted automatically in case of descending order.\n * If present, the `sortingField` property is ignored.\n *\n */\n columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<T>>;\n /**\n * Specifies the selection type (`'single' | 'multi'`).\n */\n selectionType?: TableProps.SelectionType;\n /**\n * List of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n\n /**\n * Use this slot to add filtering controls to the table.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the table.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the table.\n */\n preferences?: React.ReactNode;\n\n /**\n * Determines whether a given item is disabled. If an item is disabled, the user can't select it.\n */\n isItemDisabled?: TableProps.IsItemDisabled<T>;\n\n /**\n * Specifies if text wraps within table cells. If set to `true`, long text within cells may wrap onto\n * multiple lines instead of being truncated with an ellipsis.\n */\n wrapLines?: boolean;\n\n /**\n * Specifies if columns can be resized. If set to `true`, users can resize the columns in the table.\n */\n resizableColumns?: boolean;\n\n /**\n * Specifies alternative text for the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Specifies the alternative text for an item.\n * * `allItemsSelectionLabel` ((SelectionState) => string) - Specifies the alternative text for multi-selection column header.\n * * `selectionGroupLabel` (string) - Specifies the alternative text for the whole selection and single-selection column header.\n * It is prefixed to `itemSelectionLabel` and `allItemsSelectionLabel` when they are set.\n * * `tableLabel` (string) - Provides a alternative text for the table. If you use a header for this table, you may reuse the string\n * to provide a caption-like description. For example, tableLabel=Instances will be announced as 'Instances table'.\n *\n * You can use the first argument of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The `itemSelectionLabel` for individual\n * items also receives the corresponding `Item` object. You can use the `selectionGroupLabel` to\n * add a meaningful description to the whole selection.\n */\n ariaLabels?: TableProps.AriaLabels<T>;\n\n /**\n * Specifies the definition object of the currently sorted column. Make sure you pass an object that's\n * present in the `columnDefinitions` array.\n */\n sortingColumn?: TableProps.SortingColumn<T>;\n /**\n * Specifies whether to use a descending sort order.\n */\n sortingDescending?: boolean;\n /**\n * Specifies if sorting buttons are disabled. For example, use this property\n * to prevent the user from sorting before items are fully loaded.\n */\n sortingDisabled?: boolean;\n\n /**\n * Specifies an array containing the `id`s of visible columns. If not set, all columns are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of ids doesn't influence the order in which columns are displayed - this is dictated by the `columnDefinitions` property\n */\n visibleColumns?: ReadonlyArray<string>;\n\n /**\n * Fired when the user resizes a table column. The event detail contains an array of column widths in pixels,\n * including the hidden via preferences columns. Use this event to persist the column widths.\n */\n onColumnWidthsChange?: NonCancelableEventHandler<TableProps.ColumnWidthsChangeDetail>;\n\n /**\n * Called when either the column to sort by or the direction of sorting changes upon user interaction.\n * The event detail contains the current sortingColumn and isDescending.\n */\n onSortingChange?: NonCancelableEventHandler<TableProps.SortingState<T>>;\n\n /**\n * Fired when a user interaction triggers a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<TableProps.SelectionChangeDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row. The event detail contains the index of the\n * clicked row and the row object itself. Use this event to define a row click behavior.\n */\n onRowClick?: NonCancelableEventHandler<TableProps.OnRowClickDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row with the right mouse click. The event detail\n * contains the index of the clicked row and the row object itself. Use this event to override\n * the default browser context menu behavior.\n */\n onRowContextMenu?: CancelableEventHandler<TableProps.OnRowContextMenuDetail<T>>;\n\n /**\n * If set to `true`, the table header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n\n /**\n * Specifies a vertical offset (in pixels) for the sticky header. For example, use this if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Specify a table variant with one of the following:\n * * `container` - Use this variant to have the table displayed within a container.\n * * `embedded` - Use this variant within a parent container (such as a modal, expandable\n * section, container or split panel).\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * * `full-page` – Use this variant when table is the primary element on the page.\n * @visualrefresh `embedded`, `stacked`, and `full-page` variants\n */\n variant?: TableProps.Variant;\n}\n\nexport namespace TableProps {\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type ColumnDefinition<T> = {\n id?: string;\n header: React.ReactNode;\n cell(item: T): React.ReactNode;\n ariaLabel?(data: LabelData): string;\n width?: number | string;\n minWidth?: number | string;\n maxWidth?: number | string;\n } & SortingColumn<T>;\n\n export type SelectionType = 'single' | 'multi';\n export type Variant = 'container' | 'embedded' | 'stacked' | 'full-page';\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n export type IsItemDisabled<T> = (item: T) => boolean;\n export interface AriaLabels<T> {\n allItemsSelectionLabel?: (data: TableProps.SelectionState<T>) => string;\n itemSelectionLabel?: (data: TableProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel?: string;\n tableLabel?: string;\n }\n export interface SortingState<T> {\n isDescending?: boolean;\n sortingColumn: SortingColumn<T>;\n }\n export interface SortingColumn<T> {\n sortingField?: string;\n sortingComparator?: (a: T, b: T) => number;\n }\n export interface LabelData {\n sorted: boolean;\n descending: boolean;\n disabled: boolean;\n }\n export interface OnRowClickDetail<T> {\n rowIndex: number;\n item: T;\n }\n export interface OnRowContextMenuDetail<T> {\n rowIndex: number;\n item: T;\n clientX: number;\n clientY: number;\n }\n\n export interface ColumnWidthsChangeDetail {\n widths: ReadonlyArray<number>;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled and you call this function, the table\n * scroll parent scrolls to reveal the first row of the table.\n */\n scrollToTop(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/table/interfaces.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, CancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface TableForwardRefType {\n <T>(props: TableProps<T> & { ref?: React.Ref<TableProps.Ref> }): JSX.Element;\n}\nexport interface TableProps<T = any> extends BaseComponentProps {\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Footer of the table container.\n */\n footer?: React.ReactNode;\n\n /**\n * Displayed when the `items` property is an empty array. Use it to render an empty or no-match state.\n */\n empty?: React.ReactNode;\n\n /**\n * Specifies the data that's displayed in the table rows. Each item contains the data for one row. The display of a row is handled\n * by the `cell` property of each column definition in the `columnDefinitions` property.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the table in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text that's displayed when the table is in a loading state.\n */\n loadingText?: string;\n\n /**\n * Specifies a property that uniquely identifies an individual item.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used to connect `items` and `selectedItems` values when they reference different objects.\n */\n trackBy?: TableProps.TrackBy<T>;\n\n /**\n * The columns configuration object\n * * `id` (string) - Specifies a unique column identifier. The property is used 1) as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering,\n * and 2) to match entries in the `visibleColumns` property, if defined.\n * * `header` (ReactNode) - Determines the display of the column header.\n * * `cell` ((item) => ReactNode) - Determines the display of a cell's content. You receive the current table row\n * item as an argument.\n * * `width` (string | number) - Specifies the column width. Corresponds to the `width` css-property. If the width is not set,\n * the browser automatically adjusts the column width based on the content. When `resizableColumns` property is\n * set to `true`, additional constraints apply: 1) string values are not allowed, and 2) the last visible column always\n * fills the remaining space of the table so the specified width is ignored.\n * * `minWidth` (string | number) - Specifies the minimum column width. Corresponds to the `min-width` css-property. When\n * `resizableColumns` property is set to `true`, additional constraints apply: 1) string values are not allowed,\n * and 2) the column can't resize below than the specified width (defaults to \"120px\").\n * * `maxWidth` (string | number) - Specifies the maximum column width. Corresponds to the `max-width` css-property.\n * Note that when the `resizableColumns` property is set to `true` this property is ignored.\n * * `ariaLabel` (LabelData => string) - An optional function that's called to provide an `aria-label` for the cell header.\n * It receives the current sorting state of this column, the direction it's sorted in, and an indication of\n * whether the sorting is disabled, as three Boolean values: `sorted`, `descending` and `disabled`.\n * We recommend that you use this for sortable columns to provide more meaningful labels based on the\n * current sorting direction.\n * * `sortingField` (string) - Enables default column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. Provide the name of the property within each item that should be used for sorting by this column.\n * For more complex sorting use `sortingComparator` instead.\n * * `sortingComparator` ((T, T) => number) - Enables custom column sorting. The value is used in [collection hooks](/get-started/dev-guides/collection-hooks/)\n * to reorder the items. This property accepts a custom comparator that is used to compare two items.\n * The comparator must implement ascending ordering, and the output is inverted automatically in case of descending order.\n * If present, the `sortingField` property is ignored.\n *\n */\n columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<T>>;\n /**\n * Specifies the selection type (`'single' | 'multi'`).\n */\n selectionType?: TableProps.SelectionType;\n /**\n * List of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n\n /**\n * Use this slot to add filtering controls to the table.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the table.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the table.\n */\n preferences?: React.ReactNode;\n\n /**\n * Determines whether a given item is disabled. If an item is disabled, the user can't select it.\n */\n isItemDisabled?: TableProps.IsItemDisabled<T>;\n\n /**\n * Specifies if text wraps within table cells. If set to `true`, long text within cells may wrap onto\n * multiple lines instead of being truncated with an ellipsis.\n */\n wrapLines?: boolean;\n\n /**\n * Specifies if columns can be resized. If set to `true`, users can resize the columns in the table.\n */\n resizableColumns?: boolean;\n\n /**\n * Specifies alternative text for the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Specifies the alternative text for an item.\n * * `allItemsSelectionLabel` ((SelectionState) => string) - Specifies the alternative text for multi-selection column header.\n * * `selectionGroupLabel` (string) - Specifies the alternative text for the whole selection and single-selection column header.\n * It is prefixed to `itemSelectionLabel` and `allItemsSelectionLabel` when they are set.\n * * `tableLabel` (string) - Provides a alternative text for the table. If you use a header for this table, you may reuse the string\n * to provide a caption-like description. For example, tableLabel=Instances will be announced as 'Instances table'.\n *\n * You can use the first argument of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The `itemSelectionLabel` for individual\n * items also receives the corresponding `Item` object. You can use the `selectionGroupLabel` to\n * add a meaningful description to the whole selection.\n */\n ariaLabels?: TableProps.AriaLabels<T>;\n\n /**\n * Specifies the definition object of the currently sorted column. Make sure you pass an object that's\n * present in the `columnDefinitions` array.\n */\n sortingColumn?: TableProps.SortingColumn<T>;\n /**\n * Specifies whether to use a descending sort order.\n */\n sortingDescending?: boolean;\n /**\n * Specifies if sorting buttons are disabled. For example, use this property\n * to prevent the user from sorting before items are fully loaded.\n */\n sortingDisabled?: boolean;\n\n /**\n * Specifies an array containing the `id`s of visible columns. If not set, all columns are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of ids doesn't influence the order in which columns are displayed - this is dictated by the `columnDefinitions` property\n */\n visibleColumns?: ReadonlyArray<string>;\n\n /**\n * Fired when the user resizes a table column. The event detail contains an array of column widths in pixels,\n * including the hidden via preferences columns. Use this event to persist the column widths.\n */\n onColumnWidthsChange?: NonCancelableEventHandler<TableProps.ColumnWidthsChangeDetail>;\n\n /**\n * Called when either the column to sort by or the direction of sorting changes upon user interaction.\n * The event detail contains the current sortingColumn and isDescending.\n */\n onSortingChange?: NonCancelableEventHandler<TableProps.SortingState<T>>;\n\n /**\n * Fired when a user interaction triggers a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<TableProps.SelectionChangeDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row. The event detail contains the index of the\n * clicked row and the row object itself. Use this event to define a row click behavior.\n */\n onRowClick?: NonCancelableEventHandler<TableProps.OnRowClickDetail<T>>;\n\n /**\n * Note: This feature is provided for backwards compatibility. Its use is not recommended,\n * and it may be deprecated in the future.\n *\n * Called when the user clicked at a table row with the right mouse click. The event detail\n * contains the index of the clicked row and the row object itself. Use this event to override\n * the default browser context menu behavior.\n */\n onRowContextMenu?: CancelableEventHandler<TableProps.OnRowContextMenuDetail<T>>;\n\n /**\n * If set to `true`, the table header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n\n /**\n * Specifies a vertical offset (in pixels) for the sticky header. For example, use this if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Specify a table variant with one of the following:\n * * `container` - Use this variant to have the table displayed within a container.\n * * `embedded` - Use this variant within a parent container (such as a modal, expandable\n * section, container or split panel).\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * * `full-page` – Use this variant when table is the primary element on the page.\n * @visualrefresh `embedded`, `stacked`, and `full-page` variants\n */\n variant?: TableProps.Variant;\n\n /**\n * Use this property to inform screen readers how many items there are in a table.\n * It specifies the total count of all items in a table.\n * If there is an unknown total of items in a table, leave this property undefined. */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of items is currently displayed in the table.\n * It specifies the index (1-based) of the first item in the table.\n * If the table has no pagination, leave this property undefined. */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * Requires the properties firstIndex and totalItemsCount to be set correctly.\n */\n renderAriaLive?: (data: TableProps.LiveAnnouncement) => string;\n}\n\nexport namespace TableProps {\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type ColumnDefinition<T> = {\n id?: string;\n header: React.ReactNode;\n cell(item: T): React.ReactNode;\n ariaLabel?(data: LabelData): string;\n width?: number | string;\n minWidth?: number | string;\n maxWidth?: number | string;\n } & SortingColumn<T>;\n\n export type SelectionType = 'single' | 'multi';\n export type Variant = 'container' | 'embedded' | 'stacked' | 'full-page';\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n export type IsItemDisabled<T> = (item: T) => boolean;\n export interface AriaLabels<T> {\n allItemsSelectionLabel?: (data: TableProps.SelectionState<T>) => string;\n itemSelectionLabel?: (data: TableProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel?: string;\n tableLabel?: string;\n }\n export interface SortingState<T> {\n isDescending?: boolean;\n sortingColumn: SortingColumn<T>;\n }\n export interface SortingColumn<T> {\n sortingField?: string;\n sortingComparator?: (a: T, b: T) => number;\n }\n export interface LabelData {\n sorted: boolean;\n descending: boolean;\n disabled: boolean;\n }\n export interface OnRowClickDetail<T> {\n rowIndex: number;\n item: T;\n }\n export interface OnRowContextMenuDetail<T> {\n rowIndex: number;\n item: T;\n clientX: number;\n clientY: number;\n }\n\n export interface ColumnWidthsChangeDetail {\n widths: ReadonlyArray<number>;\n }\n\n export interface LiveAnnouncement {\n totalItemsCount?: number;\n firstIndex: number;\n lastIndex: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled and you call this function, the table\n * scroll parent scrolls to reveal the first row of the table.\n */\n scrollToTop(): void;\n }\n}\n"]}
|
package/table/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/table/internal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,cAAc,CAAC;AAiC/D,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/table/internal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,cAAc,CAAC;AAiC/D,QAAA,MAAM,aAAa,qBAuUK,CAAC;AAEzB,eAAe,aAAa,CAAC"}
|
package/table/internal.js
CHANGED
|
@@ -31,7 +31,7 @@ import { useDynamicOverlap } from '../app-layout/visual-refresh/hooks/use-dynami
|
|
|
31
31
|
import LiveRegion from '../internal/components/live-region';
|
|
32
32
|
var InternalTable = React.forwardRef(function (_a, ref) {
|
|
33
33
|
var _b;
|
|
34
|
-
var header = _a.header, footer = _a.footer, empty = _a.empty, filter = _a.filter, pagination = _a.pagination, preferences = _a.preferences, items = _a.items, columnDefinitions = _a.columnDefinitions, trackBy = _a.trackBy, loading = _a.loading, loadingText = _a.loadingText, selectionType = _a.selectionType, selectedItems = _a.selectedItems, isItemDisabled = _a.isItemDisabled, ariaLabels = _a.ariaLabels, onSelectionChange = _a.onSelectionChange, onSortingChange = _a.onSortingChange, sortingColumn = _a.sortingColumn, sortingDescending = _a.sortingDescending, sortingDisabled = _a.sortingDisabled, visibleColumns = _a.visibleColumns, stickyHeader = _a.stickyHeader, stickyHeaderVerticalOffset = _a.stickyHeaderVerticalOffset, onRowClick = _a.onRowClick, onRowContextMenu = _a.onRowContextMenu, wrapLines = _a.wrapLines, resizableColumns = _a.resizableColumns, onColumnWidthsChange = _a.onColumnWidthsChange, variant = _a.variant, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["header", "footer", "empty", "filter", "pagination", "preferences", "items", "columnDefinitions", "trackBy", "loading", "loadingText", "selectionType", "selectedItems", "isItemDisabled", "ariaLabels", "onSelectionChange", "onSortingChange", "sortingColumn", "sortingDescending", "sortingDisabled", "visibleColumns", "stickyHeader", "stickyHeaderVerticalOffset", "onRowClick", "onRowContextMenu", "wrapLines", "resizableColumns", "onColumnWidthsChange", "variant", "__internalRootRef"]);
|
|
34
|
+
var header = _a.header, footer = _a.footer, empty = _a.empty, filter = _a.filter, pagination = _a.pagination, preferences = _a.preferences, items = _a.items, columnDefinitions = _a.columnDefinitions, trackBy = _a.trackBy, loading = _a.loading, loadingText = _a.loadingText, selectionType = _a.selectionType, selectedItems = _a.selectedItems, isItemDisabled = _a.isItemDisabled, ariaLabels = _a.ariaLabels, onSelectionChange = _a.onSelectionChange, onSortingChange = _a.onSortingChange, sortingColumn = _a.sortingColumn, sortingDescending = _a.sortingDescending, sortingDisabled = _a.sortingDisabled, visibleColumns = _a.visibleColumns, stickyHeader = _a.stickyHeader, stickyHeaderVerticalOffset = _a.stickyHeaderVerticalOffset, onRowClick = _a.onRowClick, onRowContextMenu = _a.onRowContextMenu, wrapLines = _a.wrapLines, resizableColumns = _a.resizableColumns, onColumnWidthsChange = _a.onColumnWidthsChange, variant = _a.variant, __internalRootRef = _a.__internalRootRef, totalItemsCount = _a.totalItemsCount, firstIndex = _a.firstIndex, renderAriaLive = _a.renderAriaLive, rest = __rest(_a, ["header", "footer", "empty", "filter", "pagination", "preferences", "items", "columnDefinitions", "trackBy", "loading", "loadingText", "selectionType", "selectedItems", "isItemDisabled", "ariaLabels", "onSelectionChange", "onSortingChange", "sortingColumn", "sortingDescending", "sortingDisabled", "visibleColumns", "stickyHeader", "stickyHeaderVerticalOffset", "onRowClick", "onRowContextMenu", "wrapLines", "resizableColumns", "onColumnWidthsChange", "variant", "__internalRootRef", "totalItemsCount", "firstIndex", "renderAriaLive"]);
|
|
35
35
|
var baseProps = getBaseProps(rest);
|
|
36
36
|
stickyHeader = stickyHeader && supportsStickyPosition();
|
|
37
37
|
var _c = useContainerQuery(function (_a) {
|
|
@@ -127,10 +127,12 @@ var InternalTable = React.forwardRef(function (_a, ref) {
|
|
|
127
127
|
_b[styles['has-footer']] = !!footer,
|
|
128
128
|
_b[styles['has-header']] = hasHeader,
|
|
129
129
|
_b)), onScroll: handleScroll }, wrapperProps, focusVisibleProps),
|
|
130
|
+
renderAriaLive && firstIndex && (React.createElement(LiveRegion, null,
|
|
131
|
+
React.createElement("span", null, renderAriaLive({ totalItemsCount: totalItemsCount, firstIndex: firstIndex, lastIndex: firstIndex + items.length })))),
|
|
130
132
|
React.createElement("table", { ref: tableRef, className: clsx(styles.table, resizableColumns && styles['table-layout-fixed']),
|
|
131
133
|
// Browsers have weird mechanism to guess whether it's a data table or a layout table.
|
|
132
134
|
// If we state explicitly, they get it always correctly even with low number of rows.
|
|
133
|
-
role: "table", "aria-label": ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tableLabel },
|
|
135
|
+
role: "table", "aria-label": ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.tableLabel, "aria-rowcount": totalItemsCount ? totalItemsCount + 1 : -1 },
|
|
134
136
|
React.createElement(Thead, __assign({ ref: theadRef, hidden: stickyHeader, onCellFocus: function (colIndex) { var _a; return (_a = stickyHeaderRef.current) === null || _a === void 0 ? void 0 : _a.setFocusedColumn(colIndex); }, onCellBlur: function () { var _a; return (_a = stickyHeaderRef.current) === null || _a === void 0 ? void 0 : _a.setFocusedColumn(null); } }, theadProps)),
|
|
135
137
|
React.createElement("tbody", null, loading || items.length === 0 ? (React.createElement("tr", null,
|
|
136
138
|
React.createElement("td", { colSpan: selectionType ? visibleColumnDefinitions.length + 1 : visibleColumnDefinitions.length, className: styles['cell-merged'] },
|
|
@@ -152,7 +154,7 @@ var InternalTable = React.forwardRef(function (_a, ref) {
|
|
|
152
154
|
if (!currentTarget.contains(getMouseDownTarget())) {
|
|
153
155
|
(_b = stickyHeaderRef.current) === null || _b === void 0 ? void 0 : _b.scrollToRow(currentTarget);
|
|
154
156
|
}
|
|
155
|
-
} }, focusMarkers.item, { onClick: onRowClickHandler && onRowClickHandler.bind(null, rowIndex, item), onContextMenu: onRowContextMenuHandler && onRowContextMenuHandler.bind(null, rowIndex, item) }),
|
|
157
|
+
} }, focusMarkers.item, { onClick: onRowClickHandler && onRowClickHandler.bind(null, rowIndex, item), onContextMenu: onRowContextMenuHandler && onRowContextMenuHandler.bind(null, rowIndex, item), "aria-rowindex": firstIndex ? firstIndex + rowIndex + 1 : undefined }),
|
|
156
158
|
selectionType !== undefined && (React.createElement(TableBodyCell, { className: styles['selection-control'], isFirstRow: firstVisible, isLastRow: lastVisible, isSelected: isSelected, isNextSelected: isNextSelected, isPrevSelected: isPrevSelected, wrapLines: false },
|
|
157
159
|
React.createElement(SelectionControl, __assign({ onFocusDown: moveFocusDown, onFocusUp: moveFocusUp, onShiftToggle: updateShiftToggle }, getItemSelectionProps(item))))),
|
|
158
160
|
visibleColumnDefinitions.map(function (column, colIndex) { return (React.createElement(TableBodyCellContent, { key: getColumnKey(column, colIndex), style: resizableColumns
|