@fluentui/react-swatch-picker 9.5.4 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -2
- package/dist/index.d.cts +428 -0
- package/dist/index.d.ts +75 -5
- package/lib/ColorSwatch.js +1 -1
- package/lib/ColorSwatch.js.map +1 -1
- package/lib/EmptySwatch.js +1 -1
- package/lib/EmptySwatch.js.map +1 -1
- package/lib/ImageSwatch.js +1 -1
- package/lib/ImageSwatch.js.map +1 -1
- package/lib/SwatchPicker.js +1 -1
- package/lib/SwatchPicker.js.map +1 -1
- package/lib/SwatchPickerRow.js +1 -1
- package/lib/SwatchPickerRow.js.map +1 -1
- package/lib/components/ColorSwatch/ColorSwatch.constants.js +4 -0
- package/lib/components/ColorSwatch/ColorSwatch.constants.js.map +1 -0
- package/lib/components/ColorSwatch/ColorSwatch.js +5 -5
- package/lib/components/ColorSwatch/ColorSwatch.js.map +1 -1
- package/lib/components/ColorSwatch/ColorSwatch.types.js +1 -3
- package/lib/components/ColorSwatch/ColorSwatch.types.js.map +1 -1
- package/lib/components/ColorSwatch/index.js +5 -4
- package/lib/components/ColorSwatch/index.js.map +1 -1
- package/lib/components/ColorSwatch/renderColorSwatch.js +1 -1
- package/lib/components/ColorSwatch/renderColorSwatch.js.map +1 -1
- package/lib/components/ColorSwatch/useColorSwatch.js +37 -20
- package/lib/components/ColorSwatch/useColorSwatch.js.map +1 -1
- package/lib/components/ColorSwatch/useColorSwatchStyles.styles.js +7 -10
- package/lib/components/ColorSwatch/useColorSwatchStyles.styles.js.map +1 -1
- package/lib/components/ColorSwatch/useColorSwatchStyles.styles.raw.js +5 -8
- package/lib/components/ColorSwatch/useColorSwatchStyles.styles.raw.js.map +1 -1
- package/lib/components/EmptySwatch/EmptySwatch.js +5 -5
- package/lib/components/EmptySwatch/EmptySwatch.js.map +1 -1
- package/lib/components/EmptySwatch/EmptySwatch.types.js +1 -3
- package/lib/components/EmptySwatch/EmptySwatch.types.js.map +1 -1
- package/lib/components/EmptySwatch/index.js +4 -4
- package/lib/components/EmptySwatch/index.js.map +1 -1
- package/lib/components/EmptySwatch/renderEmptySwatch.js +1 -1
- package/lib/components/EmptySwatch/renderEmptySwatch.js.map +1 -1
- package/lib/components/EmptySwatch/useEmptySwatch.js +26 -13
- package/lib/components/EmptySwatch/useEmptySwatch.js.map +1 -1
- package/lib/components/EmptySwatch/useEmptySwatchStyles.styles.js +3 -3
- package/lib/components/EmptySwatch/useEmptySwatchStyles.styles.js.map +1 -1
- package/lib/components/EmptySwatch/useEmptySwatchStyles.styles.raw.js +3 -3
- package/lib/components/ImageSwatch/ImageSwatch.js +5 -5
- package/lib/components/ImageSwatch/ImageSwatch.js.map +1 -1
- package/lib/components/ImageSwatch/ImageSwatch.types.js +1 -3
- package/lib/components/ImageSwatch/ImageSwatch.types.js.map +1 -1
- package/lib/components/ImageSwatch/index.js +4 -4
- package/lib/components/ImageSwatch/index.js.map +1 -1
- package/lib/components/ImageSwatch/renderImageSwatch.js +1 -1
- package/lib/components/ImageSwatch/renderImageSwatch.js.map +1 -1
- package/lib/components/ImageSwatch/useImageSwatch.js +25 -11
- package/lib/components/ImageSwatch/useImageSwatch.js.map +1 -1
- package/lib/components/ImageSwatch/useImageSwatchStyles.styles.js +3 -3
- package/lib/components/ImageSwatch/useImageSwatchStyles.styles.js.map +1 -1
- package/lib/components/ImageSwatch/useImageSwatchStyles.styles.raw.js +3 -3
- package/lib/components/SwatchPicker/SwatchPicker.js +6 -6
- package/lib/components/SwatchPicker/SwatchPicker.js.map +1 -1
- package/lib/components/SwatchPicker/SwatchPicker.types.js +1 -3
- package/lib/components/SwatchPicker/SwatchPicker.types.js.map +1 -1
- package/lib/components/SwatchPicker/index.js +4 -4
- package/lib/components/SwatchPicker/index.js.map +1 -1
- package/lib/components/SwatchPicker/renderSwatchPicker.js +2 -2
- package/lib/components/SwatchPicker/renderSwatchPicker.js.map +1 -1
- package/lib/components/SwatchPicker/useSwatchPicker.js +32 -15
- package/lib/components/SwatchPicker/useSwatchPicker.js.map +1 -1
- package/lib/components/SwatchPicker/useSwatchPickerContextValues.js +1 -1
- package/lib/components/SwatchPicker/useSwatchPickerStyles.styles.js +2 -2
- package/lib/components/SwatchPicker/useSwatchPickerStyles.styles.js.map +1 -1
- package/lib/components/SwatchPicker/useSwatchPickerStyles.styles.raw.js +2 -2
- package/lib/components/SwatchPickerRow/SwatchPickerRow.js +5 -5
- package/lib/components/SwatchPickerRow/SwatchPickerRow.js.map +1 -1
- package/lib/components/SwatchPickerRow/SwatchPickerRow.types.js +1 -3
- package/lib/components/SwatchPickerRow/SwatchPickerRow.types.js.map +1 -1
- package/lib/components/SwatchPickerRow/index.js +4 -4
- package/lib/components/SwatchPickerRow/index.js.map +1 -1
- package/lib/components/SwatchPickerRow/renderSwatchPickerRow.js +1 -1
- package/lib/components/SwatchPickerRow/renderSwatchPickerRow.js.map +1 -1
- package/lib/components/SwatchPickerRow/useSwatchPickerRow.js +21 -8
- package/lib/components/SwatchPickerRow/useSwatchPickerRow.js.map +1 -1
- package/lib/components/SwatchPickerRow/useSwatchPickerRowStyles.styles.js +1 -1
- package/lib/components/SwatchPickerRow/useSwatchPickerRowStyles.styles.js.map +1 -1
- package/lib/components/SwatchPickerRow/useSwatchPickerRowStyles.styles.raw.js +1 -1
- package/lib/contexts/index.js +2 -2
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/swatchPicker.js +1 -1
- package/lib/index.js +7 -7
- package/lib/index.js.map +1 -1
- package/lib/utils/renderUtils.js +2 -2
- package/lib/utils/renderUtils.js.map +1 -1
- package/lib-commonjs/{ColorSwatch.js → ColorSwatch.cjs} +4 -1
- package/lib-commonjs/ColorSwatch.cjs.map +1 -0
- package/lib-commonjs/{EmptySwatch.js → EmptySwatch.cjs} +4 -1
- package/lib-commonjs/EmptySwatch.cjs.map +1 -0
- package/lib-commonjs/{ImageSwatch.js → ImageSwatch.cjs} +4 -1
- package/lib-commonjs/ImageSwatch.cjs.map +1 -0
- package/lib-commonjs/{SwatchPicker.js → SwatchPicker.cjs} +4 -1
- package/lib-commonjs/SwatchPicker.cjs.map +1 -0
- package/lib-commonjs/{SwatchPickerRow.js → SwatchPickerRow.cjs} +4 -1
- package/lib-commonjs/SwatchPickerRow.cjs.map +1 -0
- package/lib-commonjs/components/ColorSwatch/{ColorSwatch.js → ColorSwatch.cjs} +3 -3
- package/lib-commonjs/components/ColorSwatch/{ColorSwatch.js.map → ColorSwatch.cjs.map} +1 -1
- package/lib-commonjs/components/ColorSwatch/ColorSwatch.constants.cjs +14 -0
- package/lib-commonjs/components/ColorSwatch/ColorSwatch.constants.cjs.map +1 -0
- package/lib-commonjs/components/ColorSwatch/{ColorSwatch.types.js → ColorSwatch.types.cjs} +1 -3
- package/lib-commonjs/components/ColorSwatch/{ColorSwatch.types.js.map → ColorSwatch.types.cjs.map} +1 -1
- package/lib-commonjs/components/ColorSwatch/{index.js → index.cjs} +9 -5
- package/lib-commonjs/components/ColorSwatch/index.cjs.map +1 -0
- package/lib-commonjs/components/ColorSwatch/renderColorSwatch.cjs.map +1 -0
- package/lib-commonjs/components/ColorSwatch/{useColorSwatch.js → useColorSwatch.cjs} +36 -18
- package/lib-commonjs/components/ColorSwatch/useColorSwatch.cjs.map +1 -0
- package/lib-commonjs/components/ColorSwatch/{useColorSwatchStyles.styles.js → useColorSwatchStyles.styles.cjs} +10 -16
- package/lib-commonjs/components/ColorSwatch/useColorSwatchStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/ColorSwatch/{useColorSwatchStyles.styles.raw.js → useColorSwatchStyles.styles.raw.cjs} +3 -9
- package/lib-commonjs/components/ColorSwatch/useColorSwatchStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/EmptySwatch/{EmptySwatch.js → EmptySwatch.cjs} +3 -3
- package/lib-commonjs/components/EmptySwatch/{EmptySwatch.js.map → EmptySwatch.cjs.map} +1 -1
- package/lib-commonjs/components/EmptySwatch/{EmptySwatch.types.js → EmptySwatch.types.cjs} +1 -3
- package/lib-commonjs/components/EmptySwatch/{EmptySwatch.types.js.map → EmptySwatch.types.cjs.map} +1 -1
- package/lib-commonjs/components/EmptySwatch/{index.js → index.cjs} +7 -4
- package/lib-commonjs/components/EmptySwatch/index.cjs.map +1 -0
- package/lib-commonjs/components/EmptySwatch/renderEmptySwatch.cjs.map +1 -0
- package/lib-commonjs/components/EmptySwatch/useEmptySwatch.cjs +52 -0
- package/lib-commonjs/components/EmptySwatch/useEmptySwatch.cjs.map +1 -0
- package/lib-commonjs/components/EmptySwatch/useEmptySwatchStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/ImageSwatch/{ImageSwatch.js → ImageSwatch.cjs} +3 -3
- package/lib-commonjs/components/ImageSwatch/{ImageSwatch.js.map → ImageSwatch.cjs.map} +1 -1
- package/lib-commonjs/components/ImageSwatch/{ImageSwatch.types.js → ImageSwatch.types.cjs} +1 -3
- package/lib-commonjs/components/ImageSwatch/{ImageSwatch.types.js.map → ImageSwatch.types.cjs.map} +1 -1
- package/lib-commonjs/components/ImageSwatch/{index.js → index.cjs} +7 -4
- package/lib-commonjs/components/ImageSwatch/index.cjs.map +1 -0
- package/lib-commonjs/components/ImageSwatch/renderImageSwatch.cjs.map +1 -0
- package/lib-commonjs/components/ImageSwatch/{useImageSwatch.js → useImageSwatch.cjs} +25 -10
- package/lib-commonjs/components/ImageSwatch/useImageSwatch.cjs.map +1 -0
- package/lib-commonjs/components/ImageSwatch/useImageSwatchStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPicker/{SwatchPicker.js → SwatchPicker.cjs} +4 -4
- package/lib-commonjs/components/SwatchPicker/{SwatchPicker.js.map → SwatchPicker.cjs.map} +1 -1
- package/lib-commonjs/components/SwatchPicker/{SwatchPicker.types.js → SwatchPicker.types.cjs} +1 -3
- package/lib-commonjs/components/SwatchPicker/{SwatchPicker.types.js.map → SwatchPicker.types.cjs.map} +1 -1
- package/lib-commonjs/components/SwatchPicker/{index.js → index.cjs} +7 -4
- package/lib-commonjs/components/SwatchPicker/index.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPicker/{renderSwatchPicker.js → renderSwatchPicker.cjs} +1 -1
- package/lib-commonjs/components/SwatchPicker/renderSwatchPicker.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPicker/{useSwatchPicker.js → useSwatchPicker.cjs} +30 -12
- package/lib-commonjs/components/SwatchPicker/useSwatchPicker.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPicker/useSwatchPickerStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPickerRow/{SwatchPickerRow.js → SwatchPickerRow.cjs} +3 -3
- package/lib-commonjs/components/SwatchPickerRow/{SwatchPickerRow.js.map → SwatchPickerRow.cjs.map} +1 -1
- package/lib-commonjs/components/SwatchPickerRow/SwatchPickerRow.types.cjs +4 -0
- package/lib-commonjs/components/SwatchPickerRow/{SwatchPickerRow.types.js.map → SwatchPickerRow.types.cjs.map} +1 -1
- package/lib-commonjs/components/SwatchPickerRow/{index.js → index.cjs} +7 -4
- package/lib-commonjs/components/SwatchPickerRow/index.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPickerRow/renderSwatchPickerRow.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPickerRow/{useSwatchPickerRow.js → useSwatchPickerRow.cjs} +21 -7
- package/lib-commonjs/components/SwatchPickerRow/useSwatchPickerRow.cjs.map +1 -0
- package/lib-commonjs/components/SwatchPickerRow/useSwatchPickerRowStyles.styles.cjs.map +1 -0
- package/lib-commonjs/contexts/{index.js → index.cjs} +2 -2
- package/lib-commonjs/contexts/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/{index.js → index.cjs} +26 -11
- package/lib-commonjs/index.cjs.map +1 -0
- package/lib-commonjs/utils/{renderUtils.js → renderUtils.cjs} +4 -4
- package/lib-commonjs/utils/{renderUtils.js.map → renderUtils.cjs.map} +1 -1
- package/package.json +20 -14
- package/lib-commonjs/ColorSwatch.js.map +0 -1
- package/lib-commonjs/EmptySwatch.js.map +0 -1
- package/lib-commonjs/ImageSwatch.js.map +0 -1
- package/lib-commonjs/SwatchPicker.js.map +0 -1
- package/lib-commonjs/SwatchPickerRow.js.map +0 -1
- package/lib-commonjs/components/ColorSwatch/index.js.map +0 -1
- package/lib-commonjs/components/ColorSwatch/renderColorSwatch.js.map +0 -1
- package/lib-commonjs/components/ColorSwatch/useColorSwatch.js.map +0 -1
- package/lib-commonjs/components/ColorSwatch/useColorSwatchStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ColorSwatch/useColorSwatchStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/EmptySwatch/index.js.map +0 -1
- package/lib-commonjs/components/EmptySwatch/renderEmptySwatch.js.map +0 -1
- package/lib-commonjs/components/EmptySwatch/useEmptySwatch.js +0 -38
- package/lib-commonjs/components/EmptySwatch/useEmptySwatch.js.map +0 -1
- package/lib-commonjs/components/EmptySwatch/useEmptySwatchStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ImageSwatch/index.js.map +0 -1
- package/lib-commonjs/components/ImageSwatch/renderImageSwatch.js.map +0 -1
- package/lib-commonjs/components/ImageSwatch/useImageSwatch.js.map +0 -1
- package/lib-commonjs/components/ImageSwatch/useImageSwatchStyles.styles.js.map +0 -1
- package/lib-commonjs/components/SwatchPicker/index.js.map +0 -1
- package/lib-commonjs/components/SwatchPicker/renderSwatchPicker.js.map +0 -1
- package/lib-commonjs/components/SwatchPicker/useSwatchPicker.js.map +0 -1
- package/lib-commonjs/components/SwatchPicker/useSwatchPickerStyles.styles.js.map +0 -1
- package/lib-commonjs/components/SwatchPickerRow/SwatchPickerRow.types.js +0 -6
- package/lib-commonjs/components/SwatchPickerRow/index.js.map +0 -1
- package/lib-commonjs/components/SwatchPickerRow/renderSwatchPickerRow.js.map +0 -1
- package/lib-commonjs/components/SwatchPickerRow/useSwatchPickerRow.js.map +0 -1
- package/lib-commonjs/components/SwatchPickerRow/useSwatchPickerRowStyles.styles.js.map +0 -1
- package/lib-commonjs/index.js.map +0 -1
- /package/lib-commonjs/components/ColorSwatch/{renderColorSwatch.js → renderColorSwatch.cjs} +0 -0
- /package/lib-commonjs/components/EmptySwatch/{renderEmptySwatch.js → renderEmptySwatch.cjs} +0 -0
- /package/lib-commonjs/components/EmptySwatch/{useEmptySwatchStyles.styles.js → useEmptySwatchStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/EmptySwatch/{useEmptySwatchStyles.styles.raw.js → useEmptySwatchStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/EmptySwatch/{useEmptySwatchStyles.styles.raw.js.map → useEmptySwatchStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/components/ImageSwatch/{renderImageSwatch.js → renderImageSwatch.cjs} +0 -0
- /package/lib-commonjs/components/ImageSwatch/{useImageSwatchStyles.styles.js → useImageSwatchStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/ImageSwatch/{useImageSwatchStyles.styles.raw.js → useImageSwatchStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/ImageSwatch/{useImageSwatchStyles.styles.raw.js.map → useImageSwatchStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/components/SwatchPicker/{useSwatchPickerContextValues.js → useSwatchPickerContextValues.cjs} +0 -0
- /package/lib-commonjs/components/SwatchPicker/{useSwatchPickerContextValues.js.map → useSwatchPickerContextValues.cjs.map} +0 -0
- /package/lib-commonjs/components/SwatchPicker/{useSwatchPickerStyles.styles.js → useSwatchPickerStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/SwatchPicker/{useSwatchPickerStyles.styles.raw.js → useSwatchPickerStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/SwatchPicker/{useSwatchPickerStyles.styles.raw.js.map → useSwatchPickerStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/components/SwatchPickerRow/{renderSwatchPickerRow.js → renderSwatchPickerRow.cjs} +0 -0
- /package/lib-commonjs/components/SwatchPickerRow/{useSwatchPickerRowStyles.styles.js → useSwatchPickerRowStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/SwatchPickerRow/{useSwatchPickerRowStyles.styles.raw.js → useSwatchPickerRowStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/SwatchPickerRow/{useSwatchPickerRowStyles.styles.raw.js.map → useSwatchPickerRowStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/contexts/{swatchPicker.js → swatchPicker.cjs} +0 -0
- /package/lib-commonjs/contexts/{swatchPicker.js.map → swatchPicker.cjs.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SwatchPickerRow } from
|
|
2
|
-
export { renderSwatchPickerRow_unstable } from
|
|
3
|
-
export { useSwatchPickerRow_unstable } from
|
|
4
|
-
export { swatchPickerRowClassNames, useSwatchPickerRowStyles_unstable } from
|
|
1
|
+
export { SwatchPickerRow } from "./SwatchPickerRow.js";
|
|
2
|
+
export { renderSwatchPickerRow_unstable } from "./renderSwatchPickerRow.js";
|
|
3
|
+
export { useSwatchPickerRow_unstable, useSwatchPickerRowBase_unstable } from "./useSwatchPickerRow.js";
|
|
4
|
+
export { swatchPickerRowClassNames, useSwatchPickerRowStyles_unstable } from "./useSwatchPickerRowStyles.styles.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPickerRow/index.ts"],"sourcesContent":["export { SwatchPickerRow } from './SwatchPickerRow';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPickerRow/index.ts"],"sourcesContent":["export { SwatchPickerRow } from './SwatchPickerRow';\nexport type {\n SwatchPickerRowBaseProps,\n SwatchPickerRowBaseState,\n SwatchPickerRowProps,\n SwatchPickerRowSlots,\n SwatchPickerRowState,\n} from './SwatchPickerRow.types';\nexport { renderSwatchPickerRow_unstable } from './renderSwatchPickerRow';\nexport { useSwatchPickerRow_unstable, useSwatchPickerRowBase_unstable } from './useSwatchPickerRow';\nexport { swatchPickerRowClassNames, useSwatchPickerRowStyles_unstable } from './useSwatchPickerRowStyles.styles';\n"],"names":["SwatchPickerRow","renderSwatchPickerRow_unstable","useSwatchPickerRow_unstable","useSwatchPickerRowBase_unstable","swatchPickerRowClassNames","useSwatchPickerRowStyles_unstable"],"mappings":"AAAA,SAASA,eAAe,QAAQ,uBAAoB;AAQpD,SAASC,8BAA8B,QAAQ,6BAA0B;AACzE,SAASC,2BAA2B,EAAEC,+BAA+B,QAAQ,0BAAuB;AACpG,SAASC,yBAAyB,EAAEC,iCAAiC,QAAQ,uCAAoC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
-
import { assertSlots } from
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of SwatchPickerRow
|
|
5
5
|
*/ export const renderSwatchPickerRow_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPickerRow/renderSwatchPickerRow.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPickerRow/renderSwatchPickerRow.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { SwatchPickerRowBaseState, SwatchPickerRowSlots } from './SwatchPickerRow.types';\n\n/**\n * Render the final JSX of SwatchPickerRow\n */\nexport const renderSwatchPickerRow_unstable = (state: SwatchPickerRowBaseState): JSXElement => {\n assertSlots<SwatchPickerRowSlots>(state);\n return <state.root />;\n};\n"],"names":["assertSlots","renderSwatchPickerRow_unstable","state","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,iCAAiC,CAACC;IAC7CF,YAAkCE;IAClC,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { getIntrinsicElementProps, slot } from
|
|
3
|
-
import { useSwatchPickerContextValue_unstable } from
|
|
2
|
+
import { getIntrinsicElementProps, slot } from "@fluentui/react-utilities";
|
|
3
|
+
import { useSwatchPickerContextValue_unstable } from "../../contexts/swatchPicker.js";
|
|
4
4
|
/**
|
|
5
|
-
* Create the state required to render SwatchPickerRow.
|
|
5
|
+
* Create the base state required to render unstyled SwatchPickerRow.
|
|
6
6
|
*
|
|
7
|
-
* The returned state can be modified with hooks
|
|
8
|
-
* before being passed to renderSwatchPickerRow_unstable.
|
|
7
|
+
* The returned state can be modified with hooks before being passed to renderSwatchPickerRow_unstable.
|
|
9
8
|
*
|
|
10
9
|
* @param props - props from this instance of SwatchPickerRow
|
|
11
10
|
* @param ref - reference to root HTMLDivElement of SwatchPickerRow
|
|
12
|
-
*/ export const
|
|
11
|
+
*/ export const useSwatchPickerRowBase_unstable = (props, ref)=>{
|
|
13
12
|
const { style, ...rest } = props;
|
|
14
|
-
const spacing = useSwatchPickerContextValue_unstable((ctx)=>ctx.spacing);
|
|
15
13
|
return {
|
|
16
14
|
components: {
|
|
17
15
|
root: 'div'
|
|
@@ -22,7 +20,22 @@ import { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicke
|
|
|
22
20
|
...rest
|
|
23
21
|
}), {
|
|
24
22
|
elementType: 'div'
|
|
25
|
-
})
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Create the state required to render SwatchPickerRow.
|
|
28
|
+
*
|
|
29
|
+
* The returned state can be modified with hooks such as useSwatchPickerRowStyles_unstable,
|
|
30
|
+
* before being passed to renderSwatchPickerRow_unstable.
|
|
31
|
+
*
|
|
32
|
+
* @param props - props from this instance of SwatchPickerRow
|
|
33
|
+
* @param ref - reference to root HTMLDivElement of SwatchPickerRow
|
|
34
|
+
*/ export const useSwatchPickerRow_unstable = (props, ref)=>{
|
|
35
|
+
const spacing = useSwatchPickerContextValue_unstable((ctx)=>ctx.spacing);
|
|
36
|
+
const baseState = useSwatchPickerRowBase_unstable(props, ref);
|
|
37
|
+
return {
|
|
38
|
+
...baseState,
|
|
26
39
|
spacing
|
|
27
40
|
};
|
|
28
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPickerRow/useSwatchPickerRow.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPickerRow/useSwatchPickerRow.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n SwatchPickerRowBaseProps,\n SwatchPickerRowBaseState,\n SwatchPickerRowProps,\n SwatchPickerRowState,\n} from './SwatchPickerRow.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled SwatchPickerRow.\n *\n * The returned state can be modified with hooks before being passed to renderSwatchPickerRow_unstable.\n *\n * @param props - props from this instance of SwatchPickerRow\n * @param ref - reference to root HTMLDivElement of SwatchPickerRow\n */\nexport const useSwatchPickerRowBase_unstable = (\n props: SwatchPickerRowBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerRowBaseState => {\n const { style, ...rest } = props;\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'row',\n ...rest,\n }),\n { elementType: 'div' },\n ),\n };\n};\n\n/**\n * Create the state required to render SwatchPickerRow.\n *\n * The returned state can be modified with hooks such as useSwatchPickerRowStyles_unstable,\n * before being passed to renderSwatchPickerRow_unstable.\n *\n * @param props - props from this instance of SwatchPickerRow\n * @param ref - reference to root HTMLDivElement of SwatchPickerRow\n */\nexport const useSwatchPickerRow_unstable = (\n props: SwatchPickerRowProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerRowState => {\n const spacing = useSwatchPickerContextValue_unstable(ctx => ctx.spacing);\n const baseState = useSwatchPickerRowBase_unstable(props, ref);\n\n return {\n ...baseState,\n spacing,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useSwatchPickerContextValue_unstable","useSwatchPickerRowBase_unstable","props","ref","style","rest","components","root","always","role","elementType","useSwatchPickerRow_unstable","spacing","ctx","baseState"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAO3E,SAASC,oCAAoC,QAAQ,iCAA8B;AAEnF;;;;;;;CAOC,GACD,OAAO,MAAMC,kCAAkC,CAC7CC,OACAC;IAEA,MAAM,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGH;IAE3B,OAAO;QACLI,YAAY;YACVC,MAAM;QACR;QACAA,MAAMR,KAAKS,MAAM,CACfV,yBAAyB,OAAO;YAC9BK;YACAM,MAAM;YACN,GAAGJ,IAAI;QACT,IACA;YAAEK,aAAa;QAAM;IAEzB;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMC,8BAA8B,CACzCT,OACAC;IAEA,MAAMS,UAAUZ,qCAAqCa,CAAAA,MAAOA,IAAID,OAAO;IACvE,MAAME,YAAYb,gCAAgCC,OAAOC;IAEzD,OAAO;QACL,GAAGW,SAAS;QACZF;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__resetStyles","mergeClasses","__styles","swatchPickerRowClassNames","root","useResetStyles","useStyles","spacingSmall","i8kkvl","spacingMedium","d","useSwatchPickerRowStyles_unstable","state","resetStyles","styles","spacingStyle","spacing","className"],"sources":["useSwatchPickerRowStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, mergeClasses, makeStyles } from
|
|
1
|
+
{"version":3,"names":["__resetStyles","mergeClasses","__styles","swatchPickerRowClassNames","root","useResetStyles","useStyles","spacingSmall","i8kkvl","spacingMedium","d","useSwatchPickerRowStyles_unstable","state","resetStyles","styles","spacingStyle","spacing","className"],"sources":["useSwatchPickerRowStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, mergeClasses, makeStyles } from \"@griffel/react\";\nexport const swatchPickerRowClassNames = {\n root: 'fui-SwatchPickerRow'\n};\n/**\n * Styles for the root slot\n */ const useResetStyles = makeResetStyles({\n display: 'flex',\n flexDirection: 'row'\n});\nconst useStyles = makeStyles({\n spacingSmall: {\n columnGap: '2px'\n },\n spacingMedium: {\n columnGap: '4px'\n }\n});\n/**\n * Apply styling to the SwatchPickerRow slots based on the state\n */ export const useSwatchPickerRowStyles_unstable = (state)=>{\n const resetStyles = useResetStyles();\n const styles = useStyles();\n const spacingStyle = state.spacing === 'small' ? styles.spacingSmall : styles.spacingMedium;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(swatchPickerRowClassNames.root, resetStyles, spacingStyle, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAA0BC,YAAY,EAAAC,QAAA,QAAoB,gBAAgB;AAC1E,OAAO,MAAMC,yBAAyB,GAAG;EACrCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,cAAc,gBAAGL,aAAA,kEAG1B,CAAC;AACF,MAAMM,SAAS,gBAAGJ,QAAA;EAAAK,YAAA;IAAAC,MAAA;EAAA;EAAAC,aAAA;IAAAD,MAAA;EAAA;AAAA;EAAAE,CAAA;AAAA,CAOjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,iCAAiC,GAAIC,KAAK,IAAG;EAC1D,MAAMC,WAAW,GAAGR,cAAc,CAAC,CAAC;EACpC,MAAMS,MAAM,GAAGR,SAAS,CAAC,CAAC;EAC1B,MAAMS,YAAY,GAAGH,KAAK,CAACI,OAAO,KAAK,OAAO,GAAGF,MAAM,CAACP,YAAY,GAAGO,MAAM,CAACL,aAAa;EAC3F;EACAG,KAAK,CAACR,IAAI,CAACa,SAAS,GAAGhB,YAAY,CAACE,yBAAyB,CAACC,IAAI,EAAES,WAAW,EAAEE,YAAY,EAAEH,KAAK,CAACR,IAAI,CAACa,SAAS,CAAC;EACpH,OAAOL,KAAK;AAChB,CAAC","ignoreList":[]}
|
package/lib/contexts/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SwatchPickerProvider, swatchPickerContextDefaultValue, useSwatchPickerContextValue_unstable } from
|
|
2
|
-
export { useSwatchPickerContextValues } from
|
|
1
|
+
export { SwatchPickerProvider, swatchPickerContextDefaultValue, useSwatchPickerContextValue_unstable } from "./swatchPicker.js";
|
|
2
|
+
export { useSwatchPickerContextValues } from "../components/SwatchPicker/useSwatchPickerContextValues.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export type { SwatchPickerContextValue, SwatchPickerContextValues } from './swatchPicker';\nexport {\n SwatchPickerProvider,\n swatchPickerContextDefaultValue,\n useSwatchPickerContextValue_unstable,\n} from './swatchPicker';\nexport { useSwatchPickerContextValues } from '../components/SwatchPicker/useSwatchPickerContextValues';\n"],"names":["SwatchPickerProvider","swatchPickerContextDefaultValue","useSwatchPickerContextValue_unstable","useSwatchPickerContextValues"],"mappings":"AACA,SACEA,oBAAoB,EACpBC,+BAA+B,EAC/BC,oCAAoC,QAC/B,
|
|
1
|
+
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export type { SwatchPickerContextValue, SwatchPickerContextValues } from './swatchPicker';\nexport {\n SwatchPickerProvider,\n swatchPickerContextDefaultValue,\n useSwatchPickerContextValue_unstable,\n} from './swatchPicker';\nexport { useSwatchPickerContextValues } from '../components/SwatchPicker/useSwatchPickerContextValues';\n"],"names":["SwatchPickerProvider","swatchPickerContextDefaultValue","useSwatchPickerContextValue_unstable","useSwatchPickerContextValues"],"mappings":"AACA,SACEA,oBAAoB,EACpBC,+BAA+B,EAC/BC,oCAAoC,QAC/B,oBAAiB;AACxB,SAASC,4BAA4B,QAAQ,6DAA0D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { createContext, useContextSelector } from
|
|
2
|
+
import { createContext, useContextSelector } from "@fluentui/react-context-selector";
|
|
3
3
|
export const swatchPickerContextDefaultValue = {
|
|
4
4
|
requestSelectionChange: ()=>{
|
|
5
5
|
/*noop*/ },
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { SwatchPicker, renderSwatchPicker_unstable, useSwatchPickerStyles_unstable, useSwatchPicker_unstable, swatchPickerClassNames } from
|
|
2
|
-
export { SwatchPickerProvider, swatchPickerContextDefaultValue, useSwatchPickerContextValue_unstable, useSwatchPickerContextValues } from
|
|
3
|
-
export { ColorSwatch, renderColorSwatch_unstable, useColorSwatchStyles_unstable, useColorSwatch_unstable, colorSwatchClassNames, swatchCSSVars } from
|
|
4
|
-
export { ImageSwatch, renderImageSwatch_unstable, useImageSwatchStyles_unstable, useImageSwatch_unstable, imageSwatchClassNames } from
|
|
5
|
-
export { SwatchPickerRow, renderSwatchPickerRow_unstable, useSwatchPickerRowStyles_unstable, useSwatchPickerRow_unstable, swatchPickerRowClassNames } from
|
|
6
|
-
export { renderSwatchPickerGrid } from
|
|
7
|
-
export { EmptySwatch, renderEmptySwatch_unstable, useEmptySwatchStyles_unstable, useEmptySwatch_unstable, emptySwatchClassNames } from
|
|
1
|
+
export { SwatchPicker, renderSwatchPicker_unstable, useSwatchPickerStyles_unstable, useSwatchPicker_unstable, useSwatchPickerBase_unstable, swatchPickerClassNames } from "./SwatchPicker.js";
|
|
2
|
+
export { SwatchPickerProvider, swatchPickerContextDefaultValue, useSwatchPickerContextValue_unstable, useSwatchPickerContextValues } from "./contexts/index.js";
|
|
3
|
+
export { ColorSwatch, renderColorSwatch_unstable, useColorSwatchStyles_unstable, useColorSwatch_unstable, useColorSwatchBase_unstable, colorSwatchClassNames, swatchCSSVars } from "./ColorSwatch.js";
|
|
4
|
+
export { ImageSwatch, renderImageSwatch_unstable, useImageSwatchStyles_unstable, useImageSwatch_unstable, useImageSwatchBase_unstable, imageSwatchClassNames } from "./ImageSwatch.js";
|
|
5
|
+
export { SwatchPickerRow, renderSwatchPickerRow_unstable, useSwatchPickerRowStyles_unstable, useSwatchPickerRowBase_unstable, useSwatchPickerRow_unstable, swatchPickerRowClassNames } from "./SwatchPickerRow.js";
|
|
6
|
+
export { renderSwatchPickerGrid } from "./utils/renderUtils.js";
|
|
7
|
+
export { EmptySwatch, renderEmptySwatch_unstable, useEmptySwatchStyles_unstable, useEmptySwatch_unstable, useEmptySwatchBase_unstable, emptySwatchClassNames } from "./EmptySwatch.js";
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n SwatchPicker,\n renderSwatchPicker_unstable,\n useSwatchPickerStyles_unstable,\n useSwatchPicker_unstable,\n swatchPickerClassNames,\n} from './SwatchPicker';\nexport {\n SwatchPickerProvider,\n swatchPickerContextDefaultValue,\n useSwatchPickerContextValue_unstable,\n useSwatchPickerContextValues,\n} from './contexts';\nexport type { SwatchPickerContextValue, SwatchPickerContextValues } from './contexts';\nexport type {\n SwatchPickerProps,\n SwatchPickerSlots,\n SwatchPickerState,\n SwatchPickerOnSelectionChangeData,\n SwatchPickerOnSelectEventHandler,\n} from './SwatchPicker';\nexport {\n ColorSwatch,\n renderColorSwatch_unstable,\n useColorSwatchStyles_unstable,\n useColorSwatch_unstable,\n colorSwatchClassNames,\n swatchCSSVars,\n} from './ColorSwatch';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n SwatchPicker,\n renderSwatchPicker_unstable,\n useSwatchPickerStyles_unstable,\n useSwatchPicker_unstable,\n useSwatchPickerBase_unstable,\n swatchPickerClassNames,\n} from './SwatchPicker';\nexport {\n SwatchPickerProvider,\n swatchPickerContextDefaultValue,\n useSwatchPickerContextValue_unstable,\n useSwatchPickerContextValues,\n} from './contexts';\nexport type { SwatchPickerContextValue, SwatchPickerContextValues } from './contexts';\nexport type {\n SwatchPickerBaseProps,\n SwatchPickerBaseState,\n SwatchPickerProps,\n SwatchPickerSlots,\n SwatchPickerState,\n SwatchPickerOnSelectionChangeData,\n SwatchPickerOnSelectEventHandler,\n} from './SwatchPicker';\nexport {\n ColorSwatch,\n renderColorSwatch_unstable,\n useColorSwatchStyles_unstable,\n useColorSwatch_unstable,\n useColorSwatchBase_unstable,\n colorSwatchClassNames,\n swatchCSSVars,\n} from './ColorSwatch';\nexport type {\n ColorSwatchBaseProps,\n ColorSwatchBaseState,\n ColorSwatchProps,\n ColorSwatchSlots,\n ColorSwatchState,\n} from './ColorSwatch';\nexport {\n ImageSwatch,\n renderImageSwatch_unstable,\n useImageSwatchStyles_unstable,\n useImageSwatch_unstable,\n useImageSwatchBase_unstable,\n imageSwatchClassNames,\n} from './ImageSwatch';\nexport type {\n ImageSwatchBaseProps,\n ImageSwatchBaseState,\n ImageSwatchProps,\n ImageSwatchSlots,\n ImageSwatchState,\n} from './ImageSwatch';\nexport type {\n SwatchPickerRowBaseProps,\n SwatchPickerRowBaseState,\n SwatchPickerRowProps,\n SwatchPickerRowSlots,\n SwatchPickerRowState,\n} from './SwatchPickerRow';\nexport {\n SwatchPickerRow,\n renderSwatchPickerRow_unstable,\n useSwatchPickerRowStyles_unstable,\n useSwatchPickerRowBase_unstable,\n useSwatchPickerRow_unstable,\n swatchPickerRowClassNames,\n} from './SwatchPickerRow';\nexport { renderSwatchPickerGrid } from './utils/renderUtils';\nexport type { SwatchProps, SwatchPickerGridProps } from './utils/renderUtils';\nexport {\n EmptySwatch,\n renderEmptySwatch_unstable,\n useEmptySwatchStyles_unstable,\n useEmptySwatch_unstable,\n useEmptySwatchBase_unstable,\n emptySwatchClassNames,\n} from './EmptySwatch';\nexport type {\n EmptySwatchBaseProps,\n EmptySwatchBaseState,\n EmptySwatchProps,\n EmptySwatchSlots,\n EmptySwatchState,\n} from './EmptySwatch';\n"],"names":["SwatchPicker","renderSwatchPicker_unstable","useSwatchPickerStyles_unstable","useSwatchPicker_unstable","useSwatchPickerBase_unstable","swatchPickerClassNames","SwatchPickerProvider","swatchPickerContextDefaultValue","useSwatchPickerContextValue_unstable","useSwatchPickerContextValues","ColorSwatch","renderColorSwatch_unstable","useColorSwatchStyles_unstable","useColorSwatch_unstable","useColorSwatchBase_unstable","colorSwatchClassNames","swatchCSSVars","ImageSwatch","renderImageSwatch_unstable","useImageSwatchStyles_unstable","useImageSwatch_unstable","useImageSwatchBase_unstable","imageSwatchClassNames","SwatchPickerRow","renderSwatchPickerRow_unstable","useSwatchPickerRowStyles_unstable","useSwatchPickerRowBase_unstable","useSwatchPickerRow_unstable","swatchPickerRowClassNames","renderSwatchPickerGrid","EmptySwatch","renderEmptySwatch_unstable","useEmptySwatchStyles_unstable","useEmptySwatch_unstable","useEmptySwatchBase_unstable","emptySwatchClassNames"],"mappings":"AAAA,SACEA,YAAY,EACZC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,wBAAwB,EACxBC,4BAA4B,EAC5BC,sBAAsB,QACjB,oBAAiB;AACxB,SACEC,oBAAoB,EACpBC,+BAA+B,EAC/BC,oCAAoC,EACpCC,4BAA4B,QACvB,sBAAa;AAWpB,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,2BAA2B,EAC3BC,qBAAqB,EACrBC,aAAa,QACR,mBAAgB;AAQvB,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,2BAA2B,EAC3BC,qBAAqB,QAChB,mBAAgB;AAevB,SACEC,eAAe,EACfC,8BAA8B,EAC9BC,iCAAiC,EACjCC,+BAA+B,EAC/BC,2BAA2B,EAC3BC,yBAAyB,QACpB,uBAAoB;AAC3B,SAASC,sBAAsB,QAAQ,yBAAsB;AAE7D,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,2BAA2B,EAC3BC,qBAAqB,QAChB,mBAAgB"}
|
package/lib/utils/renderUtils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { ColorSwatch, SwatchPickerRow, ImageSwatch } from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ColorSwatch, SwatchPickerRow, ImageSwatch } from "../index.js";
|
|
3
3
|
export const renderSwatchPickerGrid = (props)=>{
|
|
4
4
|
const { items, columnCount, renderRow, renderSwatch } = props;
|
|
5
5
|
const _renderRow = renderRow || (({ children, rowId })=>/*#__PURE__*/ React.createElement(SwatchPickerRow, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/renderUtils.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { ColorSwatch, SwatchPickerRow, ImageSwatch } from '../';\nimport type { ColorSwatchProps, ImageSwatchProps } from '../';\n\nexport type SwatchProps = ImageSwatchProps | ColorSwatchProps;\n\nexport type SwatchPickerGridProps = {\n items: SwatchProps[];\n columnCount: number;\n renderRow?: (props: { children: JSXElement[]; rowId: string | number }) => JSXElement;\n renderSwatch?: (item: SwatchProps) => JSXElement;\n};\n\nexport const renderSwatchPickerGrid = (props: SwatchPickerGridProps): JSXElement[] => {\n const { items, columnCount, renderRow, renderSwatch } = props;\n const _renderRow = renderRow || (({ children, rowId }) => <SwatchPickerRow key={rowId}>{children}</SwatchPickerRow>);\n const _renderSwatch =\n renderSwatch ||\n ((item: SwatchProps) =>\n (item as ImageSwatchProps).src ? (\n <ImageSwatch key={item.value} src={(item as ImageSwatchProps).src ?? ''} {...item} />\n ) : (\n <ColorSwatch key={item.value} color={item.color || ''} {...item} />\n ));\n\n const rowCount = Math.ceil(items.length / columnCount);\n const rows = Array.from({ length: rowCount }, (_, i) => {\n const start = i * columnCount;\n const end = start + columnCount;\n return items.slice(start, end);\n });\n\n return rows.map((row, index) => _renderRow({ children: row.map(_renderSwatch), rowId: index }));\n};\n"],"names":["React","ColorSwatch","SwatchPickerRow","ImageSwatch","renderSwatchPickerGrid","props","items","columnCount","renderRow","renderSwatch","_renderRow","children","rowId","key","_renderSwatch","item","src","value","color","rowCount","Math","ceil","length","rows","Array","from","_","i","start","end","slice","map","row","index"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,WAAW,EAAEC,eAAe,EAAEC,WAAW,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/utils/renderUtils.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { ColorSwatch, SwatchPickerRow, ImageSwatch } from '../';\nimport type { ColorSwatchProps, ImageSwatchProps } from '../';\n\nexport type SwatchProps = ImageSwatchProps | ColorSwatchProps;\n\nexport type SwatchPickerGridProps = {\n items: SwatchProps[];\n columnCount: number;\n renderRow?: (props: { children: JSXElement[]; rowId: string | number }) => JSXElement;\n renderSwatch?: (item: SwatchProps) => JSXElement;\n};\n\nexport const renderSwatchPickerGrid = (props: SwatchPickerGridProps): JSXElement[] => {\n const { items, columnCount, renderRow, renderSwatch } = props;\n const _renderRow = renderRow || (({ children, rowId }) => <SwatchPickerRow key={rowId}>{children}</SwatchPickerRow>);\n const _renderSwatch =\n renderSwatch ||\n ((item: SwatchProps) =>\n (item as ImageSwatchProps).src ? (\n <ImageSwatch key={item.value} src={(item as ImageSwatchProps).src ?? ''} {...item} />\n ) : (\n <ColorSwatch key={item.value} color={item.color || ''} {...item} />\n ));\n\n const rowCount = Math.ceil(items.length / columnCount);\n const rows = Array.from({ length: rowCount }, (_, i) => {\n const start = i * columnCount;\n const end = start + columnCount;\n return items.slice(start, end);\n });\n\n return rows.map((row, index) => _renderRow({ children: row.map(_renderSwatch), rowId: index }));\n};\n"],"names":["React","ColorSwatch","SwatchPickerRow","ImageSwatch","renderSwatchPickerGrid","props","items","columnCount","renderRow","renderSwatch","_renderRow","children","rowId","key","_renderSwatch","item","src","value","color","rowCount","Math","ceil","length","rows","Array","from","_","i","start","end","slice","map","row","index"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,WAAW,EAAEC,eAAe,EAAEC,WAAW,QAAQ,cAAM;AAYhE,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAE,GAAGJ;IACxD,MAAMK,aAAaF,aAAc,CAAA,CAAC,EAAEG,QAAQ,EAAEC,KAAK,EAAE,iBAAK,oBAACV;YAAgBW,KAAKD;WAAQD,SAA0B;IAClH,MAAMG,gBACJL,gBACC,CAAA,CAACM;YAEqC;eADrC,AAACA,KAA0BC,GAAG,iBAC5B,oBAACb;YAAYU,KAAKE,KAAKE,KAAK;YAAED,KAAK,CAAA,YAAA,AAACD,KAA0BC,GAAG,cAA9B,uBAAA,YAAkC;YAAK,GAAGD,IAAI;2BAEjF,oBAACd;YAAYY,KAAKE,KAAKE,KAAK;YAAEC,OAAOH,KAAKG,KAAK,IAAI;YAAK,GAAGH,IAAI;;KACjE;IAEJ,MAAMI,WAAWC,KAAKC,IAAI,CAACf,MAAMgB,MAAM,GAAGf;IAC1C,MAAMgB,OAAOC,MAAMC,IAAI,CAAC;QAAEH,QAAQH;IAAS,GAAG,CAACO,GAAGC;QAChD,MAAMC,QAAQD,IAAIpB;QAClB,MAAMsB,MAAMD,QAAQrB;QACpB,OAAOD,MAAMwB,KAAK,CAACF,OAAOC;IAC5B;IAEA,OAAON,KAAKQ,GAAG,CAAC,CAACC,KAAKC,QAAUvB,WAAW;YAAEC,UAAUqB,IAAID,GAAG,CAACjB;YAAgBF,OAAOqB;QAAM;AAC9F,EAAE"}
|
|
@@ -21,6 +21,9 @@ _export(exports, {
|
|
|
21
21
|
swatchCSSVars: function() {
|
|
22
22
|
return _index.swatchCSSVars;
|
|
23
23
|
},
|
|
24
|
+
useColorSwatchBase_unstable: function() {
|
|
25
|
+
return _index.useColorSwatchBase_unstable;
|
|
26
|
+
},
|
|
24
27
|
useColorSwatchStyles_unstable: function() {
|
|
25
28
|
return _index.useColorSwatchStyles_unstable;
|
|
26
29
|
},
|
|
@@ -28,4 +31,4 @@ _export(exports, {
|
|
|
28
31
|
return _index.useColorSwatch_unstable;
|
|
29
32
|
}
|
|
30
33
|
});
|
|
31
|
-
const _index = require("./components/ColorSwatch/index");
|
|
34
|
+
const _index = require("./components/ColorSwatch/index.cjs");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ColorSwatch.ts"],"sourcesContent":["export type {\n ColorSwatchBaseProps,\n ColorSwatchBaseState,\n ColorSwatchProps,\n ColorSwatchSlots,\n ColorSwatchState,\n} from './components/ColorSwatch/index';\nexport {\n ColorSwatch,\n colorSwatchClassNames,\n renderColorSwatch_unstable,\n swatchCSSVars,\n useColorSwatchStyles_unstable,\n useColorSwatch_unstable,\n useColorSwatchBase_unstable,\n} from './components/ColorSwatch/index';\n"],"names":["ColorSwatch","colorSwatchClassNames","renderColorSwatch_unstable","swatchCSSVars","useColorSwatchStyles_unstable","useColorSwatch_unstable","useColorSwatchBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,kBAAW;;;eACXC,4BAAqB;;;eACrBC,iCAA0B;;;eAC1BC,oBAAa;;;eAGbG,kCAA2B;;;eAF3BF,oCAA6B;;;eAC7BC,8BAAuB;;;uBAElB,oCAAiC"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
renderEmptySwatch_unstable: function() {
|
|
19
19
|
return _index.renderEmptySwatch_unstable;
|
|
20
20
|
},
|
|
21
|
+
useEmptySwatchBase_unstable: function() {
|
|
22
|
+
return _index.useEmptySwatchBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useEmptySwatchStyles_unstable: function() {
|
|
22
25
|
return _index.useEmptySwatchStyles_unstable;
|
|
23
26
|
},
|
|
@@ -25,4 +28,4 @@ _export(exports, {
|
|
|
25
28
|
return _index.useEmptySwatch_unstable;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
|
-
const _index = require("./components/EmptySwatch/index");
|
|
31
|
+
const _index = require("./components/EmptySwatch/index.cjs");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/EmptySwatch.ts"],"sourcesContent":["export type {\n EmptySwatchBaseProps,\n EmptySwatchBaseState,\n EmptySwatchProps,\n EmptySwatchSlots,\n EmptySwatchState,\n} from './components/EmptySwatch/index';\nexport {\n EmptySwatch,\n emptySwatchClassNames,\n renderEmptySwatch_unstable,\n useEmptySwatchBase_unstable,\n useEmptySwatchStyles_unstable,\n useEmptySwatch_unstable,\n} from './components/EmptySwatch/index';\n"],"names":["EmptySwatch","emptySwatchClassNames","renderEmptySwatch_unstable","useEmptySwatchBase_unstable","useEmptySwatchStyles_unstable","useEmptySwatch_unstable"],"mappings":";;;;;;;;;;;;eAQEA,kBAAW;;;eACXC,4BAAqB;;;eACrBC,iCAA0B;;;eAC1BC,kCAA2B;;;eAC3BC,oCAA6B;;;eAC7BC,8BAAuB;;;uBAClB,oCAAiC"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
renderImageSwatch_unstable: function() {
|
|
19
19
|
return _index.renderImageSwatch_unstable;
|
|
20
20
|
},
|
|
21
|
+
useImageSwatchBase_unstable: function() {
|
|
22
|
+
return _index.useImageSwatchBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useImageSwatchStyles_unstable: function() {
|
|
22
25
|
return _index.useImageSwatchStyles_unstable;
|
|
23
26
|
},
|
|
@@ -25,4 +28,4 @@ _export(exports, {
|
|
|
25
28
|
return _index.useImageSwatch_unstable;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
|
-
const _index = require("./components/ImageSwatch/index");
|
|
31
|
+
const _index = require("./components/ImageSwatch/index.cjs");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ImageSwatch.ts"],"sourcesContent":["export type {\n ImageSwatchBaseProps,\n ImageSwatchBaseState,\n ImageSwatchProps,\n ImageSwatchSlots,\n ImageSwatchState,\n} from './components/ImageSwatch/index';\nexport {\n ImageSwatch,\n imageSwatchClassNames,\n renderImageSwatch_unstable,\n useImageSwatchStyles_unstable,\n useImageSwatch_unstable,\n useImageSwatchBase_unstable,\n} from './components/ImageSwatch/index';\n"],"names":["ImageSwatch","imageSwatchClassNames","renderImageSwatch_unstable","useImageSwatchStyles_unstable","useImageSwatch_unstable","useImageSwatchBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,kBAAW;;;eACXC,4BAAqB;;;eACrBC,iCAA0B;;;eAG1BG,kCAA2B;;;eAF3BF,oCAA6B;;;eAC7BC,8BAAuB;;;uBAElB,oCAAiC"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
swatchPickerClassNames: function() {
|
|
19
19
|
return _index.swatchPickerClassNames;
|
|
20
20
|
},
|
|
21
|
+
useSwatchPickerBase_unstable: function() {
|
|
22
|
+
return _index.useSwatchPickerBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useSwatchPickerStyles_unstable: function() {
|
|
22
25
|
return _index.useSwatchPickerStyles_unstable;
|
|
23
26
|
},
|
|
@@ -25,4 +28,4 @@ _export(exports, {
|
|
|
25
28
|
return _index.useSwatchPicker_unstable;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
|
-
const _index = require("./components/SwatchPicker/index");
|
|
31
|
+
const _index = require("./components/SwatchPicker/index.cjs");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SwatchPicker.ts"],"sourcesContent":["export type {\n SwatchPickerBaseProps,\n SwatchPickerBaseState,\n SwatchPickerOnSelectEventHandler,\n SwatchPickerOnSelectionChangeData,\n SwatchPickerProps,\n SwatchPickerSlots,\n SwatchPickerState,\n} from './components/SwatchPicker/index';\nexport {\n SwatchPicker,\n renderSwatchPicker_unstable,\n swatchPickerClassNames,\n useSwatchPickerStyles_unstable,\n useSwatchPicker_unstable,\n useSwatchPickerBase_unstable,\n} from './components/SwatchPicker/index';\n"],"names":["SwatchPicker","renderSwatchPicker_unstable","swatchPickerClassNames","useSwatchPickerStyles_unstable","useSwatchPicker_unstable","useSwatchPickerBase_unstable"],"mappings":";;;;;;;;;;;;eAUEA,mBAAY;;;eACZC,kCAA2B;;;eAC3BC,6BAAsB;;;eAGtBG,mCAA4B;;;eAF5BF,qCAA8B;;;eAC9BC,+BAAwB;;;uBAEnB,qCAAkC"}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
swatchPickerRowClassNames: function() {
|
|
19
19
|
return _index.swatchPickerRowClassNames;
|
|
20
20
|
},
|
|
21
|
+
useSwatchPickerRowBase_unstable: function() {
|
|
22
|
+
return _index.useSwatchPickerRowBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useSwatchPickerRowStyles_unstable: function() {
|
|
22
25
|
return _index.useSwatchPickerRowStyles_unstable;
|
|
23
26
|
},
|
|
@@ -25,4 +28,4 @@ _export(exports, {
|
|
|
25
28
|
return _index.useSwatchPickerRow_unstable;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
|
-
const _index = require("./components/SwatchPickerRow/index");
|
|
31
|
+
const _index = require("./components/SwatchPickerRow/index.cjs");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SwatchPickerRow.ts"],"sourcesContent":["export type {\n SwatchPickerRowBaseProps,\n SwatchPickerRowBaseState,\n SwatchPickerRowProps,\n SwatchPickerRowSlots,\n SwatchPickerRowState,\n} from './components/SwatchPickerRow/index';\nexport {\n SwatchPickerRow,\n renderSwatchPickerRow_unstable,\n swatchPickerRowClassNames,\n useSwatchPickerRowStyles_unstable,\n useSwatchPickerRow_unstable,\n useSwatchPickerRowBase_unstable,\n} from './components/SwatchPickerRow/index';\n"],"names":["SwatchPickerRow","renderSwatchPickerRow_unstable","swatchPickerRowClassNames","useSwatchPickerRowStyles_unstable","useSwatchPickerRow_unstable","useSwatchPickerRowBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,sBAAe;;;eACfC,qCAA8B;;;eAC9BC,gCAAyB;;;eAGzBG,sCAA+B;;;eAF/BF,wCAAiC;;;eACjCC,kCAA2B;;;uBAEtB,wCAAqC"}
|
|
@@ -11,9 +11,9 @@ Object.defineProperty(exports, "ColorSwatch", {
|
|
|
11
11
|
});
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
|
-
const _useColorSwatch = require("./useColorSwatch");
|
|
15
|
-
const _renderColorSwatch = require("./renderColorSwatch");
|
|
16
|
-
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles");
|
|
14
|
+
const _useColorSwatch = require("./useColorSwatch.cjs");
|
|
15
|
+
const _renderColorSwatch = require("./renderColorSwatch.cjs");
|
|
16
|
+
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles.cjs");
|
|
17
17
|
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
18
18
|
const ColorSwatch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
19
19
|
const state = (0, _useColorSwatch.useColorSwatch_unstable)(props, ref);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ColorSwatch/ColorSwatch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useColorSwatch_unstable } from './useColorSwatch';\nimport { renderColorSwatch_unstable } from './renderColorSwatch';\nimport { useColorSwatchStyles_unstable } from './useColorSwatchStyles.styles';\nimport type { ColorSwatchProps } from './ColorSwatch.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * ColorSwatch component is used to render a colors, icons and gradients.\n */\nexport const ColorSwatch: ForwardRefComponent<ColorSwatchProps> = React.forwardRef((props, ref) => {\n const state = useColorSwatch_unstable(props, ref);\n\n useColorSwatchStyles_unstable(state);\n useCustomStyleHook_unstable('useColorSwatchStyles_unstable')(state);\n\n return renderColorSwatch_unstable(state);\n});\n\nColorSwatch.displayName = 'ColorSwatch';\n"],"names":["React","useColorSwatch_unstable","renderColorSwatch_unstable","useColorSwatchStyles_unstable","useCustomStyleHook_unstable","ColorSwatch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;gCAES,
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorSwatch/ColorSwatch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useColorSwatch_unstable } from './useColorSwatch';\nimport { renderColorSwatch_unstable } from './renderColorSwatch';\nimport { useColorSwatchStyles_unstable } from './useColorSwatchStyles.styles';\nimport type { ColorSwatchProps } from './ColorSwatch.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * ColorSwatch component is used to render a colors, icons and gradients.\n */\nexport const ColorSwatch: ForwardRefComponent<ColorSwatchProps> = React.forwardRef((props, ref) => {\n const state = useColorSwatch_unstable(props, ref);\n\n useColorSwatchStyles_unstable(state);\n useCustomStyleHook_unstable('useColorSwatchStyles_unstable')(state);\n\n return renderColorSwatch_unstable(state);\n});\n\nColorSwatch.displayName = 'ColorSwatch';\n"],"names":["React","useColorSwatch_unstable","renderColorSwatch_unstable","useColorSwatchStyles_unstable","useCustomStyleHook_unstable","ColorSwatch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;gCAES,sBAAmB;mCAChB,yBAAsB;4CACnB,mCAAgC;qCAElC,kCAAkC;AAKvE,MAAMK,cAAAA,WAAAA,GAAqDL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,YAAQR,uCAAAA,EAAwBM,OAAOC;QAE7CL,yDAAAA,EAA8BM;QAC9BL,gDAAAA,EAA4B,iCAAiCK;IAE7D,WAAOP,6CAAAA,EAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "swatchCSSVars", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return swatchCSSVars;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const swatchCSSVars = {
|
|
12
|
+
color: `--fui-SwatchPicker--color`,
|
|
13
|
+
borderColor: `--fui-SwatchPicker--borderColor`
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorSwatch/ColorSwatch.constants.ts"],"sourcesContent":["export const swatchCSSVars = {\n color: `--fui-SwatchPicker--color`,\n borderColor: `--fui-SwatchPicker--borderColor`,\n};\n"],"names":["swatchCSSVars","color","borderColor"],"mappings":";;;;;;;;;;AAAO,MAAMA,gBAAgB;IAC3BC,OAAO,CAAC,yBAAyB,CAAC;IAClCC,aAAa,CAAC,+BAA+B,CAAC;AAChD,EAAE"}
|
package/lib-commonjs/components/ColorSwatch/{ColorSwatch.types.js.map → ColorSwatch.types.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ColorSwatch/ColorSwatch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type ColorSwatchSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n disabledIcon?: Slot<'span'>;\n};\n\n/**\n * ColorSwatch Props\n */\nexport type ColorSwatchProps = ComponentProps<ColorSwatchSlots> &\n Pick<SwatchPickerProps, 'size' | 'shape'> & {\n /**\n * Border color when contrast is low\n */\n borderColor?: string;\n\n /**\n * Swatch color\n */\n color: string;\n\n /**\n * Whether the swatch is disabled\n */\n disabled?: boolean;\n\n /**\n * Swatch value\n */\n value: string;\n };\n\n/**\n * State used in rendering ColorSwatch\n */\nexport type ColorSwatchState = ComponentState<ColorSwatchSlots> &\n Pick<ColorSwatchProps, 'color' | 'disabled' | 'size' | 'shape' | 'value'> & {\n selected: boolean;\n };\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorSwatch/ColorSwatch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type ColorSwatchSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n disabledIcon?: Slot<'span'>;\n};\n\n/**\n * ColorSwatch Props\n */\nexport type ColorSwatchProps = ComponentProps<ColorSwatchSlots> &\n Pick<SwatchPickerProps, 'size' | 'shape'> & {\n /**\n * Border color when contrast is low\n */\n borderColor?: string;\n\n /**\n * Swatch color\n */\n color: string;\n\n /**\n * Whether the swatch is disabled\n */\n disabled?: boolean;\n\n /**\n * Swatch value\n */\n value: string;\n };\n\nexport type ColorSwatchBaseProps = Omit<ColorSwatchProps, 'size' | 'shape'>;\n\n/**\n * State used in rendering ColorSwatch\n */\nexport type ColorSwatchState = ComponentState<ColorSwatchSlots> &\n Pick<ColorSwatchProps, 'color' | 'disabled' | 'size' | 'shape' | 'value'> & {\n selected: boolean;\n };\n\nexport type ColorSwatchBaseState = Omit<ColorSwatchState, 'size' | 'shape'>;\n"],"names":[],"mappings":""}
|
|
@@ -19,7 +19,10 @@ _export(exports, {
|
|
|
19
19
|
return _renderColorSwatch.renderColorSwatch_unstable;
|
|
20
20
|
},
|
|
21
21
|
swatchCSSVars: function() {
|
|
22
|
-
return
|
|
22
|
+
return _ColorSwatchconstants.swatchCSSVars;
|
|
23
|
+
},
|
|
24
|
+
useColorSwatchBase_unstable: function() {
|
|
25
|
+
return _useColorSwatch.useColorSwatchBase_unstable;
|
|
23
26
|
},
|
|
24
27
|
useColorSwatchStyles_unstable: function() {
|
|
25
28
|
return _useColorSwatchStylesstyles.useColorSwatchStyles_unstable;
|
|
@@ -28,7 +31,8 @@ _export(exports, {
|
|
|
28
31
|
return _useColorSwatch.useColorSwatch_unstable;
|
|
29
32
|
}
|
|
30
33
|
});
|
|
31
|
-
const _ColorSwatch = require("./ColorSwatch");
|
|
32
|
-
const _renderColorSwatch = require("./renderColorSwatch");
|
|
33
|
-
const _useColorSwatch = require("./useColorSwatch");
|
|
34
|
-
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles");
|
|
34
|
+
const _ColorSwatch = require("./ColorSwatch.cjs");
|
|
35
|
+
const _renderColorSwatch = require("./renderColorSwatch.cjs");
|
|
36
|
+
const _useColorSwatch = require("./useColorSwatch.cjs");
|
|
37
|
+
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles.cjs");
|
|
38
|
+
const _ColorSwatchconstants = require("./ColorSwatch.constants.cjs");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorSwatch/index.ts"],"sourcesContent":["export { ColorSwatch } from './ColorSwatch';\nexport type {\n ColorSwatchBaseProps,\n ColorSwatchBaseState,\n ColorSwatchProps,\n ColorSwatchSlots,\n ColorSwatchState,\n} from './ColorSwatch.types';\nexport { renderColorSwatch_unstable } from './renderColorSwatch';\nexport { useColorSwatch_unstable, useColorSwatchBase_unstable } from './useColorSwatch';\nexport { colorSwatchClassNames, useColorSwatchStyles_unstable } from './useColorSwatchStyles.styles';\nexport { swatchCSSVars } from './ColorSwatch.constants';\n"],"names":["ColorSwatch","renderColorSwatch_unstable","useColorSwatch_unstable","useColorSwatchBase_unstable","colorSwatchClassNames","useColorSwatchStyles_unstable","swatchCSSVars"],"mappings":";;;;;;;;;;;IAASA;uCAAW;;IAUXI;gEAAqB;;;eAFrBH,6CAA0B;;;eAG1BK,mCAAa;;;eAFYH,2CAA2B;;;eAC7BE,yDAA6B;;;eADpDH,uCAAuB;;;6BATJ,mBAAgB;mCAQD,yBAAsB;gCACI,sBAAmB;4CACnB,mCAAgC;sCACvE,6BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorSwatch/renderColorSwatch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { ColorSwatchBaseState, ColorSwatchSlots } from './ColorSwatch.types';\n\n/**\n * Render the final JSX of ColorSwatch\n */\nexport const renderColorSwatch_unstable = (state: ColorSwatchBaseState): JSXElement => {\n assertSlots<ColorSwatchSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.icon && <state.icon />}\n {state.disabled && state.disabledIcon && <state.disabledIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderColorSwatch_unstable","state","root","children","icon","disabled","disabledIcon"],"mappings":";;;;+BAUaC;;;;;;4BATb,iCAAiD;gCAErB,4BAA4B;AAOjD,mCAAmC,CAACC;QACzCF,2BAAAA,EAA8BE;IAE9B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAMC,IAAI,CAACC,QAAQ;YACnBF,MAAMG,IAAI,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,IAAI,EAAA,CAAA;YACzBH,MAAMI,QAAQ,IAAIJ,MAAMK,YAAY,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,YAAY,EAAA,CAAA;;;AAGlE,EAAE"}
|
|
@@ -3,23 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useColorSwatchBase_unstable: function() {
|
|
14
|
+
return useColorSwatchBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useColorSwatch_unstable: function() {
|
|
9
17
|
return useColorSwatch_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
12
20
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
22
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
15
|
-
const _swatchPicker = require("../../contexts/swatchPicker");
|
|
16
|
-
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles");
|
|
23
|
+
const _swatchPicker = require("../../contexts/swatchPicker.cjs");
|
|
17
24
|
const _reacticons = require("@fluentui/react-icons");
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const { borderColor, color, disabled, disabledIcon, icon, value, onClick,
|
|
21
|
-
const _size = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.size);
|
|
22
|
-
const _shape = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.shape);
|
|
25
|
+
const _ColorSwatchconstants = require("./ColorSwatch.constants.cjs");
|
|
26
|
+
const useColorSwatchBase_unstable = (props, ref)=>{
|
|
27
|
+
const { borderColor, color, disabled, disabledIcon, icon, value, onClick, style, ...rest } = props;
|
|
23
28
|
const isGrid = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.isGrid);
|
|
24
29
|
const requestSelectionChange = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.requestSelectionChange);
|
|
25
30
|
const selected = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.selectedValue === value);
|
|
@@ -28,8 +33,8 @@ const useColorSwatch_unstable = (props, ref)=>{
|
|
|
28
33
|
selectedSwatch: color
|
|
29
34
|
})));
|
|
30
35
|
const rootVariables = {
|
|
31
|
-
[
|
|
32
|
-
[
|
|
36
|
+
[_ColorSwatchconstants.swatchCSSVars.color]: color,
|
|
37
|
+
[_ColorSwatchconstants.swatchCSSVars.borderColor]: borderColor
|
|
33
38
|
};
|
|
34
39
|
const role = isGrid ? 'gridcell' : 'radio';
|
|
35
40
|
const ariaSelected = isGrid ? {
|
|
@@ -41,10 +46,6 @@ const useColorSwatch_unstable = (props, ref)=>{
|
|
|
41
46
|
elementType: 'span'
|
|
42
47
|
});
|
|
43
48
|
const disabledIconShorthand = _reactutilities.slot.optional(disabledIcon, {
|
|
44
|
-
defaultProps: {
|
|
45
|
-
children: /*#__PURE__*/ _react.createElement(_reacticons.ProhibitedFilled, null)
|
|
46
|
-
},
|
|
47
|
-
renderByDefault: true,
|
|
48
49
|
elementType: 'span'
|
|
49
50
|
});
|
|
50
51
|
return {
|
|
@@ -71,10 +72,27 @@ const useColorSwatch_unstable = (props, ref)=>{
|
|
|
71
72
|
icon: iconShorthand,
|
|
72
73
|
disabledIcon: disabledIconShorthand,
|
|
73
74
|
disabled,
|
|
74
|
-
size: size !== null && size !== void 0 ? size : _size,
|
|
75
|
-
shape: shape !== null && shape !== void 0 ? shape : _shape,
|
|
76
75
|
selected,
|
|
77
76
|
color,
|
|
78
77
|
value
|
|
79
78
|
};
|
|
80
79
|
};
|
|
80
|
+
const useColorSwatch_unstable = (props, ref)=>{
|
|
81
|
+
const sizeFromContext = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.size);
|
|
82
|
+
const shapeFromContext = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.shape);
|
|
83
|
+
const { size = sizeFromContext, shape = shapeFromContext, disabledIcon, ...rest } = props;
|
|
84
|
+
const baseState = useColorSwatchBase_unstable(rest, ref);
|
|
85
|
+
return {
|
|
86
|
+
...baseState,
|
|
87
|
+
size,
|
|
88
|
+
shape,
|
|
89
|
+
disabledIcon: _reactutilities.slot.optional(disabledIcon, {
|
|
90
|
+
defaultProps: {
|
|
91
|
+
...baseState.disabledIcon,
|
|
92
|
+
children: /*#__PURE__*/ _react.createElement(_reacticons.ProhibitedFilled, null)
|
|
93
|
+
},
|
|
94
|
+
renderByDefault: true,
|
|
95
|
+
elementType: 'span'
|
|
96
|
+
})
|
|
97
|
+
};
|
|
98
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ColorSwatch/useColorSwatch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot, useEventCallback, getIntrinsicElementProps, mergeCallbacks } from '@fluentui/react-utilities';\nimport type {\n ColorSwatchBaseProps,\n ColorSwatchBaseState,\n ColorSwatchProps,\n ColorSwatchState,\n} from './ColorSwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\nimport { ProhibitedFilled } from '@fluentui/react-icons';\nimport { swatchCSSVars } from './ColorSwatch.constants';\n\n/**\n * Create the basee state required to render unstyled ColorSwatch.\n *\n * The returned state can be modified with hooks before being passed to renderColorSwatch_unstable.\n *\n * @param props - props from this instance of ColorSwatch\n * @param ref - reference to root HTMLButtonElement of ColorSwatch\n */\nexport const useColorSwatchBase_unstable = (\n props: ColorSwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): ColorSwatchBaseState => {\n const { borderColor, color, disabled, disabledIcon, icon, value, onClick, style, ...rest } = props;\n const isGrid = useSwatchPickerContextValue_unstable(ctx => ctx.isGrid);\n\n const requestSelectionChange = useSwatchPickerContextValue_unstable(ctx => ctx.requestSelectionChange);\n const selected = useSwatchPickerContextValue_unstable(ctx => ctx.selectedValue === value);\n\n const onColorSwatchClick = useEventCallback(\n mergeCallbacks(onClick, (event: React.MouseEvent<HTMLButtonElement>) =>\n requestSelectionChange(event, {\n selectedValue: value,\n selectedSwatch: color,\n }),\n ),\n );\n\n const rootVariables = {\n [swatchCSSVars.color]: color,\n [swatchCSSVars.borderColor]: borderColor,\n };\n\n const role = isGrid ? 'gridcell' : 'radio';\n const ariaSelected = isGrid\n ? {\n 'aria-selected': selected,\n }\n : { 'aria-checked': selected };\n\n const iconShorthand = slot.optional(icon, { elementType: 'span' });\n const disabledIconShorthand = slot.optional(disabledIcon, {\n elementType: 'span',\n });\n\n return {\n components: {\n root: 'button',\n icon: 'span',\n disabledIcon: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...ariaSelected,\n onClick: onColorSwatchClick,\n type: 'button',\n disabled,\n ...rest,\n style: {\n ...rootVariables,\n ...style,\n },\n }),\n { elementType: 'button' },\n ),\n icon: iconShorthand,\n disabledIcon: disabledIconShorthand,\n disabled,\n selected,\n color,\n value,\n };\n};\n\n/**\n * Create the state required to render ColorSwatch.\n *\n * The returned state can be modified with hooks such as useColorSwatchStyles_unstable,\n * before being passed to renderColorSwatch_unstable.\n *\n * @param props - props from this instance of ColorSwatch\n * @param ref - reference to root HTMLButtonElement of ColorSwatch\n */\nexport const useColorSwatch_unstable = (\n props: ColorSwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): ColorSwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n const { size = sizeFromContext, shape = shapeFromContext, disabledIcon, ...rest } = props;\n\n const baseState = useColorSwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size,\n shape,\n disabledIcon: slot.optional(disabledIcon, {\n defaultProps: {\n ...baseState.disabledIcon,\n children: <ProhibitedFilled />,\n },\n renderByDefault: true,\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","slot","useEventCallback","getIntrinsicElementProps","mergeCallbacks","useSwatchPickerContextValue_unstable","ProhibitedFilled","swatchCSSVars","useColorSwatchBase_unstable","props","ref","borderColor","color","disabled","disabledIcon","icon","value","onClick","style","rest","isGrid","ctx","requestSelectionChange","selected","selectedValue","onColorSwatchClick","event","selectedSwatch","rootVariables","role","ariaSelected","iconShorthand","optional","elementType","disabledIconShorthand","components","root","always","type","useColorSwatch_unstable","sizeFromContext","size","shapeFromContext","shape","baseState","defaultProps","children","renderByDefault"],"mappings":"AAAA;;;;;;;;;;;;IAsBaQ,2BAAAA;;;IA4EA+B,uBAAAA;;;;;iEAhGU,QAAQ;gCACkD,4BAA4B;8BAOxD,iCAA8B;4BAClD,wBAAwB;sCAC3B,6BAA0B;AAUjD,oCAAoC,CACzC9B,OACAC;IAEA,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGV;IAC7F,MAAMW,aAASf,kDAAAA,EAAqCgB,CAAAA,MAAOA,IAAID,MAAM;IAErE,MAAME,yBAAyBjB,sDAAAA,EAAqCgB,CAAAA,MAAOA,IAAIC,sBAAsB;IACrG,MAAMC,eAAWlB,kDAAAA,EAAqCgB,CAAAA,MAAOA,IAAIG,aAAa,KAAKR;IAEnF,MAAMS,yBAAqBvB,gCAAAA,MACzBE,8BAAAA,EAAea,SAAS,CAACS,QACvBJ,uBAAuBI,OAAO;YAC5BF,eAAeR;YACfW,gBAAgBf;QAClB;IAIJ,MAAMgB,gBAAgB;QACpB,CAACrB,mCAAAA,CAAcK,KAAK,CAAC,EAAEA;QACvB,CAACL,mCAAAA,CAAcI,WAAW,CAAC,EAAEA;IAC/B;IAEA,MAAMkB,OAAOT,SAAS,aAAa;IACnC,MAAMU,eAAeV,SACjB;QACE,iBAAiBG;IACnB,IACA;QAAE,gBAAgBA;IAAS;IAE/B,MAAMQ,gBAAgB9B,oBAAAA,CAAK+B,QAAQ,CAACjB,MAAM;QAAEkB,aAAa;IAAO;IAChE,MAAMC,wBAAwBjC,oBAAAA,CAAK+B,QAAQ,CAAClB,cAAc;QACxDmB,aAAa;IACf;IAEA,OAAO;QACLE,YAAY;YACVC,MAAM;YACNrB,MAAM;YACND,cAAc;QAChB;QACAsB,MAAMnC,oBAAAA,CAAKoC,MAAM,KACflC,wCAAAA,EAAyB,UAAU;YACjCO;YACAmB;YACA,GAAGC,YAAY;YACfb,SAASQ;YACTa,MAAM;YACNzB;YACA,GAAGM,IAAI;YACPD,OAAO;gBACL,GAAGU,aAAa;gBAChB,GAAGV,KAAK;YACV;QACF,IACA;YAAEe,aAAa;QAAS;QAE1BlB,MAAMgB;QACNjB,cAAcoB;QACdrB;QACAU;QACAX;QACAI;IACF;AACF,EAAE;AAWK,gCAAgC,CACrCP,OACAC;IAEA,MAAM8B,sBAAkBnC,kDAAAA,EAAqCgB,CAAAA,MAAOA,IAAIoB,IAAI;IAC5E,MAAMC,uBAAmBrC,kDAAAA,EAAqCgB,CAAAA,MAAOA,IAAIsB,KAAK;IAC9E,MAAM,EAAEF,OAAOD,eAAe,EAAEG,QAAQD,gBAAgB,EAAE5B,YAAY,EAAE,GAAGK,MAAM,GAAGV;IAEpF,MAAMmC,YAAYpC,4BAA4BW,MAAMT;IAEpD,OAAO;QACL,GAAGkC,SAAS;QACZH;QACAE;QACA7B,cAAcb,oBAAAA,CAAK+B,QAAQ,CAAClB,cAAc;YACxC+B,cAAc;gBACZ,GAAGD,UAAU9B,YAAY;gBACzBgC,UAAAA,WAAAA,GAAU,OAAA,aAAA,CAACxC,4BAAAA,EAAAA;YACb;YACAyC,iBAAiB;YACjBd,aAAa;QACf;IACF;AACF,EAAE"}
|
|
@@ -13,37 +13,31 @@ _export(exports, {
|
|
|
13
13
|
colorSwatchClassNames: function() {
|
|
14
14
|
return colorSwatchClassNames;
|
|
15
15
|
},
|
|
16
|
-
swatchCSSVars: function() {
|
|
17
|
-
return swatchCSSVars;
|
|
18
|
-
},
|
|
19
16
|
useColorSwatchStyles_unstable: function() {
|
|
20
17
|
return useColorSwatchStyles_unstable;
|
|
21
18
|
}
|
|
22
19
|
});
|
|
23
20
|
const _react = require("@griffel/react");
|
|
21
|
+
const _ColorSwatchconstants = require("./ColorSwatch.constants.cjs");
|
|
24
22
|
const colorSwatchClassNames = {
|
|
25
23
|
root: 'fui-ColorSwatch',
|
|
26
24
|
icon: 'fui-ColorSwatch__icon',
|
|
27
25
|
disabledIcon: 'fui-ColorSwatch__disabledIcon'
|
|
28
26
|
};
|
|
29
|
-
const
|
|
30
|
-
color: `--fui-SwatchPicker--color`,
|
|
31
|
-
borderColor: `--fui-SwatchPicker--borderColor`
|
|
32
|
-
};
|
|
33
|
-
const { color, borderColor } = swatchCSSVars;
|
|
27
|
+
const { color, borderColor } = _ColorSwatchconstants.swatchCSSVars;
|
|
34
28
|
/**
|
|
35
29
|
* Styles for the root slot
|
|
36
|
-
*/ const useResetStyles = /*#__PURE__*/ (0, _react.__resetStyles)("
|
|
30
|
+
*/ const useResetStyles = /*#__PURE__*/ (0, _react.__resetStyles)("r15zvwyd", null, {
|
|
37
31
|
r: [
|
|
38
|
-
".
|
|
39
|
-
".
|
|
40
|
-
".
|
|
41
|
-
".
|
|
42
|
-
".
|
|
43
|
-
".
|
|
32
|
+
".r15zvwyd{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;box-sizing:border-box;border:1px solid var(--fui-SwatchPicker--borderColor, var(--colorTransparentStroke));background:var(--fui-SwatchPicker--color);overflow:hidden;padding:0;}",
|
|
33
|
+
".r15zvwyd:hover{cursor:pointer;border:none;box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorBrandStroke1),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}",
|
|
34
|
+
".r15zvwyd:hover:active{border:none;box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorCompoundBrandStrokePressed),inset 0 0 0 var(--strokeWidthThickest) var(--colorStrokeFocus1);}",
|
|
35
|
+
".r15zvwyd:focus{outline:none;}",
|
|
36
|
+
".r15zvwyd:focus-visible{outline:none;}",
|
|
37
|
+
".r15zvwyd[data-fui-focus-visible]{border:none;outline:none;box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorStrokeFocus2),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}"
|
|
44
38
|
],
|
|
45
39
|
s: [
|
|
46
|
-
"@media (forced-colors: active){.
|
|
40
|
+
"@media (forced-colors: active){.r15zvwyd{forced-color-adjust:none;}.r15zvwyd:hover{box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorBrandStroke2Hover),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}.r15zvwyd:hover:active{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorBrandStroke2Pressed),inset 0 0 0 var(--strokeWidthThickest) var(--colorStrokeFocus1);}}"
|
|
47
41
|
]
|
|
48
42
|
});
|
|
49
43
|
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|