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, "ToolbarRadioButton", {
enumerable: true,
get: function() {
return ToolbarRadioButton;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactbutton = require("@fluentui/react-button");
const _useToolbarRadioButton = require("./useToolbarRadioButton");
const _useToolbarRadioButtonStylesstyles = require("./useToolbarRadioButtonStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const ToolbarRadioButton = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useToolbarRadioButton.useToolbarRadioButton_unstable)(props, ref);
(0, _useToolbarRadioButtonStylesstyles.useToolbarRadioButtonStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useToolbarRadioButtonStyles_unstable')(state);
return (0, _reactbutton.renderToggleButton_unstable)(state);
});
ToolbarRadioButton.displayName = 'ToolbarRadioButton';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToolbarRadioButton/ToolbarRadioButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ToolbarRadioButtonProps } from './ToolbarRadioButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderToggleButton_unstable } from '@fluentui/react-button';\nimport { useToolbarRadioButton_unstable } from './useToolbarRadioButton';\nimport { useToolbarRadioButtonStyles_unstable } from './useToolbarRadioButtonStyles.styles';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * ToolbarRadioButton component\n */\nexport const ToolbarRadioButton: ForwardRefComponent<ToolbarRadioButtonProps> = React.forwardRef((props, ref) => {\n const state = useToolbarRadioButton_unstable(props, ref);\n\n useToolbarRadioButtonStyles_unstable(state);\n\n useCustomStyleHook_unstable('useToolbarRadioButtonStyles_unstable')(state);\n\n return renderToggleButton_unstable(state);\n}) as ForwardRefComponent<ToolbarRadioButtonProps>;\n\nToolbarRadioButton.displayName = 'ToolbarRadioButton';\n"],"names":["ToolbarRadioButton","React","forwardRef","props","ref","state","useToolbarRadioButton_unstable","useToolbarRadioButtonStyles_unstable","useCustomStyleHook_unstable","renderToggleButton_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;6BAGqB;uCACG;mDACM;qCACT;AAKrC,MAAMA,qBAAAA,WAAAA,GAAmEC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACvG,MAAMC,QAAQC,IAAAA,qDAAAA,EAA+BH,OAAOC;IAEpDG,IAAAA,uEAAAA,EAAqCF;IAErCG,IAAAA,gDAAAA,EAA4B,wCAAwCH;IAEpE,OAAOI,IAAAA,wCAAAA,EAA4BJ;AACrC;AAEAL,mBAAmBU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
/**
* State used in rendering ToolbarRadioButton
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToolbarRadioButton/ToolbarRadioButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { ToggleButtonProps, ButtonSlots, ToggleButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarRadioButton Props\n */\nexport type ToolbarRadioButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n name: string;\n value: string;\n };\n\n/**\n * State used in rendering ToolbarRadioButton\n */\nexport type ToolbarRadioButtonState = ComponentState<Partial<ButtonSlots>> &\n ToggleButtonState &\n Required<Pick<ToggleButtonProps, 'checked'>> &\n Pick<ToolbarRadioButtonProps, 'name' | 'value'>;\n"],"names":[],"rangeMappings":";;","mappings":"AAaA;;CAEC"}
@@ -0,0 +1,24 @@
"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, {
ToolbarRadioButton: function() {
return _ToolbarRadioButton.ToolbarRadioButton;
},
useToolbarRadioButtonStyles_unstable: function() {
return _useToolbarRadioButtonStylesstyles.useToolbarRadioButtonStyles_unstable;
},
useToolbarRadioButton_unstable: function() {
return _useToolbarRadioButton.useToolbarRadioButton_unstable;
}
});
const _ToolbarRadioButton = require("./ToolbarRadioButton");
const _useToolbarRadioButton = require("./useToolbarRadioButton");
const _useToolbarRadioButtonStylesstyles = require("./useToolbarRadioButtonStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToolbarRadioButton/index.ts"],"sourcesContent":["export { ToolbarRadioButton } from './ToolbarRadioButton';\nexport type { ToolbarRadioButtonProps, ToolbarRadioButtonState } from './ToolbarRadioButton.types';\nexport { useToolbarRadioButton_unstable } from './useToolbarRadioButton';\nexport { useToolbarRadioButtonStyles_unstable } from './useToolbarRadioButtonStyles.styles';\n"],"names":["ToolbarRadioButton","useToolbarRadioButtonStyles_unstable","useToolbarRadioButton_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,kBAAkB;eAAlBA,sCAAkB;;IAGlBC,oCAAoC;eAApCA,uEAAoC;;IADpCC,8BAA8B;eAA9BA,qDAA8B;;;oCAFJ;uCAEY;mDACM"}
@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToolbarRadioButton_unstable", {
enumerable: true,
get: function() {
return useToolbarRadioButton_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 _reactbutton = require("@fluentui/react-button");
const _ToolbarContext = require("../Toolbar/ToolbarContext");
const useToolbarRadioButton_unstable = (props, ref)=>{
const handleRadio = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>ctx.handleRadio);
const checked = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>{
var _ctx_checkedValues_props_name;
return !!((_ctx_checkedValues_props_name = ctx.checkedValues[props.name]) === null || _ctx_checkedValues_props_name === void 0 ? void 0 : _ctx_checkedValues_props_name.includes(props.value));
});
const size = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>ctx.size);
const { onClick: onClickOriginal } = props;
const toggleButtonState = (0, _reactbutton.useToggleButton_unstable)({
size,
checked,
role: 'radio',
'aria-checked': checked,
...props
}, ref);
const state = {
...toggleButtonState,
name: props.name,
value: props.value
};
const handleOnClick = (0, _reactutilities.useEventCallback)((e)=>{
handleRadio === null || handleRadio === void 0 ? void 0 : handleRadio(e, state.name, state.value, state.checked);
onClickOriginal === null || onClickOriginal === void 0 ? void 0 : onClickOriginal(e);
});
state.root['aria-pressed'] = undefined;
state.root.onClick = handleOnClick;
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/ToolbarRadioButton/useToolbarRadioButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useToggleButton_unstable } from '@fluentui/react-button';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\nimport { ToolbarRadioButtonProps, ToolbarRadioButtonState } from './ToolbarRadioButton.types';\n\n/**\n * Given user props, defines default props for the RadioButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the RadioButton component.\n * @param ref - User provided ref to be passed to the RadioButton component.\n */\nexport const useToolbarRadioButton_unstable = (\n props: ToolbarRadioButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarRadioButtonState => {\n const handleRadio = useToolbarContext_unstable(ctx => ctx.handleRadio);\n const checked = useToolbarContext_unstable(ctx => !!ctx.checkedValues[props.name]?.includes(props.value));\n const size = useToolbarContext_unstable(ctx => ctx.size);\n\n const { onClick: onClickOriginal } = props;\n const toggleButtonState = useToggleButton_unstable(\n { size, checked, role: 'radio', 'aria-checked': checked, ...props },\n ref,\n );\n const state: ToolbarRadioButtonState = {\n ...toggleButtonState,\n name: props.name,\n value: props.value,\n };\n\n const handleOnClick = useEventCallback(\n (e: React.MouseEvent<HTMLButtonElement, MouseEvent> & React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n handleRadio?.(e, state.name, state.value, state.checked);\n onClickOriginal?.(e);\n },\n );\n state.root['aria-pressed'] = undefined;\n state.root.onClick = handleOnClick;\n return state;\n};\n"],"names":["useToolbarRadioButton_unstable","props","ref","handleRadio","useToolbarContext_unstable","ctx","checked","checkedValues","name","includes","value","size","onClick","onClickOriginal","toggleButtonState","useToggleButton_unstable","role","state","handleOnClick","useEventCallback","e","root","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAYaA;;;eAAAA;;;;iEAZU;gCACU;6BACQ;gCACE;AASpC,MAAMA,iCAAiC,CAC5CC,OACAC;IAEA,MAAMC,cAAcC,IAAAA,0CAAAA,EAA2BC,CAAAA,MAAOA,IAAIF,WAAW;IACrE,MAAMG,UAAUF,IAAAA,0CAAAA,EAA2BC,CAAAA;YAASA;eAAF,CAAC,CAAA,CAAA,AAACA,CAAAA,gCAAAA,IAAIE,aAAa,CAACN,MAAMO,IAAI,CAAC,AAAD,MAAC,QAA7BH,kCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,8BAA+BI,QAAQ,CAACR,MAAMS,KAAK,CAAA;;IACvG,MAAMC,OAAOP,IAAAA,0CAAAA,EAA2BC,CAAAA,MAAOA,IAAIM,IAAI;IAEvD,MAAM,EAAEC,SAASC,eAAe,EAAE,GAAGZ;IACrC,MAAMa,oBAAoBC,IAAAA,qCAAAA,EACxB;QAAEJ;QAAML;QAASU,MAAM;QAAS,gBAAgBV;QAAS,GAAGL,KAAK;IAAC,GAClEC;IAEF,MAAMe,QAAiC;QACrC,GAAGH,iBAAiB;QACpBN,MAAMP,MAAMO,IAAI;QAChBE,OAAOT,MAAMS,KAAK;IACpB;IAEA,MAAMQ,gBAAgBC,IAAAA,gCAAAA,EACpB,CAACC;QACCjB,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAciB,GAAGH,MAAMT,IAAI,EAAES,MAAMP,KAAK,EAAEO,MAAMX,OAAO;QACvDO,oBAAAA,QAAAA,oBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,gBAAkBO;IACpB;IAEFH,MAAMI,IAAI,CAAC,eAAe,GAAGC;IAC7BL,MAAMI,IAAI,CAACT,OAAO,GAAGM;IACrB,OAAOD;AACT"}
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useToolbarRadioButtonStyles_unstable", {
enumerable: true,
get: function() {
return useToolbarRadioButtonStyles_unstable;
}
});
const _react = require("@griffel/react");
const _reactbutton = require("@fluentui/react-button");
const useBaseStyles = /*#__PURE__*/ (0, _react.__styles)({
selected: {
sj55zd: "f16muhyy"
}
}, {
d: [
".f16muhyy{color:var(--colorBrandForeground1);}"
]
});
const useToolbarRadioButtonStyles_unstable = (state)=>{
'use no memo';
(0, _reactbutton.useToggleButtonStyles_unstable)(state);
const toggleButtonStyles = useBaseStyles();
state.root.className = (0, _react.mergeClasses)(state.root.className, state.checked && toggleButtonStyles.selected);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useToolbarRadioButtonStyles.styles.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useToggleButtonStyles_unstable } from '@fluentui/react-button';\nconst useBaseStyles = makeStyles({\n selected: {\n color: tokens.colorBrandForeground1\n }\n});\n/**\n * Apply styling to the ToolbarRadioButton slots based on the state\n */ export const useToolbarRadioButtonStyles_unstable = (state)=>{\n 'use no memo';\n useToggleButtonStyles_unstable(state);\n const toggleButtonStyles = useBaseStyles();\n state.root.className = mergeClasses(state.root.className, state.checked && toggleButtonStyles.selected);\n return state;\n};\n"],"names":["useToolbarRadioButtonStyles_unstable","useBaseStyles","__styles","selected","sj55zd","d","state","useToggleButtonStyles_unstable","toggleButtonStyles","root","className","mergeClasses","checked"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUiBA;;;eAAAA;;;uBATwB;6BACM;AAC/C,MAAMC,gBAAa,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,UAAA;QAAAC,QAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;KAAA;AAAA;AAOX,MAAML,uCAAwCM,CAAAA;IACrD;IACAC,IAAAA,2CAA8B,EAACD;IAC/B,MAAME,qBAAqBP;IAC3BK,MAAMG,IAAI,CAACC,SAAS,GAAGC,IAAAA,mBAAY,EAACL,MAAMG,IAAI,CAACC,SAAS,EAAEJ,MAAMM,OAAO,IAAIJ,mBAAmBL,QAAQ;IACtG,OAAOG;AACX"}