@fluentui/react-swatch-picker 9.6.1 → 9.6.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 +31 -2
- package/lib/components/EmptySwatch/useEmptySwatch.js +1 -0
- package/lib/components/EmptySwatch/useEmptySwatch.js.map +1 -1
- package/lib/components/ImageSwatch/useImageSwatch.js +1 -0
- package/lib/components/ImageSwatch/useImageSwatch.js.map +1 -1
- package/lib/components/SwatchPicker/useSwatchPicker.js +1 -1
- package/lib/components/SwatchPicker/useSwatchPicker.js.map +1 -1
- package/lib/components/SwatchPickerRow/useSwatchPickerRow.js +1 -2
- package/lib/components/SwatchPickerRow/useSwatchPickerRow.js.map +1 -1
- package/lib-commonjs/components/EmptySwatch/useEmptySwatch.cjs +1 -0
- package/lib-commonjs/components/EmptySwatch/useEmptySwatch.cjs.map +1 -1
- package/lib-commonjs/components/ImageSwatch/useImageSwatch.cjs +1 -0
- package/lib-commonjs/components/ImageSwatch/useImageSwatch.cjs.map +1 -1
- package/lib-commonjs/components/SwatchPicker/useSwatchPicker.cjs +1 -1
- package/lib-commonjs/components/SwatchPicker/useSwatchPicker.cjs.map +1 -1
- package/lib-commonjs/components/SwatchPickerRow/useSwatchPickerRow.cjs +1 -2
- package/lib-commonjs/components/SwatchPickerRow/useSwatchPickerRow.cjs.map +1 -1
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-swatch-picker
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on Mon,
|
|
3
|
+
<!-- This log was last generated on Mon, 19 Oct 2026 14:49:10 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.6.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-swatch-picker_v9.6.3)
|
|
8
|
+
|
|
9
|
+
Mon, 19 Oct 2026 14:49:10 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- fix: forward the style prop to the SwatchPicker and SwatchPickerRow roots ([PR #36847](https://github.com/microsoft/fluentui/pull/36847) by vgenaev@gmail.com)
|
|
14
|
+
- fix: prevent ImageSwatch and EmptySwatch from submitting forms ([PR #36822](https://github.com/microsoft/fluentui/pull/36822) by vgenaev@gmail.com)
|
|
15
|
+
- Bump @fluentui/react-context-selector to v9.2.21 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-field to v9.5.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-tabster to v9.26.19 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
|
|
21
|
+
## [9.6.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-swatch-picker_v9.6.2)
|
|
22
|
+
|
|
23
|
+
Tue, 22 Sep 2026 11:25:39 GMT
|
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-swatch-picker_v9.6.1..@fluentui/react-swatch-picker_v9.6.2)
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- fix: remove unused react-dom and @types/react-dom peer dependencies, mark @types/react as optional ([PR #36559](https://github.com/microsoft/fluentui/pull/36559) by martinhochel@microsoft.com)
|
|
29
|
+
- Bump @fluentui/react-context-selector to v9.2.20 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
30
|
+
- Bump @fluentui/react-field to v9.5.5 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
31
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
32
|
+
- Bump @fluentui/react-shared-contexts to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
33
|
+
- Bump @fluentui/react-tabster to v9.26.18 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
34
|
+
- Bump @fluentui/react-utilities to v9.26.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
35
|
+
|
|
7
36
|
## [9.6.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-swatch-picker_v9.6.1)
|
|
8
37
|
|
|
9
|
-
Mon, 24 Aug 2026
|
|
38
|
+
Mon, 24 Aug 2026 16:40:04 GMT
|
|
10
39
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-swatch-picker_v9.6.0..@fluentui/react-swatch-picker_v9.6.1)
|
|
11
40
|
|
|
12
41
|
### Patches
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/EmptySwatch/useEmptySwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n EmptySwatchBaseProps,\n EmptySwatchBaseState,\n EmptySwatchProps,\n EmptySwatchState,\n} from './EmptySwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled EmptySwatch.\n *\n * The returned state can be modified with hooks before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatchBase_unstable = (\n props: EmptySwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchBaseState => {\n const isGrid = useSwatchPickerContextValue_unstable(ctx => ctx.isGrid);\n\n const role = isGrid ? 'gridcell' : 'radio';\n const a11yProps = isGrid ? {} : { 'aria-checked': false };\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...a11yProps,\n ...props,\n }),\n { elementType: 'button' },\n ),\n };\n};\n\n/**\n * Create the state required to render EmptySwatch.\n *\n * The returned state can be modified with hooks such as useEmptySwatchStyles_unstable,\n * before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatch_unstable = (\n props: EmptySwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n const { size = sizeFromContext, shape = shapeFromContext, ...rest } = props;\n\n const baseState = useEmptySwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size,\n shape,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useSwatchPickerContextValue_unstable","useEmptySwatchBase_unstable","props","ref","isGrid","ctx","role","a11yProps","components","root","always","elementType","useEmptySwatch_unstable","sizeFromContext","size","shapeFromContext","shape","rest","baseState"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAO3E,SAASC,oCAAoC,QAAQ,iCAA8B;AAEnF;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAMC,SAASJ,qCAAqCK,CAAAA,MAAOA,IAAID,MAAM;IAErE,MAAME,OAAOF,SAAS,aAAa;IACnC,MAAMG,YAAYH,SAAS,CAAC,IAAI;QAAE,gBAAgB;IAAM;IACxD,OAAO;QACLI,YAAY;YACVC,MAAM;QACR;QACAA,MAAMV,KAAKW,MAAM,CACfZ,yBAAyB,UAAU;YACjCK;YACAG;YACA,GAAGC,SAAS;
|
|
1
|
+
{"version":3,"sources":["../src/components/EmptySwatch/useEmptySwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n EmptySwatchBaseProps,\n EmptySwatchBaseState,\n EmptySwatchProps,\n EmptySwatchState,\n} from './EmptySwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled EmptySwatch.\n *\n * The returned state can be modified with hooks before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatchBase_unstable = (\n props: EmptySwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchBaseState => {\n const isGrid = useSwatchPickerContextValue_unstable(ctx => ctx.isGrid);\n\n const role = isGrid ? 'gridcell' : 'radio';\n const a11yProps = isGrid ? {} : { 'aria-checked': false };\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...a11yProps,\n type: 'button',\n ...props,\n }),\n { elementType: 'button' },\n ),\n };\n};\n\n/**\n * Create the state required to render EmptySwatch.\n *\n * The returned state can be modified with hooks such as useEmptySwatchStyles_unstable,\n * before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatch_unstable = (\n props: EmptySwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n const { size = sizeFromContext, shape = shapeFromContext, ...rest } = props;\n\n const baseState = useEmptySwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size,\n shape,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useSwatchPickerContextValue_unstable","useEmptySwatchBase_unstable","props","ref","isGrid","ctx","role","a11yProps","components","root","always","type","elementType","useEmptySwatch_unstable","sizeFromContext","size","shapeFromContext","shape","rest","baseState"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAO3E,SAASC,oCAAoC,QAAQ,iCAA8B;AAEnF;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAMC,SAASJ,qCAAqCK,CAAAA,MAAOA,IAAID,MAAM;IAErE,MAAME,OAAOF,SAAS,aAAa;IACnC,MAAMG,YAAYH,SAAS,CAAC,IAAI;QAAE,gBAAgB;IAAM;IACxD,OAAO;QACLI,YAAY;YACVC,MAAM;QACR;QACAA,MAAMV,KAAKW,MAAM,CACfZ,yBAAyB,UAAU;YACjCK;YACAG;YACA,GAAGC,SAAS;YACZI,MAAM;YACN,GAAGT,KAAK;QACV,IACA;YAAEU,aAAa;QAAS;IAE5B;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CACrCX,OACAC;IAEA,MAAMW,kBAAkBd,qCAAqCK,CAAAA,MAAOA,IAAIU,IAAI;IAC5E,MAAMC,mBAAmBhB,qCAAqCK,CAAAA,MAAOA,IAAIY,KAAK;IAC9E,MAAM,EAAEF,OAAOD,eAAe,EAAEG,QAAQD,gBAAgB,EAAE,GAAGE,MAAM,GAAGhB;IAEtE,MAAMiB,YAAYlB,4BAA4BiB,MAAMf;IAEpD,OAAO;QACL,GAAGgB,SAAS;QACZJ;QACAE;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ImageSwatch/useImageSwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot, useEventCallback, mergeCallbacks } from '@fluentui/react-utilities';\nimport type {\n ImageSwatchBaseProps,\n ImageSwatchBaseState,\n ImageSwatchProps,\n ImageSwatchState,\n} from './ImageSwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled ImageSwatch.\n *\n * The returned state can be modified with hooks before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatchBase_unstable = (\n props: ImageSwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchBaseState => {\n const { src, 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 role = isGrid ? 'gridcell' : 'radio';\n const ariaSelected = isGrid\n ? {\n 'aria-selected': selected,\n }\n : { 'aria-checked': selected };\n\n const onImageSwatchClick = useEventCallback(\n mergeCallbacks(onClick, (event: React.MouseEvent<HTMLButtonElement>) =>\n requestSelectionChange(event, {\n selectedValue: value,\n selectedSwatch: src,\n }),\n ),\n );\n\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...ariaSelected,\n onClick: onImageSwatchClick,\n ...rest,\n style: {\n backgroundImage: `url(${src})`,\n ...style,\n },\n }),\n { elementType: 'button' },\n ),\n value,\n selected,\n };\n};\n\n/**\n * Create the state required to render ImageSwatch.\n *\n * The returned state can be modified with hooks such as useImageSwatchStyles_unstable,\n * before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatch_unstable = (\n props: ImageSwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n\n const { size: _size, shape: _shape, ...rest } = props;\n\n const baseState = useImageSwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size: sizeFromContext,\n shape: shapeFromContext,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useEventCallback","mergeCallbacks","useSwatchPickerContextValue_unstable","useImageSwatchBase_unstable","props","ref","src","value","onClick","style","rest","isGrid","ctx","requestSelectionChange","selected","selectedValue","role","ariaSelected","onImageSwatchClick","event","selectedSwatch","components","root","always","backgroundImage","elementType","useImageSwatch_unstable","sizeFromContext","size","shapeFromContext","shape","_size","_shape","baseState"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,cAAc,QAAQ,4BAA4B;AAO7G,SAASC,oCAAoC,QAAQ,iCAA8B;AAEnF;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGN;IAChD,MAAMO,SAAST,qCAAqCU,CAAAA,MAAOA,IAAID,MAAM;IAErE,MAAME,yBAAyBX,qCAAqCU,CAAAA,MAAOA,IAAIC,sBAAsB;IACrG,MAAMC,WAAWZ,qCAAqCU,CAAAA,MAAOA,IAAIG,aAAa,KAAKR;IAEnF,MAAMS,OAAOL,SAAS,aAAa;IACnC,MAAMM,eAAeN,SACjB;QACE,iBAAiBG;IACnB,IACA;QAAE,gBAAgBA;IAAS;IAE/B,MAAMI,qBAAqBlB,iBACzBC,eAAeO,SAAS,CAACW,QACvBN,uBAAuBM,OAAO;YAC5BJ,eAAeR;YACfa,gBAAgBd;QAClB;IAIJ,OAAO;QACLe,YAAY;YACVC,MAAM;QACR;QACAA,MAAMvB,KAAKwB,MAAM,CACfzB,yBAAyB,UAAU;YACjCO;YACAW;YACA,GAAGC,YAAY;YACfT,SAASU;
|
|
1
|
+
{"version":3,"sources":["../src/components/ImageSwatch/useImageSwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot, useEventCallback, mergeCallbacks } from '@fluentui/react-utilities';\nimport type {\n ImageSwatchBaseProps,\n ImageSwatchBaseState,\n ImageSwatchProps,\n ImageSwatchState,\n} from './ImageSwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled ImageSwatch.\n *\n * The returned state can be modified with hooks before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatchBase_unstable = (\n props: ImageSwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchBaseState => {\n const { src, 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 role = isGrid ? 'gridcell' : 'radio';\n const ariaSelected = isGrid\n ? {\n 'aria-selected': selected,\n }\n : { 'aria-checked': selected };\n\n const onImageSwatchClick = useEventCallback(\n mergeCallbacks(onClick, (event: React.MouseEvent<HTMLButtonElement>) =>\n requestSelectionChange(event, {\n selectedValue: value,\n selectedSwatch: src,\n }),\n ),\n );\n\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...ariaSelected,\n onClick: onImageSwatchClick,\n type: 'button',\n ...rest,\n style: {\n backgroundImage: `url(${src})`,\n ...style,\n },\n }),\n { elementType: 'button' },\n ),\n value,\n selected,\n };\n};\n\n/**\n * Create the state required to render ImageSwatch.\n *\n * The returned state can be modified with hooks such as useImageSwatchStyles_unstable,\n * before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatch_unstable = (\n props: ImageSwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n\n const { size: _size, shape: _shape, ...rest } = props;\n\n const baseState = useImageSwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size: sizeFromContext,\n shape: shapeFromContext,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useEventCallback","mergeCallbacks","useSwatchPickerContextValue_unstable","useImageSwatchBase_unstable","props","ref","src","value","onClick","style","rest","isGrid","ctx","requestSelectionChange","selected","selectedValue","role","ariaSelected","onImageSwatchClick","event","selectedSwatch","components","root","always","type","backgroundImage","elementType","useImageSwatch_unstable","sizeFromContext","size","shapeFromContext","shape","_size","_shape","baseState"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,cAAc,QAAQ,4BAA4B;AAO7G,SAASC,oCAAoC,QAAQ,iCAA8B;AAEnF;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGN;IAChD,MAAMO,SAAST,qCAAqCU,CAAAA,MAAOA,IAAID,MAAM;IAErE,MAAME,yBAAyBX,qCAAqCU,CAAAA,MAAOA,IAAIC,sBAAsB;IACrG,MAAMC,WAAWZ,qCAAqCU,CAAAA,MAAOA,IAAIG,aAAa,KAAKR;IAEnF,MAAMS,OAAOL,SAAS,aAAa;IACnC,MAAMM,eAAeN,SACjB;QACE,iBAAiBG;IACnB,IACA;QAAE,gBAAgBA;IAAS;IAE/B,MAAMI,qBAAqBlB,iBACzBC,eAAeO,SAAS,CAACW,QACvBN,uBAAuBM,OAAO;YAC5BJ,eAAeR;YACfa,gBAAgBd;QAClB;IAIJ,OAAO;QACLe,YAAY;YACVC,MAAM;QACR;QACAA,MAAMvB,KAAKwB,MAAM,CACfzB,yBAAyB,UAAU;YACjCO;YACAW;YACA,GAAGC,YAAY;YACfT,SAASU;YACTM,MAAM;YACN,GAAGd,IAAI;YACPD,OAAO;gBACLgB,iBAAiB,CAAC,IAAI,EAAEnB,IAAI,CAAC,CAAC;gBAC9B,GAAGG,KAAK;YACV;QACF,IACA;YAAEiB,aAAa;QAAS;QAE1BnB;QACAO;IACF;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMa,0BAA0B,CACrCvB,OACAC;IAEA,MAAMuB,kBAAkB1B,qCAAqCU,CAAAA,MAAOA,IAAIiB,IAAI;IAC5E,MAAMC,mBAAmB5B,qCAAqCU,CAAAA,MAAOA,IAAImB,KAAK;IAE9E,MAAM,EAAEF,MAAMG,KAAK,EAAED,OAAOE,MAAM,EAAE,GAAGvB,MAAM,GAAGN;IAEhD,MAAM8B,YAAY/B,4BAA4BO,MAAML;IAEpD,OAAO;QACL,GAAG6B,SAAS;QACZL,MAAMD;QACNG,OAAOD;IACT;AACF,EAAE"}
|
|
@@ -12,7 +12,7 @@ import { getIntrinsicElementProps, useControllableState, useEventCallback, slot
|
|
|
12
12
|
*/ export const useSwatchPickerBase_unstable = (props, ref)=>{
|
|
13
13
|
// Merge props from surrounding <Field>, if any
|
|
14
14
|
props = useFieldControlProps_unstable(props);
|
|
15
|
-
const { layout, onSelectionChange,
|
|
15
|
+
const { layout, onSelectionChange, ...rest } = props;
|
|
16
16
|
const isGrid = layout === 'grid';
|
|
17
17
|
const role = isGrid ? 'grid' : 'radiogroup';
|
|
18
18
|
const [selectedValue, setSelectedValue] = useControllableState({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPicker/useSwatchPicker.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { getIntrinsicElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\n\nimport type {\n SwatchPickerBaseProps,\n SwatchPickerBaseState,\n SwatchPickerProps,\n SwatchPickerState,\n} from './SwatchPicker.types';\n\n/**\n * Create the base state required to render unstyled SwatchPicker.\n *\n * The returned state can be modified with hooks before being passed to renderSwatchPicker_unstable.\n *\n * @param props - props from this instance of SwatchPicker\n * @param ref - reference to root HTMLElement of SwatchPicker\n */\nexport const useSwatchPickerBase_unstable = (\n props: SwatchPickerBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerBaseState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n\n const { layout, onSelectionChange,
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPicker/useSwatchPicker.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { getIntrinsicElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\n\nimport type {\n SwatchPickerBaseProps,\n SwatchPickerBaseState,\n SwatchPickerProps,\n SwatchPickerState,\n} from './SwatchPicker.types';\n\n/**\n * Create the base state required to render unstyled SwatchPicker.\n *\n * The returned state can be modified with hooks before being passed to renderSwatchPicker_unstable.\n *\n * @param props - props from this instance of SwatchPicker\n * @param ref - reference to root HTMLElement of SwatchPicker\n */\nexport const useSwatchPickerBase_unstable = (\n props: SwatchPickerBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerBaseState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n\n const { layout, onSelectionChange, ...rest } = props;\n\n const isGrid = layout === 'grid';\n\n const role = isGrid ? 'grid' : 'radiogroup';\n\n const [selectedValue, setSelectedValue] = useControllableState({\n state: props.selectedValue,\n defaultState: props.defaultSelectedValue,\n initialState: '',\n });\n\n const requestSelectionChange: SwatchPickerState['requestSelectionChange'] = useEventCallback((event, data) => {\n onSelectionChange?.(event, {\n type: 'click',\n event,\n selectedValue: data.selectedValue,\n selectedSwatch: data.selectedSwatch,\n });\n setSelectedValue(data.selectedValue);\n });\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role,\n ...rest,\n }),\n { elementType: 'div' },\n ),\n isGrid,\n requestSelectionChange,\n selectedValue,\n };\n};\n\n/**\n * Create the state required to render SwatchPicker.\n *\n * The returned state can be modified with hooks such as useSwatchPickerStyles_unstable,\n * before being passed to renderSwatchPicker_unstable.\n *\n * @param props - props from this instance of SwatchPicker\n * @param ref - reference to root HTMLElement of SwatchPicker\n */\nexport const useSwatchPicker_unstable = (\n props: SwatchPickerProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerState => {\n const { focusMode = 'arrow', size = 'medium', shape, spacing = 'medium', ...rest } = props;\n\n const baseState = useSwatchPickerBase_unstable(rest, ref);\n\n const focusAttributes = useArrowNavigationGroup({\n circular: true,\n axis: baseState.isGrid ? 'grid-linear' : 'both',\n memorizeCurrent: true,\n });\n\n return {\n ...baseState,\n root: {\n ...baseState.root,\n ...(focusMode === 'arrow' ? focusAttributes : {}),\n },\n size,\n shape,\n spacing,\n };\n};\n"],"names":["useFieldControlProps_unstable","useArrowNavigationGroup","getIntrinsicElementProps","useControllableState","useEventCallback","slot","useSwatchPickerBase_unstable","props","ref","layout","onSelectionChange","rest","isGrid","role","selectedValue","setSelectedValue","state","defaultState","defaultSelectedValue","initialState","requestSelectionChange","event","data","type","selectedSwatch","components","root","always","elementType","useSwatchPicker_unstable","focusMode","size","shape","spacing","baseState","focusAttributes","circular","axis","memorizeCurrent"],"mappings":"AAAA;AAIA,SAASA,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,wBAAwB,EAAEC,oBAAoB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AASnH;;;;;;;CAOC,GACD,OAAO,MAAMC,+BAA+B,CAC1CC,OACAC;IAEA,+CAA+C;IAC/CD,QAAQP,8BAA8BO;IAEtC,MAAM,EAAEE,MAAM,EAAEC,iBAAiB,EAAE,GAAGC,MAAM,GAAGJ;IAE/C,MAAMK,SAASH,WAAW;IAE1B,MAAMI,OAAOD,SAAS,SAAS;IAE/B,MAAM,CAACE,eAAeC,iBAAiB,GAAGZ,qBAAqB;QAC7Da,OAAOT,MAAMO,aAAa;QAC1BG,cAAcV,MAAMW,oBAAoB;QACxCC,cAAc;IAChB;IAEA,MAAMC,yBAAsEhB,iBAAiB,CAACiB,OAAOC;QACnGZ,8BAAAA,wCAAAA,kBAAoBW,OAAO;YACzBE,MAAM;YACNF;YACAP,eAAeQ,KAAKR,aAAa;YACjCU,gBAAgBF,KAAKE,cAAc;QACrC;QACAT,iBAAiBO,KAAKR,aAAa;IACrC;IAEA,OAAO;QACLW,YAAY;YACVC,MAAM;QACR;QACAA,MAAMrB,KAAKsB,MAAM,CACfzB,yBAAyB,OAAO;YAC9BM;YACAK;YACA,GAAGF,IAAI;QACT,IACA;YAAEiB,aAAa;QAAM;QAEvBhB;QACAQ;QACAN;IACF;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMe,2BAA2B,CACtCtB,OACAC;IAEA,MAAM,EAAEsB,YAAY,OAAO,EAAEC,OAAO,QAAQ,EAAEC,KAAK,EAAEC,UAAU,QAAQ,EAAE,GAAGtB,MAAM,GAAGJ;IAErF,MAAM2B,YAAY5B,6BAA6BK,MAAMH;IAErD,MAAM2B,kBAAkBlC,wBAAwB;QAC9CmC,UAAU;QACVC,MAAMH,UAAUtB,MAAM,GAAG,gBAAgB;QACzC0B,iBAAiB;IACnB;IAEA,OAAO;QACL,GAAGJ,SAAS;QACZR,MAAM;YACJ,GAAGQ,UAAUR,IAAI;YACjB,GAAII,cAAc,UAAUK,kBAAkB,CAAC,CAAC;QAClD;QACAJ;QACAC;QACAC;IACF;AACF,EAAE"}
|
|
@@ -9,7 +9,6 @@ import { useSwatchPickerContextValue_unstable } from "../../contexts/swatchPicke
|
|
|
9
9
|
* @param props - props from this instance of SwatchPickerRow
|
|
10
10
|
* @param ref - reference to root HTMLDivElement of SwatchPickerRow
|
|
11
11
|
*/ export const useSwatchPickerRowBase_unstable = (props, ref)=>{
|
|
12
|
-
const { style, ...rest } = props;
|
|
13
12
|
return {
|
|
14
13
|
components: {
|
|
15
14
|
root: 'div'
|
|
@@ -17,7 +16,7 @@ import { useSwatchPickerContextValue_unstable } from "../../contexts/swatchPicke
|
|
|
17
16
|
root: slot.always(getIntrinsicElementProps('div', {
|
|
18
17
|
ref,
|
|
19
18
|
role: 'row',
|
|
20
|
-
...
|
|
19
|
+
...props
|
|
21
20
|
}), {
|
|
22
21
|
elementType: 'div'
|
|
23
22
|
})
|
|
@@ -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 {\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
|
|
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 return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'row',\n ...props,\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","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,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMN,KAAKO,MAAM,CACfR,yBAAyB,OAAO;YAC9BK;YACAI,MAAM;YACN,GAAGL,KAAK;QACV,IACA;YAAEM,aAAa;QAAM;IAEzB;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMC,8BAA8B,CACzCP,OACAC;IAEA,MAAMO,UAAUV,qCAAqCW,CAAAA,MAAOA,IAAID,OAAO;IACvE,MAAME,YAAYX,gCAAgCC,OAAOC;IAEzD,OAAO;QACL,GAAGS,SAAS;QACZF;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/EmptySwatch/useEmptySwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n EmptySwatchBaseProps,\n EmptySwatchBaseState,\n EmptySwatchProps,\n EmptySwatchState,\n} from './EmptySwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled EmptySwatch.\n *\n * The returned state can be modified with hooks before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatchBase_unstable = (\n props: EmptySwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchBaseState => {\n const isGrid = useSwatchPickerContextValue_unstable(ctx => ctx.isGrid);\n\n const role = isGrid ? 'gridcell' : 'radio';\n const a11yProps = isGrid ? {} : { 'aria-checked': false };\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...a11yProps,\n ...props,\n }),\n { elementType: 'button' },\n ),\n };\n};\n\n/**\n * Create the state required to render EmptySwatch.\n *\n * The returned state can be modified with hooks such as useEmptySwatchStyles_unstable,\n * before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatch_unstable = (\n props: EmptySwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n const { size = sizeFromContext, shape = shapeFromContext, ...rest } = props;\n\n const baseState = useEmptySwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size,\n shape,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useSwatchPickerContextValue_unstable","useEmptySwatchBase_unstable","props","ref","isGrid","ctx","role","a11yProps","components","root","always","elementType","useEmptySwatch_unstable","sizeFromContext","size","shapeFromContext","shape","rest","baseState"],"mappings":"AAAA;;;;;;;;;;;;IAoBaG,2BAAAA;;;
|
|
1
|
+
{"version":3,"sources":["../src/components/EmptySwatch/useEmptySwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n EmptySwatchBaseProps,\n EmptySwatchBaseState,\n EmptySwatchProps,\n EmptySwatchState,\n} from './EmptySwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled EmptySwatch.\n *\n * The returned state can be modified with hooks before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatchBase_unstable = (\n props: EmptySwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchBaseState => {\n const isGrid = useSwatchPickerContextValue_unstable(ctx => ctx.isGrid);\n\n const role = isGrid ? 'gridcell' : 'radio';\n const a11yProps = isGrid ? {} : { 'aria-checked': false };\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...a11yProps,\n type: 'button',\n ...props,\n }),\n { elementType: 'button' },\n ),\n };\n};\n\n/**\n * Create the state required to render EmptySwatch.\n *\n * The returned state can be modified with hooks such as useEmptySwatchStyles_unstable,\n * before being passed to renderEmptySwatch_unstable.\n *\n * @param props - props from this instance of EmptySwatch\n * @param ref - reference to root HTMLDivElement of EmptySwatch\n */\nexport const useEmptySwatch_unstable = (\n props: EmptySwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): EmptySwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n const { size = sizeFromContext, shape = shapeFromContext, ...rest } = props;\n\n const baseState = useEmptySwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size,\n shape,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useSwatchPickerContextValue_unstable","useEmptySwatchBase_unstable","props","ref","isGrid","ctx","role","a11yProps","components","root","always","type","elementType","useEmptySwatch_unstable","sizeFromContext","size","shapeFromContext","shape","rest","baseState"],"mappings":"AAAA;;;;;;;;;;;;IAoBaG,2BAAAA;;;2BAkCAY;;;;gCAnDkC,4BAA4B;8BAOtB,iCAA8B;AAU5E,oCAAoC,CACzCX,OACAC;IAEA,MAAMC,aAASJ,kDAAAA,EAAqCK,CAAAA,MAAOA,IAAID,MAAM;IAErE,MAAME,OAAOF,SAAS,aAAa;IACnC,MAAMG,YAAYH,SAAS,CAAC,IAAI;QAAE,gBAAgB;IAAM;IACxD,OAAO;QACLI,YAAY;YACVC,MAAM;QACR;QACAA,MAAMV,oBAAAA,CAAKW,MAAM,KACfZ,wCAAAA,EAAyB,UAAU;YACjCK;YACAG;YACA,GAAGC,SAAS;YACZI,MAAM;YACN,GAAGT,KAAK;QACV,IACA;YAAEU,aAAa;QAAS;IAE5B;AACF,EAAE;AAWK,MAAMC,0BAA0B,CACrCX,OACAC;IAEA,MAAMW,sBAAkBd,kDAAAA,EAAqCK,CAAAA,MAAOA,IAAIU,IAAI;IAC5E,MAAMC,mBAAmBhB,sDAAAA,EAAqCK,CAAAA,MAAOA,IAAIY,KAAK;IAC9E,MAAM,EAAEF,OAAOD,eAAe,EAAEG,QAAQD,gBAAgB,EAAE,GAAGE,MAAM,GAAGhB;IAEtE,MAAMiB,YAAYlB,4BAA4BiB,MAAMf;IAEpD,OAAO;QACL,GAAGgB,SAAS;QACZJ;QACAE;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ImageSwatch/useImageSwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot, useEventCallback, mergeCallbacks } from '@fluentui/react-utilities';\nimport type {\n ImageSwatchBaseProps,\n ImageSwatchBaseState,\n ImageSwatchProps,\n ImageSwatchState,\n} from './ImageSwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled ImageSwatch.\n *\n * The returned state can be modified with hooks before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatchBase_unstable = (\n props: ImageSwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchBaseState => {\n const { src, 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 role = isGrid ? 'gridcell' : 'radio';\n const ariaSelected = isGrid\n ? {\n 'aria-selected': selected,\n }\n : { 'aria-checked': selected };\n\n const onImageSwatchClick = useEventCallback(\n mergeCallbacks(onClick, (event: React.MouseEvent<HTMLButtonElement>) =>\n requestSelectionChange(event, {\n selectedValue: value,\n selectedSwatch: src,\n }),\n ),\n );\n\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...ariaSelected,\n onClick: onImageSwatchClick,\n ...rest,\n style: {\n backgroundImage: `url(${src})`,\n ...style,\n },\n }),\n { elementType: 'button' },\n ),\n value,\n selected,\n };\n};\n\n/**\n * Create the state required to render ImageSwatch.\n *\n * The returned state can be modified with hooks such as useImageSwatchStyles_unstable,\n * before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatch_unstable = (\n props: ImageSwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n\n const { size: _size, shape: _shape, ...rest } = props;\n\n const baseState = useImageSwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size: sizeFromContext,\n shape: shapeFromContext,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useEventCallback","mergeCallbacks","useSwatchPickerContextValue_unstable","useImageSwatchBase_unstable","props","ref","src","value","onClick","style","rest","isGrid","ctx","requestSelectionChange","selected","selectedValue","role","ariaSelected","onImageSwatchClick","event","selectedSwatch","components","root","always","backgroundImage","elementType","useImageSwatch_unstable","sizeFromContext","size","shapeFromContext","shape","_size","_shape","baseState"],"mappings":"AAAA;;;;;;;;;;;;IAoBaK,2BAAAA;;;
|
|
1
|
+
{"version":3,"sources":["../src/components/ImageSwatch/useImageSwatch.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot, useEventCallback, mergeCallbacks } from '@fluentui/react-utilities';\nimport type {\n ImageSwatchBaseProps,\n ImageSwatchBaseState,\n ImageSwatchProps,\n ImageSwatchState,\n} from './ImageSwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\n\n/**\n * Create the base state required to render unstyled ImageSwatch.\n *\n * The returned state can be modified with hooks before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatchBase_unstable = (\n props: ImageSwatchBaseProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchBaseState => {\n const { src, 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 role = isGrid ? 'gridcell' : 'radio';\n const ariaSelected = isGrid\n ? {\n 'aria-selected': selected,\n }\n : { 'aria-checked': selected };\n\n const onImageSwatchClick = useEventCallback(\n mergeCallbacks(onClick, (event: React.MouseEvent<HTMLButtonElement>) =>\n requestSelectionChange(event, {\n selectedValue: value,\n selectedSwatch: src,\n }),\n ),\n );\n\n return {\n components: {\n root: 'button',\n },\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n role,\n ...ariaSelected,\n onClick: onImageSwatchClick,\n type: 'button',\n ...rest,\n style: {\n backgroundImage: `url(${src})`,\n ...style,\n },\n }),\n { elementType: 'button' },\n ),\n value,\n selected,\n };\n};\n\n/**\n * Create the state required to render ImageSwatch.\n *\n * The returned state can be modified with hooks such as useImageSwatchStyles_unstable,\n * before being passed to renderImageSwatch_unstable.\n *\n * @param props - props from this instance of ImageSwatch\n * @param ref - reference to root HTMLDivElement of ImageSwatch\n */\nexport const useImageSwatch_unstable = (\n props: ImageSwatchProps,\n ref: React.Ref<HTMLButtonElement>,\n): ImageSwatchState => {\n const sizeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shapeFromContext = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\n\n const { size: _size, shape: _shape, ...rest } = props;\n\n const baseState = useImageSwatchBase_unstable(rest, ref);\n\n return {\n ...baseState,\n size: sizeFromContext,\n shape: shapeFromContext,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useEventCallback","mergeCallbacks","useSwatchPickerContextValue_unstable","useImageSwatchBase_unstable","props","ref","src","value","onClick","style","rest","isGrid","ctx","requestSelectionChange","selected","selectedValue","role","ariaSelected","onImageSwatchClick","event","selectedSwatch","components","root","always","type","backgroundImage","elementType","useImageSwatch_unstable","sizeFromContext","size","shapeFromContext","shape","_size","_shape","baseState"],"mappings":"AAAA;;;;;;;;;;;;IAoBaK,2BAAAA;;;IA2DAwB,uBAAAA;;;;gCA5EoE,4BAA4B;8BAOxD,iCAA8B;AAU5E,oCAAoC,CACzCvB,OACAC;IAEA,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGN;IAChD,MAAMO,aAAST,kDAAAA,EAAqCU,CAAAA,MAAOA,IAAID,MAAM;IAErE,MAAME,6BAAyBX,kDAAAA,EAAqCU,CAAAA,MAAOA,IAAIC,sBAAsB;IACrG,MAAMC,eAAWZ,kDAAAA,EAAqCU,CAAAA,MAAOA,IAAIG,aAAa,KAAKR;IAEnF,MAAMS,OAAOL,SAAS,aAAa;IACnC,MAAMM,eAAeN,SACjB;QACE,iBAAiBG;IACnB,IACA;QAAE,gBAAgBA;IAAS;IAE/B,MAAMI,yBAAqBlB,gCAAAA,MACzBC,8BAAAA,EAAeO,SAAS,CAACW,QACvBN,uBAAuBM,OAAO;YAC5BJ,eAAeR;YACfa,gBAAgBd;QAClB;IAIJ,OAAO;QACLe,YAAY;YACVC,MAAM;QACR;QACAA,MAAMvB,oBAAAA,CAAKwB,MAAM,KACfzB,wCAAAA,EAAyB,UAAU;YACjCO;YACAW;YACA,GAAGC,YAAY;YACfT,SAASU;YACTM,MAAM;YACN,GAAGd,IAAI;YACPD,OAAO;gBACLgB,iBAAiB,CAAC,IAAI,EAAEnB,IAAI,CAAC,CAAC;gBAC9B,GAAGG,KAAK;YACV;QACF,IACA;YAAEiB,aAAa;QAAS;QAE1BnB;QACAO;IACF;AACF,EAAE;AAWK,gCAAgC,CACrCV,OACAC;IAEA,MAAMuB,kBAAkB1B,sDAAAA,EAAqCU,CAAAA,MAAOA,IAAIiB,IAAI;IAC5E,MAAMC,uBAAmB5B,kDAAAA,EAAqCU,CAAAA,MAAOA,IAAImB,KAAK;IAE9E,MAAM,EAAEF,MAAMG,KAAK,EAAED,OAAOE,MAAM,EAAE,GAAGvB,MAAM,GAAGN;IAEhD,MAAM8B,YAAY/B,4BAA4BO,MAAML;IAEpD,OAAO;QACL,GAAG6B,SAAS;QACZL,MAAMD;QACNG,OAAOD;IACT;AACF,EAAE"}
|
|
@@ -23,7 +23,7 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
23
23
|
const useSwatchPickerBase_unstable = (props, ref)=>{
|
|
24
24
|
// Merge props from surrounding <Field>, if any
|
|
25
25
|
props = (0, _reactfield.useFieldControlProps_unstable)(props);
|
|
26
|
-
const { layout, onSelectionChange,
|
|
26
|
+
const { layout, onSelectionChange, ...rest } = props;
|
|
27
27
|
const isGrid = layout === 'grid';
|
|
28
28
|
const role = isGrid ? 'grid' : 'radiogroup';
|
|
29
29
|
const [selectedValue, setSelectedValue] = (0, _reactutilities.useControllableState)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPicker/useSwatchPicker.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { getIntrinsicElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\n\nimport type {\n SwatchPickerBaseProps,\n SwatchPickerBaseState,\n SwatchPickerProps,\n SwatchPickerState,\n} from './SwatchPicker.types';\n\n/**\n * Create the base state required to render unstyled SwatchPicker.\n *\n * The returned state can be modified with hooks before being passed to renderSwatchPicker_unstable.\n *\n * @param props - props from this instance of SwatchPicker\n * @param ref - reference to root HTMLElement of SwatchPicker\n */\nexport const useSwatchPickerBase_unstable = (\n props: SwatchPickerBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerBaseState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n\n const { layout, onSelectionChange,
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPicker/useSwatchPicker.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { getIntrinsicElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\n\nimport type {\n SwatchPickerBaseProps,\n SwatchPickerBaseState,\n SwatchPickerProps,\n SwatchPickerState,\n} from './SwatchPicker.types';\n\n/**\n * Create the base state required to render unstyled SwatchPicker.\n *\n * The returned state can be modified with hooks before being passed to renderSwatchPicker_unstable.\n *\n * @param props - props from this instance of SwatchPicker\n * @param ref - reference to root HTMLElement of SwatchPicker\n */\nexport const useSwatchPickerBase_unstable = (\n props: SwatchPickerBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerBaseState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n\n const { layout, onSelectionChange, ...rest } = props;\n\n const isGrid = layout === 'grid';\n\n const role = isGrid ? 'grid' : 'radiogroup';\n\n const [selectedValue, setSelectedValue] = useControllableState({\n state: props.selectedValue,\n defaultState: props.defaultSelectedValue,\n initialState: '',\n });\n\n const requestSelectionChange: SwatchPickerState['requestSelectionChange'] = useEventCallback((event, data) => {\n onSelectionChange?.(event, {\n type: 'click',\n event,\n selectedValue: data.selectedValue,\n selectedSwatch: data.selectedSwatch,\n });\n setSelectedValue(data.selectedValue);\n });\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role,\n ...rest,\n }),\n { elementType: 'div' },\n ),\n isGrid,\n requestSelectionChange,\n selectedValue,\n };\n};\n\n/**\n * Create the state required to render SwatchPicker.\n *\n * The returned state can be modified with hooks such as useSwatchPickerStyles_unstable,\n * before being passed to renderSwatchPicker_unstable.\n *\n * @param props - props from this instance of SwatchPicker\n * @param ref - reference to root HTMLElement of SwatchPicker\n */\nexport const useSwatchPicker_unstable = (\n props: SwatchPickerProps,\n ref: React.Ref<HTMLDivElement>,\n): SwatchPickerState => {\n const { focusMode = 'arrow', size = 'medium', shape, spacing = 'medium', ...rest } = props;\n\n const baseState = useSwatchPickerBase_unstable(rest, ref);\n\n const focusAttributes = useArrowNavigationGroup({\n circular: true,\n axis: baseState.isGrid ? 'grid-linear' : 'both',\n memorizeCurrent: true,\n });\n\n return {\n ...baseState,\n root: {\n ...baseState.root,\n ...(focusMode === 'arrow' ? focusAttributes : {}),\n },\n size,\n shape,\n spacing,\n };\n};\n"],"names":["useFieldControlProps_unstable","useArrowNavigationGroup","getIntrinsicElementProps","useControllableState","useEventCallback","slot","useSwatchPickerBase_unstable","props","ref","layout","onSelectionChange","rest","isGrid","role","selectedValue","setSelectedValue","state","defaultState","defaultSelectedValue","initialState","requestSelectionChange","event","data","type","selectedSwatch","components","root","always","elementType","useSwatchPicker_unstable","focusMode","size","shape","spacing","baseState","focusAttributes","circular","axis","memorizeCurrent"],"mappings":"AAAA;;;;;;;;;;;;IAuBaM,4BAAAA;;;IAwDAuB,wBAAAA;;;;4BA3EiC,wBAAwB;8BAC9B,0BAA0B;gCACqB,4BAA4B;AAiB5G,qCAAqC,CAC1CtB,OACAC;IAEA,+CAA+C;IAC/CD,YAAQP,yCAAAA,EAA8BO;IAEtC,MAAM,EAAEE,MAAM,EAAEC,iBAAiB,EAAE,GAAGC,MAAM,GAAGJ;IAE/C,MAAMK,SAASH,WAAW;IAE1B,MAAMI,OAAOD,SAAS,SAAS;IAE/B,MAAM,CAACE,eAAeC,iBAAiB,OAAGZ,oCAAAA,EAAqB;QAC7Da,OAAOT,MAAMO,aAAa;QAC1BG,cAAcV,MAAMW,oBAAoB;QACxCC,cAAc;IAChB;IAEA,MAAMC,6BAAsEhB,gCAAAA,EAAiB,CAACiB,OAAOC;QACnGZ,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAoBW,OAAO;YACzBE,MAAM;YACNF;YACAP,eAAeQ,KAAKR,aAAa;YACjCU,gBAAgBF,KAAKE,cAAc;QACrC;QACAT,iBAAiBO,KAAKR,aAAa;IACrC;IAEA,OAAO;QACLW,YAAY;YACVC,MAAM;QACR;QACAA,MAAMrB,oBAAAA,CAAKsB,MAAM,KACfzB,wCAAAA,EAAyB,OAAO;YAC9BM;YACAK;YACA,GAAGF,IAAI;QACT,IACA;YAAEiB,aAAa;QAAM;QAEvBhB;QACAQ;QACAN;IACF;AACF,EAAE;AAWK,iCAAiC,CACtCP,OACAC;IAEA,MAAM,EAAEsB,YAAY,OAAO,EAAEC,OAAO,QAAQ,EAAEC,KAAK,EAAEC,UAAU,QAAQ,EAAE,GAAGtB,MAAM,GAAGJ;IAErF,MAAM2B,YAAY5B,6BAA6BK,MAAMH;IAErD,MAAM2B,sBAAkBlC,qCAAAA,EAAwB;QAC9CmC,UAAU;QACVC,MAAMH,UAAUtB,MAAM,GAAG,gBAAgB;QACzC0B,iBAAiB;IACnB;IAEA,OAAO;QACL,GAAGJ,SAAS;QACZR,MAAM;YACJ,GAAGQ,UAAUR,IAAI;YACjB,GAAII,cAAc,UAAUK,kBAAkB,CAAC,CAAC;QAClD;QACAJ;QACAC;QACAC;IACF;AACF,EAAE"}
|
|
@@ -20,7 +20,6 @@ _export(exports, {
|
|
|
20
20
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
21
21
|
const _swatchPicker = require("../../contexts/swatchPicker.cjs");
|
|
22
22
|
const useSwatchPickerRowBase_unstable = (props, ref)=>{
|
|
23
|
-
const { style, ...rest } = props;
|
|
24
23
|
return {
|
|
25
24
|
components: {
|
|
26
25
|
root: 'div'
|
|
@@ -28,7 +27,7 @@ const useSwatchPickerRowBase_unstable = (props, ref)=>{
|
|
|
28
27
|
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
|
|
29
28
|
ref,
|
|
30
29
|
role: 'row',
|
|
31
|
-
...
|
|
30
|
+
...props
|
|
32
31
|
}), {
|
|
33
32
|
elementType: 'div'
|
|
34
33
|
})
|
|
@@ -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 {\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
|
|
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 return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'row',\n ...props,\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","components","root","always","role","elementType","useSwatchPickerRow_unstable","spacing","ctx","baseState"],"mappings":"AAAA;;;;;;;;;;;;IAoBaG,+BAAAA;;;+BA4BAQ;;;;gCA7CkC,4BAA4B;8BAOtB,iCAA8B;AAU5E,wCAAwC,CAC7CP,OACAC;IAEA,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMN,oBAAAA,CAAKO,MAAM,KACfR,wCAAAA,EAAyB,OAAO;YAC9BK;YACAI,MAAM;YACN,GAAGL,KAAK;QACV,IACA;YAAEM,aAAa;QAAM;IAEzB;AACF,EAAE;AAWK,MAAMC,8BAA8B,CACzCP,OACAC;IAEA,MAAMO,cAAUV,kDAAAA,EAAqCW,CAAAA,MAAOA,IAAID,OAAO;IACvE,MAAME,YAAYX,gCAAgCC,OAAOC;IAEzD,OAAO;QACL,GAAGS,SAAS;QACZF;IACF;AACF,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-swatch-picker",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.3",
|
|
4
4
|
"description": "New fluentui react package",
|
|
5
5
|
"main": "lib-commonjs/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,22 +12,25 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui/react-context-selector": "^9.2.
|
|
16
|
-
"@fluentui/react-field": "^9.5.
|
|
15
|
+
"@fluentui/react-context-selector": "^9.2.21",
|
|
16
|
+
"@fluentui/react-field": "^9.5.6",
|
|
17
17
|
"@fluentui/react-icons": "^2.0.245",
|
|
18
|
-
"@fluentui/react-jsx-runtime": "^9.4.
|
|
19
|
-
"@fluentui/react-shared-contexts": "^9.26.
|
|
20
|
-
"@fluentui/react-tabster": "^9.26.
|
|
18
|
+
"@fluentui/react-jsx-runtime": "^9.4.7",
|
|
19
|
+
"@fluentui/react-shared-contexts": "^9.26.4",
|
|
20
|
+
"@fluentui/react-tabster": "^9.26.19",
|
|
21
21
|
"@fluentui/react-theme": "^9.2.2",
|
|
22
|
-
"@fluentui/react-utilities": "^9.
|
|
22
|
+
"@fluentui/react-utilities": "^9.27.0",
|
|
23
23
|
"@griffel/react": "^1.5.32",
|
|
24
24
|
"@swc/helpers": "^0.5.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@types/react": ">=16.14.0 <20.0.0",
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
"react": ">=16.14.0 <20.0.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependenciesMeta": {
|
|
31
|
+
"@types/react": {
|
|
32
|
+
"optional": true
|
|
33
|
+
}
|
|
31
34
|
},
|
|
32
35
|
"exports": {
|
|
33
36
|
".": {
|