@fluentui/react-select 9.0.0-beta.8 → 9.0.0
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/CHANGELOG.json +536 -2
- package/CHANGELOG.md +192 -3
- package/README.md +1 -5
- package/dist/index.d.ts +17 -0
- package/lib/Select.js.map +1 -1
- package/lib/SelectField.js +2 -0
- package/lib/SelectField.js.map +1 -0
- package/lib/components/Select/Select.js +0 -1
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Select/Select.types.js.map +1 -1
- package/lib/components/Select/index.js.map +1 -1
- package/lib/components/Select/renderSelect.js +6 -4
- package/lib/components/Select/renderSelect.js.map +1 -1
- package/lib/components/Select/useSelect.js +4 -2
- package/lib/components/Select/useSelect.js.map +1 -1
- package/lib/components/Select/useSelectStyles.js +223 -194
- package/lib/components/Select/useSelectStyles.js.map +1 -1
- package/lib/components/SelectField/SelectField.js +8 -0
- package/lib/components/SelectField/SelectField.js.map +1 -0
- package/lib/components/SelectField/index.js +2 -0
- package/lib/components/SelectField/index.js.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib-amd/Select.js +6 -0
- package/lib-amd/Select.js.map +1 -0
- package/lib-amd/SelectField.js +6 -0
- package/lib-amd/SelectField.js.map +1 -0
- package/lib-amd/components/Select/Select.js +15 -0
- package/lib-amd/components/Select/Select.js.map +1 -0
- package/lib-amd/components/Select/Select.types.js +5 -0
- package/lib-amd/components/Select/Select.types.js.map +1 -0
- package/lib-amd/components/Select/index.js +10 -0
- package/lib-amd/components/Select/index.js.map +1 -0
- package/lib-amd/components/Select/renderSelect.js +16 -0
- package/lib-amd/components/Select/renderSelect.js.map +1 -0
- package/lib-amd/components/Select/useSelect.js +51 -0
- package/lib-amd/components/Select/useSelect.js.map +1 -0
- package/lib-amd/components/Select/useSelectStyles.js +154 -0
- package/lib-amd/components/Select/useSelectStyles.js.map +1 -0
- package/lib-amd/components/SelectField/SelectField.js +10 -0
- package/lib-amd/components/SelectField/SelectField.js.map +1 -0
- package/lib-amd/components/SelectField/index.js +6 -0
- package/lib-amd/components/SelectField/index.js.map +1 -0
- package/lib-amd/index.js +13 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-commonjs/Select.js +0 -2
- package/lib-commonjs/Select.js.map +1 -1
- package/lib-commonjs/SelectField.js +8 -0
- package/lib-commonjs/SelectField.js.map +1 -0
- package/lib-commonjs/components/Select/Select.js +0 -6
- package/lib-commonjs/components/Select/Select.js.map +1 -1
- package/lib-commonjs/components/Select/Select.types.js.map +1 -1
- package/lib-commonjs/components/Select/index.js +0 -6
- package/lib-commonjs/components/Select/index.js.map +1 -1
- package/lib-commonjs/components/Select/renderSelect.js +6 -8
- package/lib-commonjs/components/Select/renderSelect.js.map +1 -1
- package/lib-commonjs/components/Select/useSelect.js +4 -7
- package/lib-commonjs/components/Select/useSelect.js.map +1 -1
- package/lib-commonjs/components/Select/useSelectStyles.js +223 -198
- package/lib-commonjs/components/Select/useSelectStyles.js.map +1 -1
- package/lib-commonjs/components/SelectField/SelectField.js +14 -0
- package/lib-commonjs/components/SelectField/SelectField.js.map +1 -0
- package/lib-commonjs/components/SelectField/index.js +8 -0
- package/lib-commonjs/components/SelectField/index.js.map +1 -0
- package/lib-commonjs/index.js +15 -3
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +21 -18
- package/Spec.md +0 -238
- package/dist/tsdoc-metadata.json +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-select/src/SelectField.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/SelectField/index';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
define(["require", "exports", "react", "./useSelect", "./renderSelect", "./useSelectStyles"], function (require, exports, React, useSelect_1, renderSelect_1, useSelectStyles_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Select = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Select component
|
|
7
|
+
*/
|
|
8
|
+
exports.Select = React.forwardRef(function (props, ref) {
|
|
9
|
+
var state = useSelect_1.useSelect_unstable(props, ref);
|
|
10
|
+
useSelectStyles_1.useSelectStyles_unstable(state);
|
|
11
|
+
return renderSelect_1.renderSelect_unstable(state);
|
|
12
|
+
});
|
|
13
|
+
exports.Select.displayName = 'Select';
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/Select/Select.tsx"],"names":[],"mappings":";;;;IAOA;;OAEG;IACU,QAAA,MAAM,GAAqC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAClF,IAAM,KAAK,GAAG,8BAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE7C,0CAAwB,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,oCAAqB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,cAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import * as React from 'react';\nimport { useSelect_unstable } from './useSelect';\nimport { renderSelect_unstable } from './renderSelect';\nimport { useSelectStyles_unstable } from './useSelectStyles';\nimport type { SelectProps } from './Select.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Select component\n */\nexport const Select: ForwardRefComponent<SelectProps> = React.forwardRef((props, ref) => {\n const state = useSelect_unstable(props, ref);\n\n useSelectStyles_unstable(state);\n return renderSelect_unstable(state);\n});\n\nSelect.displayName = 'Select';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/Select/Select.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type SelectSlots = {\n /*\n * Wrapper for both the select and icon, renders as a `<span>`.\n * The `className` and `style` props on `<Select>` are applied to this slot;\n * All other top-level props are applied to the primary slot, `select`.\n */\n root: NonNullable<Slot<'span'>>;\n\n /** Primary slot: the actual `<select>` element */\n select: NonNullable<Slot<'select'>>;\n\n /** the icon, typically a down arrow */\n icon: Slot<'span'>;\n};\n\nexport type SelectProps = Omit<ComponentProps<Partial<SelectSlots>, 'select'>, 'size' | 'onChange'> & {\n /**\n * Controls the colors and borders of the Select.\n *\n * @default 'outline'\n */\n appearance?: 'outline' | 'underline' | 'filled-darker' | 'filled-lighter';\n\n /**\n * Called when the user changes the select element's value by selecting an option.\n */\n onChange?: (ev: React.ChangeEvent<HTMLSelectElement>, data: SelectOnChangeData) => void;\n\n /**\n * Matches the Input sizes\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n};\n\nexport type SelectState = ComponentState<SelectSlots> & Required<Pick<SelectProps, 'appearance' | 'size'>>;\n\n/**\n * Data passed to the `onChange` callback when a new option is selected.\n */\nexport type SelectOnChangeData = {\n /**\n * Updated `<select>` value, taken from either the selected option's value prop or inner text.\n */\n value: string;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./Select", "./Select.types", "./renderSelect", "./useSelect", "./useSelectStyles"], function (require, exports, tslib_1, Select_1, Select_types_1, renderSelect_1, useSelect_1, useSelectStyles_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(Select_1, exports);
|
|
5
|
+
tslib_1.__exportStar(Select_types_1, exports);
|
|
6
|
+
tslib_1.__exportStar(renderSelect_1, exports);
|
|
7
|
+
tslib_1.__exportStar(useSelect_1, exports);
|
|
8
|
+
tslib_1.__exportStar(useSelectStyles_1, exports);
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/Select/index.ts"],"names":[],"mappings":";;;IAAA,wCAAyB;IACzB,8CAA+B;IAC/B,8CAA+B;IAC/B,2CAA4B;IAC5B,iDAAkC","sourcesContent":["export * from './Select';\nexport * from './Select.types';\nexport * from './renderSelect';\nexport * from './useSelect';\nexport * from './useSelectStyles';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.renderSelect_unstable = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Render the final JSX of Select
|
|
7
|
+
*/
|
|
8
|
+
var renderSelect_unstable = function (state) {
|
|
9
|
+
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
|
10
|
+
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
|
11
|
+
React.createElement(slots.select, tslib_1.__assign({}, slotProps.select), slotProps.select.children),
|
|
12
|
+
React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon))));
|
|
13
|
+
};
|
|
14
|
+
exports.renderSelect_unstable = renderSelect_unstable;
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=renderSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderSelect.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/Select/renderSelect.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,qBAAqB,GAAG,UAAC,KAAkB;QAChD,IAAA,KAAuB,0BAAQ,CAAc,KAAK,CAAC,EAAjD,KAAK,WAAA,EAAE,SAAS,eAAiC,CAAC;QAC1D,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,KAAK,CAAC,MAAM,uBAAK,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAgB;YAC9E,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACvB,CACd,CAAC;IACJ,CAAC,CAAC;IARW,QAAA,qBAAqB,yBAQhC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SelectSlots, SelectState } from './Select.types';\n\n/**\n * Render the final JSX of Select\n */\nexport const renderSelect_unstable = (state: SelectState) => {\n const { slots, slotProps } = getSlots<SelectSlots>(state);\n return (\n <slots.root {...slotProps.root}>\n <slots.select {...slotProps.select}>{slotProps.select.children}</slots.select>\n <slots.icon {...slotProps.icon} />\n </slots.root>\n );\n};\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/react-icons", "@fluentui/react-shared-contexts"], function (require, exports, tslib_1, React, react_utilities_1, react_icons_1, react_shared_contexts_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useSelect_unstable = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Create the state required to render Select.
|
|
7
|
+
*
|
|
8
|
+
* The returned state can be modified with hooks such as useSelectStyles,
|
|
9
|
+
* before being passed to renderSelect.
|
|
10
|
+
*
|
|
11
|
+
* @param props - props from this instance of Select
|
|
12
|
+
* @param ref - reference to the `<select>` element in Select
|
|
13
|
+
*/
|
|
14
|
+
var useSelect_unstable = function (props, ref) {
|
|
15
|
+
var _a;
|
|
16
|
+
var overrides = react_shared_contexts_1.useOverrides_unstable();
|
|
17
|
+
var defaultValue = props.defaultValue, value = props.value, select = props.select, icon = props.icon, root = props.root, _b = props.appearance, appearance = _b === void 0 ? (_a = overrides.inputDefaultAppearance) !== null && _a !== void 0 ? _a : 'outline' : _b, onChange = props.onChange, _c = props.size, size = _c === void 0 ? 'medium' : _c;
|
|
18
|
+
var nativeProps = react_utilities_1.getPartitionedNativeProps({
|
|
19
|
+
props: props,
|
|
20
|
+
primarySlotTagName: 'select',
|
|
21
|
+
excludedPropNames: ['appearance', 'defaultValue', 'onChange', 'size', 'value'],
|
|
22
|
+
});
|
|
23
|
+
var state = {
|
|
24
|
+
size: size,
|
|
25
|
+
appearance: appearance,
|
|
26
|
+
components: {
|
|
27
|
+
root: 'span',
|
|
28
|
+
select: 'select',
|
|
29
|
+
icon: 'span',
|
|
30
|
+
},
|
|
31
|
+
select: react_utilities_1.resolveShorthand(select, {
|
|
32
|
+
required: true,
|
|
33
|
+
defaultProps: tslib_1.__assign({ defaultValue: defaultValue, value: value, ref: ref }, nativeProps.primary),
|
|
34
|
+
}),
|
|
35
|
+
icon: react_utilities_1.resolveShorthand(icon, {
|
|
36
|
+
required: true,
|
|
37
|
+
defaultProps: { children: React.createElement(react_icons_1.ChevronDownRegular, null) },
|
|
38
|
+
}),
|
|
39
|
+
root: react_utilities_1.resolveShorthand(root, {
|
|
40
|
+
required: true,
|
|
41
|
+
defaultProps: nativeProps.root,
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
state.select.onChange = react_utilities_1.useEventCallback(function (event) {
|
|
45
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, { value: event.target.value });
|
|
46
|
+
});
|
|
47
|
+
return state;
|
|
48
|
+
};
|
|
49
|
+
exports.useSelect_unstable = useSelect_unstable;
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=useSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelect.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/Select/useSelect.tsx"],"names":[],"mappings":";;;;IAMA;;;;;;;;OAQG;IACI,IAAM,kBAAkB,G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MAAM,CAAC,QAAQ,GAAG,kCAAgB,CAAC,UAAA,KAAK;YAC5C,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,KAAK,EAAE,EAAE,KAAK,EAAG,KAAK,CAAC,MAA4B,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IArDW,QAAA,kBAAkB,sBAqD7B","sourcesContent":["import * as React from 'react';\nimport { getPartitionedNativeProps, resolveShorthand, useEventCallback } from '@fluentui/react-utilities';\nimport { ChevronDownRegular } from '@fluentui/react-icons';\nimport type { SelectProps, SelectState } from './Select.types';\nimport { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render Select.\n *\n * The returned state can be modified with hooks such as useSelectStyles,\n * before being passed to renderSelect.\n *\n * @param props - props from this instance of Select\n * @param ref - reference to the `<select>` element in Select\n */\nexport const useSelect_unstable = (props: SelectProps, ref: React.Ref<HTMLSelectElement>): SelectState => {\n const overrides = useOverrides();\n\n const {\n defaultValue,\n value,\n select,\n icon,\n root,\n appearance = overrides.inputDefaultAppearance ?? 'outline',\n\n onChange,\n size = 'medium',\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'select',\n excludedPropNames: ['appearance', 'defaultValue', 'onChange', 'size', 'value'],\n });\n\n const state: SelectState = {\n size,\n appearance,\n components: {\n root: 'span',\n select: 'select',\n icon: 'span',\n },\n select: resolveShorthand(select, {\n required: true,\n defaultProps: {\n defaultValue,\n value,\n ref,\n ...nativeProps.primary,\n },\n }),\n icon: resolveShorthand(icon, {\n required: true,\n defaultProps: { children: <ChevronDownRegular /> },\n }),\n root: resolveShorthand(root, {\n required: true,\n defaultProps: nativeProps.root,\n }),\n };\n\n state.select.onChange = useEventCallback(event => {\n onChange?.(event, { value: (event.target as HTMLSelectElement).value });\n });\n\n return state;\n};\n"]}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme"], function (require, exports, tslib_1, react_1, react_theme_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useSelectStyles_unstable = exports.selectClassNames = void 0;
|
|
5
|
+
exports.selectClassNames = {
|
|
6
|
+
root: 'fui-Select',
|
|
7
|
+
select: 'fui-Select__select',
|
|
8
|
+
icon: 'fui-Select__icon',
|
|
9
|
+
};
|
|
10
|
+
var iconSizes = {
|
|
11
|
+
small: '16px',
|
|
12
|
+
medium: '20px',
|
|
13
|
+
large: '24px',
|
|
14
|
+
};
|
|
15
|
+
//TODO: Should fieldHeights be a set of global design tokens or constants?
|
|
16
|
+
var fieldHeights = {
|
|
17
|
+
small: '24px',
|
|
18
|
+
medium: '32px',
|
|
19
|
+
large: '40px',
|
|
20
|
+
};
|
|
21
|
+
/* Since the <select> element must span the full width and cannot have children,
|
|
22
|
+
* the right padding needs to be calculated from the sum of the following:
|
|
23
|
+
* 1. Field padding-right
|
|
24
|
+
* 2. Icon width
|
|
25
|
+
* 3. Content-icon spacing
|
|
26
|
+
* 4. Content inner padding
|
|
27
|
+
*/
|
|
28
|
+
var paddingRight = {
|
|
29
|
+
small: "calc(" + react_theme_1.tokens.spacingHorizontalSNudge + "\n + " + iconSizes.small + "\n + " + react_theme_1.tokens.spacingHorizontalXXS + "\n + " + react_theme_1.tokens.spacingHorizontalXXS + ")",
|
|
30
|
+
medium: "calc(" + react_theme_1.tokens.spacingHorizontalMNudge + "\n + " + iconSizes.medium + "\n + " + react_theme_1.tokens.spacingHorizontalXXS + "\n + " + react_theme_1.tokens.spacingHorizontalXXS + ")",
|
|
31
|
+
large: "calc(" + react_theme_1.tokens.spacingHorizontalM + "\n + " + iconSizes.large + "\n + " + react_theme_1.tokens.spacingHorizontalSNudge + "\n + " + react_theme_1.tokens.spacingHorizontalSNudge + ")",
|
|
32
|
+
};
|
|
33
|
+
/* Left padding is calculated from the outer padding + inner content padding values
|
|
34
|
+
* since <select> can't have additional child content or custom inner layout */
|
|
35
|
+
var paddingLeft = {
|
|
36
|
+
small: "calc(" + react_theme_1.tokens.spacingHorizontalSNudge + " + " + react_theme_1.tokens.spacingHorizontalXXS + ")",
|
|
37
|
+
medium: "calc(" + react_theme_1.tokens.spacingHorizontalMNudge + " + " + react_theme_1.tokens.spacingHorizontalXXS + ")",
|
|
38
|
+
large: "calc(" + react_theme_1.tokens.spacingHorizontalM + " + " + react_theme_1.tokens.spacingHorizontalSNudge + ")",
|
|
39
|
+
};
|
|
40
|
+
/* end of shared values */
|
|
41
|
+
var useRootStyles = react_1.makeStyles({
|
|
42
|
+
base: {
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
boxSizing: 'border-box',
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexWrap: 'nowrap',
|
|
47
|
+
fontFamily: react_theme_1.tokens.fontFamilyBase,
|
|
48
|
+
position: 'relative',
|
|
49
|
+
'&::after': tslib_1.__assign(tslib_1.__assign({ backgroundImage: "linear-gradient(\n 0deg,\n " + react_theme_1.tokens.colorCompoundBrandStroke + " 0%,\n " + react_theme_1.tokens.colorCompoundBrandStroke + " 50%,\n transparent 50%,\n transparent 100%\n )" }, react_1.shorthands.borderRadius(0, 0, react_theme_1.tokens.borderRadiusMedium, react_theme_1.tokens.borderRadiusMedium)), { boxSizing: 'border-box', content: '""', height: react_theme_1.tokens.borderRadiusMedium, position: 'absolute', bottom: '0', left: '0', right: '0', transform: 'scaleX(0)', transitionProperty: 'transform', transitionDuration: react_theme_1.tokens.durationUltraFast, transitionDelay: react_theme_1.tokens.curveAccelerateMid, '@media screen and (prefers-reduced-motion: reduce)': {
|
|
50
|
+
transitionDuration: '0.01ms',
|
|
51
|
+
transitionDelay: '0.01ms',
|
|
52
|
+
} }),
|
|
53
|
+
'&:focus-within::after': {
|
|
54
|
+
transform: 'scaleX(1)',
|
|
55
|
+
transitionProperty: 'transform',
|
|
56
|
+
transitionDuration: react_theme_1.tokens.durationNormal,
|
|
57
|
+
transitionDelay: react_theme_1.tokens.curveDecelerateMid,
|
|
58
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
|
59
|
+
transitionDuration: '0.01ms',
|
|
60
|
+
transitionDelay: '0.01ms',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
var useSelectStyles = react_1.makeStyles({
|
|
66
|
+
base: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ appearance: 'none' }, react_1.shorthands.border('1px', 'solid', 'transparent')), react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)), { boxShadow: 'none', boxSizing: 'border-box', color: react_theme_1.tokens.colorNeutralForeground1, cursor: 'pointer', flexGrow: 1, maxWidth: '100%', paddingBottom: 0, paddingTop: 0, ':focus': {
|
|
67
|
+
outlineWidth: '2px',
|
|
68
|
+
outlineStyle: 'solid',
|
|
69
|
+
outlineColor: 'transparent',
|
|
70
|
+
} }),
|
|
71
|
+
disabled: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { color: react_theme_1.tokens.colorNeutralForegroundDisabled, cursor: 'not-allowed', '@media (forced-colors: active)': tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')) }),
|
|
72
|
+
disabledUnderline: tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStrokeDisabled, react_theme_1.tokens.colorTransparentStrokeDisabled, react_theme_1.tokens.colorNeutralStrokeDisabled)),
|
|
73
|
+
small: tslib_1.__assign({ height: fieldHeights.small, paddingLeft: paddingLeft.small, paddingRight: paddingRight.small }, react_theme_1.typographyStyles.caption1),
|
|
74
|
+
medium: tslib_1.__assign({ height: fieldHeights.medium, paddingLeft: paddingLeft.medium, paddingRight: paddingRight.medium }, react_theme_1.typographyStyles.body1),
|
|
75
|
+
large: tslib_1.__assign({ height: fieldHeights.large, paddingLeft: paddingLeft.large, paddingRight: paddingRight.large }, react_theme_1.typographyStyles.body2),
|
|
76
|
+
outline: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1 }, react_1.shorthands.border('1px', 'solid', react_theme_1.tokens.colorNeutralStroke1)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
|
|
77
|
+
outlineInteractive: {
|
|
78
|
+
'&:hover': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Hover)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
|
|
79
|
+
'&:active': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Pressed)), { borderBottomColor: react_theme_1.tokens.colorNeutralStrokeAccessible }),
|
|
80
|
+
},
|
|
81
|
+
underline: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderBottom('1px', 'solid', react_theme_1.tokens.colorNeutralStrokeAccessible)), react_1.shorthands.borderRadius(0)),
|
|
82
|
+
'filled-lighter': {
|
|
83
|
+
backgroundColor: react_theme_1.tokens.colorNeutralBackground1,
|
|
84
|
+
},
|
|
85
|
+
'filled-darker': {
|
|
86
|
+
backgroundColor: react_theme_1.tokens.colorNeutralBackground3,
|
|
87
|
+
},
|
|
88
|
+
invalid: {
|
|
89
|
+
':not(:focus-within),:hover:not(:focus-within)': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorPaletteRedBorder2)),
|
|
90
|
+
},
|
|
91
|
+
invalidUnderline: {
|
|
92
|
+
':not(:focus-within),:hover:not(:focus-within)': {
|
|
93
|
+
borderBottomColor: react_theme_1.tokens.colorPaletteRedBorder2,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
var useIconStyles = react_1.makeStyles({
|
|
98
|
+
icon: {
|
|
99
|
+
boxSizing: 'border-box',
|
|
100
|
+
color: react_theme_1.tokens.colorNeutralStrokeAccessible,
|
|
101
|
+
display: 'block',
|
|
102
|
+
position: 'absolute',
|
|
103
|
+
pointerEvents: 'none',
|
|
104
|
+
// the SVG must have display: block for accurate positioning
|
|
105
|
+
// otherwise an extra inline space is inserted after the svg element
|
|
106
|
+
'& svg': {
|
|
107
|
+
display: 'block',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
disabled: {
|
|
111
|
+
color: react_theme_1.tokens.colorNeutralForegroundDisabled,
|
|
112
|
+
'@media (forced-colors: active)': {
|
|
113
|
+
color: 'GrayText',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
small: {
|
|
117
|
+
fontSize: iconSizes.small,
|
|
118
|
+
height: iconSizes.small,
|
|
119
|
+
right: react_theme_1.tokens.spacingHorizontalSNudge,
|
|
120
|
+
width: iconSizes.small,
|
|
121
|
+
},
|
|
122
|
+
medium: {
|
|
123
|
+
fontSize: iconSizes.medium,
|
|
124
|
+
height: iconSizes.medium,
|
|
125
|
+
right: react_theme_1.tokens.spacingHorizontalMNudge,
|
|
126
|
+
width: iconSizes.medium,
|
|
127
|
+
},
|
|
128
|
+
large: {
|
|
129
|
+
fontSize: iconSizes.large,
|
|
130
|
+
height: iconSizes.large,
|
|
131
|
+
right: react_theme_1.tokens.spacingHorizontalM,
|
|
132
|
+
width: iconSizes.large,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* Apply styling to the Select slots based on the state
|
|
137
|
+
*/
|
|
138
|
+
var useSelectStyles_unstable = function (state) {
|
|
139
|
+
var size = state.size, appearance = state.appearance;
|
|
140
|
+
var disabled = state.select.disabled;
|
|
141
|
+
var invalid = "" + state.select['aria-invalid'] === 'true';
|
|
142
|
+
var iconStyles = useIconStyles();
|
|
143
|
+
var rootStyles = useRootStyles();
|
|
144
|
+
var selectStyles = useSelectStyles();
|
|
145
|
+
state.root.className = react_1.mergeClasses(exports.selectClassNames.root, rootStyles.base, state.root.className);
|
|
146
|
+
state.select.className = react_1.mergeClasses(exports.selectClassNames.select, selectStyles.base, selectStyles[size], selectStyles[appearance], !disabled && appearance === 'outline' && selectStyles.outlineInteractive, !disabled && invalid && appearance !== 'underline' && selectStyles.invalid, !disabled && invalid && appearance === 'underline' && selectStyles.invalidUnderline, disabled && selectStyles.disabled, disabled && appearance === 'underline' && selectStyles.disabledUnderline, state.select.className);
|
|
147
|
+
if (state.icon) {
|
|
148
|
+
state.icon.className = react_1.mergeClasses(exports.selectClassNames.icon, iconStyles.icon, disabled && iconStyles.disabled, iconStyles[size], state.icon.className);
|
|
149
|
+
}
|
|
150
|
+
return state;
|
|
151
|
+
};
|
|
152
|
+
exports.useSelectStyles_unstable = useSelectStyles_unstable;
|
|
153
|
+
});
|
|
154
|
+
//# sourceMappingURL=useSelectStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelectStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/Select/useSelectStyles.ts"],"names":[],"mappings":";;;;IAKa,QAAA,gBAAgB,GAAgC;QAC3D,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,oBAAoB;QAC5B,IAAI,EAAE,kBAAkB;KACzB,CAAC;IAEF,IAAM,SAAS,GAAG;QAChB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACd,CAAC;IAEF,0EAA0E;IAC1E,IAAM,YAAY,GAAG;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACd,CAAC;IAEF;;;;;;OAMG;IACH,IAAM,YAAY,GAAG;QACnB,KAAK,EAAE,UAAQ,oBAAM,CAAC,uBAAuB,gBACvC,SAAS,CAAC,KAAK,gBACf,oBAAM,CAAC,oBAAoB,gBAC3B,oBAAM,CA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AAgB,CAAC,IAAI,EACrB,UAAU,CAAC,IAAI,EACf,QAAQ,IAAI,UAAU,CAAC,QAAQ,EAC/B,UAAU,CAAC,IAAI,CAAC,EAChB,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAnCW,QAAA,wBAAwB,4BAmCnC","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SelectSlots, SelectState } from './Select.types';\n\nexport const selectClassNames: SlotClassNames<SelectSlots> = {\n root: 'fui-Select',\n select: 'fui-Select__select',\n icon: 'fui-Select__icon',\n};\n\nconst iconSizes = {\n small: '16px',\n medium: '20px',\n large: '24px',\n};\n\n//TODO: Should fieldHeights be a set of global design tokens or constants?\nconst fieldHeights = {\n small: '24px',\n medium: '32px',\n large: '40px',\n};\n\n/* Since the <select> element must span the full width and cannot have children,\n * the right padding needs to be calculated from the sum of the following:\n * 1. Field padding-right\n * 2. Icon width\n * 3. Content-icon spacing\n * 4. Content inner padding\n */\nconst paddingRight = {\n small: `calc(${tokens.spacingHorizontalSNudge}\n + ${iconSizes.small}\n + ${tokens.spacingHorizontalXXS}\n + ${tokens.spacingHorizontalXXS})`,\n medium: `calc(${tokens.spacingHorizontalMNudge}\n + ${iconSizes.medium}\n + ${tokens.spacingHorizontalXXS}\n + ${tokens.spacingHorizontalXXS})`,\n large: `calc(${tokens.spacingHorizontalM}\n + ${iconSizes.large}\n + ${tokens.spacingHorizontalSNudge}\n + ${tokens.spacingHorizontalSNudge})`,\n};\n\n/* Left padding is calculated from the outer padding + inner content padding values\n * since <select> can't have additional child content or custom inner layout */\nconst paddingLeft = {\n small: `calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`,\n medium: `calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`,\n large: `calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`,\n};\n\n/* end of shared values */\n\nconst useRootStyles = makeStyles({\n base: {\n alignItems: 'center',\n boxSizing: 'border-box',\n display: 'flex',\n flexWrap: 'nowrap',\n fontFamily: tokens.fontFamilyBase,\n position: 'relative',\n\n '&::after': {\n backgroundImage: `linear-gradient(\n 0deg,\n ${tokens.colorCompoundBrandStroke} 0%,\n ${tokens.colorCompoundBrandStroke} 50%,\n transparent 50%,\n transparent 100%\n )`,\n ...shorthands.borderRadius(0, 0, tokens.borderRadiusMedium, tokens.borderRadiusMedium),\n boxSizing: 'border-box',\n content: '\"\"',\n height: tokens.borderRadiusMedium,\n position: 'absolute',\n bottom: '0',\n left: '0',\n right: '0',\n transform: 'scaleX(0)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationUltraFast,\n transitionDelay: tokens.curveAccelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n\n '&:focus-within::after': {\n transform: 'scaleX(1)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationNormal,\n transitionDelay: tokens.curveDecelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n },\n});\n\nconst useSelectStyles = makeStyles({\n base: {\n appearance: 'none',\n ...shorthands.border('1px', 'solid', 'transparent'),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n boxShadow: 'none',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground1,\n cursor: 'pointer',\n flexGrow: 1,\n maxWidth: '100%',\n paddingBottom: 0,\n paddingTop: 0,\n\n ':focus': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: 'transparent',\n },\n },\n disabled: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n disabledUnderline: {\n ...shorthands.borderColor(\n tokens.colorTransparentStrokeDisabled,\n tokens.colorTransparentStrokeDisabled,\n tokens.colorNeutralStrokeDisabled,\n ),\n },\n\n small: {\n height: fieldHeights.small,\n paddingLeft: paddingLeft.small,\n paddingRight: paddingRight.small,\n ...typographyStyles.caption1,\n },\n medium: {\n height: fieldHeights.medium,\n paddingLeft: paddingLeft.medium,\n paddingRight: paddingRight.medium,\n ...typographyStyles.body1,\n },\n large: {\n height: fieldHeights.large,\n paddingLeft: paddingLeft.large,\n paddingRight: paddingRight.large,\n ...typographyStyles.body2,\n },\n outline: {\n backgroundColor: tokens.colorNeutralBackground1,\n ...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n outlineInteractive: {\n '&:hover': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n\n '&:active': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n },\n underline: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderBottom('1px', 'solid', tokens.colorNeutralStrokeAccessible),\n ...shorthands.borderRadius(0),\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n },\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n },\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n invalidUnderline: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n borderBottomColor: tokens.colorPaletteRedBorder2,\n },\n },\n});\n\nconst useIconStyles = makeStyles({\n icon: {\n boxSizing: 'border-box',\n color: tokens.colorNeutralStrokeAccessible,\n display: 'block',\n position: 'absolute',\n pointerEvents: 'none',\n\n // the SVG must have display: block for accurate positioning\n // otherwise an extra inline space is inserted after the svg element\n '& svg': {\n display: 'block',\n },\n },\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n small: {\n fontSize: iconSizes.small,\n height: iconSizes.small,\n right: tokens.spacingHorizontalSNudge,\n width: iconSizes.small,\n },\n medium: {\n fontSize: iconSizes.medium,\n height: iconSizes.medium,\n right: tokens.spacingHorizontalMNudge,\n width: iconSizes.medium,\n },\n large: {\n fontSize: iconSizes.large,\n height: iconSizes.large,\n right: tokens.spacingHorizontalM,\n width: iconSizes.large,\n },\n});\n\n/**\n * Apply styling to the Select slots based on the state\n */\nexport const useSelectStyles_unstable = (state: SelectState): SelectState => {\n const { size, appearance } = state;\n const disabled = state.select.disabled;\n const invalid = `${state.select['aria-invalid']}` === 'true';\n\n const iconStyles = useIconStyles();\n const rootStyles = useRootStyles();\n const selectStyles = useSelectStyles();\n\n state.root.className = mergeClasses(selectClassNames.root, rootStyles.base, state.root.className);\n\n state.select.className = mergeClasses(\n selectClassNames.select,\n selectStyles.base,\n selectStyles[size],\n selectStyles[appearance],\n !disabled && appearance === 'outline' && selectStyles.outlineInteractive,\n !disabled && invalid && appearance !== 'underline' && selectStyles.invalid,\n !disabled && invalid && appearance === 'underline' && selectStyles.invalidUnderline,\n disabled && selectStyles.disabled,\n disabled && appearance === 'underline' && selectStyles.disabledUnderline,\n state.select.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n selectClassNames.icon,\n iconStyles.icon,\n disabled && iconStyles.disabled,\n iconStyles[size],\n state.icon.className,\n );\n }\n\n return state;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
define(["require", "exports", "@fluentui/react-field", "../../Select"], function (require, exports, react_field_1, Select_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SelectField = exports.selectFieldClassNames = void 0;
|
|
5
|
+
/** @deprecated Use Field with Select: `<Field><Select /></Field>` */
|
|
6
|
+
exports.selectFieldClassNames = react_field_1.getDeprecatedFieldClassNames(Select_1.selectClassNames.root);
|
|
7
|
+
/** @deprecated Use Field with Select: `<Field><Select /></Field>` */
|
|
8
|
+
exports.SelectField = react_field_1.makeDeprecatedField(Select_1.Select);
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=SelectField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/SelectField/SelectField.tsx"],"names":[],"mappings":";;;;IAOA,qEAAqE;IACxD,QAAA,qBAAqB,GAAG,0CAA4B,CAAC,yBAAgB,CAAC,IAAI,CAAC,CAAC;IACzF,qEAAqE;IACxD,QAAA,WAAW,GAA0C,iCAAmB,CAAC,eAAM,CAAC,CAAC","sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { DeprecatedFieldProps, getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { Select, selectClassNames, SelectProps } from '../../Select';\n\n/** @deprecated Use Field with Select: `<Field><Select /></Field>` */\nexport type SelectFieldProps = DeprecatedFieldProps<SelectProps>;\n/** @deprecated Use Field with Select: `<Field><Select /></Field>` */\nexport const selectFieldClassNames = getDeprecatedFieldClassNames(selectClassNames.root);\n/** @deprecated Use Field with Select: `<Field><Select /></Field>` */\nexport const SelectField: ForwardRefComponent<SelectFieldProps> = makeDeprecatedField(Select);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
define(["require", "exports", "tslib", "./SelectField"], function (require, exports, tslib_1, SelectField_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
tslib_1.__exportStar(SelectField_1, exports);
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-select/src/components/SelectField/index.ts"],"names":[],"mappings":";;;IAAA,6CAA8B","sourcesContent":["export * from './SelectField';\n"]}
|
package/lib-amd/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
define(["require", "exports", "./Select", "./SelectField"], function (require, exports, Select_1, SelectField_1) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.selectFieldClassNames = exports.SelectField_unstable = exports.useSelect_unstable = exports.useSelectStyles_unstable = exports.renderSelect_unstable = exports.selectClassNames = exports.Select = void 0;
|
|
5
|
+
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return Select_1.Select; } });
|
|
6
|
+
Object.defineProperty(exports, "selectClassNames", { enumerable: true, get: function () { return Select_1.selectClassNames; } });
|
|
7
|
+
Object.defineProperty(exports, "renderSelect_unstable", { enumerable: true, get: function () { return Select_1.renderSelect_unstable; } });
|
|
8
|
+
Object.defineProperty(exports, "useSelectStyles_unstable", { enumerable: true, get: function () { return Select_1.useSelectStyles_unstable; } });
|
|
9
|
+
Object.defineProperty(exports, "useSelect_unstable", { enumerable: true, get: function () { return Select_1.useSelect_unstable; } });
|
|
10
|
+
Object.defineProperty(exports, "SelectField_unstable", { enumerable: true, get: function () { return SelectField_1.SelectField; } });
|
|
11
|
+
Object.defineProperty(exports, "selectFieldClassNames", { enumerable: true, get: function () { return SelectField_1.selectFieldClassNames; } });
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-select/src/index.ts"],"names":[],"mappings":";;;;IACE,gGAAA,MAAM,OAAA;IACN,0GAAA,gBAAgB,OAAA;IAChB,+GAAA,qBAAqB,OAAA;IACrB,kHAAA,wBAAwB,OAAA;IACxB,4GAAA,kBAAkB,OAAA;IAKX,mHAAA,WAAW,OAAwB;IAAE,oHAAA,qBAAqB,OAAA","sourcesContent":["export {\n Select,\n selectClassNames,\n renderSelect_unstable,\n useSelectStyles_unstable,\n useSelect_unstable,\n} from './Select';\nexport type { SelectOnChangeData, SelectProps, SelectSlots, SelectState } from './Select';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { SelectField as SelectField_unstable, selectFieldClassNames } from './SelectField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { SelectFieldProps as SelectFieldProps_unstable } from './SelectField';\n"]}
|
package/lib-commonjs/Select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-select/src/Select.ts"],"sourcesContent":["export * from './components/Select/index';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-select/src/SelectField.ts"],"sourcesContent":["export * from './components/SelectField/index';\n"]}
|
|
@@ -4,19 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Select = void 0;
|
|
7
|
-
|
|
8
7
|
const React = /*#__PURE__*/require("react");
|
|
9
|
-
|
|
10
8
|
const useSelect_1 = /*#__PURE__*/require("./useSelect");
|
|
11
|
-
|
|
12
9
|
const renderSelect_1 = /*#__PURE__*/require("./renderSelect");
|
|
13
|
-
|
|
14
10
|
const useSelectStyles_1 = /*#__PURE__*/require("./useSelectStyles");
|
|
15
11
|
/**
|
|
16
12
|
* Select component
|
|
17
13
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
14
|
exports.Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
21
15
|
const state = useSelect_1.useSelect_unstable(props, ref);
|
|
22
16
|
useSelectStyles_1.useSelectStyles_unstable(state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIA;;;AAGaA,cAAM,gBAAqCC,KAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EACtF,MAAMC,KAAK,GAAGC,8BAAkB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAE5CG,0CAAwB,CAACF,KAAK,CAAC;EAC/B,OAAOG,oCAAqB,CAACH,KAAK,CAAC;AACrC,CAAC,CAAC;AAEFL,cAAM,CAACS,WAAW,GAAG,QAAQ","names":["exports","React","forwardRef","props","ref","state","useSelect_1","useSelectStyles_1","renderSelect_1","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-select/src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSelect_unstable } from './useSelect';\nimport { renderSelect_unstable } from './renderSelect';\nimport { useSelectStyles_unstable } from './useSelectStyles';\nimport type { SelectProps } from './Select.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Select component\n */\nexport const Select: ForwardRefComponent<SelectProps> = React.forwardRef((props, ref) => {\n const state = useSelect_unstable(props, ref);\n\n useSelectStyles_unstable(state);\n return renderSelect_unstable(state);\n});\n\nSelect.displayName = 'Select';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"mappings":"","names":[],"sourceRoot":"../src/","sources":[],"sourcesContent":[]}
|
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
const tslib_1 = /*#__PURE__*/require("tslib");
|
|
8
|
-
|
|
9
7
|
tslib_1.__exportStar(require("./Select"), exports);
|
|
10
|
-
|
|
11
8
|
tslib_1.__exportStar(require("./Select.types"), exports);
|
|
12
|
-
|
|
13
9
|
tslib_1.__exportStar(require("./renderSelect"), exports);
|
|
14
|
-
|
|
15
10
|
tslib_1.__exportStar(require("./useSelect"), exports);
|
|
16
|
-
|
|
17
11
|
tslib_1.__exportStar(require("./useSelectStyles"), exports);
|
|
18
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-select/src/components/Select/index.ts"],"sourcesContent":["export * from './Select';\nexport * from './Select.types';\nexport * from './renderSelect';\nexport * from './useSelect';\nexport * from './useSelectStyles';\n"]}
|
|
@@ -4,25 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.renderSelect_unstable = void 0;
|
|
7
|
-
|
|
8
7
|
const React = /*#__PURE__*/require("react");
|
|
9
|
-
|
|
10
8
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
9
|
/**
|
|
12
10
|
* Render the final JSX of Select
|
|
13
11
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
12
|
const renderSelect_unstable = state => {
|
|
17
13
|
const {
|
|
18
14
|
slots,
|
|
19
15
|
slotProps
|
|
20
16
|
} = react_utilities_1.getSlots(state);
|
|
21
|
-
return React.createElement(slots.root, {
|
|
22
|
-
|
|
23
|
-
},
|
|
17
|
+
return React.createElement(slots.root, {
|
|
18
|
+
...slotProps.root
|
|
19
|
+
}, React.createElement(slots.select, {
|
|
20
|
+
...slotProps.select
|
|
21
|
+
}, slotProps.select.children), React.createElement(slots.icon, {
|
|
22
|
+
...slotProps.icon
|
|
24
23
|
}));
|
|
25
24
|
};
|
|
26
|
-
|
|
27
25
|
exports.renderSelect_unstable = renderSelect_unstable;
|
|
28
26
|
//# sourceMappingURL=renderSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,qBAAqB,GAAIC,KAAkB,IAAI;EAC1D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAcH,KAAK,CAAC;EACzD,OACEI,oBAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC5BD,oBAACH,KAAK,CAACK,MAAM;IAAA,GAAKJ,SAAS,CAACI;EAAM,GAAGJ,SAAS,CAACI,MAAM,CAACC,QAAQ,CAAgB,EAC9EH,oBAACH,KAAK,CAACO,IAAI;IAAA,GAAKN,SAAS,CAACM;EAAI,EAAI,CACvB;AAEjB,CAAC;AARYC,6BAAqB","names":["renderSelect_unstable","state","slots","slotProps","react_utilities_1","React","root","select","children","icon","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-select/src/components/Select/renderSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SelectSlots, SelectState } from './Select.types';\n\n/**\n * Render the final JSX of Select\n */\nexport const renderSelect_unstable = (state: SelectState) => {\n const { slots, slotProps } = getSlots<SelectSlots>(state);\n return (\n <slots.root {...slotProps.root}>\n <slots.select {...slotProps.select}>{slotProps.select.children}</slots.select>\n <slots.icon {...slotProps.icon} />\n </slots.root>\n );\n};\n"]}
|
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useSelect_unstable = void 0;
|
|
7
|
-
|
|
8
7
|
const React = /*#__PURE__*/require("react");
|
|
9
|
-
|
|
10
8
|
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
|
-
|
|
12
9
|
const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
|
10
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
|
13
11
|
/**
|
|
14
12
|
* Create the state required to render Select.
|
|
15
13
|
*
|
|
@@ -19,16 +17,16 @@ const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
|
|
19
17
|
* @param props - props from this instance of Select
|
|
20
18
|
* @param ref - reference to the `<select>` element in Select
|
|
21
19
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
20
|
const useSelect_unstable = (props, ref) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const overrides = react_shared_contexts_1.useOverrides_unstable();
|
|
25
23
|
const {
|
|
26
24
|
defaultValue,
|
|
27
25
|
value,
|
|
28
26
|
select,
|
|
29
27
|
icon,
|
|
30
28
|
root,
|
|
31
|
-
appearance = 'outline',
|
|
29
|
+
appearance = (_a = overrides.inputDefaultAppearance) !== null && _a !== void 0 ? _a : 'outline',
|
|
32
30
|
onChange,
|
|
33
31
|
size = 'medium'
|
|
34
32
|
} = props;
|
|
@@ -72,6 +70,5 @@ const useSelect_unstable = (props, ref) => {
|
|
|
72
70
|
});
|
|
73
71
|
return state;
|
|
74
72
|
};
|
|
75
|
-
|
|
76
73
|
exports.useSelect_unstable = useSelect_unstable;
|
|
77
74
|
//# sourceMappingURL=useSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AAEA;;;;;;;;;AASO,MAAMA,kBAAkB,GAAG,CAACC,KAAkB,EAAEC,GAAiC,KAAiB;;EACvG,MAAMC,SAAS,GAAGC,6CAAY,EAAE;EAEhC,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,MAAM;IACNC,IAAI;IACJC,IAAI;IACJC,UAAU,GAAG,eAAS,CAACC,sBAAsB,mCAAI,SAAS;IAE1DC,QAAQ;IACRC,IAAI,GAAG;EAAQ,CAChB,GAAGZ,KAAK;EAET,MAAMa,WAAW,GAAGC,2CAAyB,CAAC;IAC5Cd,KAAK;IACLe,kBAAkB,EAAE,QAAQ;IAC5BC,iBAAiB,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO;GAC9E,CAAC;EAEF,MAAMC,KAAK,GAAgB;IACzBL,IAAI;IACJH,UAAU;IACVS,UAAU,EAAE;MACVV,IAAI,EAAE,MAAM;MACZF,MAAM,EAAE,QAAQ;MAChBC,IAAI,EAAE;KACP;IACDD,MAAM,EAAEQ,kCAAgB,CAACR,MAAM,EAAE;MAC/Ba,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZhB,YAAY;QACZC,KAAK;QACLJ,GAAG;QACH,GAAGY,WAAW,CAACQ;;KAElB,CAAC;IACFd,IAAI,EAAEO,kCAAgB,CAACP,IAAI,EAAE;MAC3BY,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QAAEE,QAAQ,EAAEC,oBAACC,gCAAkB;MAAG;KACjD,CAAC;IACFhB,IAAI,EAAEM,kCAAgB,CAACN,IAAI,EAAE;MAC3BW,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAEP,WAAW,CAACL;KAC3B;GACF;EAEDS,KAAK,CAACX,MAAM,CAACK,QAAQ,GAAGG,kCAAgB,CAACW,KAAK,IAAG;IAC/Cd,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAGc,KAAK,EAAE;MAAEpB,KAAK,EAAGoB,KAAK,CAACC,MAA4B,CAACrB;IAAK,CAAE,CAAC;EACzE,CAAC,CAAC;EAEF,OAAOY,KAAK;AACd,CAAC;AArDYU,0BAAkB","names":["useSelect_unstable","props","ref","overrides","react_shared_contexts_1","defaultValue","value","select","icon","root","appearance","inputDefaultAppearance","onChange","size","nativeProps","react_utilities_1","primarySlotTagName","excludedPropNames","state","components","required","defaultProps","primary","children","React","react_icons_1","event","target","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-select/src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getPartitionedNativeProps, resolveShorthand, useEventCallback } from '@fluentui/react-utilities';\nimport { ChevronDownRegular } from '@fluentui/react-icons';\nimport type { SelectProps, SelectState } from './Select.types';\nimport { useOverrides_unstable as useOverrides } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render Select.\n *\n * The returned state can be modified with hooks such as useSelectStyles,\n * before being passed to renderSelect.\n *\n * @param props - props from this instance of Select\n * @param ref - reference to the `<select>` element in Select\n */\nexport const useSelect_unstable = (props: SelectProps, ref: React.Ref<HTMLSelectElement>): SelectState => {\n const overrides = useOverrides();\n\n const {\n defaultValue,\n value,\n select,\n icon,\n root,\n appearance = overrides.inputDefaultAppearance ?? 'outline',\n\n onChange,\n size = 'medium',\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'select',\n excludedPropNames: ['appearance', 'defaultValue', 'onChange', 'size', 'value'],\n });\n\n const state: SelectState = {\n size,\n appearance,\n components: {\n root: 'span',\n select: 'select',\n icon: 'span',\n },\n select: resolveShorthand(select, {\n required: true,\n defaultProps: {\n defaultValue,\n value,\n ref,\n ...nativeProps.primary,\n },\n }),\n icon: resolveShorthand(icon, {\n required: true,\n defaultProps: { children: <ChevronDownRegular /> },\n }),\n root: resolveShorthand(root, {\n required: true,\n defaultProps: nativeProps.root,\n }),\n };\n\n state.select.onChange = useEventCallback(event => {\n onChange?.(event, { value: (event.target as HTMLSelectElement).value });\n });\n\n return state;\n};\n"]}
|