@fluentui/react-slider 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.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.md +46 -11
- package/README.md +6 -0
- package/lib/components/Slider/Slider.constants.js.map +1 -1
- package/lib/components/Slider/Slider.js.map +1 -1
- package/lib/components/Slider/Slider.module.css +315 -0
- package/lib/components/Slider/Slider.types.js.map +1 -1
- package/lib/components/Slider/index.js.map +1 -1
- package/lib/components/Slider/renderSlider.js +2 -2
- package/lib/components/Slider/renderSlider.js.map +1 -1
- package/lib/components/Slider/useSlider.js +4 -0
- package/lib/components/Slider/useSlider.js.map +1 -1
- package/lib/components/Slider/useSliderState.js +2 -5
- package/lib/components/Slider/useSliderState.js.map +1 -1
- package/lib/components/Slider/useSliderStyles.styles.css.js +16 -0
- package/lib/components/Slider/useSliderStyles.styles.css.js.map +1 -0
- package/lib/components/Slider/useSliderStyles.styles.raw.css.js +16 -0
- package/lib/components/Slider/useSliderStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Slider/useSliderStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/Slider.cjs +9 -9
- package/lib-commonjs/Slider.cjs.map +1 -1
- package/lib-commonjs/components/Slider/Slider.cjs.map +1 -1
- package/lib-commonjs/components/Slider/Slider.constants.cjs.map +1 -1
- package/lib-commonjs/components/Slider/Slider.module.css +315 -0
- package/lib-commonjs/components/Slider/Slider.types.cjs.map +1 -1
- package/lib-commonjs/components/Slider/index.cjs +9 -9
- package/lib-commonjs/components/Slider/index.cjs.map +1 -1
- package/lib-commonjs/components/Slider/renderSlider.cjs.map +1 -1
- package/lib-commonjs/components/Slider/useSlider.cjs +7 -3
- package/lib-commonjs/components/Slider/useSlider.cjs.map +1 -1
- package/lib-commonjs/components/Slider/useSliderState.cjs +1 -4
- package/lib-commonjs/components/Slider/useSliderState.cjs.map +1 -1
- package/lib-commonjs/components/Slider/useSliderStyles.styles.cjs +3 -3
- package/lib-commonjs/components/Slider/useSliderStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Slider/useSliderStyles.styles.css.cjs +35 -0
- package/lib-commonjs/components/Slider/useSliderStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Slider/useSliderStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/Slider/useSliderStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Slider/useSliderStyles.styles.raw.css.cjs +35 -0
- package/lib-commonjs/components/Slider/useSliderStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/index.cjs +9 -9
- package/lib-commonjs/index.cjs.map +1 -1
- package/package.json +14 -14
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,58 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-slider
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Sat, 31 Oct 2026 11:08:55 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.
|
|
7
|
+
## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-slider_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-slider_v9.6.
|
|
9
|
+
Sat, 31 Oct 2026 11:08:55 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-slider_v9.6.8..@fluentui/react-slider_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
|
-
- Release 9.
|
|
15
|
-
- Bump @fluentui/react-field to v9.
|
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v9.
|
|
17
|
-
- Bump @fluentui/react-shared-contexts to v9.
|
|
18
|
-
- Bump @fluentui/react-tabster to v9.
|
|
19
|
-
- Bump @fluentui/react-theme to v9.
|
|
20
|
-
- Bump @fluentui/react-utilities to v9.
|
|
14
|
+
- Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
|
|
15
|
+
- Bump @fluentui/react-field to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-tabster to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-theme to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
- Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
|
+
|
|
22
|
+
## [9.6.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-slider_v9.6.8)
|
|
23
|
+
|
|
24
|
+
Thu, 22 Oct 2026 11:25:58 GMT
|
|
25
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-slider_v9.6.7..@fluentui/react-slider_v9.6.8)
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- fix: use getPercentInRange from react-utilities ([PR #36890](https://github.com/microsoft/fluentui/pull/36890) by vgenaev@gmail.com)
|
|
30
|
+
|
|
31
|
+
## [9.6.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-slider_v9.6.7)
|
|
32
|
+
|
|
33
|
+
Mon, 19 Oct 2026 16:49:00 GMT
|
|
34
|
+
|
|
35
|
+
### Patches
|
|
36
|
+
|
|
37
|
+
- fix: default Slider aria-orientation from vertical while preserving explicit input attributes ([PR #36895](https://github.com/microsoft/fluentui/pull/36895) by paoloalipro@gmail.com)
|
|
38
|
+
- Bump @fluentui/react-field to v9.5.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
39
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
40
|
+
- Bump @fluentui/react-tabster to v9.26.19 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
41
|
+
- Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
42
|
+
|
|
43
|
+
## [9.6.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-slider_v9.6.6)
|
|
44
|
+
|
|
45
|
+
Tue, 22 Sep 2026 11:25:39 GMT
|
|
46
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-slider_v9.6.5..@fluentui/react-slider_v9.6.6)
|
|
47
|
+
|
|
48
|
+
### Patches
|
|
49
|
+
|
|
50
|
+
- fix: remove unused react-dom and @types/react-dom peer dependencies, mark @types/react as optional ([PR #36559](https://github.com/microsoft/fluentui/pull/36559) by martinhochel@microsoft.com)
|
|
51
|
+
- Bump @fluentui/react-field to v9.5.5 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
52
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
53
|
+
- Bump @fluentui/react-shared-contexts to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
54
|
+
- Bump @fluentui/react-tabster to v9.26.18 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
55
|
+
- Bump @fluentui/react-utilities to v9.26.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
56
|
|
|
22
57
|
## [9.6.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-slider_v9.6.5)
|
|
23
58
|
|
package/README.md
CHANGED
|
@@ -39,3 +39,9 @@ See [SPEC.md](./Spec.md).
|
|
|
39
39
|
### Migration Guide
|
|
40
40
|
|
|
41
41
|
If you're upgrading to Fluent UI v9 see [MIGRATION.md](./MIGRATION.md) for guidance on updating to the latest Slider implementation.
|
|
42
|
+
|
|
43
|
+
## Opt-in CSS Modules styles
|
|
44
|
+
|
|
45
|
+
CSS Modules alternatives are available for `Slider`. The default exports and component imports continue to use Griffel.
|
|
46
|
+
|
|
47
|
+
To opt in, configure your bundler to replace each `use<Component>Styles.styles.js` module with its adjacent `use<Component>Styles.styles.css.js` alternative (or `.styles.ts` with `.styles.css.ts` for source builds). Apply the replacement consistently to client and server bundles. The CSS loader must provide a default class-name map and retain the adjacent `.module.css` asset, including CSS from dependencies. All component rules are in `@layer fluentui` and use the theme custom properties supplied by `FluentProvider`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/Slider.constants.ts"],"sourcesContent":["export const sliderCSSVars = {\n sliderDirectionVar: `--fui-Slider--direction`,\n sliderInnerThumbRadiusVar: `--fui-Slider__inner-thumb--radius`,\n sliderProgressVar: `--fui-Slider--progress`,\n sliderProgressColorVar: `--fui-Slider__progress--color`,\n sliderRailSizeVar: `--fui-Slider__rail--size`,\n sliderRailColorVar: `--fui-Slider__rail--color`,\n sliderStepsPercentVar: `--fui-Slider--steps-percent`,\n sliderThumbColorVar: `--fui-Slider__thumb--color`,\n sliderThumbSizeVar: `--fui-Slider__thumb--size`,\n};\n"],"names":["sliderCSSVars","sliderDirectionVar","sliderInnerThumbRadiusVar","sliderProgressVar","sliderProgressColorVar","sliderRailSizeVar","sliderRailColorVar","sliderStepsPercentVar","sliderThumbColorVar","sliderThumbSizeVar"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB;IAC3BC,oBAAoB,CAAC,uBAAuB,CAAC;IAC7CC,2BAA2B,CAAC,iCAAiC,CAAC;IAC9DC,mBAAmB,CAAC,sBAAsB,CAAC;IAC3CC,wBAAwB,CAAC,6BAA6B,CAAC;IACvDC,mBAAmB,CAAC,wBAAwB,CAAC;IAC7CC,oBAAoB,CAAC,yBAAyB,CAAC;IAC/CC,uBAAuB,CAAC,2BAA2B,CAAC;IACpDC,qBAAqB,CAAC,0BAA0B,CAAC;IACjDC,oBAAoB,CAAC,yBAAyB,CAAC;AACjD,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/Slider.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useSlider_unstable } from './useSlider';\nimport { renderSlider_unstable } from './renderSlider';\nimport { useSliderStyles_unstable } from './useSliderStyles.styles';\nimport type { SliderProps } from './Slider.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * The Slider component allows users to quickly select a value by dragging a thumb across a rail.\n */\nexport const Slider: ForwardRefComponent<SliderProps> = React.forwardRef((props, ref) => {\n const state = useSlider_unstable(props, ref);\n\n useSliderStyles_unstable(state);\n\n useCustomStyleHook_unstable('useSliderStyles_unstable')(state);\n\n return renderSlider_unstable(state);\n});\nSlider.displayName = 'Slider';\n"],"names":["React","useSlider_unstable","renderSlider_unstable","useSliderStyles_unstable","useCustomStyleHook_unstable","Slider","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ,iBAAc;AACjD,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,wBAAwB,QAAQ,8BAA2B;AAGpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQR,mBAAmBM,OAAOC;IAExCL,yBAAyBM;IAEzBL,4BAA4B,4BAA4BK;IAExD,OAAOP,sBAAsBO;AAC/B,GAAG;AACHJ,OAAOK,WAAW,GAAG"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-grid;
|
|
5
|
+
touch-action: none;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-items: center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.horizontal:focus {
|
|
11
|
+
outline-style: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.horizontal:focus-visible {
|
|
15
|
+
outline-style: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.horizontal[data-fui-focus-within]:focus-within::after {
|
|
19
|
+
content: '';
|
|
20
|
+
position: absolute;
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
border: var(--strokeWidthThick) solid var(--colorStrokeFocus2);
|
|
24
|
+
border-radius: var(--borderRadiusMedium);
|
|
25
|
+
top: calc(0px - var(--strokeWidthThick) - calc(var(--strokeWidthThick) * -1));
|
|
26
|
+
inset-inline-end: calc(0px - var(--strokeWidthThick) - calc(var(--spacingHorizontalXS) * -1));
|
|
27
|
+
bottom: calc(0px - var(--strokeWidthThick) - calc(var(--strokeWidthThick) * -1));
|
|
28
|
+
inset-inline-start: calc(0px - var(--strokeWidthThick) - calc(var(--spacingHorizontalXS) * -1));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.horizontal[data-fui-focus-within]:focus-within {
|
|
32
|
+
border-top-color: transparent;
|
|
33
|
+
border-inline-end-color: transparent;
|
|
34
|
+
border-bottom-color: transparent;
|
|
35
|
+
border-inline-start-color: transparent;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.vertical:focus {
|
|
39
|
+
outline-style: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.vertical:focus-visible {
|
|
43
|
+
outline-style: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.vertical[data-fui-focus-within]:focus-within::after {
|
|
47
|
+
content: '';
|
|
48
|
+
position: absolute;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
z-index: 1;
|
|
51
|
+
border: var(--strokeWidthThick) solid var(--colorStrokeFocus2);
|
|
52
|
+
border-radius: var(--borderRadiusMedium);
|
|
53
|
+
top: calc(0px - var(--strokeWidthThick) - calc(var(--strokeWidthThick) * -1));
|
|
54
|
+
inset-inline-end: calc(0px - var(--strokeWidthThick) - var(--spacingHorizontalXS));
|
|
55
|
+
bottom: calc(0px - var(--strokeWidthThick) - calc(var(--strokeWidthThick) * -1));
|
|
56
|
+
inset-inline-start: calc(0px - var(--strokeWidthThick) - var(--spacingHorizontalXS));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.vertical[data-fui-focus-within]:focus-within {
|
|
60
|
+
border-top-color: transparent;
|
|
61
|
+
border-inline-end-color: transparent;
|
|
62
|
+
border-bottom-color: transparent;
|
|
63
|
+
border-inline-start-color: transparent;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.small {
|
|
67
|
+
--fui-Slider__thumb--size: var(--spacingHorizontalL);
|
|
68
|
+
--fui-Slider__inner-thumb--radius: calc(var(--spacingHorizontalXS) * 1.25);
|
|
69
|
+
--fui-Slider__rail--size: var(--strokeWidthThick);
|
|
70
|
+
min-height: var(--spacingHorizontalXXL);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.medium {
|
|
74
|
+
--fui-Slider__thumb--size: var(--spacingHorizontalXL);
|
|
75
|
+
--fui-Slider__inner-thumb--radius: var(--spacingHorizontalSNudge);
|
|
76
|
+
--fui-Slider__rail--size: var(--spacingHorizontalXS);
|
|
77
|
+
min-height: var(--spacingHorizontalXXXL);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.horizontal {
|
|
81
|
+
min-width: calc(var(--spacingHorizontalXS) * 30);
|
|
82
|
+
grid-template-rows: 1fr var(--fui-Slider__thumb--size) 1fr;
|
|
83
|
+
grid-template-columns: 1fr calc(100% - var(--fui-Slider__thumb--size)) 1fr;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.vertical {
|
|
87
|
+
min-height: calc(var(--spacingHorizontalXS) * 30);
|
|
88
|
+
grid-template-rows: 1fr calc(100% - var(--fui-Slider__thumb--size)) 1fr;
|
|
89
|
+
grid-template-columns: 1fr var(--fui-Slider__thumb--size) 1fr;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.enabled:hover {
|
|
93
|
+
--fui-Slider__thumb--color: var(--colorCompoundBrandBackgroundHover);
|
|
94
|
+
--fui-Slider__progress--color: var(--colorCompoundBrandBackgroundHover);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.enabled:active {
|
|
98
|
+
--fui-Slider__thumb--color: var(--colorCompoundBrandBackgroundPressed);
|
|
99
|
+
--fui-Slider__progress--color: var(--colorCompoundBrandBackgroundPressed);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.enabled {
|
|
103
|
+
--fui-Slider__rail--color: var(--colorNeutralStrokeAccessible);
|
|
104
|
+
--fui-Slider__progress--color: var(--colorCompoundBrandBackground);
|
|
105
|
+
--fui-Slider__thumb--color: var(--colorCompoundBrandBackground);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.disabled {
|
|
109
|
+
--fui-Slider__thumb--color: var(--colorNeutralForegroundDisabled);
|
|
110
|
+
--fui-Slider__rail--color: var(--colorNeutralBackgroundDisabled);
|
|
111
|
+
--fui-Slider__progress--color: var(--colorNeutralForegroundDisabled);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.rail::before {
|
|
115
|
+
content: '';
|
|
116
|
+
position: absolute;
|
|
117
|
+
background-image: repeating-linear-gradient(
|
|
118
|
+
var(--fui-Slider--direction),
|
|
119
|
+
transparent 0%,
|
|
120
|
+
transparent calc(var(--fui-Slider--steps-percent) - var(--strokeWidthThin)),
|
|
121
|
+
var(--colorNeutralBackground1) calc(var(--fui-Slider--steps-percent) - var(--strokeWidthThin)),
|
|
122
|
+
var(--colorNeutralBackground1) var(--fui-Slider--steps-percent)
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.rail {
|
|
127
|
+
border-radius: var(--borderRadiusXLarge);
|
|
128
|
+
pointer-events: none;
|
|
129
|
+
grid-row-start: 2;
|
|
130
|
+
grid-row-end: 2;
|
|
131
|
+
grid-column-start: 2;
|
|
132
|
+
grid-column-end: 2;
|
|
133
|
+
position: relative;
|
|
134
|
+
forced-color-adjust: none;
|
|
135
|
+
background-image: linear-gradient(
|
|
136
|
+
var(--fui-Slider--direction),
|
|
137
|
+
var(--fui-Slider__progress--color) 0%,
|
|
138
|
+
var(--fui-Slider__progress--color) var(--fui-Slider--progress),
|
|
139
|
+
var(--fui-Slider__rail--color) var(--fui-Slider--progress)
|
|
140
|
+
);
|
|
141
|
+
outline-width: var(--strokeWidthThin);
|
|
142
|
+
outline-style: solid;
|
|
143
|
+
outline-color: var(--colorTransparentStroke);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:where(.horizontal) > .rail::before {
|
|
147
|
+
inset-inline-start: calc(var(--strokeWidthThin) * -1);
|
|
148
|
+
inset-inline-end: calc(var(--strokeWidthThin) * -1);
|
|
149
|
+
height: var(--fui-Slider__rail--size);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:where(.horizontal) > .rail {
|
|
153
|
+
width: 100%;
|
|
154
|
+
height: var(--fui-Slider__rail--size);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:where(.vertical) > .rail::before {
|
|
158
|
+
width: var(--fui-Slider__rail--size);
|
|
159
|
+
top: calc(var(--strokeWidthThin) * -1);
|
|
160
|
+
bottom: calc(var(--strokeWidthThin) * -1);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:where(.vertical) > .rail {
|
|
164
|
+
width: var(--fui-Slider__rail--size);
|
|
165
|
+
height: 100%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.thumb::before {
|
|
169
|
+
position: absolute;
|
|
170
|
+
top: 0px;
|
|
171
|
+
inset-inline-start: 0px;
|
|
172
|
+
bottom: 0px;
|
|
173
|
+
inset-inline-end: 0px;
|
|
174
|
+
border-radius: var(--borderRadiusCircular);
|
|
175
|
+
box-sizing: border-box;
|
|
176
|
+
content: '';
|
|
177
|
+
border: calc(var(--fui-Slider__thumb--size) * 0.05) solid var(--colorNeutralStroke1);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.thumb {
|
|
181
|
+
--fui-Slider__thumb--position: clamp(
|
|
182
|
+
var(--fui-Slider__inner-thumb--radius),
|
|
183
|
+
var(--fui-Slider--progress),
|
|
184
|
+
calc(100% - var(--fui-Slider__inner-thumb--radius))
|
|
185
|
+
);
|
|
186
|
+
grid-row-start: 2;
|
|
187
|
+
grid-row-end: 2;
|
|
188
|
+
grid-column-start: 2;
|
|
189
|
+
grid-column-end: 2;
|
|
190
|
+
position: absolute;
|
|
191
|
+
width: var(--fui-Slider__thumb--size);
|
|
192
|
+
height: var(--fui-Slider__thumb--size);
|
|
193
|
+
pointer-events: none;
|
|
194
|
+
outline-style: none;
|
|
195
|
+
forced-color-adjust: none;
|
|
196
|
+
border-radius: var(--borderRadiusCircular);
|
|
197
|
+
box-shadow: 0 0 0 calc(var(--fui-Slider__thumb--size) * 0.2) var(--colorNeutralBackground1) inset;
|
|
198
|
+
background-color: var(--fui-Slider__thumb--color);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
:where(.horizontal) > .thumb {
|
|
202
|
+
transform: translateX(-50%);
|
|
203
|
+
inset-inline-start: var(--fui-Slider__thumb--position);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
:where(.horizontal) > .thumb:where(:dir(rtl)) {
|
|
207
|
+
transform: translateX(50%);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
:where(.vertical) > .thumb {
|
|
211
|
+
transform: translateY(50%);
|
|
212
|
+
bottom: var(--fui-Slider__thumb--position);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:where(.disabled) > .thumb::before {
|
|
216
|
+
border: calc(var(--fui-Slider__thumb--size) * 0.05) solid var(--colorNeutralForegroundDisabled);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.input {
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
opacity: 0;
|
|
222
|
+
grid-row-start: 1;
|
|
223
|
+
grid-row-end: -1;
|
|
224
|
+
grid-column-start: 1;
|
|
225
|
+
grid-column-end: -1;
|
|
226
|
+
padding: 0;
|
|
227
|
+
margin: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:where(.horizontal) > .input {
|
|
231
|
+
height: var(--fui-Slider__thumb--size);
|
|
232
|
+
width: 100%;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
:where(.vertical) > .input {
|
|
236
|
+
height: 100%;
|
|
237
|
+
width: var(--fui-Slider__thumb--size);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
:where(.disabled) > .input {
|
|
241
|
+
cursor: default;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@media (forced-colors: active) {
|
|
245
|
+
.horizontal[data-fui-focus-within]:focus-within::after {
|
|
246
|
+
border-top-color: Highlight;
|
|
247
|
+
border-inline-end-color: Highlight;
|
|
248
|
+
border-bottom-color: Highlight;
|
|
249
|
+
border-inline-start-color: Highlight;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@media (forced-colors: active) {
|
|
254
|
+
.vertical[data-fui-focus-within]:focus-within::after {
|
|
255
|
+
border-top-color: Highlight;
|
|
256
|
+
border-inline-end-color: Highlight;
|
|
257
|
+
border-bottom-color: Highlight;
|
|
258
|
+
border-inline-start-color: Highlight;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
@media (forced-colors: active) {
|
|
263
|
+
.enabled:hover {
|
|
264
|
+
--fui-Slider__thumb--color: Highlight;
|
|
265
|
+
--fui-Slider__progress--color: Highlight;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@media (forced-colors: active) {
|
|
270
|
+
.enabled {
|
|
271
|
+
--fui-Slider__rail--color: CanvasText;
|
|
272
|
+
--fui-Slider__thumb--color: Highlight;
|
|
273
|
+
--fui-Slider__progress--color: Highlight;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
@media (forced-colors: active) {
|
|
278
|
+
.disabled {
|
|
279
|
+
--fui-Slider__rail--color: GrayText;
|
|
280
|
+
--fui-Slider__thumb--color: GrayText;
|
|
281
|
+
--fui-Slider__progress--color: GrayText;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
@media (forced-colors: active) {
|
|
286
|
+
.rail::before {
|
|
287
|
+
background-image: repeating-linear-gradient(
|
|
288
|
+
var(--fui-Slider--direction),
|
|
289
|
+
transparent 0%,
|
|
290
|
+
transparent calc(var(--fui-Slider--steps-percent) - var(--strokeWidthThin)),
|
|
291
|
+
HighlightText calc(var(--fui-Slider--steps-percent) - var(--strokeWidthThin)),
|
|
292
|
+
HighlightText var(--fui-Slider--steps-percent)
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@supports (writing-mode: sideways-lr) {
|
|
298
|
+
:where(.vertical) > .input {
|
|
299
|
+
writing-mode: vertical-lr;
|
|
300
|
+
direction: rtl;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@supports (writing-mode: sideways-lr) {
|
|
305
|
+
:where(.vertical) > .input:where(:dir(rtl)) {
|
|
306
|
+
direction: ltr;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@supports not (writing-mode: sideways-lr) {
|
|
311
|
+
:where(.vertical) > .input {
|
|
312
|
+
-webkit-appearance: slider-vertical;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/Slider.types.ts"],"sourcesContent":["import type * 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\nexport type SliderProps = Omit<\n ComponentProps<Partial<SliderSlots>, 'input'>,\n 'defaultValue' | 'onChange' | 'size' | 'value'\n> & {\n /**\n * The starting value for an uncontrolled Slider.\n * Mutually exclusive with `value` prop.\n */\n defaultValue?: number;\n\n /**\n * Whether to render the Slider as disabled.\n *\n * @default `false` (renders enabled)\n */\n disabled?: boolean;\n\n /**\n * The max value of the Slider.\n * @default 100\n */\n max?: number;\n\n /**\n * The min value of the Slider.\n * @default 0\n */\n min?: number;\n\n /**\n * The size of the Slider.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\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 * The current value of the controlled Slider.\n * Mutually exclusive with `defaultValue` prop.\n */\n value?: number;\n\n /**\n * Render the Slider in a vertical orientation, smallest value on the bottom.\n * @default `false`\n */\n vertical?: boolean;\n\n /**\n * Triggers a callback when the value has been changed. This will be called on every individual step.\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void;\n};\n\nexport type SliderOnChangeData = {\n value: number;\n};\n\n/**\n * Slider base props, excluding design-related props like size.\n * Note: vertical is kept as it affects aria-orientation behavior.\n */\nexport type SliderBaseProps = Omit<SliderProps, 'size'>;\n\nexport type SliderState = ComponentState<SliderSlots> & Pick<SliderProps, 'disabled' | 'size' | 'vertical'>;\n\n/**\n * Slider base state, excluding design-related state like size.\n */\nexport type SliderBaseState = Omit<SliderState, 'size'>;\n"],"names":[],"mappings":"AAgHA;;CAEC,GACD,WAAwD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/index.ts"],"sourcesContent":["export { Slider } from './Slider';\nexport { sliderCSSVars } from './Slider.constants';\nexport type {\n SliderBaseProps,\n SliderBaseState,\n SliderOnChangeData,\n SliderProps,\n SliderSlots,\n SliderState,\n} from './Slider.types';\nexport { renderSlider_unstable } from './renderSlider';\nexport { useSlider_unstable, useSliderBase_unstable } from './useSlider';\nexport { useSliderState_unstable } from './useSliderState';\nexport { sliderClassNames, useSliderStyles_unstable } from './useSliderStyles.styles';\n"],"names":["Slider","sliderCSSVars","renderSlider_unstable","useSlider_unstable","useSliderBase_unstable","useSliderState_unstable","sliderClassNames","useSliderStyles_unstable"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAW;AAClC,SAASC,aAAa,QAAQ,wBAAqB;AASnD,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,kBAAkB,EAAEC,sBAAsB,QAAQ,iBAAc;AACzE,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,8BAA2B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { assertSlots } from "@fluentui/react-utilities";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of Slider
|
|
5
5
|
*/ export const renderSlider_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/renderSlider.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { SliderBaseState, SliderSlots } from './Slider.types';\n\n/**\n * Render the final JSX of Slider\n */\nexport const renderSlider_unstable = (state: SliderBaseState): JSXElement => {\n assertSlots<SliderSlots>(state);\n\n return (\n <state.root>\n <state.input />\n <state.rail />\n <state.thumb />\n </state.root>\n );\n};\n"],"names":["assertSlots","renderSlider_unstable","state","root","input","rail","thumb"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpCF,YAAyBE;IAEzB,qBACE,MAACA,MAAMC,IAAI;;0BACT,KAACD,MAAME,KAAK;0BACZ,KAACF,MAAMG,IAAI;0BACX,KAACH,MAAMI,KAAK;;;AAGlB,EAAE"}
|
|
@@ -61,6 +61,10 @@ export const useSlider_unstable = (props, ref)=>{
|
|
|
61
61
|
elementType: 'div'
|
|
62
62
|
})
|
|
63
63
|
};
|
|
64
|
+
// Apply after slot resolution so an explicitly undefined slot attribute also receives the default.
|
|
65
|
+
if (state.input['aria-orientation'] === undefined) {
|
|
66
|
+
state.input['aria-orientation'] = state.vertical ? 'vertical' : 'horizontal';
|
|
67
|
+
}
|
|
64
68
|
state.root.ref = useMergedRefs(state.root.ref, useFocusWithin());
|
|
65
69
|
useSliderState_unstable(state, props);
|
|
66
70
|
return state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/useSlider.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { getPartitionedNativeProps, useId, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useSliderState_unstable } from './useSliderState';\nimport type { SliderBaseProps, SliderBaseState, SliderProps, SliderState } from './Slider.types';\nimport { useFocusWithin } from '@fluentui/react-tabster';\n\nexport const useSlider_unstable = (props: SliderProps, ref: React.Ref<HTMLInputElement>): SliderState => {\n const { size = 'medium', ...baseProps } = props;\n\n const baseState = useSliderBase_unstable(baseProps, ref);\n\n return {\n ...baseState,\n size,\n };\n};\n\n/**\n * Base hook for Slider component, which manages state related to slots structure, ARIA attributes,\n * keyboard handling, and controlled/uncontrolled value state.\n *\n * @param props - User provided props to the Slider component.\n * @param ref - User provided ref to be passed to the Slider input element.\n */\nexport const useSliderBase_unstable = (props: SliderBaseProps, ref: React.Ref<HTMLInputElement>): SliderBaseState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props, { supportsLabelFor: true });\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange'],\n });\n\n const {\n disabled,\n vertical,\n // Slots\n root,\n input,\n rail,\n thumb,\n } = props;\n\n const state: SliderBaseState = {\n disabled,\n vertical,\n components: {\n input: 'input',\n rail: 'div',\n root: 'div',\n thumb: 'div',\n },\n root: slot.always(root, {\n defaultProps: nativeProps.root,\n elementType: 'div',\n }),\n input: slot.always(input, {\n defaultProps: {\n id: useId('slider-', props.id),\n ref,\n ...nativeProps.primary,\n type: 'range',\n orient: vertical ? 'vertical' : undefined,\n },\n elementType: 'input',\n }),\n rail: slot.always(rail, { elementType: 'div' }),\n thumb: slot.always(thumb, { elementType: 'div' }),\n };\n\n // Apply after slot resolution so an explicitly undefined slot attribute also receives the default.\n if (state.input['aria-orientation'] === undefined) {\n state.input['aria-orientation'] = state.vertical ? 'vertical' : 'horizontal';\n }\n\n state.root.ref = useMergedRefs(state.root.ref, useFocusWithin<HTMLDivElement>());\n\n useSliderState_unstable(state, props);\n\n return state;\n};\n"],"names":["useFieldControlProps_unstable","getPartitionedNativeProps","useId","useMergedRefs","slot","useSliderState_unstable","useFocusWithin","useSlider_unstable","props","ref","size","baseProps","baseState","useSliderBase_unstable","supportsLabelFor","nativeProps","primarySlotTagName","excludedPropNames","disabled","vertical","root","input","rail","thumb","state","components","always","defaultProps","elementType","id","primary","type","orient","undefined"],"mappings":"AAAA;AAGA,SAASA,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,yBAAyB,EAAEC,KAAK,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AAClG,SAASC,uBAAuB,QAAQ,sBAAmB;AAE3D,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC;IACrD,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGC,WAAW,GAAGH;IAE1C,MAAMI,YAAYC,uBAAuBF,WAAWF;IAEpD,OAAO;QACL,GAAGG,SAAS;QACZF;IACF;AACF,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMG,yBAAyB,CAACL,OAAwBC;IAC7D,+CAA+C;IAC/CD,QAAQR,8BAA8BQ,OAAO;QAAEM,kBAAkB;IAAK;IAEtE,MAAMC,cAAcd,0BAA0B;QAC5CO;QACAQ,oBAAoB;QACpBC,mBAAmB;YAAC;SAAW;IACjC;IAEA,MAAM,EACJC,QAAQ,EACRC,QAAQ,EACR,QAAQ;IACRC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,KAAK,EACN,GAAGf;IAEJ,MAAMgB,QAAyB;QAC7BN;QACAC;QACAM,YAAY;YACVJ,OAAO;YACPC,MAAM;YACNF,MAAM;YACNG,OAAO;QACT;QACAH,MAAMhB,KAAKsB,MAAM,CAACN,MAAM;YACtBO,cAAcZ,YAAYK,IAAI;YAC9BQ,aAAa;QACf;QACAP,OAAOjB,KAAKsB,MAAM,CAACL,OAAO;YACxBM,cAAc;gBACZE,IAAI3B,MAAM,WAAWM,MAAMqB,EAAE;gBAC7BpB;gBACA,GAAGM,YAAYe,OAAO;gBACtBC,MAAM;gBACNC,QAAQb,WAAW,aAAac;YAClC;YACAL,aAAa;QACf;QACAN,MAAMlB,KAAKsB,MAAM,CAACJ,MAAM;YAAEM,aAAa;QAAM;QAC7CL,OAAOnB,KAAKsB,MAAM,CAACH,OAAO;YAAEK,aAAa;QAAM;IACjD;IAEA,mGAAmG;IACnG,IAAIJ,MAAMH,KAAK,CAAC,mBAAmB,KAAKY,WAAW;QACjDT,MAAMH,KAAK,CAAC,mBAAmB,GAAGG,MAAML,QAAQ,GAAG,aAAa;IAClE;IAEAK,MAAMJ,IAAI,CAACX,GAAG,GAAGN,cAAcqB,MAAMJ,IAAI,CAACX,GAAG,EAAEH;IAE/CD,wBAAwBmB,OAAOhB;IAE/B,OAAOgB;AACT,EAAE"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { clamp, useControllableState, useEventCallback } from "@fluentui/react-utilities";
|
|
2
|
+
import { clamp, getPercentInRange, useControllableState, useEventCallback } from "@fluentui/react-utilities";
|
|
3
3
|
import { useFluent_unstable as useFluent } from "@fluentui/react-shared-contexts";
|
|
4
4
|
import { sliderCSSVars } from "./Slider.constants.js";
|
|
5
5
|
const { sliderStepsPercentVar, sliderProgressVar, sliderDirectionVar } = sliderCSSVars;
|
|
6
|
-
const getPercent = (value, min, max)=>{
|
|
7
|
-
return max === min ? 0 : (value - min) / (max - min) * 100;
|
|
8
|
-
};
|
|
9
6
|
export const useSliderState_unstable = (state, props)=>{
|
|
10
7
|
const { min = 0, max = 100, step } = props;
|
|
11
8
|
const { dir } = useFluent();
|
|
@@ -15,7 +12,7 @@ export const useSliderState_unstable = (state, props)=>{
|
|
|
15
12
|
initialState: 0
|
|
16
13
|
});
|
|
17
14
|
const clampedValue = clamp(currentValue, min, max);
|
|
18
|
-
const valuePercent =
|
|
15
|
+
const valuePercent = getPercentInRange(clampedValue, min, max);
|
|
19
16
|
const inputOnChange = state.input.onChange;
|
|
20
17
|
const propsOnChange = props.onChange;
|
|
21
18
|
const onChange = useEventCallback((ev)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/useSliderState.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { clamp, getPercentInRange, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { sliderCSSVars } from './Slider.constants';\nimport type { SliderBaseState, SliderBaseProps } from './Slider.types';\n\nconst { sliderStepsPercentVar, sliderProgressVar, sliderDirectionVar } = sliderCSSVars;\n\nexport const useSliderState_unstable = (state: SliderBaseState, props: SliderBaseProps): SliderBaseState => {\n const { min = 0, max = 100, step } = props;\n const { dir } = useFluent();\n const [currentValue, setCurrentValue] = useControllableState({\n state: props.value,\n defaultState: props.defaultValue,\n initialState: 0,\n });\n const clampedValue = clamp(currentValue, min, max);\n const valuePercent = getPercentInRange(clampedValue, min, max);\n\n const inputOnChange = state.input.onChange;\n const propsOnChange = props.onChange;\n\n const onChange: React.ChangeEventHandler<HTMLInputElement> = useEventCallback(ev => {\n const newValue = Number(ev.target.value);\n setCurrentValue(clamp(newValue, min, max));\n\n if (inputOnChange && inputOnChange !== propsOnChange) {\n inputOnChange(ev);\n } else if (propsOnChange) {\n propsOnChange(ev, { value: newValue });\n }\n });\n\n const stepPercent = step && step > 0 ? `${(step * 100) / (max - min)}%` : undefined;\n const rootVariables = {\n [sliderDirectionVar]: state.vertical ? '0deg' : dir === 'ltr' ? '90deg' : '270deg',\n [sliderProgressVar]: `${valuePercent}%`,\n // Set the sliderStepsPercentVar only if defined - fixes SSR errors in React 18\n ...(stepPercent !== undefined && {\n [sliderStepsPercentVar]: stepPercent,\n }),\n };\n\n // Root props\n // eslint-disable-next-line react-hooks/immutability\n state.root.style = {\n ...rootVariables,\n ...state.root.style,\n };\n\n // Input Props\n // eslint-disable-next-line react-hooks/immutability\n state.input.value = clampedValue;\n // eslint-disable-next-line react-hooks/immutability\n state.input.onChange = onChange;\n\n return state;\n};\n"],"names":["clamp","getPercentInRange","useControllableState","useEventCallback","useFluent_unstable","useFluent","sliderCSSVars","sliderStepsPercentVar","sliderProgressVar","sliderDirectionVar","useSliderState_unstable","state","props","min","max","step","dir","currentValue","setCurrentValue","value","defaultState","defaultValue","initialState","clampedValue","valuePercent","inputOnChange","input","onChange","propsOnChange","ev","newValue","Number","target","stepPercent","undefined","rootVariables","vertical","root","style"],"mappings":"AAAA;AAGA,SAASA,KAAK,EAAEC,iBAAiB,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAC7G,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,aAAa,QAAQ,wBAAqB;AAGnD,MAAM,EAAEC,qBAAqB,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAE,GAAGH;AAEzE,OAAO,MAAMI,0BAA0B,CAACC,OAAwBC;IAC9D,MAAM,EAAEC,MAAM,CAAC,EAAEC,MAAM,GAAG,EAAEC,IAAI,EAAE,GAAGH;IACrC,MAAM,EAAEI,GAAG,EAAE,GAAGX;IAChB,MAAM,CAACY,cAAcC,gBAAgB,GAAGhB,qBAAqB;QAC3DS,OAAOC,MAAMO,KAAK;QAClBC,cAAcR,MAAMS,YAAY;QAChCC,cAAc;IAChB;IACA,MAAMC,eAAevB,MAAMiB,cAAcJ,KAAKC;IAC9C,MAAMU,eAAevB,kBAAkBsB,cAAcV,KAAKC;IAE1D,MAAMW,gBAAgBd,MAAMe,KAAK,CAACC,QAAQ;IAC1C,MAAMC,gBAAgBhB,MAAMe,QAAQ;IAEpC,MAAMA,WAAuDxB,iBAAiB0B,CAAAA;QAC5E,MAAMC,WAAWC,OAAOF,GAAGG,MAAM,CAACb,KAAK;QACvCD,gBAAgBlB,MAAM8B,UAAUjB,KAAKC;QAErC,IAAIW,iBAAiBA,kBAAkBG,eAAe;YACpDH,cAAcI;QAChB,OAAO,IAAID,eAAe;YACxBA,cAAcC,IAAI;gBAAEV,OAAOW;YAAS;QACtC;IACF;IAEA,MAAMG,cAAclB,QAAQA,OAAO,IAAI,GAAG,AAACA,OAAO,MAAQD,CAAAA,MAAMD,GAAE,EAAG,CAAC,CAAC,GAAGqB;IAC1E,MAAMC,gBAAgB;QACpB,CAAC1B,mBAAmB,EAAEE,MAAMyB,QAAQ,GAAG,SAASpB,QAAQ,QAAQ,UAAU;QAC1E,CAACR,kBAAkB,EAAE,GAAGgB,aAAa,CAAC,CAAC;QACvC,+EAA+E;QAC/E,GAAIS,gBAAgBC,aAAa;YAC/B,CAAC3B,sBAAsB,EAAE0B;QAC3B,CAAC;IACH;IAEA,aAAa;IACb,oDAAoD;IACpDtB,MAAM0B,IAAI,CAACC,KAAK,GAAG;QACjB,GAAGH,aAAa;QAChB,GAAGxB,MAAM0B,IAAI,CAACC,KAAK;IACrB;IAEA,cAAc;IACd,oDAAoD;IACpD3B,MAAMe,KAAK,CAACP,KAAK,GAAGI;IACpB,oDAAoD;IACpDZ,MAAMe,KAAK,CAACC,QAAQ,GAAGA;IAEvB,OAAOhB;AACT,EAAE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./Slider.module.css";
|
|
3
|
+
export const sliderClassNames = {
|
|
4
|
+
root: 'fui-Slider',
|
|
5
|
+
rail: 'fui-Slider__rail',
|
|
6
|
+
thumb: 'fui-Slider__thumb',
|
|
7
|
+
input: 'fui-Slider__input'
|
|
8
|
+
};
|
|
9
|
+
export const useSliderStyles_unstable = (state)=>{
|
|
10
|
+
var _state_size;
|
|
11
|
+
state.root.className = clsx(sliderClassNames.root, styles.root, styles[(_state_size = state.size) !== null && _state_size !== void 0 ? _state_size : 'medium'], state.vertical ? styles.vertical : styles.horizontal, state.disabled ? styles.disabled : styles.enabled, state.root.className);
|
|
12
|
+
state.rail.className = clsx(sliderClassNames.rail, styles.rail, state.rail.className);
|
|
13
|
+
state.thumb.className = clsx(sliderClassNames.thumb, styles.thumb, state.thumb.className);
|
|
14
|
+
state.input.className = clsx(sliderClassNames.input, styles.input, state.input.className);
|
|
15
|
+
return state;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/useSliderStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SliderState, SliderSlots } from './Slider.types';\nimport styles from './Slider.module.css';\n\nexport const sliderClassNames: SlotClassNames<SliderSlots> = {\n root: 'fui-Slider',\n rail: 'fui-Slider__rail',\n thumb: 'fui-Slider__thumb',\n input: 'fui-Slider__input',\n};\n\nexport const useSliderStyles_unstable = (state: SliderState): SliderState => {\n state.root.className = clsx(\n sliderClassNames.root,\n styles.root,\n styles[state.size ?? 'medium'],\n state.vertical ? styles.vertical : styles.horizontal,\n state.disabled ? styles.disabled : styles.enabled,\n state.root.className,\n );\n state.rail.className = clsx(sliderClassNames.rail, styles.rail, state.rail.className);\n state.thumb.className = clsx(sliderClassNames.thumb, styles.thumb, state.thumb.className);\n state.input.className = clsx(sliderClassNames.input, styles.input, state.input.className);\n return state;\n};\n"],"names":["clsx","styles","sliderClassNames","root","rail","thumb","input","useSliderStyles_unstable","state","className","size","vertical","horizontal","disabled","enabled"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,sBAAsB;AAEzC,OAAO,MAAMC,mBAAgD;IAC3DC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,OAAO,MAAMC,2BAA2B,CAACC;QAI9BA;IAHTA,MAAML,IAAI,CAACM,SAAS,GAAGT,KACrBE,iBAAiBC,IAAI,EACrBF,OAAOE,IAAI,EACXF,MAAM,EAACO,cAAAA,MAAME,IAAI,cAAVF,yBAAAA,cAAc,SAAS,EAC9BA,MAAMG,QAAQ,GAAGV,OAAOU,QAAQ,GAAGV,OAAOW,UAAU,EACpDJ,MAAMK,QAAQ,GAAGZ,OAAOY,QAAQ,GAAGZ,OAAOa,OAAO,EACjDN,MAAML,IAAI,CAACM,SAAS;IAEtBD,MAAMJ,IAAI,CAACK,SAAS,GAAGT,KAAKE,iBAAiBE,IAAI,EAAEH,OAAOG,IAAI,EAAEI,MAAMJ,IAAI,CAACK,SAAS;IACpFD,MAAMH,KAAK,CAACI,SAAS,GAAGT,KAAKE,iBAAiBG,KAAK,EAAEJ,OAAOI,KAAK,EAAEG,MAAMH,KAAK,CAACI,SAAS;IACxFD,MAAMF,KAAK,CAACG,SAAS,GAAGT,KAAKE,iBAAiBI,KAAK,EAAEL,OAAOK,KAAK,EAAEE,MAAMF,KAAK,CAACG,SAAS;IACxF,OAAOD;AACT,EAAE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./Slider.module.css";
|
|
3
|
+
export const sliderClassNames = {
|
|
4
|
+
root: 'fui-Slider',
|
|
5
|
+
rail: 'fui-Slider__rail',
|
|
6
|
+
thumb: 'fui-Slider__thumb',
|
|
7
|
+
input: 'fui-Slider__input'
|
|
8
|
+
};
|
|
9
|
+
export const useSliderStyles_unstable = (state)=>{
|
|
10
|
+
var _state_size;
|
|
11
|
+
state.root.className = clsx(sliderClassNames.root, styles.root, styles[(_state_size = state.size) !== null && _state_size !== void 0 ? _state_size : 'medium'], state.vertical ? styles.vertical : styles.horizontal, state.disabled ? styles.disabled : styles.enabled, state.root.className);
|
|
12
|
+
state.rail.className = clsx(sliderClassNames.rail, styles.rail, state.rail.className);
|
|
13
|
+
state.thumb.className = clsx(sliderClassNames.thumb, styles.thumb, state.thumb.className);
|
|
14
|
+
state.input.className = clsx(sliderClassNames.input, styles.input, state.input.className);
|
|
15
|
+
return state;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Slider/useSliderStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SliderState, SliderSlots } from './Slider.types';\nimport styles from './Slider.module.css';\n\nexport const sliderClassNames: SlotClassNames<SliderSlots> = {\n root: 'fui-Slider',\n rail: 'fui-Slider__rail',\n thumb: 'fui-Slider__thumb',\n input: 'fui-Slider__input',\n};\n\nexport const useSliderStyles_unstable = (state: SliderState): SliderState => {\n state.root.className = clsx(\n sliderClassNames.root,\n styles.root,\n styles[state.size ?? 'medium'],\n state.vertical ? styles.vertical : styles.horizontal,\n state.disabled ? styles.disabled : styles.enabled,\n state.root.className,\n );\n state.rail.className = clsx(sliderClassNames.rail, styles.rail, state.rail.className);\n state.thumb.className = clsx(sliderClassNames.thumb, styles.thumb, state.thumb.className);\n state.input.className = clsx(sliderClassNames.input, styles.input, state.input.className);\n return state;\n};\n"],"names":["clsx","styles","sliderClassNames","root","rail","thumb","input","useSliderStyles_unstable","state","className","size","vertical","horizontal","disabled","enabled"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,sBAAsB;AAEzC,OAAO,MAAMC,mBAAgD;IAC3DC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,OAAO,MAAMC,2BAA2B,CAACC;QAI9BA;IAHTA,MAAML,IAAI,CAACM,SAAS,GAAGT,KACrBE,iBAAiBC,IAAI,EACrBF,OAAOE,IAAI,EACXF,MAAM,EAACO,cAAAA,MAAME,IAAI,cAAVF,yBAAAA,cAAc,SAAS,EAC9BA,MAAMG,QAAQ,GAAGV,OAAOU,QAAQ,GAAGV,OAAOW,UAAU,EACpDJ,MAAMK,QAAQ,GAAGZ,OAAOY,QAAQ,GAAGZ,OAAOa,OAAO,EACjDN,MAAML,IAAI,CAACM,SAAS;IAEtBD,MAAMJ,IAAI,CAACK,SAAS,GAAGT,KAAKE,iBAAiBE,IAAI,EAAEH,OAAOG,IAAI,EAAEI,MAAMJ,IAAI,CAACK,SAAS;IACpFD,MAAMH,KAAK,CAACI,SAAS,GAAGT,KAAKE,iBAAiBG,KAAK,EAAEJ,OAAOI,KAAK,EAAEG,MAAMH,KAAK,CAACI,SAAS;IACxFD,MAAMF,KAAK,CAACG,SAAS,GAAGT,KAAKE,iBAAiBI,KAAK,EAAEL,OAAOK,KAAK,EAAEE,MAAMF,KAAK,CAACG,SAAS;IACxF,OAAOD;AACT,EAAE"}
|