@fluentui/react-toolbar 9.7.7 → 9.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -2
- package/dist/index.d.ts +79 -7
- package/lib/components/Toolbar/Toolbar.types.js +1 -1
- package/lib/components/Toolbar/Toolbar.types.js.map +1 -1
- package/lib/components/Toolbar/ToolbarContext.js.map +1 -1
- package/lib/components/Toolbar/renderToolbar.js.map +1 -1
- package/lib/components/Toolbar/useToolbar.js +0 -1
- package/lib/components/Toolbar/useToolbar.js.map +1 -1
- package/lib/components/Toolbar/useToolbarContextValues.js +10 -3
- package/lib/components/Toolbar/useToolbarContextValues.js.map +1 -1
- package/lib/components/Toolbar/useToolbarStyles.styles.raw.js.map +1 -1
- package/lib/components/ToolbarButton/ToolbarButton.types.js.map +1 -1
- package/lib/components/ToolbarButton/useToolbarButton.js +5 -9
- package/lib/components/ToolbarButton/useToolbarButton.js.map +1 -1
- package/lib/components/ToolbarButton/useToolbarButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/ToolbarDivider/ToolbarDivider.types.js.map +1 -1
- package/lib/components/ToolbarDivider/useToolbarDivider.js +6 -5
- package/lib/components/ToolbarDivider/useToolbarDivider.js.map +1 -1
- package/lib/components/ToolbarGroup/useToolbarGroup.js +0 -1
- package/lib/components/ToolbarGroup/useToolbarGroup.js.map +1 -1
- package/lib/components/ToolbarGroup/useToolbarGroupStyles.styles.raw.js.map +1 -1
- package/lib/components/ToolbarRadioButton/ToolbarRadioButton.types.js.map +1 -1
- package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js +7 -7
- package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -1
- package/lib/components/ToolbarRadioButton/useToolbarRadioButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/ToolbarToggleButton/ToolbarToggleButton.types.js.map +1 -1
- package/lib/components/ToolbarToggleButton/useToolbarToggleButton.js +7 -5
- package/lib/components/ToolbarToggleButton/useToolbarToggleButton.js.map +1 -1
- package/lib/components/ToolbarToggleButton/useToolbarToggleButtonStyles.styles.raw.js.map +1 -1
- package/lib/index.js +5 -16
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Toolbar/Toolbar.types.js +0 -2
- package/lib-commonjs/components/Toolbar/Toolbar.types.js.map +1 -1
- package/lib-commonjs/components/Toolbar/ToolbarContext.js.map +1 -1
- package/lib-commonjs/components/Toolbar/renderToolbar.js.map +1 -1
- package/lib-commonjs/components/Toolbar/useToolbar.js +0 -2
- package/lib-commonjs/components/Toolbar/useToolbar.js.map +1 -1
- package/lib-commonjs/components/Toolbar/useToolbarContextValues.js +11 -3
- package/lib-commonjs/components/Toolbar/useToolbarContextValues.js.map +1 -1
- package/lib-commonjs/components/Toolbar/useToolbarStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ToolbarButton/ToolbarButton.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarButton/useToolbarButton.js +4 -9
- package/lib-commonjs/components/ToolbarButton/useToolbarButton.js.map +1 -1
- package/lib-commonjs/components/ToolbarButton/useToolbarButtonStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ToolbarDivider/ToolbarDivider.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarDivider/useToolbarDivider.js +5 -5
- package/lib-commonjs/components/ToolbarDivider/useToolbarDivider.js.map +1 -1
- package/lib-commonjs/components/ToolbarGroup/useToolbarGroup.js +0 -2
- package/lib-commonjs/components/ToolbarGroup/useToolbarGroup.js.map +1 -1
- package/lib-commonjs/components/ToolbarGroup/useToolbarGroupStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ToolbarRadioButton/ToolbarRadioButton.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js +6 -7
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -1
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButtonStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ToolbarToggleButton/ToolbarToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButton.js +6 -5
- package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButtonStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +15 -11
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarToggleButton/ToolbarToggleButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport type { ToggleButtonProps, ButtonSlots, ToggleButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarToggleButton Props\n */\nexport type ToolbarToggleButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n name: string;\n value: string;\n };\n\nexport type ToolbarToggleButtonBaseProps = DistributiveOmit<ToolbarToggleButtonProps, 'appearance'>;\n\n/**\n * State used in rendering ToolbarToggleButton\n */\nexport type ToolbarToggleButtonState = ComponentState<Partial<ButtonSlots>> &\n ToggleButtonState &\n Required<Pick<ToggleButtonProps, 'checked'>> &\n Pick<ToolbarToggleButtonProps, 'name' | 'value'>;\n\nexport type ToolbarToggleButtonBaseState = DistributiveOmit<ToolbarToggleButtonState, 'appearance'>;\n"],"names":[],"mappings":"AAuBA,
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarToggleButton/ToolbarToggleButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport type { ToggleButtonProps, ButtonSlots, ToggleButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarToggleButton Props\n */\nexport type ToolbarToggleButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n name: string;\n value: string;\n };\n\nexport type ToolbarToggleButtonBaseProps = DistributiveOmit<ToolbarToggleButtonProps, 'appearance'>;\n\n/**\n * State used in rendering ToolbarToggleButton\n */\nexport type ToolbarToggleButtonState = ComponentState<Partial<ButtonSlots>> &\n ToggleButtonState &\n Required<Pick<ToggleButtonProps, 'checked'>> &\n Pick<ToolbarToggleButtonProps, 'name' | 'value'>;\n\nexport type ToolbarToggleButtonBaseState = DistributiveOmit<ToolbarToggleButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":"AAuBA,WAAuH"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import { useToggleButton_unstable } from '@fluentui/react-button';
|
|
2
|
+
import { useToggleButtonBase_unstable } from '@fluentui/react-button';
|
|
4
3
|
import { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';
|
|
5
4
|
/**
|
|
6
5
|
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
|
@@ -8,11 +7,14 @@ import { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';
|
|
|
8
7
|
* @param props - User provided props to the ToggleButton component.
|
|
9
8
|
* @param ref - User provided ref to be passed to the ToggleButton component.
|
|
10
9
|
*/ export const useToolbarToggleButton_unstable = (props, ref)=>{
|
|
11
|
-
const
|
|
10
|
+
const contextSize = useToolbarContext_unstable((ctx)=>ctx.size);
|
|
11
|
+
const { appearance = 'subtle', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium', ...baseProps } = props;
|
|
12
12
|
const state = useToolbarToggleButtonBase_unstable(baseProps, ref);
|
|
13
13
|
return {
|
|
14
|
+
...state,
|
|
14
15
|
appearance,
|
|
15
|
-
|
|
16
|
+
size,
|
|
17
|
+
shape: 'rounded'
|
|
16
18
|
};
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
@@ -29,7 +31,7 @@ import { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';
|
|
|
29
31
|
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));
|
|
30
32
|
});
|
|
31
33
|
const { onClick: onClickOriginal } = props;
|
|
32
|
-
const toggleButtonState =
|
|
34
|
+
const toggleButtonState = useToggleButtonBase_unstable({
|
|
33
35
|
checked,
|
|
34
36
|
...props
|
|
35
37
|
}, ref);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarToggleButton/useToolbarToggleButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarToggleButton/useToolbarToggleButton.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useToggleButtonBase_unstable } from '@fluentui/react-button';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\nimport type {\n ToolbarToggleButtonProps,\n ToolbarToggleButtonState,\n ToolbarToggleButtonBaseProps,\n ToolbarToggleButtonBaseState,\n} from './ToolbarToggleButton.types';\n\n/**\n * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToolbarToggleButton_unstable = (\n props: ToolbarToggleButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarToggleButtonState => {\n const contextSize = useToolbarContext_unstable(ctx => ctx.size);\n const { appearance = 'subtle', size = contextSize ?? 'medium', ...baseProps } = props;\n const state = useToolbarToggleButtonBase_unstable(baseProps, ref);\n\n return {\n ...state,\n appearance,\n size,\n shape: 'rounded',\n };\n};\n\n/**\n * Base hook that builds Toolbar ToggleButton state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToolbarToggleButtonBase_unstable = (\n props: ToolbarToggleButtonBaseProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarToggleButtonBaseState => {\n const handleToggleButton = useToolbarContext_unstable(ctx => ctx.handleToggleButton);\n const checked = useToolbarContext_unstable(ctx => !!ctx.checkedValues[props.name]?.includes(props.value));\n\n const { onClick: onClickOriginal } = props;\n const toggleButtonState = useToggleButtonBase_unstable({ checked, ...props }, ref);\n const state: ToolbarToggleButtonBaseState = {\n ...toggleButtonState,\n name: props.name,\n value: props.value,\n };\n\n const handleOnClick = (\n e: React.MouseEvent<HTMLButtonElement, MouseEvent> & React.MouseEvent<HTMLAnchorElement, MouseEvent>,\n ) => {\n if (state.disabled || state.disabledFocusable) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n handleToggleButton?.(e, state.name, state.value, state.checked);\n onClickOriginal?.(e);\n };\n\n state.root.onClick = handleOnClick;\n return state;\n};\n"],"names":["useToggleButtonBase_unstable","useToolbarContext_unstable","useToolbarToggleButton_unstable","props","ref","contextSize","ctx","size","appearance","baseProps","state","useToolbarToggleButtonBase_unstable","shape","handleToggleButton","checked","checkedValues","name","includes","value","onClick","onClickOriginal","toggleButtonState","handleOnClick","e","disabled","disabledFocusable","preventDefault","stopPropagation","root"],"mappings":"AAAA;AAGA,SAASA,4BAA4B,QAAQ,yBAAyB;AACtE,SAASC,0BAA0B,QAAQ,4BAA4B;AAQvE;;;;;CAKC,GACD,OAAO,MAAMC,kCAAkC,CAC7CC,OACAC;IAEA,MAAMC,cAAcJ,2BAA2BK,CAAAA,MAAOA,IAAIC,IAAI;IAC9D,MAAM,EAAEC,aAAa,QAAQ,EAAED,OAAOF,wBAAAA,yBAAAA,cAAe,QAAQ,EAAE,GAAGI,WAAW,GAAGN;IAChF,MAAMO,QAAQC,oCAAoCF,WAAWL;IAE7D,OAAO;QACL,GAAGM,KAAK;QACRF;QACAD;QACAK,OAAO;IACT;AACF,EAAE;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMD,sCAAsC,CACjDR,OACAC;IAEA,MAAMS,qBAAqBZ,2BAA2BK,CAAAA,MAAOA,IAAIO,kBAAkB;IACnF,MAAMC,UAAUb,2BAA2BK,CAAAA;YAASA;eAAF,CAAC,GAACA,gCAAAA,IAAIS,aAAa,CAACZ,MAAMa,IAAI,CAAC,cAA7BV,oDAAAA,8BAA+BW,QAAQ,CAACd,MAAMe,KAAK;;IAEvG,MAAM,EAAEC,SAASC,eAAe,EAAE,GAAGjB;IACrC,MAAMkB,oBAAoBrB,6BAA6B;QAAEc;QAAS,GAAGX,KAAK;IAAC,GAAGC;IAC9E,MAAMM,QAAsC;QAC1C,GAAGW,iBAAiB;QACpBL,MAAMb,MAAMa,IAAI;QAChBE,OAAOf,MAAMe,KAAK;IACpB;IAEA,MAAMI,gBAAgB,CACpBC;QAEA,IAAIb,MAAMc,QAAQ,IAAId,MAAMe,iBAAiB,EAAE;YAC7CF,EAAEG,cAAc;YAChBH,EAAEI,eAAe;YACjB;QACF;QAEAd,+BAAAA,yCAAAA,mBAAqBU,GAAGb,MAAMM,IAAI,EAAEN,MAAMQ,KAAK,EAAER,MAAMI,OAAO;QAC9DM,4BAAAA,sCAAAA,gBAAkBG;IACpB;IAEAb,MAAMkB,IAAI,CAACT,OAAO,GAAGG;IACrB,OAAOZ;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarToggleButton/useToolbarToggleButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useToggleButtonStyles_unstable } from '@fluentui/react-button';\nimport { ToolbarToggleButtonState } from './ToolbarToggleButton.types';\n\nconst useBaseStyles = makeStyles({\n /* use subtle ToggleButton selected styles for Toolbar Radio selected state */\n selected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground2Selected,\n },\n\n iconSelected: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\n/**\n * Apply styling to the ToolbarToggleButton slots based on the state\n */\nexport const useToolbarToggleButtonStyles_unstable = (state: ToolbarToggleButtonState): ToolbarToggleButtonState => {\n 'use no memo';\n\n const toggleButtonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.checked && toggleButtonStyles.selected, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(state.checked && toggleButtonStyles.iconSelected, state.icon.className);\n }\n\n useToggleButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["tokens","makeStyles","mergeClasses","useToggleButtonStyles_unstable","useBaseStyles","selected","backgroundColor","colorSubtleBackgroundSelected","color","colorNeutralForeground2Selected","iconSelected","colorNeutralForeground2BrandSelected","useToolbarToggleButtonStyles_unstable","state","toggleButtonStyles","root","className","checked","icon"],"mappings":"AAAA;AAEA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,8BAA8B,QAAQ,yBAAyB;AAGxE,MAAMC,gBAAgBH,WAAW;IAC/B,4EAA4E,GAC5EI,UAAU;QACRC,iBAAiBN,OAAOO,6BAA6B;QACrDC,OAAOR,OAAOS,+BAA+B;IAC/C;IAEAC,cAAc;QACZF,OAAOR,OAAOW,oCAAoC;IACpD;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,wCAAwC,CAACC;IACpD;IAEA,MAAMC,qBAAqBV;IAE3BS,MAAME,IAAI,CAACC,SAAS,GAAGd,aAAaW,MAAMI,OAAO,IAAIH,mBAAmBT,QAAQ,EAAEQ,MAAME,IAAI,CAACC,SAAS;IAEtG,IAAIH,MAAMK,IAAI,EAAE;QACdL,MAAMK,IAAI,CAACF,SAAS,GAAGd,aAAaW,MAAMI,OAAO,IAAIH,mBAAmBJ,YAAY,EAAEG,MAAMK,IAAI,CAACF,SAAS;IAC5G;IAEAb,+BAA+BU;IAE/B,OAAOA;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarToggleButton/useToolbarToggleButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useToggleButtonStyles_unstable } from '@fluentui/react-button';\nimport type { ToolbarToggleButtonState } from './ToolbarToggleButton.types';\n\nconst useBaseStyles = makeStyles({\n /* use subtle ToggleButton selected styles for Toolbar Radio selected state */\n selected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground2Selected,\n },\n\n iconSelected: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\n/**\n * Apply styling to the ToolbarToggleButton slots based on the state\n */\nexport const useToolbarToggleButtonStyles_unstable = (state: ToolbarToggleButtonState): ToolbarToggleButtonState => {\n 'use no memo';\n\n const toggleButtonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.checked && toggleButtonStyles.selected, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(state.checked && toggleButtonStyles.iconSelected, state.icon.className);\n }\n\n useToggleButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["tokens","makeStyles","mergeClasses","useToggleButtonStyles_unstable","useBaseStyles","selected","backgroundColor","colorSubtleBackgroundSelected","color","colorNeutralForeground2Selected","iconSelected","colorNeutralForeground2BrandSelected","useToolbarToggleButtonStyles_unstable","state","toggleButtonStyles","root","className","checked","icon"],"mappings":"AAAA;AAEA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,8BAA8B,QAAQ,yBAAyB;AAGxE,MAAMC,gBAAgBH,WAAW;IAC/B,4EAA4E,GAC5EI,UAAU;QACRC,iBAAiBN,OAAOO,6BAA6B;QACrDC,OAAOR,OAAOS,+BAA+B;IAC/C;IAEAC,cAAc;QACZF,OAAOR,OAAOW,oCAAoC;IACpD;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,wCAAwC,CAACC;IACpD;IAEA,MAAMC,qBAAqBV;IAE3BS,MAAME,IAAI,CAACC,SAAS,GAAGd,aAAaW,MAAMI,OAAO,IAAIH,mBAAmBT,QAAQ,EAAEQ,MAAME,IAAI,CAACC,SAAS;IAEtG,IAAIH,MAAMK,IAAI,EAAE;QACdL,MAAMK,IAAI,CAACF,SAAS,GAAGd,aAAaW,MAAMI,OAAO,IAAIH,mBAAmBJ,YAAY,EAAEG,MAAMK,IAAI,CAACF,SAAS;IAC5G;IAEAb,+BAA+BU;IAE/B,OAAOA;AACT,EAAE"}
|
package/lib/index.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
export { Toolbar, renderToolbar_unstable, toolbarClassNames, useToolbarStyles_unstable, useToolbar_unstable, useToolbarContextValues_unstable, useToolbarContext_unstable } from './Toolbar';
|
|
2
|
-
export { ToolbarButton, useToolbarButtonStyles_unstable, useToolbarButton_unstable } from './ToolbarButton';
|
|
3
|
-
export { ToolbarDivider, useToolbarDividerStyles_unstable, useToolbarDivider_unstable } from './ToolbarDivider';
|
|
4
|
-
export { ToolbarToggleButton, useToolbarToggleButtonStyles_unstable, useToolbarToggleButton_unstable } from './ToolbarToggleButton';
|
|
5
|
-
export { ToolbarRadioButton, useToolbarRadioButtonStyles_unstable, useToolbarRadioButton_unstable } from './ToolbarRadioButton';
|
|
1
|
+
export { Toolbar, renderToolbar_unstable, toolbarClassNames, useToolbarStyles_unstable, useToolbar_unstable, useToolbarContextValues_unstable, useToolbarContext_unstable, useToolbarBase_unstable } from './Toolbar';
|
|
2
|
+
export { ToolbarButton, useToolbarButtonStyles_unstable, useToolbarButton_unstable, useToolbarButtonBase_unstable } from './ToolbarButton';
|
|
3
|
+
export { ToolbarDivider, useToolbarDividerStyles_unstable, useToolbarDivider_unstable, useToolbarDividerBase_unstable } from './ToolbarDivider';
|
|
4
|
+
export { ToolbarToggleButton, useToolbarToggleButtonStyles_unstable, useToolbarToggleButton_unstable, useToolbarToggleButtonBase_unstable } from './ToolbarToggleButton';
|
|
5
|
+
export { ToolbarRadioButton, useToolbarRadioButtonStyles_unstable, useToolbarRadioButton_unstable, useToolbarRadioButtonBase_unstable } from './ToolbarRadioButton';
|
|
6
6
|
export { ToolbarGroup, useToolbarGroupStyles_unstable, useToolbarGroup_unstable, renderToolbarGroup_unstable, toolbarGroupClassNames } from './ToolbarGroup';
|
|
7
7
|
export { ToolbarRadioGroup } from './ToolbarRadioGroup';
|
|
8
|
-
// Experimental APIs
|
|
9
|
-
// export type { ToolbarBaseState, ToolbarBaseProps } from './Toolbar';
|
|
10
|
-
// export { useToolbarBase_unstable } from './Toolbar';
|
|
11
|
-
// export type { ToolbarButtonBaseState, ToolbarButtonBaseProps } from './ToolbarButton';
|
|
12
|
-
// export { useToolbarButtonBase_unstable } from './ToolbarButton';
|
|
13
|
-
// export type { ToolbarDividerBaseState, ToolbarDividerBaseProps } from './ToolbarDivider';
|
|
14
|
-
// export { useToolbarDividerBase_unstable } from './ToolbarDivider';
|
|
15
|
-
// export type { ToolbarRadioButtonBaseState, ToolbarRadioButtonBaseProps } from './ToolbarRadioButton';
|
|
16
|
-
// export { useToolbarRadioButtonBase_unstable } from './ToolbarRadioButton';
|
|
17
|
-
// export type { ToolbarToggleButtonBaseState, ToolbarToggleButtonBaseProps } from './ToolbarToggleButton';
|
|
18
|
-
// export { useToolbarToggleButtonBase_unstable } from './ToolbarToggleButton';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Toolbar,\n renderToolbar_unstable,\n toolbarClassNames,\n useToolbarStyles_unstable,\n useToolbar_unstable,\n useToolbarContextValues_unstable,\n useToolbarContext_unstable,\n} from './Toolbar';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Toolbar,\n renderToolbar_unstable,\n toolbarClassNames,\n useToolbarStyles_unstable,\n useToolbar_unstable,\n useToolbarContextValues_unstable,\n useToolbarContext_unstable,\n useToolbarBase_unstable,\n} from './Toolbar';\nexport type {\n ToolbarContextValue,\n ToolbarContextValues,\n ToolbarProps,\n ToolbarSlots,\n ToolbarState,\n ToolbarBaseState,\n ToolbarBaseProps,\n} from './Toolbar';\nexport {\n ToolbarButton,\n useToolbarButtonStyles_unstable,\n useToolbarButton_unstable,\n useToolbarButtonBase_unstable,\n} from './ToolbarButton';\nexport type {\n ToolbarButtonProps,\n ToolbarButtonState,\n ToolbarButtonBaseState,\n ToolbarButtonBaseProps,\n} from './ToolbarButton';\nexport {\n ToolbarDivider,\n useToolbarDividerStyles_unstable,\n useToolbarDivider_unstable,\n useToolbarDividerBase_unstable,\n} from './ToolbarDivider';\nexport type {\n ToolbarDividerProps,\n ToolbarDividerState,\n ToolbarDividerBaseState,\n ToolbarDividerBaseProps,\n} from './ToolbarDivider';\nexport {\n ToolbarToggleButton,\n useToolbarToggleButtonStyles_unstable,\n useToolbarToggleButton_unstable,\n useToolbarToggleButtonBase_unstable,\n} from './ToolbarToggleButton';\nexport type {\n ToolbarToggleButtonProps,\n ToolbarToggleButtonState,\n ToolbarToggleButtonBaseState,\n ToolbarToggleButtonBaseProps,\n} from './ToolbarToggleButton';\nexport {\n ToolbarRadioButton,\n useToolbarRadioButtonStyles_unstable,\n useToolbarRadioButton_unstable,\n useToolbarRadioButtonBase_unstable,\n} from './ToolbarRadioButton';\nexport type {\n ToolbarRadioButtonProps,\n ToolbarRadioButtonState,\n ToolbarRadioButtonBaseState,\n ToolbarRadioButtonBaseProps,\n} from './ToolbarRadioButton';\nexport {\n ToolbarGroup,\n useToolbarGroupStyles_unstable,\n useToolbarGroup_unstable,\n renderToolbarGroup_unstable,\n toolbarGroupClassNames,\n} from './ToolbarGroup';\nexport type { ToolbarGroupProps, ToolbarGroupState } from './ToolbarGroup';\nexport { ToolbarRadioGroup } from './ToolbarRadioGroup';\nexport type { ToolbarRadioGroupProps, ToolbarRadioGroupState } from './ToolbarRadioGroup';\n"],"names":["Toolbar","renderToolbar_unstable","toolbarClassNames","useToolbarStyles_unstable","useToolbar_unstable","useToolbarContextValues_unstable","useToolbarContext_unstable","useToolbarBase_unstable","ToolbarButton","useToolbarButtonStyles_unstable","useToolbarButton_unstable","useToolbarButtonBase_unstable","ToolbarDivider","useToolbarDividerStyles_unstable","useToolbarDivider_unstable","useToolbarDividerBase_unstable","ToolbarToggleButton","useToolbarToggleButtonStyles_unstable","useToolbarToggleButton_unstable","useToolbarToggleButtonBase_unstable","ToolbarRadioButton","useToolbarRadioButtonStyles_unstable","useToolbarRadioButton_unstable","useToolbarRadioButtonBase_unstable","ToolbarGroup","useToolbarGroupStyles_unstable","useToolbarGroup_unstable","renderToolbarGroup_unstable","toolbarGroupClassNames","ToolbarRadioGroup"],"mappings":"AAAA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,mBAAmB,EACnBC,gCAAgC,EAChCC,0BAA0B,EAC1BC,uBAAuB,QAClB,YAAY;AAUnB,SACEC,aAAa,EACbC,+BAA+B,EAC/BC,yBAAyB,EACzBC,6BAA6B,QACxB,kBAAkB;AAOzB,SACEC,cAAc,EACdC,gCAAgC,EAChCC,0BAA0B,EAC1BC,8BAA8B,QACzB,mBAAmB;AAO1B,SACEC,mBAAmB,EACnBC,qCAAqC,EACrCC,+BAA+B,EAC/BC,mCAAmC,QAC9B,wBAAwB;AAO/B,SACEC,kBAAkB,EAClBC,oCAAoC,EACpCC,8BAA8B,EAC9BC,kCAAkC,QAC7B,uBAAuB;AAO9B,SACEC,YAAY,EACZC,8BAA8B,EAC9BC,wBAAwB,EACxBC,2BAA2B,EAC3BC,sBAAsB,QACjB,iBAAiB;AAExB,SAASC,iBAAiB,QAAQ,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/Toolbar.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ToolbarSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToolbarCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type ToolbarCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\n/**\n * Toolbar Props\n */\nexport type ToolbarProps = ComponentProps<ToolbarSlots> & {\n /**\n * Toolbar can have small or medium size\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Toolbar can be vertical styled\n * @default false\n */\n vertical?: boolean;\n\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onCheckedValueChange?: (e: ToolbarCheckedValueChangeEvent, data: ToolbarCheckedValueChangeData) => void;\n};\n\nexport type ToolbarBaseProps = Omit<ToolbarProps, 'size'>;\n\n/**\n * State used in rendering Toolbar\n */\nexport type ToolbarState = ComponentState<ToolbarSlots> &\n Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> &\n Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /*\n * Toggles the state of a ToggleButton item\n */\n handleToggleButton: ToggableHandler;\n /*\n * Toggles the state of a ToggleButton item\n */\n handleRadio: ToggableHandler;\n };\n\nexport type ToolbarBaseState = Omit<ToolbarState, 'size'>;\n\nexport type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {\n handleToggleButton?: ToggableHandler;\n handleRadio?: ToggableHandler;\n};\n\nexport type ToolbarContextValues = {\n toolbar: ToolbarContextValue;\n};\n\nexport type UninitializedToolbarState = Omit<ToolbarBaseState, 'checkedValues' | 'handleToggleButton' | 'handleRadio'> &\n Partial<Pick<ToolbarState, 'checkedValues'>>;\n\nexport type ToggableHandler = (\n e: React.MouseEvent | React.KeyboardEvent,\n name: string,\n value: string,\n checked?: boolean,\n) => void;\n"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/Toolbar.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ToolbarSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToolbarCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type ToolbarCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\n/**\n * Toolbar Props\n */\nexport type ToolbarProps = ComponentProps<ToolbarSlots> & {\n /**\n * Toolbar can have small or medium size\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Toolbar can be vertical styled\n * @default false\n */\n vertical?: boolean;\n\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onCheckedValueChange?: (e: ToolbarCheckedValueChangeEvent, data: ToolbarCheckedValueChangeData) => void;\n};\n\nexport type ToolbarBaseProps = Omit<ToolbarProps, 'size'>;\n\n/**\n * State used in rendering Toolbar\n */\nexport type ToolbarState = ComponentState<ToolbarSlots> &\n Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> &\n Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /*\n * Toggles the state of a ToggleButton item\n */\n handleToggleButton: ToggableHandler;\n /*\n * Toggles the state of a ToggleButton item\n */\n handleRadio: ToggableHandler;\n };\n\nexport type ToolbarBaseState = Omit<ToolbarState, 'size'>;\n\nexport type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {\n handleToggleButton?: ToggableHandler;\n handleRadio?: ToggableHandler;\n};\n\nexport type ToolbarContextValues = {\n toolbar: ToolbarContextValue;\n};\n\nexport type UninitializedToolbarState = Omit<ToolbarBaseState, 'checkedValues' | 'handleToggleButton' | 'handleRadio'> &\n Partial<Pick<ToolbarState, 'checkedValues'>>;\n\nexport type ToggableHandler = (\n e: React.MouseEvent | React.KeyboardEvent,\n name: string,\n value: string,\n checked?: boolean,\n) => void;\n"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/ToolbarContext.ts"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/ToolbarContext.ts"],"sourcesContent":["'use client';\n\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ToolbarContextValue } from './Toolbar.types';\n\nexport const ToolbarContext = createContext<ToolbarContextValue | undefined>(undefined) as Context<ToolbarContextValue>;\n\nconst toolbarContextDefaultValue: ToolbarContextValue = {\n size: 'medium' as 'medium',\n handleToggleButton: () => null,\n handleRadio: () => null,\n vertical: false,\n checkedValues: {},\n};\n\nexport const useToolbarContext_unstable = <T>(selector: ContextSelector<ToolbarContextValue, T>): T =>\n useContextSelector(ToolbarContext, (ctx = toolbarContextDefaultValue) => selector(ctx));\n"],"names":["createContext","useContextSelector","ToolbarContext","undefined","toolbarContextDefaultValue","size","handleToggleButton","handleRadio","vertical","checkedValues","useToolbarContext_unstable","selector","ctx"],"mappings":"AAAA;;;;;;;;;;;;kBAMaE;;;8BAUAQ;;;;sCAdqC,mCAAmC;AAI9E,MAAMR,qBAAiBF,mCAAAA,EAA+CG,WAA2C;AAExH,MAAMC,6BAAkD;IACtDC,MAAM;IACNC,oBAAoB,IAAM;IAC1BC,aAAa,IAAM;IACnBC,UAAU;IACVC,eAAe,CAAC;AAClB;AAEO,MAAMC,6BAA6B,CAAIC,eAC5CV,wCAAAA,EAAmBC,gBAAgB,CAACU,MAAMR,0BAA0B,GAAKO,SAASC,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/renderToolbar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/renderToolbar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { ToolbarBaseState, ToolbarSlots, ToolbarContextValues } from './Toolbar.types';\nimport { ToolbarContext } from './ToolbarContext';\n\n/**\n * Render the final JSX of Toolbar\n */\nexport const renderToolbar_unstable = (state: ToolbarBaseState, contextValues: ToolbarContextValues): JSXElement => {\n assertSlots<ToolbarSlots>(state);\n\n return (\n <ToolbarContext.Provider value={contextValues.toolbar}>\n <state.root>{state.root.children}</state.root>\n </ToolbarContext.Provider>\n );\n};\n"],"names":["assertSlots","ToolbarContext","renderToolbar_unstable","state","contextValues","Provider","value","toolbar","root","children"],"mappings":";;;;+BAUaE;;;;;;4BATb,gDAAiD;gCACrB,4BAA4B;gCAGzB,mBAAmB;AAK3C,+BAA+B,CAACC,OAAyBC;QAC9DJ,2BAAAA,EAA0BG;IAE1B,OAAA,WAAA,OACE,eAAA,EAACF,8BAAAA,CAAeI,QAAQ,EAAA;QAACC,OAAOF,cAAcG,OAAO;kBACnD,WAAA,OAAA,eAAA,EAACJ,MAAMK,IAAI,EAAA;sBAAEL,MAAMK,IAAI,CAACC,QAAQ;;;AAGtC,EAAE"}
|
|
@@ -20,8 +20,6 @@ _export(exports, {
|
|
|
20
20
|
return useToolbar_unstable;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
24
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
25
23
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
26
24
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
27
25
|
const useToolbar_unstable = (props, ref)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/useToolbar.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useEventCallback, useControllableState, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n ToggableHandler,\n ToolbarBaseProps,\n ToolbarBaseState,\n ToolbarProps,\n ToolbarState,\n UninitializedToolbarState,\n} from './Toolbar.types';\nimport { TabsterDOMAttribute
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/useToolbar.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useEventCallback, useControllableState, getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n ToggableHandler,\n ToolbarBaseProps,\n ToolbarBaseState,\n ToolbarProps,\n ToolbarState,\n UninitializedToolbarState,\n} from './Toolbar.types';\nimport type { TabsterDOMAttribute } from '@fluentui/react-tabster';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render Toolbar.\n *\n * The returned state can be modified with hooks such as useToolbarStyles_unstable,\n * before being passed to renderToolbar_unstable.\n *\n * @param props - props from this instance of Toolbar\n * @param ref - reference to root HTMLElement of Toolbar\n */\nexport const useToolbar_unstable = (props: ToolbarProps, ref: React.Ref<HTMLElement>): ToolbarState => {\n const { size = 'medium' } = props;\n const state = useToolbarBase_unstable(props, ref);\n const arrowNavigationProps = useToolbarArrowNavigationProps_unstable();\n\n return {\n size,\n ...state,\n root: {\n ...state.root,\n ...arrowNavigationProps,\n },\n };\n};\n\n/**\n * Base hook that builds Toolbar state for behavior and structure only.\n * It does not add arrow key navigation, which is handled by `useToolbar_unstable`.\n *\n * @internal\n * @param props - Props for this Toolbar instance.\n * @param ref - Ref to the root HTMLElement.\n */\nexport const useToolbarBase_unstable = (props: ToolbarBaseProps, ref: React.Ref<HTMLElement>): ToolbarBaseState => {\n const { vertical = false } = props;\n\n const initialState: UninitializedToolbarState = {\n vertical,\n // TODO add appropriate props/defaults\n components: {\n // TODO add each slot's element type or component\n root: 'div',\n },\n // TODO add appropriate slots, for example:\n // mySlot: resolveShorthand(props.mySlot),\n root: slot.always(\n getIntrinsicElementProps('div', {\n role: 'toolbar',\n ref: ref as React.Ref<HTMLDivElement>,\n ...(vertical && ({ 'aria-orientation': 'vertical' } as const)),\n ...props,\n }),\n { elementType: 'div' },\n ),\n };\n\n const [checkedValues, onCheckedValueChange] = useToolbarSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues: props.defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n const handleToggleButton: ToggableHandler = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked?: boolean) => {\n if (name && value) {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n onCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n }\n },\n );\n\n const handleRadio: ToggableHandler = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked?: boolean) => {\n if (name && value) {\n onCheckedValueChange?.(e, {\n name,\n checkedItems: [value],\n });\n }\n },\n );\n\n return {\n ...initialState,\n handleToggleButton,\n handleRadio,\n checkedValues: checkedValues ?? {},\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useToolbarSelectableState = (\n state: Pick<ToolbarBaseProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: state.checkedValues,\n defaultState: state.defaultCheckedValues,\n initialState: {},\n });\n const { onCheckedValueChange: onCheckedValueChangeOriginal } = state;\n const onCheckedValueChange: ToolbarBaseState['onCheckedValueChange'] = useEventCallback(\n (e, { name, checkedItems }) => {\n if (onCheckedValueChangeOriginal) {\n onCheckedValueChangeOriginal(e, { name, checkedItems });\n }\n\n setCheckedValues(s => {\n return s ? { ...s, [name]: checkedItems } : { [name]: checkedItems };\n });\n },\n );\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n\n/**\n * Hook to add arrow navigation props to the Toolbar.\n *\n * @internal\n * @returns - Tabster DOM attributes for arrow navigation\n */\nexport const useToolbarArrowNavigationProps_unstable = (): TabsterDOMAttribute => {\n return useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n });\n};\n"],"names":["useEventCallback","useControllableState","getIntrinsicElementProps","slot","useArrowNavigationGroup","useToolbar_unstable","props","ref","size","state","useToolbarBase_unstable","arrowNavigationProps","useToolbarArrowNavigationProps_unstable","root","vertical","initialState","components","always","role","elementType","checkedValues","onCheckedValueChange","useToolbarSelectableState","defaultCheckedValues","handleToggleButton","e","name","value","checked","checkedItems","newCheckedItems","splice","indexOf","push","handleRadio","setCheckedValues","defaultState","onCheckedValueChangeOriginal","s","circular","axis"],"mappings":"AAAA;;;;;;;;;;;;2CAgJaY;;;IAjGAF,uBAAAA;;;uBAvBAL;;;;gCArB0E,4BAA4B;8BAU3E,0BAA0B;AAW3D,MAAMA,sBAAsB,CAACC,OAAqBC;IACvD,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGF;IAC5B,MAAMG,QAAQC,wBAAwBJ,OAAOC;IAC7C,MAAMI,uBAAuBC;IAE7B,OAAO;QACLJ;QACA,GAAGC,KAAK;QACRI,MAAM;YACJ,GAAGJ,MAAMI,IAAI;YACb,GAAGF,oBAAoB;QACzB;IACF;AACF,EAAE;AAUK,gCAAgC,CAACL,OAAyBC;IAC/D,MAAM,EAAEO,WAAW,KAAK,EAAE,GAAGR;IAE7B,MAAMS,eAA0C;QAC9CD;QACA,sCAAsC;QACtCE,YAAY;YACV,iDAAiD;YACjDH,MAAM;QACR;QACA,2CAA2C;QAC3C,0CAA0C;QAC1CA,MAAMV,oBAAAA,CAAKc,MAAM,KACff,wCAAAA,EAAyB,OAAO;YAC9BgB,MAAM;YACNX,KAAKA;YACL,GAAIO,YAAa;gBAAE,oBAAoB;YAAW,CAAW;YAC7D,GAAGR,KAAK;QACV,IACA;YAAEa,aAAa;QAAM;IAEzB;IAEA,MAAM,CAACC,eAAeC,qBAAqB,GAAGC,0BAA0B;QACtEF,eAAed,MAAMc,aAAa;QAClCG,sBAAsBjB,MAAMiB,oBAAoB;QAChDF,sBAAsBf,MAAMe,oBAAoB;IAClD;IAEA,MAAMG,yBAAsCxB,gCAAAA,EAC1C,CAACyB,GAA2CC,MAAcC,OAAeC;QACvE,IAAIF,QAAQC,OAAO;YACjB,MAAME,eAAeT,CAAAA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,aAAe,CAACM,KAAK,AAALA,KAAS,EAAE;YAChD,MAAMI,kBAAkB;mBAAID;aAAa;YACzC,IAAID,SAAS;gBACXE,gBAAgBC,MAAM,CAACD,gBAAgBE,OAAO,CAACL,QAAQ;YACzD,OAAO;gBACLG,gBAAgBG,IAAI,CAACN;YACvB;YACAN,yBAAAA,QAAAA,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAuBI,GAAG;gBAAEC;gBAAMG,cAAcC;YAAgB;QAClE;IACF;IAGF,MAAMI,kBAA+BlC,gCAAAA,EACnC,CAACyB,GAA2CC,MAAcC,OAAeC;QACvE,IAAIF,QAAQC,OAAO;YACjBN,yBAAAA,QAAAA,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAuBI,GAAG;gBACxBC;gBACAG,cAAc;oBAACF;iBAAM;YACvB;QACF;IACF;IAGF,OAAO;QACL,GAAGZ,YAAY;QACfS;QACAU;QACAd,eAAeA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,gBAAiB,CAAC;IACnC;AACF,EAAE;AAEF;;;CAGC,GACD,MAAME,4BAA4B,CAChCb;IAEA,MAAM,CAACW,eAAee,iBAAiB,OAAGlC,oCAAAA,EAAqB;QAC7DQ,OAAOA,MAAMW,aAAa;QAC1BgB,cAAc3B,MAAMc,oBAAoB;QACxCR,cAAc,CAAC;IACjB;IACA,MAAM,EAAEM,sBAAsBgB,4BAA4B,EAAE,GAAG5B;IAC/D,MAAMY,2BAAiErB,gCAAAA,EACrE,CAACyB,GAAG,EAAEC,IAAI,EAAEG,YAAY,EAAE;QACxB,IAAIQ,8BAA8B;YAChCA,6BAA6BZ,GAAG;gBAAEC;gBAAMG;YAAa;QACvD;QAEAM,iBAAiBG,CAAAA;YACf,OAAOA,IAAI;gBAAE,GAAGA,CAAC;gBAAE,CAACZ,KAAK,EAAEG;YAAa,IAAI;gBAAE,CAACH,KAAK,EAAEG;YAAa;QACrE;IACF;IAGF,OAAO;QAACT;QAAeC;KAAqB;AAC9C;AAQO,MAAMT,0CAA0C;IACrD,WAAOR,qCAAAA,EAAwB;QAC7BmC,UAAU;QACVC,MAAM;IACR;AACF,EAAE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
@@ -8,16 +9,23 @@ Object.defineProperty(exports, "useToolbarContextValues_unstable", {
|
|
|
8
9
|
return useToolbarContextValues_unstable;
|
|
9
10
|
}
|
|
10
11
|
});
|
|
12
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
11
14
|
function useToolbarContextValues_unstable(state) {
|
|
12
15
|
const { size, handleToggleButton, vertical, checkedValues, handleRadio } = state;
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
const toolbar = _react.useMemo(()=>({
|
|
17
|
+
size,
|
|
18
|
+
vertical,
|
|
19
|
+
handleToggleButton,
|
|
20
|
+
handleRadio,
|
|
21
|
+
checkedValues
|
|
22
|
+
}), [
|
|
15
23
|
size,
|
|
16
24
|
vertical,
|
|
17
25
|
handleToggleButton,
|
|
18
26
|
handleRadio,
|
|
19
27
|
checkedValues
|
|
20
|
-
|
|
28
|
+
]);
|
|
21
29
|
return {
|
|
22
30
|
toolbar
|
|
23
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/useToolbarContextValues.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/useToolbarContextValues.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { ToolbarContextValue, ToolbarContextValues, ToolbarState } from './Toolbar.types';\n\nexport function useToolbarContextValues_unstable(state: ToolbarState): ToolbarContextValues {\n const { size, handleToggleButton, vertical, checkedValues, handleRadio } = state;\n\n const toolbar = React.useMemo<ToolbarContextValue>(\n () => ({\n size,\n vertical,\n handleToggleButton,\n handleRadio,\n checkedValues,\n }),\n [size, vertical, handleToggleButton, handleRadio, checkedValues],\n );\n\n return { toolbar };\n}\n"],"names":["React","useToolbarContextValues_unstable","state","size","handleToggleButton","vertical","checkedValues","handleRadio","toolbar","useMemo"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;AAGxB,SAASC,iCAAiCC,KAAmB;IAClE,MAAM,EAAEC,IAAI,EAAEC,kBAAkB,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,WAAW,EAAE,GAAGL;IAE3E,MAAMM,UAAUR,OAAMS,OAAO,CAC3B,IAAO,CAAA;YACLN;YACAE;YACAD;YACAG;YACAD;SACF,CAAA,EACA;QAACH;QAAME;QAAUD;QAAoBG;QAAaD;KAAc;IAGlE,OAAO;QAAEE;IAAQ;AACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Toolbar/useToolbarStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { ToolbarSlots, ToolbarState } from './Toolbar.types';\n\nexport const toolbarClassNames: SlotClassNames<ToolbarSlots> = {\n root: 'fui-Toolbar',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n padding: '4px 8px',\n },\n vertical: {\n flexDirection: 'column',\n width: 'fit-content',\n },\n small: { padding: '0px 4px' },\n medium: { padding: '4px 8px' },\n large: { padding: '4px 20px' },\n});\n\n/**\n * Apply styling to the Toolbar slots based on the state\n */\nexport const useToolbarStyles_unstable = (state: ToolbarState): ToolbarState => {\n 'use no memo';\n\n const styles = useStyles();\n const { vertical, size } = state;\n state.root.className = mergeClasses(\n toolbarClassNames.root,\n styles.root,\n vertical && styles.vertical,\n size === 'small' && !vertical && styles.small,\n size === 'medium' && !vertical && styles.medium,\n size === 'large' && !vertical && styles.large,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","toolbarClassNames","root","useStyles","display","alignItems","padding","vertical","flexDirection","width","small","medium","large","useToolbarStyles_unstable","state","styles","size","className"],"mappings":"AAAA;;;;;;;;;;;;IAMaE,iBAAAA;;;6BAyBAY;eAAAA;;;uBA5B4B,iBAAiB;AAGnD,0BAAwD;IAC7DX,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAYJ,iBAAAA,EAAW;IAC3BG,MAAM;QACJE,SAAS;QACTC,YAAY;QACZC,SAAS;IACX;IACAC,UAAU;QACRC,eAAe;QACfC,OAAO;IACT;IACAC,OAAO;QAAEJ,SAAS;IAAU;IAC5BK,QAAQ;QAAEL,SAAS;IAAU;IAC7BM,OAAO;QAAEN,SAAS;IAAW;AAC/B;AAKO,kCAAkC,CAACQ;IACxC;IAEA,MAAMC,SAASZ;IACf,MAAM,EAAEI,QAAQ,EAAES,IAAI,EAAE,GAAGF;IAC3BA,MAAMZ,IAAI,CAACe,SAAS,OAAGjB,mBAAAA,EACrBC,kBAAkBC,IAAI,EACtBa,OAAOb,IAAI,EACXK,YAAYQ,OAAOR,QAAQ,EAC3BS,SAAS,WAAW,CAACT,YAAYQ,OAAOL,KAAK,EAC7CM,SAAS,YAAY,CAACT,YAAYQ,OAAOJ,MAAM,EAC/CK,SAAS,WAAW,CAACT,YAAYQ,OAAOH,KAAK,EAC7CE,MAAMZ,IAAI,CAACe,SAAS;IAGtB,OAAOH;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Toolbar/useToolbarStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { ToolbarSlots, ToolbarState } from './Toolbar.types';\n\nexport const toolbarClassNames: SlotClassNames<ToolbarSlots> = {\n root: 'fui-Toolbar',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n padding: '4px 8px',\n },\n vertical: {\n flexDirection: 'column',\n width: 'fit-content',\n },\n small: { padding: '0px 4px' },\n medium: { padding: '4px 8px' },\n large: { padding: '4px 20px' },\n});\n\n/**\n * Apply styling to the Toolbar slots based on the state\n */\nexport const useToolbarStyles_unstable = (state: ToolbarState): ToolbarState => {\n 'use no memo';\n\n const styles = useStyles();\n const { vertical, size } = state;\n state.root.className = mergeClasses(\n toolbarClassNames.root,\n styles.root,\n vertical && styles.vertical,\n size === 'small' && !vertical && styles.small,\n size === 'medium' && !vertical && styles.medium,\n size === 'large' && !vertical && styles.large,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","toolbarClassNames","root","useStyles","display","alignItems","padding","vertical","flexDirection","width","small","medium","large","useToolbarStyles_unstable","state","styles","size","className"],"mappings":"AAAA;;;;;;;;;;;;IAMaE,iBAAAA;;;6BAyBAY;eAAAA;;;uBA5B4B,iBAAiB;AAGnD,0BAAwD;IAC7DX,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAYJ,iBAAAA,EAAW;IAC3BG,MAAM;QACJE,SAAS;QACTC,YAAY;QACZC,SAAS;IACX;IACAC,UAAU;QACRC,eAAe;QACfC,OAAO;IACT;IACAC,OAAO;QAAEJ,SAAS;IAAU;IAC5BK,QAAQ;QAAEL,SAAS;IAAU;IAC7BM,OAAO;QAAEN,SAAS;IAAW;AAC/B;AAKO,kCAAkC,CAACQ;IACxC;IAEA,MAAMC,SAASZ;IACf,MAAM,EAAEI,QAAQ,EAAES,IAAI,EAAE,GAAGF;IAC3BA,MAAMZ,IAAI,CAACe,SAAS,OAAGjB,mBAAAA,EACrBC,kBAAkBC,IAAI,EACtBa,OAAOb,IAAI,EACXK,YAAYQ,OAAOR,QAAQ,EAC3BS,SAAS,WAAW,CAACT,YAAYQ,OAAOL,KAAK,EAC7CM,SAAS,YAAY,CAACT,YAAYQ,OAAOJ,MAAM,EAC/CK,SAAS,WAAW,CAACT,YAAYQ,OAAOH,KAAK,EAC7CE,MAAMZ,IAAI,CAACe,SAAS;IAGtB,OAAOH;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarButton/ToolbarButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport { ButtonProps, ButtonSlots, ButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarButton Props\n */\nexport type ToolbarButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ButtonProps, 'disabled' | 'disabledFocusable'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n } & {\n vertical?: boolean;\n };\n\nexport type ToolbarButtonBaseProps = DistributiveOmit<ToolbarButtonProps, 'appearance'>;\n\n/**\n * State used in rendering ToolbarButton\n */\nexport type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> &\n ButtonState &\n Required<Pick<ToolbarButtonProps, 'vertical'>>;\n\nexport type ToolbarButtonBaseState = DistributiveOmit<ToolbarButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarButton/ToolbarButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonSlots, ButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarButton Props\n */\nexport type ToolbarButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ButtonProps, 'disabled' | 'disabledFocusable'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n } & {\n vertical?: boolean;\n };\n\nexport type ToolbarButtonBaseProps = DistributiveOmit<ToolbarButtonProps, 'appearance'>;\n\n/**\n * State used in rendering ToolbarButton\n */\nexport type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> &\n ButtonState &\n Required<Pick<ToolbarButtonProps, 'vertical'>>;\n\nexport type ToolbarButtonBaseState = DistributiveOmit<ToolbarButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":""}
|
|
@@ -17,13 +17,12 @@ _export(exports, {
|
|
|
17
17
|
return useToolbarButton_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
21
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
20
|
const _reactbutton = require("@fluentui/react-button");
|
|
23
21
|
const useToolbarButton_unstable = (props, ref)=>{
|
|
24
|
-
const
|
|
22
|
+
const { appearance = 'subtle', ...baseProps } = props;
|
|
23
|
+
const state = useToolbarButtonBase_unstable(baseProps, ref);
|
|
25
24
|
return {
|
|
26
|
-
appearance
|
|
25
|
+
appearance,
|
|
27
26
|
size: 'medium',
|
|
28
27
|
shape: 'rounded',
|
|
29
28
|
...state
|
|
@@ -31,11 +30,7 @@ const useToolbarButton_unstable = (props, ref)=>{
|
|
|
31
30
|
};
|
|
32
31
|
const useToolbarButtonBase_unstable = (props, ref)=>{
|
|
33
32
|
const { vertical = false, ...buttonProps } = props;
|
|
34
|
-
const state = (0, _reactbutton.
|
|
35
|
-
appearance: 'subtle',
|
|
36
|
-
...buttonProps,
|
|
37
|
-
size: 'medium'
|
|
38
|
-
}, ref);
|
|
33
|
+
const state = (0, _reactbutton.useButtonBase_unstable)(buttonProps, ref);
|
|
39
34
|
return {
|
|
40
35
|
vertical,
|
|
41
36
|
...state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarButton/useToolbarButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarButton/useToolbarButton.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useButtonBase_unstable } from '@fluentui/react-button';\nimport type {\n ToolbarButtonBaseProps,\n ToolbarButtonBaseState,\n ToolbarButtonProps,\n ToolbarButtonState,\n} from './ToolbarButton.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useToolbarButton_unstable = (\n props: ToolbarButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarButtonState => {\n const { appearance = 'subtle', ...baseProps } = props;\n const state = useToolbarButtonBase_unstable(baseProps, ref);\n\n return {\n appearance,\n size: 'medium',\n shape: 'rounded',\n ...state,\n };\n};\n\n/**\n * Base hook that builds Toolbar Button state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useToolbarButtonBase_unstable = (\n props: ToolbarButtonBaseProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarButtonBaseState => {\n const { vertical = false, ...buttonProps } = props;\n const state = useButtonBase_unstable(buttonProps, ref);\n\n return {\n vertical,\n ...state,\n };\n};\n"],"names":["useButtonBase_unstable","useToolbarButton_unstable","props","ref","appearance","baseProps","state","useToolbarButtonBase_unstable","size","shape","vertical","buttonProps"],"mappings":"AAAA;;;;;;;;;;;;IAwCaO,6BAAAA;;;6BAvBAN;;;;6BAd0B,yBAAyB;AAczD,MAAMA,4BAA4B,CACvCC,OACAC;IAEA,MAAM,EAAEC,aAAa,QAAQ,EAAE,GAAGC,WAAW,GAAGH;IAChD,MAAMI,QAAQC,8BAA8BF,WAAWF;IAEvD,OAAO;QACLC;QACAI,MAAM;QACNC,OAAO;QACP,GAAGH,KAAK;IACV;AACF,EAAE;AAUK,sCAAsC,CAC3CJ,OACAC;IAEA,MAAM,EAAEO,WAAW,KAAK,EAAE,GAAGC,aAAa,GAAGT;IAC7C,MAAMI,YAAQN,mCAAAA,EAAuBW,aAAaR;IAElD,OAAO;QACLO;QACA,GAAGJ,KAAK;IACV;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarButton/useToolbarButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useButtonStyles_unstable } from '@fluentui/react-button';\nimport { ToolbarButtonState } from './ToolbarButton.types';\n\nconst useBaseStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n verticalIcon: {\n fontSize: '24px',\n margin: '0',\n },\n});\n\n/**\n * Apply styling to the ToolbarButton slots based on the state\n */\nexport const useToolbarButtonStyles_unstable = (state: ToolbarButtonState): void => {\n 'use no memo';\n\n const buttonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.vertical && buttonStyles.vertical, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(state.vertical && buttonStyles.verticalIcon, state.icon.className);\n }\n\n useButtonStyles_unstable(state);\n};\n"],"names":["makeStyles","mergeClasses","useButtonStyles_unstable","useBaseStyles","vertical","flexDirection","verticalIcon","fontSize","margin","useToolbarButtonStyles_unstable","state","buttonStyles","root","className","icon"],"mappings":"AAAA;;;;;;;;;;;uBAEyC,iBAAiB;6BACjB,yBAAyB;AAGlE,MAAMG,oBAAgBH,iBAAAA,EAAW;IAC/BI,UAAU;QACRC,eAAe;IACjB;IACAC,cAAc;QACZC,UAAU;QACVC,QAAQ;IACV;AACF;AAKO,MAAMC,kCAAkC,CAACC;IAC9C;IAEA,MAAMC,eAAeR;IAErBO,MAAME,IAAI,CAACC,SAAS,OAAGZ,mBAAAA,EAAaS,MAAMN,QAAQ,IAAIO,aAAaP,QAAQ,EAAEM,MAAME,IAAI,CAACC,SAAS;IAEjG,IAAIH,MAAMI,IAAI,EAAE;QACdJ,MAAMI,IAAI,CAACD,SAAS,OAAGZ,mBAAAA,EAAaS,MAAMN,QAAQ,IAAIO,aAAaL,YAAY,EAAEI,MAAMI,IAAI,CAACD,SAAS;IACvG;QAEAX,qCAAAA,EAAyBQ;AAC3B,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarButton/useToolbarButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useButtonStyles_unstable } from '@fluentui/react-button';\nimport type { ToolbarButtonState } from './ToolbarButton.types';\n\nconst useBaseStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n verticalIcon: {\n fontSize: '24px',\n margin: '0',\n },\n});\n\n/**\n * Apply styling to the ToolbarButton slots based on the state\n */\nexport const useToolbarButtonStyles_unstable = (state: ToolbarButtonState): void => {\n 'use no memo';\n\n const buttonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.vertical && buttonStyles.vertical, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(state.vertical && buttonStyles.verticalIcon, state.icon.className);\n }\n\n useButtonStyles_unstable(state);\n};\n"],"names":["makeStyles","mergeClasses","useButtonStyles_unstable","useBaseStyles","vertical","flexDirection","verticalIcon","fontSize","margin","useToolbarButtonStyles_unstable","state","buttonStyles","root","className","icon"],"mappings":"AAAA;;;;;;;;;;;uBAEyC,iBAAiB;6BACjB,yBAAyB;AAGlE,MAAMG,oBAAgBH,iBAAAA,EAAW;IAC/BI,UAAU;QACRC,eAAe;IACjB;IACAC,cAAc;QACZC,UAAU;QACVC,QAAQ;IACV;AACF;AAKO,MAAMC,kCAAkC,CAACC;IAC9C;IAEA,MAAMC,eAAeR;IAErBO,MAAME,IAAI,CAACC,SAAS,OAAGZ,mBAAAA,EAAaS,MAAMN,QAAQ,IAAIO,aAAaP,QAAQ,EAAEM,MAAME,IAAI,CAACC,SAAS;IAEjG,IAAIH,MAAMI,IAAI,EAAE;QACdJ,MAAMI,IAAI,CAACD,SAAS,OAAGZ,mBAAAA,EAAaS,MAAMN,QAAQ,IAAIO,aAAaL,YAAY,EAAEI,MAAMI,IAAI,CAACD,SAAS;IACvG;QAEAX,qCAAAA,EAAyBQ;AAC3B,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarDivider/ToolbarDivider.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { DividerSlots, DividerState } from '@fluentui/react-divider';\n\n/**\n * ToolbarDivider Props\n */\nexport type ToolbarDividerProps = ComponentProps<Partial<DividerSlots>> & {\n /**\n * A divider can be horizontal or vertical (default).\n *\n * @default true\n */\n vertical?: boolean;\n};\n\nexport type ToolbarDividerBaseProps = ToolbarDividerProps;\n\n/**\n * State used in rendering ToolbarDivider\n */\nexport type ToolbarDividerState = ComponentState<Partial<DividerSlots>> & DividerState;\n\nexport type ToolbarDividerBaseState =
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarDivider/ToolbarDivider.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { DividerSlots, DividerState, DividerBaseState } from '@fluentui/react-divider';\n\n/**\n * ToolbarDivider Props\n */\nexport type ToolbarDividerProps = ComponentProps<Partial<DividerSlots>> & {\n /**\n * A divider can be horizontal or vertical (default).\n *\n * @default true\n */\n vertical?: boolean;\n};\n\nexport type ToolbarDividerBaseProps = ToolbarDividerProps;\n\n/**\n * State used in rendering ToolbarDivider\n */\nexport type ToolbarDividerState = ComponentState<Partial<DividerSlots>> & DividerState;\n\nexport type ToolbarDividerBaseState = ComponentState<Partial<DividerSlots>> & DividerBaseState;\n"],"names":[],"mappings":""}
|
|
@@ -17,20 +17,20 @@ _export(exports, {
|
|
|
17
17
|
return useToolbarDivider_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
21
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
20
|
const _reactdivider = require("@fluentui/react-divider");
|
|
23
21
|
const _ToolbarContext = require("../Toolbar/ToolbarContext");
|
|
24
22
|
const useToolbarDivider_unstable = (props, ref)=>{
|
|
25
23
|
const state = useToolbarDividerBase_unstable(props, ref);
|
|
26
24
|
return {
|
|
27
|
-
|
|
28
|
-
appearance: 'default'
|
|
25
|
+
alignContent: 'center',
|
|
26
|
+
appearance: 'default',
|
|
27
|
+
inset: false,
|
|
28
|
+
...state
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
const useToolbarDividerBase_unstable = (props, ref)=>{
|
|
32
32
|
const vertical = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>ctx.vertical);
|
|
33
|
-
return (0, _reactdivider.
|
|
33
|
+
return (0, _reactdivider.useDividerBase_unstable)({
|
|
34
34
|
vertical: !vertical,
|
|
35
35
|
...props
|
|
36
36
|
}, ref);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarDivider/useToolbarDivider.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type {\n ToolbarDividerBaseProps,\n ToolbarDividerBaseState,\n ToolbarDividerProps,\n ToolbarDividerState,\n} from './ToolbarDivider.types';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarDivider/useToolbarDivider.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport type {\n ToolbarDividerBaseProps,\n ToolbarDividerBaseState,\n ToolbarDividerProps,\n ToolbarDividerState,\n} from './ToolbarDivider.types';\nimport { useDividerBase_unstable } from '@fluentui/react-divider';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * Create the state required to render ToolbarDivider.\n *\n * The returned state can be modified with hooks such as useToolbarDividerStyles_unstable,\n * before being passed to renderToolbar_unstable.\n *\n * @param props - props from this instance of ToolbarDivider\n * @param ref - reference to root HTMLElement of ToolbarDivider\n */\nexport const useToolbarDivider_unstable = (\n props: ToolbarDividerProps,\n ref: React.Ref<HTMLElement>,\n): ToolbarDividerState => {\n const state = useToolbarDividerBase_unstable(props, ref);\n return {\n alignContent: 'center',\n appearance: 'default',\n inset: false,\n ...state,\n };\n};\n\n/**\n * Base hook that builds ToolbarDivider state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - props from this instance of ToolbarDivider\n * @param ref - reference to root HTMLElement of ToolbarDivider\n */\nexport const useToolbarDividerBase_unstable = (\n props: ToolbarDividerBaseProps,\n ref: React.Ref<HTMLElement>,\n): ToolbarDividerBaseState => {\n const vertical = useToolbarContext_unstable(ctx => ctx.vertical);\n return useDividerBase_unstable({ vertical: !vertical, ...props }, ref);\n};\n"],"names":["useDividerBase_unstable","useToolbarContext_unstable","useToolbarDivider_unstable","props","ref","state","useToolbarDividerBase_unstable","alignContent","appearance","inset","vertical","ctx"],"mappings":"AAAA;;;;;;;;;;;;IA0CaM,8BAAAA;;;8BArBAJ;;;;8BAZ2B,0BAA0B;gCACvB,4BAA4B;AAWhE,MAAMA,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,QAAQC,+BAA+BH,OAAOC;IACpD,OAAO;QACLG,cAAc;QACdC,YAAY;QACZC,OAAO;QACP,GAAGJ,KAAK;IACV;AACF,EAAE;AAUK,uCAAuC,CAC5CF,OACAC;IAEA,MAAMM,eAAWT,0CAAAA,EAA2BU,CAAAA,MAAOA,IAAID,QAAQ;IAC/D,WAAOV,qCAAAA,EAAwB;QAAEU,UAAU,CAACA;QAAU,GAAGP,KAAK;IAAC,GAAGC;AACpE,EAAE"}
|
|
@@ -17,8 +17,6 @@ _export(exports, {
|
|
|
17
17
|
return useToolbarGroup_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
21
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
20
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
23
21
|
const _ToolbarContext = require("../Toolbar/ToolbarContext");
|
|
24
22
|
const useToolbarGroup_unstable = (props, ref)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarGroup/useToolbarGroup.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport type { ToolbarGroupProps, ToolbarGroupState } from './ToolbarGroup.types';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * Given user props, defines default props for the Group\n * @param props - User provided props to the Group component.\n * @param ref - User provided ref to be passed to the Group component.\n */\nexport const useToolbarGroup_unstable = (\n props: ToolbarGroupProps,\n ref: React.Ref<HTMLDivElement>,\n): ToolbarGroupState => {\n return useToolbarGroupBase_unstable(props, ref);\n};\n\n/**\n * Base hook that builds Toolbar Group state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - User provided props to the Group component.\n * @param ref - User provided ref to be passed to the Group component.\n */\nexport const useToolbarGroupBase_unstable = (\n props: ToolbarGroupProps,\n ref: React.Ref<HTMLDivElement>,\n): ToolbarGroupState => {\n const vertical = useToolbarContext_unstable(ctx => ctx.vertical);\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps<React.HTMLAttributes<HTMLDivElement>>('div', {\n ref,\n role: 'presentation',\n ...props,\n }),\n { elementType: 'div' },\n ),\n vertical,\n };\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarGroup/useToolbarGroup.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\n\nimport type { ToolbarGroupProps, ToolbarGroupState } from './ToolbarGroup.types';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * Given user props, defines default props for the Group\n * @param props - User provided props to the Group component.\n * @param ref - User provided ref to be passed to the Group component.\n */\nexport const useToolbarGroup_unstable = (\n props: ToolbarGroupProps,\n ref: React.Ref<HTMLDivElement>,\n): ToolbarGroupState => {\n return useToolbarGroupBase_unstable(props, ref);\n};\n\n/**\n * Base hook that builds Toolbar Group state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\n * @param props - User provided props to the Group component.\n * @param ref - User provided ref to be passed to the Group component.\n */\nexport const useToolbarGroupBase_unstable = (\n props: ToolbarGroupProps,\n ref: React.Ref<HTMLDivElement>,\n): ToolbarGroupState => {\n const vertical = useToolbarContext_unstable(ctx => ctx.vertical);\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps<React.HTMLAttributes<HTMLDivElement>>('div', {\n ref,\n role: 'presentation',\n ...props,\n }),\n { elementType: 'div' },\n ),\n vertical,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useToolbarContext_unstable","useToolbarGroup_unstable","props","ref","useToolbarGroupBase_unstable","vertical","ctx","components","root","always","role","elementType"],"mappings":"AAAA;;;;;;;;;;;;gCA4BaM;eAAAA;;4BAfAH;;;;gCARkC,4BAA4B;gCAChC,4BAA4B;AAOhE,MAAMA,2BAA2B,CACtCC,OACAC;IAEA,OAAOC,6BAA6BF,OAAOC;AAC7C,EAAE;AAUK,qCAAqC,CAC1CD,OACAC;IAEA,MAAME,eAAWL,0CAAAA,EAA2BM,CAAAA,MAAOA,IAAID,QAAQ;IAE/D,OAAO;QACLE,YAAY;YACVC,MAAM;QACR;QACAA,MAAMT,oBAAAA,CAAKU,MAAM,KACfX,wCAAAA,EAA+D,OAAO;YACpEK;YACAO,MAAM;YACN,GAAGR,KAAK;QACV,IACA;YAAES,aAAa;QAAM;QAEvBN;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarGroup/useToolbarGroupStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nimport type { ToolbarGroupSlots, ToolbarGroupState } from './ToolbarGroup.types';\n\nexport const toolbarGroupClassNames: SlotClassNames<ToolbarGroupSlots> = {\n root: 'fui-ToolbarGroup',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n },\n vertical: {\n flexDirection: 'column',\n width: 'fit-content',\n },\n});\n\n/**\n * Apply styling to the Toolbar slots based on the state\n */\nexport const useToolbarGroupStyles_unstable = (state: ToolbarGroupState): ToolbarGroupState => {\n 'use no memo';\n\n const { vertical } = state;\n const styles = useStyles();\n\n state.root.className = mergeClasses(\n toolbarGroupClassNames.root,\n styles.root,\n vertical && styles.vertical,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","toolbarGroupClassNames","root","useStyles","display","alignItems","vertical","flexDirection","width","useToolbarGroupStyles_unstable","state","styles","className"],"mappings":"AAAA;;;;;;;;;;;;IAOaE,sBAAAA;;;IAkBAQ,8BAAAA;;;;uBAtB4B,iBAAiB;AAInD,+BAAkE;IACvEP,MAAM;AACR,EAAE;AAEF,MAAMC,gBAAYJ,iBAAAA,EAAW;IAC3BG,MAAM;QACJE,SAAS;QACTC,YAAY;IACd;IACAC,UAAU;QACRC,eAAe;QACfC,OAAO;IACT;AACF;AAKO,uCAAuC,CAACE;IAC7C;IAEA,MAAM,EAAEJ,QAAQ,EAAE,GAAGI;IACrB,MAAMC,SAASR;IAEfO,MAAMR,IAAI,CAACU,SAAS,OAAGZ,mBAAAA,EACrBC,uBAAuBC,IAAI,EAC3BS,OAAOT,IAAI,EACXI,YAAYK,OAAOL,QAAQ,EAC3BI,MAAMR,IAAI,CAACU,SAAS;IAGtB,OAAOF;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarGroup/useToolbarGroupStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nimport type { ToolbarGroupSlots, ToolbarGroupState } from './ToolbarGroup.types';\n\nexport const toolbarGroupClassNames: SlotClassNames<ToolbarGroupSlots> = {\n root: 'fui-ToolbarGroup',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n },\n vertical: {\n flexDirection: 'column',\n width: 'fit-content',\n },\n});\n\n/**\n * Apply styling to the Toolbar slots based on the state\n */\nexport const useToolbarGroupStyles_unstable = (state: ToolbarGroupState): ToolbarGroupState => {\n 'use no memo';\n\n const { vertical } = state;\n const styles = useStyles();\n\n state.root.className = mergeClasses(\n toolbarGroupClassNames.root,\n styles.root,\n vertical && styles.vertical,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","toolbarGroupClassNames","root","useStyles","display","alignItems","vertical","flexDirection","width","useToolbarGroupStyles_unstable","state","styles","className"],"mappings":"AAAA;;;;;;;;;;;;IAOaE,sBAAAA;;;IAkBAQ,8BAAAA;;;;uBAtB4B,iBAAiB;AAInD,+BAAkE;IACvEP,MAAM;AACR,EAAE;AAEF,MAAMC,gBAAYJ,iBAAAA,EAAW;IAC3BG,MAAM;QACJE,SAAS;QACTC,YAAY;IACd;IACAC,UAAU;QACRC,eAAe;QACfC,OAAO;IACT;AACF;AAKO,uCAAuC,CAACE;IAC7C;IAEA,MAAM,EAAEJ,QAAQ,EAAE,GAAGI;IACrB,MAAMC,SAASR;IAEfO,MAAMR,IAAI,CAACU,SAAS,OAAGZ,mBAAAA,EACrBC,uBAAuBC,IAAI,EAC3BS,OAAOT,IAAI,EACXI,YAAYK,OAAOL,QAAQ,EAC3BI,MAAMR,IAAI,CAACU,SAAS;IAGtB,OAAOF;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarRadioButton/ToolbarRadioButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport type { 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\nexport type ToolbarRadioButtonBaseProps = DistributiveOmit<ToolbarRadioButtonProps, 'appearance'>;\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\nexport type ToolbarRadioButtonBaseState = DistributiveOmit<ToolbarRadioButtonState, 'appearance' | 'size'>;\n"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarRadioButton/ToolbarRadioButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport type { 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\nexport type ToolbarRadioButtonBaseProps = DistributiveOmit<ToolbarRadioButtonProps, 'appearance'>;\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\nexport type ToolbarRadioButtonBaseState = DistributiveOmit<ToolbarRadioButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":""}
|
|
@@ -17,19 +17,18 @@ _export(exports, {
|
|
|
17
17
|
return useToolbarRadioButton_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
21
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
20
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
23
21
|
const _reactbutton = require("@fluentui/react-button");
|
|
24
22
|
const _ToolbarContext = require("../Toolbar/ToolbarContext");
|
|
25
23
|
const useToolbarRadioButton_unstable = (props, ref)=>{
|
|
26
|
-
const
|
|
27
|
-
const size =
|
|
28
|
-
const state = useToolbarRadioButtonBase_unstable(
|
|
24
|
+
const contextSize = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>ctx.size);
|
|
25
|
+
const { appearance = 'subtle', size = contextSize, ...baseProps } = props;
|
|
26
|
+
const state = useToolbarRadioButtonBase_unstable(baseProps, ref);
|
|
29
27
|
return {
|
|
30
28
|
...state,
|
|
31
29
|
appearance,
|
|
32
|
-
size
|
|
30
|
+
size,
|
|
31
|
+
shape: 'rounded'
|
|
33
32
|
};
|
|
34
33
|
};
|
|
35
34
|
const useToolbarRadioButtonBase_unstable = (props, ref)=>{
|
|
@@ -39,7 +38,7 @@ const useToolbarRadioButtonBase_unstable = (props, ref)=>{
|
|
|
39
38
|
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));
|
|
40
39
|
});
|
|
41
40
|
const { onClick: onClickOriginal } = props;
|
|
42
|
-
const toggleButtonState = (0, _reactbutton.
|
|
41
|
+
const toggleButtonState = (0, _reactbutton.useToggleButtonBase_unstable)({
|
|
43
42
|
checked,
|
|
44
43
|
role: 'radio',
|
|
45
44
|
'aria-checked': checked,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarRadioButton/useToolbarRadioButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarRadioButton/useToolbarRadioButton.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useToggleButtonBase_unstable } from '@fluentui/react-button';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\nimport type {\n ToolbarRadioButtonProps,\n ToolbarRadioButtonState,\n ToolbarRadioButtonBaseProps,\n ToolbarRadioButtonBaseState,\n} 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 contextSize = useToolbarContext_unstable(ctx => ctx.size);\n const { appearance = 'subtle', size = contextSize, ...baseProps } = props;\n const state = useToolbarRadioButtonBase_unstable(baseProps, ref);\n\n return {\n ...state,\n appearance,\n size,\n shape: 'rounded',\n };\n};\n\n/**\n * Base hook that builds Toolbar RadioButton state for behavior and structure only.\n * It does not provide any design-related defaults.\n *\n * @internal\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 useToolbarRadioButtonBase_unstable = (\n props: ToolbarRadioButtonBaseProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarRadioButtonBaseState => {\n const handleRadio = useToolbarContext_unstable(ctx => ctx.handleRadio);\n const checked = useToolbarContext_unstable(ctx => !!ctx.checkedValues[props.name]?.includes(props.value));\n\n const { onClick: onClickOriginal } = props;\n const toggleButtonState = useToggleButtonBase_unstable(\n { checked, role: 'radio', 'aria-checked': checked, ...props },\n ref,\n );\n const state: ToolbarRadioButtonBaseState = {\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\n return state;\n};\n"],"names":["useEventCallback","useToggleButtonBase_unstable","useToolbarContext_unstable","useToolbarRadioButton_unstable","props","ref","contextSize","ctx","size","appearance","baseProps","state","useToolbarRadioButtonBase_unstable","shape","handleRadio","checked","checkedValues","name","includes","value","onClick","onClickOriginal","toggleButtonState","role","handleOnClick","e","root","undefined"],"mappings":"AAAA;;;;;;;;;;;;IA2CaY,kCAAAA;;;kCAxBAT;;;;gCAhBoB,4BAA4B;6BAChB,yBAAyB;gCAC3B,4BAA4B;AAchE,MAAMA,iCAAiC,CAC5CC,OACAC;IAEA,MAAMC,kBAAcJ,0CAAAA,EAA2BK,CAAAA,MAAOA,IAAIC,IAAI;IAC9D,MAAM,EAAEC,aAAa,QAAQ,EAAED,OAAOF,WAAW,EAAE,GAAGI,WAAW,GAAGN;IACpE,MAAMO,QAAQC,mCAAmCF,WAAWL;IAE5D,OAAO;QACL,GAAGM,KAAK;QACRF;QACAD;QACAK,OAAO;IACT;AACF,EAAE;AAUK,2CAA2C,CAChDT,OACAC;IAEA,MAAMS,kBAAcZ,0CAAAA,EAA2BK,CAAAA,MAAOA,IAAIO,WAAW;IACrE,MAAMC,cAAUb,0CAAAA,EAA2BK,CAAAA;YAASA;eAAF,CAAC,CAAA,CAACA,AAAD,iCAACA,IAAIS,aAAa,CAACZ,MAAMa,KAAI,AAAC,MAAA,QAA7BV,kCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,8BAA+BW,QAAQ,CAACd,MAAMe,MAAK;;IAEvG,MAAM,EAAEC,SAASC,eAAe,EAAE,GAAGjB;IACrC,MAAMkB,wBAAoBrB,yCAAAA,EACxB;QAAEc;QAASQ,MAAM;QAAS,gBAAgBR;QAAS,GAAGX,KAAK;IAAC,GAC5DC;IAEF,MAAMM,QAAqC;QACzC,GAAGW,iBAAiB;QACpBL,MAAMb,MAAMa,IAAI;QAChBE,OAAOf,MAAMe,KAAK;IACpB;IAEA,MAAMK,oBAAgBxB,gCAAAA,EACpB,CAACyB;QACCX,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAcW,GAAGd,MAAMM,IAAI,EAAEN,MAAMQ,KAAK,EAAER,MAAMI,OAAO;QACvDM,oBAAAA,QAAAA,oBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,gBAAkBI;IACpB;IAEFd,MAAMe,IAAI,CAAC,eAAe,GAAGC;IAC7BhB,MAAMe,IAAI,CAACN,OAAO,GAAGI;IAErB,OAAOb;AACT,EAAE"}
|
package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButtonStyles.styles.raw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarRadioButton/useToolbarRadioButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useToggleButtonStyles_unstable } from '@fluentui/react-button';\nimport { ToolbarRadioButtonState } from './ToolbarRadioButton.types';\n\nconst useBaseStyles = makeStyles({\n /* use subtle ToggleButton selected styles for Toolbar Radio selected state */\n selected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground2Selected,\n },\n\n iconSelected: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\n/**\n * Apply styling to the ToolbarRadioButton slots based on the state\n */\nexport const useToolbarRadioButtonStyles_unstable = (state: ToolbarRadioButtonState): ToolbarRadioButtonState => {\n 'use no memo';\n\n const toggleButtonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.checked && toggleButtonStyles.selected, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(state.checked && toggleButtonStyles.iconSelected, state.icon.className);\n }\n\n useToggleButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["tokens","makeStyles","mergeClasses","useToggleButtonStyles_unstable","useBaseStyles","selected","backgroundColor","colorSubtleBackgroundSelected","color","colorNeutralForeground2Selected","iconSelected","colorNeutralForeground2BrandSelected","useToolbarRadioButtonStyles_unstable","state","toggleButtonStyles","root","className","checked","icon"],"mappings":"AAAA;;;;;;;;;;;4BAEuB,wBAAwB;uBACN,iBAAiB;6BACX,yBAAyB;AAGxE,MAAMI,oBAAgBH,iBAAAA,EAAW;IAC/B,4EAA4E,GAC5EI,UAAU;QACRC,iBAAiBN,kBAAAA,CAAOO,6BAA6B;QACrDC,OAAOR,kBAAAA,CAAOS,+BAA+B;IAC/C;IAEAC,cAAc;QACZF,OAAOR,kBAAAA,CAAOW,oCAAoC;IACpD;AACF;AAKO,MAAMC,uCAAuC,CAACC;IACnD;IAEA,MAAMC,qBAAqBV;IAE3BS,MAAME,IAAI,CAACC,SAAS,GAAGd,uBAAAA,EAAaW,MAAMI,OAAO,IAAIH,mBAAmBT,QAAQ,EAAEQ,MAAME,IAAI,CAACC,SAAS;IAEtG,IAAIH,MAAMK,IAAI,EAAE;QACdL,MAAMK,IAAI,CAACF,SAAS,OAAGd,mBAAAA,EAAaW,MAAMI,OAAO,IAAIH,mBAAmBJ,YAAY,EAAEG,MAAMK,IAAI,CAACF,SAAS;IAC5G;QAEAb,2CAAAA,EAA+BU;IAE/B,OAAOA;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarRadioButton/useToolbarRadioButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useToggleButtonStyles_unstable } from '@fluentui/react-button';\nimport type { ToolbarRadioButtonState } from './ToolbarRadioButton.types';\n\nconst useBaseStyles = makeStyles({\n /* use subtle ToggleButton selected styles for Toolbar Radio selected state */\n selected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground2Selected,\n },\n\n iconSelected: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\n/**\n * Apply styling to the ToolbarRadioButton slots based on the state\n */\nexport const useToolbarRadioButtonStyles_unstable = (state: ToolbarRadioButtonState): ToolbarRadioButtonState => {\n 'use no memo';\n\n const toggleButtonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.checked && toggleButtonStyles.selected, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(state.checked && toggleButtonStyles.iconSelected, state.icon.className);\n }\n\n useToggleButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["tokens","makeStyles","mergeClasses","useToggleButtonStyles_unstable","useBaseStyles","selected","backgroundColor","colorSubtleBackgroundSelected","color","colorNeutralForeground2Selected","iconSelected","colorNeutralForeground2BrandSelected","useToolbarRadioButtonStyles_unstable","state","toggleButtonStyles","root","className","checked","icon"],"mappings":"AAAA;;;;;;;;;;;4BAEuB,wBAAwB;uBACN,iBAAiB;6BACX,yBAAyB;AAGxE,MAAMI,oBAAgBH,iBAAAA,EAAW;IAC/B,4EAA4E,GAC5EI,UAAU;QACRC,iBAAiBN,kBAAAA,CAAOO,6BAA6B;QACrDC,OAAOR,kBAAAA,CAAOS,+BAA+B;IAC/C;IAEAC,cAAc;QACZF,OAAOR,kBAAAA,CAAOW,oCAAoC;IACpD;AACF;AAKO,MAAMC,uCAAuC,CAACC;IACnD;IAEA,MAAMC,qBAAqBV;IAE3BS,MAAME,IAAI,CAACC,SAAS,GAAGd,uBAAAA,EAAaW,MAAMI,OAAO,IAAIH,mBAAmBT,QAAQ,EAAEQ,MAAME,IAAI,CAACC,SAAS;IAEtG,IAAIH,MAAMK,IAAI,EAAE;QACdL,MAAMK,IAAI,CAACF,SAAS,OAAGd,mBAAAA,EAAaW,MAAMI,OAAO,IAAIH,mBAAmBJ,YAAY,EAAEG,MAAMK,IAAI,CAACF,SAAS;IAC5G;QAEAb,2CAAAA,EAA+BU;IAE/B,OAAOA;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToolbarToggleButton/ToolbarToggleButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport type { ToggleButtonProps, ButtonSlots, ToggleButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarToggleButton Props\n */\nexport type ToolbarToggleButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n name: string;\n value: string;\n };\n\nexport type ToolbarToggleButtonBaseProps = DistributiveOmit<ToolbarToggleButtonProps, 'appearance'>;\n\n/**\n * State used in rendering ToolbarToggleButton\n */\nexport type ToolbarToggleButtonState = ComponentState<Partial<ButtonSlots>> &\n ToggleButtonState &\n Required<Pick<ToggleButtonProps, 'checked'>> &\n Pick<ToolbarToggleButtonProps, 'name' | 'value'>;\n\nexport type ToolbarToggleButtonBaseState = DistributiveOmit<ToolbarToggleButtonState, 'appearance'>;\n"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToolbarToggleButton/ToolbarToggleButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit } from '@fluentui/react-utilities';\nimport type { ToggleButtonProps, ButtonSlots, ToggleButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarToggleButton Props\n */\nexport type ToolbarToggleButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {\n appearance?: 'primary' | 'subtle' | 'transparent';\n name: string;\n value: string;\n };\n\nexport type ToolbarToggleButtonBaseProps = DistributiveOmit<ToolbarToggleButtonProps, 'appearance'>;\n\n/**\n * State used in rendering ToolbarToggleButton\n */\nexport type ToolbarToggleButtonState = ComponentState<Partial<ButtonSlots>> &\n ToggleButtonState &\n Required<Pick<ToggleButtonProps, 'checked'>> &\n Pick<ToolbarToggleButtonProps, 'name' | 'value'>;\n\nexport type ToolbarToggleButtonBaseState = DistributiveOmit<ToolbarToggleButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":""}
|
|
@@ -17,16 +17,17 @@ _export(exports, {
|
|
|
17
17
|
return useToolbarToggleButton_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
21
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
22
20
|
const _reactbutton = require("@fluentui/react-button");
|
|
23
21
|
const _ToolbarContext = require("../Toolbar/ToolbarContext");
|
|
24
22
|
const useToolbarToggleButton_unstable = (props, ref)=>{
|
|
25
|
-
const
|
|
23
|
+
const contextSize = (0, _ToolbarContext.useToolbarContext_unstable)((ctx)=>ctx.size);
|
|
24
|
+
const { appearance = 'subtle', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium', ...baseProps } = props;
|
|
26
25
|
const state = useToolbarToggleButtonBase_unstable(baseProps, ref);
|
|
27
26
|
return {
|
|
27
|
+
...state,
|
|
28
28
|
appearance,
|
|
29
|
-
|
|
29
|
+
size,
|
|
30
|
+
shape: 'rounded'
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
33
|
const useToolbarToggleButtonBase_unstable = (props, ref)=>{
|
|
@@ -36,7 +37,7 @@ const useToolbarToggleButtonBase_unstable = (props, ref)=>{
|
|
|
36
37
|
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));
|
|
37
38
|
});
|
|
38
39
|
const { onClick: onClickOriginal } = props;
|
|
39
|
-
const toggleButtonState = (0, _reactbutton.
|
|
40
|
+
const toggleButtonState = (0, _reactbutton.useToggleButtonBase_unstable)({
|
|
40
41
|
checked,
|
|
41
42
|
...props
|
|
42
43
|
}, ref);
|