Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ColorSwatch", {
enumerable: true,
get: function() {
return ColorSwatch;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useColorSwatch = require("./useColorSwatch");
const _renderColorSwatch = require("./renderColorSwatch");
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const ColorSwatch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useColorSwatch.useColorSwatch_unstable)(props, ref);
(0, _useColorSwatchStylesstyles.useColorSwatchStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useColorSwatchStyles_unstable')(state);
return (0, _renderColorSwatch.renderColorSwatch_unstable)(state);
});
ColorSwatch.displayName = 'ColorSwatch';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ColorSwatch/ColorSwatch.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useColorSwatch_unstable } from './useColorSwatch';\nimport { renderColorSwatch_unstable } from './renderColorSwatch';\nimport { useColorSwatchStyles_unstable } from './useColorSwatchStyles.styles';\nimport type { ColorSwatchProps } from './ColorSwatch.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * ColorSwatch component is used to render a colors, icons and gradients.\n */\nexport const ColorSwatch: ForwardRefComponent<ColorSwatchProps> = React.forwardRef((props, ref) => {\n const state = useColorSwatch_unstable(props, ref);\n\n useColorSwatchStyles_unstable(state);\n useCustomStyleHook_unstable('useColorSwatchStyles_unstable')(state);\n\n return renderColorSwatch_unstable(state);\n});\n\nColorSwatch.displayName = 'ColorSwatch';\n"],"names":["ColorSwatch","React","forwardRef","props","ref","state","useColorSwatch_unstable","useColorSwatchStyles_unstable","useCustomStyleHook_unstable","renderColorSwatch_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;gCAEiB;mCACG;4CACG;qCAEF;AAKrC,MAAMA,cAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBH,OAAOC;IAE7CG,IAAAA,yDAAAA,EAA8BF;IAC9BG,IAAAA,gDAAAA,EAA4B,iCAAiCH;IAE7D,OAAOI,IAAAA,6CAAAA,EAA2BJ;AACpC;AAEAL,YAAYU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering ColorSwatch
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ColorSwatch/ColorSwatch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type ColorSwatchSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n disabledIcon?: Slot<'span'>;\n};\n\n/**\n * ColorSwatch Props\n */\nexport type ColorSwatchProps = ComponentProps<ColorSwatchSlots> &\n Pick<SwatchPickerProps, 'size' | 'shape'> & {\n /**\n * Border color when contrast is low\n */\n borderColor?: string;\n\n /**\n * Swatch color\n */\n color: string;\n\n /**\n * Whether the swatch is disabled\n */\n disabled?: boolean;\n\n /**\n * Swatch value\n */\n value: string;\n };\n\n/**\n * State used in rendering ColorSwatch\n */\nexport type ColorSwatchState = ComponentState<ColorSwatchSlots> &\n Pick<ColorSwatchProps, 'color' | 'disabled' | 'size' | 'shape' | 'value'> & {\n selected: boolean;\n };\n"],"names":[],"rangeMappings":";;","mappings":"AAmCA;;CAEC"}
@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ColorSwatch: function() {
return _ColorSwatch.ColorSwatch;
},
colorSwatchClassNames: function() {
return _useColorSwatchStylesstyles.colorSwatchClassNames;
},
renderColorSwatch_unstable: function() {
return _renderColorSwatch.renderColorSwatch_unstable;
},
swatchCSSVars: function() {
return _useColorSwatchStylesstyles.swatchCSSVars;
},
useColorSwatchStyles_unstable: function() {
return _useColorSwatchStylesstyles.useColorSwatchStyles_unstable;
},
useColorSwatch_unstable: function() {
return _useColorSwatch.useColorSwatch_unstable;
}
});
const _ColorSwatch = require("./ColorSwatch");
const _renderColorSwatch = require("./renderColorSwatch");
const _useColorSwatch = require("./useColorSwatch");
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ColorSwatch/index.ts"],"sourcesContent":["export { ColorSwatch } from './ColorSwatch';\nexport type { ColorSwatchProps, ColorSwatchSlots, ColorSwatchState } from './ColorSwatch.types';\nexport { renderColorSwatch_unstable } from './renderColorSwatch';\nexport { useColorSwatch_unstable } from './useColorSwatch';\nexport { colorSwatchClassNames, swatchCSSVars, useColorSwatchStyles_unstable } from './useColorSwatchStyles.styles';\n"],"names":["ColorSwatch","colorSwatchClassNames","renderColorSwatch_unstable","swatchCSSVars","useColorSwatchStyles_unstable","useColorSwatch_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,WAAW;eAAXA,wBAAW;;IAIXC,qBAAqB;eAArBA,iDAAqB;;IAFrBC,0BAA0B;eAA1BA,6CAA0B;;IAEHC,aAAa;eAAbA,yCAAa;;IAAEC,6BAA6B;eAA7BA,yDAA6B;;IADnEC,uBAAuB;eAAvBA,uCAAuB;;;6BAHJ;mCAEe;gCACH;4CAC4C"}
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderColorSwatch_unstable", {
enumerable: true,
get: function() {
return renderColorSwatch_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderColorSwatch_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
children: [
state.root.children,
state.icon && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.icon, {}),
state.disabled && state.disabledIcon && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.disabledIcon, {})
]
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ColorSwatch/renderColorSwatch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ColorSwatchState, ColorSwatchSlots } from './ColorSwatch.types';\n\n/**\n * Render the final JSX of ColorSwatch\n */\nexport const renderColorSwatch_unstable = (state: ColorSwatchState) => {\n assertSlots<ColorSwatchSlots>(state);\n\n return (\n <state.root>\n {state.root.children}\n {state.icon && <state.icon />}\n {state.disabled && state.disabledIcon && <state.disabledIcon />}\n </state.root>\n );\n};\n"],"names":["renderColorSwatch_unstable","state","assertSlots","_jsxs","root","children","icon","_jsx","disabled","disabledIcon"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,6BAA6B,CAACC;IACzCC,IAAAA,2BAAAA,EAA8BD;IAE9B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAACF,MAAMG,IAAI,EAAA;;YACRH,MAAMG,IAAI,CAACC,QAAQ;YACnBJ,MAAMK,IAAI,IAAA,WAAA,GAAIC,IAAAA,eAAA,EAACN,MAAMK,IAAI,EAAA,CAAA;YACzBL,MAAMO,QAAQ,IAAIP,MAAMQ,YAAY,IAAA,WAAA,GAAIF,IAAAA,eAAA,EAACN,MAAMQ,YAAY,EAAA,CAAA;;;AAGlE"}
@@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useColorSwatch_unstable", {
enumerable: true,
get: function() {
return useColorSwatch_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _swatchPicker = require("../../contexts/swatchPicker");
const _useColorSwatchStylesstyles = require("./useColorSwatchStyles.styles");
const _reacticons = require("@fluentui/react-icons");
const _reacttheme = require("@fluentui/react-theme");
const useColorSwatch_unstable = (props, ref)=>{
const { borderColor, color, disabled, disabledIcon, icon, value, onClick, size, shape, style, ...rest } = props;
const _size = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.size);
const _shape = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.shape);
const isGrid = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.isGrid);
const requestSelectionChange = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.requestSelectionChange);
const selected = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.selectedValue === value);
const onColorSwatchClick = (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(onClick, (event)=>requestSelectionChange(event, {
selectedValue: value,
selectedSwatch: color
})));
const rootVariables = {
[_useColorSwatchStylesstyles.swatchCSSVars.color]: color,
[_useColorSwatchStylesstyles.swatchCSSVars.borderColor]: borderColor !== null && borderColor !== void 0 ? borderColor : _reacttheme.tokens.colorTransparentStroke
};
const role = isGrid ? 'gridcell' : 'radio';
const ariaSelected = isGrid ? {
'aria-selected': selected
} : {
'aria-checked': selected
};
const iconShorthand = _reactutilities.slot.optional(icon, {
elementType: 'span'
});
const disabledIconShorthand = _reactutilities.slot.optional(disabledIcon, {
defaultProps: {
children: /*#__PURE__*/ _react.createElement(_reacticons.ProhibitedFilled, null)
},
renderByDefault: true,
elementType: 'span'
});
return {
components: {
root: 'button',
icon: 'span',
disabledIcon: 'span'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('button', {
ref,
role,
...ariaSelected,
onClick: onColorSwatchClick,
type: 'button',
disabled,
...rest,
style: {
...rootVariables,
...style
}
}), {
elementType: 'button'
}),
icon: iconShorthand,
disabledIcon: disabledIconShorthand,
disabled,
size: size !== null && size !== void 0 ? size : _size,
shape: shape !== null && shape !== void 0 ? shape : _shape,
selected,
color,
value
};
};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,266 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
colorSwatchClassNames: function() {
return colorSwatchClassNames;
},
swatchCSSVars: function() {
return swatchCSSVars;
},
useColorSwatchStyles_unstable: function() {
return useColorSwatchStyles_unstable;
}
});
const _react = require("@griffel/react");
const colorSwatchClassNames = {
root: 'fui-ColorSwatch',
icon: 'fui-ColorSwatch__icon',
disabledIcon: 'fui-ColorSwatch__disabledIcon'
};
const swatchCSSVars = {
color: `--fui-SwatchPicker--color`,
borderColor: `--fui-SwatchPicker--borderColor`
};
const { color, borderColor } = swatchCSSVars;
/**
* Styles for the root slot
*/ const useResetStyles = /*#__PURE__*/ (0, _react.__resetStyles)("ryw27oi", null, {
r: [
".ryw27oi{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;box-sizing:border-box;border:1px solid var(--fui-SwatchPicker--borderColor);background:var(--fui-SwatchPicker--color);overflow:hidden;padding:0;}",
".ryw27oi:hover{cursor:pointer;border:none;box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorBrandStroke1),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}",
".ryw27oi:hover:active{border:none;box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorCompoundBrandStrokePressed),inset 0 0 0 var(--strokeWidthThickest) var(--colorStrokeFocus1);}",
".ryw27oi:focus{outline:none;}",
".ryw27oi:focus-visible{outline:none;}",
".ryw27oi[data-fui-focus-visible]{border:none;outline:none;box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorStrokeFocus2),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}"
],
s: [
"@media (forced-colors: active){.ryw27oi{forced-color-adjust:none;}.ryw27oi:hover{box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorBrandStroke2Hover),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}.ryw27oi:hover:active{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorBrandStroke2Pressed),inset 0 0 0 var(--strokeWidthThickest) var(--colorStrokeFocus1);}}"
]
});
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
disabled: {
eoavqd: "fphbwmw",
Bvxd0ez: "f1q3txrk",
Bs5ihcz: "f1hjbkfk"
},
selected: {
Bgfg5da: 0,
B9xav0g: 0,
oivjwe: 0,
Bn0qgzm: 0,
B4g9neb: 0,
zhjwy3: 0,
wvpqe5: 0,
ibv6hh: 0,
u1mtju: 0,
h3c5rm: 0,
vrafjx: 0,
Bekrc4i: 0,
i8vvqc: 0,
g2u3we: 0,
icvyot: 0,
B4j52fo: 0,
irswps: "f3bhgqh",
E5pizo: "f8ps3yo",
Bvxd0ez: "f106r15f",
vajtyg: "ft0nc49",
j6ew2k: "f16jq8vy",
Bspt33j: "f18nq7tj"
}
}, {
h: [
".fphbwmw:hover{cursor:not-allowed;}",
".f1q3txrk:hover{box-shadow:none;}",
".f106r15f:hover{box-shadow:inset 0 0 0 var(--strokeWidthThickest) var(--colorCompoundBrandStrokeHover),inset 0 0 0 6px var(--colorStrokeFocus1);}",
".ft0nc49:hover:active{box-shadow:inset 0 0 0 var(--strokeWidthThickest) var(--colorCompoundBrandStrokePressed),inset 0 0 0 7px var(--colorStrokeFocus1);}"
],
m: [
[
"@media (forced-colors: active){.f1hjbkfk:hover{box-shadow:none;}}",
{
m: "(forced-colors: active)"
}
],
[
"@media (forced-colors: active){.f18nq7tj{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorBrandStroke2Pressed),inset 0 0 0 5px var(--colorStrokeFocus1);}}",
{
m: "(forced-colors: active)"
}
]
],
d: [
[
".f3bhgqh{border:none;}",
{
p: -2
}
],
".f8ps3yo{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorBrandStroke1),inset 0 0 0 5px var(--colorStrokeFocus1);}",
".f16jq8vy[data-fui-focus-visible]{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus2),inset 0 0 0 5px var(--colorStrokeFocus1);}"
]
});
const useSizeStyles = /*#__PURE__*/ (0, _react.__styles)({
"extra-small": {
a9b677: "f64fuq3",
Bqenvij: "fjamq6b"
},
small: {
a9b677: "fq4mcun",
Bqenvij: "frvgh55"
},
medium: {
a9b677: "f1w9dchk",
Bqenvij: "fxldao9"
},
large: {
a9b677: "f1szoe96",
Bqenvij: "f1d2rq10"
}
}, {
d: [
".f64fuq3{width:20px;}",
".fjamq6b{height:20px;}",
".fq4mcun{width:24px;}",
".frvgh55{height:24px;}",
".f1w9dchk{width:28px;}",
".fxldao9{height:28px;}",
".f1szoe96{width:32px;}",
".f1d2rq10{height:32px;}"
]
});
const useShapeStyles = /*#__PURE__*/ (0, _react.__styles)({
rounded: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "ft85np5",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "f2krc9w"
},
circular: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f44lkw9",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "f1062rbf"
},
square: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f1fabniw",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "fj0ryk1"
}
}, {
d: [
[
".ft85np5{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
[
".f2krc9w[data-fui-focus-visible]{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
[
".f44lkw9{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
[
".f1062rbf[data-fui-focus-visible]{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
[
".f1fabniw{border-radius:var(--borderRadiusNone);}",
{
p: -1
}
],
[
".fj0ryk1[data-fui-focus-visible]{border-radius:var(--borderRadiusNone);}",
{
p: -1
}
]
]
});
const useIconStyles = /*#__PURE__*/ (0, _react.__styles)({
disabledIcon: {
sj55zd: "fqpbvvt",
Bhu2qc9: "f14y0k3d"
},
icon: {
qhf8xq: "f1euv43f",
mc9l5x: "f22iagw",
qb2dma: "f7nlbp4"
},
"extra-small": {
Be2twd7: "f4ybsrx"
},
small: {
Be2twd7: "f4ybsrx"
},
medium: {
Be2twd7: "fe5j1ua"
},
large: {
Be2twd7: "f1rt2boy"
}
}, {
d: [
".fqpbvvt{color:var(--colorNeutralForegroundInverted);}",
".f14y0k3d{filter:drop-shadow(0 1px 1px rgb(0 0 0 / 1));}",
".f1euv43f{position:absolute;}",
".f22iagw{display:flex;}",
".f7nlbp4{align-self:center;}",
".f4ybsrx{font-size:16px;}",
".fe5j1ua{font-size:20px;}",
".f1rt2boy{font-size:24px;}"
]
});
const useColorSwatchStyles_unstable = (state)=>{
'use no memo';
const resetStyles = useResetStyles();
const styles = useStyles();
const sizeStyles = useSizeStyles();
const shapeStyles = useShapeStyles();
const iconStyles = useIconStyles();
const { size = 'medium', shape = 'square' } = state;
state.root.className = (0, _react.mergeClasses)(colorSwatchClassNames.root, resetStyles, sizeStyles[size], shapeStyles[shape], state.selected && styles.selected, state.disabled && styles.disabled, state.root.className);
if (state.disabled && state.disabledIcon) {
state.disabledIcon.className = (0, _react.mergeClasses)(iconStyles.icon, iconStyles[size], iconStyles.disabledIcon, state.disabledIcon.className);
}
if (state.icon) {
state.icon.className = (0, _react.mergeClasses)(iconStyles.icon, iconStyles[size], state.icon.className);
}
return state;
};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "EmptySwatch", {
enumerable: true,
get: function() {
return EmptySwatch;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useEmptySwatch = require("./useEmptySwatch");
const _renderEmptySwatch = require("./renderEmptySwatch");
const _useEmptySwatchStylesstyles = require("./useEmptySwatchStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const EmptySwatch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useEmptySwatch.useEmptySwatch_unstable)(props, ref);
(0, _useEmptySwatchStylesstyles.useEmptySwatchStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useEmptySwatchStyles_unstable')(state);
return (0, _renderEmptySwatch.renderEmptySwatch_unstable)(state);
});
EmptySwatch.displayName = 'EmptySwatch';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/EmptySwatch/EmptySwatch.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useEmptySwatch_unstable } from './useEmptySwatch';\nimport { renderEmptySwatch_unstable } from './renderEmptySwatch';\nimport { useEmptySwatchStyles_unstable } from './useEmptySwatchStyles.styles';\nimport type { EmptySwatchProps } from './EmptySwatch.types';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * EmptySwatch component is used for adding new color swatches.\n */\nexport const EmptySwatch: ForwardRefComponent<EmptySwatchProps> = React.forwardRef((props, ref) => {\n const state = useEmptySwatch_unstable(props, ref);\n\n useEmptySwatchStyles_unstable(state);\n useCustomStyleHook_unstable('useEmptySwatchStyles_unstable')(state);\n return renderEmptySwatch_unstable(state);\n});\n\nEmptySwatch.displayName = 'EmptySwatch';\n"],"names":["EmptySwatch","React","forwardRef","props","ref","state","useEmptySwatch_unstable","useEmptySwatchStyles_unstable","useCustomStyleHook_unstable","renderEmptySwatch_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;gCAEiB;mCACG;4CACG;qCAEF;AAKrC,MAAMA,cAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBH,OAAOC;IAE7CG,IAAAA,yDAAAA,EAA8BF;IAC9BG,IAAAA,gDAAAA,EAA4B,iCAAiCH;IAC7D,OAAOI,IAAAA,6CAAAA,EAA2BJ;AACpC;AAEAL,YAAYU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering EmptySwatch
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/EmptySwatch/EmptySwatch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { SwatchPickerProps } from '../SwatchPicker/SwatchPicker.types';\n\nexport type EmptySwatchSlots = {\n root: Slot<'button'>;\n};\n\n/**\n * EmptySwatch Props\n */\nexport type EmptySwatchProps = ComponentProps<EmptySwatchSlots> & Pick<SwatchPickerProps, 'size' | 'shape'>;\n\n/**\n * State used in rendering EmptySwatch\n */\nexport type EmptySwatchState = ComponentState<EmptySwatchSlots> & Pick<EmptySwatchProps, 'size' | 'shape'>;\n"],"names":[],"rangeMappings":";;","mappings":"AAYA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
EmptySwatch: function() {
return _EmptySwatch.EmptySwatch;
},
emptySwatchClassNames: function() {
return _useEmptySwatchStylesstyles.emptySwatchClassNames;
},
renderEmptySwatch_unstable: function() {
return _renderEmptySwatch.renderEmptySwatch_unstable;
},
useEmptySwatchStyles_unstable: function() {
return _useEmptySwatchStylesstyles.useEmptySwatchStyles_unstable;
},
useEmptySwatch_unstable: function() {
return _useEmptySwatch.useEmptySwatch_unstable;
}
});
const _EmptySwatch = require("./EmptySwatch");
const _renderEmptySwatch = require("./renderEmptySwatch");
const _useEmptySwatch = require("./useEmptySwatch");
const _useEmptySwatchStylesstyles = require("./useEmptySwatchStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/EmptySwatch/index.ts"],"sourcesContent":["export { EmptySwatch } from './EmptySwatch';\nexport type { EmptySwatchProps, EmptySwatchSlots, EmptySwatchState } from './EmptySwatch.types';\nexport { renderEmptySwatch_unstable } from './renderEmptySwatch';\nexport { useEmptySwatch_unstable } from './useEmptySwatch';\nexport { emptySwatchClassNames, useEmptySwatchStyles_unstable } from './useEmptySwatchStyles.styles';\n"],"names":["EmptySwatch","emptySwatchClassNames","renderEmptySwatch_unstable","useEmptySwatchStyles_unstable","useEmptySwatch_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,WAAW;eAAXA,wBAAW;;IAIXC,qBAAqB;eAArBA,iDAAqB;;IAFrBC,0BAA0B;eAA1BA,6CAA0B;;IAEHC,6BAA6B;eAA7BA,yDAA6B;;IADpDC,uBAAuB;eAAvBA,uCAAuB;;;6BAHJ;mCAEe;gCACH;4CAC6B"}
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderEmptySwatch_unstable", {
enumerable: true,
get: function() {
return renderEmptySwatch_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderEmptySwatch_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/EmptySwatch/renderEmptySwatch.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { EmptySwatchState, EmptySwatchSlots } from './EmptySwatch.types';\n\n/**\n * Render the final JSX of EmptySwatch\n */\nexport const renderEmptySwatch_unstable = (state: EmptySwatchState) => {\n assertSlots<EmptySwatchSlots>(state);\n\n return <state.root />;\n};\n"],"names":["renderEmptySwatch_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,6BAA6B,CAACC;IACzCC,IAAAA,2BAAAA,EAA8BD;IAE9B,OAAA,WAAA,GAAOE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA,CAAA;AACpB"}
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useEmptySwatch_unstable", {
enumerable: true,
get: function() {
return useEmptySwatch_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _swatchPicker = require("../../contexts/swatchPicker");
const useEmptySwatch_unstable = (props, ref)=>{
const { size, shape, ...rest } = props;
const _size = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.size);
const _shape = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.shape);
const isGrid = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.isGrid);
const role = isGrid ? 'gridcell' : 'radio';
const a11yProps = isGrid ? {} : {
'aria-checked': false
};
return {
components: {
root: 'button'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('button', {
ref,
role,
...a11yProps,
...rest
}), {
elementType: 'button'
}),
size: size !== null && size !== void 0 ? size : _size,
shape: shape !== null && shape !== void 0 ? shape : _shape
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/EmptySwatch/useEmptySwatch.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { EmptySwatchProps, EmptySwatchState } from './EmptySwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\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 { size, shape, ...rest } = props;\n const _size = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const _shape = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\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 ...rest,\n }),\n { elementType: 'button' },\n ),\n size: size ?? _size,\n shape: shape ?? _shape,\n };\n};\n"],"names":["useEmptySwatch_unstable","props","ref","size","shape","rest","_size","useSwatchPickerContextValue_unstable","ctx","_shape","isGrid","role","a11yProps","components","root","slot","always","getIntrinsicElementProps","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;;iEAdU;gCACwB;8BAEM;AAW9C,MAAMA,0BAA0B,CACrCC,OACAC;IAEA,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGJ;IACjC,MAAMK,QAAQC,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIL,IAAI;IAClE,MAAMM,SAASF,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIJ,KAAK;IACpE,MAAMM,SAASH,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIE,MAAM;IAErE,MAAMC,OAAOD,SAAS,aAAa;IACnC,MAAME,YAAYF,SAAS,CAAC,IAAI;QAAE,gBAAgB;IAAM;IACxD,OAAO;QACLG,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,UAAU;YACjCf;YACAS;YACA,GAAGC,SAAS;YACZ,GAAGP,IAAI;QACT,IACA;YAAEa,aAAa;QAAS;QAE1Bf,MAAMA,SAAAA,QAAAA,SAAAA,KAAAA,IAAAA,OAAQG;QACdF,OAAOA,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,QAASK;IAClB;AACF"}
@@ -0,0 +1,144 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
emptySwatchClassNames: function() {
return emptySwatchClassNames;
},
useEmptySwatchStyles_unstable: function() {
return useEmptySwatchStyles_unstable;
}
});
const _react = require("@griffel/react");
const emptySwatchClassNames = {
root: 'fui-EmptySwatch'
};
/**
* Styles for the root slot
*/ const useStyles = /*#__PURE__*/ (0, _react.__resetStyles)("r1top892", null, [
".r1top892{background-color:var(--colorTransparentBackground);border:1px dashed var(--colorNeutralForeground4);}"
]);
const useSizeStyles = /*#__PURE__*/ (0, _react.__styles)({
"extra-small": {
a9b677: "f64fuq3",
Bqenvij: "fjamq6b"
},
small: {
a9b677: "fq4mcun",
Bqenvij: "frvgh55"
},
medium: {
a9b677: "f1w9dchk",
Bqenvij: "fxldao9"
},
large: {
a9b677: "f1szoe96",
Bqenvij: "f1d2rq10"
}
}, {
d: [
".f64fuq3{width:20px;}",
".fjamq6b{height:20px;}",
".fq4mcun{width:24px;}",
".frvgh55{height:24px;}",
".f1w9dchk{width:28px;}",
".fxldao9{height:28px;}",
".f1szoe96{width:32px;}",
".f1d2rq10{height:32px;}"
]
});
const useShapeStyles = /*#__PURE__*/ (0, _react.__styles)({
rounded: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "ft85np5",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "f2krc9w"
},
circular: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f44lkw9",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "f1062rbf"
},
square: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f1fabniw",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "fj0ryk1"
}
}, {
d: [
[
".ft85np5{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
[
".f2krc9w[data-fui-focus-visible]{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
[
".f44lkw9{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
[
".f1062rbf[data-fui-focus-visible]{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
[
".f1fabniw{border-radius:var(--borderRadiusNone);}",
{
p: -1
}
],
[
".fj0ryk1[data-fui-focus-visible]{border-radius:var(--borderRadiusNone);}",
{
p: -1
}
]
]
});
const useEmptySwatchStyles_unstable = (state)=>{
'use no memo';
const styles = useStyles();
const sizeStyles = useSizeStyles();
const shapeStyles = useShapeStyles();
var _state_size;
const size = (_state_size = state.size) !== null && _state_size !== void 0 ? _state_size : 'medium';
var _state_shape;
state.root.className = (0, _react.mergeClasses)(emptySwatchClassNames.root, styles, sizeStyles[size], shapeStyles[(_state_shape = state.shape) !== null && _state_shape !== void 0 ? _state_shape : 'square'], state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useEmptySwatchStyles.styles.js"],"sourcesContent":["import { 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 'use no memo';\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 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"],"names":["emptySwatchClassNames","useEmptySwatchStyles_unstable","root","useStyles","__resetStyles","useSizeStyles","__styles","a9b677","Bqenvij","small","medium","large","d","useShapeStyles","rounded","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bw81rd7","kdpuga","dm238s","B6xbmo0","B3whbx2","circular","square","p","state","styles","sizeStyles","shapeStyles","_state_size","size","_state_shape","className","mergeClasses","shape"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAGaA,qBAAqB;eAArBA;;IAiDIC,6BAA6B;eAA7BA;;;uBApDyC;AAGnD,MAAMD,wBAAwB;IACjCE,MAAM;AACV;AACA;;CAEA,GAAI,MAAMC,YAAS,WAAA,GAAGC,IAAAA,oBAAA,EAAA,YAAA,MAAA;IAAA;CAGrB;AACD,MAAMC,gBAAa,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAA,eAAA;QAAAC,QAAA;QAAAC,SAAA;IAAA;IAAAC,OAAA;QAAAF,QAAA;QAAAC,SAAA;IAAA;IAAAE,QAAA;QAAAH,QAAA;QAAAC,SAAA;IAAA;IAAAG,OAAA;QAAAJ,QAAA;QAAAC,SAAA;IAAA;AAAA,GAAA;IAAAI,GAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA;AAkBtB,MAAMC,iBAAc,WAAA,GAAGP,IAAAA,eAAA,EAAA;IAAAQ,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;IAAA;IAAAC,UAAA;QAAAV,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;IAAA;IAAAE,QAAA;QAAAX,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;IAAA;AAAA,GAAA;IAAAZ,GAAA;QAAA;YAAA;YAAA;gBAAAe,GAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,GAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,GAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,GAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,GAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,GAAA,CAAA;YAAA;SAAA;KAAA;AAAA;AAsBZ,MAAM1B,gCAAiC2B,CAAAA;IAC9C;IACA,MAAMC,SAAS1B;IACf,MAAM2B,aAAazB;IACnB,MAAM0B,cAAclB;IACpB,IAAImB;IACJ,MAAMC,OAAO,AAACD,CAAAA,cAAcJ,MAAMK,IAAI,AAAJA,MAAU,QAAQD,gBAAgB,KAAK,IAAIA,cAAc;IAC3F,IAAIE;IACJN,MAAM1B,IAAI,CAACiC,SAAS,GAAGC,IAAAA,mBAAY,EAACpC,sBAAsBE,IAAI,EAAE2B,QAAQC,UAAU,CAACG,KAAK,EAAEF,WAAW,CAAC,AAACG,CAAAA,eAAeN,MAAMS,KAAK,AAALA,MAAW,QAAQH,iBAAiB,KAAK,IAAIA,eAAe,SAAS,EAAEN,MAAM1B,IAAI,CAACiC,SAAS;IACvN,OAAOP;AACX"}
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ImageSwatch", {
enumerable: true,
get: function() {
return ImageSwatch;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useImageSwatch = require("./useImageSwatch");
const _renderImageSwatch = require("./renderImageSwatch");
const _useImageSwatchStylesstyles = require("./useImageSwatchStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const ImageSwatch = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useImageSwatch.useImageSwatch_unstable)(props, ref);
(0, _useImageSwatchStylesstyles.useImageSwatchStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useImageSwatchStyles_unstable')(state);
return (0, _renderImageSwatch.renderImageSwatch_unstable)(state);
});
ImageSwatch.displayName = 'ImageSwatch';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ImageSwatch/ImageSwatch.tsx"],"sourcesContent":["import * 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":["ImageSwatch","React","forwardRef","props","ref","state","useImageSwatch_unstable","useImageSwatchStyles_unstable","useCustomStyleHook_unstable","renderImageSwatch_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;gCAEiB;mCACG;4CACG;qCAEF;AAKrC,MAAMA,cAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQC,IAAAA,uCAAAA,EAAwBH,OAAOC;IAE7CG,IAAAA,yDAAAA,EAA8BF;IAC9BG,IAAAA,gDAAAA,EAA4B,iCAAiCH;IAE7D,OAAOI,IAAAA,6CAAAA,EAA2BJ;AACpC;AAEAL,YAAYU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering ImageSwatch
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ImageSwatch/ImageSwatch.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { 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":[],"rangeMappings":";;","mappings":"AAuBA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ImageSwatch: function() {
return _ImageSwatch.ImageSwatch;
},
imageSwatchClassNames: function() {
return _useImageSwatchStylesstyles.imageSwatchClassNames;
},
renderImageSwatch_unstable: function() {
return _renderImageSwatch.renderImageSwatch_unstable;
},
useImageSwatchStyles_unstable: function() {
return _useImageSwatchStylesstyles.useImageSwatchStyles_unstable;
},
useImageSwatch_unstable: function() {
return _useImageSwatch.useImageSwatch_unstable;
}
});
const _ImageSwatch = require("./ImageSwatch");
const _renderImageSwatch = require("./renderImageSwatch");
const _useImageSwatch = require("./useImageSwatch");
const _useImageSwatchStylesstyles = require("./useImageSwatchStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ImageSwatch/index.ts"],"sourcesContent":["export { ImageSwatch } from './ImageSwatch';\nexport type { ImageSwatchProps, ImageSwatchSlots, ImageSwatchState } from './ImageSwatch.types';\nexport { renderImageSwatch_unstable } from './renderImageSwatch';\nexport { useImageSwatch_unstable } from './useImageSwatch';\nexport { imageSwatchClassNames, useImageSwatchStyles_unstable } from './useImageSwatchStyles.styles';\n"],"names":["ImageSwatch","imageSwatchClassNames","renderImageSwatch_unstable","useImageSwatchStyles_unstable","useImageSwatch_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,WAAW;eAAXA,wBAAW;;IAIXC,qBAAqB;eAArBA,iDAAqB;;IAFrBC,0BAA0B;eAA1BA,6CAA0B;;IAEHC,6BAA6B;eAA7BA,yDAA6B;;IADpDC,uBAAuB;eAAvBA,uCAAuB;;;6BAHJ;mCAEe;gCACH;4CAC6B"}
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderImageSwatch_unstable", {
enumerable: true,
get: function() {
return renderImageSwatch_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderImageSwatch_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {});
};
@@ -0,0 +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 { ImageSwatchState, ImageSwatchSlots } from './ImageSwatch.types';\n\n/**\n * Render the final JSX of ImageSwatch\n */\nexport const renderImageSwatch_unstable = (state: ImageSwatchState) => {\n assertSlots<ImageSwatchSlots>(state);\n\n return <state.root />;\n};\n"],"names":["renderImageSwatch_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,6BAA6B,CAACC;IACzCC,IAAAA,2BAAAA,EAA8BD;IAE9B,OAAA,WAAA,GAAOE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA,CAAA;AACpB"}
@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useImageSwatch_unstable", {
enumerable: true,
get: function() {
return useImageSwatch_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _swatchPicker = require("../../contexts/swatchPicker");
const useImageSwatch_unstable = (props, ref)=>{
const { src, value, onClick, style, ...rest } = props;
const size = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.size);
const shape = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.shape);
const isGrid = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.isGrid);
const requestSelectionChange = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.requestSelectionChange);
const selected = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.selectedValue === value);
const role = isGrid ? 'gridcell' : 'radio';
const ariaSelected = isGrid ? {
'aria-selected': selected
} : {
'aria-checked': selected
};
const onImageSwatchClick = (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(onClick, (event)=>requestSelectionChange(event, {
selectedValue: value,
selectedSwatch: src
})));
return {
components: {
root: 'button'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('button', {
ref,
role,
...ariaSelected,
onClick: onImageSwatchClick,
...rest,
style: {
backgroundImage: `url(${src})`,
...style
}
}), {
elementType: 'button'
}),
value,
selected,
size,
shape
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ImageSwatch/useImageSwatch.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useEventCallback, mergeCallbacks } from '@fluentui/react-utilities';\nimport type { ImageSwatchProps, ImageSwatchState } from './ImageSwatch.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\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 { src, value, onClick, style, ...rest } = props;\n const size = useSwatchPickerContextValue_unstable(ctx => ctx.size);\n const shape = useSwatchPickerContextValue_unstable(ctx => ctx.shape);\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 size,\n shape,\n };\n};\n"],"names":["useImageSwatch_unstable","props","ref","src","value","onClick","style","rest","size","useSwatchPickerContextValue_unstable","ctx","shape","isGrid","requestSelectionChange","selected","selectedValue","role","ariaSelected","onImageSwatchClick","useEventCallback","mergeCallbacks","event","selectedSwatch","components","root","slot","always","getIntrinsicElementProps","backgroundImage","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;;iEAdU;gCAC0D;8BAE5B;AAW9C,MAAMA,0BAA0B,CACrCC,OACAC;IAEA,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGN;IAChD,MAAMO,OAAOC,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIF,IAAI;IACjE,MAAMG,QAAQF,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIC,KAAK;IACnE,MAAMC,SAASH,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIE,MAAM;IAErE,MAAMC,yBAAyBJ,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIG,sBAAsB;IACrG,MAAMC,WAAWL,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIK,aAAa,KAAKX;IAEnF,MAAMY,OAAOJ,SAAS,aAAa;IACnC,MAAMK,eAAeL,SACjB;QACE,iBAAiBE;IACnB,IACA;QAAE,gBAAgBA;IAAS;IAE/B,MAAMI,qBAAqBC,IAAAA,gCAAAA,EACzBC,IAAAA,8BAAAA,EAAef,SAAS,CAACgB,QACvBR,uBAAuBQ,OAAO;YAC5BN,eAAeX;YACfkB,gBAAgBnB;QAClB;IAIJ,OAAO;QACLoB,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,UAAU;YACjCzB;YACAc;YACA,GAAGC,YAAY;YACfZ,SAASa;YACT,GAAGX,IAAI;YACPD,OAAO;gBACLsB,iBAAiB,CAAC,IAAI,EAAEzB,IAAI,CAAC,CAAC;gBAC9B,GAAGG,KAAK;YACV;QACF,IACA;YAAEuB,aAAa;QAAS;QAE1BzB;QACAU;QACAN;QACAG;IACF;AACF"}
@@ -0,0 +1,202 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
imageSwatchClassNames: function() {
return imageSwatchClassNames;
},
useImageSwatchStyles_unstable: function() {
return useImageSwatchStyles_unstable;
}
});
const _react = require("@griffel/react");
const imageSwatchClassNames = {
root: 'fui-ImageSwatch'
};
/**
* Styles for the root slot
*/ const useStyles = /*#__PURE__*/ (0, _react.__resetStyles)("r18b5q7m", null, {
r: [
".r18b5q7m{display:inline-flex;box-sizing:border-box;border:1px solid var(--colorTransparentStroke);background-size:cover;background-repeat:no-repeat;padding:0;}",
".r18b5q7m:hover{cursor:pointer;border:none;box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorBrandStroke1),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}",
".r18b5q7m:hover:active{border:none;box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorCompoundBrandStrokePressed),inset 0 0 0 var(--strokeWidthThickest) var(--colorStrokeFocus1);}",
".r18b5q7m:focus{outline:none;}",
".r18b5q7m:focus-visible{outline:none;}",
".r18b5q7m[data-fui-focus-visible]{border:none;outline:none;box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorStrokeFocus2),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}"
],
s: [
"@media (forced-colors: active){.r18b5q7m{forced-color-adjust:none;}.r18b5q7m:hover{box-shadow:inset 0 0 0 var(--strokeWidthThick) var(--colorBrandStroke2Hover),inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus1);}.r18b5q7m:hover:active{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorBrandStroke2Pressed),inset 0 0 0 var(--strokeWidthThickest) var(--colorStrokeFocus1);}}"
]
});
const useStylesSelected = /*#__PURE__*/ (0, _react.__styles)({
selected: {
Bgfg5da: 0,
B9xav0g: 0,
oivjwe: 0,
Bn0qgzm: 0,
B4g9neb: 0,
zhjwy3: 0,
wvpqe5: 0,
ibv6hh: 0,
u1mtju: 0,
h3c5rm: 0,
vrafjx: 0,
Bekrc4i: 0,
i8vvqc: 0,
g2u3we: 0,
icvyot: 0,
B4j52fo: 0,
irswps: "f3bhgqh",
E5pizo: "f8ps3yo",
Bvxd0ez: "f106r15f",
vajtyg: "ft0nc49",
j6ew2k: "f16jq8vy",
Bspt33j: "f18nq7tj"
}
}, {
d: [
[
".f3bhgqh{border:none;}",
{
p: -2
}
],
".f8ps3yo{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorBrandStroke1),inset 0 0 0 5px var(--colorStrokeFocus1);}",
".f16jq8vy[data-fui-focus-visible]{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorStrokeFocus2),inset 0 0 0 5px var(--colorStrokeFocus1);}"
],
h: [
".f106r15f:hover{box-shadow:inset 0 0 0 var(--strokeWidthThickest) var(--colorCompoundBrandStrokeHover),inset 0 0 0 6px var(--colorStrokeFocus1);}",
".ft0nc49:hover:active{box-shadow:inset 0 0 0 var(--strokeWidthThickest) var(--colorCompoundBrandStrokePressed),inset 0 0 0 7px var(--colorStrokeFocus1);}"
],
m: [
[
"@media (forced-colors: active){.f18nq7tj{box-shadow:inset 0 0 0 var(--strokeWidthThicker) var(--colorBrandStroke2Pressed),inset 0 0 0 5px var(--colorStrokeFocus1);}}",
{
m: "(forced-colors: active)"
}
]
]
});
const useSizeStyles = /*#__PURE__*/ (0, _react.__styles)({
"extra-small": {
a9b677: "f64fuq3",
Bqenvij: "fjamq6b"
},
small: {
a9b677: "fq4mcun",
Bqenvij: "frvgh55"
},
medium: {
a9b677: "f1w9dchk",
Bqenvij: "fxldao9"
},
large: {
a9b677: "f1szoe96",
Bqenvij: "f1d2rq10"
}
}, {
d: [
".f64fuq3{width:20px;}",
".fjamq6b{height:20px;}",
".fq4mcun{width:24px;}",
".frvgh55{height:24px;}",
".f1w9dchk{width:28px;}",
".fxldao9{height:28px;}",
".f1szoe96{width:32px;}",
".f1d2rq10{height:32px;}"
]
});
const useShapeStyles = /*#__PURE__*/ (0, _react.__styles)({
rounded: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "ft85np5",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "f2krc9w"
},
circular: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f44lkw9",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "f1062rbf"
},
square: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f1fabniw",
Bw81rd7: 0,
kdpuga: 0,
dm238s: 0,
B6xbmo0: 0,
B3whbx2: "fj0ryk1"
}
}, {
d: [
[
".ft85np5{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
[
".f2krc9w[data-fui-focus-visible]{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
[
".f44lkw9{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
[
".f1062rbf[data-fui-focus-visible]{border-radius:var(--borderRadiusCircular);}",
{
p: -1
}
],
[
".f1fabniw{border-radius:var(--borderRadiusNone);}",
{
p: -1
}
],
[
".fj0ryk1[data-fui-focus-visible]{border-radius:var(--borderRadiusNone);}",
{
p: -1
}
]
]
});
const useImageSwatchStyles_unstable = (state)=>{
'use no memo';
const styles = useStyles();
const selectedStyles = useStylesSelected();
const sizeStyles = useSizeStyles();
const shapeStyles = useShapeStyles();
const { size = 'medium', shape = 'square' } = state;
state.root.className = (0, _react.mergeClasses)(imageSwatchClassNames.root, styles, sizeStyles[size], shapeStyles[shape], state.selected && selectedStyles.selected, state.root.className);
return state;
};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "SwatchPicker", {
enumerable: true,
get: function() {
return SwatchPicker;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useSwatchPicker = require("./useSwatchPicker");
const _renderSwatchPicker = require("./renderSwatchPicker");
const _useSwatchPickerStylesstyles = require("./useSwatchPickerStyles.styles");
const _swatchPicker = require("../../contexts/swatchPicker");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const SwatchPicker = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useSwatchPicker.useSwatchPicker_unstable)(props, ref);
const contextValues = (0, _swatchPicker.useSwatchPickerContextValues)(state);
(0, _useSwatchPickerStylesstyles.useSwatchPickerStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useSwatchPickerStyles_unstable')(state);
return (0, _renderSwatchPicker.renderSwatchPicker_unstable)(state, contextValues);
});
SwatchPicker.displayName = 'SwatchPicker';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/SwatchPicker/SwatchPicker.tsx"],"sourcesContent":["import * 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 '../../contexts/swatchPicker';\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":["SwatchPicker","React","forwardRef","props","ref","state","useSwatchPicker_unstable","contextValues","useSwatchPickerContextValues","useSwatchPickerStyles_unstable","useCustomStyleHook_unstable","renderSwatchPicker_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAYaA;;;eAAAA;;;;iEAZU;iCAEkB;oCACG;6CACG;8BAEF;qCACD;AAKrC,MAAMA,eAAAA,WAAAA,GAAuDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC3F,MAAMC,QAAQC,IAAAA,yCAAAA,EAAyBH,OAAOC;IAC9C,MAAMG,gBAAgBC,IAAAA,0CAAAA,EAA6BH;IAEnDI,IAAAA,2DAAAA,EAA+BJ;IAC/BK,IAAAA,gDAAAA,EAA4B,kCAAkCL;IAE9D,OAAOM,IAAAA,+CAAAA,EAA4BN,OAAOE;AAC5C;AAEAP,aAAaY,WAAW,GAAG"}
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/SwatchPicker/SwatchPicker.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot, EventHandler, EventData } from '@fluentui/react-utilities';\nimport { 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 * 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":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
SwatchPicker: function() {
return _SwatchPicker.SwatchPicker;
},
renderSwatchPicker_unstable: function() {
return _renderSwatchPicker.renderSwatchPicker_unstable;
},
swatchPickerClassNames: function() {
return _useSwatchPickerStylesstyles.swatchPickerClassNames;
},
useSwatchPickerStyles_unstable: function() {
return _useSwatchPickerStylesstyles.useSwatchPickerStyles_unstable;
},
useSwatchPicker_unstable: function() {
return _useSwatchPicker.useSwatchPicker_unstable;
}
});
const _SwatchPicker = require("./SwatchPicker");
const _renderSwatchPicker = require("./renderSwatchPicker");
const _useSwatchPicker = require("./useSwatchPicker");
const _useSwatchPickerStylesstyles = require("./useSwatchPickerStyles.styles");
@@ -0,0 +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","swatchPickerClassNames","useSwatchPickerStyles_unstable","useSwatchPicker_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,YAAY;eAAZA,0BAAY;;IAQZC,2BAA2B;eAA3BA,+CAA2B;;IAE3BC,sBAAsB;eAAtBA,mDAAsB;;IAAEC,8BAA8B;eAA9BA,2DAA8B;;IADtDC,wBAAwB;eAAxBA,yCAAwB;;;8BATJ;oCAQe;iCACH;6CAC8B"}
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderSwatchPicker_unstable", {
enumerable: true,
get: function() {
return renderSwatchPicker_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const _swatchPicker = require("../../contexts/swatchPicker");
const renderSwatchPicker_unstable = (state, contextValues)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_swatchPicker.SwatchPickerProvider, {
value: contextValues.swatchPicker,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {
children: state.root.children
})
});
};
@@ -0,0 +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 { SwatchPickerProvider } from '../../contexts/swatchPicker';\nimport type { SwatchPickerContextValues } from '../../contexts/swatchPicker';\nimport type { SwatchPickerState, SwatchPickerSlots } from './SwatchPicker.types';\n\n/**\n * Render the final JSX of SwatchPicker\n */\nexport const renderSwatchPicker_unstable = (state: SwatchPickerState, contextValues: SwatchPickerContextValues) => {\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":["renderSwatchPicker_unstable","state","contextValues","assertSlots","_jsx","SwatchPickerProvider","value","swatchPicker","root","children"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;4BAVb;gCAE4B;8BACS;AAO9B,MAAMA,8BAA8B,CAACC,OAA0BC;IACpEC,IAAAA,2BAAAA,EAA+BF;IAE/B,OAAA,WAAA,GACEG,IAAAA,eAAA,EAACC,kCAAAA,EAAAA;QAAqBC,OAAOJ,cAAcK,YAAY;kBACrD,WAAA,GAAAH,IAAAA,eAAA,EAACH,MAAMO,IAAI,EAAA;sBAAEP,MAAMO,IAAI,CAACC,QAAQ;;;AAGtC"}
@@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useSwatchPicker_unstable", {
enumerable: true,
get: function() {
return useSwatchPicker_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactfield = require("@fluentui/react-field");
const _reacttabster = require("@fluentui/react-tabster");
const _reactutilities = require("@fluentui/react-utilities");
const useSwatchPicker_unstable = (props, ref)=>{
// Merge props from surrounding <Field>, if any
props = (0, _reactfield.useFieldControlProps_unstable)(props);
const { layout, onSelectionChange, size = 'medium', shape, spacing = 'medium', style, ...rest } = props;
const isGrid = layout === 'grid';
const focusAttributes = (0, _reacttabster.useArrowNavigationGroup)({
circular: true,
axis: isGrid ? 'grid-linear' : 'both',
memorizeCurrent: true
});
const role = isGrid ? 'grid' : 'radiogroup';
const [selectedValue, setSelectedValue] = (0, _reactutilities.useControllableState)({
state: props.selectedValue,
defaultState: props.defaultSelectedValue,
initialState: ''
});
const requestSelectionChange = (0, _reactutilities.useEventCallback)((event, data)=>{
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(event, {
type: 'click',
event,
selectedValue: data.selectedValue,
selectedSwatch: data.selectedSwatch
});
setSelectedValue(data.selectedValue);
});
return {
components: {
root: 'div'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
ref,
role,
...focusAttributes,
...rest
}), {
elementType: 'div'
}),
isGrid,
requestSelectionChange,
selectedValue,
size,
shape,
spacing
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/SwatchPicker/useSwatchPicker.ts"],"sourcesContent":["import * 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 { SwatchPickerProps, SwatchPickerState } from './SwatchPicker.types';\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 // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n\n const { layout, onSelectionChange, size = 'medium', shape, spacing = 'medium', style, ...rest } = props;\n\n const isGrid = layout === 'grid';\n const focusAttributes = useArrowNavigationGroup({\n circular: true,\n axis: isGrid ? 'grid-linear' : 'both',\n memorizeCurrent: true,\n });\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 ...focusAttributes,\n ...rest,\n }),\n { elementType: 'div' },\n ),\n isGrid,\n requestSelectionChange,\n selectedValue,\n size,\n shape,\n spacing,\n };\n};\n"],"names":["useSwatchPicker_unstable","props","ref","useFieldControlProps_unstable","layout","onSelectionChange","size","shape","spacing","style","rest","isGrid","focusAttributes","useArrowNavigationGroup","circular","axis","memorizeCurrent","role","selectedValue","setSelectedValue","useControllableState","state","defaultState","defaultSelectedValue","initialState","requestSelectionChange","useEventCallback","event","data","type","selectedSwatch","components","root","slot","always","getIntrinsicElementProps","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAiBaA;;;eAAAA;;;;iEAjBU;4BAEuB;8BACN;gCAC+C;AAahF,MAAMA,2BAA2B,CACtCC,OACAC;IAEA,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAAAA,EAA8BF;IAEtC,MAAM,EAAEG,MAAM,EAAEC,iBAAiB,EAAEC,OAAO,QAAQ,EAAEC,KAAK,EAAEC,UAAU,QAAQ,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGT;IAElG,MAAMU,SAASP,WAAW;IAC1B,MAAMQ,kBAAkBC,IAAAA,qCAAAA,EAAwB;QAC9CC,UAAU;QACVC,MAAMJ,SAAS,gBAAgB;QAC/BK,iBAAiB;IACnB;IAEA,MAAMC,OAAON,SAAS,SAAS;IAE/B,MAAM,CAACO,eAAeC,iBAAiB,GAAGC,IAAAA,oCAAAA,EAAqB;QAC7DC,OAAOpB,MAAMiB,aAAa;QAC1BI,cAAcrB,MAAMsB,oBAAoB;QACxCC,cAAc;IAChB;IAEA,MAAMC,yBAAsEC,IAAAA,gCAAAA,EAAiB,CAACC,OAAOC;QACnGvB,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAoBsB,OAAO;YACzBE,MAAM;YACNF;YACAT,eAAeU,KAAKV,aAAa;YACjCY,gBAAgBF,KAAKE,cAAc;QACrC;QACAX,iBAAiBS,KAAKV,aAAa;IACrC;IAEA,OAAO;QACLa,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9BjC;YACAe;YACA,GAAGL,eAAe;YAClB,GAAGF,IAAI;QACT,IACA;YAAE0B,aAAa;QAAM;QAEvBzB;QACAc;QACAP;QACAZ;QACAC;QACAC;IACF;AACF"}
@@ -0,0 +1,82 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
swatchPickerClassNames: function() {
return swatchPickerClassNames;
},
useSwatchPickerStyles_unstable: function() {
return useSwatchPickerStyles_unstable;
}
});
const _react = require("@griffel/react");
const swatchPickerClassNames = {
root: 'fui-SwatchPicker'
};
/**
* Styles for the root slot
*/ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
root: {
Byoj8tv: 0,
uwmqm3: 0,
z189sj: 0,
z8tnut: 0,
B0ocmuz: "f14ufcw5",
mc9l5x: "f22iagw"
},
row: {
Beiy3e4: "f1063pyq"
},
grid: {
Beiy3e4: "f1vx9l62"
},
spacingSmall: {
i8kkvl: 0,
Belr9w4: 0,
rmohyg: "f1t6b6ee"
},
spacingMedium: {
i8kkvl: 0,
Belr9w4: 0,
rmohyg: "f4xv25i"
}
}, {
d: [
[
".f14ufcw5{padding:var(--spacingHorizontalNone) var(--spacingVerticalNone);}",
{
p: -1
}
],
".f22iagw{display:flex;}",
".f1063pyq{flex-direction:row;}",
".f1vx9l62{flex-direction:column;}",
[
".f1t6b6ee{gap:2px;}",
{
p: -1
}
],
[
".f4xv25i{gap:4px;}",
{
p: -1
}
]
]
});
const useSwatchPickerStyles_unstable = (state)=>{
'use no memo';
const styles = useStyles();
const layoutStyle = state.isGrid ? styles.grid : styles.row;
const spacingStyle = state.spacing === 'small' ? styles.spacingSmall : styles.spacingMedium;
state.root.className = (0, _react.mergeClasses)(swatchPickerClassNames.root, styles.root, layoutStyle, spacingStyle, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useSwatchPickerStyles.styles.js"],"sourcesContent":["import { 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 'use no memo';\n const styles = useStyles();\n const layoutStyle = state.isGrid ? styles.grid : styles.row;\n const spacingStyle = state.spacing === 'small' ? styles.spacingSmall : styles.spacingMedium;\n state.root.className = mergeClasses(swatchPickerClassNames.root, styles.root, layoutStyle, spacingStyle, state.root.className);\n return state;\n};\n"],"names":["swatchPickerClassNames","useSwatchPickerStyles_unstable","root","useStyles","__styles","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","mc9l5x","row","Beiy3e4","grid","spacingSmall","i8kkvl","Belr9w4","rmohyg","spacingMedium","d","p","state","styles","layoutStyle","isGrid","spacingStyle","spacing","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,sBAAsB;eAAtBA;;IAyBIC,8BAA8B;eAA9BA;;;uBA3BwB;AAElC,MAAMD,yBAAyB;IAClCE,MAAM;AACV;AACA;;CAEA,GAAI,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAF,MAAA;QAAAG,SAAA;QAAAC,QAAA;QAAAC,QAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;IAAA;IAAAC,KAAA;QAAAC,SAAA;IAAA;IAAAC,MAAA;QAAAD,SAAA;IAAA;IAAAE,cAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;IAAA;IAAAC,eAAA;QAAAH,QAAA;QAAAC,SAAA;QAAAC,QAAA;IAAA;AAAA,GAAA;IAAAE,GAAA;QAAA;YAAA;YAAA;gBAAAC,GAAA,CAAA;YAAA;SAAA;QAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBAAAA,GAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,GAAA,CAAA;YAAA;SAAA;KAAA;AAAA;AAoBX,MAAMnB,iCAAkCoB,CAAAA;IAC/C;IACA,MAAMC,SAASnB;IACf,MAAMoB,cAAcF,MAAMG,MAAM,GAAGF,OAAOT,IAAI,GAAGS,OAAOX,GAAG;IAC3D,MAAMc,eAAeJ,MAAMK,OAAO,KAAK,UAAUJ,OAAOR,YAAY,GAAGQ,OAAOJ,aAAa;IAC3FG,MAAMnB,IAAI,CAACyB,SAAS,GAAGC,IAAAA,mBAAY,EAAC5B,uBAAuBE,IAAI,EAAEoB,OAAOpB,IAAI,EAAEqB,aAAaE,cAAcJ,MAAMnB,IAAI,CAACyB,SAAS;IAC7H,OAAON;AACX"}
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "SwatchPickerRow", {
enumerable: true,
get: function() {
return SwatchPickerRow;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useSwatchPickerRow = require("./useSwatchPickerRow");
const _renderSwatchPickerRow = require("./renderSwatchPickerRow");
const _useSwatchPickerRowStylesstyles = require("./useSwatchPickerRowStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const SwatchPickerRow = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useSwatchPickerRow.useSwatchPickerRow_unstable)(props, ref);
(0, _useSwatchPickerRowStylesstyles.useSwatchPickerRowStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useSwatchPickerRowStyles_unstable')(state);
return (0, _renderSwatchPickerRow.renderSwatchPickerRow_unstable)(state);
});
SwatchPickerRow.displayName = 'SwatchPickerRow';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/SwatchPickerRow/SwatchPickerRow.tsx"],"sourcesContent":["import * 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":["SwatchPickerRow","React","forwardRef","props","ref","state","useSwatchPickerRow_unstable","useSwatchPickerRowStyles_unstable","useCustomStyleHook_unstable","renderSwatchPickerRow_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;oCAEqB;uCACG;gDACG;qCAEN;AAKrC,MAAMA,kBAAAA,WAAAA,GAA6DC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACjG,MAAMC,QAAQC,IAAAA,+CAAAA,EAA4BH,OAAOC;IAEjDG,IAAAA,iEAAAA,EAAkCF;IAClCG,IAAAA,gDAAAA,EAA4B,qCAAqCH;IACjE,OAAOI,IAAAA,qDAAAA,EAA+BJ;AACxC;AAEAL,gBAAgBU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering SwatchPickerRow
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +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":[],"rangeMappings":";;","mappings":"AAYA;;CAEC"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
SwatchPickerRow: function() {
return _SwatchPickerRow.SwatchPickerRow;
},
renderSwatchPickerRow_unstable: function() {
return _renderSwatchPickerRow.renderSwatchPickerRow_unstable;
},
swatchPickerRowClassNames: function() {
return _useSwatchPickerRowStylesstyles.swatchPickerRowClassNames;
},
useSwatchPickerRowStyles_unstable: function() {
return _useSwatchPickerRowStylesstyles.useSwatchPickerRowStyles_unstable;
},
useSwatchPickerRow_unstable: function() {
return _useSwatchPickerRow.useSwatchPickerRow_unstable;
}
});
const _SwatchPickerRow = require("./SwatchPickerRow");
const _renderSwatchPickerRow = require("./renderSwatchPickerRow");
const _useSwatchPickerRow = require("./useSwatchPickerRow");
const _useSwatchPickerRowStylesstyles = require("./useSwatchPickerRowStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/SwatchPickerRow/index.ts"],"sourcesContent":["export { SwatchPickerRow } from './SwatchPickerRow';\nexport type { SwatchPickerRowProps, SwatchPickerRowSlots, SwatchPickerRowState } from './SwatchPickerRow.types';\nexport { renderSwatchPickerRow_unstable } from './renderSwatchPickerRow';\nexport { useSwatchPickerRow_unstable } from './useSwatchPickerRow';\nexport { swatchPickerRowClassNames, useSwatchPickerRowStyles_unstable } from './useSwatchPickerRowStyles.styles';\n"],"names":["SwatchPickerRow","renderSwatchPickerRow_unstable","swatchPickerRowClassNames","useSwatchPickerRowStyles_unstable","useSwatchPickerRow_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,eAAe;eAAfA,gCAAe;;IAEfC,8BAA8B;eAA9BA,qDAA8B;;IAE9BC,yBAAyB;eAAzBA,yDAAyB;;IAAEC,iCAAiC;eAAjCA,iEAAiC;;IAD5DC,2BAA2B;eAA3BA,+CAA2B;;;iCAHJ;uCAEe;oCACH;gDACiC"}
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderSwatchPickerRow_unstable", {
enumerable: true,
get: function() {
return renderSwatchPickerRow_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderSwatchPickerRow_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/SwatchPickerRow/renderSwatchPickerRow.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { SwatchPickerRowState, SwatchPickerRowSlots } from './SwatchPickerRow.types';\n\n/**\n * Render the final JSX of SwatchPickerRow\n */\nexport const renderSwatchPickerRow_unstable = (state: SwatchPickerRowState) => {\n assertSlots<SwatchPickerRowSlots>(state);\n return <state.root />;\n};\n"],"names":["renderSwatchPickerRow_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,iCAAiC,CAACC;IAC7CC,IAAAA,2BAAAA,EAAkCD;IAClC,OAAA,WAAA,GAAOE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA,CAAA;AACpB"}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useSwatchPickerRow_unstable", {
enumerable: true,
get: function() {
return useSwatchPickerRow_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactutilities = require("@fluentui/react-utilities");
const _swatchPicker = require("../../contexts/swatchPicker");
const useSwatchPickerRow_unstable = (props, ref)=>{
const { style, ...rest } = props;
const spacing = (0, _swatchPicker.useSwatchPickerContextValue_unstable)((ctx)=>ctx.spacing);
return {
components: {
root: 'div'
},
root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
ref,
role: 'row',
...rest
}), {
elementType: 'div'
}),
spacing
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/SwatchPickerRow/useSwatchPickerRow.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { SwatchPickerRowProps, SwatchPickerRowState } from './SwatchPickerRow.types';\nimport { useSwatchPickerContextValue_unstable } from '../../contexts/swatchPicker';\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 { style, ...rest } = props;\n const spacing = useSwatchPickerContextValue_unstable(ctx => ctx.spacing);\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n role: 'row',\n ...rest,\n }),\n { elementType: 'div' },\n ),\n spacing,\n };\n};\n"],"names":["useSwatchPickerRow_unstable","props","ref","style","rest","spacing","useSwatchPickerContextValue_unstable","ctx","components","root","slot","always","getIntrinsicElementProps","role","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;;iEAdU;gCACwB;8BAEM;AAW9C,MAAMA,8BAA8B,CACzCC,OACAC;IAEA,MAAM,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGH;IAC3B,MAAMI,UAAUC,IAAAA,kDAAAA,EAAqCC,CAAAA,MAAOA,IAAIF,OAAO;IAEvE,OAAO;QACLG,YAAY;YACVC,MAAM;QACR;QACAA,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB,OAAO;YAC9BV;YACAW,MAAM;YACN,GAAGT,IAAI;QACT,IACA;YAAEU,aAAa;QAAM;QAEvBT;IACF;AACF"}
@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
swatchPickerRowClassNames: function() {
return swatchPickerRowClassNames;
},
useSwatchPickerRowStyles_unstable: function() {
return useSwatchPickerRowStyles_unstable;
}
});
const _react = require("@griffel/react");
const swatchPickerRowClassNames = {
root: 'fui-SwatchPickerRow'
};
/**
* Styles for the root slot
*/ const useResetStyles = /*#__PURE__*/ (0, _react.__resetStyles)("r1xhj18k", null, [
".r1xhj18k{display:flex;flex-direction:row;}"
]);
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
spacingSmall: {
i8kkvl: "f16mnhsx"
},
spacingMedium: {
i8kkvl: "f1q8lukm"
}
}, {
d: [
".f16mnhsx{column-gap:2px;}",
".f1q8lukm{column-gap:4px;}"
]
});
const useSwatchPickerRowStyles_unstable = (state)=>{
'use no memo';
const resetStyles = useResetStyles();
const styles = useStyles();
const spacingStyle = state.spacing === 'small' ? styles.spacingSmall : styles.spacingMedium;
state.root.className = (0, _react.mergeClasses)(swatchPickerRowClassNames.root, resetStyles, spacingStyle, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useSwatchPickerRowStyles.styles.js"],"sourcesContent":["import { makeResetStyles, mergeClasses, makeStyles } from '@griffel/react';\nexport const swatchPickerRowClassNames = {\n root: 'fui-SwatchPickerRow'\n};\n/**\n * Styles for the root slot\n */ const useResetStyles = makeResetStyles({\n display: 'flex',\n flexDirection: 'row'\n});\nconst useStyles = makeStyles({\n spacingSmall: {\n columnGap: '2px'\n },\n spacingMedium: {\n columnGap: '4px'\n }\n});\n/**\n * Apply styling to the SwatchPickerRow slots based on the state\n */ export const useSwatchPickerRowStyles_unstable = (state)=>{\n 'use no memo';\n const resetStyles = useResetStyles();\n const styles = useStyles();\n const spacingStyle = state.spacing === 'small' ? styles.spacingSmall : styles.spacingMedium;\n state.root.className = mergeClasses(swatchPickerRowClassNames.root, resetStyles, spacingStyle, state.root.className);\n return state;\n};\n"],"names":["swatchPickerRowClassNames","useSwatchPickerRowStyles_unstable","root","useResetStyles","__resetStyles","useStyles","__styles","spacingSmall","i8kkvl","spacingMedium","d","state","resetStyles","styles","spacingStyle","spacing","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,yBAAyB;eAAzBA;;IAmBIC,iCAAiC;eAAjCA;;;uBApByC;AACnD,MAAMD,4BAA4B;IACrCE,MAAM;AACV;AACA;;CAEA,GAAI,MAAMC,iBAAc,WAAA,GAAGC,IAAAA,oBAAA,EAAA,YAAA,MAAA;IAAA;CAG1B;AACD,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,cAAA;QAAAC,QAAA;IAAA;IAAAC,eAAA;QAAAD,QAAA;IAAA;AAAA,GAAA;IAAAE,GAAA;QAAA;QAAA;KAAA;AAAA;AAUP,MAAMT,oCAAqCU,CAAAA;IAClD;IACA,MAAMC,cAAcT;IACpB,MAAMU,SAASR;IACf,MAAMS,eAAeH,MAAMI,OAAO,KAAK,UAAUF,OAAON,YAAY,GAAGM,OAAOJ,aAAa;IAC3FE,MAAMT,IAAI,CAACc,SAAS,GAAGC,IAAAA,mBAAY,EAACjB,0BAA0BE,IAAI,EAAEU,aAAaE,cAAcH,MAAMT,IAAI,CAACc,SAAS;IACnH,OAAOL;AACX"}