@fluentui/react-select 0.0.0-nightly-20230223-2115.1 → 0.0.0-nightly-20230227-0424.1
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 +13 -13
- package/CHANGELOG.md +9 -9
- package/lib/Select.js.map +1 -1
- package/lib/SelectField.js.map +1 -1
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Select/Select.types.js +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 +7 -2
- package/lib/components/Select/renderSelect.js.map +1 -1
- package/lib/components/Select/useSelect.js +2 -1
- package/lib/components/Select/useSelect.js.map +1 -1
- package/lib/components/Select/useSelectStyles.js.map +1 -1
- package/lib/components/SelectField/SelectField.js +2 -1
- package/lib/components/SelectField/SelectField.js.map +1 -1
- package/lib/components/SelectField/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Select.js +4 -5
- package/lib-commonjs/Select.js.map +1 -1
- package/lib-commonjs/SelectField.js +4 -5
- package/lib-commonjs/SelectField.js.map +1 -1
- package/lib-commonjs/components/Select/Select.js +15 -16
- package/lib-commonjs/components/Select/Select.js.map +1 -1
- package/lib-commonjs/components/Select/Select.types.js +2 -5
- package/lib-commonjs/components/Select/Select.types.js.map +1 -1
- package/lib-commonjs/components/Select/index.js +8 -9
- package/lib-commonjs/components/Select/index.js.map +1 -1
- package/lib-commonjs/components/Select/renderSelect.js +22 -15
- package/lib-commonjs/components/Select/renderSelect.js.map +1 -1
- package/lib-commonjs/components/Select/useSelect.js +69 -59
- package/lib-commonjs/components/Select/useSelect.js.map +1 -1
- package/lib-commonjs/components/Select/useSelectStyles.js +272 -589
- package/lib-commonjs/components/Select/useSelectStyles.js.map +1 -1
- package/lib-commonjs/components/SelectField/SelectField.js +11 -17
- package/lib-commonjs/components/SelectField/SelectField.js.map +1 -1
- package/lib-commonjs/components/SelectField/index.js +4 -5
- package/lib-commonjs/components/SelectField/index.js.map +1 -1
- package/lib-commonjs/index.js +49 -21
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +8 -8
- package/.swcrc +0 -33
|
@@ -1,64 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useSelect_unstable", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>useSelect_unstable
|
|
4
|
+
value: true
|
|
8
5
|
});
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
exports.useSelect_unstable = void 0;
|
|
7
|
+
const React = /*#__PURE__*/require("react");
|
|
8
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
+
const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
|
10
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
|
11
|
+
/**
|
|
12
|
+
* Create the state required to render Select.
|
|
13
|
+
*
|
|
14
|
+
* The returned state can be modified with hooks such as useSelectStyles,
|
|
15
|
+
* before being passed to renderSelect.
|
|
16
|
+
*
|
|
17
|
+
* @param props - props from this instance of Select
|
|
18
|
+
* @param ref - reference to the `<select>` element in Select
|
|
19
|
+
*/
|
|
20
|
+
const useSelect_unstable = (props, ref) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const overrides = react_shared_contexts_1.useOverrides_unstable();
|
|
23
|
+
const {
|
|
24
|
+
defaultValue,
|
|
25
|
+
value,
|
|
26
|
+
select,
|
|
27
|
+
icon,
|
|
28
|
+
root,
|
|
29
|
+
appearance = (_a = overrides.inputDefaultAppearance) !== null && _a !== void 0 ? _a : 'outline',
|
|
30
|
+
onChange,
|
|
31
|
+
size = 'medium'
|
|
32
|
+
} = props;
|
|
33
|
+
const nativeProps = react_utilities_1.getPartitionedNativeProps({
|
|
34
|
+
props,
|
|
35
|
+
primarySlotTagName: 'select',
|
|
36
|
+
excludedPropNames: ['appearance', 'defaultValue', 'onChange', 'size', 'value']
|
|
37
|
+
});
|
|
38
|
+
const state = {
|
|
39
|
+
size,
|
|
40
|
+
appearance,
|
|
41
|
+
components: {
|
|
42
|
+
root: 'span',
|
|
43
|
+
select: 'select',
|
|
44
|
+
icon: 'span'
|
|
45
|
+
},
|
|
46
|
+
select: react_utilities_1.resolveShorthand(select, {
|
|
47
|
+
required: true,
|
|
48
|
+
defaultProps: {
|
|
49
|
+
defaultValue,
|
|
50
|
+
value,
|
|
51
|
+
ref,
|
|
52
|
+
...nativeProps.primary
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
icon: react_utilities_1.resolveShorthand(icon, {
|
|
56
|
+
required: true,
|
|
57
|
+
defaultProps: {
|
|
58
|
+
children: React.createElement(react_icons_1.ChevronDownRegular, null)
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
root: react_utilities_1.resolveShorthand(root, {
|
|
62
|
+
required: true,
|
|
63
|
+
defaultProps: nativeProps.root
|
|
64
|
+
})
|
|
65
|
+
};
|
|
66
|
+
state.select.onChange = react_utilities_1.useEventCallback(event => {
|
|
67
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, {
|
|
68
|
+
value: event.target.value
|
|
27
69
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
root: 'span',
|
|
33
|
-
select: 'select',
|
|
34
|
-
icon: 'span'
|
|
35
|
-
},
|
|
36
|
-
select: (0, _reactUtilities.resolveShorthand)(select, {
|
|
37
|
-
required: true,
|
|
38
|
-
defaultProps: {
|
|
39
|
-
defaultValue,
|
|
40
|
-
value,
|
|
41
|
-
ref,
|
|
42
|
-
...nativeProps.primary
|
|
43
|
-
}
|
|
44
|
-
}),
|
|
45
|
-
icon: (0, _reactUtilities.resolveShorthand)(icon, {
|
|
46
|
-
required: true,
|
|
47
|
-
defaultProps: {
|
|
48
|
-
children: /*#__PURE__*/ _react.createElement(_reactIcons.ChevronDownRegular, null)
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
root: (0, _reactUtilities.resolveShorthand)(root, {
|
|
52
|
-
required: true,
|
|
53
|
-
defaultProps: nativeProps.root
|
|
54
|
-
})
|
|
55
|
-
};
|
|
56
|
-
state.select.onChange = (0, _reactUtilities.useEventCallback)((event)=>{
|
|
57
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event, {
|
|
58
|
-
value: event.target.value
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
return state;
|
|
62
|
-
}; //# sourceMappingURL=useSelect.js.map
|
|
63
|
-
|
|
70
|
+
});
|
|
71
|
+
return state;
|
|
72
|
+
};
|
|
73
|
+
exports.useSelect_unstable = useSelect_unstable;
|
|
64
74
|
//# sourceMappingURL=useSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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":"","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"]}
|