@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
39 lines • 2.07 kB
JavaScript
import { __rest } from "tslib";
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import { getAnalyticsMetadataAttribute } from '@awsui/component-toolkit/internal/analytics-metadata';
import useBaseComponent from '../internal/hooks/use-base-component';
import { applyDisplayName } from '../internal/utils/apply-display-name';
import { getExternalProps } from '../internal/utils/external-props';
import InternalSelect from './internal';
import analyticsSelectors from '../internal/components/button-trigger/analytics-metadata/styles.css.js';
const Select = React.forwardRef((_a, ref) => {
var { options = [], filteringType = 'none', statusType = 'finished', triggerVariant = 'label' } = _a, restProps = __rest(_a, ["options", "filteringType", "statusType", "triggerVariant"]);
const baseComponentProps = useBaseComponent('Select', {
props: {
autoFocus: restProps.autoFocus,
expandToViewport: restProps.expandToViewport,
filteringType,
triggerVariant,
virtualScroll: restProps.virtualScroll,
readOnly: restProps.readOnly,
},
metadata: {
hasInlineLabel: Boolean(restProps.inlineLabelText),
hasDisabledReasons: options.some(option => Boolean(option.disabledReason)),
},
});
const externalProps = getExternalProps(restProps);
const componentAnalyticsMetadata = {
name: 'awsui.Select',
label: `.${analyticsSelectors['button-trigger']}`,
properties: {
disabled: `${!!externalProps.disabled}`,
},
};
return (React.createElement(InternalSelect, Object.assign({ options: options, filteringType: filteringType, statusType: statusType, triggerVariant: triggerVariant }, externalProps, baseComponentProps, { ref: ref }, getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata }))));
});
applyDisplayName(Select, 'Select');
export default Select;
//# sourceMappingURL=index.js.map