@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 +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 {
|
|
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;YACZ,GAAGL,KAAK;QACV,IACA;YAAES,aAAa;QAAS;IAE5B;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CACrCV,OACAC;IAEA,MAAMU,kBAAkBb,qCAAqCK,CAAAA,MAAOA,IAAIS,IAAI;IAC5E,MAAMC,mBAAmBf,qCAAqCK,CAAAA,MAAOA,IAAIW,KAAK;IAC9E,MAAM,EAAEF,OAAOD,eAAe,EAAEG,QAAQD,gBAAgB,EAAE,GAAGE,MAAM,GAAGf;IAEtE,MAAMgB,YAAYjB,4BAA4BgB,MAAMd;IAEpD,OAAO;QACL,GAAGe,SAAS;QACZJ;QACAE;IACF;AACF,EAAE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { __resetStyles, __styles, mergeClasses } from
|
|
4
|
-
import { tokens } from
|
|
5
|
-
import { createCustomFocusIndicatorStyle } from
|
|
3
|
+
import { __resetStyles, __styles, mergeClasses } from "@griffel/react";
|
|
4
|
+
import { tokens } from "@fluentui/react-theme";
|
|
5
|
+
import { createCustomFocusIndicatorStyle } from "@fluentui/react-tabster";
|
|
6
6
|
export const emptySwatchClassNames = {
|
|
7
7
|
root: 'fui-EmptySwatch'
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","createCustomFocusIndicatorStyle","emptySwatchClassNames","root","useStyles","useSizeStyles","a9b677","Bqenvij","small","medium","large","d","useShapeStyles","rounded","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bw81rd7","kdpuga","dm238s","B6xbmo0","B3whbx2","circular","square","p","useEmptySwatchStyles_unstable","state","styles","sizeStyles","shapeStyles","_state_size","size","_state_shape","className","shape"],"sources":["useEmptySwatchStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from
|
|
1
|
+
{"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","createCustomFocusIndicatorStyle","emptySwatchClassNames","root","useStyles","useSizeStyles","a9b677","Bqenvij","small","medium","large","d","useShapeStyles","rounded","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bw81rd7","kdpuga","dm238s","B6xbmo0","B3whbx2","circular","square","p","useEmptySwatchStyles_unstable","state","styles","sizeStyles","shapeStyles","_state_size","size","_state_shape","className","shape"],"sources":["useEmptySwatchStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { createCustomFocusIndicatorStyle } from \"@fluentui/react-tabster\";\nexport const emptySwatchClassNames = {\n root: 'fui-EmptySwatch'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeResetStyles({\n backgroundColor: tokens.colorTransparentBackground,\n border: `1px dashed ${tokens.colorNeutralForeground4}`\n});\nconst useSizeStyles = makeStyles({\n 'extra-small': {\n width: '20px',\n height: '20px'\n },\n small: {\n width: '24px',\n height: '24px'\n },\n medium: {\n width: '28px',\n height: '28px'\n },\n large: {\n width: '32px',\n height: '32px'\n }\n});\nconst useShapeStyles = makeStyles({\n rounded: {\n borderRadius: tokens.borderRadiusMedium,\n ...createCustomFocusIndicatorStyle({\n borderRadius: tokens.borderRadiusMedium\n })\n },\n circular: {\n borderRadius: tokens.borderRadiusCircular,\n ...createCustomFocusIndicatorStyle({\n borderRadius: tokens.borderRadiusCircular\n })\n },\n square: {\n borderRadius: tokens.borderRadiusNone,\n ...createCustomFocusIndicatorStyle({\n borderRadius: tokens.borderRadiusNone\n })\n }\n});\n/**\n * Apply styling to the EmptySwatch slots based on the state\n */ export const useEmptySwatchStyles_unstable = (state)=>{\n const styles = useStyles();\n const sizeStyles = useSizeStyles();\n const shapeStyles = useShapeStyles();\n var _state_size;\n const size = (_state_size = state.size) !== null && _state_size !== void 0 ? _state_size : 'medium';\n var _state_shape;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(emptySwatchClassNames.root, styles, sizeStyles[size], shapeStyles[(_state_shape = state.shape) !== null && _state_shape !== void 0 ? _state_shape : 'square'], state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,OAAO,MAAMC,qBAAqB,GAAG;EACjCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGP,aAAA,sIAGrB,CAAC;AACF,MAAMQ,aAAa,gBAAGP,QAAA;EAAA;IAAAQ,MAAA;IAAAC,OAAA;EAAA;EAAAC,KAAA;IAAAF,MAAA;IAAAC,OAAA;EAAA;EAAAE,MAAA;IAAAH,MAAA;IAAAC,OAAA;EAAA;EAAAG,KAAA;IAAAJ,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAI,CAAA;AAAA,CAiBrB,CAAC;AACF,MAAMC,cAAc,gBAAGd,QAAA;EAAAe,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAV,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAE,MAAA;IAAAX,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAZ,CAAA;IAAAe,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CAmBtB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,6BAA6B,GAAIC,KAAK,IAAG;EACtD,MAAMC,MAAM,GAAGzB,SAAS,CAAC,CAAC;EAC1B,MAAM0B,UAAU,GAAGzB,aAAa,CAAC,CAAC;EAClC,MAAM0B,WAAW,GAAGnB,cAAc,CAAC,CAAC;EACpC,IAAIoB,WAAW;EACf,MAAMC,IAAI,GAAG,CAACD,WAAW,GAAGJ,KAAK,CAACK,IAAI,MAAM,IAAI,IAAID,WAAW,KAAK,KAAK,CAAC,GAAGA,WAAW,GAAG,QAAQ;EACnG,IAAIE,YAAY;EAChB;EACAN,KAAK,CAACzB,IAAI,CAACgC,SAAS,GAAGpC,YAAY,CAACG,qBAAqB,CAACC,IAAI,EAAE0B,MAAM,EAAEC,UAAU,CAACG,IAAI,CAAC,EAAEF,WAAW,CAAC,CAACG,YAAY,GAAGN,KAAK,CAACQ,KAAK,MAAM,IAAI,IAAIF,YAAY,KAAK,KAAK,CAAC,GAAGA,YAAY,GAAG,QAAQ,CAAC,EAAEN,KAAK,CAACzB,IAAI,CAACgC,SAAS,CAAC;EACxN,OAAOP,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { makeResetStyles, makeStyles, mergeClasses } from
|
|
3
|
-
import { tokens } from
|
|
4
|
-
import { createCustomFocusIndicatorStyle } from
|
|
2
|
+
import { makeResetStyles, makeStyles, mergeClasses } from "@griffel/react";
|
|
3
|
+
import { tokens } from "@fluentui/react-theme";
|
|
4
|
+
import { createCustomFocusIndicatorStyle } from "@fluentui/react-tabster";
|
|
5
5
|
export const emptySwatchClassNames = {
|
|
6
6
|
root: 'fui-EmptySwatch'
|
|
7
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import * as React from
|
|
3
|
-
import { useImageSwatch_unstable } from
|
|
4
|
-
import { renderImageSwatch_unstable } from
|
|
5
|
-
import { useImageSwatchStyles_unstable } from
|
|
6
|
-
import { useCustomStyleHook_unstable } from
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useImageSwatch_unstable } from "./useImageSwatch.js";
|
|
4
|
+
import { renderImageSwatch_unstable } from "./renderImageSwatch.js";
|
|
5
|
+
import { useImageSwatchStyles_unstable } from "./useImageSwatchStyles.styles.js";
|
|
6
|
+
import { useCustomStyleHook_unstable } from "@fluentui/react-shared-contexts";
|
|
7
7
|
/**
|
|
8
8
|
* ImageSwatch component is used to render an images, patterns and textures.
|
|
9
9
|
*/ export const ImageSwatch = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ImageSwatch/ImageSwatch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useImageSwatch_unstable } from './useImageSwatch';\nimport { renderImageSwatch_unstable } from './renderImageSwatch';\nimport { useImageSwatchStyles_unstable } from './useImageSwatchStyles.styles';\nimport type { ImageSwatchProps } from './ImageSwatch.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * ImageSwatch component is used to render an images, patterns and textures.\n */\nexport const ImageSwatch: ForwardRefComponent<ImageSwatchProps> = React.forwardRef((props, ref) => {\n const state = useImageSwatch_unstable(props, ref);\n\n useImageSwatchStyles_unstable(state);\n useCustomStyleHook_unstable('useImageSwatchStyles_unstable')(state);\n\n return renderImageSwatch_unstable(state);\n});\n\nImageSwatch.displayName = 'ImageSwatch';\n"],"names":["React","useImageSwatch_unstable","renderImageSwatch_unstable","useImageSwatchStyles_unstable","useCustomStyleHook_unstable","ImageSwatch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,uBAAuB,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/ImageSwatch/ImageSwatch.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useImageSwatch_unstable } from './useImageSwatch';\nimport { renderImageSwatch_unstable } from './renderImageSwatch';\nimport { useImageSwatchStyles_unstable } from './useImageSwatchStyles.styles';\nimport type { ImageSwatchProps } from './ImageSwatch.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * ImageSwatch component is used to render an images, patterns and textures.\n */\nexport const ImageSwatch: ForwardRefComponent<ImageSwatchProps> = React.forwardRef((props, ref) => {\n const state = useImageSwatch_unstable(props, ref);\n\n useImageSwatchStyles_unstable(state);\n useCustomStyleHook_unstable('useImageSwatchStyles_unstable')(state);\n\n return renderImageSwatch_unstable(state);\n});\n\nImageSwatch.displayName = 'ImageSwatch';\n"],"names":["React","useImageSwatch_unstable","renderImageSwatch_unstable","useImageSwatchStyles_unstable","useCustomStyleHook_unstable","ImageSwatch","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,yBAAsB;AACjE,SAASC,6BAA6B,QAAQ,mCAAgC;AAE9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQR,wBAAwBM,OAAOC;IAE7CL,8BAA8BM;IAC9BL,4BAA4B,iCAAiCK;IAE7D,OAAOP,2BAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ImageSwatch/ImageSwatch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type ImageSwatchSlots = {\n root: Slot<'button'>;\n};\n\n/**\n * ImageSwatch Props\n */\nexport type ImageSwatchProps = ComponentProps<ImageSwatchSlots> &\n Pick<SwatchPickerProps, 'size' | 'shape'> & {\n /**\n * Swatch color\n */\n src: string;\n\n /**\n * Swatch value\n */\n value: string;\n };\n\n/**\n * State used in rendering ImageSwatch\n */\nexport type ImageSwatchState = ComponentState<ImageSwatchSlots> &\n Pick<ImageSwatchProps, 'color' | 'size' | 'shape' | 'value'> & {\n selected: boolean;\n };\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/ImageSwatch/ImageSwatch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type ImageSwatchSlots = {\n root: Slot<'button'>;\n};\n\n/**\n * ImageSwatch Props\n */\nexport type ImageSwatchProps = ComponentProps<ImageSwatchSlots> &\n Pick<SwatchPickerProps, 'size' | 'shape'> & {\n /**\n * Swatch color\n */\n src: string;\n\n /**\n * Swatch value\n */\n value: string;\n };\n\nexport type ImageSwatchBaseProps = Omit<ImageSwatchProps, 'size' | 'shape'>;\n\n/**\n * State used in rendering ImageSwatch\n */\nexport type ImageSwatchState = ComponentState<ImageSwatchSlots> &\n Pick<ImageSwatchProps, 'color' | 'size' | 'shape' | 'value'> & {\n selected: boolean;\n };\n\nexport type ImageSwatchBaseState = Omit<ImageSwatchState, 'size' | 'shape'>;\n"],"names":[],"mappings":"AAiCA,WAA4E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ImageSwatch } from
|
|
2
|
-
export { renderImageSwatch_unstable } from
|
|
3
|
-
export { useImageSwatch_unstable } from
|
|
4
|
-
export { imageSwatchClassNames, useImageSwatchStyles_unstable } from
|
|
1
|
+
export { ImageSwatch } from "./ImageSwatch.js";
|
|
2
|
+
export { renderImageSwatch_unstable } from "./renderImageSwatch.js";
|
|
3
|
+
export { useImageSwatch_unstable, useImageSwatchBase_unstable } from "./useImageSwatch.js";
|
|
4
|
+
export { imageSwatchClassNames, useImageSwatchStyles_unstable } from "./useImageSwatchStyles.styles.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ImageSwatch/index.ts"],"sourcesContent":["export { ImageSwatch } from './ImageSwatch';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/ImageSwatch/index.ts"],"sourcesContent":["export { ImageSwatch } from './ImageSwatch';\nexport type {\n ImageSwatchBaseProps,\n ImageSwatchBaseState,\n ImageSwatchProps,\n ImageSwatchSlots,\n ImageSwatchState,\n} from './ImageSwatch.types';\nexport { renderImageSwatch_unstable } from './renderImageSwatch';\nexport { useImageSwatch_unstable, useImageSwatchBase_unstable } from './useImageSwatch';\nexport { imageSwatchClassNames, useImageSwatchStyles_unstable } from './useImageSwatchStyles.styles';\n"],"names":["ImageSwatch","renderImageSwatch_unstable","useImageSwatch_unstable","useImageSwatchBase_unstable","imageSwatchClassNames","useImageSwatchStyles_unstable"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mBAAgB;AAQ5C,SAASC,0BAA0B,QAAQ,yBAAsB;AACjE,SAASC,uBAAuB,EAAEC,2BAA2B,QAAQ,sBAAmB;AACxF,SAASC,qBAAqB,EAAEC,6BAA6B,QAAQ,mCAAgC"}
|
|
@@ -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 ImageSwatch
|
|
5
5
|
*/ export const renderImageSwatch_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ImageSwatch/renderImageSwatch.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/ImageSwatch/renderImageSwatch.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 { ImageSwatchBaseState, ImageSwatchSlots } from './ImageSwatch.types';\n\n/**\n * Render the final JSX of ImageSwatch\n */\nexport const renderImageSwatch_unstable = (state: ImageSwatchBaseState): JSXElement => {\n assertSlots<ImageSwatchSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderImageSwatch_unstable","state","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAE9B,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { getIntrinsicElementProps, slot, useEventCallback, mergeCallbacks } from
|
|
3
|
-
import { useSwatchPickerContextValue_unstable } from
|
|
2
|
+
import { getIntrinsicElementProps, slot, useEventCallback, mergeCallbacks } from "@fluentui/react-utilities";
|
|
3
|
+
import { useSwatchPickerContextValue_unstable } from "../../contexts/swatchPicker.js";
|
|
4
4
|
/**
|
|
5
|
-
* Create the state required to render ImageSwatch.
|
|
5
|
+
* Create the base state required to render unstyled ImageSwatch.
|
|
6
6
|
*
|
|
7
|
-
* The returned state can be modified with hooks
|
|
8
|
-
* before being passed to renderImageSwatch_unstable.
|
|
7
|
+
* The returned state can be modified with hooks before being passed to renderImageSwatch_unstable.
|
|
9
8
|
*
|
|
10
9
|
* @param props - props from this instance of ImageSwatch
|
|
11
10
|
* @param ref - reference to root HTMLDivElement of ImageSwatch
|
|
12
|
-
*/ export const
|
|
11
|
+
*/ export const useImageSwatchBase_unstable = (props, ref)=>{
|
|
13
12
|
const { src, value, onClick, style, ...rest } = props;
|
|
14
|
-
const size = useSwatchPickerContextValue_unstable((ctx)=>ctx.size);
|
|
15
|
-
const shape = useSwatchPickerContextValue_unstable((ctx)=>ctx.shape);
|
|
16
13
|
const isGrid = useSwatchPickerContextValue_unstable((ctx)=>ctx.isGrid);
|
|
17
14
|
const requestSelectionChange = useSwatchPickerContextValue_unstable((ctx)=>ctx.requestSelectionChange);
|
|
18
15
|
const selected = useSwatchPickerContextValue_unstable((ctx)=>ctx.selectedValue === value);
|
|
@@ -44,8 +41,25 @@ import { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicke
|
|
|
44
41
|
elementType: 'button'
|
|
45
42
|
}),
|
|
46
43
|
value,
|
|
47
|
-
selected
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
selected
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Create the state required to render ImageSwatch.
|
|
49
|
+
*
|
|
50
|
+
* The returned state can be modified with hooks such as useImageSwatchStyles_unstable,
|
|
51
|
+
* before being passed to renderImageSwatch_unstable.
|
|
52
|
+
*
|
|
53
|
+
* @param props - props from this instance of ImageSwatch
|
|
54
|
+
* @param ref - reference to root HTMLDivElement of ImageSwatch
|
|
55
|
+
*/ export const useImageSwatch_unstable = (props, ref)=>{
|
|
56
|
+
const sizeFromContext = useSwatchPickerContextValue_unstable((ctx)=>ctx.size);
|
|
57
|
+
const shapeFromContext = useSwatchPickerContextValue_unstable((ctx)=>ctx.shape);
|
|
58
|
+
const { size: _size, shape: _shape, ...rest } = props;
|
|
59
|
+
const baseState = useImageSwatchBase_unstable(rest, ref);
|
|
60
|
+
return {
|
|
61
|
+
...baseState,
|
|
62
|
+
size: sizeFromContext,
|
|
63
|
+
shape: shapeFromContext
|
|
50
64
|
};
|
|
51
65
|
};
|
|
@@ -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 {
|
|
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;YACT,GAAGR,IAAI;YACPD,OAAO;gBACLe,iBAAiB,CAAC,IAAI,EAAElB,IAAI,CAAC,CAAC;gBAC9B,GAAGG,KAAK;YACV;QACF,IACA;YAAEgB,aAAa;QAAS;QAE1BlB;QACAO;IACF;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMY,0BAA0B,CACrCtB,OACAC;IAEA,MAAMsB,kBAAkBzB,qCAAqCU,CAAAA,MAAOA,IAAIgB,IAAI;IAC5E,MAAMC,mBAAmB3B,qCAAqCU,CAAAA,MAAOA,IAAIkB,KAAK;IAE9E,MAAM,EAAEF,MAAMG,KAAK,EAAED,OAAOE,MAAM,EAAE,GAAGtB,MAAM,GAAGN;IAEhD,MAAM6B,YAAY9B,4BAA4BO,MAAML;IAEpD,OAAO;QACL,GAAG4B,SAAS;QACZL,MAAMD;QACNG,OAAOD;IACT;AACF,EAAE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { __styles, mergeClasses, __resetStyles } from
|
|
4
|
-
import { tokens } from
|
|
5
|
-
import { createCustomFocusIndicatorStyle } from
|
|
3
|
+
import { __styles, mergeClasses, __resetStyles } from "@griffel/react";
|
|
4
|
+
import { tokens } from "@fluentui/react-theme";
|
|
5
|
+
import { createCustomFocusIndicatorStyle } from "@fluentui/react-tabster";
|
|
6
6
|
export const imageSwatchClassNames = {
|
|
7
7
|
root: 'fui-ImageSwatch'
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","__resetStyles","tokens","createCustomFocusIndicatorStyle","imageSwatchClassNames","root","useStyles","r","s","useStylesSelected","selected","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","E5pizo","Bvxd0ez","vajtyg","j6ew2k","Bv9i2bc","d","p","h","m","useSizeStyles","a9b677","Bqenvij","small","medium","large","useShapeStyles","rounded","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bw81rd7","kdpuga","dm238s","B6xbmo0","B3whbx2","circular","square","useImageSwatchStyles_unstable","state","styles","selectedStyles","sizeStyles","shapeStyles","size","shape","className"],"sources":["useImageSwatchStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses, makeResetStyles } from
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","__resetStyles","tokens","createCustomFocusIndicatorStyle","imageSwatchClassNames","root","useStyles","r","s","useStylesSelected","selected","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","E5pizo","Bvxd0ez","vajtyg","j6ew2k","Bv9i2bc","d","p","h","m","useSizeStyles","a9b677","Bqenvij","small","medium","large","useShapeStyles","rounded","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bw81rd7","kdpuga","dm238s","B6xbmo0","B3whbx2","circular","square","useImageSwatchStyles_unstable","state","styles","selectedStyles","sizeStyles","shapeStyles","size","shape","className"],"sources":["useImageSwatchStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses, makeResetStyles } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { createCustomFocusIndicatorStyle } from \"@fluentui/react-tabster\";\nexport const imageSwatchClassNames = {\n root: 'fui-ImageSwatch'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeResetStyles({\n display: 'inline-flex',\n boxSizing: 'border-box',\n border: `1px solid ${tokens.colorTransparentStroke}`,\n backgroundSize: 'cover',\n backgroundRepeat: 'no-repeat',\n padding: '0',\n ':hover': {\n cursor: 'pointer',\n border: 'none',\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorBrandStroke1}, inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorStrokeFocus1}`\n },\n ':hover:active': {\n border: 'none',\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorCompoundBrandStrokePressed}, inset 0 0 0 ${tokens.strokeWidthThickest} ${tokens.colorStrokeFocus1}`\n },\n ':focus': {\n outline: 'none'\n },\n ':focus-visible': {\n outline: 'none'\n },\n ...createCustomFocusIndicatorStyle({\n border: 'none',\n outline: 'none',\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorStrokeFocus2}, inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorStrokeFocus1}`\n }),\n // High contrast styles\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'none',\n ':hover': {\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThick} ${tokens.colorBrandStroke2Hover}, inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorStrokeFocus1}`\n },\n ':hover:active': {\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorBrandStroke2Pressed}, inset 0 0 0 ${tokens.strokeWidthThickest} ${tokens.colorStrokeFocus1}`\n }\n }\n});\nconst useStylesSelected = makeStyles({\n selected: {\n border: 'none',\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorBrandStroke1}, inset 0 0 0 5px ${tokens.colorStrokeFocus1}`,\n ':hover': {\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThickest} ${tokens.colorCompoundBrandStrokeHover}, inset 0 0 0 6px ${tokens.colorStrokeFocus1}`\n },\n ':hover:active': {\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThickest} ${tokens.colorCompoundBrandStrokePressed}, inset 0 0 0 7px ${tokens.colorStrokeFocus1}`\n },\n ...createCustomFocusIndicatorStyle({\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorStrokeFocus2}, inset 0 0 0 5px ${tokens.colorStrokeFocus1}`\n }),\n '@media (forced-colors: active)': {\n boxShadow: `inset 0 0 0 ${tokens.strokeWidthThicker} ${tokens.colorBrandStroke2Pressed}, inset 0 0 0 5px ${tokens.colorStrokeFocus1}`\n }\n }\n});\nconst useSizeStyles = makeStyles({\n 'extra-small': {\n width: '20px',\n height: '20px'\n },\n small: {\n width: '24px',\n height: '24px'\n },\n medium: {\n width: '28px',\n height: '28px'\n },\n large: {\n width: '32px',\n height: '32px'\n }\n});\nconst useShapeStyles = makeStyles({\n rounded: {\n borderRadius: tokens.borderRadiusMedium,\n ...createCustomFocusIndicatorStyle({\n borderRadius: tokens.borderRadiusMedium\n })\n },\n circular: {\n borderRadius: tokens.borderRadiusCircular,\n ...createCustomFocusIndicatorStyle({\n borderRadius: tokens.borderRadiusCircular\n })\n },\n square: {\n borderRadius: tokens.borderRadiusNone,\n ...createCustomFocusIndicatorStyle({\n borderRadius: tokens.borderRadiusNone\n })\n }\n});\n/**\n * Apply styling to the ImageSwatch slots based on the state\n */ export const useImageSwatchStyles_unstable = (state)=>{\n const styles = useStyles();\n const selectedStyles = useStylesSelected();\n const sizeStyles = useSizeStyles();\n const shapeStyles = useShapeStyles();\n const { size = 'medium', shape = 'square' } = state;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(imageSwatchClassNames.root, styles, sizeStyles[size], shapeStyles[shape], state.selected && selectedStyles.selected, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,EAAAC,aAAA,QAAyB,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,OAAO,MAAMC,qBAAqB,GAAG;EACjCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGL,aAAA;EAAAM,CAAA;EAAAC,CAAA;AAAA,CAqCrB,CAAC;AACF,MAAMC,iBAAiB,gBAAGV,QAAA;EAAAW,QAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;IAAAC,CAAA;EAAA;EAAAC,CAAA;EAAAC,CAAA;IAAAA,CAAA;EAAA;AAAA,CAiBzB,CAAC;AACF,MAAMC,aAAa,gBAAGtC,QAAA;EAAA;IAAAuC,MAAA;IAAAC,OAAA;EAAA;EAAAC,KAAA;IAAAF,MAAA;IAAAC,OAAA;EAAA;EAAAE,MAAA;IAAAH,MAAA;IAAAC,OAAA;EAAA;EAAAG,KAAA;IAAAJ,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAN,CAAA;AAAA,CAiBrB,CAAC;AACF,MAAMU,cAAc,gBAAG5C,QAAA;EAAA6C,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAV,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAE,MAAA;IAAAX,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAArB,CAAA;IAAAC,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CAmBtB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMuB,6BAA6B,GAAIC,KAAK,IAAG;EACtD,MAAMC,MAAM,GAAGrD,SAAS,CAAC,CAAC;EAC1B,MAAMsD,cAAc,GAAGnD,iBAAiB,CAAC,CAAC;EAC1C,MAAMoD,UAAU,GAAGxB,aAAa,CAAC,CAAC;EAClC,MAAMyB,WAAW,GAAGnB,cAAc,CAAC,CAAC;EACpC,MAAM;IAAEoB,IAAI,GAAG,QAAQ;IAAEC,KAAK,GAAG;EAAS,CAAC,GAAGN,KAAK;EACnD;EACAA,KAAK,CAACrD,IAAI,CAAC4D,SAAS,GAAGjE,YAAY,CAACI,qBAAqB,CAACC,IAAI,EAAEsD,MAAM,EAAEE,UAAU,CAACE,IAAI,CAAC,EAAED,WAAW,CAACE,KAAK,CAAC,EAAEN,KAAK,CAAChD,QAAQ,IAAIkD,cAAc,CAAClD,QAAQ,EAAEgD,KAAK,CAACrD,IAAI,CAAC4D,SAAS,CAAC;EAC9K,OAAOP,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { makeStyles, mergeClasses, makeResetStyles } from
|
|
3
|
-
import { tokens } from
|
|
4
|
-
import { createCustomFocusIndicatorStyle } from
|
|
2
|
+
import { makeStyles, mergeClasses, makeResetStyles } from "@griffel/react";
|
|
3
|
+
import { tokens } from "@fluentui/react-theme";
|
|
4
|
+
import { createCustomFocusIndicatorStyle } from "@fluentui/react-tabster";
|
|
5
5
|
export const imageSwatchClassNames = {
|
|
6
6
|
root: 'fui-ImageSwatch'
|
|
7
7
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import * as React from
|
|
3
|
-
import { useSwatchPicker_unstable } from
|
|
4
|
-
import { renderSwatchPicker_unstable } from
|
|
5
|
-
import { useSwatchPickerStyles_unstable } from
|
|
6
|
-
import { useSwatchPickerContextValues } from
|
|
7
|
-
import { useCustomStyleHook_unstable } from
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useSwatchPicker_unstable } from "./useSwatchPicker.js";
|
|
4
|
+
import { renderSwatchPicker_unstable } from "./renderSwatchPicker.js";
|
|
5
|
+
import { useSwatchPickerStyles_unstable } from "./useSwatchPickerStyles.styles.js";
|
|
6
|
+
import { useSwatchPickerContextValues } from "./useSwatchPickerContextValues.js";
|
|
7
|
+
import { useCustomStyleHook_unstable } from "@fluentui/react-shared-contexts";
|
|
8
8
|
/**
|
|
9
9
|
* SwatchPicker component - TODO: add more docs
|
|
10
10
|
*/ export const SwatchPicker = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPicker/SwatchPicker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useSwatchPicker_unstable } from './useSwatchPicker';\nimport { renderSwatchPicker_unstable } from './renderSwatchPicker';\nimport { useSwatchPickerStyles_unstable } from './useSwatchPickerStyles.styles';\nimport type { SwatchPickerProps } from './SwatchPicker.types';\nimport { useSwatchPickerContextValues } from './useSwatchPickerContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * SwatchPicker component - TODO: add more docs\n */\nexport const SwatchPicker: ForwardRefComponent<SwatchPickerProps> = React.forwardRef((props, ref) => {\n const state = useSwatchPicker_unstable(props, ref);\n const contextValues = useSwatchPickerContextValues(state);\n\n useSwatchPickerStyles_unstable(state);\n useCustomStyleHook_unstable('useSwatchPickerStyles_unstable')(state);\n\n return renderSwatchPicker_unstable(state, contextValues);\n});\n\nSwatchPicker.displayName = 'SwatchPicker';\n"],"names":["React","useSwatchPicker_unstable","renderSwatchPicker_unstable","useSwatchPickerStyles_unstable","useSwatchPickerContextValues","useCustomStyleHook_unstable","SwatchPicker","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,wBAAwB,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPicker/SwatchPicker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useSwatchPicker_unstable } from './useSwatchPicker';\nimport { renderSwatchPicker_unstable } from './renderSwatchPicker';\nimport { useSwatchPickerStyles_unstable } from './useSwatchPickerStyles.styles';\nimport type { SwatchPickerProps } from './SwatchPicker.types';\nimport { useSwatchPickerContextValues } from './useSwatchPickerContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * SwatchPicker component - TODO: add more docs\n */\nexport const SwatchPicker: ForwardRefComponent<SwatchPickerProps> = React.forwardRef((props, ref) => {\n const state = useSwatchPicker_unstable(props, ref);\n const contextValues = useSwatchPickerContextValues(state);\n\n useSwatchPickerStyles_unstable(state);\n useCustomStyleHook_unstable('useSwatchPickerStyles_unstable')(state);\n\n return renderSwatchPicker_unstable(state, contextValues);\n});\n\nSwatchPicker.displayName = 'SwatchPicker';\n"],"names":["React","useSwatchPicker_unstable","renderSwatchPicker_unstable","useSwatchPickerStyles_unstable","useSwatchPickerContextValues","useCustomStyleHook_unstable","SwatchPicker","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,wBAAwB,QAAQ,uBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,0BAAuB;AACnE,SAASC,8BAA8B,QAAQ,oCAAiC;AAEhF,SAASC,4BAA4B,QAAQ,oCAAiC;AAC9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,6BAAuDN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC3F,MAAMC,QAAQT,yBAAyBO,OAAOC;IAC9C,MAAME,gBAAgBP,6BAA6BM;IAEnDP,+BAA+BO;IAC/BL,4BAA4B,kCAAkCK;IAE9D,OAAOR,4BAA4BQ,OAAOC;AAC5C,GAAG;AAEHL,aAAaM,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPicker/SwatchPicker.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot, EventHandler, EventData } from '@fluentui/react-utilities';\nimport type { SwatchPickerContextValue } from '../../contexts/swatchPicker';\n\nexport type SwatchPickerSlots = {\n root: Slot<'div'>;\n};\n\nexport type SwatchPickerOnSelectEventHandler = EventHandler<SwatchPickerOnSelectionChangeData>;\n\nexport type SwatchPickerOnSelectionChangeData = EventData<'click', React.MouseEvent<HTMLButtonElement>> & {\n selectedValue: string;\n selectedSwatch: string;\n};\n\n/**\n * SwatchPicker Props\n */\nexport type SwatchPickerProps = ComponentProps<SwatchPickerSlots> & {\n /**\n * Default selected value\n */\n defaultSelectedValue?: string;\n\n /**\n * Sets the focus behavior for the SwatchPicker.\n *\n * `arrow`\n * This behavior will cycle through all elements inside of the SwatchPicker when pressing the Arrow key.\n *\n * `tab`\n * This behavior will cycle through all elements inside of the SwatchPicker when pressing the Tab key.\n *\n * @default 'arrow'\n */\n focusMode?: 'arrow' | 'tab';\n\n /**\n * Whether SwatchPicker is row or grid\n */\n layout?: 'row' | 'grid';\n\n /**\n * Triggers a callback when the value has been changed\n */\n onSelectionChange?: EventHandler<SwatchPickerOnSelectionChangeData>;\n\n /**\n * Controlled selected value\n */\n selectedValue?: string;\n\n /**\n * Swatch size\n * @defaultvalue 'medium'\n */\n size?: 'extra-small' | 'small' | 'medium' | 'large';\n\n /**\n * Swatch shape\n * @defaultvalue 'square'\n */\n shape?: 'rounded' | 'square' | 'circular';\n\n /**\n * Spacing between swatches\n * @defaultvalue 'medium'\n */\n spacing?: 'small' | 'medium';\n};\n\n/**\n * State used in rendering SwatchPicker\n */\nexport type SwatchPickerState = ComponentState<SwatchPickerSlots> &\n SwatchPickerContextValue &\n Pick<SwatchPickerProps, 'layout' | 'size' | 'shape' | 'spacing'> & {\n isGrid: boolean;\n };\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPicker/SwatchPicker.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot, EventHandler, EventData } from '@fluentui/react-utilities';\nimport type { SwatchPickerContextValue } from '../../contexts/swatchPicker';\n\nexport type SwatchPickerSlots = {\n root: Slot<'div'>;\n};\n\nexport type SwatchPickerOnSelectEventHandler = EventHandler<SwatchPickerOnSelectionChangeData>;\n\nexport type SwatchPickerOnSelectionChangeData = EventData<'click', React.MouseEvent<HTMLButtonElement>> & {\n selectedValue: string;\n selectedSwatch: string;\n};\n\n/**\n * SwatchPicker Props\n */\nexport type SwatchPickerProps = ComponentProps<SwatchPickerSlots> & {\n /**\n * Default selected value\n */\n defaultSelectedValue?: string;\n\n /**\n * Sets the focus behavior for the SwatchPicker.\n *\n * `arrow`\n * This behavior will cycle through all elements inside of the SwatchPicker when pressing the Arrow key.\n *\n * `tab`\n * This behavior will cycle through all elements inside of the SwatchPicker when pressing the Tab key.\n *\n * @default 'arrow'\n */\n focusMode?: 'arrow' | 'tab';\n\n /**\n * Whether SwatchPicker is row or grid\n */\n layout?: 'row' | 'grid';\n\n /**\n * Triggers a callback when the value has been changed\n */\n onSelectionChange?: EventHandler<SwatchPickerOnSelectionChangeData>;\n\n /**\n * Controlled selected value\n */\n selectedValue?: string;\n\n /**\n * Swatch size\n * @defaultvalue 'medium'\n */\n size?: 'extra-small' | 'small' | 'medium' | 'large';\n\n /**\n * Swatch shape\n * @defaultvalue 'square'\n */\n shape?: 'rounded' | 'square' | 'circular';\n\n /**\n * Spacing between swatches\n * @defaultvalue 'medium'\n */\n spacing?: 'small' | 'medium';\n};\n\nexport type SwatchPickerBaseProps = Omit<SwatchPickerProps, 'size' | 'shape' | 'spacing'>;\n\n/**\n * State used in rendering SwatchPicker\n */\nexport type SwatchPickerState = ComponentState<SwatchPickerSlots> &\n SwatchPickerContextValue &\n Pick<SwatchPickerProps, 'layout' | 'size' | 'shape' | 'spacing'> & {\n isGrid: boolean;\n };\n\nexport type SwatchPickerBaseState = Omit<SwatchPickerState, 'size' | 'shape' | 'spacing'>;\n"],"names":[],"mappings":"AAkFA,WAA0F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SwatchPicker } from
|
|
2
|
-
export { renderSwatchPicker_unstable } from
|
|
3
|
-
export { useSwatchPicker_unstable } from
|
|
4
|
-
export { swatchPickerClassNames, useSwatchPickerStyles_unstable } from
|
|
1
|
+
export { SwatchPicker } from "./SwatchPicker.js";
|
|
2
|
+
export { renderSwatchPicker_unstable } from "./renderSwatchPicker.js";
|
|
3
|
+
export { useSwatchPicker_unstable, useSwatchPickerBase_unstable } from "./useSwatchPicker.js";
|
|
4
|
+
export { swatchPickerClassNames, useSwatchPickerStyles_unstable } from "./useSwatchPickerStyles.styles.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPicker/index.ts"],"sourcesContent":["export { SwatchPicker } from './SwatchPicker';\nexport type {\n SwatchPickerOnSelectEventHandler,\n SwatchPickerOnSelectionChangeData,\n SwatchPickerProps,\n SwatchPickerSlots,\n SwatchPickerState,\n} from './SwatchPicker.types';\nexport { renderSwatchPicker_unstable } from './renderSwatchPicker';\nexport { useSwatchPicker_unstable } from './useSwatchPicker';\nexport { swatchPickerClassNames, useSwatchPickerStyles_unstable } from './useSwatchPickerStyles.styles';\n"],"names":["SwatchPicker","renderSwatchPicker_unstable","useSwatchPicker_unstable","swatchPickerClassNames","useSwatchPickerStyles_unstable"],"mappings":"AAAA,SAASA,YAAY,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPicker/index.ts"],"sourcesContent":["export { SwatchPicker } from './SwatchPicker';\nexport type {\n SwatchPickerBaseProps,\n SwatchPickerBaseState,\n SwatchPickerOnSelectEventHandler,\n SwatchPickerOnSelectionChangeData,\n SwatchPickerProps,\n SwatchPickerSlots,\n SwatchPickerState,\n} from './SwatchPicker.types';\nexport { renderSwatchPicker_unstable } from './renderSwatchPicker';\nexport { useSwatchPicker_unstable, useSwatchPickerBase_unstable } from './useSwatchPicker';\nexport { swatchPickerClassNames, useSwatchPickerStyles_unstable } from './useSwatchPickerStyles.styles';\n"],"names":["SwatchPicker","renderSwatchPicker_unstable","useSwatchPicker_unstable","useSwatchPickerBase_unstable","swatchPickerClassNames","useSwatchPickerStyles_unstable"],"mappings":"AAAA,SAASA,YAAY,QAAQ,oBAAiB;AAU9C,SAASC,2BAA2B,QAAQ,0BAAuB;AACnE,SAASC,wBAAwB,EAAEC,4BAA4B,QAAQ,uBAAoB;AAC3F,SAASC,sBAAsB,EAAEC,8BAA8B,QAAQ,oCAAiC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
-
import { assertSlots } from
|
|
3
|
-
import { SwatchPickerProvider } from
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
|
+
import { SwatchPickerProvider } from "../../contexts/swatchPicker.js";
|
|
4
4
|
/**
|
|
5
5
|
* Render the final JSX of SwatchPicker
|
|
6
6
|
*/ export const renderSwatchPicker_unstable = (state, contextValues)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPicker/renderSwatchPicker.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 { SwatchPickerProvider } from '../../contexts/swatchPicker';\nimport type { SwatchPickerContextValues } from '../../contexts/swatchPicker';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPicker/renderSwatchPicker.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 { SwatchPickerProvider } from '../../contexts/swatchPicker';\nimport type { SwatchPickerContextValues } from '../../contexts/swatchPicker';\nimport type { SwatchPickerBaseState, SwatchPickerSlots } from './SwatchPicker.types';\n\n/**\n * Render the final JSX of SwatchPicker\n */\nexport const renderSwatchPicker_unstable = (\n state: SwatchPickerBaseState,\n contextValues: SwatchPickerContextValues,\n): JSXElement => {\n assertSlots<SwatchPickerSlots>(state);\n\n return (\n <SwatchPickerProvider value={contextValues.swatchPicker}>\n <state.root>{state.root.children}</state.root>\n </SwatchPickerProvider>\n );\n};\n"],"names":["assertSlots","SwatchPickerProvider","renderSwatchPicker_unstable","state","contextValues","value","swatchPicker","root","children"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,oBAAoB,QAAQ,iCAA8B;AAInE;;CAEC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEAJ,YAA+BG;IAE/B,qBACE,KAACF;QAAqBI,OAAOD,cAAcE,YAAY;kBACrD,cAAA,KAACH,MAAMI,IAAI;sBAAEJ,MAAMI,IAAI,CAACC,QAAQ;;;AAGtC,EAAE"}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useFieldControlProps_unstable } from
|
|
3
|
-
import { useArrowNavigationGroup } from
|
|
4
|
-
import { getIntrinsicElementProps, useControllableState, useEventCallback, slot } from
|
|
2
|
+
import { useFieldControlProps_unstable } from "@fluentui/react-field";
|
|
3
|
+
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
4
|
+
import { getIntrinsicElementProps, useControllableState, useEventCallback, slot } from "@fluentui/react-utilities";
|
|
5
5
|
/**
|
|
6
|
-
* Create the state required to render SwatchPicker.
|
|
6
|
+
* Create the base state required to render unstyled SwatchPicker.
|
|
7
7
|
*
|
|
8
|
-
* The returned state can be modified with hooks
|
|
9
|
-
* before being passed to renderSwatchPicker_unstable.
|
|
8
|
+
* The returned state can be modified with hooks before being passed to renderSwatchPicker_unstable.
|
|
10
9
|
*
|
|
11
10
|
* @param props - props from this instance of SwatchPicker
|
|
12
11
|
* @param ref - reference to root HTMLElement of SwatchPicker
|
|
13
|
-
*/ export const
|
|
12
|
+
*/ export const useSwatchPickerBase_unstable = (props, ref)=>{
|
|
14
13
|
// Merge props from surrounding <Field>, if any
|
|
15
14
|
props = useFieldControlProps_unstable(props);
|
|
16
|
-
const {
|
|
15
|
+
const { layout, onSelectionChange, style, ...rest } = props;
|
|
17
16
|
const isGrid = layout === 'grid';
|
|
18
|
-
const focusAttributes = useArrowNavigationGroup({
|
|
19
|
-
circular: true,
|
|
20
|
-
axis: isGrid ? 'grid-linear' : 'both',
|
|
21
|
-
memorizeCurrent: true
|
|
22
|
-
});
|
|
23
17
|
const role = isGrid ? 'grid' : 'radiogroup';
|
|
24
18
|
const [selectedValue, setSelectedValue] = useControllableState({
|
|
25
19
|
state: props.selectedValue,
|
|
@@ -42,14 +36,37 @@ import { getIntrinsicElementProps, useControllableState, useEventCallback, slot
|
|
|
42
36
|
root: slot.always(getIntrinsicElementProps('div', {
|
|
43
37
|
ref,
|
|
44
38
|
role,
|
|
45
|
-
...focusMode === 'arrow' ? focusAttributes : {},
|
|
46
39
|
...rest
|
|
47
40
|
}), {
|
|
48
41
|
elementType: 'div'
|
|
49
42
|
}),
|
|
50
43
|
isGrid,
|
|
51
44
|
requestSelectionChange,
|
|
52
|
-
selectedValue
|
|
45
|
+
selectedValue
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Create the state required to render SwatchPicker.
|
|
50
|
+
*
|
|
51
|
+
* The returned state can be modified with hooks such as useSwatchPickerStyles_unstable,
|
|
52
|
+
* before being passed to renderSwatchPicker_unstable.
|
|
53
|
+
*
|
|
54
|
+
* @param props - props from this instance of SwatchPicker
|
|
55
|
+
* @param ref - reference to root HTMLElement of SwatchPicker
|
|
56
|
+
*/ export const useSwatchPicker_unstable = (props, ref)=>{
|
|
57
|
+
const { focusMode = 'arrow', size = 'medium', shape, spacing = 'medium', ...rest } = props;
|
|
58
|
+
const baseState = useSwatchPickerBase_unstable(rest, ref);
|
|
59
|
+
const focusAttributes = useArrowNavigationGroup({
|
|
60
|
+
circular: true,
|
|
61
|
+
axis: baseState.isGrid ? 'grid-linear' : 'both',
|
|
62
|
+
memorizeCurrent: true
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
...baseState,
|
|
66
|
+
root: {
|
|
67
|
+
...baseState.root,
|
|
68
|
+
...focusMode === 'arrow' ? focusAttributes : {}
|
|
69
|
+
},
|
|
53
70
|
size,
|
|
54
71
|
shape,
|
|
55
72
|
spacing
|
|
@@ -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 {
|
|
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, style, ...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","style","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,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGL;IAEtD,MAAMM,SAASJ,WAAW;IAE1B,MAAMK,OAAOD,SAAS,SAAS;IAE/B,MAAM,CAACE,eAAeC,iBAAiB,GAAGb,qBAAqB;QAC7Dc,OAAOV,MAAMQ,aAAa;QAC1BG,cAAcX,MAAMY,oBAAoB;QACxCC,cAAc;IAChB;IAEA,MAAMC,yBAAsEjB,iBAAiB,CAACkB,OAAOC;QACnGb,8BAAAA,wCAAAA,kBAAoBY,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,MAAMtB,KAAKuB,MAAM,CACf1B,yBAAyB,OAAO;YAC9BM;YACAM;YACA,GAAGF,IAAI;QACT,IACA;YAAEiB,aAAa;QAAM;QAEvBhB;QACAQ;QACAN;IACF;AACF,EAAE;AAEF;;;;;;;;CAQC,GACD,OAAO,MAAMe,2BAA2B,CACtCvB,OACAC;IAEA,MAAM,EAAEuB,YAAY,OAAO,EAAEC,OAAO,QAAQ,EAAEC,KAAK,EAAEC,UAAU,QAAQ,EAAE,GAAGtB,MAAM,GAAGL;IAErF,MAAM4B,YAAY7B,6BAA6BM,MAAMJ;IAErD,MAAM4B,kBAAkBnC,wBAAwB;QAC9CoC,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import * as React from
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
export const useSwatchPickerContextValues = (state)=>{
|
|
4
4
|
const { isGrid, size, shape, spacing, requestSelectionChange, selectedValue } = state;
|
|
5
5
|
const swatchPicker = React.useMemo(()=>({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { __styles, mergeClasses } from
|
|
4
|
-
import { tokens } from
|
|
3
|
+
import { __styles, mergeClasses } from "@griffel/react";
|
|
4
|
+
import { tokens } from "@fluentui/react-theme";
|
|
5
5
|
export const swatchPickerClassNames = {
|
|
6
6
|
root: 'fui-SwatchPicker'
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","tokens","swatchPickerClassNames","root","useStyles","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","mc9l5x","row","Beiy3e4","grid","spacingSmall","i8kkvl","Belr9w4","rmohyg","spacingMedium","d","p","useSwatchPickerStyles_unstable","state","styles","layoutStyle","isGrid","spacingStyle","spacing","className"],"sources":["useSwatchPickerStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","tokens","swatchPickerClassNames","root","useStyles","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","mc9l5x","row","Beiy3e4","grid","spacingSmall","i8kkvl","Belr9w4","rmohyg","spacingMedium","d","p","useSwatchPickerStyles_unstable","state","styles","layoutStyle","isGrid","spacingStyle","spacing","className"],"sources":["useSwatchPickerStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nexport const swatchPickerClassNames = {\n root: 'fui-SwatchPicker'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n padding: `${tokens.spacingHorizontalNone} ${tokens.spacingVerticalNone}`,\n display: 'flex'\n },\n row: {\n flexDirection: 'row'\n },\n grid: {\n flexDirection: 'column'\n },\n spacingSmall: {\n gap: '2px'\n },\n spacingMedium: {\n gap: '4px'\n }\n});\n/**\n * Apply styling to the SwatchPicker slots based on the state\n */ export const useSwatchPickerStyles_unstable = (state)=>{\n const styles = useStyles();\n const layoutStyle = state.isGrid ? styles.grid : styles.row;\n const spacingStyle = state.spacing === 'small' ? styles.spacingSmall : styles.spacingMedium;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(swatchPickerClassNames.root, styles.root, layoutStyle, spacingStyle, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,sBAAsB,GAAG;EAClCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGL,QAAA;EAAAI,IAAA;IAAAE,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,GAAA;IAAAC,OAAA;EAAA;EAAAC,IAAA;IAAAD,OAAA;EAAA;EAAAE,YAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,aAAA;IAAAH,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;AAAA;EAAAE,CAAA;IAAAC,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CAiBrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,8BAA8B,GAAIC,KAAK,IAAG;EACvD,MAAMC,MAAM,GAAGnB,SAAS,CAAC,CAAC;EAC1B,MAAMoB,WAAW,GAAGF,KAAK,CAACG,MAAM,GAAGF,MAAM,CAACV,IAAI,GAAGU,MAAM,CAACZ,GAAG;EAC3D,MAAMe,YAAY,GAAGJ,KAAK,CAACK,OAAO,KAAK,OAAO,GAAGJ,MAAM,CAACT,YAAY,GAAGS,MAAM,CAACL,aAAa;EAC3F;EACAI,KAAK,CAACnB,IAAI,CAACyB,SAAS,GAAG5B,YAAY,CAACE,sBAAsB,CAACC,IAAI,EAAEoB,MAAM,CAACpB,IAAI,EAAEqB,WAAW,EAAEE,YAAY,EAAEJ,KAAK,CAACnB,IAAI,CAACyB,SAAS,CAAC;EAC9H,OAAON,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { makeStyles, mergeClasses } from
|
|
3
|
-
import { tokens } from
|
|
2
|
+
import { makeStyles, mergeClasses } from "@griffel/react";
|
|
3
|
+
import { tokens } from "@fluentui/react-theme";
|
|
4
4
|
export const swatchPickerClassNames = {
|
|
5
5
|
root: 'fui-SwatchPicker'
|
|
6
6
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import * as React from
|
|
3
|
-
import { useSwatchPickerRow_unstable } from
|
|
4
|
-
import { renderSwatchPickerRow_unstable } from
|
|
5
|
-
import { useSwatchPickerRowStyles_unstable } from
|
|
6
|
-
import { useCustomStyleHook_unstable } from
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useSwatchPickerRow_unstable } from "./useSwatchPickerRow.js";
|
|
4
|
+
import { renderSwatchPickerRow_unstable } from "./renderSwatchPickerRow.js";
|
|
5
|
+
import { useSwatchPickerRowStyles_unstable } from "./useSwatchPickerRowStyles.styles.js";
|
|
6
|
+
import { useCustomStyleHook_unstable } from "@fluentui/react-shared-contexts";
|
|
7
7
|
/**
|
|
8
8
|
* SwatchPickerRow component is used to render a row of swatches.
|
|
9
9
|
*/ export const SwatchPickerRow = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPickerRow/SwatchPickerRow.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useSwatchPickerRow_unstable } from './useSwatchPickerRow';\nimport { renderSwatchPickerRow_unstable } from './renderSwatchPickerRow';\nimport { useSwatchPickerRowStyles_unstable } from './useSwatchPickerRowStyles.styles';\nimport type { SwatchPickerRowProps } from './SwatchPickerRow.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * SwatchPickerRow component is used to render a row of swatches.\n */\nexport const SwatchPickerRow: ForwardRefComponent<SwatchPickerRowProps> = React.forwardRef((props, ref) => {\n const state = useSwatchPickerRow_unstable(props, ref);\n\n useSwatchPickerRowStyles_unstable(state);\n useCustomStyleHook_unstable('useSwatchPickerRowStyles_unstable')(state);\n return renderSwatchPickerRow_unstable(state);\n});\n\nSwatchPickerRow.displayName = 'SwatchPickerRow';\n"],"names":["React","useSwatchPickerRow_unstable","renderSwatchPickerRow_unstable","useSwatchPickerRowStyles_unstable","useCustomStyleHook_unstable","SwatchPickerRow","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPickerRow/SwatchPickerRow.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useSwatchPickerRow_unstable } from './useSwatchPickerRow';\nimport { renderSwatchPickerRow_unstable } from './renderSwatchPickerRow';\nimport { useSwatchPickerRowStyles_unstable } from './useSwatchPickerRowStyles.styles';\nimport type { SwatchPickerRowProps } from './SwatchPickerRow.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * SwatchPickerRow component is used to render a row of swatches.\n */\nexport const SwatchPickerRow: ForwardRefComponent<SwatchPickerRowProps> = React.forwardRef((props, ref) => {\n const state = useSwatchPickerRow_unstable(props, ref);\n\n useSwatchPickerRowStyles_unstable(state);\n useCustomStyleHook_unstable('useSwatchPickerRowStyles_unstable')(state);\n return renderSwatchPickerRow_unstable(state);\n});\n\nSwatchPickerRow.displayName = 'SwatchPickerRow';\n"],"names":["React","useSwatchPickerRow_unstable","renderSwatchPickerRow_unstable","useSwatchPickerRowStyles_unstable","useCustomStyleHook_unstable","SwatchPickerRow","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ,0BAAuB;AACnE,SAASC,8BAA8B,QAAQ,6BAA0B;AACzE,SAASC,iCAAiC,QAAQ,uCAAoC;AAEtF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,gCAA6DL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACjG,MAAMC,QAAQR,4BAA4BM,OAAOC;IAEjDL,kCAAkCM;IAClCL,4BAA4B,qCAAqCK;IACjE,OAAOP,+BAA+BO;AACxC,GAAG;AAEHJ,gBAAgBK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SwatchPickerRow/SwatchPickerRow.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type SwatchPickerRowSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * SwatchPickerRow Props\n */\nexport type SwatchPickerRowProps = ComponentProps<SwatchPickerRowSlots>;\n\n/**\n * State used in rendering SwatchPickerRow\n */\nexport type SwatchPickerRowState = ComponentState<SwatchPickerRowSlots> & Pick<SwatchPickerProps, 'spacing'>;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/SwatchPickerRow/SwatchPickerRow.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type SwatchPickerRowSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * SwatchPickerRow Props\n */\nexport type SwatchPickerRowProps = ComponentProps<SwatchPickerRowSlots>;\n\nexport type SwatchPickerRowBaseProps = ComponentProps<SwatchPickerRowSlots>;\n\n/**\n * State used in rendering SwatchPickerRow\n */\nexport type SwatchPickerRowState = ComponentState<SwatchPickerRowSlots> & Pick<SwatchPickerProps, 'spacing'>;\n\nexport type SwatchPickerRowBaseState = ComponentState<SwatchPickerRowSlots>;\n"],"names":[],"mappings":"AAmBA,WAA4E"}
|