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,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "RadioGroup", {
enumerable: true,
get: function() {
return RadioGroup;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _renderRadioGroup = require("./renderRadioGroup");
const _useRadioGroup = require("./useRadioGroup");
const _useRadioGroupStylesstyles = require("./useRadioGroupStyles.styles");
const _useRadioGroupContextValues = require("../../contexts/useRadioGroupContextValues");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const RadioGroup = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useRadioGroup.useRadioGroup_unstable)(props, ref);
const contextValues = (0, _useRadioGroupContextValues.useRadioGroupContextValues)(state);
(0, _useRadioGroupStylesstyles.useRadioGroupStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useRadioGroupStyles_unstable')(state);
return (0, _renderRadioGroup.renderRadioGroup_unstable)(state, contextValues);
});
RadioGroup.displayName = 'RadioGroup';
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { RadioGroupProps } from './RadioGroup.types';\nimport { renderRadioGroup_unstable } from './renderRadioGroup';\nimport { useRadioGroup_unstable } from './useRadioGroup';\nimport { useRadioGroupStyles_unstable } from './useRadioGroupStyles.styles';\nimport { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * A RadioGroup component presents a set of options where only one option can be selected.\n */\nexport const RadioGroup: ForwardRefComponent<RadioGroupProps> = React.forwardRef((props, ref) => {\n const state = useRadioGroup_unstable(props, ref);\n const contextValues = useRadioGroupContextValues(state);\n\n useRadioGroupStyles_unstable(state);\n\n useCustomStyleHook_unstable('useRadioGroupStyles_unstable')(state);\n\n return renderRadioGroup_unstable(state, contextValues);\n});\n\nRadioGroup.displayName = 'RadioGroup';\n"],"names":["RadioGroup","React","forwardRef","props","ref","state","useRadioGroup_unstable","contextValues","useRadioGroupContextValues","useRadioGroupStyles_unstable","useCustomStyleHook_unstable","renderRadioGroup_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAYaA;;;eAAAA;;;;iEAZU;kCAGmB;+BACH;2CACM;4CACF;qCACC;AAKrC,MAAMA,aAAAA,WAAAA,GAAmDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQC,IAAAA,qCAAAA,EAAuBH,OAAOC;IAC5C,MAAMG,gBAAgBC,IAAAA,sDAAAA,EAA2BH;IAEjDI,IAAAA,uDAAAA,EAA6BJ;IAE7BK,IAAAA,gDAAAA,EAA4B,gCAAgCL;IAE5D,OAAOM,IAAAA,2CAAAA,EAA0BN,OAAOE;AAC1C;AAEAP,WAAWY,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/RadioGroup/RadioGroup.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type RadioGroupSlots = {\n /**\n * The radio group root.\n */\n root: NonNullable<Slot<'div'>>;\n};\n\nexport type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {\n /**\n * The name of this radio group. This name is applied to all Radio items inside this group.\n *\n * If no name is provided, one will be generated so that all of the Radio items have the same name.\n */\n name?: string;\n\n /**\n * The selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n value?: string;\n\n /**\n * The default selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n defaultValue?: string;\n\n /**\n * Callback when the selected Radio item changes.\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;\n\n /**\n * How the radio items are laid out in the group.\n *\n * @default vertical\n */\n layout?: 'vertical' | 'horizontal' | 'horizontal-stacked';\n\n /**\n * Disable all Radio items in this group.\n */\n disabled?: boolean;\n\n /**\n * Require a selection in this group. Adds the `required` prop to all child Radio items.\n */\n required?: boolean;\n};\n\n/**\n * Data for the onChange event for RadioGroup.\n */\nexport type RadioGroupOnChangeData = {\n /**\n * The value of the newly selected Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering RadioGroup\n */\nexport type RadioGroupState = ComponentState<RadioGroupSlots> &\n Required<Pick<RadioGroupProps, 'layout'>> &\n Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;\n\nexport type RadioGroupContextValue = Pick<\n RadioGroupProps,\n 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required' | 'aria-describedby'\n>;\n\nexport type RadioGroupContextValues = {\n radioGroup: RadioGroupContextValue;\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, {
RadioGroup: function() {
return _RadioGroup.RadioGroup;
},
radioGroupClassNames: function() {
return _useRadioGroupStylesstyles.radioGroupClassNames;
},
renderRadioGroup_unstable: function() {
return _renderRadioGroup.renderRadioGroup_unstable;
},
useRadioGroupStyles_unstable: function() {
return _useRadioGroupStylesstyles.useRadioGroupStyles_unstable;
},
useRadioGroup_unstable: function() {
return _useRadioGroup.useRadioGroup_unstable;
}
});
const _RadioGroup = require("./RadioGroup");
const _renderRadioGroup = require("./renderRadioGroup");
const _useRadioGroup = require("./useRadioGroup");
const _useRadioGroupStylesstyles = require("./useRadioGroupStyles.styles");
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/RadioGroup/index.ts"],"sourcesContent":["export { RadioGroup } from './RadioGroup';\nexport type {\n RadioGroupContextValue,\n RadioGroupContextValues,\n RadioGroupOnChangeData,\n RadioGroupProps,\n RadioGroupSlots,\n RadioGroupState,\n} from './RadioGroup.types';\nexport { renderRadioGroup_unstable } from './renderRadioGroup';\nexport { useRadioGroup_unstable } from './useRadioGroup';\nexport { radioGroupClassNames, useRadioGroupStyles_unstable } from './useRadioGroupStyles.styles';\n"],"names":["RadioGroup","radioGroupClassNames","renderRadioGroup_unstable","useRadioGroupStyles_unstable","useRadioGroup_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,UAAU;eAAVA,sBAAU;;IAWVC,oBAAoB;eAApBA,+CAAoB;;IAFpBC,yBAAyB;eAAzBA,2CAAyB;;IAEHC,4BAA4B;eAA5BA,uDAA4B;;IADlDC,sBAAsB;eAAtBA,qCAAsB;;;4BAVJ;kCASe;+BACH;2CAC4B"}
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderRadioGroup_unstable", {
enumerable: true,
get: function() {
return renderRadioGroup_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const _RadioGroupContext = require("../../contexts/RadioGroupContext");
const renderRadioGroup_unstable = (state, contextValues)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_RadioGroupContext.RadioGroupContext.Provider, {
value: contextValues.radioGroup,
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
});
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/RadioGroup/renderRadioGroup.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport { RadioGroupContextValues, RadioGroupSlots, RadioGroupState } from './RadioGroup.types';\n\n/**\n * Render the final JSX of RadioGroup\n */\nexport const renderRadioGroup_unstable = (state: RadioGroupState, contextValues: RadioGroupContextValues) => {\n assertSlots<RadioGroupSlots>(state);\n\n return (\n <RadioGroupContext.Provider value={contextValues.radioGroup}>\n <state.root />\n </RadioGroupContext.Provider>\n );\n};\n"],"names":["renderRadioGroup_unstable","state","contextValues","assertSlots","_jsx","RadioGroupContext","Provider","value","radioGroup","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;gCAE4B;mCACM;AAM3B,MAAMA,4BAA4B,CAACC,OAAwBC;IAChEC,IAAAA,2BAAAA,EAA6BF;IAE7B,OAAA,WAAA,GACEG,IAAAA,eAAA,EAACC,oCAAAA,CAAkBC,QAAQ,EAAA;QAACC,OAAOL,cAAcM,UAAU;kBACzD,WAAA,GAAAJ,IAAAA,eAAA,EAACH,MAAMQ,IAAI,EAAA,CAAA;;AAGjB"}
@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useRadioGroup_unstable", {
enumerable: true,
get: function() {
return useRadioGroup_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 _reactutilities = require("@fluentui/react-utilities");
const useRadioGroup_unstable = (props, ref)=>{
// Merge props from surrounding <Field>, if any
props = (0, _reactfield.useFieldControlProps_unstable)(props);
const generatedName = (0, _reactutilities.useId)('radiogroup-');
const { name = generatedName, value, defaultValue, disabled, layout = 'vertical', onChange, required } = props;
return {
layout,
name,
value,
defaultValue,
disabled,
required,
components: {
root: 'div'
},
root: {
ref,
role: 'radiogroup',
..._reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', props, /*excludedPropNames:*/ [
'onChange',
'name'
]), {
elementType: 'div'
}),
onChange: (0, _reactutilities.useEventCallback)((ev)=>{
if (onChange && (0, _reactutilities.isHTMLElement)(ev.target, {
constructorName: 'HTMLInputElement'
}) && ev.target.type === 'radio') {
onChange(ev, {
value: ev.target.value
});
}
})
}
};
};
@@ -0,0 +1 @@
{"version":3,"sources":["../src/components/RadioGroup/useRadioGroup.ts"],"sourcesContent":["import * as React from 'react';\nimport { useFieldControlProps_unstable } from '@fluentui/react-field';\nimport { getIntrinsicElementProps, isHTMLElement, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { RadioGroupProps, RadioGroupState } from './RadioGroup.types';\n\n/**\n * Create the state required to render RadioGroup.\n *\n * The returned state can be modified with hooks such as useRadioGroupStyles_unstable,\n * before being passed to renderRadioGroup_unstable.\n *\n * @param props - props from this instance of RadioGroup\n * @param ref - reference to root HTMLElement of RadioGroup\n */\nexport const useRadioGroup_unstable = (props: RadioGroupProps, ref: React.Ref<HTMLDivElement>): RadioGroupState => {\n // Merge props from surrounding <Field>, if any\n props = useFieldControlProps_unstable(props);\n\n const generatedName = useId('radiogroup-');\n\n const { name = generatedName, value, defaultValue, disabled, layout = 'vertical', onChange, required } = props;\n\n return {\n layout,\n name,\n value,\n defaultValue,\n disabled,\n required,\n components: {\n root: 'div',\n },\n root: {\n ref,\n role: 'radiogroup',\n ...slot.always(getIntrinsicElementProps('div', props, /*excludedPropNames:*/ ['onChange', 'name']), {\n elementType: 'div',\n }),\n onChange: useEventCallback(ev => {\n if (\n onChange &&\n isHTMLElement(ev.target, { constructorName: 'HTMLInputElement' }) &&\n ev.target.type === 'radio'\n ) {\n onChange(ev, { value: ev.target.value });\n }\n }),\n },\n };\n};\n"],"names":["useRadioGroup_unstable","props","ref","useFieldControlProps_unstable","generatedName","useId","name","value","defaultValue","disabled","layout","onChange","required","components","root","role","slot","always","getIntrinsicElementProps","elementType","useEventCallback","ev","isHTMLElement","target","constructorName","type"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAcaA;;;eAAAA;;;;iEAdU;4BACuB;gCACyC;AAYhF,MAAMA,yBAAyB,CAACC,OAAwBC;IAC7D,+CAA+C;IAC/CD,QAAQE,IAAAA,yCAAAA,EAA8BF;IAEtC,MAAMG,gBAAgBC,IAAAA,qBAAAA,EAAM;IAE5B,MAAM,EAAEC,OAAOF,aAAa,EAAEG,KAAK,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,SAAS,UAAU,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGX;IAEzG,OAAO;QACLS;QACAJ;QACAC;QACAC;QACAC;QACAG;QACAC,YAAY;YACVC,MAAM;QACR;QACAA,MAAM;YACJZ;YACAa,MAAM;YACN,GAAGC,oBAAAA,CAAKC,MAAM,CAACC,IAAAA,wCAAAA,EAAyB,OAAOjB,OAAO,oBAAoB,GAAG;gBAAC;gBAAY;aAAO,GAAG;gBAClGkB,aAAa;YACf,EAAE;YACFR,UAAUS,IAAAA,gCAAAA,EAAiBC,CAAAA;gBACzB,IACEV,YACAW,IAAAA,6BAAAA,EAAcD,GAAGE,MAAM,EAAE;oBAAEC,iBAAiB;gBAAmB,MAC/DH,GAAGE,MAAM,CAACE,IAAI,KAAK,SACnB;oBACAd,SAASU,IAAI;wBAAEd,OAAOc,GAAGE,MAAM,CAAChB,KAAK;oBAAC;gBACxC;YACF;QACF;IACF;AACF"}
@@ -0,0 +1,43 @@
"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, {
radioGroupClassNames: function() {
return radioGroupClassNames;
},
useRadioGroupStyles_unstable: function() {
return useRadioGroupStyles_unstable;
}
});
const _react = require("@griffel/react");
const radioGroupClassNames = {
root: 'fui-RadioGroup'
};
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
root: {
mc9l5x: "f22iagw",
Bt984gj: "f6jr5hl"
},
vertical: {
Beiy3e4: "f1vx9l62"
}
}, {
d: [
".f22iagw{display:flex;}",
".f6jr5hl{align-items:flex-start;}",
".f1vx9l62{flex-direction:column;}"
]
});
const useRadioGroupStyles_unstable = (state)=>{
'use no memo';
const styles = useStyles();
state.root.className = (0, _react.mergeClasses)(radioGroupClassNames.root, styles.root, state.layout === 'vertical' && styles.vertical, state.root.className);
return state;
};
@@ -0,0 +1 @@
{"version":3,"sources":["useRadioGroupStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nexport const radioGroupClassNames = {\n root: 'fui-RadioGroup'\n};\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'flex-start'\n },\n vertical: {\n flexDirection: 'column'\n }\n});\n/**\n * Apply styling to the RadioGroup slots based on the state\n */ export const useRadioGroupStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n state.root.className = mergeClasses(radioGroupClassNames.root, styles.root, state.layout === 'vertical' && styles.vertical, state.root.className);\n return state;\n};\n"],"names":["radioGroupClassNames","useRadioGroupStyles_unstable","root","useStyles","__styles","mc9l5x","Bt984gj","vertical","Beiy3e4","d","state","styles","className","mergeClasses","layout"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,oBAAoB;eAApBA;;IAcIC,4BAA4B;eAA5BA;;;uBAfwB;AAClC,MAAMD,uBAAuB;IAChCE,MAAM;AACV;AACA,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAF,MAAA;QAAAG,QAAA;QAAAC,SAAA;IAAA;IAAAC,UAAA;QAAAC,SAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;QAAA;QAAA;KAAA;AAAA;AAWP,MAAMR,+BAAgCS,CAAAA;IAC7C;IACA,MAAMC,SAASR;IACfO,MAAMR,IAAI,CAACU,SAAS,GAAGC,IAAAA,mBAAY,EAACb,qBAAqBE,IAAI,EAAES,OAAOT,IAAI,EAAEQ,MAAMI,MAAM,KAAK,cAAcH,OAAOJ,QAAQ,EAAEG,MAAMR,IAAI,CAACU,SAAS;IAChJ,OAAOF;AACX"}