Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+3168
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -0,0 +1,15 @@
@fluentui/react-slider
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
+41
View File
@@ -0,0 +1,41 @@
# @fluentui/react-slider
**Slider components for [Fluent UI React](https://react.fluentui.dev/)**
Slider allows users to quickly select a value (or range) by dragging a thumb across a rail. It is often used when setting values with a relaxed precision such as audio volume and screen brightness.
## Usage
To import Slider:
```js
import { Slider } from '@fluentui/react-components';
```
### Examples
```jsx
<Slider />
<Slider defaultValue={3} />
<Slider value={sliderValue} onChange={sliderOnChange} />
<Slider min={0} max={10} />
<Slider vertical />
<Slider disabled />
<Slider step={10} />
<Slider size="small" />
```
See [Fluent UI Storybook](https://react.fluentui.dev/) for more detailed usage examples.
Alternatively, run Storybook locally with:
1. `yarn start`
2. Select `react-slider` from the list.
### Specification
See [SPEC.md](./Spec.md).
### Migration Guide
If you're upgrading to Fluent UI v9 see [MIGRATION.md](./MIGRATION.md) for guidance on updating to the latest Slider implementation.
+131
View File
@@ -0,0 +1,131 @@
/// <reference types="react" />
import type { ComponentProps } from '@fluentui/react-utilities';
import type { ComponentState } from '@fluentui/react-utilities';
import type { ForwardRefComponent } from '@fluentui/react-utilities';
import * as React_2 from 'react';
import type { Slot } from '@fluentui/react-utilities';
import type { SlotClassNames } from '@fluentui/react-utilities';
/**
* Render the final JSX of Slider
*/
export declare const renderSlider_unstable: (state: SliderState) => JSX.Element;
/**
* The Slider component allows users to quickly select a value by dragging a thumb across a rail.
*/
export declare const Slider: ForwardRefComponent<SliderProps>;
export declare const sliderClassNames: SlotClassNames<SliderSlots>;
export declare const sliderCSSVars: {
sliderDirectionVar: string;
sliderInnerThumbRadiusVar: string;
sliderProgressVar: string;
sliderProgressColorVar: string;
sliderRailSizeVar: string;
sliderRailColorVar: string;
sliderStepsPercentVar: string;
sliderThumbColorVar: string;
sliderThumbSizeVar: string;
};
export declare type SliderOnChangeData = {
value: number;
};
export declare type SliderProps = Omit<ComponentProps<Partial<SliderSlots>, 'input'>, 'defaultValue' | 'onChange' | 'size' | 'value'> & {
/**
* The starting value for an uncontrolled Slider.
* Mutually exclusive with `value` prop.
*/
defaultValue?: number;
/**
* Whether to render the Slider as disabled.
*
* @default `false` (renders enabled)
*/
disabled?: boolean;
/**
* The max value of the Slider.
* @default 100
*/
max?: number;
/**
* The min value of the Slider.
* @default 0
*/
min?: number;
/**
* The size of the Slider.
* @default 'medium'
*/
size?: 'small' | 'medium';
/**
* The number of steps that the Slider's `value` will increment upon change. When provided, the Slider
* will snap to the closest available value. This must be a positive value.
* @default 1
*/
step?: number;
/**
* The current value of the controlled Slider.
* Mutually exclusive with `defaultValue` prop.
*/
value?: number;
/**
* Render the Slider in a vertical orientation, smallest value on the bottom.
* @default `false`
*/
vertical?: boolean;
/**
* Triggers a callback when the value has been changed. This will be called on every individual step.
*/
onChange?: (ev: React_2.ChangeEvent<HTMLInputElement>, data: SliderOnChangeData) => void;
};
export declare type SliderSlots = {
/**
* The root of the Slider.
* The root slot receives the `className` and `style` specified directly on the `<Slider>`.
* All other native props will be applied to the primary slot, `input`.
*/
root: NonNullable<Slot<'div'>>;
/**
* The Slider's base. It is used to visibly display the min and max selectable values.
*/
rail: NonNullable<Slot<'div'>>;
/**
* The draggable icon used to select a given value from the Slider.
* This is the element containing `role = 'slider'`.
*/
thumb: NonNullable<Slot<'div'>>;
/**
* The hidden input for the Slider.
* This is the PRIMARY slot: all native properties specified directly on `<Slider>` will be applied to this slot,
* except `className` and `style`, which remain on the root slot.
*
*/
input: NonNullable<Slot<'input'>> & {
/**
* Orient is a non standard attribute that allows for vertical orientation in Firefox. It is set internally
* when `vertical` is set to true.
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#non_standard_attributes
* Webkit/Chromium support for vertical inputs is provided via -webkit-appearance css property
*/
orient?: 'horizontal' | 'vertical';
};
};
export declare type SliderState = ComponentState<SliderSlots> & Pick<SliderProps, 'disabled' | 'size' | 'vertical'>;
export declare const useSlider_unstable: (props: SliderProps, ref: React_2.Ref<HTMLInputElement>) => SliderState;
export declare const useSliderState_unstable: (state: SliderState, props: SliderProps) => SliderState;
/**
* Apply styling to the Slider slots based on the state
*/
export declare const useSliderStyles_unstable: (state: SliderState) => SliderState;
export { }
+34
View File
@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Slider: function() {
return _index.Slider;
},
renderSlider_unstable: function() {
return _index.renderSlider_unstable;
},
sliderCSSVars: function() {
return _index.sliderCSSVars;
},
sliderClassNames: function() {
return _index.sliderClassNames;
},
useSliderState_unstable: function() {
return _index.useSliderState_unstable;
},
useSliderStyles_unstable: function() {
return _index.useSliderStyles_unstable;
},
useSlider_unstable: function() {
return _index.useSlider_unstable;
}
});
const _index = require("./components/Slider/index");
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../src/Slider.ts"],"sourcesContent":["export type { SliderOnChangeData, SliderProps, SliderSlots, SliderState } from './components/Slider/index';\nexport {\n Slider,\n renderSlider_unstable,\n sliderCSSVars,\n sliderClassNames,\n useSliderState_unstable,\n useSliderStyles_unstable,\n useSlider_unstable,\n} from './components/Slider/index';\n"],"names":["Slider","renderSlider_unstable","sliderCSSVars","sliderClassNames","useSliderState_unstable","useSliderStyles_unstable","useSlider_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEEA,MAAM;eAANA,aAAM;;IACNC,qBAAqB;eAArBA,4BAAqB;;IACrBC,aAAa;eAAbA,oBAAa;;IACbC,gBAAgB;eAAhBA,uBAAgB;;IAChBC,uBAAuB;eAAvBA,8BAAuB;;IACvBC,wBAAwB;eAAxBA,+BAAwB;;IACxBC,kBAAkB;eAAlBA,yBAAkB;;;uBACb"}
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Slider", {
enumerable: true,
get: function() {
return Slider;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useSlider = require("./useSlider");
const _renderSlider = require("./renderSlider");
const _useSliderStylesstyles = require("./useSliderStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const Slider = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useSlider.useSlider_unstable)(props, ref);
(0, _useSliderStylesstyles.useSliderStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useSliderStyles_unstable')(state);
return (0, _renderSlider.renderSlider_unstable)(state);
});
Slider.displayName = 'Slider';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/Slider.tsx"],"sourcesContent":["import * 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":["Slider","React","forwardRef","props","ref","state","useSlider_unstable","useSliderStyles_unstable","useCustomStyleHook_unstable","renderSlider_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;2BACY;8BACG;uCACG;qCAGG;AAKrC,MAAMA,SAAAA,WAAAA,GAA2CC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQC,IAAAA,6BAAAA,EAAmBH,OAAOC;IAExCG,IAAAA,+CAAAA,EAAyBF;IAEzBG,IAAAA,gDAAAA,EAA4B,4BAA4BH;IAExD,OAAOI,IAAAA,mCAAAA,EAAsBJ;AAC/B;AACAL,OAAOU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/Slider.types.ts"],"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\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\nexport type SliderState = ComponentState<SliderSlots> & Pick<SliderProps, 'disabled' | 'size' | 'vertical'>;\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Slider: function() {
return _Slider.Slider;
},
renderSlider_unstable: function() {
return _renderSlider.renderSlider_unstable;
},
sliderCSSVars: function() {
return _useSliderStylesstyles.sliderCSSVars;
},
sliderClassNames: function() {
return _useSliderStylesstyles.sliderClassNames;
},
useSliderState_unstable: function() {
return _useSliderState.useSliderState_unstable;
},
useSliderStyles_unstable: function() {
return _useSliderStylesstyles.useSliderStyles_unstable;
},
useSlider_unstable: function() {
return _useSlider.useSlider_unstable;
}
});
const _Slider = require("./Slider");
const _renderSlider = require("./renderSlider");
const _useSlider = require("./useSlider");
const _useSliderState = require("./useSliderState");
const _useSliderStylesstyles = require("./useSliderStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/index.ts"],"sourcesContent":["export { Slider } from './Slider';\nexport type { SliderOnChangeData, SliderProps, SliderSlots, SliderState } from './Slider.types';\nexport { renderSlider_unstable } from './renderSlider';\nexport { useSlider_unstable } from './useSlider';\nexport { useSliderState_unstable } from './useSliderState';\nexport { sliderClassNames, sliderCSSVars, useSliderStyles_unstable } from './useSliderStyles.styles';\n"],"names":["Slider","renderSlider_unstable","sliderCSSVars","sliderClassNames","useSliderState_unstable","useSliderStyles_unstable","useSlider_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,MAAM;eAANA,cAAM;;IAENC,qBAAqB;eAArBA,mCAAqB;;IAGHC,aAAa;eAAbA,oCAAa;;IAA/BC,gBAAgB;eAAhBA,uCAAgB;;IADhBC,uBAAuB;eAAvBA,uCAAuB;;IACUC,wBAAwB;eAAxBA,+CAAwB;;IAFzDC,kBAAkB;eAAlBA,6BAAkB;;;wBAHJ;8BAEe;2BACH;gCACK;uCACkC"}
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderSlider_unstable", {
enumerable: true,
get: function() {
return renderSlider_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderSlider_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
children: [
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.input, {}),
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.rail, {}),
/*#__PURE__*/ (0, _jsxruntime.jsx)(state.thumb, {})
]
});
};
@@ -0,0 +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 { SliderState, SliderSlots } from './Slider.types';\n\n/**\n * Render the final JSX of Slider\n */\nexport const renderSlider_unstable = (state: SliderState) => {\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":["renderSlider_unstable","state","assertSlots","_jsxs","root","_jsx","input","rail","thumb"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,wBAAwB,CAACC;IACpCC,IAAAA,2BAAAA,EAAyBD;IAEzB,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAACF,MAAMG,IAAI,EAAA;;0BACTC,IAAAA,eAAA,EAACJ,MAAMK,KAAK,EAAA,CAAA;0BACZD,IAAAA,eAAA,EAACJ,MAAMM,IAAI,EAAA,CAAA;0BACXF,IAAAA,eAAA,EAACJ,MAAMO,KAAK,EAAA,CAAA;;;AAGlB"}
@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useSlider_unstable", {
enumerable: true,
get: function() {
return useSlider_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactfield = require("@fluentui/react-field");
const _reactutilities = require("@fluentui/react-utilities");
const _useSliderState = require("./useSliderState");
const _reacttabster = require("@fluentui/react-tabster");
const useSlider_unstable = (props, ref)=>{
// Merge props from surrounding <Field>, if any
props = (0, _reactfield.useFieldControlProps_unstable)(props, {
supportsLabelFor: true
});
const nativeProps = (0, _reactutilities.getPartitionedNativeProps)({
props,
primarySlotTagName: 'input',
excludedPropNames: [
'onChange',
'size'
]
});
const { disabled, vertical, size = 'medium', root, input, rail, thumb } = props;
const state = {
disabled,
size,
vertical,
components: {
input: 'input',
rail: 'div',
root: 'div',
thumb: 'div'
},
root: _reactutilities.slot.always(root, {
defaultProps: nativeProps.root,
elementType: 'div'
}),
input: _reactutilities.slot.always(input, {
defaultProps: {
id: (0, _reactutilities.useId)('slider-', props.id),
ref,
...nativeProps.primary,
type: 'range',
orient: vertical ? 'vertical' : undefined
},
elementType: 'input'
}),
rail: _reactutilities.slot.always(rail, {
elementType: 'div'
}),
thumb: _reactutilities.slot.always(thumb, {
elementType: 'div'
})
};
state.root.ref = (0, _reactutilities.useMergedRefs)(state.root.ref, (0, _reacttabster.useFocusWithin)());
(0, _useSliderState.useSliderState_unstable)(state, props);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/useSlider.ts"],"sourcesContent":["import * 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 { SliderProps, SliderState } from './Slider.types';\nimport { useFocusWithin } from '@fluentui/react-tabster';\n\nexport const useSlider_unstable = (props: SliderProps, ref: React.Ref<HTMLInputElement>): SliderState => {\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', 'size'],\n });\n\n const {\n disabled,\n vertical,\n size = 'medium',\n // Slots\n root,\n input,\n rail,\n thumb,\n } = props;\n\n const state: SliderState = {\n disabled,\n size,\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 state.root.ref = useMergedRefs(state.root.ref, useFocusWithin<HTMLDivElement>());\n\n useSliderState_unstable(state, props);\n\n return state;\n};\n"],"names":["useSlider_unstable","props","ref","useFieldControlProps_unstable","supportsLabelFor","nativeProps","getPartitionedNativeProps","primarySlotTagName","excludedPropNames","disabled","vertical","size","root","input","rail","thumb","state","components","slot","always","defaultProps","elementType","id","useId","primary","type","orient","undefined","useMergedRefs","useFocusWithin","useSliderState_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;4BACuB;gCACwB;gCAC9B;8BAET;AAExB,MAAMA,qBAAqB,CAACC,OAAoBC;IACrD,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAAAA,EAA8BF,OAAO;QAAEG,kBAAkB;IAAK;IAEtE,MAAMC,cAAcC,IAAAA,yCAAAA,EAA0B;QAC5CL;QACAM,oBAAoB;QACpBC,mBAAmB;YAAC;YAAY;SAAO;IACzC;IAEA,MAAM,EACJC,QAAQ,EACRC,QAAQ,EACRC,OAAO,QAAQ,EAEfC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,KAAK,EACN,GAAGd;IAEJ,MAAMe,QAAqB;QACzBP;QACAE;QACAD;QACAO,YAAY;YACVJ,OAAO;YACPC,MAAM;YACNF,MAAM;YACNG,OAAO;QACT;QACAH,MAAMM,oBAAAA,CAAKC,MAAM,CAACP,MAAM;YACtBQ,cAAcf,YAAYO,IAAI;YAC9BS,aAAa;QACf;QACAR,OAAOK,oBAAAA,CAAKC,MAAM,CAACN,OAAO;YACxBO,cAAc;gBACZE,IAAIC,IAAAA,qBAAAA,EAAM,WAAWtB,MAAMqB,EAAE;gBAC7BpB;gBACA,GAAGG,YAAYmB,OAAO;gBACtBC,MAAM;gBACNC,QAAQhB,WAAW,aAAaiB;YAClC;YACAN,aAAa;QACf;QACAP,MAAMI,oBAAAA,CAAKC,MAAM,CAACL,MAAM;YAAEO,aAAa;QAAM;QAC7CN,OAAOG,oBAAAA,CAAKC,MAAM,CAACJ,OAAO;YAAEM,aAAa;QAAM;IACjD;IAEAL,MAAMJ,IAAI,CAACV,GAAG,GAAG0B,IAAAA,6BAAAA,EAAcZ,MAAMJ,IAAI,CAACV,GAAG,EAAE2B,IAAAA,4BAAAA;IAE/CC,IAAAA,uCAAAA,EAAwBd,OAAOf;IAE/B,OAAOe;AACT"}
@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useSliderState_unstable", {
enumerable: true,
get: function() {
return useSliderState_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const _useSliderStylesstyles = require("./useSliderStyles.styles");
const { sliderStepsPercentVar, sliderProgressVar, sliderDirectionVar } = _useSliderStylesstyles.sliderCSSVars;
const getPercent = (value, min, max)=>{
return max === min ? 0 : (value - min) / (max - min) * 100;
};
const useSliderState_unstable = (state, props)=>{
'use no memo';
const { min = 0, max = 100, step } = props;
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
const [currentValue, setCurrentValue] = (0, _reactutilities.useControllableState)({
state: props.value,
defaultState: props.defaultValue,
initialState: 0
});
const clampedValue = (0, _reactutilities.clamp)(currentValue, min, max);
const valuePercent = getPercent(clampedValue, min, max);
const inputOnChange = state.input.onChange;
const propsOnChange = props.onChange;
const onChange = (0, _reactutilities.useEventCallback)((ev)=>{
const newValue = Number(ev.target.value);
setCurrentValue((0, _reactutilities.clamp)(newValue, min, max));
if (inputOnChange && inputOnChange !== propsOnChange) {
inputOnChange(ev);
} else if (propsOnChange) {
propsOnChange(ev, {
value: newValue
});
}
});
const rootVariables = {
[sliderDirectionVar]: state.vertical ? '0deg' : dir === 'ltr' ? '90deg' : '270deg',
[sliderStepsPercentVar]: step && step > 0 ? `${step * 100 / (max - min)}%` : '',
[sliderProgressVar]: `${valuePercent}%`
};
// Root props
state.root.style = {
...rootVariables,
...state.root.style
};
// Input Props
state.input.value = clampedValue;
state.input.onChange = onChange;
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/useSliderState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { clamp, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { sliderCSSVars } from './useSliderStyles.styles';\nimport type { SliderState, SliderProps } from './Slider.types';\n\nconst { sliderStepsPercentVar, sliderProgressVar, sliderDirectionVar } = sliderCSSVars;\n\nconst getPercent = (value: number, min: number, max: number) => {\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n};\n\nexport const useSliderState_unstable = (state: SliderState, props: SliderProps) => {\n 'use no memo';\n\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 = getPercent(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 rootVariables = {\n [sliderDirectionVar]: state.vertical ? '0deg' : dir === 'ltr' ? '90deg' : '270deg',\n [sliderStepsPercentVar]: step && step > 0 ? `${(step * 100) / (max - min)}%` : '',\n [sliderProgressVar]: `${valuePercent}%`,\n };\n\n // Root props\n state.root.style = {\n ...rootVariables,\n ...state.root.style,\n };\n\n // Input Props\n state.input.value = clampedValue;\n state.input.onChange = onChange;\n\n return state;\n};\n"],"names":["useSliderState_unstable","sliderStepsPercentVar","sliderProgressVar","sliderDirectionVar","sliderCSSVars","getPercent","value","min","max","state","props","step","dir","useFluent","currentValue","setCurrentValue","useControllableState","defaultState","defaultValue","initialState","clampedValue","clamp","valuePercent","inputOnChange","input","onChange","propsOnChange","useEventCallback","ev","newValue","Number","target","rootVariables","vertical","root","style"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAYaA;;;eAAAA;;;;iEAZU;gCACuC;qCACd;uCAClB;AAG9B,MAAM,EAAEC,qBAAqB,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAE,GAAGC,oCAAAA;AAEzE,MAAMC,aAAa,CAACC,OAAeC,KAAaC;IAC9C,OAAOA,QAAQD,MAAM,IAAI,AAAED,CAAAA,QAAQC,GAAAA,IAAQC,CAAAA,MAAMD,GAAAA,IAAQ;AAC3D;AAEO,MAAMP,0BAA0B,CAACS,OAAoBC;IAC1D;IAEA,MAAM,EAAEH,MAAM,CAAC,EAAEC,MAAM,GAAG,EAAEG,IAAI,EAAE,GAAGD;IACrC,MAAM,EAAEE,GAAG,EAAE,GAAGC,IAAAA,uCAAAA;IAChB,MAAM,CAACC,cAAcC,gBAAgB,GAAGC,IAAAA,oCAAAA,EAAqB;QAC3DP,OAAOC,MAAMJ,KAAK;QAClBW,cAAcP,MAAMQ,YAAY;QAChCC,cAAc;IAChB;IACA,MAAMC,eAAeC,IAAAA,qBAAAA,EAAMP,cAAcP,KAAKC;IAC9C,MAAMc,eAAejB,WAAWe,cAAcb,KAAKC;IAEnD,MAAMe,gBAAgBd,MAAMe,KAAK,CAACC,QAAQ;IAC1C,MAAMC,gBAAgBhB,MAAMe,QAAQ;IAEpC,MAAMA,WAAuDE,IAAAA,gCAAAA,EAAiBC,CAAAA;QAC5E,MAAMC,WAAWC,OAAOF,GAAGG,MAAM,CAACzB,KAAK;QACvCS,gBAAgBM,IAAAA,qBAAAA,EAAMQ,UAAUtB,KAAKC;QAErC,IAAIe,iBAAiBA,kBAAkBG,eAAe;YACpDH,cAAcK;QAChB,OAAO,IAAIF,eAAe;YACxBA,cAAcE,IAAI;gBAAEtB,OAAOuB;YAAS;QACtC;IACF;IAEA,MAAMG,gBAAgB;QACpB,CAAC7B,mBAAmB,EAAEM,MAAMwB,QAAQ,GAAG,SAASrB,QAAQ,QAAQ,UAAU;QAC1E,CAACX,sBAAsB,EAAEU,QAAQA,OAAO,IAAI,CAAC,EAAEA,OAAQ,MAAQH,CAAAA,MAAMD,GAAAA,EAAK,CAAC,CAAC,GAAG;QAC/E,CAACL,kBAAkB,EAAE,CAAC,EAAEoB,aAAa,CAAC,CAAC;IACzC;IAEA,aAAa;IACbb,MAAMyB,IAAI,CAACC,KAAK,GAAG;QACjB,GAAGH,aAAa;QAChB,GAAGvB,MAAMyB,IAAI,CAACC,KAAK;IACrB;IAEA,cAAc;IACd1B,MAAMe,KAAK,CAAClB,KAAK,GAAGc;IACpBX,MAAMe,KAAK,CAACC,QAAQ,GAAGA;IAEvB,OAAOhB;AACT"}
@@ -0,0 +1,673 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
sliderCSSVars: function() {
return sliderCSSVars;
},
sliderClassNames: function() {
return sliderClassNames;
},
useSliderStyles_unstable: function() {
return useSliderStyles_unstable;
}
});
const _react = require("@griffel/react");
const sliderClassNames = {
root: 'fui-Slider',
rail: 'fui-Slider__rail',
thumb: 'fui-Slider__thumb',
input: 'fui-Slider__input'
};
// Internal CSS variables
const thumbPositionVar = `--fui-Slider__thumb--position`;
const sliderCSSVars = {
sliderDirectionVar: `--fui-Slider--direction`,
sliderInnerThumbRadiusVar: `--fui-Slider__inner-thumb--radius`,
sliderProgressVar: `--fui-Slider--progress`,
sliderProgressColorVar: `--fui-Slider__progress--color`,
sliderRailSizeVar: `--fui-Slider__rail--size`,
sliderRailColorVar: `--fui-Slider__rail--color`,
sliderStepsPercentVar: `--fui-Slider--steps-percent`,
sliderThumbColorVar: `--fui-Slider__thumb--color`,
sliderThumbSizeVar: `--fui-Slider__thumb--size`
};
const { sliderDirectionVar, sliderInnerThumbRadiusVar, sliderProgressVar, sliderProgressColorVar, sliderRailSizeVar, sliderRailColorVar, sliderStepsPercentVar, sliderThumbColorVar, sliderThumbSizeVar } = sliderCSSVars;
/**
* Styles for the root slot
*/ const useRootStyles = /*#__PURE__*/ (0, _react.__styles)({
root: {
qhf8xq: "f10pi13n",
mc9l5x: "fwk3njj",
lpbzjs: "f1sdsnyy",
Bt984gj: "f122n59",
B7hvi0a: "f1oiokrs"
},
small: {
Bi64ftq: "f1agqo6f",
Bslxy2k: "f1mmvox9",
Ba19x4e: "f1i7ztpd",
sshi5w: "f1pha7fy"
},
medium: {
Bi64ftq: "f1a78h9h",
Bslxy2k: "fh1udnr",
Ba19x4e: "fuok0yf",
sshi5w: "f1nxs5xn"
},
horizontal: {
Bf4jedk: "fyvtabn",
wkccdc: "fgfd48t",
Budl1dq: "f4t5rw1"
},
vertical: {
sshi5w: "f1pzv1zu",
wkccdc: "fktlcaf",
Budl1dq: "fiadc6h"
},
enabled: {
B7wi8oa: "f4l8x3l",
B250r6j: "f671q34",
Bpmy4es: "fvfzmw5",
Buw9y6v: "faw1t00",
Bq939m0: "fxdgx5",
gjzr1t: "fii04fa",
tg7hqu: "f36hzz8",
ypdvl1: "f1volkfw",
Bw5jdd4: "f1xddb6",
Bdjie01: "fcdikl",
Bvh9j6m: "fhpzgm6",
Bvsvvpo: "f1q6pm3h"
},
disabled: {
Bpmy4es: "foojseg",
B7wi8oa: "f1lgdqhv",
B250r6j: "f1veetlj",
ypdvl1: "fu12m3e",
Bw5jdd4: "fi9guym",
Bdjie01: "fcdjl4u"
},
focusIndicatorHorizontal: {
Brovlpu: "ftqa4ok",
B486eqv: "f2hkw1w",
Bssx7fj: "f1b1k54r",
uh7if5: [
"f4ne723",
"fqqcjud"
],
clntm0: "fh7aioi",
Dlk2r6: [
"fqqcjud",
"f4ne723"
],
Bm3wd5j: "f1k55ka9",
Bbrhkcr: [
"fgclinu",
"f16pcs8n"
],
f1oku: "fycbxed",
aywvf2: [
"f16pcs8n",
"fgclinu"
],
B2j2mmj: "ffht0p2",
wigs8: "f1p0ul1q",
pbfy6t: "f1c901ms",
B0v4ure: "f1alokd7",
Byrf0fs: 0,
Bsiemmq: 0,
Bwckmig: 0,
skfxo0: 0,
Iidy0u: 0,
B98u21t: 0,
Bvwlmkc: 0,
jo1ztg: 0,
Ba1iezr: 0,
Blmvk6g: 0,
B24cy0v: 0,
Bil7v7r: 0,
Br3gin4: 0,
nr063g: 0,
ghq09: 0,
Bbgo44z: 0,
Bseh09z: "fmj8fco",
az1dzo: 0,
Ba3ybja: 0,
B6352mv: 0,
vppk2z: 0,
Biaj6j7: "f1iwowo3",
B2pnrqr: "f1pffoy2",
B29w5g4: [
"f1bmyog6",
"f15fv2gd"
],
Bhhzhcn: "fs6b7xr",
Bec0n69: [
"f15fv2gd",
"f1bmyog6"
]
},
focusIndicatorVertical: {
Brovlpu: "ftqa4ok",
B486eqv: "f2hkw1w",
Bssx7fj: "f1b1k54r",
uh7if5: [
"f4ne723",
"fqqcjud"
],
clntm0: "fh7aioi",
Dlk2r6: [
"fqqcjud",
"f4ne723"
],
Bm3wd5j: "f1k55ka9",
Bbrhkcr: [
"fgclinu",
"f16pcs8n"
],
f1oku: "fycbxed",
aywvf2: [
"f16pcs8n",
"fgclinu"
],
B2j2mmj: "ffht0p2",
wigs8: "f1p0ul1q",
pbfy6t: "f1c901ms",
B0v4ure: "f1alokd7",
Byrf0fs: 0,
Bsiemmq: 0,
Bwckmig: 0,
skfxo0: 0,
Iidy0u: 0,
B98u21t: 0,
Bvwlmkc: 0,
jo1ztg: 0,
Ba1iezr: 0,
Blmvk6g: 0,
B24cy0v: 0,
Bil7v7r: 0,
Br3gin4: 0,
nr063g: 0,
ghq09: 0,
Bbgo44z: 0,
Bseh09z: "fmj8fco",
az1dzo: 0,
Ba3ybja: 0,
B6352mv: 0,
vppk2z: 0,
Biaj6j7: "f1iwowo3",
B2pnrqr: "f1hxpdv8",
B29w5g4: [
"fm5xmfm",
"femsgmt"
],
Bhhzhcn: "f1dmxpeg",
Bec0n69: [
"femsgmt",
"fm5xmfm"
]
}
}, {
d: [
".f10pi13n{position:relative;}",
".fwk3njj{display:inline-grid;}",
".f1sdsnyy{touch-action:none;}",
".f122n59{align-items:center;}",
".f1oiokrs{justify-items:center;}",
".f1agqo6f{--fui-Slider__thumb--size:16px;}",
".f1mmvox9{--fui-Slider__inner-thumb--radius:5px;}",
".f1i7ztpd{--fui-Slider__rail--size:2px;}",
".f1pha7fy{min-height:24px;}",
".f1a78h9h{--fui-Slider__thumb--size:20px;}",
".fh1udnr{--fui-Slider__inner-thumb--radius:6px;}",
".fuok0yf{--fui-Slider__rail--size:4px;}",
".f1nxs5xn{min-height:32px;}",
".fyvtabn{min-width:120px;}",
".fgfd48t{grid-template-rows:1fr var(--fui-Slider__thumb--size) 1fr;}",
".f4t5rw1{grid-template-columns:1fr calc(100% - var(--fui-Slider__thumb--size)) 1fr;}",
".f1pzv1zu{min-height:120px;}",
".fktlcaf{grid-template-rows:1fr calc(100% - var(--fui-Slider__thumb--size)) 1fr;}",
".fiadc6h{grid-template-columns:1fr var(--fui-Slider__thumb--size) 1fr;}",
".f4l8x3l{--fui-Slider__rail--color:var(--colorNeutralStrokeAccessible);}",
".f671q34{--fui-Slider__progress--color:var(--colorCompoundBrandBackground);}",
".fvfzmw5{--fui-Slider__thumb--color:var(--colorCompoundBrandBackground);}",
".foojseg{--fui-Slider__thumb--color:var(--colorNeutralForegroundDisabled);}",
".f1lgdqhv{--fui-Slider__rail--color:var(--colorNeutralBackgroundDisabled);}",
".f1veetlj{--fui-Slider__progress--color:var(--colorNeutralForegroundDisabled);}",
".f1b1k54r[data-fui-focus-within]:focus-within{border-top-color:transparent;}",
".f4ne723[data-fui-focus-within]:focus-within{border-right-color:transparent;}",
".fqqcjud[data-fui-focus-within]:focus-within{border-left-color:transparent;}",
".fh7aioi[data-fui-focus-within]:focus-within{border-bottom-color:transparent;}",
".ffht0p2[data-fui-focus-within]:focus-within::after{content:\"\";}",
".f1p0ul1q[data-fui-focus-within]:focus-within::after{position:absolute;}",
".f1c901ms[data-fui-focus-within]:focus-within::after{pointer-events:none;}",
".f1alokd7[data-fui-focus-within]:focus-within::after{z-index:1;}",
[
".fmj8fco[data-fui-focus-within]:focus-within::after{border:2px solid var(--colorStrokeFocus2);}",
{
p: -2
}
],
[
".f1iwowo3[data-fui-focus-within]:focus-within::after{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
".f1pffoy2[data-fui-focus-within]:focus-within::after{top:calc(0px - 2px - -2px);}",
".f1bmyog6[data-fui-focus-within]:focus-within::after{right:calc(0px - 2px - 8px);}",
".f15fv2gd[data-fui-focus-within]:focus-within::after{left:calc(0px - 2px - 8px);}",
".fs6b7xr[data-fui-focus-within]:focus-within::after{bottom:calc(0px - 2px - -2px);}",
[
".fmj8fco[data-fui-focus-within]:focus-within::after{border:2px solid var(--colorStrokeFocus2);}",
{
p: -2
}
],
[
".f1iwowo3[data-fui-focus-within]:focus-within::after{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
".f1hxpdv8[data-fui-focus-within]:focus-within::after{top:calc(0px - 2px - 6px);}",
".fm5xmfm[data-fui-focus-within]:focus-within::after{right:calc(0px - 2px - 4px);}",
".femsgmt[data-fui-focus-within]:focus-within::after{left:calc(0px - 2px - 4px);}",
".f1dmxpeg[data-fui-focus-within]:focus-within::after{bottom:calc(0px - 2px - 6px);}"
],
h: [
".faw1t00:hover{--fui-Slider__thumb--color:var(--colorCompoundBrandBackgroundHover);}",
".fxdgx5:hover{--fui-Slider__progress--color:var(--colorCompoundBrandBackgroundHover);}"
],
a: [
".fii04fa:active{--fui-Slider__thumb--color:var(--colorCompoundBrandBackgroundPressed);}",
".f36hzz8:active{--fui-Slider__progress--color:var(--colorCompoundBrandBackgroundPressed);}"
],
m: [
[
"@media (forced-colors: active){.f1volkfw{--fui-Slider__rail--color:CanvasText;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.f1xddb6{--fui-Slider__thumb--color:Highlight;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.fcdikl{--fui-Slider__progress--color:Highlight;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.fhpzgm6:hover{--fui-Slider__thumb--color:Highlight;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.f1q6pm3h:hover{--fui-Slider__progress--color:Highlight;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.fu12m3e{--fui-Slider__rail--color:GrayText;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.fi9guym{--fui-Slider__thumb--color:GrayText;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.fcdjl4u{--fui-Slider__progress--color:GrayText;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.f1k55ka9[data-fui-focus-within]:focus-within::after{border-top-color:Highlight;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.f16pcs8n[data-fui-focus-within]:focus-within::after{border-left-color:Highlight;}.fgclinu[data-fui-focus-within]:focus-within::after{border-right-color:Highlight;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.fycbxed[data-fui-focus-within]:focus-within::after{border-bottom-color:Highlight;}}",
{
m: "(forced-colors: active)"
}
]
],
f: [
".ftqa4ok:focus{outline-style:none;}"
],
i: [
".f2hkw1w:focus-visible{outline-style:none;}"
]
});
/**
* Styles for the rail slot
*/ const useRailStyles = /*#__PURE__*/ (0, _react.__styles)({
rail: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f1kijzfu",
Bkecrkj: "f1aehjj5",
Ijaq50: "faunodf",
nk6f5a: "f88nxoq",
Br312pm: "fd46tj4",
Bw0ie65: "f1e2fz10",
qhf8xq: "f10pi13n",
Bvjb7m6: "fdgv6k0",
Bcmaq0h: "fizngqt",
Bpd4iqm: "fpvhumw",
oeaueh: "f1yog68k",
Bw0xxkn: "f13sgyd8",
Ftih45: "fzhtfnv",
Brfgrao: "f1j7ml58",
Bbn5juq: "fx36ao7",
Brdvuy1: "fux3rle"
},
horizontal: {
a9b677: "fly5x3f",
Bqenvij: "f1cy86ho",
Fbdkly: [
"f1heqfse",
"fkh49vu"
],
mdwyqc: [
"fkh49vu",
"f1heqfse"
],
Baz25je: "f16tdq4e"
},
vertical: {
a9b677: "fqxfnkd",
Bqenvij: "f1l02sjl",
Ccq8qp: "f1rik0od",
Bciustq: "f14xwovp",
lawp4y: "fdehrcx"
}
}, {
d: [
[
".f1kijzfu{border-radius:var(--borderRadiusXLarge);}",
{
p: -1
}
],
".f1aehjj5{pointer-events:none;}",
".faunodf{grid-row-start:2;}",
".f88nxoq{grid-row-end:2;}",
".fd46tj4{grid-column-start:2;}",
".f1e2fz10{grid-column-end:2;}",
".f10pi13n{position:relative;}",
".fdgv6k0{forced-color-adjust:none;}",
".fizngqt{background-image:linear-gradient(\n var(--fui-Slider--direction),\n var(--fui-Slider__progress--color) 0%,\n var(--fui-Slider__progress--color) var(--fui-Slider--progress),\n var(--fui-Slider__rail--color) var(--fui-Slider--progress)\n );}",
".fpvhumw{outline-width:1px;}",
".f1yog68k{outline-style:solid;}",
".f13sgyd8{outline-color:var(--colorTransparentStroke);}",
".fzhtfnv::before{content:'';}",
".f1j7ml58::before{position:absolute;}",
".fx36ao7::before{background-image:repeating-linear-gradient(\n var(--fui-Slider--direction),\n #0000 0%,\n #0000 calc(var(--fui-Slider--steps-percent) - 1px),\n var(--colorNeutralBackground1) calc(var(--fui-Slider--steps-percent) - 1px),\n var(--colorNeutralBackground1) var(--fui-Slider--steps-percent)\n );}",
".fly5x3f{width:100%;}",
".f1cy86ho{height:var(--fui-Slider__rail--size);}",
".f1heqfse::before{left:-1px;}",
".fkh49vu::before{right:-1px;}",
".f16tdq4e::before{height:var(--fui-Slider__rail--size);}",
".fqxfnkd{width:var(--fui-Slider__rail--size);}",
".f1l02sjl{height:100%;}",
".f1rik0od::before{width:var(--fui-Slider__rail--size);}",
".f14xwovp::before{top:-1px;}",
".fdehrcx::before{bottom:-1px;}"
],
m: [
[
"@media (forced-colors: active){.fux3rle::before{background-image:repeating-linear-gradient(\n var(--fui-Slider--direction),\n #0000 0%,\n #0000 calc(var(--fui-Slider--steps-percent) - 1px),\n HighlightText calc(var(--fui-Slider--steps-percent) - 1px),\n HighlightText var(--fui-Slider--steps-percent)\n );}}",
{
m: "(forced-colors: active)"
}
]
]
});
/**
* Styles for the thumb slot
*/ const useThumbStyles = /*#__PURE__*/ (0, _react.__styles)({
thumb: {
B2lzsem: "ftx3jue",
Ijaq50: "faunodf",
nk6f5a: "f88nxoq",
Br312pm: "fd46tj4",
Bw0ie65: "f1e2fz10",
qhf8xq: "f1euv43f",
a9b677: "f174ca62",
Bqenvij: "f1yfdkfd",
Bkecrkj: "f1aehjj5",
oeaueh: "f1s6fcnf",
Bvjb7m6: "fdgv6k0",
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f44lkw9",
E5pizo: "fof7hq0",
De3pzq: "foksa45",
Brfgrao: "f1j7ml58",
Bciustq: "f14u7mkt",
Fbdkly: [
"f5zrw40",
"f1ks5ppg"
],
lawp4y: "fto0uou",
mdwyqc: [
"f1ks5ppg",
"f5zrw40"
],
r59vdv: 0,
Budzafs: 0,
ck0cow: 0,
n07z76: 0,
Gng75u: "fielpny",
Bcvre1j: "fyl8oag",
Ftih45: "fzhtfnv",
Bcgcnre: 0,
Bqjgrrk: 0,
qa3bma: 0,
y0oebl: 0,
Biqmznv: 0,
Bm6vgfq: 0,
Bbv0w2i: 0,
uvfttm: 0,
eqrjj: 0,
Bk5zm6e: 0,
m598lv: 0,
B4f6apu: 0,
ydt019: 0,
Bq4z7u6: 0,
Bdkvgpv: 0,
B0qfbqy: 0,
kj8mxx: "f1fsco4d"
},
disabled: {
Bcgcnre: 0,
Bqjgrrk: 0,
qa3bma: 0,
y0oebl: 0,
Biqmznv: 0,
Bm6vgfq: 0,
Bbv0w2i: 0,
uvfttm: 0,
eqrjj: 0,
Bk5zm6e: 0,
m598lv: 0,
B4f6apu: 0,
ydt019: 0,
Bq4z7u6: 0,
Bdkvgpv: 0,
B0qfbqy: 0,
kj8mxx: "f1pv9hn4"
},
horizontal: {
Bz10aip: [
"f13gfj74",
"f1nfknbn"
],
oyh7mz: [
"foa2ioz",
"fjmilum"
]
},
vertical: {
Bz10aip: "f5cv5a3",
B5kzvoi: "f1k2fpdo"
}
}, {
d: [
".ftx3jue{--fui-Slider__thumb--position:clamp(var(--fui-Slider__inner-thumb--radius), var(--fui-Slider--progress), calc(100% - var(--fui-Slider__inner-thumb--radius)));}",
".faunodf{grid-row-start:2;}",
".f88nxoq{grid-row-end:2;}",
".fd46tj4{grid-column-start:2;}",
".f1e2fz10{grid-column-end:2;}",
".f1euv43f{position:absolute;}",
".f174ca62{width:var(--fui-Slider__thumb--size);}",
".f1yfdkfd{height:var(--fui-Slider__thumb--size);}",
".f1aehjj5{pointer-events:none;}",
".f1s6fcnf{outline-style:none;}",
".fdgv6k0{forced-color-adjust:none;}",
[
".f44lkw9{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
".fof7hq0{box-shadow:0 0 0 calc(var(--fui-Slider__thumb--size) * .2) var(--colorNeutralBackground1) inset;}",
".foksa45{background-color:var(--fui-Slider__thumb--color);}",
".f1j7ml58::before{position:absolute;}",
".f14u7mkt::before{top:0px;}",
".f5zrw40::before{left:0px;}",
".f1ks5ppg::before{right:0px;}",
".fto0uou::before{bottom:0px;}",
[
".fielpny::before{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
".fyl8oag::before{box-sizing:border-box;}",
".fzhtfnv::before{content:'';}",
[
".f1fsco4d::before{border:calc(var(--fui-Slider__thumb--size) * .05) solid var(--colorNeutralStroke1);}",
{
p: -2
}
],
[
".f1pv9hn4::before{border:calc(var(--fui-Slider__thumb--size) * .05) solid var(--colorNeutralForegroundDisabled);}",
{
p: -2
}
],
".f13gfj74{transform:translateX(-50%);}",
".f1nfknbn{transform:translateX(50%);}",
".foa2ioz{left:var(--fui-Slider__thumb--position);}",
".fjmilum{right:var(--fui-Slider__thumb--position);}",
".f5cv5a3{transform:translateY(50%);}",
".f1k2fpdo{bottom:var(--fui-Slider__thumb--position);}"
]
});
/**
* Styles for the Input slot
*/ const useInputStyles = /*#__PURE__*/ (0, _react.__styles)({
input: {
Bceei9c: "f1k6fduh",
abs64n: "fk73vx1",
Ijaq50: "f16hsg94",
nk6f5a: "f1nzqi2z",
Br312pm: "fwpfdsa",
Bw0ie65: "fuur7zz",
Byoj8tv: 0,
uwmqm3: 0,
z189sj: 0,
z8tnut: 0,
B0ocmuz: "f1mk8lai",
jrapky: 0,
Frg6f3: 0,
t21cq0: 0,
B6of3ja: 0,
B74szlk: "f1s184ao"
},
disabled: {
Bceei9c: "f158kwzp"
},
horizontal: {
Bqenvij: "f1yfdkfd",
a9b677: "fly5x3f"
},
vertical: {
Bqenvij: "f1l02sjl",
a9b677: "f174ca62",
Brp00wb: "f1r9mf01"
}
}, {
d: [
".f1k6fduh{cursor:pointer;}",
".fk73vx1{opacity:0;}",
".f16hsg94{grid-row-start:1;}",
".f1nzqi2z{grid-row-end:-1;}",
".fwpfdsa{grid-column-start:1;}",
".fuur7zz{grid-column-end:-1;}",
[
".f1mk8lai{padding:0;}",
{
p: -1
}
],
[
".f1s184ao{margin:0;}",
{
p: -1
}
],
".f158kwzp{cursor:default;}",
".f1yfdkfd{height:var(--fui-Slider__thumb--size);}",
".fly5x3f{width:100%;}",
".f1l02sjl{height:100%;}",
".f174ca62{width:var(--fui-Slider__thumb--size);}",
".f1r9mf01{-webkit-appearance:slider-vertical;}"
]
});
const useSliderStyles_unstable = (state)=>{
'use no memo';
const rootStyles = useRootStyles();
const railStyles = useRailStyles();
const thumbStyles = useThumbStyles();
const inputStyles = useInputStyles();
const isVertical = state.vertical;
state.root.className = (0, _react.mergeClasses)(sliderClassNames.root, rootStyles.root, isVertical ? rootStyles.focusIndicatorVertical : rootStyles.focusIndicatorHorizontal, rootStyles[state.size], isVertical ? rootStyles.vertical : rootStyles.horizontal, state.disabled ? rootStyles.disabled : rootStyles.enabled, state.root.className);
state.rail.className = (0, _react.mergeClasses)(sliderClassNames.rail, railStyles.rail, isVertical ? railStyles.vertical : railStyles.horizontal, state.rail.className);
state.thumb.className = (0, _react.mergeClasses)(sliderClassNames.thumb, thumbStyles.thumb, isVertical ? thumbStyles.vertical : thumbStyles.horizontal, state.disabled && thumbStyles.disabled, state.thumb.className);
state.input.className = (0, _react.mergeClasses)(sliderClassNames.input, inputStyles.input, isVertical ? inputStyles.vertical : inputStyles.horizontal, state.disabled && inputStyles.disabled, state.input.className);
return state;
};
File diff suppressed because one or more lines are too long
+34
View File
@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
Slider: function() {
return _Slider.Slider;
},
renderSlider_unstable: function() {
return _Slider.renderSlider_unstable;
},
sliderCSSVars: function() {
return _Slider.sliderCSSVars;
},
sliderClassNames: function() {
return _Slider.sliderClassNames;
},
useSliderState_unstable: function() {
return _Slider.useSliderState_unstable;
},
useSliderStyles_unstable: function() {
return _Slider.useSliderStyles_unstable;
},
useSlider_unstable: function() {
return _Slider.useSlider_unstable;
}
});
const _Slider = require("./Slider");
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Slider,\n renderSlider_unstable,\n sliderClassNames,\n sliderCSSVars,\n useSliderState_unstable,\n useSliderStyles_unstable,\n useSlider_unstable,\n} from './Slider';\nexport type { SliderOnChangeData, SliderProps, SliderSlots, SliderState } from './Slider';\n"],"names":["Slider","renderSlider_unstable","sliderCSSVars","sliderClassNames","useSliderState_unstable","useSliderStyles_unstable","useSlider_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACEA,MAAM;eAANA,cAAM;;IACNC,qBAAqB;eAArBA,6BAAqB;;IAErBC,aAAa;eAAbA,qBAAa;;IADbC,gBAAgB;eAAhBA,wBAAgB;;IAEhBC,uBAAuB;eAAvBA,+BAAuB;;IACvBC,wBAAwB;eAAxBA,gCAAwB;;IACxBC,kBAAkB;eAAlBA,0BAAkB;;;wBACb"}
+1
View File
@@ -0,0 +1 @@
export { Slider, renderSlider_unstable, sliderCSSVars, sliderClassNames, useSliderState_unstable, useSliderStyles_unstable, useSlider_unstable } from './components/Slider/index';
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../src/Slider.ts"],"sourcesContent":["export type { SliderOnChangeData, SliderProps, SliderSlots, SliderState } from './components/Slider/index';\nexport {\n Slider,\n renderSlider_unstable,\n sliderCSSVars,\n sliderClassNames,\n useSliderState_unstable,\n useSliderStyles_unstable,\n useSlider_unstable,\n} from './components/Slider/index';\n"],"names":["Slider","renderSlider_unstable","sliderCSSVars","sliderClassNames","useSliderState_unstable","useSliderStyles_unstable","useSlider_unstable"],"rangeMappings":"","mappings":"AACA,SACEA,MAAM,EACNC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,uBAAuB,EACvBC,wBAAwB,EACxBC,kBAAkB,QACb,4BAA4B"}
+14
View File
@@ -0,0 +1,14 @@
import * as React from 'react';
import { useSlider_unstable } from './useSlider';
import { renderSlider_unstable } from './renderSlider';
import { useSliderStyles_unstable } from './useSliderStyles.styles';
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
/**
* The Slider component allows users to quickly select a value by dragging a thumb across a rail.
*/ export const Slider = /*#__PURE__*/ React.forwardRef((props, ref)=>{
const state = useSlider_unstable(props, ref);
useSliderStyles_unstable(state);
useCustomStyleHook_unstable('useSliderStyles_unstable')(state);
return renderSlider_unstable(state);
});
Slider.displayName = 'Slider';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/Slider.tsx"],"sourcesContent":["import * 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"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,2BAA2B;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 @@
import * as React from 'react';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/Slider.types.ts"],"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\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\nexport type SliderState = ComponentState<SliderSlots> & Pick<SliderProps, 'disabled' | 'size' | 'vertical'>;\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
+5
View File
@@ -0,0 +1,5 @@
export { Slider } from './Slider';
export { renderSlider_unstable } from './renderSlider';
export { useSlider_unstable } from './useSlider';
export { useSliderState_unstable } from './useSliderState';
export { sliderClassNames, sliderCSSVars, useSliderStyles_unstable } from './useSliderStyles.styles';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/index.ts"],"sourcesContent":["export { Slider } from './Slider';\nexport type { SliderOnChangeData, SliderProps, SliderSlots, SliderState } from './Slider.types';\nexport { renderSlider_unstable } from './renderSlider';\nexport { useSlider_unstable } from './useSlider';\nexport { useSliderState_unstable } from './useSliderState';\nexport { sliderClassNames, sliderCSSVars, useSliderStyles_unstable } from './useSliderStyles.styles';\n"],"names":["Slider","renderSlider_unstable","useSlider_unstable","useSliderState_unstable","sliderClassNames","sliderCSSVars","useSliderStyles_unstable"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW;AAElC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,gBAAgB,EAAEC,aAAa,EAAEC,wBAAwB,QAAQ,2BAA2B"}
@@ -0,0 +1,14 @@
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
import { assertSlots } from '@fluentui/react-utilities';
/**
* Render the final JSX of Slider
*/ export const renderSlider_unstable = (state)=>{
assertSlots(state);
return /*#__PURE__*/ _jsxs(state.root, {
children: [
/*#__PURE__*/ _jsx(state.input, {}),
/*#__PURE__*/ _jsx(state.rail, {}),
/*#__PURE__*/ _jsx(state.thumb, {})
]
});
};
@@ -0,0 +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 { SliderState, SliderSlots } from './Slider.types';\n\n/**\n * Render the final JSX of Slider\n */\nexport const renderSlider_unstable = (state: SliderState) => {\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"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;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"}
+55
View File
@@ -0,0 +1,55 @@
import * as React from 'react';
import { useFieldControlProps_unstable } from '@fluentui/react-field';
import { getPartitionedNativeProps, useId, useMergedRefs, slot } from '@fluentui/react-utilities';
import { useSliderState_unstable } from './useSliderState';
import { useFocusWithin } from '@fluentui/react-tabster';
export const useSlider_unstable = (props, ref)=>{
// Merge props from surrounding <Field>, if any
props = useFieldControlProps_unstable(props, {
supportsLabelFor: true
});
const nativeProps = getPartitionedNativeProps({
props,
primarySlotTagName: 'input',
excludedPropNames: [
'onChange',
'size'
]
});
const { disabled, vertical, size = 'medium', // Slots
root, input, rail, thumb } = props;
const state = {
disabled,
size,
vertical,
components: {
input: 'input',
rail: 'div',
root: 'div',
thumb: 'div'
},
root: slot.always(root, {
defaultProps: nativeProps.root,
elementType: 'div'
}),
input: slot.always(input, {
defaultProps: {
id: useId('slider-', props.id),
ref,
...nativeProps.primary,
type: 'range',
orient: vertical ? 'vertical' : undefined
},
elementType: 'input'
}),
rail: slot.always(rail, {
elementType: 'div'
}),
thumb: slot.always(thumb, {
elementType: 'div'
})
};
state.root.ref = useMergedRefs(state.root.ref, useFocusWithin());
useSliderState_unstable(state, props);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/useSlider.ts"],"sourcesContent":["import * 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 { SliderProps, SliderState } from './Slider.types';\nimport { useFocusWithin } from '@fluentui/react-tabster';\n\nexport const useSlider_unstable = (props: SliderProps, ref: React.Ref<HTMLInputElement>): SliderState => {\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', 'size'],\n });\n\n const {\n disabled,\n vertical,\n size = 'medium',\n // Slots\n root,\n input,\n rail,\n thumb,\n } = props;\n\n const state: SliderState = {\n disabled,\n size,\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 state.root.ref = useMergedRefs(state.root.ref, useFocusWithin<HTMLDivElement>());\n\n useSliderState_unstable(state, props);\n\n return state;\n};\n"],"names":["React","useFieldControlProps_unstable","getPartitionedNativeProps","useId","useMergedRefs","slot","useSliderState_unstable","useFocusWithin","useSlider_unstable","props","ref","supportsLabelFor","nativeProps","primarySlotTagName","excludedPropNames","disabled","vertical","size","root","input","rail","thumb","state","components","always","defaultProps","elementType","id","primary","type","orient","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,yBAAyB,EAAEC,KAAK,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AAClG,SAASC,uBAAuB,QAAQ,mBAAmB;AAE3D,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC;IACrD,+CAA+C;IAC/CD,QAAQR,8BAA8BQ,OAAO;QAAEE,kBAAkB;IAAK;IAEtE,MAAMC,cAAcV,0BAA0B;QAC5CO;QACAI,oBAAoB;QACpBC,mBAAmB;YAAC;YAAY;SAAO;IACzC;IAEA,MAAM,EACJC,QAAQ,EACRC,QAAQ,EACRC,OAAO,QAAQ,EACf,QAAQ;IACRC,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,KAAK,EACN,GAAGZ;IAEJ,MAAMa,QAAqB;QACzBP;QACAE;QACAD;QACAO,YAAY;YACVJ,OAAO;YACPC,MAAM;YACNF,MAAM;YACNG,OAAO;QACT;QACAH,MAAMb,KAAKmB,MAAM,CAACN,MAAM;YACtBO,cAAcb,YAAYM,IAAI;YAC9BQ,aAAa;QACf;QACAP,OAAOd,KAAKmB,MAAM,CAACL,OAAO;YACxBM,cAAc;gBACZE,IAAIxB,MAAM,WAAWM,MAAMkB,EAAE;gBAC7BjB;gBACA,GAAGE,YAAYgB,OAAO;gBACtBC,MAAM;gBACNC,QAAQd,WAAW,aAAae;YAClC;YACAL,aAAa;QACf;QACAN,MAAMf,KAAKmB,MAAM,CAACJ,MAAM;YAAEM,aAAa;QAAM;QAC7CL,OAAOhB,KAAKmB,MAAM,CAACH,OAAO;YAAEK,aAAa;QAAM;IACjD;IAEAJ,MAAMJ,IAAI,CAACR,GAAG,GAAGN,cAAckB,MAAMJ,IAAI,CAACR,GAAG,EAAEH;IAE/CD,wBAAwBgB,OAAOb;IAE/B,OAAOa;AACT,EAAE"}
@@ -0,0 +1,47 @@
import * as React from 'react';
import { clamp, useControllableState, useEventCallback } from '@fluentui/react-utilities';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import { sliderCSSVars } from './useSliderStyles.styles';
const { sliderStepsPercentVar, sliderProgressVar, sliderDirectionVar } = sliderCSSVars;
const getPercent = (value, min, max)=>{
return max === min ? 0 : (value - min) / (max - min) * 100;
};
export const useSliderState_unstable = (state, props)=>{
'use no memo';
const { min = 0, max = 100, step } = props;
const { dir } = useFluent();
const [currentValue, setCurrentValue] = useControllableState({
state: props.value,
defaultState: props.defaultValue,
initialState: 0
});
const clampedValue = clamp(currentValue, min, max);
const valuePercent = getPercent(clampedValue, min, max);
const inputOnChange = state.input.onChange;
const propsOnChange = props.onChange;
const onChange = useEventCallback((ev)=>{
const newValue = Number(ev.target.value);
setCurrentValue(clamp(newValue, min, max));
if (inputOnChange && inputOnChange !== propsOnChange) {
inputOnChange(ev);
} else if (propsOnChange) {
propsOnChange(ev, {
value: newValue
});
}
});
const rootVariables = {
[sliderDirectionVar]: state.vertical ? '0deg' : dir === 'ltr' ? '90deg' : '270deg',
[sliderStepsPercentVar]: step && step > 0 ? `${step * 100 / (max - min)}%` : '',
[sliderProgressVar]: `${valuePercent}%`
};
// Root props
state.root.style = {
...rootVariables,
...state.root.style
};
// Input Props
state.input.value = clampedValue;
state.input.onChange = onChange;
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/Slider/useSliderState.tsx"],"sourcesContent":["import * as React from 'react';\nimport { clamp, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { sliderCSSVars } from './useSliderStyles.styles';\nimport type { SliderState, SliderProps } from './Slider.types';\n\nconst { sliderStepsPercentVar, sliderProgressVar, sliderDirectionVar } = sliderCSSVars;\n\nconst getPercent = (value: number, min: number, max: number) => {\n return max === min ? 0 : ((value - min) / (max - min)) * 100;\n};\n\nexport const useSliderState_unstable = (state: SliderState, props: SliderProps) => {\n 'use no memo';\n\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 = getPercent(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 rootVariables = {\n [sliderDirectionVar]: state.vertical ? '0deg' : dir === 'ltr' ? '90deg' : '270deg',\n [sliderStepsPercentVar]: step && step > 0 ? `${(step * 100) / (max - min)}%` : '',\n [sliderProgressVar]: `${valuePercent}%`,\n };\n\n // Root props\n state.root.style = {\n ...rootVariables,\n ...state.root.style,\n };\n\n // Input Props\n state.input.value = clampedValue;\n state.input.onChange = onChange;\n\n return state;\n};\n"],"names":["React","clamp","useControllableState","useEventCallback","useFluent_unstable","useFluent","sliderCSSVars","sliderStepsPercentVar","sliderProgressVar","sliderDirectionVar","getPercent","value","min","max","useSliderState_unstable","state","props","step","dir","currentValue","setCurrentValue","defaultState","defaultValue","initialState","clampedValue","valuePercent","inputOnChange","input","onChange","propsOnChange","ev","newValue","Number","target","rootVariables","vertical","root","style"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,KAAK,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAC1F,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,aAAa,QAAQ,2BAA2B;AAGzD,MAAM,EAAEC,qBAAqB,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAE,GAAGH;AAEzE,MAAMI,aAAa,CAACC,OAAeC,KAAaC;IAC9C,OAAOA,QAAQD,MAAM,IAAI,AAAED,CAAAA,QAAQC,GAAE,IAAMC,CAAAA,MAAMD,GAAE,IAAM;AAC3D;AAEA,OAAO,MAAME,0BAA0B,CAACC,OAAoBC;IAC1D;IAEA,MAAM,EAAEJ,MAAM,CAAC,EAAEC,MAAM,GAAG,EAAEI,IAAI,EAAE,GAAGD;IACrC,MAAM,EAAEE,GAAG,EAAE,GAAGb;IAChB,MAAM,CAACc,cAAcC,gBAAgB,GAAGlB,qBAAqB;QAC3Da,OAAOC,MAAML,KAAK;QAClBU,cAAcL,MAAMM,YAAY;QAChCC,cAAc;IAChB;IACA,MAAMC,eAAevB,MAAMkB,cAAcP,KAAKC;IAC9C,MAAMY,eAAef,WAAWc,cAAcZ,KAAKC;IAEnD,MAAMa,gBAAgBX,MAAMY,KAAK,CAACC,QAAQ;IAC1C,MAAMC,gBAAgBb,MAAMY,QAAQ;IAEpC,MAAMA,WAAuDzB,iBAAiB2B,CAAAA;QAC5E,MAAMC,WAAWC,OAAOF,GAAGG,MAAM,CAACtB,KAAK;QACvCS,gBAAgBnB,MAAM8B,UAAUnB,KAAKC;QAErC,IAAIa,iBAAiBA,kBAAkBG,eAAe;YACpDH,cAAcI;QAChB,OAAO,IAAID,eAAe;YACxBA,cAAcC,IAAI;gBAAEnB,OAAOoB;YAAS;QACtC;IACF;IAEA,MAAMG,gBAAgB;QACpB,CAACzB,mBAAmB,EAAEM,MAAMoB,QAAQ,GAAG,SAASjB,QAAQ,QAAQ,UAAU;QAC1E,CAACX,sBAAsB,EAAEU,QAAQA,OAAO,IAAI,CAAC,EAAE,AAACA,OAAO,MAAQJ,CAAAA,MAAMD,GAAE,EAAG,CAAC,CAAC,GAAG;QAC/E,CAACJ,kBAAkB,EAAE,CAAC,EAAEiB,aAAa,CAAC,CAAC;IACzC;IAEA,aAAa;IACbV,MAAMqB,IAAI,CAACC,KAAK,GAAG;QACjB,GAAGH,aAAa;QAChB,GAAGnB,MAAMqB,IAAI,CAACC,KAAK;IACrB;IAEA,cAAc;IACdtB,MAAMY,KAAK,CAAChB,KAAK,GAAGa;IACpBT,MAAMY,KAAK,CAACC,QAAQ,GAAGA;IAEvB,OAAOb;AACT,EAAE"}
@@ -0,0 +1,407 @@
import { __styles, mergeClasses } from '@griffel/react';
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
import { tokens } from '@fluentui/react-theme';
export const sliderClassNames = {
root: 'fui-Slider',
rail: 'fui-Slider__rail',
thumb: 'fui-Slider__thumb',
input: 'fui-Slider__input'
};
// Internal CSS variables
const thumbPositionVar = `--fui-Slider__thumb--position`;
export const sliderCSSVars = {
sliderDirectionVar: `--fui-Slider--direction`,
sliderInnerThumbRadiusVar: `--fui-Slider__inner-thumb--radius`,
sliderProgressVar: `--fui-Slider--progress`,
sliderProgressColorVar: `--fui-Slider__progress--color`,
sliderRailSizeVar: `--fui-Slider__rail--size`,
sliderRailColorVar: `--fui-Slider__rail--color`,
sliderStepsPercentVar: `--fui-Slider--steps-percent`,
sliderThumbColorVar: `--fui-Slider__thumb--color`,
sliderThumbSizeVar: `--fui-Slider__thumb--size`
};
const {
sliderDirectionVar,
sliderInnerThumbRadiusVar,
sliderProgressVar,
sliderProgressColorVar,
sliderRailSizeVar,
sliderRailColorVar,
sliderStepsPercentVar,
sliderThumbColorVar,
sliderThumbSizeVar
} = sliderCSSVars;
/**
* Styles for the root slot
*/
const useRootStyles = /*#__PURE__*/__styles({
root: {
qhf8xq: "f10pi13n",
mc9l5x: "fwk3njj",
lpbzjs: "f1sdsnyy",
Bt984gj: "f122n59",
B7hvi0a: "f1oiokrs"
},
small: {
Bi64ftq: "f1agqo6f",
Bslxy2k: "f1mmvox9",
Ba19x4e: "f1i7ztpd",
sshi5w: "f1pha7fy"
},
medium: {
Bi64ftq: "f1a78h9h",
Bslxy2k: "fh1udnr",
Ba19x4e: "fuok0yf",
sshi5w: "f1nxs5xn"
},
horizontal: {
Bf4jedk: "fyvtabn",
wkccdc: "fgfd48t",
Budl1dq: "f4t5rw1"
},
vertical: {
sshi5w: "f1pzv1zu",
wkccdc: "fktlcaf",
Budl1dq: "fiadc6h"
},
enabled: {
B7wi8oa: "f4l8x3l",
B250r6j: "f671q34",
Bpmy4es: "fvfzmw5",
Buw9y6v: "faw1t00",
Bq939m0: "fxdgx5",
gjzr1t: "fii04fa",
tg7hqu: "f36hzz8",
ypdvl1: "f1volkfw",
Bw5jdd4: "f1xddb6",
Bdjie01: "fcdikl",
Bvh9j6m: "fhpzgm6",
Bvsvvpo: "f1q6pm3h"
},
disabled: {
Bpmy4es: "foojseg",
B7wi8oa: "f1lgdqhv",
B250r6j: "f1veetlj",
ypdvl1: "fu12m3e",
Bw5jdd4: "fi9guym",
Bdjie01: "fcdjl4u"
},
focusIndicatorHorizontal: {
Brovlpu: "ftqa4ok",
B486eqv: "f2hkw1w",
Bssx7fj: "f1b1k54r",
uh7if5: ["f4ne723", "fqqcjud"],
clntm0: "fh7aioi",
Dlk2r6: ["fqqcjud", "f4ne723"],
Bm3wd5j: "f1k55ka9",
Bbrhkcr: ["fgclinu", "f16pcs8n"],
f1oku: "fycbxed",
aywvf2: ["f16pcs8n", "fgclinu"],
B2j2mmj: "ffht0p2",
wigs8: "f1p0ul1q",
pbfy6t: "f1c901ms",
B0v4ure: "f1alokd7",
Byrf0fs: 0,
Bsiemmq: 0,
Bwckmig: 0,
skfxo0: 0,
Iidy0u: 0,
B98u21t: 0,
Bvwlmkc: 0,
jo1ztg: 0,
Ba1iezr: 0,
Blmvk6g: 0,
B24cy0v: 0,
Bil7v7r: 0,
Br3gin4: 0,
nr063g: 0,
ghq09: 0,
Bbgo44z: 0,
Bseh09z: "fmj8fco",
az1dzo: 0,
Ba3ybja: 0,
B6352mv: 0,
vppk2z: 0,
Biaj6j7: "f1iwowo3",
B2pnrqr: "f1pffoy2",
B29w5g4: ["f1bmyog6", "f15fv2gd"],
Bhhzhcn: "fs6b7xr",
Bec0n69: ["f15fv2gd", "f1bmyog6"]
},
focusIndicatorVertical: {
Brovlpu: "ftqa4ok",
B486eqv: "f2hkw1w",
Bssx7fj: "f1b1k54r",
uh7if5: ["f4ne723", "fqqcjud"],
clntm0: "fh7aioi",
Dlk2r6: ["fqqcjud", "f4ne723"],
Bm3wd5j: "f1k55ka9",
Bbrhkcr: ["fgclinu", "f16pcs8n"],
f1oku: "fycbxed",
aywvf2: ["f16pcs8n", "fgclinu"],
B2j2mmj: "ffht0p2",
wigs8: "f1p0ul1q",
pbfy6t: "f1c901ms",
B0v4ure: "f1alokd7",
Byrf0fs: 0,
Bsiemmq: 0,
Bwckmig: 0,
skfxo0: 0,
Iidy0u: 0,
B98u21t: 0,
Bvwlmkc: 0,
jo1ztg: 0,
Ba1iezr: 0,
Blmvk6g: 0,
B24cy0v: 0,
Bil7v7r: 0,
Br3gin4: 0,
nr063g: 0,
ghq09: 0,
Bbgo44z: 0,
Bseh09z: "fmj8fco",
az1dzo: 0,
Ba3ybja: 0,
B6352mv: 0,
vppk2z: 0,
Biaj6j7: "f1iwowo3",
B2pnrqr: "f1hxpdv8",
B29w5g4: ["fm5xmfm", "femsgmt"],
Bhhzhcn: "f1dmxpeg",
Bec0n69: ["femsgmt", "fm5xmfm"]
}
}, {
d: [".f10pi13n{position:relative;}", ".fwk3njj{display:inline-grid;}", ".f1sdsnyy{touch-action:none;}", ".f122n59{align-items:center;}", ".f1oiokrs{justify-items:center;}", ".f1agqo6f{--fui-Slider__thumb--size:16px;}", ".f1mmvox9{--fui-Slider__inner-thumb--radius:5px;}", ".f1i7ztpd{--fui-Slider__rail--size:2px;}", ".f1pha7fy{min-height:24px;}", ".f1a78h9h{--fui-Slider__thumb--size:20px;}", ".fh1udnr{--fui-Slider__inner-thumb--radius:6px;}", ".fuok0yf{--fui-Slider__rail--size:4px;}", ".f1nxs5xn{min-height:32px;}", ".fyvtabn{min-width:120px;}", ".fgfd48t{grid-template-rows:1fr var(--fui-Slider__thumb--size) 1fr;}", ".f4t5rw1{grid-template-columns:1fr calc(100% - var(--fui-Slider__thumb--size)) 1fr;}", ".f1pzv1zu{min-height:120px;}", ".fktlcaf{grid-template-rows:1fr calc(100% - var(--fui-Slider__thumb--size)) 1fr;}", ".fiadc6h{grid-template-columns:1fr var(--fui-Slider__thumb--size) 1fr;}", ".f4l8x3l{--fui-Slider__rail--color:var(--colorNeutralStrokeAccessible);}", ".f671q34{--fui-Slider__progress--color:var(--colorCompoundBrandBackground);}", ".fvfzmw5{--fui-Slider__thumb--color:var(--colorCompoundBrandBackground);}", ".foojseg{--fui-Slider__thumb--color:var(--colorNeutralForegroundDisabled);}", ".f1lgdqhv{--fui-Slider__rail--color:var(--colorNeutralBackgroundDisabled);}", ".f1veetlj{--fui-Slider__progress--color:var(--colorNeutralForegroundDisabled);}", ".f1b1k54r[data-fui-focus-within]:focus-within{border-top-color:transparent;}", ".f4ne723[data-fui-focus-within]:focus-within{border-right-color:transparent;}", ".fqqcjud[data-fui-focus-within]:focus-within{border-left-color:transparent;}", ".fh7aioi[data-fui-focus-within]:focus-within{border-bottom-color:transparent;}", ".ffht0p2[data-fui-focus-within]:focus-within::after{content:\"\";}", ".f1p0ul1q[data-fui-focus-within]:focus-within::after{position:absolute;}", ".f1c901ms[data-fui-focus-within]:focus-within::after{pointer-events:none;}", ".f1alokd7[data-fui-focus-within]:focus-within::after{z-index:1;}", [".fmj8fco[data-fui-focus-within]:focus-within::after{border:2px solid var(--colorStrokeFocus2);}", {
p: -2
}], [".f1iwowo3[data-fui-focus-within]:focus-within::after{border-radius:var(--borderRadiusMedium);}", {
p: -1
}], ".f1pffoy2[data-fui-focus-within]:focus-within::after{top:calc(0px - 2px - -2px);}", ".f1bmyog6[data-fui-focus-within]:focus-within::after{right:calc(0px - 2px - 8px);}", ".f15fv2gd[data-fui-focus-within]:focus-within::after{left:calc(0px - 2px - 8px);}", ".fs6b7xr[data-fui-focus-within]:focus-within::after{bottom:calc(0px - 2px - -2px);}", [".fmj8fco[data-fui-focus-within]:focus-within::after{border:2px solid var(--colorStrokeFocus2);}", {
p: -2
}], [".f1iwowo3[data-fui-focus-within]:focus-within::after{border-radius:var(--borderRadiusMedium);}", {
p: -1
}], ".f1hxpdv8[data-fui-focus-within]:focus-within::after{top:calc(0px - 2px - 6px);}", ".fm5xmfm[data-fui-focus-within]:focus-within::after{right:calc(0px - 2px - 4px);}", ".femsgmt[data-fui-focus-within]:focus-within::after{left:calc(0px - 2px - 4px);}", ".f1dmxpeg[data-fui-focus-within]:focus-within::after{bottom:calc(0px - 2px - 6px);}"],
h: [".faw1t00:hover{--fui-Slider__thumb--color:var(--colorCompoundBrandBackgroundHover);}", ".fxdgx5:hover{--fui-Slider__progress--color:var(--colorCompoundBrandBackgroundHover);}"],
a: [".fii04fa:active{--fui-Slider__thumb--color:var(--colorCompoundBrandBackgroundPressed);}", ".f36hzz8:active{--fui-Slider__progress--color:var(--colorCompoundBrandBackgroundPressed);}"],
m: [["@media (forced-colors: active){.f1volkfw{--fui-Slider__rail--color:CanvasText;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.f1xddb6{--fui-Slider__thumb--color:Highlight;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.fcdikl{--fui-Slider__progress--color:Highlight;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.fhpzgm6:hover{--fui-Slider__thumb--color:Highlight;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.f1q6pm3h:hover{--fui-Slider__progress--color:Highlight;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.fu12m3e{--fui-Slider__rail--color:GrayText;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.fi9guym{--fui-Slider__thumb--color:GrayText;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.fcdjl4u{--fui-Slider__progress--color:GrayText;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.f1k55ka9[data-fui-focus-within]:focus-within::after{border-top-color:Highlight;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.f16pcs8n[data-fui-focus-within]:focus-within::after{border-left-color:Highlight;}.fgclinu[data-fui-focus-within]:focus-within::after{border-right-color:Highlight;}}", {
m: "(forced-colors: active)"
}], ["@media (forced-colors: active){.fycbxed[data-fui-focus-within]:focus-within::after{border-bottom-color:Highlight;}}", {
m: "(forced-colors: active)"
}]],
f: [".ftqa4ok:focus{outline-style:none;}"],
i: [".f2hkw1w:focus-visible{outline-style:none;}"]
});
/**
* Styles for the rail slot
*/
const useRailStyles = /*#__PURE__*/__styles({
rail: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f1kijzfu",
Bkecrkj: "f1aehjj5",
Ijaq50: "faunodf",
nk6f5a: "f88nxoq",
Br312pm: "fd46tj4",
Bw0ie65: "f1e2fz10",
qhf8xq: "f10pi13n",
Bvjb7m6: "fdgv6k0",
Bcmaq0h: "fizngqt",
Bpd4iqm: "fpvhumw",
oeaueh: "f1yog68k",
Bw0xxkn: "f13sgyd8",
Ftih45: "fzhtfnv",
Brfgrao: "f1j7ml58",
Bbn5juq: "fx36ao7",
Brdvuy1: "fux3rle"
},
horizontal: {
a9b677: "fly5x3f",
Bqenvij: "f1cy86ho",
Fbdkly: ["f1heqfse", "fkh49vu"],
mdwyqc: ["fkh49vu", "f1heqfse"],
Baz25je: "f16tdq4e"
},
vertical: {
a9b677: "fqxfnkd",
Bqenvij: "f1l02sjl",
Ccq8qp: "f1rik0od",
Bciustq: "f14xwovp",
lawp4y: "fdehrcx"
}
}, {
d: [[".f1kijzfu{border-radius:var(--borderRadiusXLarge);}", {
p: -1
}], ".f1aehjj5{pointer-events:none;}", ".faunodf{grid-row-start:2;}", ".f88nxoq{grid-row-end:2;}", ".fd46tj4{grid-column-start:2;}", ".f1e2fz10{grid-column-end:2;}", ".f10pi13n{position:relative;}", ".fdgv6k0{forced-color-adjust:none;}", ".fizngqt{background-image:linear-gradient(\n var(--fui-Slider--direction),\n var(--fui-Slider__progress--color) 0%,\n var(--fui-Slider__progress--color) var(--fui-Slider--progress),\n var(--fui-Slider__rail--color) var(--fui-Slider--progress)\n );}", ".fpvhumw{outline-width:1px;}", ".f1yog68k{outline-style:solid;}", ".f13sgyd8{outline-color:var(--colorTransparentStroke);}", ".fzhtfnv::before{content:'';}", ".f1j7ml58::before{position:absolute;}", ".fx36ao7::before{background-image:repeating-linear-gradient(\n var(--fui-Slider--direction),\n #0000 0%,\n #0000 calc(var(--fui-Slider--steps-percent) - 1px),\n var(--colorNeutralBackground1) calc(var(--fui-Slider--steps-percent) - 1px),\n var(--colorNeutralBackground1) var(--fui-Slider--steps-percent)\n );}", ".fly5x3f{width:100%;}", ".f1cy86ho{height:var(--fui-Slider__rail--size);}", ".f1heqfse::before{left:-1px;}", ".fkh49vu::before{right:-1px;}", ".f16tdq4e::before{height:var(--fui-Slider__rail--size);}", ".fqxfnkd{width:var(--fui-Slider__rail--size);}", ".f1l02sjl{height:100%;}", ".f1rik0od::before{width:var(--fui-Slider__rail--size);}", ".f14xwovp::before{top:-1px;}", ".fdehrcx::before{bottom:-1px;}"],
m: [["@media (forced-colors: active){.fux3rle::before{background-image:repeating-linear-gradient(\n var(--fui-Slider--direction),\n #0000 0%,\n #0000 calc(var(--fui-Slider--steps-percent) - 1px),\n HighlightText calc(var(--fui-Slider--steps-percent) - 1px),\n HighlightText var(--fui-Slider--steps-percent)\n );}}", {
m: "(forced-colors: active)"
}]]
});
/**
* Styles for the thumb slot
*/
const useThumbStyles = /*#__PURE__*/__styles({
thumb: {
B2lzsem: "ftx3jue",
Ijaq50: "faunodf",
nk6f5a: "f88nxoq",
Br312pm: "fd46tj4",
Bw0ie65: "f1e2fz10",
qhf8xq: "f1euv43f",
a9b677: "f174ca62",
Bqenvij: "f1yfdkfd",
Bkecrkj: "f1aehjj5",
oeaueh: "f1s6fcnf",
Bvjb7m6: "fdgv6k0",
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f44lkw9",
E5pizo: "fof7hq0",
De3pzq: "foksa45",
Brfgrao: "f1j7ml58",
Bciustq: "f14u7mkt",
Fbdkly: ["f5zrw40", "f1ks5ppg"],
lawp4y: "fto0uou",
mdwyqc: ["f1ks5ppg", "f5zrw40"],
r59vdv: 0,
Budzafs: 0,
ck0cow: 0,
n07z76: 0,
Gng75u: "fielpny",
Bcvre1j: "fyl8oag",
Ftih45: "fzhtfnv",
Bcgcnre: 0,
Bqjgrrk: 0,
qa3bma: 0,
y0oebl: 0,
Biqmznv: 0,
Bm6vgfq: 0,
Bbv0w2i: 0,
uvfttm: 0,
eqrjj: 0,
Bk5zm6e: 0,
m598lv: 0,
B4f6apu: 0,
ydt019: 0,
Bq4z7u6: 0,
Bdkvgpv: 0,
B0qfbqy: 0,
kj8mxx: "f1fsco4d"
},
disabled: {
Bcgcnre: 0,
Bqjgrrk: 0,
qa3bma: 0,
y0oebl: 0,
Biqmznv: 0,
Bm6vgfq: 0,
Bbv0w2i: 0,
uvfttm: 0,
eqrjj: 0,
Bk5zm6e: 0,
m598lv: 0,
B4f6apu: 0,
ydt019: 0,
Bq4z7u6: 0,
Bdkvgpv: 0,
B0qfbqy: 0,
kj8mxx: "f1pv9hn4"
},
horizontal: {
Bz10aip: ["f13gfj74", "f1nfknbn"],
oyh7mz: ["foa2ioz", "fjmilum"]
},
vertical: {
Bz10aip: "f5cv5a3",
B5kzvoi: "f1k2fpdo"
}
}, {
d: [".ftx3jue{--fui-Slider__thumb--position:clamp(var(--fui-Slider__inner-thumb--radius), var(--fui-Slider--progress), calc(100% - var(--fui-Slider__inner-thumb--radius)));}", ".faunodf{grid-row-start:2;}", ".f88nxoq{grid-row-end:2;}", ".fd46tj4{grid-column-start:2;}", ".f1e2fz10{grid-column-end:2;}", ".f1euv43f{position:absolute;}", ".f174ca62{width:var(--fui-Slider__thumb--size);}", ".f1yfdkfd{height:var(--fui-Slider__thumb--size);}", ".f1aehjj5{pointer-events:none;}", ".f1s6fcnf{outline-style:none;}", ".fdgv6k0{forced-color-adjust:none;}", [".f44lkw9{border-radius:var(--borderRadiusCircular);}", {
p: -1
}], ".fof7hq0{box-shadow:0 0 0 calc(var(--fui-Slider__thumb--size) * .2) var(--colorNeutralBackground1) inset;}", ".foksa45{background-color:var(--fui-Slider__thumb--color);}", ".f1j7ml58::before{position:absolute;}", ".f14u7mkt::before{top:0px;}", ".f5zrw40::before{left:0px;}", ".f1ks5ppg::before{right:0px;}", ".fto0uou::before{bottom:0px;}", [".fielpny::before{border-radius:var(--borderRadiusCircular);}", {
p: -1
}], ".fyl8oag::before{box-sizing:border-box;}", ".fzhtfnv::before{content:'';}", [".f1fsco4d::before{border:calc(var(--fui-Slider__thumb--size) * .05) solid var(--colorNeutralStroke1);}", {
p: -2
}], [".f1pv9hn4::before{border:calc(var(--fui-Slider__thumb--size) * .05) solid var(--colorNeutralForegroundDisabled);}", {
p: -2
}], ".f13gfj74{transform:translateX(-50%);}", ".f1nfknbn{transform:translateX(50%);}", ".foa2ioz{left:var(--fui-Slider__thumb--position);}", ".fjmilum{right:var(--fui-Slider__thumb--position);}", ".f5cv5a3{transform:translateY(50%);}", ".f1k2fpdo{bottom:var(--fui-Slider__thumb--position);}"]
});
/**
* Styles for the Input slot
*/
const useInputStyles = /*#__PURE__*/__styles({
input: {
Bceei9c: "f1k6fduh",
abs64n: "fk73vx1",
Ijaq50: "f16hsg94",
nk6f5a: "f1nzqi2z",
Br312pm: "fwpfdsa",
Bw0ie65: "fuur7zz",
Byoj8tv: 0,
uwmqm3: 0,
z189sj: 0,
z8tnut: 0,
B0ocmuz: "f1mk8lai",
jrapky: 0,
Frg6f3: 0,
t21cq0: 0,
B6of3ja: 0,
B74szlk: "f1s184ao"
},
disabled: {
Bceei9c: "f158kwzp"
},
horizontal: {
Bqenvij: "f1yfdkfd",
a9b677: "fly5x3f"
},
vertical: {
Bqenvij: "f1l02sjl",
a9b677: "f174ca62",
Brp00wb: "f1r9mf01"
}
}, {
d: [".f1k6fduh{cursor:pointer;}", ".fk73vx1{opacity:0;}", ".f16hsg94{grid-row-start:1;}", ".f1nzqi2z{grid-row-end:-1;}", ".fwpfdsa{grid-column-start:1;}", ".fuur7zz{grid-column-end:-1;}", [".f1mk8lai{padding:0;}", {
p: -1
}], [".f1s184ao{margin:0;}", {
p: -1
}], ".f158kwzp{cursor:default;}", ".f1yfdkfd{height:var(--fui-Slider__thumb--size);}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f174ca62{width:var(--fui-Slider__thumb--size);}", ".f1r9mf01{-webkit-appearance:slider-vertical;}"]
});
/**
* Apply styling to the Slider slots based on the state
*/
export const useSliderStyles_unstable = state => {
'use no memo';
const rootStyles = useRootStyles();
const railStyles = useRailStyles();
const thumbStyles = useThumbStyles();
const inputStyles = useInputStyles();
const isVertical = state.vertical;
state.root.className = mergeClasses(sliderClassNames.root, rootStyles.root, isVertical ? rootStyles.focusIndicatorVertical : rootStyles.focusIndicatorHorizontal, rootStyles[state.size], isVertical ? rootStyles.vertical : rootStyles.horizontal, state.disabled ? rootStyles.disabled : rootStyles.enabled, state.root.className);
state.rail.className = mergeClasses(sliderClassNames.rail, railStyles.rail, isVertical ? railStyles.vertical : railStyles.horizontal, state.rail.className);
state.thumb.className = mergeClasses(sliderClassNames.thumb, thumbStyles.thumb, isVertical ? thumbStyles.vertical : thumbStyles.horizontal, state.disabled && thumbStyles.disabled, state.thumb.className);
state.input.className = mergeClasses(sliderClassNames.input, inputStyles.input, isVertical ? inputStyles.vertical : inputStyles.horizontal, state.disabled && inputStyles.disabled, state.input.className);
return state;
};
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
export { Slider, renderSlider_unstable, sliderClassNames, sliderCSSVars, useSliderState_unstable, useSliderStyles_unstable, useSlider_unstable } from './Slider';
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Slider,\n renderSlider_unstable,\n sliderClassNames,\n sliderCSSVars,\n useSliderState_unstable,\n useSliderStyles_unstable,\n useSlider_unstable,\n} from './Slider';\nexport type { SliderOnChangeData, SliderProps, SliderSlots, SliderState } from './Slider';\n"],"names":["Slider","renderSlider_unstable","sliderClassNames","sliderCSSVars","useSliderState_unstable","useSliderStyles_unstable","useSlider_unstable"],"rangeMappings":"","mappings":"AAAA,SACEA,MAAM,EACNC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,EACbC,uBAAuB,EACvBC,wBAAwB,EACxBC,kBAAkB,QACb,WAAW"}
+58
View File
@@ -0,0 +1,58 @@
{
"name": "@fluentui/react-slider",
"version": "9.3.0",
"description": "Fluent UI React Slider component.",
"main": "lib-commonjs/index.js",
"module": "lib/index.js",
"typings": "./dist/index.d.ts",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/microsoft/fluentui"
},
"license": "MIT",
"devDependencies": {
"@fluentui/eslint-plugin": "*",
"@fluentui/react-conformance": "*",
"@fluentui/react-conformance-griffel": "*",
"@fluentui/react-label": "*",
"@fluentui/scripts-api-extractor": "*"
},
"dependencies": {
"@fluentui/react-field": "^9.2.0",
"@fluentui/react-jsx-runtime": "^9.0.50",
"@fluentui/react-shared-contexts": "^9.21.2",
"@fluentui/react-tabster": "^9.24.0",
"@fluentui/react-theme": "^9.1.24",
"@fluentui/react-utilities": "^9.18.20",
"@griffel/react": "^1.5.22",
"@swc/helpers": "^0.5.1"
},
"peerDependencies": {
"@types/react": ">=16.14.0 <19.0.0",
"@types/react-dom": ">=16.9.0 <19.0.0",
"react": ">=16.14.0 <19.0.0",
"react-dom": ">=16.14.0 <19.0.0"
},
"beachball": {
"disallowedChangeTypes": [
"major",
"prerelease"
]
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"node": "./lib-commonjs/index.js",
"import": "./lib/index.js",
"require": "./lib-commonjs/index.js"
},
"./package.json": "./package.json"
},
"files": [
"*.md",
"dist/*.d.ts",
"lib",
"lib-commonjs"
]
}