@fluentui/react-slider 9.0.0-alpha.8 → 9.0.0-beta.10
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 +991 -10
- package/CHANGELOG.md +283 -11
- package/README.md +1 -2
- package/dist/react-slider.d.ts +36 -67
- package/lib/components/Slider/Slider.d.ts +4 -3
- package/lib/components/Slider/Slider.js +8 -8
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.types.d.ts +26 -55
- package/lib/components/Slider/Slider.types.js.map +1 -1
- package/lib/components/Slider/index.d.ts +2 -2
- package/lib/components/Slider/index.js +2 -2
- package/lib/components/Slider/index.js.map +1 -1
- package/lib/components/Slider/renderSlider.d.ts +1 -1
- package/lib/components/Slider/renderSlider.js +10 -8
- package/lib/components/Slider/renderSlider.js.map +1 -1
- package/lib/components/Slider/useSlider.d.ts +2 -6
- package/lib/components/Slider/useSlider.js +57 -85
- package/lib/components/Slider/useSlider.js.map +1 -1
- package/lib/components/Slider/useSliderState.d.ts +1 -1
- package/lib/components/Slider/useSliderState.js +49 -183
- package/lib/components/Slider/useSliderState.js.map +1 -1
- package/lib/components/Slider/useSliderStyles.d.ts +19 -1
- package/lib/components/Slider/useSliderStyles.js +175 -297
- package/lib/components/Slider/useSliderStyles.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Slider.js +1 -1
- package/lib-commonjs/components/Slider/Slider.d.ts +4 -3
- package/lib-commonjs/components/Slider/Slider.js +9 -9
- package/lib-commonjs/components/Slider/Slider.js.map +1 -1
- package/lib-commonjs/components/Slider/Slider.types.d.ts +26 -55
- package/lib-commonjs/components/Slider/index.d.ts +2 -2
- package/lib-commonjs/components/Slider/index.js +24 -3
- package/lib-commonjs/components/Slider/index.js.map +1 -1
- package/lib-commonjs/components/Slider/renderSlider.d.ts +1 -1
- package/lib-commonjs/components/Slider/renderSlider.js +14 -14
- package/lib-commonjs/components/Slider/renderSlider.js.map +1 -1
- package/lib-commonjs/components/Slider/useSlider.d.ts +2 -6
- package/lib-commonjs/components/Slider/useSlider.js +60 -89
- package/lib-commonjs/components/Slider/useSlider.js.map +1 -1
- package/lib-commonjs/components/Slider/useSliderState.d.ts +1 -1
- package/lib-commonjs/components/Slider/useSliderState.js +55 -191
- package/lib-commonjs/components/Slider/useSliderState.js.map +1 -1
- package/lib-commonjs/components/Slider/useSliderStyles.d.ts +19 -1
- package/lib-commonjs/components/Slider/useSliderStyles.js +177 -299
- package/lib-commonjs/components/Slider/useSliderStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +0 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +20 -14
- package/Spec.md +0 -216
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -12
- package/lib/common/isConformant.js.map +0 -1
- package/lib/utils/calculateSteps.d.ts +0 -5
- package/lib/utils/calculateSteps.js +0 -27
- package/lib/utils/calculateSteps.js.map +0 -1
- package/lib/utils/clamp.d.ts +0 -8
- package/lib/utils/clamp.js +0 -11
- package/lib/utils/clamp.js.map +0 -1
- package/lib/utils/getKeydownValue.d.ts +0 -6
- package/lib/utils/getKeydownValue.js +0 -39
- package/lib/utils/getKeydownValue.js.map +0 -1
- package/lib/utils/getMarkPercent.d.ts +0 -7
- package/lib/utils/getMarkPercent.js +0 -22
- package/lib/utils/getMarkPercent.js.map +0 -1
- package/lib/utils/getMarkValues.d.ts +0 -8
- package/lib/utils/getMarkValues.js +0 -24
- package/lib/utils/getMarkValues.js.map +0 -1
- package/lib/utils/getPercent.d.ts +0 -8
- package/lib/utils/getPercent.js +0 -11
- package/lib/utils/getPercent.js.map +0 -1
- package/lib/utils/getRTLSafeKey.d.ts +0 -4
- package/lib/utils/getRTLSafeKey.js +0 -21
- package/lib/utils/getRTLSafeKey.js.map +0 -1
- package/lib/utils/index.d.ts +0 -9
- package/lib/utils/index.js +0 -10
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/on.d.ts +0 -1
- package/lib/utils/on.js +0 -8
- package/lib/utils/on.js.map +0 -1
- package/lib/utils/renderMarks.d.ts +0 -13
- package/lib/utils/renderMarks.js +0 -31
- package/lib/utils/renderMarks.js.map +0 -1
- package/lib-amd/Slider.d.ts +0 -1
- package/lib-amd/Slider.js +0 -6
- package/lib-amd/Slider.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -4
- package/lib-amd/common/isConformant.js +0 -16
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Slider/Slider.d.ts +0 -5
- package/lib-amd/components/Slider/Slider.js +0 -15
- package/lib-amd/components/Slider/Slider.js.map +0 -1
- package/lib-amd/components/Slider/Slider.types.d.ts +0 -126
- package/lib-amd/components/Slider/Slider.types.js +0 -5
- package/lib-amd/components/Slider/Slider.types.js.map +0 -1
- package/lib-amd/components/Slider/index.d.ts +0 -6
- package/lib-amd/components/Slider/index.js +0 -11
- package/lib-amd/components/Slider/index.js.map +0 -1
- package/lib-amd/components/Slider/renderSlider.d.ts +0 -5
- package/lib-amd/components/Slider/renderSlider.js +0 -23
- package/lib-amd/components/Slider/renderSlider.js.map +0 -1
- package/lib-amd/components/Slider/useSlider.d.ts +0 -10
- package/lib-amd/components/Slider/useSlider.js +0 -72
- package/lib-amd/components/Slider/useSlider.js.map +0 -1
- package/lib-amd/components/Slider/useSliderState.d.ts +0 -2
- package/lib-amd/components/Slider/useSliderState.js +0 -151
- package/lib-amd/components/Slider/useSliderState.js.map +0 -1
- package/lib-amd/components/Slider/useSliderStyles.d.ts +0 -5
- package/lib-amd/components/Slider/useSliderStyles.js +0 -378
- package/lib-amd/components/Slider/useSliderStyles.js.map +0 -1
- package/lib-amd/index.d.ts +0 -2
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/utils/calculateSteps.d.ts +0 -5
- package/lib-amd/utils/calculateSteps.js +0 -30
- package/lib-amd/utils/calculateSteps.js.map +0 -1
- package/lib-amd/utils/clamp.d.ts +0 -8
- package/lib-amd/utils/clamp.js +0 -15
- package/lib-amd/utils/clamp.js.map +0 -1
- package/lib-amd/utils/getKeydownValue.d.ts +0 -6
- package/lib-amd/utils/getKeydownValue.js +0 -42
- package/lib-amd/utils/getKeydownValue.js.map +0 -1
- package/lib-amd/utils/getMarkPercent.d.ts +0 -7
- package/lib-amd/utils/getMarkPercent.js +0 -26
- package/lib-amd/utils/getMarkPercent.js.map +0 -1
- package/lib-amd/utils/getMarkValues.d.ts +0 -8
- package/lib-amd/utils/getMarkValues.js +0 -30
- package/lib-amd/utils/getMarkValues.js.map +0 -1
- package/lib-amd/utils/getPercent.d.ts +0 -8
- package/lib-amd/utils/getPercent.js +0 -17
- package/lib-amd/utils/getPercent.js.map +0 -1
- package/lib-amd/utils/getRTLSafeKey.d.ts +0 -4
- package/lib-amd/utils/getRTLSafeKey.js +0 -23
- package/lib-amd/utils/getRTLSafeKey.js.map +0 -1
- package/lib-amd/utils/index.d.ts +0 -9
- package/lib-amd/utils/index.js +0 -14
- package/lib-amd/utils/index.js.map +0 -1
- package/lib-amd/utils/on.d.ts +0 -1
- package/lib-amd/utils/on.js +0 -12
- package/lib-amd/utils/on.js.map +0 -1
- package/lib-amd/utils/renderMarks.d.ts +0 -13
- package/lib-amd/utils/renderMarks.js +0 -27
- package/lib-amd/utils/renderMarks.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -23
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/utils/calculateSteps.d.ts +0 -5
- package/lib-commonjs/utils/calculateSteps.js +0 -37
- package/lib-commonjs/utils/calculateSteps.js.map +0 -1
- package/lib-commonjs/utils/clamp.d.ts +0 -8
- package/lib-commonjs/utils/clamp.js +0 -20
- package/lib-commonjs/utils/clamp.js.map +0 -1
- package/lib-commonjs/utils/getKeydownValue.d.ts +0 -6
- package/lib-commonjs/utils/getKeydownValue.js +0 -49
- package/lib-commonjs/utils/getKeydownValue.js.map +0 -1
- package/lib-commonjs/utils/getMarkPercent.d.ts +0 -7
- package/lib-commonjs/utils/getMarkPercent.js +0 -31
- package/lib-commonjs/utils/getMarkPercent.js.map +0 -1
- package/lib-commonjs/utils/getMarkValues.d.ts +0 -8
- package/lib-commonjs/utils/getMarkValues.js +0 -34
- package/lib-commonjs/utils/getMarkValues.js.map +0 -1
- package/lib-commonjs/utils/getPercent.d.ts +0 -8
- package/lib-commonjs/utils/getPercent.js +0 -20
- package/lib-commonjs/utils/getPercent.js.map +0 -1
- package/lib-commonjs/utils/getRTLSafeKey.d.ts +0 -4
- package/lib-commonjs/utils/getRTLSafeKey.js +0 -30
- package/lib-commonjs/utils/getRTLSafeKey.js.map +0 -1
- package/lib-commonjs/utils/index.d.ts +0 -9
- package/lib-commonjs/utils/index.js +0 -26
- package/lib-commonjs/utils/index.js.map +0 -1
- package/lib-commonjs/utils/on.d.ts +0 -1
- package/lib-commonjs/utils/on.js +0 -16
- package/lib-commonjs/utils/on.js.map +0 -1
- package/lib-commonjs/utils/renderMarks.d.ts +0 -13
- package/lib-commonjs/utils/renderMarks.js +0 -42
- package/lib-commonjs/utils/renderMarks.js.map +0 -1
|
@@ -1,49 +1,38 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentState, ComponentProps,
|
|
2
|
+
import type { ComponentState, ComponentProps, Slot } from '@fluentui/react-utilities';
|
|
3
3
|
export declare type SliderSlots = {
|
|
4
4
|
/**
|
|
5
5
|
* The root of the Slider.
|
|
6
|
+
* The root slot receives the `className` and `style` specified directly on the `<Slider>`.
|
|
7
|
+
* All other native props will be applied to the primary slot, `input`.
|
|
6
8
|
*/
|
|
7
|
-
root:
|
|
9
|
+
root: NonNullable<Slot<'div'>>;
|
|
8
10
|
/**
|
|
9
11
|
* The Slider's base. It is used to visibly display the min and max selectable values.
|
|
10
12
|
*/
|
|
11
|
-
rail:
|
|
12
|
-
/**
|
|
13
|
-
* The wrapper around the Slider component.
|
|
14
|
-
*/
|
|
15
|
-
sliderWrapper: IntrinsicShorthandProps<'div'>;
|
|
16
|
-
/**
|
|
17
|
-
* The wrapper around the Slider's track. It is primarily used to handle the positioning of the track.
|
|
18
|
-
*/
|
|
19
|
-
trackWrapper: IntrinsicShorthandProps<'div'>;
|
|
20
|
-
/**
|
|
21
|
-
* The bar showing the current selected area adjacent to the Slider's thumb.
|
|
22
|
-
*/
|
|
23
|
-
track: IntrinsicShorthandProps<'div'>;
|
|
24
|
-
/**
|
|
25
|
-
* The wrapper holding the marks and mark labels for the Slider.
|
|
26
|
-
*/
|
|
27
|
-
marksWrapper: IntrinsicShorthandProps<'div'>;
|
|
28
|
-
/**
|
|
29
|
-
* The wrapper around the Slider's thumb. It is primarily used to handle the dragging animation from translateX.
|
|
30
|
-
*/
|
|
31
|
-
thumbWrapper: IntrinsicShorthandProps<'div'>;
|
|
13
|
+
rail: NonNullable<Slot<'div'>>;
|
|
32
14
|
/**
|
|
33
15
|
* The draggable icon used to select a given value from the Slider.
|
|
34
16
|
* This is the element containing `role = 'slider'`.
|
|
35
17
|
*/
|
|
36
|
-
thumb:
|
|
37
|
-
/**
|
|
38
|
-
* The area in which the Slider's rail allows for the thumb to be dragged.
|
|
39
|
-
*/
|
|
40
|
-
activeRail: IntrinsicShorthandProps<'div'>;
|
|
18
|
+
thumb: NonNullable<Slot<'div'>>;
|
|
41
19
|
/**
|
|
42
20
|
* The hidden input for the Slider.
|
|
21
|
+
* This is the PRIMARY slot: all native properties specified directly on `<Slider>` will be applied to this slot,
|
|
22
|
+
* except `className` and `style`, which remain on the root slot.
|
|
23
|
+
*
|
|
43
24
|
*/
|
|
44
|
-
input:
|
|
25
|
+
input: NonNullable<Slot<'input'>> & {
|
|
26
|
+
/**
|
|
27
|
+
* Orient is a non standard attribute that allows for vertical orientation in Firefox. It is set internally
|
|
28
|
+
* when `vertical` is set to true.
|
|
29
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#non_standard_attributes
|
|
30
|
+
* Webkit/Chromium support for vertical inputs is provided via -webkit-appearance css property
|
|
31
|
+
*/
|
|
32
|
+
orient?: 'horizontal' | 'vertical';
|
|
33
|
+
};
|
|
45
34
|
};
|
|
46
|
-
|
|
35
|
+
declare type SliderCommons = {
|
|
47
36
|
/**
|
|
48
37
|
* The starting value for an uncontrolled Slider.
|
|
49
38
|
* Mutually exclusive with `value` prop.
|
|
@@ -70,14 +59,6 @@ export declare type SliderCommons = {
|
|
|
70
59
|
* @default 1
|
|
71
60
|
*/
|
|
72
61
|
step?: number;
|
|
73
|
-
/**
|
|
74
|
-
* The number of steps that the Slider's value will change by during a key press. When provided, the `keyboardSteps`
|
|
75
|
-
* will be separated from the pointer `steps` allowing for the value to go outside of pointer related
|
|
76
|
-
* snapping values.
|
|
77
|
-
*
|
|
78
|
-
* @default `step` or 1
|
|
79
|
-
*/
|
|
80
|
-
keyboardStep?: number;
|
|
81
62
|
/**
|
|
82
63
|
* Whether to render the Slider as disabled.
|
|
83
64
|
*
|
|
@@ -89,18 +70,6 @@ export declare type SliderCommons = {
|
|
|
89
70
|
* @default `false` (renders horizontally)
|
|
90
71
|
*/
|
|
91
72
|
vertical?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* When enabled, small marks are displayed across the Slider, showing potential steps.
|
|
94
|
-
*
|
|
95
|
-
* - If `true`, marks are visible at each `step`.
|
|
96
|
-
* - If `number[]`, marks will be displayed at each provided number. Numbers must be in ascending order.
|
|
97
|
-
* - If `{}[]`, mark is shown at the value location and displays any provided custom labels and marks.
|
|
98
|
-
*/
|
|
99
|
-
marks?: boolean | (number | {
|
|
100
|
-
value: number;
|
|
101
|
-
label?: string | JSX.Element;
|
|
102
|
-
mark?: JSX.Element;
|
|
103
|
-
})[];
|
|
104
73
|
/**
|
|
105
74
|
* The starting origin point for the Slider.
|
|
106
75
|
* @default min
|
|
@@ -114,13 +83,15 @@ export declare type SliderCommons = {
|
|
|
114
83
|
/**
|
|
115
84
|
* Triggers a callback when the value has been changed. This will be called on every individual step.
|
|
116
85
|
*/
|
|
117
|
-
onChange?: (ev: React.
|
|
118
|
-
value: number;
|
|
119
|
-
}) => void;
|
|
86
|
+
onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void;
|
|
120
87
|
/**
|
|
121
88
|
* The Slider's current value label to be read by the screen reader.
|
|
122
89
|
*/
|
|
123
|
-
|
|
90
|
+
getAriaValueText?: (value: number) => string;
|
|
91
|
+
};
|
|
92
|
+
export declare type SliderOnChangeData = {
|
|
93
|
+
value: number;
|
|
124
94
|
};
|
|
125
|
-
export declare type SliderProps = Omit<ComponentProps<SliderSlots>, 'onChange' | '
|
|
95
|
+
export declare type SliderProps = Omit<ComponentProps<Partial<SliderSlots>, 'input'>, 'defaultValue' | 'onChange' | 'size' | 'value'> & SliderCommons;
|
|
126
96
|
export declare type SliderState = ComponentState<SliderSlots> & SliderCommons;
|
|
97
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.types.js","sourceRoot":"../src/","sources":["components/Slider/Slider.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ComponentState, ComponentProps,
|
|
1
|
+
{"version":3,"file":"Slider.types.js","sourceRoot":"../src/","sources":["components/Slider/Slider.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentState, ComponentProps, Slot } from '@fluentui/react-utilities';\n\nexport type SliderSlots = {\n /**\n * The root of the Slider.\n * The root slot receives the `className` and `style` specified directly on the `<Slider>`.\n * All other native props will be applied to the primary slot, `input`.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The Slider's base. It is used to visibly display the min and max selectable values.\n */\n rail: NonNullable<Slot<'div'>>;\n\n /**\n * The draggable icon used to select a given value from the Slider.\n * This is the element containing `role = 'slider'`.\n */\n thumb: NonNullable<Slot<'div'>>;\n\n /**\n * The hidden input for the Slider.\n * This is the PRIMARY slot: all native properties specified directly on `<Slider>` will be applied to this slot,\n * except `className` and `style`, which remain on the root slot.\n *\n */\n input: NonNullable<Slot<'input'>> & {\n /**\n * Orient is a non standard attribute that allows for vertical orientation in Firefox. It is set internally\n * when `vertical` is set to true.\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#non_standard_attributes\n * Webkit/Chromium support for vertical inputs is provided via -webkit-appearance css property\n */\n orient?: 'horizontal' | 'vertical';\n };\n};\n\ntype SliderCommons = {\n /**\n * The starting value for an uncontrolled Slider.\n * Mutually exclusive with `value` prop.\n */\n defaultValue?: number;\n\n /**\n * The current value of the controlled Slider.\n * Mutually exclusive with `defaultValue` prop.\n */\n value?: number;\n\n /**\n * The min value of the Slider.\n * @default 0\n */\n min?: number;\n\n /**\n * The max value of the Slider.\n * @default 100\n */\n max?: number;\n\n /**\n * The number of steps that the Slider's `value` will increment upon change. When provided, the Slider\n * will snap to the closest available value. This must be a positive value.\n * @default 1\n */\n step?: number;\n\n /**\n * Whether to render the Slider as disabled.\n *\n * @default `false` (renders enabled)\n */\n disabled?: boolean;\n\n /**\n * Whether to render the Slider vertically.\n * @default `false` (renders horizontally)\n */\n vertical?: boolean;\n\n /**\n * The starting origin point for the Slider.\n * @default min\n */\n origin?: number;\n\n /**\n * The size of the Slider.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n\n /**\n * Triggers a callback when the value has been changed. This will be called on every individual step.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void;\n\n /**\n * The Slider's current value label to be read by the screen reader.\n */\n getAriaValueText?: (value: number) => string;\n};\n\nexport type SliderOnChangeData = {\n value: number;\n};\n\nexport type SliderProps = Omit<\n ComponentProps<Partial<SliderSlots>, 'input'>,\n 'defaultValue' | 'onChange' | 'size' | 'value'\n> &\n SliderCommons;\n\nexport type SliderState = ComponentState<SliderSlots> & SliderCommons;\n"]}
|
|
@@ -2,5 +2,5 @@ export * from './Slider';
|
|
|
2
2
|
export * from './Slider.types';
|
|
3
3
|
export * from './renderSlider';
|
|
4
4
|
export * from './useSlider';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export { useSliderState_unstable } from './useSliderState';
|
|
6
|
+
export { sliderClassName, useSliderStyles_unstable } from './useSliderStyles';
|
|
@@ -2,6 +2,6 @@ export * from './Slider';
|
|
|
2
2
|
export * from './Slider.types';
|
|
3
3
|
export * from './renderSlider';
|
|
4
4
|
export * from './useSlider';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export { useSliderState_unstable } from './useSliderState';
|
|
6
|
+
export { sliderClassName, useSliderStyles_unstable } from './useSliderStyles';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Slider/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Slider/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export * from './Slider';\nexport * from './Slider.types';\nexport * from './renderSlider';\nexport * from './useSlider';\nexport { useSliderState_unstable } from './useSliderState';\nexport { sliderClassName, useSliderStyles_unstable } from './useSliderStyles';\n"]}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
|
4
|
-
import { sliderShorthandProps } from './useSlider';
|
|
5
3
|
/**
|
|
6
4
|
* Render the final JSX of Slider
|
|
7
5
|
*/
|
|
8
6
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
|
7
|
+
export const renderSlider_unstable = state => {
|
|
8
|
+
const {
|
|
9
|
+
slots,
|
|
10
|
+
slotProps
|
|
11
|
+
} = getSlots(state);
|
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
13
|
+
}, /*#__PURE__*/React.createElement(slots.input, { ...slotProps.input
|
|
14
|
+
}), /*#__PURE__*/React.createElement(slots.rail, { ...slotProps.rail
|
|
15
|
+
}), /*#__PURE__*/React.createElement(slots.thumb, { ...slotProps.thumb
|
|
16
|
+
}));
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=renderSlider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Slider/renderSlider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["components/Slider/renderSlider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAAuB;AAC1D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAc,KAAd,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CADF,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAFF,eAGE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CAHF,CADF;AAOD,CAVM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SliderState, SliderSlots } from './Slider.types';\n\n/**\n * Render the final JSX of Slider\n */\nexport const renderSlider_unstable = (state: SliderState) => {\n const { slots, slotProps } = getSlots<SliderSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n <slots.rail {...slotProps.rail} />\n <slots.thumb {...slotProps.thumb} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SliderProps,
|
|
3
|
-
/**
|
|
4
|
-
* Array of all shorthand properties listed in sliderShorthandProps
|
|
5
|
-
*/
|
|
6
|
-
export declare const sliderShorthandProps: (keyof SliderSlots)[];
|
|
2
|
+
import { SliderProps, SliderState } from './Slider.types';
|
|
7
3
|
/**
|
|
8
4
|
* Given user props, returns state and render function for a Slider.
|
|
9
5
|
*/
|
|
10
|
-
export declare const
|
|
6
|
+
export declare const useSlider_unstable: (props: SliderProps, ref: React.Ref<HTMLInputElement>) => SliderState;
|
|
@@ -1,103 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useSliderState } from './useSliderState';
|
|
4
|
-
/**
|
|
5
|
-
* Array of all shorthand properties listed in sliderShorthandProps
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export var sliderShorthandProps = ['root', 'activeRail', 'input', 'rail', 'sliderWrapper', 'thumb', 'thumbWrapper', 'track', 'trackWrapper', 'marksWrapper'];
|
|
1
|
+
import { getPartitionedNativeProps, resolveShorthand, useId } from '@fluentui/react-utilities';
|
|
2
|
+
import { useSliderState_unstable } from './useSliderState';
|
|
9
3
|
/**
|
|
10
4
|
* Given user props, returns state and render function for a Slider.
|
|
11
5
|
*/
|
|
12
6
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
defaultValue
|
|
41
|
-
|
|
42
|
-
max
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
origin: origin,
|
|
51
|
-
size: size,
|
|
52
|
-
root: getNativeElementProps('span', __assign(__assign({
|
|
53
|
-
ref: ref
|
|
54
|
-
}, props), {
|
|
55
|
-
id: useId('slider-', props.id)
|
|
56
|
-
})),
|
|
7
|
+
export const useSlider_unstable = (props, ref) => {
|
|
8
|
+
const nativeProps = getPartitionedNativeProps({
|
|
9
|
+
props,
|
|
10
|
+
primarySlotTagName: 'input',
|
|
11
|
+
excludedPropNames: ['onChange', 'size']
|
|
12
|
+
});
|
|
13
|
+
const {
|
|
14
|
+
// Props
|
|
15
|
+
value,
|
|
16
|
+
defaultValue,
|
|
17
|
+
min = 0,
|
|
18
|
+
max = 100,
|
|
19
|
+
step,
|
|
20
|
+
disabled,
|
|
21
|
+
getAriaValueText,
|
|
22
|
+
vertical,
|
|
23
|
+
size = 'medium',
|
|
24
|
+
origin,
|
|
25
|
+
onChange,
|
|
26
|
+
// Slots
|
|
27
|
+
root,
|
|
28
|
+
input,
|
|
29
|
+
rail,
|
|
30
|
+
thumb
|
|
31
|
+
} = props;
|
|
32
|
+
const state = {
|
|
33
|
+
getAriaValueText,
|
|
34
|
+
defaultValue,
|
|
35
|
+
disabled,
|
|
36
|
+
max,
|
|
37
|
+
min,
|
|
38
|
+
origin,
|
|
39
|
+
size,
|
|
40
|
+
step,
|
|
41
|
+
vertical,
|
|
42
|
+
value,
|
|
43
|
+
onChange,
|
|
57
44
|
components: {
|
|
58
|
-
|
|
45
|
+
input: 'input',
|
|
59
46
|
rail: 'div',
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
track: 'div',
|
|
63
|
-
marksWrapper: 'div',
|
|
64
|
-
thumbWrapper: 'div',
|
|
65
|
-
thumb: 'div',
|
|
66
|
-
activeRail: 'div',
|
|
67
|
-
input: 'input'
|
|
47
|
+
root: 'div',
|
|
48
|
+
thumb: 'div'
|
|
68
49
|
},
|
|
69
|
-
|
|
70
|
-
required: true
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
required: true
|
|
74
|
-
}),
|
|
75
|
-
trackWrapper: resolveShorthand(trackWrapper, {
|
|
76
|
-
required: true
|
|
77
|
-
}),
|
|
78
|
-
track: resolveShorthand(track, {
|
|
79
|
-
required: true
|
|
50
|
+
root: resolveShorthand(root, {
|
|
51
|
+
required: true,
|
|
52
|
+
defaultProps: { ...nativeProps.root
|
|
53
|
+
}
|
|
80
54
|
}),
|
|
81
|
-
|
|
82
|
-
required: true
|
|
55
|
+
input: resolveShorthand(input, {
|
|
56
|
+
required: true,
|
|
57
|
+
defaultProps: {
|
|
58
|
+
id: useId('slider-', props.id),
|
|
59
|
+
ref,
|
|
60
|
+
...nativeProps.primary,
|
|
61
|
+
type: 'range',
|
|
62
|
+
orient: vertical ? 'vertical' : undefined
|
|
63
|
+
}
|
|
83
64
|
}),
|
|
84
|
-
|
|
65
|
+
rail: resolveShorthand(rail, {
|
|
85
66
|
required: true
|
|
86
67
|
}),
|
|
87
68
|
thumb: resolveShorthand(thumb, {
|
|
88
69
|
required: true
|
|
89
|
-
}),
|
|
90
|
-
activeRail: resolveShorthand(activeRail, {
|
|
91
|
-
required: true
|
|
92
|
-
}),
|
|
93
|
-
input: resolveShorthand(input, {
|
|
94
|
-
required: true,
|
|
95
|
-
defaultProps: {
|
|
96
|
-
type: 'range'
|
|
97
|
-
}
|
|
98
70
|
})
|
|
99
71
|
};
|
|
100
|
-
|
|
72
|
+
useSliderState_unstable(state);
|
|
101
73
|
return state;
|
|
102
74
|
};
|
|
103
75
|
//# sourceMappingURL=useSlider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Slider/useSlider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["components/Slider/useSlider.ts"],"names":[],"mappings":"AACA,SAAS,yBAAT,EAAoC,gBAApC,EAAsD,KAAtD,QAAmE,2BAAnE;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AAGA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAAC,KAAD,EAAqB,GAArB,KAAsE;AACtG,QAAM,WAAW,GAAG,yBAAyB,CAAC;AAC5C,IAAA,KAD4C;AAE5C,IAAA,kBAAkB,EAAE,OAFwB;AAG5C,IAAA,iBAAiB,EAAE,CAAC,UAAD,EAAa,MAAb;AAHyB,GAAD,CAA7C;AAMA,QAAM;AACJ;AACA,IAAA,KAFI;AAGJ,IAAA,YAHI;AAIJ,IAAA,GAAG,GAAG,CAJF;AAKJ,IAAA,GAAG,GAAG,GALF;AAMJ,IAAA,IANI;AAOJ,IAAA,QAPI;AAQJ,IAAA,gBARI;AASJ,IAAA,QATI;AAUJ,IAAA,IAAI,GAAG,QAVH;AAWJ,IAAA,MAXI;AAYJ,IAAA,QAZI;AAaJ;AACA,IAAA,IAdI;AAeJ,IAAA,KAfI;AAgBJ,IAAA,IAhBI;AAiBJ,IAAA;AAjBI,MAkBF,KAlBJ;AAoBA,QAAM,KAAK,GAAgB;AACzB,IAAA,gBADyB;AAEzB,IAAA,YAFyB;AAGzB,IAAA,QAHyB;AAIzB,IAAA,GAJyB;AAKzB,IAAA,GALyB;AAMzB,IAAA,MANyB;AAOzB,IAAA,IAPyB;AAQzB,IAAA,IARyB;AASzB,IAAA,QATyB;AAUzB,IAAA,KAVyB;AAWzB,IAAA,QAXyB;AAYzB,IAAA,UAAU,EAAE;AACV,MAAA,KAAK,EAAE,OADG;AAEV,MAAA,IAAI,EAAE,KAFI;AAGV,MAAA,IAAI,EAAE,KAHI;AAIV,MAAA,KAAK,EAAE;AAJG,KAZa;AAkBzB,IAAA,IAAI,EAAE,gBAAgB,CAAC,IAAD,EAAO;AAC3B,MAAA,QAAQ,EAAE,IADiB;AAE3B,MAAA,YAAY,EAAE,EACZ,GAAG,WAAW,CAAC;AADH;AAFa,KAAP,CAlBG;AAwBzB,IAAA,KAAK,EAAE,gBAAgB,CAAC,KAAD,EAAQ;AAC7B,MAAA,QAAQ,EAAE,IADmB;AAE7B,MAAA,YAAY,EAAE;AACZ,QAAA,EAAE,EAAE,KAAK,CAAC,SAAD,EAAY,KAAK,CAAC,EAAlB,CADG;AAEZ,QAAA,GAFY;AAGZ,WAAG,WAAW,CAAC,OAHH;AAIZ,QAAA,IAAI,EAAE,OAJM;AAKZ,QAAA,MAAM,EAAE,QAAQ,GAAG,UAAH,GAAgB;AALpB;AAFe,KAAR,CAxBE;AAkCzB,IAAA,IAAI,EAAE,gBAAgB,CAAC,IAAD,EAAO;AAAE,MAAA,QAAQ,EAAE;AAAZ,KAAP,CAlCG;AAmCzB,IAAA,KAAK,EAAE,gBAAgB,CAAC,KAAD,EAAQ;AAAE,MAAA,QAAQ,EAAE;AAAZ,KAAR;AAnCE,GAA3B;AAsCA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AAEA,SAAO,KAAP;AACD,CApEM","sourcesContent":["import * as React from 'react';\nimport { getPartitionedNativeProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { useSliderState_unstable } from './useSliderState';\nimport { SliderProps, SliderState } from './Slider.types';\n\n/**\n * Given user props, returns state and render function for a Slider.\n */\nexport const useSlider_unstable = (props: SliderProps, ref: React.Ref<HTMLInputElement>): SliderState => {\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange', 'size'],\n });\n\n const {\n // Props\n value,\n defaultValue,\n min = 0,\n max = 100,\n step,\n disabled,\n getAriaValueText,\n vertical,\n size = 'medium',\n origin,\n onChange,\n // Slots\n root,\n input,\n rail,\n thumb,\n } = props;\n\n const state: SliderState = {\n getAriaValueText,\n defaultValue,\n disabled,\n max,\n min,\n origin,\n size,\n step,\n vertical,\n value,\n onChange,\n components: {\n input: 'input',\n rail: 'div',\n root: 'div',\n thumb: 'div',\n },\n root: resolveShorthand(root, {\n required: true,\n defaultProps: {\n ...nativeProps.root,\n },\n }),\n input: resolveShorthand(input, {\n required: true,\n defaultProps: {\n id: useId('slider-', props.id),\n ref,\n ...nativeProps.primary,\n type: 'range',\n orient: vertical ? 'vertical' : undefined,\n },\n }),\n rail: resolveShorthand(rail, { required: true }),\n thumb: resolveShorthand(thumb, { required: true }),\n };\n\n useSliderState_unstable(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SliderState } from './Slider.types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useSliderState_unstable: (state: SliderState) => SliderState;
|