@fluentui/react-color-picker 9.3.1 → 9.3.3
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 +23 -2
- package/lib/components/AlphaSlider/AlphaSlider.constants.js.map +1 -1
- package/lib/components/AlphaSlider/AlphaSlider.js.map +1 -1
- package/lib/components/AlphaSlider/AlphaSlider.types.js.map +1 -1
- package/lib/components/AlphaSlider/alphaSliderUtils.js +1 -1
- package/lib/components/AlphaSlider/alphaSliderUtils.js.map +1 -1
- package/lib/components/AlphaSlider/index.js.map +1 -1
- package/lib/components/AlphaSlider/renderAlphaSlider.js +2 -2
- package/lib/components/AlphaSlider/renderAlphaSlider.js.map +1 -1
- package/lib/components/AlphaSlider/useAlphaSlider.js +1 -0
- package/lib/components/AlphaSlider/useAlphaSlider.js.map +1 -1
- package/lib/components/AlphaSlider/useAlphaSliderState.js +12 -13
- package/lib/components/AlphaSlider/useAlphaSliderState.js.map +1 -1
- package/lib/components/AlphaSlider/useAlphaSliderStyles.styles.raw.js.map +1 -1
- package/lib/components/ColorArea/ColorArea.constants.js.map +1 -1
- package/lib/components/ColorArea/ColorArea.js.map +1 -1
- package/lib/components/ColorArea/ColorArea.types.js.map +1 -1
- package/lib/components/ColorArea/index.js.map +1 -1
- package/lib/components/ColorArea/renderColorArea.js +2 -2
- package/lib/components/ColorArea/renderColorArea.js.map +1 -1
- package/lib/components/ColorArea/useColorArea.js +1 -0
- package/lib/components/ColorArea/useColorArea.js.map +1 -1
- package/lib/components/ColorArea/useColorAreaStyles.styles.raw.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.types.js.map +1 -1
- package/lib/components/ColorPicker/index.js.map +1 -1
- package/lib/components/ColorPicker/renderColorPicker.js +2 -2
- package/lib/components/ColorPicker/renderColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/useColorPicker.js.map +1 -1
- package/lib/components/ColorPicker/useColorPickerContextValues.js.map +1 -1
- package/lib/components/ColorPicker/useColorPickerStyles.styles.raw.js.map +1 -1
- package/lib/components/ColorSlider/ColorSlider.constants.js +1 -0
- package/lib/components/ColorSlider/ColorSlider.constants.js.map +1 -1
- package/lib/components/ColorSlider/ColorSlider.js.map +1 -1
- package/lib/components/ColorSlider/ColorSlider.types.js.map +1 -1
- package/lib/components/ColorSlider/index.js.map +1 -1
- package/lib/components/ColorSlider/renderColorSlider.js +2 -2
- package/lib/components/ColorSlider/renderColorSlider.js.map +1 -1
- package/lib/components/ColorSlider/useColorSlider.js +28 -11
- package/lib/components/ColorSlider/useColorSlider.js.map +1 -1
- package/lib/components/ColorSlider/useColorSliderStyles.styles.js +4 -3
- package/lib/components/ColorSlider/useColorSliderStyles.styles.js.map +1 -1
- package/lib/components/ColorSlider/useColorSliderStyles.styles.raw.js +3 -2
- package/lib/components/ColorSlider/useColorSliderStyles.styles.raw.js.map +1 -1
- package/lib/contexts/colorPicker.js.map +1 -1
- package/lib/types/color.js.map +1 -1
- package/lib/utils/adjustChannel.js.map +1 -1
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/createHslColor.js.map +1 -1
- package/lib/utils/createHsvColor.js.map +1 -1
- package/lib/utils/getCoordinates.js.map +1 -1
- package/lib-commonjs/AlphaSlider.cjs +8 -8
- package/lib-commonjs/ColorArea.cjs +8 -8
- package/lib-commonjs/ColorPicker.cjs +9 -9
- package/lib-commonjs/ColorPicker.cjs.map +1 -1
- package/lib-commonjs/ColorSlider.cjs +8 -8
- package/lib-commonjs/components/AlphaSlider/AlphaSlider.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/AlphaSlider.constants.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/AlphaSlider.types.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/alphaSliderUtils.cjs +5 -5
- package/lib-commonjs/components/AlphaSlider/alphaSliderUtils.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/index.cjs +8 -8
- package/lib-commonjs/components/AlphaSlider/index.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/renderAlphaSlider.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSlider.cjs +4 -3
- package/lib-commonjs/components/AlphaSlider/useAlphaSlider.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderState.cjs +10 -11
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderState.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.cjs +3 -3
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/AlphaSlider/useAlphaSliderStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/ColorArea.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/ColorArea.constants.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/ColorArea.types.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/index.cjs +8 -8
- package/lib-commonjs/components/ColorArea/index.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/renderColorArea.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/useColorArea.cjs +4 -3
- package/lib-commonjs/components/ColorArea/useColorArea.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.cjs +3 -3
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/ColorArea/useColorAreaStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/ColorPicker.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/ColorPicker.types.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/index.cjs +9 -9
- package/lib-commonjs/components/ColorPicker/index.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/renderColorPicker.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPicker.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPicker.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPickerContextValues.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPickerContextValues.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/ColorPicker/useColorPickerStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/ColorSlider.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/ColorSlider.constants.cjs +1 -0
- package/lib-commonjs/components/ColorSlider/ColorSlider.constants.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/ColorSlider.types.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/index.cjs +8 -8
- package/lib-commonjs/components/ColorSlider/index.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/renderColorSlider.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/useColorSlider.cjs +30 -13
- package/lib-commonjs/components/ColorSlider/useColorSlider.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.cjs +8 -16
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.raw.cjs +6 -5
- package/lib-commonjs/components/ColorSlider/useColorSliderStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/contexts/colorPicker.cjs +4 -4
- package/lib-commonjs/contexts/colorPicker.cjs.map +1 -1
- package/lib-commonjs/index.cjs +27 -27
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/types/color.cjs.map +1 -1
- package/lib-commonjs/utils/adjustChannel.cjs +3 -3
- package/lib-commonjs/utils/adjustChannel.cjs.map +1 -1
- package/lib-commonjs/utils/constants.cjs +6 -6
- package/lib-commonjs/utils/constants.cjs.map +1 -1
- package/lib-commonjs/utils/createHslColor.cjs +3 -3
- package/lib-commonjs/utils/createHslColor.cjs.map +1 -1
- package/lib-commonjs/utils/createHsvColor.cjs.map +1 -1
- package/lib-commonjs/utils/getCoordinates.cjs +3 -3
- package/lib-commonjs/utils/getCoordinates.cjs.map +1 -1
- package/package.json +5 -5
- package/lib/utils/getPercent.js +0 -11
- package/lib/utils/getPercent.js.map +0 -1
- package/lib-commonjs/utils/getPercent.cjs +0 -21
- package/lib-commonjs/utils/getPercent.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ColorSlider/useColorSlider.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport {\n getPartitionedNativeProps,\n useId,\n slot,\n useControllableState,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { colorSliderCSSVars } from './ColorSlider.constants';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport type {\n ColorSliderBaseProps,\n ColorSliderBaseState,\n ColorSliderProps,\n ColorSliderState,\n} from './ColorSlider.types';\nimport { useColorPickerContextValue_unstable } from '../../contexts/colorPicker';\nimport { MIN, HUE_MAX, MAX as COLOR_MAX } from '../../utils/constants';\nimport { getPercent } from '../../utils/getPercent';\nimport { createHsvColor } from '../../utils/createHsvColor';\nimport { clampValue, type ChannelActions, adjustChannel } from '../../utils/adjustChannel';\nimport type { HsvColor } from '../../types/color';\nimport { INITIAL_COLOR_HSV } from '../../utils/constants';\nimport { createHslColor, createHslColorString } from '../../utils/createHslColor';\n\n/**\n * Create the base state required to render unstyled ColorSlider.\n *\n * The returned state can be modified with hooks before being passed to renderColorSlider_unstable.\n *\n * @param props - props from this instance of ColorSlider\n * @param ref - reference to root HTMLInputElement of ColorSlider\n */\nexport const useColorSliderBase_unstable = (\n props: ColorSliderBaseProps,\n ref: React.Ref<HTMLInputElement>,\n): ColorSliderBaseState => {\n 'use no memo'; // justified: compiler would optimize useColorSlider_unstable — manual opt-out to preserve runtime behavior\n\n const { dir } = useFluent();\n const onChangeFromContext = useColorPickerContextValue_unstable(ctx => ctx.requestChange);\n const colorFromContext = useColorPickerContextValue_unstable(ctx => ctx.color);\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange', 'color'],\n });\n\n const {\n color,\n channel = 'hue',\n onChange = onChangeFromContext,\n vertical,\n // Slots\n root,\n input,\n rail,\n thumb,\n } = props;\n\n const hsvColor = color || colorFromContext;\n const hslColor = createHslColor(hsvColor);\n\n const [currentColor, setCurrentColor] = useControllableState<HsvColor>({\n defaultState: props.defaultColor,\n state: hsvColor,\n initialState: INITIAL_COLOR_HSV,\n });\n\n const MAX = channel === 'hue' ? HUE_MAX : COLOR_MAX;\n\n const valueChannelActions: ChannelActions<number> = {\n hue: clampValue(currentColor.h),\n saturation: clampValue(currentColor.s * 100),\n value: clampValue(currentColor.v * 100),\n };\n\n const clampedValue = adjustChannel(channel, valueChannelActions);\n const valuePercent = getPercent(clampedValue, MIN, MAX);\n\n const inputOnChange = input?.onChange;\n\n const _onChange: React.ChangeEventHandler<HTMLInputElement> = useEventCallback(event => {\n const newValue = Number(event.target.value);\n const colorActions: ChannelActions<() => HsvColor> = {\n hue: () => createHsvColor({ ...hsvColor, h: newValue }),\n saturation: () => createHsvColor({ ...hsvColor, s: newValue / 100 }),\n value: () => createHsvColor({ ...hsvColor, v: newValue / 100 }),\n };\n const newColor = adjustChannel(channel, colorActions)();\n\n setCurrentColor(newColor);\n\n inputOnChange?.(event);\n onChange?.(event, {\n type: 'change',\n event,\n color: newColor,\n });\n });\n\n const rootVariables = {\n [colorSliderCSSVars.sliderDirectionVar]: vertical ? '180deg' : dir === 'ltr' ? '-90deg' : '90deg',\n [colorSliderCSSVars.sliderProgressVar]: `${valuePercent}%`,\n [colorSliderCSSVars.thumbColorVar]:\n channel === 'hue' ? `hsl(${clampedValue}, 100%, 50%)` : createHslColorString(hsvColor),\n [colorSliderCSSVars.railColorVar]:\n channel === 'hue'\n ? `hsl(${hslColor.h}, ${hslColor.s * 100}%, ${hslColor.l * 100}%)`\n : `hsl(${hslColor.h}, 100%, 50%)`,\n };\n\n const state: ColorSliderBaseState = {\n vertical,\n channel,\n components: {\n input: 'input',\n rail: 'div',\n root: 'div',\n thumb: 'div',\n },\n root: slot.always(root, {\n defaultProps: {\n role: 'group',\n ...nativeProps.root,\n },\n elementType: 'div',\n }),\n input: slot.always(input, {\n defaultProps: {\n id: useId('slider-', props.id),\n ref,\n min: MIN,\n max: MAX,\n tabIndex: 0,\n ['aria-orientation']: vertical ? 'vertical' : 'horizontal',\n ...nativeProps.primary,\n type: 'range',\n },\n elementType: 'input',\n }),\n rail: slot.always(rail, { elementType: 'div' }),\n thumb: slot.always(thumb, { elementType: 'div' }),\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 return state;\n};\n\n/**\n * Create the state required to render ColorSlider.\n *\n * The returned state can be modified with hooks such as useColorSliderStyles_unstable,\n * before being passed to renderColorSlider_unstable.\n *\n * @param props - props from this instance of ColorSlider\n * @param ref - reference to root HTMLInputElement of ColorSlider\n */\nexport const useColorSlider_unstable = (\n props: ColorSliderProps,\n ref: React.Ref<HTMLInputElement>,\n): ColorSliderState => {\n const shapeFromContext = useColorPickerContextValue_unstable(ctx => ctx.shape);\n\n const { shape = shapeFromContext, ...baseProps } = props;\n\n const state: ColorSliderState = {\n ...useColorSliderBase_unstable(baseProps, ref),\n shape,\n };\n\n return state;\n};\n"],"names":["getPartitionedNativeProps","useId","slot","useControllableState","useEventCallback","colorSliderCSSVars","useFluent_unstable","useFluent","useColorPickerContextValue_unstable","MIN","HUE_MAX","MAX","COLOR_MAX","getPercent","createHsvColor","clampValue","adjustChannel","INITIAL_COLOR_HSV","createHslColor","createHslColorString","useColorSliderBase_unstable","props","ref","dir","onChangeFromContext","ctx","requestChange","colorFromContext","color","nativeProps","primarySlotTagName","excludedPropNames","channel","onChange","vertical","root","input","rail","thumb","hsvColor","hslColor","currentColor","setCurrentColor","defaultState","defaultColor","state","initialState","valueChannelActions","hue","h","saturation","s","value","v","clampedValue","valuePercent","inputOnChange","_onChange","event","newValue","Number","target","colorActions","newColor","type","rootVariables","sliderDirectionVar","sliderProgressVar","thumbColorVar","railColorVar","l","components","always","defaultProps","role","elementType","id","min","max","tabIndex","primary","style","useColorSlider_unstable","shapeFromContext","shape","baseProps"],"mappings":"AAAA;;;;;;;;;;;;IAmCaoB,2BAAAA;;;2BAqIA8D;;;;gCA/JN,4BAA4B;sCACA,6BAA0B;qCACb,kCAAkC;6BAO9B,gCAA6B;2BAClC,2BAAwB;4BAC5C,4BAAyB;gCACrB,gCAA6B;+BACG,+BAA4B;gCAGtC,gCAA6B;AAU3E,oCAAoC,CACzC7D,OACAC;IAEA,eAAe,2GAA2G;IAE1H,MAAM,EAAEC,GAAG,EAAE,OAAGhB,uCAAAA;IAChB,MAAMiB,0BAAsBhB,gDAAAA,EAAoCiB,CAAAA,MAAOA,IAAIC,aAAa;IACxF,MAAMC,uBAAmBnB,gDAAAA,EAAoCiB,CAAAA,MAAOA,IAAIG,KAAK;IAC7E,MAAMC,kBAAc7B,yCAAAA,EAA0B;QAC5CqB;QACAS,oBAAoB;QACpBC,mBAAmB;YAAC;YAAY;SAAQ;IAC1C;IAEA,MAAM,EACJH,KAAK,EACLI,UAAU,KAAK,EACfC,WAAWT,mBAAmB,EAC9BU,QAAQ,EACR,AACAC,IAAI,EACJC,EAFQ,GAEH,EACLC,IAAI,EACJC,KAAK,EACN,GAAGjB;IAEJ,MAAMkB,WAAWX,SAASD;IAC1B,MAAMa,WAAWtB,kCAAAA,EAAeqB;IAEhC,MAAM,CAACE,cAAcC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MAAMV,IAAI,CAAC8C,KAAK,GAAG;QACjB,GAAGhB,aAAa;QAChB,GAAGpB,MAAMV,IAAI,CAAC8C,KAAK;IACrB;IAEA,cAAc;IACdpC,MAAMT,KAAK,CAACgB,KAAK,GAAGE;IACpBT,MAAMT,KAAK,CAACH,QAAQ,GAAGwB;IACvB,OAAOZ;AACT,EAAE;AAWK,MAAMqC,0BAA0B,CACrC7D,OACAC;IAEA,MAAM6D,uBAAmB3E,gDAAAA,EAAoCiB,CAAAA,MAAOA,IAAI2D,KAAK;IAE7E,MAAM,EAAEA,QAAQD,gBAAgB,EAAE,GAAGE,WAAW,GAAGhE;IAEnD,MAAMwB,QAA0B;QAC9B,GAAGzB,4BAA4BiE,WAAW/D,IAAI;QAC9C8D;IACF;IAEA,OAAOvC;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ColorSlider/useColorSlider.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport {\n getPartitionedNativeProps,\n getPercentInRange,\n useId,\n slot,\n useControllableState,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { colorSliderCSSVars } from './ColorSlider.constants';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport type {\n ColorSliderBaseProps,\n ColorSliderBaseState,\n ColorSliderProps,\n ColorSliderState,\n} from './ColorSlider.types';\nimport { useColorPickerContextValue_unstable } from '../../contexts/colorPicker';\nimport { MIN, HUE_MAX, MAX as COLOR_MAX } from '../../utils/constants';\nimport { createHsvColor } from '../../utils/createHsvColor';\nimport { clampValue, type ChannelActions, adjustChannel } from '../../utils/adjustChannel';\nimport type { HsvColor } from '../../types/color';\nimport { INITIAL_COLOR_HSV } from '../../utils/constants';\nimport { createHslColor, createHslColorString } from '../../utils/createHslColor';\n\n/**\n * Create the base state required to render unstyled ColorSlider.\n *\n * The returned state can be modified with hooks before being passed to renderColorSlider_unstable.\n *\n * @param props - props from this instance of ColorSlider\n * @param ref - reference to root HTMLInputElement of ColorSlider\n */\nexport const useColorSliderBase_unstable = (\n props: ColorSliderBaseProps,\n ref: React.Ref<HTMLInputElement>,\n): ColorSliderBaseState => {\n 'use no memo'; // justified: compiler would optimize useColorSlider_unstable — manual opt-out to preserve runtime behavior\n\n const { dir } = useFluent();\n const onChangeFromContext = useColorPickerContextValue_unstable(ctx => ctx.requestChange);\n const colorFromContext = useColorPickerContextValue_unstable(ctx => ctx.color);\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['onChange', 'color'],\n });\n\n const {\n color,\n channel = 'hue',\n onChange = onChangeFromContext,\n vertical,\n // Slots\n root,\n input,\n rail,\n thumb,\n } = props;\n\n const hslColor = createHslColor(color || colorFromContext);\n const [currentColor, setCurrentColor] = useControllableState<HsvColor>({\n defaultState: props.defaultColor,\n state: color || colorFromContext,\n initialState: INITIAL_COLOR_HSV,\n });\n\n const MAX = channel === 'hue' ? HUE_MAX : COLOR_MAX;\n\n const valueChannelActions: ChannelActions<number> = {\n hue: clampValue(currentColor.h),\n saturation: clampValue(currentColor.s * 100),\n value: clampValue(currentColor.v * 100),\n };\n\n const clampedValue = adjustChannel(channel, valueChannelActions);\n const valuePercent = getPercentInRange(clampedValue, MIN, MAX);\n\n const inputOnChange = input?.onChange;\n\n const _onChange: React.ChangeEventHandler<HTMLInputElement> = useEventCallback(event => {\n const newValue = Number(event.target.value);\n const colorActions: ChannelActions<() => HsvColor> = {\n hue: () => createHsvColor({ ...currentColor, h: newValue }),\n saturation: () => createHsvColor({ ...currentColor, s: newValue / 100 }),\n value: () => createHsvColor({ ...currentColor, v: newValue / 100 }),\n };\n const newColor = adjustChannel(channel, colorActions)();\n\n setCurrentColor(newColor);\n\n inputOnChange?.(event);\n onChange?.(event, {\n type: 'change',\n event,\n color: newColor,\n });\n });\n\n const rootVariables = {\n [colorSliderCSSVars.sliderDirectionVar]: vertical ? '180deg' : dir === 'ltr' ? '-90deg' : '90deg',\n [colorSliderCSSVars.sliderProgressVar]: `${valuePercent}%`,\n [colorSliderCSSVars.thumbColorVar]:\n channel === 'hue' ? `hsl(${clampedValue}, 100%, 50%)` : createHslColorString(currentColor),\n [colorSliderCSSVars.railColorVar]:\n channel === 'hue'\n ? `hsl(${hslColor.h}, ${hslColor.s * 100}%, ${hslColor.l * 100}%)`\n : createHslColorString({\n ...currentColor,\n ...(channel === 'saturation' ? { s: 1 } : { v: 1 }),\n a: 1,\n }),\n ...(channel !== 'hue' && {\n [colorSliderCSSVars.railColorLowVar]: createHslColorString({\n ...currentColor,\n ...(channel === 'saturation' ? { s: 0 } : { v: 0 }),\n a: 1,\n }),\n }),\n };\n\n const state: ColorSliderBaseState = {\n vertical,\n channel,\n components: {\n input: 'input',\n rail: 'div',\n root: 'div',\n thumb: 'div',\n },\n root: slot.always(root, {\n defaultProps: {\n role: 'group',\n ...nativeProps.root,\n },\n elementType: 'div',\n }),\n input: slot.always(input, {\n defaultProps: {\n id: useId('slider-', props.id),\n ref,\n min: MIN,\n max: MAX,\n tabIndex: 0,\n ['aria-orientation']: vertical ? 'vertical' : 'horizontal',\n ...nativeProps.primary,\n type: 'range',\n },\n elementType: 'input',\n }),\n rail: slot.always(rail, { elementType: 'div' }),\n thumb: slot.always(thumb, { elementType: 'div' }),\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 return state;\n};\n\n/**\n * Create the state required to render ColorSlider.\n *\n * The returned state can be modified with hooks such as useColorSliderStyles_unstable,\n * before being passed to renderColorSlider_unstable.\n *\n * @param props - props from this instance of ColorSlider\n * @param ref - reference to root HTMLInputElement of ColorSlider\n */\nexport const useColorSlider_unstable = (\n props: ColorSliderProps,\n ref: React.Ref<HTMLInputElement>,\n): ColorSliderState => {\n const shapeFromContext = useColorPickerContextValue_unstable(ctx => ctx.shape);\n\n const { shape = shapeFromContext, ...baseProps } = props;\n\n const state: ColorSliderState = {\n ...useColorSliderBase_unstable(baseProps, ref),\n shape,\n };\n\n return state;\n};\n"],"names":["getPartitionedNativeProps","getPercentInRange","useId","slot","useControllableState","useEventCallback","colorSliderCSSVars","useFluent_unstable","useFluent","useColorPickerContextValue_unstable","MIN","HUE_MAX","MAX","COLOR_MAX","createHsvColor","clampValue","adjustChannel","INITIAL_COLOR_HSV","createHslColor","createHslColorString","useColorSliderBase_unstable","props","ref","dir","onChangeFromContext","ctx","requestChange","colorFromContext","color","nativeProps","primarySlotTagName","excludedPropNames","channel","onChange","vertical","root","input","rail","thumb","hslColor","currentColor","setCurrentColor","defaultState","defaultColor","state","initialState","valueChannelActions","hue","h","saturation","s","value","v","clampedValue","valuePercent","inputOnChange","_onChange","event","newValue","Number","target","colorActions","newColor","type","rootVariables","sliderDirectionVar","sliderProgressVar","thumbColorVar","railColorVar","l","a","railColorLowVar","components","always","defaultProps","role","elementType","id","min","max","tabIndex","primary","style","useColorSlider_unstable","shapeFromContext","shape","baseProps"],"mappings":"AAAA;;;;;;;;;;;;QAmCaoB;;;QA8IA+D;;;;gCAvKN,4BAA4B;sCACA,6BAA0B;qCACb,kCAAkC;6BAO9B,gCAA6B;2BAClC,2BAAwB;gCACxC,gCAA6B;+BACG,+BAA4B;gCAGtC,gCAA6B;AAU3E,oCAAoC,CACzC9D,OACAC;IAEA,eAAe,2GAA2G;IAE1H,MAAM,EAAEC,GAAG,EAAE,OAAGf,uCAAAA;IAChB,MAAMgB,0BAAsBf,gDAAAA,EAAoCgB,CAAAA,MAAOA,IAAIC,aAAa;IACxF,MAAMC,uBAAmBlB,gDAAAA,EAAoCgB,CAAAA,MAAOA,IAAIG,KAAK;IAC7E,MAAMC,kBAAc7B,yCAAAA,EAA0B;QAC5CqB;QACAS,oBAAoB;QACpBC,mBAAmB;YAAC;YAAY;SAAQ;IAC1C;IAEA,MAAM,EACJH,KAAK,EACLI,UAAU,KAAK,EACfC,WAAWT,mBAAmB,EAC9BU,QAAQ,EACR,AACAC,IAAI,EACJC,EAFQ,GAEH,E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,OAAO;YACxBsC,cAAc;gBACZG,QAAI3E,qBAAAA,EAAM,WAAWmB,MAAMwD,EAAE;gBAC7BvD;gBACAwD,KAAKpE,cAAAA;gBACLqE,KAAKnE;gBACLoE,UAAU;gBACV,CAAC,mBAAmB,EAAE9C,WAAW,aAAa;gBAC9C,GAAGL,YAAYoD,OAAO;gBACtBlB,MAAM;YACR;YACAa,aAAa;QACf;QACAvC,MAAMlC,oBAAAA,CAAKsE,MAAM,CAACpC,MAAM;YAAEuC,aAAa;QAAM;QAC7CtC,OAAOnC,oBAAAA,CAAKsE,MAAM,CAACnC,OAAO;YAAEsC,aAAa;QAAM;IACjD;IAEA,aAAa;IACbhC,MAAMT,IAAI,CAAC+C,KAAK,GAAG;QACjB,GAAGlB,aAAa;QAChB,GAAGpB,MAAMT,IAAI,CAAC+C,KAAK;IACrB;IAEA,cAAc;IACdtC,MAAMR,KAAK,CAACe,KAAK,GAAGE;IACpBT,MAAMR,KAAK,CAACH,QAAQ,GAAGuB;IACvB,OAAOZ;AACT,EAAE;AAWK,gCAAgC,CACrCvB,OACAC;IAEA,MAAM8D,uBAAmB3E,gDAAAA,EAAoCgB,CAAAA,MAAOA,IAAI4D,KAAK;IAE7E,MAAM,EAAEA,QAAQD,gBAAgB,EAAE,GAAGE,WAAW,GAAGjE;IAEnD,MAAMuB,QAA0B;QAC9B,GAAGxB,4BAA4BkE,WAAWhE,IAAI;QAC9C+D;IACF;IAEA,OAAOzC;AACT,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
colorSliderClassNames
|
|
13
|
+
get colorSliderClassNames () {
|
|
14
14
|
return colorSliderClassNames;
|
|
15
15
|
},
|
|
16
|
-
useColorSliderStyles_unstable
|
|
16
|
+
get useColorSliderStyles_unstable () {
|
|
17
17
|
return useColorSliderStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -25,7 +25,7 @@ const colorSliderClassNames = {
|
|
|
25
25
|
thumb: 'fui-ColorSlider__thumb',
|
|
26
26
|
input: 'fui-ColorSlider__input'
|
|
27
27
|
};
|
|
28
|
-
const hueBackground = `linear-gradient(${[
|
|
28
|
+
const hueBackground = `linear-gradient(${/*#__PURE__*/ [
|
|
29
29
|
`var(${_ColorSliderconstants.colorSliderCSSVars.sliderDirectionVar})`,
|
|
30
30
|
'red',
|
|
31
31
|
'fuchsia',
|
|
@@ -35,6 +35,7 @@ const hueBackground = `linear-gradient(${[
|
|
|
35
35
|
'yellow',
|
|
36
36
|
'red'
|
|
37
37
|
].join(',')})`;
|
|
38
|
+
const channelBackground = `linear-gradient(var(${_ColorSliderconstants.colorSliderCSSVars.sliderDirectionVar}), var(${_ColorSliderconstants.colorSliderCSSVars.railColorVar}), var(${_ColorSliderconstants.colorSliderCSSVars.railColorLowVar}))`;
|
|
38
39
|
/**
|
|
39
40
|
* Styles for the root slot
|
|
40
41
|
*/ const useRootStyles = /*#__PURE__*/ (0, _react.__resetStyles)("r1j9hj9j", null, [
|
|
@@ -66,24 +67,15 @@ const useChannelStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
|
66
67
|
Bcmaq0h: "f1curpo1"
|
|
67
68
|
},
|
|
68
69
|
saturation: {
|
|
69
|
-
Bcmaq0h:
|
|
70
|
-
"fdhcg5e",
|
|
71
|
-
"f1onqon0"
|
|
72
|
-
]
|
|
70
|
+
Bcmaq0h: "f1vl4pgh"
|
|
73
71
|
},
|
|
74
72
|
value: {
|
|
75
|
-
Bcmaq0h:
|
|
76
|
-
"f1r1ueul",
|
|
77
|
-
"fbtriqu"
|
|
78
|
-
]
|
|
73
|
+
Bcmaq0h: "f1vl4pgh"
|
|
79
74
|
}
|
|
80
75
|
}, {
|
|
81
76
|
d: [
|
|
82
77
|
".f1curpo1{background-image:linear-gradient(var(--fui-Slider--direction),red,fuchsia,blue,aqua,lime,yellow,red);}",
|
|
83
|
-
".
|
|
84
|
-
".f1onqon0{background-image:linear-gradient(to left, #808080, var(--fui-Slider__rail--color));}",
|
|
85
|
-
".f1r1ueul{background-image:linear-gradient(to right, #000, var(--fui-Slider__rail--color));}",
|
|
86
|
-
".fbtriqu{background-image:linear-gradient(to left, #000, var(--fui-Slider__rail--color));}"
|
|
78
|
+
".f1vl4pgh{background-image:linear-gradient(var(--fui-Slider--direction), var(--fui-Slider__rail--color), var(--fui-Slider__rail--color-low));}"
|
|
87
79
|
]
|
|
88
80
|
});
|
|
89
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useColorSliderStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, makeResetStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { colorSliderCSSVars } from \"./ColorSlider.constants.js\";\nexport const colorSliderClassNames = {\n root: 'fui-ColorSlider',\n rail: 'fui-ColorSlider__rail',\n thumb: 'fui-ColorSlider__thumb',\n input: 'fui-ColorSlider__input'\n};\nconst hueBackground = `linear-gradient(${[\n `var(${colorSliderCSSVars.sliderDirectionVar})`,\n 'red',\n 'fuchsia',\n 'blue',\n 'aqua',\n 'lime',\n 'yellow',\n 'red'\n].join(',')})`;\n/**\n * Styles for the root slot\n */ const useRootStyles = makeResetStyles({\n position: 'relative',\n display: 'inline-grid',\n touchAction: 'none',\n alignItems: 'center',\n justifyItems: 'center',\n [colorSliderCSSVars.thumbSizeVar]: '20px',\n [colorSliderCSSVars.railSizeVar]: '20px',\n minHeight: '32px'\n});\nconst useStyles = makeStyles({\n horizontal: {\n minWidth: '200px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`,\n gridTemplateColumns: `1fr 100% 1fr`\n },\n vertical: {\n minHeight: '280px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr 100% 1fr`,\n gridTemplateColumns: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`\n }\n});\nconst useChannelStyles = makeStyles({\n hue: {\n backgroundImage: hueBackground\n },\n saturation: {\n backgroundImage: `linear-gradient(to right, #808080, var(${colorSliderCSSVars.railColorVar}))`\n },\n value: {\n backgroundImage: `linear-gradient(to right, #000, var(${colorSliderCSSVars.railColorVar}))`\n }\n});\n/**\n * Styles for the rail slot\n */ const useRailStyles = makeStyles({\n rail: {\n pointerEvents: 'none',\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'relative',\n forcedColorAdjust: 'none',\n outlineWidth: '1px',\n outlineStyle: 'solid',\n outlineColor: tokens.colorTransparentStroke,\n '::before': {\n content: \"''\",\n position: 'absolute'\n }\n },\n horizontal: {\n width: '100%',\n height: `var(${colorSliderCSSVars.railSizeVar})`,\n '::before': {\n left: '-1px',\n right: '-1px',\n height: `var(${colorSliderCSSVars.railSizeVar})`\n }\n },\n vertical: {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n height: '100%',\n '::before': {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n top: '-1px',\n bottom: '1px'\n }\n }\n});\n/**\n * Styles for the thumb slot\n */ const useThumbStyles = makeStyles({\n thumb: {\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'absolute',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n pointerEvents: 'none',\n outlineStyle: 'none',\n forcedColorAdjust: 'none',\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForeground4}`,\n boxShadow: tokens.shadow4,\n backgroundColor: `var(${colorSliderCSSVars.thumbColorVar})`,\n '::before': {\n position: 'absolute',\n inset: '0px',\n borderRadius: tokens.borderRadiusCircular,\n boxSizing: 'border-box',\n content: \"''\",\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralBackground1}`\n }\n },\n horizontal: {\n transform: 'translateX(-50%)',\n left: `var(${colorSliderCSSVars.sliderProgressVar})`\n },\n vertical: {\n transform: 'translateY(50%)',\n bottom: `var(${colorSliderCSSVars.sliderProgressVar})`\n }\n});\nconst useShapeStyles = makeStyles({\n rounded: {\n borderRadius: tokens.borderRadiusMedium\n },\n square: {\n borderRadius: tokens.borderRadiusNone\n }\n});\n/**\n * Styles for the Input slot\n */ const useInputStyles = makeStyles({\n input: {\n cursor: 'pointer',\n opacity: 0,\n gridRowStart: '1',\n gridRowEnd: '-1',\n gridColumnStart: '1',\n gridColumnEnd: '-1',\n padding: '0',\n margin: '0',\n [`:focus-visible ~ .${colorSliderClassNames.thumb}`]: {\n border: `2px solid ${tokens.colorStrokeFocus2}`,\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusCircular\n }\n },\n horizontal: {\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n width: '100%'\n },\n vertical: {\n height: '100%',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n 'writing-mode': 'vertical-lr',\n direction: 'rtl'\n }\n});\n/**\n * Apply styling to the ColorSlider slots based on the state\n */ export const useColorSliderStyles_unstable = (state)=>{\n const rootStyles = useRootStyles();\n const styles = useStyles();\n const railStyles = useRailStyles();\n const thumbStyles = useThumbStyles();\n const inputStyles = useInputStyles();\n const shapeStyles = useShapeStyles();\n const channelStyles = useChannelStyles();\n const isVertical = state.vertical;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(colorSliderClassNames.root, rootStyles, isVertical ? styles.vertical : styles.horizontal, state.root.className);\n // eslint-disable-next-line react-hooks/immutability\n state.rail.className = mergeClasses(colorSliderClassNames.rail, railStyles.rail, channelStyles[state.channel || 'hue'], shapeStyles[state.shape || 'rounded'], isVertical ? railStyles.vertical : railStyles.horizontal, state.rail.className);\n // eslint-disable-next-line react-hooks/immutability\n state.thumb.className = mergeClasses(colorSliderClassNames.thumb, thumbStyles.thumb, isVertical ? thumbStyles.vertical : thumbStyles.horizontal, state.thumb.className);\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(colorSliderClassNames.input, inputStyles.input, isVertical ? inputStyles.vertical : inputStyles.horizontal, state.input.className);\n return state;\n};\n"],"names":["__styles","__resetStyles","mergeClasses","tokens","colorSliderCSSVars","colorSliderClassNames","root","rail","thumb","input","hueBackground","sliderDirectionVar","join","useRootStyles","useStyles","horizontal","Bf4jedk","wkccdc","Budl1dq","vertical","sshi5w","d","useChannelStyles","hue","Bcmaq0h","saturation","value","useRailStyles","Bkecrkj","Ijaq50","nk6f5a","Br312pm","Bw0ie65","qhf8xq","Bvjb7m6","Bpd4iqm","oeaueh","Bw0xxkn","Ftih45","Brfgrao","a9b677","Bqenvij","Fbdkly","mdwyqc","Baz25je","Ccq8qp","Bciustq","lawp4y","useThumbStyles","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","E5pizo","De3pzq","gc50h5","r59vdv","Budzafs","ck0cow","n07z76","Gng75u","Bcvre1j","Bcgcnre","Bqjgrrk","qa3bma","y0oebl","Biqmznv","Bm6vgfq","Bbv0w2i","uvfttm","eqrjj","Bk5zm6e","m598lv","B4f6apu","ydt019","Bq4z7u6","Bdkvgpv","B0qfbqy","kj8mxx","Bz10aip","oyh7mz","B5kzvoi","p","useShapeStyles","rounded","square","useInputStyles","Bceei9c","abs64n","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","jrapky","Frg6f3","t21cq0","B6of3ja","B74szlk","jo39rj","C5zqim","Bdlbwnu","B8rk77i","Bbzx7hc","Hwkvcz","B0nnt1c","Brwsv5j","B2b7vog","B4hmq5e","B8jxwem","B18nadz","Ddg5ig","Byj09el","Dac2s3","Dd2y6r","Bk0t58e","Ewenww","Brqi8qb","zz3kca","low6xx","d0s10n","wea7l5","olu5tv","g5nsvh","Bqvnfwh","Biqzhck","kgocjf","i","useColorSliderStyles_unstable","state","rootStyles","styles","railStyles","thumbStyles","inputStyles","shapeStyles","channelStyles","isVertical","className","channel","shape"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAICK,qBAAqB;;;iCAsKY;eAA7B6I;;;uBAzKyC,gBAAgB;sCAEvC,4BAA4B;AACxD,8BAA8B;IACjC5I,IAAI,EAAE,iBAAiB;IACvBC,IAAI,EAAE,uBAAuB;IAC7BC,KAAK,EAAE,wBAAwB;IAC/BC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,aAAa,GAAG,CAAA,gBAAA,EAAmB;IACrC,CAAA,IAAA,EAAON,wCAAkB,CAACO,kBAAkB,CAAA,CAAA,CAAG;IAC/C,KAAK;IACL,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,KAAK;CACR,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAA,CAAG;AACd;;CAEA,GAAI,MAAMC,aAAa,GAAA,WAAA,OAAGZ,oBAAA,EAAA,YAAA,MAAA;IAAA;CASzB,CAAC;AACF,MAAMa,SAAS,GAAA,WAAA,OAAGd,eAAA,EAAA;IAAAe,UAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,QAAA,EAAA;QAAAC,MAAA,EAAA;QAAAH,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAG,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA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,OAAG1J,mBAAY,EAACG,qBAAqB,CAACG,KAAK,EAAE+I,WAAW,CAAC/I,KAAK,EAAEmJ,UAAU,GAAGJ,WAAW,CAACpI,QAAQ,GAAGoI,WAAW,CAACxI,UAAU,EAAEoI,KAAK,CAAC3I,KAAK,CAACoJ,SAAS,CAAC;IACvK,oDAAA;IACAT,KAAK,CAAC1I,KAAK,CAACmJ,SAAS,OAAG1J,mBAAY,EAACG,qBAAqB,CAACI,KAAK,EAAE+I,WAAW,CAAC/I,KAAK,EAAEkJ,UAAU,GAAGH,WAAW,CAACrI,QAAQ,GAAGqI,WAAW,CAACzI,UAAU,EAAEoI,KAAK,CAAC1I,KAAK,CAACmJ,SAAS,CAAC;IACvK,OAAOT,KAAK;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["useColorSliderStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, makeResetStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { colorSliderCSSVars } from \"./ColorSlider.constants.js\";\nexport const colorSliderClassNames = {\n root: 'fui-ColorSlider',\n rail: 'fui-ColorSlider__rail',\n thumb: 'fui-ColorSlider__thumb',\n input: 'fui-ColorSlider__input'\n};\nconst hueBackground = `linear-gradient(${[\n `var(${colorSliderCSSVars.sliderDirectionVar})`,\n 'red',\n 'fuchsia',\n 'blue',\n 'aqua',\n 'lime',\n 'yellow',\n 'red'\n].join(',')})`;\nconst channelBackground = `linear-gradient(var(${colorSliderCSSVars.sliderDirectionVar}), var(${colorSliderCSSVars.railColorVar}), var(${colorSliderCSSVars.railColorLowVar}))`;\n/**\n * Styles for the root slot\n */ const useRootStyles = makeResetStyles({\n position: 'relative',\n display: 'inline-grid',\n touchAction: 'none',\n alignItems: 'center',\n justifyItems: 'center',\n [colorSliderCSSVars.thumbSizeVar]: '20px',\n [colorSliderCSSVars.railSizeVar]: '20px',\n minHeight: '32px'\n});\nconst useStyles = makeStyles({\n horizontal: {\n minWidth: '200px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`,\n gridTemplateColumns: `1fr 100% 1fr`\n },\n vertical: {\n minHeight: '280px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr 100% 1fr`,\n gridTemplateColumns: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`\n }\n});\nconst useChannelStyles = makeStyles({\n hue: {\n backgroundImage: hueBackground\n },\n saturation: {\n backgroundImage: channelBackground\n },\n value: {\n backgroundImage: channelBackground\n }\n});\n/**\n * Styles for the rail slot\n */ const useRailStyles = makeStyles({\n rail: {\n pointerEvents: 'none',\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'relative',\n forcedColorAdjust: 'none',\n outlineWidth: '1px',\n outlineStyle: 'solid',\n outlineColor: tokens.colorTransparentStroke,\n '::before': {\n content: \"''\",\n position: 'absolute'\n }\n },\n horizontal: {\n width: '100%',\n height: `var(${colorSliderCSSVars.railSizeVar})`,\n '::before': {\n left: '-1px',\n right: '-1px',\n height: `var(${colorSliderCSSVars.railSizeVar})`\n }\n },\n vertical: {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n height: '100%',\n '::before': {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n top: '-1px',\n bottom: '1px'\n }\n }\n});\n/**\n * Styles for the thumb slot\n */ const useThumbStyles = makeStyles({\n thumb: {\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'absolute',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n pointerEvents: 'none',\n outlineStyle: 'none',\n forcedColorAdjust: 'none',\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForeground4}`,\n boxShadow: tokens.shadow4,\n backgroundColor: `var(${colorSliderCSSVars.thumbColorVar})`,\n '::before': {\n position: 'absolute',\n inset: '0px',\n borderRadius: tokens.borderRadiusCircular,\n boxSizing: 'border-box',\n content: \"''\",\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralBackground1}`\n }\n },\n horizontal: {\n transform: 'translateX(-50%)',\n left: `var(${colorSliderCSSVars.sliderProgressVar})`\n },\n vertical: {\n transform: 'translateY(50%)',\n bottom: `var(${colorSliderCSSVars.sliderProgressVar})`\n }\n});\nconst useShapeStyles = makeStyles({\n rounded: {\n borderRadius: tokens.borderRadiusMedium\n },\n square: {\n borderRadius: tokens.borderRadiusNone\n }\n});\n/**\n * Styles for the Input slot\n */ const useInputStyles = makeStyles({\n input: {\n cursor: 'pointer',\n opacity: 0,\n gridRowStart: '1',\n gridRowEnd: '-1',\n gridColumnStart: '1',\n gridColumnEnd: '-1',\n padding: '0',\n margin: '0',\n [`:focus-visible ~ .${colorSliderClassNames.thumb}`]: {\n border: `2px solid ${tokens.colorStrokeFocus2}`,\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusCircular\n }\n },\n horizontal: {\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n width: '100%'\n },\n vertical: {\n height: '100%',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n 'writing-mode': 'vertical-lr',\n direction: 'rtl'\n }\n});\n/**\n * Apply styling to the ColorSlider slots based on the state\n */ export const useColorSliderStyles_unstable = (state)=>{\n const rootStyles = useRootStyles();\n const styles = useStyles();\n const railStyles = useRailStyles();\n const thumbStyles = useThumbStyles();\n const inputStyles = useInputStyles();\n const shapeStyles = useShapeStyles();\n const channelStyles = useChannelStyles();\n const isVertical = state.vertical;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(colorSliderClassNames.root, rootStyles, isVertical ? styles.vertical : styles.horizontal, state.root.className);\n // eslint-disable-next-line react-hooks/immutability\n state.rail.className = mergeClasses(colorSliderClassNames.rail, railStyles.rail, channelStyles[state.channel || 'hue'], shapeStyles[state.shape || 'rounded'], isVertical ? railStyles.vertical : railStyles.horizontal, state.rail.className);\n // eslint-disable-next-line react-hooks/immutability\n state.thumb.className = mergeClasses(colorSliderClassNames.thumb, thumbStyles.thumb, isVertical ? thumbStyles.vertical : thumbStyles.horizontal, state.thumb.className);\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(colorSliderClassNames.input, inputStyles.input, isVertical ? inputStyles.vertical : inputStyles.horizontal, state.input.className);\n return state;\n};\n"],"names":["__styles","__resetStyles","mergeClasses","tokens","colorSliderCSSVars","colorSliderClassNames","root","rail","thumb","input","hueBackground","sliderDirectionVar","join","channelBackground","railColorVar","railColorLowVar","useRootStyles","useStyles","horizontal","Bf4jedk","wkccdc","Budl1dq","vertical","sshi5w","d","useChannelStyles","hue","Bcmaq0h","saturation","value","useRailStyles","Bkecrkj","Ijaq50","nk6f5a","Br312pm","Bw0ie65","qhf8xq","Bvjb7m6","Bpd4iqm","oeaueh","Bw0xxkn","Ftih45","Brfgrao","a9b677","Bqenvij","Fbdkly","mdwyqc","Baz25je","Ccq8qp","Bciustq","lawp4y","useThumbStyles","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","E5pizo","De3pzq","gc50h5","r59vdv","Budzafs","ck0cow","n07z76","Gng75u","Bcvre1j","Bcgcnre","Bqjgrrk","qa3bma","y0oebl","Biqmznv","Bm6vgfq","Bbv0w2i","uvfttm","eqrjj","Bk5zm6e","m598lv","B4f6apu","ydt019","Bq4z7u6","Bdkvgpv","B0qfbqy","kj8mxx","Bz10aip","oyh7mz","B5kzvoi","p","useShapeStyles","rounded","square","useInputStyles","Bceei9c","abs64n","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","jrapky","Frg6f3","t21cq0","B6of3ja","B74szlk","jo39rj","C5zqim","Bdlbwnu","B8rk77i","Bbzx7hc","Hwkvcz","B0nnt1c","Brwsv5j","B2b7vog","B4hmq5e","B8jxwem","B18nadz","Ddg5ig","Byj09el","Dac2s3","Dd2y6r","Bk0t58e","Ewenww","Brqi8qb","zz3kca","low6xx","d0s10n","wea7l5","olu5tv","g5nsvh","Bqvnfwh","Biqzhck","kgocjf","i","useColorSliderStyles_unstable","state","rootStyles","styles","railStyles","thumbStyles","inputStyles","shapeStyles","channelStyles","isVertical","className","channel","shape"],"mappings":"AAAA,YAAY;;;;;;;;;;;;QAICK,qBAAqB;;;;eAuKjBgJ,6BAA6B;;;uBA1KY,gBAAgB;sCAEvC,4BAA4B;AACxD,8BAA8B;IACjC/I,IAAI,EAAE,iBAAiB;IACvBC,IAAI,EAAE,uBAAuB;IAC7BC,KAAK,EAAE,wBAAwB;IAC/BC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,aAAa,GAAG,CAAA,gBAAA,EAAA,WAAA,GAAmB;IACrC,CAAA,IAAA,EAAON,wCAAkB,CAACO,kBAAkB,CAAA,CAAA,CAAG;IAC/C,KAAK;IACL,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,KAAK;CACR,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAA,CAAG;AACd,MAAMC,iBAAiB,GAAG,CAAA,oBAAA,EAAuBT,wCAAkB,CAACO,kBAAkB,CAAA,OAAA,EAAUP,wCAAkB,CAACU,YAAY,CAAA,OAAA,EAAUV,wCAAkB,CAACW,eAAe,CAAA,EAAA,CAAI;AAC/K;;CAEA,GAAI,MAAMC,aAAa,GAAA,WAAA,OAAGf,oBAAA,EAAA,YAAA,MAAA;IAAA;CASzB,CAAC;AACF,MAAMgB,SAAS,GAAA,WAAA,GAAGjB,mBAAA,EAAA;IAAAkB,U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EAAEH,UAAU,GAAGL,UAAU,CAACnI,QAAQ,GAAGmI,UAAU,CAACvI,UAAU,EAAEoI,KAAK,CAAC/I,IAAI,CAACwJ,SAAS,CAAC;IAC9O,oDAAA;IACAT,KAAK,CAAC9I,KAAK,CAACuJ,SAAS,OAAG7J,mBAAY,EAACG,qBAAqB,CAACG,KAAK,EAAEkJ,WAAW,CAAClJ,KAAK,EAAEsJ,UAAU,GAAGJ,WAAW,CAACpI,QAAQ,GAAGoI,WAAW,CAACxI,UAAU,EAAEoI,KAAK,CAAC9I,KAAK,CAACuJ,SAAS,CAAC;IACvK,oDAAA;IACAT,KAAK,CAAC7I,KAAK,CAACsJ,SAAS,OAAG7J,mBAAY,EAACG,qBAAqB,CAACI,KAAK,EAAEkJ,WAAW,CAAClJ,KAAK,EAAEqJ,UAAU,GAAGH,WAAW,CAACrI,QAAQ,GAAGqI,WAAW,CAACzI,UAAU,EAAEoI,KAAK,CAAC7I,KAAK,CAACsJ,SAAS,CAAC;IACvK,OAAOT,KAAK;AAChB,CAAC"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
colorSliderClassNames
|
|
13
|
+
get colorSliderClassNames () {
|
|
14
14
|
return colorSliderClassNames;
|
|
15
15
|
},
|
|
16
|
-
useColorSliderStyles_unstable
|
|
16
|
+
get useColorSliderStyles_unstable () {
|
|
17
17
|
return useColorSliderStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -36,6 +36,7 @@ const hueBackground = `linear-gradient(${[
|
|
|
36
36
|
'yellow',
|
|
37
37
|
'red'
|
|
38
38
|
].join(',')})`;
|
|
39
|
+
const channelBackground = `linear-gradient(var(${_ColorSliderconstants.colorSliderCSSVars.sliderDirectionVar}), var(${_ColorSliderconstants.colorSliderCSSVars.railColorVar}), var(${_ColorSliderconstants.colorSliderCSSVars.railColorLowVar}))`;
|
|
39
40
|
/**
|
|
40
41
|
* Styles for the root slot
|
|
41
42
|
*/ const useRootStyles = (0, _react.makeResetStyles)({
|
|
@@ -67,10 +68,10 @@ const useChannelStyles = (0, _react.makeStyles)({
|
|
|
67
68
|
backgroundImage: hueBackground
|
|
68
69
|
},
|
|
69
70
|
saturation: {
|
|
70
|
-
backgroundImage:
|
|
71
|
+
backgroundImage: channelBackground
|
|
71
72
|
},
|
|
72
73
|
value: {
|
|
73
|
-
backgroundImage:
|
|
74
|
+
backgroundImage: channelBackground
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
77
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ColorSlider/useColorSliderStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ColorSliderSlots, ColorSliderState } from './ColorSlider.types';\nimport { colorSliderCSSVars } from './ColorSlider.constants';\n\nexport const colorSliderClassNames: SlotClassNames<ColorSliderSlots> = {\n root: 'fui-ColorSlider',\n rail: 'fui-ColorSlider__rail',\n thumb: 'fui-ColorSlider__thumb',\n input: 'fui-ColorSlider__input',\n};\n\nconst hueBackground = `linear-gradient(${[\n `var(${colorSliderCSSVars.sliderDirectionVar})`,\n 'red',\n 'fuchsia',\n 'blue',\n 'aqua',\n 'lime',\n 'yellow',\n 'red',\n].join(',')})`;\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeResetStyles({\n position: 'relative',\n display: 'inline-grid',\n touchAction: 'none',\n alignItems: 'center',\n justifyItems: 'center',\n [colorSliderCSSVars.thumbSizeVar]: '20px',\n [colorSliderCSSVars.railSizeVar]: '20px',\n minHeight: '32px',\n});\n\nconst useStyles = makeStyles({\n horizontal: {\n minWidth: '200px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`,\n gridTemplateColumns: `1fr 100% 1fr`,\n },\n\n vertical: {\n minHeight: '280px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr 100% 1fr`,\n gridTemplateColumns: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`,\n },\n});\n\nconst useChannelStyles = makeStyles({\n hue: {\n backgroundImage: hueBackground,\n },\n saturation: {\n backgroundImage: `linear-gradient(to right, #808080, var(${colorSliderCSSVars.railColorVar}))`,\n },\n value: {\n backgroundImage: `linear-gradient(to right, #000, var(${colorSliderCSSVars.railColorVar}))`,\n },\n});\n\n/**\n * Styles for the rail slot\n */\nconst useRailStyles = makeStyles({\n rail: {\n pointerEvents: 'none',\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'relative',\n forcedColorAdjust: 'none',\n outlineWidth: '1px',\n outlineStyle: 'solid',\n outlineColor: tokens.colorTransparentStroke,\n '::before': {\n content: \"''\",\n position: 'absolute',\n },\n },\n\n horizontal: {\n width: '100%',\n height: `var(${colorSliderCSSVars.railSizeVar})`,\n '::before': {\n left: '-1px',\n right: '-1px',\n height: `var(${colorSliderCSSVars.railSizeVar})`,\n },\n },\n\n vertical: {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n height: '100%',\n '::before': {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n top: '-1px',\n bottom: '1px',\n },\n },\n});\n\n/**\n * Styles for the thumb slot\n */\nconst useThumbStyles = makeStyles({\n thumb: {\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'absolute',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n pointerEvents: 'none',\n outlineStyle: 'none',\n forcedColorAdjust: 'none',\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForeground4}`,\n boxShadow: tokens.shadow4,\n backgroundColor: `var(${colorSliderCSSVars.thumbColorVar})`,\n '::before': {\n position: 'absolute',\n inset: '0px',\n borderRadius: tokens.borderRadiusCircular,\n boxSizing: 'border-box',\n content: \"''\",\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralBackground1}`,\n },\n },\n horizontal: {\n transform: 'translateX(-50%)',\n left: `var(${colorSliderCSSVars.sliderProgressVar})`,\n },\n vertical: {\n transform: 'translateY(50%)',\n bottom: `var(${colorSliderCSSVars.sliderProgressVar})`,\n },\n});\n\nconst useShapeStyles = makeStyles({\n rounded: {\n borderRadius: tokens.borderRadiusMedium,\n },\n square: {\n borderRadius: tokens.borderRadiusNone,\n },\n});\n\n/**\n * Styles for the Input slot\n */\nconst useInputStyles = makeStyles({\n input: {\n cursor: 'pointer',\n opacity: 0,\n gridRowStart: '1',\n gridRowEnd: '-1',\n gridColumnStart: '1',\n gridColumnEnd: '-1',\n padding: '0',\n margin: '0',\n [`:focus-visible ~ .${colorSliderClassNames.thumb}`]: {\n border: `2px solid ${tokens.colorStrokeFocus2}`,\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusCircular,\n },\n },\n horizontal: {\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n width: '100%',\n },\n vertical: {\n height: '100%',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n 'writing-mode': 'vertical-lr',\n direction: 'rtl',\n },\n});\n\n/**\n * Apply styling to the ColorSlider slots based on the state\n */\nexport const useColorSliderStyles_unstable = (state: ColorSliderState): ColorSliderState => {\n const rootStyles = useRootStyles();\n const styles = useStyles();\n const railStyles = useRailStyles();\n const thumbStyles = useThumbStyles();\n const inputStyles = useInputStyles();\n const shapeStyles = useShapeStyles();\n const channelStyles = useChannelStyles();\n const isVertical = state.vertical;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n colorSliderClassNames.root,\n rootStyles,\n isVertical ? styles.vertical : styles.horizontal,\n state.root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.rail.className = mergeClasses(\n colorSliderClassNames.rail,\n railStyles.rail,\n channelStyles[state.channel || 'hue'],\n shapeStyles[state.shape || 'rounded'],\n isVertical ? railStyles.vertical : railStyles.horizontal,\n state.rail.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.thumb.className = mergeClasses(\n colorSliderClassNames.thumb,\n thumbStyles.thumb,\n isVertical ? thumbStyles.vertical : thumbStyles.horizontal,\n state.thumb.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(\n colorSliderClassNames.input,\n inputStyles.input,\n isVertical ? inputStyles.vertical : inputStyles.horizontal,\n state.input.className,\n );\n return state;\n};\n"],"names":["makeStyles","makeResetStyles","mergeClasses","tokens","colorSliderCSSVars","colorSliderClassNames","root","rail","thumb","input","hueBackground","sliderDirectionVar","join","useRootStyles","position","display","touchAction","alignItems","justifyItems","thumbSizeVar","railSizeVar","minHeight","useStyles","horizontal","minWidth","gridTemplateRows","gridTemplateColumns","vertical","useChannelStyles","hue","backgroundImage","saturation","railColorVar","value","useRailStyles","pointerEvents","gridRowStart","gridRowEnd","gridColumnStart","gridColumnEnd","forcedColorAdjust","outlineWidth","outlineStyle","outlineColor","colorTransparentStroke","content","width","height","left","right","top","bottom","useThumbStyles","borderRadius","borderRadiusCircular","border","strokeWidthThin","colorNeutralForeground4","boxShadow","shadow4","backgroundColor","thumbColorVar","inset","boxSizing","strokeWidthThick","colorNeutralBackground1","transform","sliderProgressVar","useShapeStyles","rounded","borderRadiusMedium","square","borderRadiusNone","useInputStyles","cursor","opacity","padding","margin","colorStrokeFocus2","outline","direction","useColorSliderStyles_unstable","state","rootStyles","styles","railStyles","thumbStyles","inputStyles","shapeStyles","channelStyles","isVertical","className","channel","shape"],"mappings":"AAAA;;;;;;;;;;;;yBAQaK;;;iCAuLA4E;eAAAA;;;uBA7L6C,iBAAiB;4BAEpD,wBAAwB;sCAEZ,6BAA0B;AAEtD,MAAM5E,wBAA0D;IACrEC,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,MAAMC,gBAAgB,CAAC,gBAAgB,EAAE;IACvC,CAAC,IAAI,EAAEN,wCAAAA,CAAmBO,kBAAkB,CAAC,CAAC,CAAC;IAC/C;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAACC,IAAI,CAAC,KAAK,CAAC,CAAC;AAEd;;CAEC,GACD,MAAMC,oBAAgBZ,sBAAAA,EAAgB;IACpCa,UAAU;IACVC,SAAS;IACTC,aAAa;IACbC,YAAY;IACZC,cAAc;IACd,CAACd,wCAAAA,CAAmBe,YAAY,CAAC,EAAE;IACnC,CAACf,wCAAAA,CAAmBgB,WAAW,CAAC,EAAE;IAClCC,WAAW;AACb;AAEA,MAAMC,gBAAYtB,iBAAAA,EAAW;IAC3BuB,YAAY;QACVC,UAAU;QACV,6GAA6G;QAC7GC,kBAAkB,CAAC,QAAQ,EAAErB,wCAAAA,CAAmBe,YAAY,CAAC,KAAK,CAAC;QACnEO,qBAAqB,CAAC,YAAY,CAAC;IACrC;IAEAC,UAAU;QACRN,WAAW;QACX,6GAA6G;QAC7GI,kBAAkB,CAAC,YAAY,CAAC;QAChCC,qBAAqB,CAAC,QAAQ,EAAEtB,wCAAAA,CAAmBe,YAAY,CAAC,KAAK,CAAC;IACxE;AACF;AAEA,MAAMS,uBAAmB5B,iBAAAA,EAAW;IAClC6B,KAAK;QACHC,iBAAiBpB;IACnB;IACAqB,YAAY;QACVD,iBAAiB,CAAC,uCAAuC,EAAE1B,wCAAAA,CAAmB4B,YAAY,CAAC,EAAE,CAAC;IAChG;IACAC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AsBI,KAAK,EAC3B8E,YAAY9E,KAAK,EACjBiF,aAAaH,YAAY5D,QAAQ,GAAG4D,YAAYhE,UAAU,EAC1D2D,MAAMzE,KAAK,CAACkF,SAAS;IAEvB,OAAOT;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ColorSlider/useColorSliderStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, makeResetStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ColorSliderSlots, ColorSliderState } from './ColorSlider.types';\nimport { colorSliderCSSVars } from './ColorSlider.constants';\n\nexport const colorSliderClassNames: SlotClassNames<ColorSliderSlots> = {\n root: 'fui-ColorSlider',\n rail: 'fui-ColorSlider__rail',\n thumb: 'fui-ColorSlider__thumb',\n input: 'fui-ColorSlider__input',\n};\n\nconst hueBackground = `linear-gradient(${[\n `var(${colorSliderCSSVars.sliderDirectionVar})`,\n 'red',\n 'fuchsia',\n 'blue',\n 'aqua',\n 'lime',\n 'yellow',\n 'red',\n].join(',')})`;\nconst channelBackground = `linear-gradient(var(${colorSliderCSSVars.sliderDirectionVar}), var(${colorSliderCSSVars.railColorVar}), var(${colorSliderCSSVars.railColorLowVar}))`;\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeResetStyles({\n position: 'relative',\n display: 'inline-grid',\n touchAction: 'none',\n alignItems: 'center',\n justifyItems: 'center',\n [colorSliderCSSVars.thumbSizeVar]: '20px',\n [colorSliderCSSVars.railSizeVar]: '20px',\n minHeight: '32px',\n});\n\nconst useStyles = makeStyles({\n horizontal: {\n minWidth: '200px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`,\n gridTemplateColumns: `1fr 100% 1fr`,\n },\n\n vertical: {\n minHeight: '280px',\n // 3x3 grid with the rail and thumb in the center cell [2,2] and the hidden input stretching across all cells\n gridTemplateRows: `1fr 100% 1fr`,\n gridTemplateColumns: `1fr var(${colorSliderCSSVars.thumbSizeVar}) 1fr`,\n },\n});\n\nconst useChannelStyles = makeStyles({\n hue: {\n backgroundImage: hueBackground,\n },\n saturation: {\n backgroundImage: channelBackground,\n },\n value: {\n backgroundImage: channelBackground,\n },\n});\n\n/**\n * Styles for the rail slot\n */\nconst useRailStyles = makeStyles({\n rail: {\n pointerEvents: 'none',\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'relative',\n forcedColorAdjust: 'none',\n outlineWidth: '1px',\n outlineStyle: 'solid',\n outlineColor: tokens.colorTransparentStroke,\n '::before': {\n content: \"''\",\n position: 'absolute',\n },\n },\n\n horizontal: {\n width: '100%',\n height: `var(${colorSliderCSSVars.railSizeVar})`,\n '::before': {\n left: '-1px',\n right: '-1px',\n height: `var(${colorSliderCSSVars.railSizeVar})`,\n },\n },\n\n vertical: {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n height: '100%',\n '::before': {\n width: `var(${colorSliderCSSVars.railSizeVar})`,\n top: '-1px',\n bottom: '1px',\n },\n },\n});\n\n/**\n * Styles for the thumb slot\n */\nconst useThumbStyles = makeStyles({\n thumb: {\n gridRowStart: '2',\n gridRowEnd: '2',\n gridColumnStart: '2',\n gridColumnEnd: '2',\n position: 'absolute',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n pointerEvents: 'none',\n outlineStyle: 'none',\n forcedColorAdjust: 'none',\n borderRadius: tokens.borderRadiusCircular,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralForeground4}`,\n boxShadow: tokens.shadow4,\n backgroundColor: `var(${colorSliderCSSVars.thumbColorVar})`,\n '::before': {\n position: 'absolute',\n inset: '0px',\n borderRadius: tokens.borderRadiusCircular,\n boxSizing: 'border-box',\n content: \"''\",\n border: `${tokens.strokeWidthThick} solid ${tokens.colorNeutralBackground1}`,\n },\n },\n horizontal: {\n transform: 'translateX(-50%)',\n left: `var(${colorSliderCSSVars.sliderProgressVar})`,\n },\n vertical: {\n transform: 'translateY(50%)',\n bottom: `var(${colorSliderCSSVars.sliderProgressVar})`,\n },\n});\n\nconst useShapeStyles = makeStyles({\n rounded: {\n borderRadius: tokens.borderRadiusMedium,\n },\n square: {\n borderRadius: tokens.borderRadiusNone,\n },\n});\n\n/**\n * Styles for the Input slot\n */\nconst useInputStyles = makeStyles({\n input: {\n cursor: 'pointer',\n opacity: 0,\n gridRowStart: '1',\n gridRowEnd: '-1',\n gridColumnStart: '1',\n gridColumnEnd: '-1',\n padding: '0',\n margin: '0',\n [`:focus-visible ~ .${colorSliderClassNames.thumb}`]: {\n border: `2px solid ${tokens.colorStrokeFocus2}`,\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorTransparentStroke}`,\n borderRadius: tokens.borderRadiusCircular,\n },\n },\n horizontal: {\n height: `var(${colorSliderCSSVars.thumbSizeVar})`,\n width: '100%',\n },\n vertical: {\n height: '100%',\n width: `var(${colorSliderCSSVars.thumbSizeVar})`,\n 'writing-mode': 'vertical-lr',\n direction: 'rtl',\n },\n});\n\n/**\n * Apply styling to the ColorSlider slots based on the state\n */\nexport const useColorSliderStyles_unstable = (state: ColorSliderState): ColorSliderState => {\n const rootStyles = useRootStyles();\n const styles = useStyles();\n const railStyles = useRailStyles();\n const thumbStyles = useThumbStyles();\n const inputStyles = useInputStyles();\n const shapeStyles = useShapeStyles();\n const channelStyles = useChannelStyles();\n const isVertical = state.vertical;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n colorSliderClassNames.root,\n rootStyles,\n isVertical ? styles.vertical : styles.horizontal,\n state.root.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.rail.className = mergeClasses(\n colorSliderClassNames.rail,\n railStyles.rail,\n channelStyles[state.channel || 'hue'],\n shapeStyles[state.shape || 'rounded'],\n isVertical ? railStyles.vertical : railStyles.horizontal,\n state.rail.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.thumb.className = mergeClasses(\n colorSliderClassNames.thumb,\n thumbStyles.thumb,\n isVertical ? thumbStyles.vertical : thumbStyles.horizontal,\n state.thumb.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.input.className = mergeClasses(\n colorSliderClassNames.input,\n inputStyles.input,\n isVertical ? inputStyles.vertical : inputStyles.horizontal,\n state.input.className,\n );\n return state;\n};\n"],"names":["makeStyles","makeResetStyles","mergeClasses","tokens","colorSliderCSSVars","colorSliderClassNames","root","rail","thumb","input","hueBackground","sliderDirectionVar","join","channelBackground","railColorVar","railColorLowVar","useRootStyles","position","display","touchAction","alignItems","justifyItems","thumbSizeVar","railSizeVar","minHeight","useStyles","horizontal","minWidth","gridTemplateRows","gridTemplateColumns","vertical","useChannelStyles","hue","backgroundImage","saturation","value","useRailStyles","pointerEvents","gridRowStart","gridRowEnd","gridColumnStart","gridColumnEnd","forcedColorAdjust","outlineWidth","outlineStyle","outlineColor","colorTransparentStroke","content","width","height","left","right","top","bottom","useThumbStyles","borderRadius","borderRadiusCircular","border","strokeWidthThin","colorNeutralForeground4","boxShadow","shadow4","backgroundColor","thumbColorVar","inset","boxSizing","strokeWidthThick","colorNeutralBackground1","transform","sliderProgressVar","useShapeStyles","rounded","borderRadiusMedium","square","borderRadiusNone","useInputStyles","cursor","opacity","padding","margin","colorStrokeFocus2","outline","direction","useColorSliderStyles_unstable","state","rootStyles","styles","railStyles","thumbStyles","inputStyles","shapeStyles","channelStyles","isVertical","className","channel","shape"],"mappings":"AAAA;;;;;;;;;;;;QAQaK;;;QAwLA8E;;;;uBA9L6C,iBAAiB;4BAEpD,wBAAwB;sCAEZ,6BAA0B;AAEtD,8BAAgE;IACrE7E,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,MAAMC,gBAAgB,CAAC,gBAAgB,EAAE;IACvC,CAAC,IAAI,E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5C,MAAMC,aAAarE;IACnB,MAAMsE,SAAS7D;IACf,MAAM8D,aAAanD;IACnB,MAAMoD,cAAclC;IACpB,MAAMmC,cAAcd;IACpB,MAAMe,cAAcpB;IACpB,MAAMqB,gBAAgB5D;IACtB,MAAM6D,aAAaR,MAAMtD,QAAQ;IAEjC,oDAAoD;IACpDsD,MAAM9E,IAAI,CAACuF,SAAS,GAAG3F,uBAAAA,EACrBG,sBAAsBC,IAAI,EAC1B+E,YACAO,aAAaN,OAAOxD,QAAQ,GAAGwD,OAAO5D,UAAU,EAChD0D,MAAM9E,IAAI,CAACuF,SAAS;IAGtB,oDAAoD;IACpDT,MAAM7E,IAAI,CAACsF,SAAS,OAAG3F,mBAAAA,EACrBG,sBAAsBE,IAAI,EAC1BgF,WAAWhF,IAAI,EACfoF,aAAa,CAACP,MAAMU,OAAO,IAAI,MAAM,EACrCJ,WAAW,CAACN,MAAMW,KAAK,IAAI,UAAU,EACrCH,aAAaL,WAAWzD,QAAQ,GAAGyD,WAAW7D,UAAU,EACxD0D,MAAM7E,IAAI,CAACsF,SAAS;IAGtB,oDAAoD;IACpDT,MAAM5E,KAAK,CAACqF,SAAS,OAAG3F,mBAAAA,EACtBG,sBAAsBG,KAAK,EAC3BgF,YAAYhF,KAAK,EACjBoF,aAAaJ,YAAY1D,QAAQ,GAAG0D,YAAY9D,UAAU,EAC1D0D,MAAM5E,KAAK,CAACqF,SAAS;IAGvB,oDAAoD;IACpDT,MAAM3E,KAAK,CAACoF,SAAS,OAAG3F,mBAAAA,EACtBG,sBAAsBI,KAAK,EAC3BgF,YAAYhF,KAAK,EACjBmF,aAAaH,YAAY3D,QAAQ,GAAG2D,YAAY/D,UAAU,EAC1D0D,MAAM3E,KAAK,CAACoF,SAAS;IAEvB,OAAOT;AACT,EAAE"}
|
|
@@ -6,17 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
ColorPickerProvider
|
|
13
|
+
get ColorPickerProvider () {
|
|
14
14
|
return ColorPickerProvider;
|
|
15
15
|
},
|
|
16
|
-
colorPickerContextDefaultValue
|
|
16
|
+
get colorPickerContextDefaultValue () {
|
|
17
17
|
return colorPickerContextDefaultValue;
|
|
18
18
|
},
|
|
19
|
-
useColorPickerContextValue_unstable
|
|
19
|
+
get useColorPickerContextValue_unstable () {
|
|
20
20
|
return useColorPickerContextValue_unstable;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/colorPicker.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { ColorPickerProps } from '../components/ColorPicker/ColorPicker.types';\nimport type { HsvColor } from '../types/color';\n\n/**\n * The context through which individual color controls communicate with the picker.\n */\nexport type ColorPickerContextValue = Pick<ColorPickerProps, 'shape' | 'color'> & {\n /**\n * Callback used by Sliders to request a change on it's selected value\n * Should be used to get value of color channel\n *\n * @internal\n */\n requestChange: (event: React.ChangeEvent<HTMLInputElement>, data: { color: HsvColor }) => void;\n};\n\nexport const colorPickerContextDefaultValue: ColorPickerContextValue = {\n requestChange: () => {\n /*noop*/\n },\n color: undefined,\n shape: 'rounded',\n};\n\nexport type ColorPickerContextValues = {\n colorPicker: ColorPickerContextValue;\n};\n\nconst colorPickerContext = createContext<ColorPickerContextValue | undefined>(\n undefined,\n) as Context<ColorPickerContextValue>;\n\nexport const ColorPickerProvider = colorPickerContext.Provider;\n\nexport const useColorPickerContextValue_unstable = <T>(selector: ContextSelector<ColorPickerContextValue, T>): T =>\n useContextSelector(colorPickerContext, (ctx = colorPickerContextDefaultValue) => selector(ctx));\n"],"names":["createContext","useContextSelector","colorPickerContextDefaultValue","requestChange","color","undefined","shape","colorPickerContext","ColorPickerProvider","Provider","useColorPickerContextValue_unstable","selector","ctx"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;sCAGkD,mCAAmC;AAkB9E,MAAME,iCAA0D;IACrEC,eAAe;IACb,MAAM,GACR;IACAC,OAAOC;IACPC,OAAO;AACT,EAAE;AAMF,MAAMC,yBAAqBP,mCAAAA,EACzBK;AAGK,MAAMG,sBAAsBD,mBAAmBE,QAAQ,CAAC;AAExD,MAAMC,sCAAsC,CAAIC,eACrDV,wCAAAA,EAAmBM,oBAAoB,CAACK,MAAMV,8BAA8B,GAAKS,SAASC,MAAM"}
|
package/lib-commonjs/index.cjs
CHANGED
|
@@ -5,86 +5,86 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
AlphaSlider
|
|
12
|
+
get AlphaSlider () {
|
|
13
13
|
return _AlphaSlider.AlphaSlider;
|
|
14
14
|
},
|
|
15
|
-
ColorArea
|
|
15
|
+
get ColorArea () {
|
|
16
16
|
return _ColorArea.ColorArea;
|
|
17
17
|
},
|
|
18
|
-
ColorPicker
|
|
18
|
+
get ColorPicker () {
|
|
19
19
|
return _ColorPicker.ColorPicker;
|
|
20
20
|
},
|
|
21
|
-
ColorSlider
|
|
21
|
+
get ColorSlider () {
|
|
22
22
|
return _ColorSlider.ColorSlider;
|
|
23
23
|
},
|
|
24
|
-
alphaSliderClassNames
|
|
24
|
+
get alphaSliderClassNames () {
|
|
25
25
|
return _AlphaSlider.alphaSliderClassNames;
|
|
26
26
|
},
|
|
27
|
-
colorAreaClassNames
|
|
27
|
+
get colorAreaClassNames () {
|
|
28
28
|
return _ColorArea.colorAreaClassNames;
|
|
29
29
|
},
|
|
30
|
-
colorPickerClassNames
|
|
30
|
+
get colorPickerClassNames () {
|
|
31
31
|
return _ColorPicker.colorPickerClassNames;
|
|
32
32
|
},
|
|
33
|
-
colorSliderClassNames
|
|
33
|
+
get colorSliderClassNames () {
|
|
34
34
|
return _ColorSlider.colorSliderClassNames;
|
|
35
35
|
},
|
|
36
|
-
renderAlphaSlider_unstable
|
|
36
|
+
get renderAlphaSlider_unstable () {
|
|
37
37
|
return _AlphaSlider.renderAlphaSlider_unstable;
|
|
38
38
|
},
|
|
39
|
-
renderColorArea_unstable
|
|
39
|
+
get renderColorArea_unstable () {
|
|
40
40
|
return _ColorArea.renderColorArea_unstable;
|
|
41
41
|
},
|
|
42
|
-
renderColorPicker_unstable
|
|
42
|
+
get renderColorPicker_unstable () {
|
|
43
43
|
return _ColorPicker.renderColorPicker_unstable;
|
|
44
44
|
},
|
|
45
|
-
renderColorSlider_unstable
|
|
45
|
+
get renderColorSlider_unstable () {
|
|
46
46
|
return _ColorSlider.renderColorSlider_unstable;
|
|
47
47
|
},
|
|
48
|
-
useAlphaSliderBase_unstable
|
|
48
|
+
get useAlphaSliderBase_unstable () {
|
|
49
49
|
return _AlphaSlider.useAlphaSliderBase_unstable;
|
|
50
50
|
},
|
|
51
|
-
useAlphaSliderStyles_unstable
|
|
51
|
+
get useAlphaSliderStyles_unstable () {
|
|
52
52
|
return _AlphaSlider.useAlphaSliderStyles_unstable;
|
|
53
53
|
},
|
|
54
|
-
useAlphaSlider_unstable
|
|
54
|
+
get useAlphaSlider_unstable () {
|
|
55
55
|
return _AlphaSlider.useAlphaSlider_unstable;
|
|
56
56
|
},
|
|
57
|
-
useColorAreaBase_unstable
|
|
57
|
+
get useColorAreaBase_unstable () {
|
|
58
58
|
return _ColorArea.useColorAreaBase_unstable;
|
|
59
59
|
},
|
|
60
|
-
useColorAreaStyles_unstable
|
|
60
|
+
get useColorAreaStyles_unstable () {
|
|
61
61
|
return _ColorArea.useColorAreaStyles_unstable;
|
|
62
62
|
},
|
|
63
|
-
useColorArea_unstable
|
|
63
|
+
get useColorArea_unstable () {
|
|
64
64
|
return _ColorArea.useColorArea_unstable;
|
|
65
65
|
},
|
|
66
|
-
useColorPickerBase_unstable
|
|
66
|
+
get useColorPickerBase_unstable () {
|
|
67
67
|
return _ColorPicker.useColorPickerBase_unstable;
|
|
68
68
|
},
|
|
69
|
-
useColorPickerContextValue_unstable
|
|
69
|
+
get useColorPickerContextValue_unstable () {
|
|
70
70
|
return _colorPicker.useColorPickerContextValue_unstable;
|
|
71
71
|
},
|
|
72
|
-
useColorPickerContextValues
|
|
72
|
+
get useColorPickerContextValues () {
|
|
73
73
|
return _ColorPicker.useColorPickerContextValues;
|
|
74
74
|
},
|
|
75
|
-
useColorPickerStyles_unstable
|
|
75
|
+
get useColorPickerStyles_unstable () {
|
|
76
76
|
return _ColorPicker.useColorPickerStyles_unstable;
|
|
77
77
|
},
|
|
78
|
-
useColorPicker_unstable
|
|
78
|
+
get useColorPicker_unstable () {
|
|
79
79
|
return _ColorPicker.useColorPicker_unstable;
|
|
80
80
|
},
|
|
81
|
-
useColorSliderBase_unstable
|
|
81
|
+
get useColorSliderBase_unstable () {
|
|
82
82
|
return _ColorSlider.useColorSliderBase_unstable;
|
|
83
83
|
},
|
|
84
|
-
useColorSliderStyles_unstable
|
|
84
|
+
get useColorSliderStyles_unstable () {
|
|
85
85
|
return _ColorSlider.useColorSliderStyles_unstable;
|
|
86
86
|
},
|
|
87
|
-
useColorSlider_unstable
|
|
87
|
+
get useColorSlider_unstable () {
|
|
88
88
|
return _ColorSlider.useColorSlider_unstable;
|
|
89
89
|
}
|
|
90
90
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type {\n ColorChannel,\n ColorSliderBaseProps,\n ColorSliderBaseState,\n ColorSliderProps,\n ColorSliderSlots,\n ColorSliderState,\n} from './ColorSlider';\nexport {\n ColorSlider,\n colorSliderClassNames,\n renderColorSlider_unstable,\n useColorSliderBase_unstable,\n useColorSliderStyles_unstable,\n useColorSlider_unstable,\n} from './ColorSlider';\nexport type {\n ColorPickerBaseProps,\n ColorPickerBaseState,\n ColorPickerProps,\n ColorPickerSlots,\n ColorPickerState,\n} from './ColorPicker';\nexport {\n ColorPicker,\n colorPickerClassNames,\n renderColorPicker_unstable,\n useColorPickerBase_unstable,\n useColorPickerContextValues,\n useColorPickerStyles_unstable,\n useColorPicker_unstable,\n} from './ColorPicker';\nexport type {\n ColorAreaBaseProps,\n ColorAreaBaseState,\n ColorAreaProps,\n ColorAreaSlots,\n ColorAreaState,\n} from './ColorArea';\nexport {\n ColorArea,\n colorAreaClassNames,\n renderColorArea_unstable,\n useColorAreaBase_unstable,\n useColorAreaStyles_unstable,\n useColorArea_unstable,\n} from './ColorArea';\nexport type {\n AlphaSliderBaseProps,\n AlphaSliderBaseState,\n AlphaSliderProps,\n AlphaSliderSlots,\n AlphaSliderState,\n} from './AlphaSlider';\nexport {\n AlphaSlider,\n alphaSliderClassNames,\n renderAlphaSlider_unstable,\n useAlphaSliderBase_unstable,\n useAlphaSliderStyles_unstable,\n useAlphaSlider_unstable,\n} from './AlphaSlider';\nexport type { ColorPickerContextValue, ColorPickerContextValues } from './contexts/colorPicker';\nexport { useColorPickerContextValue_unstable } from './contexts/colorPicker';\n"],"names":["ColorSlider","colorSliderClassNames","renderColorSlider_unstable","useColorSliderBase_unstable","useColorSliderStyles_unstable","useColorSlider_unstable","ColorPicker","colorPickerClassNames","renderColorPicker_unstable","useColorPickerBase_unstable","useColorPickerContextValues","useColorPickerStyles_unstable","useColorPicker_unstable","ColorArea","colorAreaClassNames","renderColorArea_unstable","useColorAreaBase_unstable","useColorAreaStyles_unstable","useColorArea_unstable","AlphaSlider","alphaSliderClassNames","renderAlphaSlider_unstable","useAlphaSliderBase_unstable","useAlphaSliderStyles_unstable","useAlphaSlider_unstable","useColorPickerContextValue_unstable"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type {\n ColorChannel,\n ColorSliderBaseProps,\n ColorSliderBaseState,\n ColorSliderProps,\n ColorSliderSlots,\n ColorSliderState,\n} from './ColorSlider';\nexport {\n ColorSlider,\n colorSliderClassNames,\n renderColorSlider_unstable,\n useColorSliderBase_unstable,\n useColorSliderStyles_unstable,\n useColorSlider_unstable,\n} from './ColorSlider';\nexport type {\n ColorPickerBaseProps,\n ColorPickerBaseState,\n ColorPickerProps,\n ColorPickerSlots,\n ColorPickerState,\n} from './ColorPicker';\nexport {\n ColorPicker,\n colorPickerClassNames,\n renderColorPicker_unstable,\n useColorPickerBase_unstable,\n useColorPickerContextValues,\n useColorPickerStyles_unstable,\n useColorPicker_unstable,\n} from './ColorPicker';\nexport type {\n ColorAreaBaseProps,\n ColorAreaBaseState,\n ColorAreaProps,\n ColorAreaSlots,\n ColorAreaState,\n} from './ColorArea';\nexport {\n ColorArea,\n colorAreaClassNames,\n renderColorArea_unstable,\n useColorAreaBase_unstable,\n useColorAreaStyles_unstable,\n useColorArea_unstable,\n} from './ColorArea';\nexport type {\n AlphaSliderBaseProps,\n AlphaSliderBaseState,\n AlphaSliderProps,\n AlphaSliderSlots,\n AlphaSliderState,\n} from './AlphaSlider';\nexport {\n AlphaSlider,\n alphaSliderClassNames,\n renderAlphaSlider_unstable,\n useAlphaSliderBase_unstable,\n useAlphaSliderStyles_unstable,\n useAlphaSlider_unstable,\n} from './AlphaSlider';\nexport type { ColorPickerContextValue, ColorPickerContextValues } from './contexts/colorPicker';\nexport { useColorPickerContextValue_unstable } from './contexts/colorPicker';\n"],"names":["ColorSlider","colorSliderClassNames","renderColorSlider_unstable","useColorSliderBase_unstable","useColorSliderStyles_unstable","useColorSlider_unstable","ColorPicker","colorPickerClassNames","renderColorPicker_unstable","useColorPickerBase_unstable","useColorPickerContextValues","useColorPickerStyles_unstable","useColorPicker_unstable","ColorArea","colorAreaClassNames","renderColorArea_unstable","useColorAreaBase_unstable","useColorAreaStyles_unstable","useColorArea_unstable","AlphaSlider","alphaSliderClassNames","renderAlphaSlider_unstable","useAlphaSliderBase_unstable","useAlphaSliderStyles_unstable","useAlphaSlider_unstable","useColorPickerContextValue_unstable"],"mappings":";;;;;;;;;;;QAuDEmB;uCAAW;;QAfXN;mCAAS;;;eAhBTP,wBAAW;;;eAfXN,wBAAW;;;eA+CXoB,kCAAqB;;;eAfrBN,8BAAmB;;;eAhBnBP,kCAAqB;;;eAfrBN,kCAAqB;;QA+CrBoB;sDAA0B;;;eAf1BN,mCAAwB;;;eAhBxBP,uCAA0B;;;eAf1BN,uCAA0B;;;eA+C1BoB,wCAA2B;;;eAC3BC,0CAA6B;;QAC7BC;mDAAuB;;;eAjBvBR,oCAAyB;;;eACzBC,sCAA2B;;;eAC3BC,gCAAqB;;QAlBrBT;uDAA2B;;;eAoCpBgB,gDAAmC;;;eAnC1Cf,wCAA2B;;;eAC3BC,0CAA6B;;QAC7BC;mDAAuB;;;eAlBvBT,wCAA2B;;;eAC3BC,0CAA6B;;;eAC7BC,oCAAuB;;;6BAClB,mBAAgB;6BAgBhB,mBAAgB;2BAehB,iBAAc;6BAed,mBAAgB;6BAE6B,4BAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/types/color.ts"],"sourcesContent":["export type HsvColor = {\n h: number;\n s: number;\n v: number;\n a?: number;\n};\n\nexport type HslColor = {\n h: number;\n s: number;\n l: number;\n a?: number;\n};\n"],"names":[],"mappings":""}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
adjustChannel
|
|
12
|
+
get adjustChannel () {
|
|
13
13
|
return adjustChannel;
|
|
14
14
|
},
|
|
15
|
-
clampValue
|
|
15
|
+
get clampValue () {
|
|
16
16
|
return clampValue;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/adjustChannel.ts"],"sourcesContent":["import type { ColorChannel } from '../components/ColorSlider/ColorSlider.types';\nimport { MIN, HUE_MAX, MAX as COLOR_MAX } from './constants';\nimport { clamp } from '@fluentui/react-utilities';\n\n/**\n * Clamps a given value to the valid range for a specified color channel.\n *\n * @param value - The numeric value to be clamped.\n * @param channel - The color channel to use for clamping. Defaults to 'hue'.\n * @returns The clamped value within the range defined by the color channel.\n */\nexport function clampValue(value: number, channel: ColorChannel = 'hue'): number {\n const MAX = channel === 'hue' ? HUE_MAX : COLOR_MAX;\n return clamp(value, MIN, MAX);\n}\n\nexport type ChannelActions<T> = {\n hue: T;\n saturation: T;\n value: T;\n};\n\n/**\n * Adjusts the specified color channel using the provided actions.\n *\n * @template T - The type of the result returned by the actions.\n * @param {ColorChannel} channel - The color channel to adjust.\n * @param {ChannelActions<T>} actions - An object containing actions for each color channel.\n * @returns {T} - The result of the action corresponding to the specified channel, or the hue action if the channel is not found.\n */\nexport function adjustChannel<T>(channel: ColorChannel, actions: ChannelActions<T>): T {\n return actions[channel] ?? actions.hue;\n}\n"],"names":["MIN","HUE_MAX","MAX","COLOR_MAX","clamp","clampValue","value","channel","adjustChannel","actions","hue"],"mappings":";;;;;;;;;;;;;;;;;;2BAC+C,iBAAc;gCACvC,4BAA4B;AAS3C,SAASK,WAAWC,KAAa,EAAEC,UAAwB,KAAK;IACrE,MAAML,MAAMK,YAAY,QAAQN,kBAAAA,GAAUE,cAAAA;IAC1C,WAAOC,qBAAAA,EAAME,OAAON,cAAAA,EAAKE;AAC3B;AAgBO,SAASM,cAAiBD,OAAqB,EAAEE,OAA0B;QACzEA;IAAP,OAAA,CAAOA,mBAAAA,OAAO,CAACF,QAAAA,AAAQ,MAAA,QAAhBE,qBAAAA,KAAAA,IAAAA,mBAAoBA,QAAQC,GAAG;AACxC"}
|
|
@@ -5,23 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
HUE_MAX
|
|
12
|
+
get HUE_MAX () {
|
|
13
13
|
return HUE_MAX;
|
|
14
14
|
},
|
|
15
|
-
INITIAL_COLOR
|
|
15
|
+
get INITIAL_COLOR () {
|
|
16
16
|
return INITIAL_COLOR;
|
|
17
17
|
},
|
|
18
|
-
INITIAL_COLOR_HSV
|
|
18
|
+
get INITIAL_COLOR_HSV () {
|
|
19
19
|
return INITIAL_COLOR_HSV;
|
|
20
20
|
},
|
|
21
|
-
MAX
|
|
21
|
+
get MAX () {
|
|
22
22
|
return MAX;
|
|
23
23
|
},
|
|
24
|
-
MIN
|
|
24
|
+
get MIN () {
|
|
25
25
|
return MIN;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/constants.ts"],"sourcesContent":["export const MIN = 0;\nexport const MAX = 100;\nexport const HUE_MAX = 360;\nexport const INITIAL_COLOR = '#FFF';\nexport const INITIAL_COLOR_HSV = { h: 0, s: 0, v: 1, a: 1 };\n"],"names":["MIN","MAX","HUE_MAX","INITIAL_COLOR","INITIAL_COLOR_HSV","h","s","v","a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,MAAM,EAAE;AACd,MAAMC,MAAM,IAAI;AAChB,MAAMC,UAAU,IAAI;AACpB,MAAMC,gBAAgB,OAAO;AAC7B,MAAMC,oBAAoB;IAAEC,GAAG;IAAGC,GAAG;IAAGC,GAAG;IAAGC,GAAG;AAAE,EAAE"}
|
|
@@ -11,14 +11,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
11
11
|
function _export(target, all) {
|
|
12
12
|
for(var name in all)Object.defineProperty(target, name, {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: all
|
|
14
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
_export(exports, {
|
|
18
|
-
createHslColor
|
|
18
|
+
get createHslColor () {
|
|
19
19
|
return createHslColor;
|
|
20
20
|
},
|
|
21
|
-
createHslColorString
|
|
21
|
+
get createHslColorString () {
|
|
22
22
|
return createHslColorString;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/createHslColor.ts"],"sourcesContent":["import type { HslColor, HsvColor } from '../types/color';\n\n/**\n *\n * Creates an HSL color object from a given HSV color object.\n *\n * @param color - HSV color object to convert to HSL.\n * @returns HSL color object with the same hue and alpha values, and converted saturation and lightness values.\n */\nexport function createHslColor(color: Partial<HsvColor> = {}): HslColor {\n const { h = 0, s = 0, v = 0, a = 1 } = color;\n const l = v * (1 - s / 2);\n const hslSaturation = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l);\n\n return { h, s: hslSaturation, l, a };\n}\n\n/**\n * Creates an HSL color string from a given HSV color object.\n *\n * @param color - HSV color object to convert to HSL string.\n * @returns - HSL color string in the format of \"hsla(h, s%, l%, a)\".\n */\nexport function createHslColorString(color: Partial<HsvColor> = {}): string {\n const hslColor = createHslColor(color);\n const saturation = Number((hslColor.s * 100).toFixed(2));\n const lightness = Number((hslColor.l * 100).toFixed(2));\n\n return `hsla(${hslColor.h}, ${saturation}%, ${lightness}%, ${hslColor.a})`;\n}\n"],"names":["createHslColor","color","h","s","v","a","l","hslSaturation","Math","min","createHslColorString","hslColor","saturation","Number","toFixed","lightness"],"mappings":"AAEA;;;;;;CAMC,GACD;;;;;;;;;;;;;;;eAcgBU;;;AAdT,SAASV,eAAeC,QAA2B,CAAC,CAAC;IAC1D,MAAM,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAE,GAAGJ;IACvC,MAAMK,IAAIF,IAAK,CAAA,IAAID,KAAI,CAAA;IACvB,MAAMI,gBAAgBD,MAAM,KAAKA,MAAM,IAAI,IAAKF,CAAAA,KAAIE,CAAAA,GAAKE,KAAKC,GAAG,CAACH,GAAG,IAAIA;IAEzE,OAAO;QAAEJ;QAAGC,GAAGI;QAAeD;QAAGD;IAAE;AACrC;AAQO,8BAA8BJ,QAA2B,CAAC,CAAC;IAChE,MAAMU,WAAWX,eAAeC;IAChC,MAAMW,aAAaC,OAAQF,CAAAA,SAASR,CAAC,GAAG,GAAA,CAAE,CAAGW,OAAO,CAAC;IACrD,MAAMC,YAAYF,OAAQF,UAASL,CAAC,GAAG,GAAA,CAAE,CAAGQ,OAAO,CAAC;IAEpD,OAAO,CAAC,KAAK,EAAEH,SAAST,CAAC,CAAC,EAAE,EAAEU,WAAW,GAAG,EAAEG,UAAU,GAAG,EAAEJ,SAASN,CAAC,CAAC,CAAC,CAAC;AAC5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/createHsvColor.ts"],"sourcesContent":["import type { HsvColor } from '../types/color';\n\n/**\n * Creates an HSV color object with optional hue, saturation, value, and alpha components.\n *\n * @param {Partial<HsvColor>} param0 - An object containing optional HSV color components:\n * - `h` (number): The hue component, default is 0.\n * - `s` (number): The saturation component, default is 0.\n * - `v` (number): The value component, default is 0.\n * - `a` (number): The alpha component, default is 1.\n * @returns {HsvColor} The resulting HSV color object.\n */\nexport function createHsvColor({ h = 0, s = 0, v = 0, a = 1 }: Partial<HsvColor>): HsvColor {\n return { h, s, v, a };\n}\n"],"names":["createHsvColor","h","s","v","a"],"mappings":"AAEA;;;;;;;;;CASC,GACD;;;;;;;;;;AAAO,SAASA,eAAe,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAEC,IAAI,CAAC,EAAqB;IAC9E,OAAO;QAAEH;QAAGC;QAAGC;QAAGC;IAAE;AACtB"}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getCoordinates
|
|
12
|
+
get getCoordinates () {
|
|
13
13
|
return getCoordinates;
|
|
14
14
|
},
|
|
15
|
-
roundTwoDecimal
|
|
15
|
+
get roundTwoDecimal () {
|
|
16
16
|
return roundTwoDecimal;
|
|
17
17
|
}
|
|
18
18
|
});
|