@fluentui/react-select 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230321-0440.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 +1 -1
- package/lib/Select.js.map +1 -1
- package/lib/SelectField.js +1 -1
- package/lib/SelectField.js.map +1 -1
- package/lib/components/Select/Select.js +6 -6
- 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 +5 -5
- package/lib/components/Select/index.js.map +1 -1
- package/lib/components/Select/renderSelect.js +9 -3
- package/lib/components/Select/renderSelect.js.map +1 -1
- package/lib/components/Select/useSelect.js +13 -12
- package/lib/components/Select/useSelect.js.map +1 -1
- package/lib/components/Select/useSelectStyles.js +13 -13
- package/lib/components/Select/useSelectStyles.js.map +1 -1
- package/lib/components/SelectField/SelectField.js +3 -2
- package/lib/components/SelectField/SelectField.js.map +1 -1
- package/lib/components/SelectField/index.js +1 -1
- package/lib/components/SelectField/index.js.map +1 -1
- package/lib/index.js +2 -2
- 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 +20 -19
- 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 -13
- 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 +10 -9
- package/.swcrc +0 -39
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
+
value: true
|
|
4
5
|
});
|
|
5
|
-
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
6
|
-
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
7
|
-
//# sourceMappingURL=Select.types.js.map
|
|
8
|
-
|
|
9
6
|
//# sourceMappingURL=Select.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../../../../../../../packages/react-components/react-select/src/components/Select/Select.types.ts"],"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"],"mappings":""}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
+
value: true
|
|
4
5
|
});
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
12
|
-
|
|
6
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./Select"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./Select.types"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./renderSelect"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./useSelect"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./useSelectStyles"), exports);
|
|
13
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports"],"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"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,cAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,oBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,oBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,iBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,uBAAAC,OAAA"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "renderSelect_unstable", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>renderSelect_unstable
|
|
4
|
+
value: true
|
|
8
5
|
});
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
exports.renderSelect_unstable = void 0;
|
|
7
|
+
const React = /*#__PURE__*/require("react");
|
|
8
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
+
/**
|
|
10
|
+
* Render the final JSX of Select
|
|
11
|
+
*/
|
|
12
|
+
const renderSelect_unstable = state => {
|
|
13
|
+
const {
|
|
14
|
+
slots,
|
|
15
|
+
slotProps
|
|
16
|
+
} = react_utilities_1.getSlots(state);
|
|
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
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
exports.renderSelect_unstable = renderSelect_unstable;
|
|
17
26
|
//# sourceMappingURL=renderSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"names":["React","require","react_utilities_1","renderSelect_unstable","state","slots","slotProps","getSlots","createElement","root","select","children","icon","exports"],"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"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;AAGO,MAAME,qBAAqB,GAAIC,KAAkB,IAAI;EAC1D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,iBAAA,CAAAK,QAAQ,CAAcH,KAAK,CAAC;EACzD,OACEJ,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC5BT,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACK,MAAM;IAAA,GAAKJ,SAAS,CAACI;EAAM,GAAGJ,SAAS,CAACI,MAAM,CAACC,QAAQ,CAAgB,EAC9EX,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACO,IAAI;IAAA,GAAKN,SAAS,CAACM;EAAI,EAAI,CACvB;AAEjB,CAAC;AARYC,OAAA,CAAAV,qBAAqB,GAAAA,qBAAA"}
|
|
@@ -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?.(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,"names":["React","require","react_utilities_1","react_icons_1","react_shared_contexts_1","useSelect_unstable","props","ref","overrides","useOverrides_unstable","defaultValue","value","select","icon","root","appearance","_a","inputDefaultAppearance","onChange","size","nativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","state","components","resolveShorthand","required","defaultProps","primary","children","createElement","ChevronDownRegular","useEventCallback","event","target","exports"],"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"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AACA,MAAAE,aAAA,gBAAAF,OAAA;AAEA,MAAAG,uBAAA,gBAAAH,OAAA;AAEA;;;;;;;;;AASO,MAAMI,kBAAkB,GAAGA,CAACC,KAAkB,EAAEC,GAAiC,KAAiB;;EACvG,MAAMC,SAAS,GAAGJ,uBAAA,CAAAK,qBAAY,EAAE;EAEhC,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,MAAM;IACNC,IAAI;IACJC,IAAI;IACJC,UAAU,GAAG,CAAAC,EAAA,GAAAR,SAAS,CAACS,sBAAsB,cAAAD,EAAA,cAAAA,EAAA,GAAI,SAAS;IAE1DE,QAAQ;IACRC,IAAI,GAAG;EAAQ,CAChB,GAAGb,KAAK;EAET,MAAMc,WAAW,GAAGlB,iBAAA,CAAAmB,yBAAyB,CAAC;IAC5Cf,KAAK;IACLgB,kBAAkB,EAAE,QAAQ;IAC5BC,iBAAiB,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO;GAC9E,CAAC;EAEF,MAAMC,KAAK,GAAgB;IACzBL,IAAI;IACJJ,UAAU;IACVU,UAAU,EAAE;MACVX,IAAI,EAAE,MAAM;MACZF,MAAM,EAAE,QAAQ;MAChBC,IAAI,EAAE;KACP;IACDD,MAAM,EAAEV,iBAAA,CAAAwB,gBAAgB,CAACd,MAAM,EAAE;MAC/Be,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZlB,YAAY;QACZC,KAAK;QACLJ,GAAG;QACH,GAAGa,WAAW,CAACS;;KAElB,CAAC;IACFhB,IAAI,EAAEX,iBAAA,CAAAwB,gBAAgB,CAACb,IAAI,EAAE;MAC3Bc,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QAAEE,QAAQ,EAAE9B,KAAA,CAAA+B,aAAA,CAAC5B,aAAA,CAAA6B,kBAAkB;MAAG;KACjD,CAAC;IACFlB,IAAI,EAAEZ,iBAAA,CAAAwB,gBAAgB,CAACZ,IAAI,EAAE;MAC3Ba,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAER,WAAW,CAACN;KAC3B;GACF;EAEDU,KAAK,CAACZ,MAAM,CAACM,QAAQ,GAAGhB,iBAAA,CAAA+B,gBAAgB,CAACC,KAAK,IAAG;IAC/ChB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAGgB,KAAK,EAAE;MAAEvB,KAAK,EAAGuB,KAAK,CAACC,MAA4B,CAACxB;IAAK,CAAE,CAAC;EACzE,CAAC,CAAC;EAEF,OAAOa,KAAK;AACd,CAAC;AArDYY,OAAA,CAAA/B,kBAAkB,GAAAA,kBAAA"}
|