@fluentui/react-checkbox 9.4.7 → 9.5.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 +14 -2
- package/lib/components/Checkbox/useCheckboxStyles.styles.raw.js +179 -0
- package/lib/components/Checkbox/useCheckboxStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Checkbox/useCheckboxStyles.styles.raw.js +195 -0
- package/lib-commonjs/components/Checkbox/useCheckboxStyles.styles.raw.js.map +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-checkbox
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 17 Jul 2025 13:45:36 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.5.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.5.0)
|
|
8
|
+
|
|
9
|
+
Thu, 17 Jul 2025 13:45:36 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-checkbox_v9.4.7..@fluentui/react-checkbox_v9.5.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: enable griffel raw styles ([PR #34853](https://github.com/microsoft/fluentui/pull/34853) by martinhochel@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-field to v9.4.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
|
|
16
|
+
- Bump @fluentui/react-label to v9.3.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
|
|
17
|
+
- Bump @fluentui/react-tabster to v9.26.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
|
|
18
|
+
|
|
7
19
|
## [9.4.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.4.7)
|
|
8
20
|
|
|
9
|
-
Fri, 11 Jul 2025 15:
|
|
21
|
+
Fri, 11 Jul 2025 15:59:24 GMT
|
|
10
22
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-checkbox_v9.4.6..@fluentui/react-checkbox_v9.4.7)
|
|
11
23
|
|
|
12
24
|
### Patches
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
|
|
2
|
+
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
|
|
3
|
+
import { tokens } from '@fluentui/react-theme';
|
|
4
|
+
export const checkboxClassNames = {
|
|
5
|
+
root: 'fui-Checkbox',
|
|
6
|
+
label: 'fui-Checkbox__label',
|
|
7
|
+
input: 'fui-Checkbox__input',
|
|
8
|
+
indicator: 'fui-Checkbox__indicator'
|
|
9
|
+
};
|
|
10
|
+
// CSS variables used internally in Checkbox's styles
|
|
11
|
+
const vars = {
|
|
12
|
+
indicatorColor: '--fui-Checkbox__indicator--color',
|
|
13
|
+
indicatorBorderColor: '--fui-Checkbox__indicator--borderColor',
|
|
14
|
+
indicatorBackgroundColor: '--fui-Checkbox__indicator--backgroundColor'
|
|
15
|
+
};
|
|
16
|
+
// The indicator size is used by the indicator and label styles
|
|
17
|
+
const indicatorSizeMedium = '16px';
|
|
18
|
+
const indicatorSizeLarge = '20px';
|
|
19
|
+
const useRootBaseClassName = makeResetStyles({
|
|
20
|
+
position: 'relative',
|
|
21
|
+
display: 'inline-flex',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
verticalAlign: 'middle',
|
|
24
|
+
color: tokens.colorNeutralForeground3,
|
|
25
|
+
...createFocusOutlineStyle({
|
|
26
|
+
style: {},
|
|
27
|
+
selector: 'focus-within'
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
const useRootStyles = makeStyles({
|
|
31
|
+
unchecked: {
|
|
32
|
+
':hover': {
|
|
33
|
+
color: tokens.colorNeutralForeground2,
|
|
34
|
+
[vars.indicatorBorderColor]: tokens.colorNeutralStrokeAccessibleHover
|
|
35
|
+
},
|
|
36
|
+
':active': {
|
|
37
|
+
color: tokens.colorNeutralForeground1,
|
|
38
|
+
[vars.indicatorBorderColor]: tokens.colorNeutralStrokeAccessiblePressed
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
checked: {
|
|
42
|
+
color: tokens.colorNeutralForeground1,
|
|
43
|
+
[vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackground,
|
|
44
|
+
[vars.indicatorColor]: tokens.colorNeutralForegroundInverted,
|
|
45
|
+
[vars.indicatorBorderColor]: tokens.colorCompoundBrandBackground,
|
|
46
|
+
':hover': {
|
|
47
|
+
[vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackgroundHover,
|
|
48
|
+
[vars.indicatorBorderColor]: tokens.colorCompoundBrandBackgroundHover
|
|
49
|
+
},
|
|
50
|
+
':active': {
|
|
51
|
+
[vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackgroundPressed,
|
|
52
|
+
[vars.indicatorBorderColor]: tokens.colorCompoundBrandBackgroundPressed
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
mixed: {
|
|
56
|
+
color: tokens.colorNeutralForeground1,
|
|
57
|
+
[vars.indicatorBorderColor]: tokens.colorCompoundBrandStroke,
|
|
58
|
+
[vars.indicatorColor]: tokens.colorCompoundBrandForeground1,
|
|
59
|
+
':hover': {
|
|
60
|
+
[vars.indicatorBorderColor]: tokens.colorCompoundBrandStrokeHover,
|
|
61
|
+
[vars.indicatorColor]: tokens.colorCompoundBrandForeground1Hover
|
|
62
|
+
},
|
|
63
|
+
':active': {
|
|
64
|
+
[vars.indicatorBorderColor]: tokens.colorCompoundBrandStrokePressed,
|
|
65
|
+
[vars.indicatorColor]: tokens.colorCompoundBrandForeground1Pressed
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
disabled: {
|
|
69
|
+
cursor: 'default',
|
|
70
|
+
color: tokens.colorNeutralForegroundDisabled,
|
|
71
|
+
[vars.indicatorBorderColor]: tokens.colorNeutralStrokeDisabled,
|
|
72
|
+
[vars.indicatorColor]: tokens.colorNeutralForegroundDisabled,
|
|
73
|
+
'@media (forced-colors: active)': {
|
|
74
|
+
color: 'GrayText',
|
|
75
|
+
[vars.indicatorColor]: 'GrayText'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const useInputBaseClassName = makeResetStyles({
|
|
80
|
+
boxSizing: 'border-box',
|
|
81
|
+
cursor: 'inherit',
|
|
82
|
+
height: '100%',
|
|
83
|
+
margin: 0,
|
|
84
|
+
opacity: 0,
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
top: 0,
|
|
87
|
+
// Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
|
|
88
|
+
// This is done so that clicking on that "empty space" still toggles the checkbox.
|
|
89
|
+
width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`
|
|
90
|
+
});
|
|
91
|
+
const useInputStyles = makeStyles({
|
|
92
|
+
before: {
|
|
93
|
+
right: 0
|
|
94
|
+
},
|
|
95
|
+
after: {
|
|
96
|
+
left: 0
|
|
97
|
+
},
|
|
98
|
+
large: {
|
|
99
|
+
width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
const useIndicatorBaseClassName = makeResetStyles({
|
|
103
|
+
alignSelf: 'flex-start',
|
|
104
|
+
boxSizing: 'border-box',
|
|
105
|
+
flexShrink: 0,
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
overflow: 'hidden',
|
|
110
|
+
color: `var(${vars.indicatorColor})`,
|
|
111
|
+
backgroundColor: `var(${vars.indicatorBackgroundColor})`,
|
|
112
|
+
borderColor: `var(${vars.indicatorBorderColor}, ${tokens.colorNeutralStrokeAccessible})`,
|
|
113
|
+
borderStyle: 'solid',
|
|
114
|
+
borderWidth: tokens.strokeWidthThin,
|
|
115
|
+
borderRadius: tokens.borderRadiusSmall,
|
|
116
|
+
margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,
|
|
117
|
+
fill: 'currentColor',
|
|
118
|
+
pointerEvents: 'none',
|
|
119
|
+
fontSize: '12px',
|
|
120
|
+
height: indicatorSizeMedium,
|
|
121
|
+
width: indicatorSizeMedium
|
|
122
|
+
});
|
|
123
|
+
const useIndicatorStyles = makeStyles({
|
|
124
|
+
large: {
|
|
125
|
+
fontSize: '16px',
|
|
126
|
+
height: indicatorSizeLarge,
|
|
127
|
+
width: indicatorSizeLarge
|
|
128
|
+
},
|
|
129
|
+
circular: {
|
|
130
|
+
borderRadius: tokens.borderRadiusCircular
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
|
134
|
+
const useLabelStyles = makeStyles({
|
|
135
|
+
base: {
|
|
136
|
+
alignSelf: 'center',
|
|
137
|
+
color: 'inherit',
|
|
138
|
+
cursor: 'inherit',
|
|
139
|
+
padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`
|
|
140
|
+
},
|
|
141
|
+
before: {
|
|
142
|
+
paddingRight: tokens.spacingHorizontalXS
|
|
143
|
+
},
|
|
144
|
+
after: {
|
|
145
|
+
paddingLeft: tokens.spacingHorizontalXS
|
|
146
|
+
},
|
|
147
|
+
// Use a (negative) margin to account for the difference between the indicator's height and the label's line height.
|
|
148
|
+
// This prevents the label from expanding the height of the checkbox, but preserves line height if the label wraps.
|
|
149
|
+
medium: {
|
|
150
|
+
marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,
|
|
151
|
+
marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`
|
|
152
|
+
},
|
|
153
|
+
large: {
|
|
154
|
+
marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,
|
|
155
|
+
marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Apply styling to the Checkbox slots based on the state
|
|
160
|
+
*/ export const useCheckboxStyles_unstable = (state)=>{
|
|
161
|
+
'use no memo';
|
|
162
|
+
const { checked, disabled, labelPosition, shape, size } = state;
|
|
163
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
164
|
+
const rootStyles = useRootStyles();
|
|
165
|
+
state.root.className = mergeClasses(checkboxClassNames.root, rootBaseClassName, disabled ? rootStyles.disabled : checked === 'mixed' ? rootStyles.mixed : checked ? rootStyles.checked : rootStyles.unchecked, state.root.className);
|
|
166
|
+
const inputBaseClassName = useInputBaseClassName();
|
|
167
|
+
const inputStyles = useInputStyles();
|
|
168
|
+
state.input.className = mergeClasses(checkboxClassNames.input, inputBaseClassName, size === 'large' && inputStyles.large, inputStyles[labelPosition], state.input.className);
|
|
169
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
|
170
|
+
const indicatorStyles = useIndicatorStyles();
|
|
171
|
+
if (state.indicator) {
|
|
172
|
+
state.indicator.className = mergeClasses(checkboxClassNames.indicator, indicatorBaseClassName, size === 'large' && indicatorStyles.large, shape === 'circular' && indicatorStyles.circular, state.indicator.className);
|
|
173
|
+
}
|
|
174
|
+
const labelStyles = useLabelStyles();
|
|
175
|
+
if (state.label) {
|
|
176
|
+
state.label.className = mergeClasses(checkboxClassNames.label, labelStyles.base, labelStyles[size], labelStyles[labelPosition], state.label.className);
|
|
177
|
+
}
|
|
178
|
+
return state;
|
|
179
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Checkbox/useCheckboxStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// CSS variables used internally in Checkbox's styles\nconst vars = {\n indicatorColor: '--fui-Checkbox__indicator--color',\n indicatorBorderColor: '--fui-Checkbox__indicator--borderColor',\n indicatorBackgroundColor: '--fui-Checkbox__indicator--backgroundColor',\n} as const;\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootBaseClassName = makeResetStyles({\n position: 'relative',\n display: 'inline-flex',\n cursor: 'pointer',\n verticalAlign: 'middle',\n color: tokens.colorNeutralForeground3,\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n unchecked: {\n ':hover': {\n color: tokens.colorNeutralForeground2,\n [vars.indicatorBorderColor]: tokens.colorNeutralStrokeAccessibleHover,\n },\n\n ':active': {\n color: tokens.colorNeutralForeground1,\n [vars.indicatorBorderColor]: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n\n checked: {\n color: tokens.colorNeutralForeground1,\n [vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackground,\n [vars.indicatorColor]: tokens.colorNeutralForegroundInverted,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandBackground,\n\n ':hover': {\n [vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackgroundHover,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandBackgroundHover,\n },\n\n ':active': {\n [vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackgroundPressed,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandBackgroundPressed,\n },\n },\n\n mixed: {\n color: tokens.colorNeutralForeground1,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandStroke,\n [vars.indicatorColor]: tokens.colorCompoundBrandForeground1,\n\n ':hover': {\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandStrokeHover,\n [vars.indicatorColor]: tokens.colorCompoundBrandForeground1Hover,\n },\n\n ':active': {\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandStrokePressed,\n [vars.indicatorColor]: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n\n disabled: {\n cursor: 'default',\n\n color: tokens.colorNeutralForegroundDisabled,\n [vars.indicatorBorderColor]: tokens.colorNeutralStrokeDisabled,\n [vars.indicatorColor]: tokens.colorNeutralForegroundDisabled,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n [vars.indicatorColor]: 'GrayText',\n },\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'inherit',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n top: 0,\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n alignSelf: 'flex-start',\n boxSizing: 'border-box',\n flexShrink: 0,\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n\n color: `var(${vars.indicatorColor})`,\n backgroundColor: `var(${vars.indicatorBackgroundColor})`,\n borderColor: `var(${vars.indicatorBorderColor}, ${tokens.colorNeutralStrokeAccessible})`,\n borderStyle: 'solid',\n borderWidth: tokens.strokeWidthThin,\n borderRadius: tokens.borderRadiusSmall,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n});\n\nconst useIndicatorStyles = makeStyles({\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: { borderRadius: tokens.borderRadiusCircular },\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n color: 'inherit',\n cursor: 'inherit',\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n\n // Use a (negative) margin to account for the difference between the indicator's height and the label's line height.\n // This prevents the label from expanding the height of the checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n 'use no memo';\n\n const { checked, disabled, labelPosition, shape, size } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n checkboxClassNames.root,\n rootBaseClassName,\n disabled\n ? rootStyles.disabled\n : checked === 'mixed'\n ? rootStyles.mixed\n : checked\n ? rootStyles.checked\n : rootStyles.unchecked,\n state.root.className,\n );\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputBaseClassName,\n size === 'large' && inputStyles.large,\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorBaseClassName,\n size === 'large' && indicatorStyles.large,\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","createFocusOutlineStyle","tokens","checkboxClassNames","root","label","input","indicator","vars","indicatorColor","indicatorBorderColor","indicatorBackgroundColor","indicatorSizeMedium","indicatorSizeLarge","useRootBaseClassName","position","display","cursor","verticalAlign","color","colorNeutralForeground3","style","selector","useRootStyles","unchecked","colorNeutralForeground2","colorNeutralStrokeAccessibleHover","colorNeutralForeground1","colorNeutralStrokeAccessiblePressed","checked","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorCompoundBrandBackgroundHover","colorCompoundBrandBackgroundPressed","mixed","colorCompoundBrandStroke","colorCompoundBrandForeground1","colorCompoundBrandStrokeHover","colorCompoundBrandForeground1Hover","colorCompoundBrandStrokePressed","colorCompoundBrandForeground1Pressed","disabled","colorNeutralForegroundDisabled","colorNeutralStrokeDisabled","useInputBaseClassName","boxSizing","height","margin","opacity","top","width","spacingHorizontalS","useInputStyles","before","right","after","left","large","useIndicatorBaseClassName","alignSelf","flexShrink","alignItems","justifyContent","overflow","backgroundColor","borderColor","colorNeutralStrokeAccessible","borderStyle","borderWidth","strokeWidthThin","borderRadius","borderRadiusSmall","spacingVerticalS","fill","pointerEvents","fontSize","useIndicatorStyles","circular","borderRadiusCircular","useLabelStyles","base","padding","paddingRight","spacingHorizontalXS","paddingLeft","medium","marginTop","lineHeightBase300","marginBottom","useCheckboxStyles_unstable","state","labelPosition","shape","size","rootBaseClassName","rootStyles","className","inputBaseClassName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AMnF,SAAS,EAAE;QACnBmF,MAAMnF,SAAS,CAACyF,SAAS,GAAGhG,aAC1BG,mBAAmBI,SAAS,EAC5B4F,wBACAN,SAAS,WAAWO,gBAAgB3C,KAAK,EACzCmC,UAAU,cAAcQ,gBAAgBvB,QAAQ,EAChDa,MAAMnF,SAAS,CAACyF,SAAS;IAE7B;IAEA,MAAMK,cAActB;IACpB,IAAIW,MAAMrF,KAAK,EAAE;QACfqF,MAAMrF,KAAK,CAAC2F,SAAS,GAAGhG,aACtBG,mBAAmBE,KAAK,EACxBgG,YAAYrB,IAAI,EAChBqB,WAAW,CAACR,KAAK,EACjBQ,WAAW,CAACV,cAAc,EAC1BD,MAAMrF,KAAK,CAAC2F,SAAS;IAEzB;IAEA,OAAON;AACT,EAAE"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
checkboxClassNames: function() {
|
|
13
|
+
return checkboxClassNames;
|
|
14
|
+
},
|
|
15
|
+
useCheckboxStyles_unstable: function() {
|
|
16
|
+
return useCheckboxStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
|
21
|
+
const _reacttheme = require("@fluentui/react-theme");
|
|
22
|
+
const checkboxClassNames = {
|
|
23
|
+
root: 'fui-Checkbox',
|
|
24
|
+
label: 'fui-Checkbox__label',
|
|
25
|
+
input: 'fui-Checkbox__input',
|
|
26
|
+
indicator: 'fui-Checkbox__indicator'
|
|
27
|
+
};
|
|
28
|
+
// CSS variables used internally in Checkbox's styles
|
|
29
|
+
const vars = {
|
|
30
|
+
indicatorColor: '--fui-Checkbox__indicator--color',
|
|
31
|
+
indicatorBorderColor: '--fui-Checkbox__indicator--borderColor',
|
|
32
|
+
indicatorBackgroundColor: '--fui-Checkbox__indicator--backgroundColor'
|
|
33
|
+
};
|
|
34
|
+
// The indicator size is used by the indicator and label styles
|
|
35
|
+
const indicatorSizeMedium = '16px';
|
|
36
|
+
const indicatorSizeLarge = '20px';
|
|
37
|
+
const useRootBaseClassName = (0, _react.makeResetStyles)({
|
|
38
|
+
position: 'relative',
|
|
39
|
+
display: 'inline-flex',
|
|
40
|
+
cursor: 'pointer',
|
|
41
|
+
verticalAlign: 'middle',
|
|
42
|
+
color: _reacttheme.tokens.colorNeutralForeground3,
|
|
43
|
+
...(0, _reacttabster.createFocusOutlineStyle)({
|
|
44
|
+
style: {},
|
|
45
|
+
selector: 'focus-within'
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
const useRootStyles = (0, _react.makeStyles)({
|
|
49
|
+
unchecked: {
|
|
50
|
+
':hover': {
|
|
51
|
+
color: _reacttheme.tokens.colorNeutralForeground2,
|
|
52
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorNeutralStrokeAccessibleHover
|
|
53
|
+
},
|
|
54
|
+
':active': {
|
|
55
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
|
56
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorNeutralStrokeAccessiblePressed
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
checked: {
|
|
60
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
|
61
|
+
[vars.indicatorBackgroundColor]: _reacttheme.tokens.colorCompoundBrandBackground,
|
|
62
|
+
[vars.indicatorColor]: _reacttheme.tokens.colorNeutralForegroundInverted,
|
|
63
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorCompoundBrandBackground,
|
|
64
|
+
':hover': {
|
|
65
|
+
[vars.indicatorBackgroundColor]: _reacttheme.tokens.colorCompoundBrandBackgroundHover,
|
|
66
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorCompoundBrandBackgroundHover
|
|
67
|
+
},
|
|
68
|
+
':active': {
|
|
69
|
+
[vars.indicatorBackgroundColor]: _reacttheme.tokens.colorCompoundBrandBackgroundPressed,
|
|
70
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorCompoundBrandBackgroundPressed
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
mixed: {
|
|
74
|
+
color: _reacttheme.tokens.colorNeutralForeground1,
|
|
75
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorCompoundBrandStroke,
|
|
76
|
+
[vars.indicatorColor]: _reacttheme.tokens.colorCompoundBrandForeground1,
|
|
77
|
+
':hover': {
|
|
78
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorCompoundBrandStrokeHover,
|
|
79
|
+
[vars.indicatorColor]: _reacttheme.tokens.colorCompoundBrandForeground1Hover
|
|
80
|
+
},
|
|
81
|
+
':active': {
|
|
82
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorCompoundBrandStrokePressed,
|
|
83
|
+
[vars.indicatorColor]: _reacttheme.tokens.colorCompoundBrandForeground1Pressed
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
disabled: {
|
|
87
|
+
cursor: 'default',
|
|
88
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled,
|
|
89
|
+
[vars.indicatorBorderColor]: _reacttheme.tokens.colorNeutralStrokeDisabled,
|
|
90
|
+
[vars.indicatorColor]: _reacttheme.tokens.colorNeutralForegroundDisabled,
|
|
91
|
+
'@media (forced-colors: active)': {
|
|
92
|
+
color: 'GrayText',
|
|
93
|
+
[vars.indicatorColor]: 'GrayText'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const useInputBaseClassName = (0, _react.makeResetStyles)({
|
|
98
|
+
boxSizing: 'border-box',
|
|
99
|
+
cursor: 'inherit',
|
|
100
|
+
height: '100%',
|
|
101
|
+
margin: 0,
|
|
102
|
+
opacity: 0,
|
|
103
|
+
position: 'absolute',
|
|
104
|
+
top: 0,
|
|
105
|
+
// Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
|
|
106
|
+
// This is done so that clicking on that "empty space" still toggles the checkbox.
|
|
107
|
+
width: `calc(${indicatorSizeMedium} + 2 * ${_reacttheme.tokens.spacingHorizontalS})`
|
|
108
|
+
});
|
|
109
|
+
const useInputStyles = (0, _react.makeStyles)({
|
|
110
|
+
before: {
|
|
111
|
+
right: 0
|
|
112
|
+
},
|
|
113
|
+
after: {
|
|
114
|
+
left: 0
|
|
115
|
+
},
|
|
116
|
+
large: {
|
|
117
|
+
width: `calc(${indicatorSizeLarge} + 2 * ${_reacttheme.tokens.spacingHorizontalS})`
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
const useIndicatorBaseClassName = (0, _react.makeResetStyles)({
|
|
121
|
+
alignSelf: 'flex-start',
|
|
122
|
+
boxSizing: 'border-box',
|
|
123
|
+
flexShrink: 0,
|
|
124
|
+
display: 'flex',
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
justifyContent: 'center',
|
|
127
|
+
overflow: 'hidden',
|
|
128
|
+
color: `var(${vars.indicatorColor})`,
|
|
129
|
+
backgroundColor: `var(${vars.indicatorBackgroundColor})`,
|
|
130
|
+
borderColor: `var(${vars.indicatorBorderColor}, ${_reacttheme.tokens.colorNeutralStrokeAccessible})`,
|
|
131
|
+
borderStyle: 'solid',
|
|
132
|
+
borderWidth: _reacttheme.tokens.strokeWidthThin,
|
|
133
|
+
borderRadius: _reacttheme.tokens.borderRadiusSmall,
|
|
134
|
+
margin: _reacttheme.tokens.spacingVerticalS + ' ' + _reacttheme.tokens.spacingHorizontalS,
|
|
135
|
+
fill: 'currentColor',
|
|
136
|
+
pointerEvents: 'none',
|
|
137
|
+
fontSize: '12px',
|
|
138
|
+
height: indicatorSizeMedium,
|
|
139
|
+
width: indicatorSizeMedium
|
|
140
|
+
});
|
|
141
|
+
const useIndicatorStyles = (0, _react.makeStyles)({
|
|
142
|
+
large: {
|
|
143
|
+
fontSize: '16px',
|
|
144
|
+
height: indicatorSizeLarge,
|
|
145
|
+
width: indicatorSizeLarge
|
|
146
|
+
},
|
|
147
|
+
circular: {
|
|
148
|
+
borderRadius: _reacttheme.tokens.borderRadiusCircular
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
|
152
|
+
const useLabelStyles = (0, _react.makeStyles)({
|
|
153
|
+
base: {
|
|
154
|
+
alignSelf: 'center',
|
|
155
|
+
color: 'inherit',
|
|
156
|
+
cursor: 'inherit',
|
|
157
|
+
padding: `${_reacttheme.tokens.spacingVerticalS} ${_reacttheme.tokens.spacingHorizontalS}`
|
|
158
|
+
},
|
|
159
|
+
before: {
|
|
160
|
+
paddingRight: _reacttheme.tokens.spacingHorizontalXS
|
|
161
|
+
},
|
|
162
|
+
after: {
|
|
163
|
+
paddingLeft: _reacttheme.tokens.spacingHorizontalXS
|
|
164
|
+
},
|
|
165
|
+
// Use a (negative) margin to account for the difference between the indicator's height and the label's line height.
|
|
166
|
+
// This prevents the label from expanding the height of the checkbox, but preserves line height if the label wraps.
|
|
167
|
+
medium: {
|
|
168
|
+
marginTop: `calc((${indicatorSizeMedium} - ${_reacttheme.tokens.lineHeightBase300}) / 2)`,
|
|
169
|
+
marginBottom: `calc((${indicatorSizeMedium} - ${_reacttheme.tokens.lineHeightBase300}) / 2)`
|
|
170
|
+
},
|
|
171
|
+
large: {
|
|
172
|
+
marginTop: `calc((${indicatorSizeLarge} - ${_reacttheme.tokens.lineHeightBase300}) / 2)`,
|
|
173
|
+
marginBottom: `calc((${indicatorSizeLarge} - ${_reacttheme.tokens.lineHeightBase300}) / 2)`
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
const useCheckboxStyles_unstable = (state)=>{
|
|
177
|
+
'use no memo';
|
|
178
|
+
const { checked, disabled, labelPosition, shape, size } = state;
|
|
179
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
180
|
+
const rootStyles = useRootStyles();
|
|
181
|
+
state.root.className = (0, _react.mergeClasses)(checkboxClassNames.root, rootBaseClassName, disabled ? rootStyles.disabled : checked === 'mixed' ? rootStyles.mixed : checked ? rootStyles.checked : rootStyles.unchecked, state.root.className);
|
|
182
|
+
const inputBaseClassName = useInputBaseClassName();
|
|
183
|
+
const inputStyles = useInputStyles();
|
|
184
|
+
state.input.className = (0, _react.mergeClasses)(checkboxClassNames.input, inputBaseClassName, size === 'large' && inputStyles.large, inputStyles[labelPosition], state.input.className);
|
|
185
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
|
186
|
+
const indicatorStyles = useIndicatorStyles();
|
|
187
|
+
if (state.indicator) {
|
|
188
|
+
state.indicator.className = (0, _react.mergeClasses)(checkboxClassNames.indicator, indicatorBaseClassName, size === 'large' && indicatorStyles.large, shape === 'circular' && indicatorStyles.circular, state.indicator.className);
|
|
189
|
+
}
|
|
190
|
+
const labelStyles = useLabelStyles();
|
|
191
|
+
if (state.label) {
|
|
192
|
+
state.label.className = (0, _react.mergeClasses)(checkboxClassNames.label, labelStyles.base, labelStyles[size], labelStyles[labelPosition], state.label.className);
|
|
193
|
+
}
|
|
194
|
+
return state;
|
|
195
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Checkbox/useCheckboxStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// CSS variables used internally in Checkbox's styles\nconst vars = {\n indicatorColor: '--fui-Checkbox__indicator--color',\n indicatorBorderColor: '--fui-Checkbox__indicator--borderColor',\n indicatorBackgroundColor: '--fui-Checkbox__indicator--backgroundColor',\n} as const;\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootBaseClassName = makeResetStyles({\n position: 'relative',\n display: 'inline-flex',\n cursor: 'pointer',\n verticalAlign: 'middle',\n color: tokens.colorNeutralForeground3,\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n unchecked: {\n ':hover': {\n color: tokens.colorNeutralForeground2,\n [vars.indicatorBorderColor]: tokens.colorNeutralStrokeAccessibleHover,\n },\n\n ':active': {\n color: tokens.colorNeutralForeground1,\n [vars.indicatorBorderColor]: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n\n checked: {\n color: tokens.colorNeutralForeground1,\n [vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackground,\n [vars.indicatorColor]: tokens.colorNeutralForegroundInverted,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandBackground,\n\n ':hover': {\n [vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackgroundHover,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandBackgroundHover,\n },\n\n ':active': {\n [vars.indicatorBackgroundColor]: tokens.colorCompoundBrandBackgroundPressed,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandBackgroundPressed,\n },\n },\n\n mixed: {\n color: tokens.colorNeutralForeground1,\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandStroke,\n [vars.indicatorColor]: tokens.colorCompoundBrandForeground1,\n\n ':hover': {\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandStrokeHover,\n [vars.indicatorColor]: tokens.colorCompoundBrandForeground1Hover,\n },\n\n ':active': {\n [vars.indicatorBorderColor]: tokens.colorCompoundBrandStrokePressed,\n [vars.indicatorColor]: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n\n disabled: {\n cursor: 'default',\n\n color: tokens.colorNeutralForegroundDisabled,\n [vars.indicatorBorderColor]: tokens.colorNeutralStrokeDisabled,\n [vars.indicatorColor]: tokens.colorNeutralForegroundDisabled,\n\n '@media (forced-colors: active)': {\n color: 'GrayText',\n [vars.indicatorColor]: 'GrayText',\n },\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'inherit',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n top: 0,\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n alignSelf: 'flex-start',\n boxSizing: 'border-box',\n flexShrink: 0,\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n\n color: `var(${vars.indicatorColor})`,\n backgroundColor: `var(${vars.indicatorBackgroundColor})`,\n borderColor: `var(${vars.indicatorBorderColor}, ${tokens.colorNeutralStrokeAccessible})`,\n borderStyle: 'solid',\n borderWidth: tokens.strokeWidthThin,\n borderRadius: tokens.borderRadiusSmall,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n});\n\nconst useIndicatorStyles = makeStyles({\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: { borderRadius: tokens.borderRadiusCircular },\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n color: 'inherit',\n cursor: 'inherit',\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n\n // Use a (negative) margin to account for the difference between the indicator's height and the label's line height.\n // This prevents the label from expanding the height of the checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n 'use no memo';\n\n const { checked, disabled, labelPosition, shape, size } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n checkboxClassNames.root,\n rootBaseClassName,\n disabled\n ? rootStyles.disabled\n : checked === 'mixed'\n ? rootStyles.mixed\n : checked\n ? rootStyles.checked\n : rootStyles.unchecked,\n state.root.className,\n );\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputBaseClassName,\n size === 'large' && inputStyles.large,\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorBaseClassName,\n size === 'large' && indicatorStyles.large,\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"names":["checkboxClassNames","useCheckboxStyles_unstable","root","label","input","indicator","vars","indicatorColor","indicatorBorderColor","indicatorBackgroundColor","indicatorSizeMedium","indicatorSizeLarge","useRootBaseClassName","makeResetStyles","position","display","cursor","verticalAlign","color","tokens","colorNeutralForeground3","createFocusOutlineStyle","style","selector","useRootStyles","makeStyles","unchecked","colorNeutralForeground2","colorNeutralStrokeAccessibleHover","colorNeutralForeground1","colorNeutralStrokeAccessiblePressed","checked","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorCompoundBrandBackgroundHover","colorCompoundBrandBackgroundPressed","mixed","colorCompoundBrandStroke","colorCompoundBrandForeground1","colorCompoundBrandStrokeHover","colorCompoundBrandForeground1Hover","colorCompoundBrandStrokePressed","colorCompoundBrandForeground1Pressed","disabled","colorNeutralForegroundDisabled","colorNeutralStrokeDisabled","useInputBaseClassName","boxSizing","height","margin","opacity","top","width","spacingHorizontalS","useInputStyles","before","right","after","left","large","useIndicatorBaseClassName","alignSelf","flexShrink","alignItems","justifyContent","overflow","backgroundColor","borderColor","colorNeutralStrokeAccessible","borderStyle","borderWidth","strokeWidthThin","borderRadius","borderRadiusSmall","spacingVerticalS","fill","pointerEvents","fontSize","useIndicatorStyles","circular","borderRadiusCircular","useLabelStyles","base","padding","paddingRight","spacingHorizontalXS","paddingLeft","medium","marginTop","lineHeightBase300","marginBottom","state","labelPosition","shape","size","rootBaseClassName","rootStyles","className","mergeClasses","inputBaseClassName","inputStyles","indicatorBaseClassName","indicatorStyles","labelStyles"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAAA,mBAAAA,EACtBlG,mBAAmBI,KAAK,EACxB+F,oBACAL,SAAS,WAAWM,YAAYzC,KAAK,EACrCyC,WAAW,CAACR,cAAc,EAC1BD,MAAMvF,KAAK,CAAC6F,SAAS;IAGvB,MAAMI,yBAAyBzC;IAC/B,MAAM0C,kBAAkBxB;IACxB,IAAIa,MAAMtF,SAAS,EAAE;QACnBsF,MAAMtF,SAAS,CAAC4F,SAAS,GAAGC,IAAAA,mBAAAA,EAC1BlG,mBAAmBK,SAAS,EAC5BgG,wBACAP,SAAS,WAAWQ,gBAAgB3C,KAAK,EACzCkC,UAAU,cAAcS,gBAAgBvB,QAAQ,EAChDY,MAAMtF,SAAS,CAAC4F,SAAS;IAE7B;IAEA,MAAMM,cAActB;IACpB,IAAIU,MAAMxF,KAAK,EAAE;QACfwF,MAAMxF,KAAK,CAAC8F,SAAS,GAAGC,IAAAA,mBAAAA,EACtBlG,mBAAmBG,KAAK,EACxBoG,YAAYrB,IAAI,EAChBqB,WAAW,CAACT,KAAK,EACjBS,WAAW,CAACX,cAAc,EAC1BD,MAAMxF,KAAK,CAAC8F,SAAS;IAEzB;IAEA,OAAON;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-checkbox",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"description": "Fluent UI checkbox component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"@fluentui/scripts-api-extractor": "*"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@fluentui/react-field": "^9.
|
|
21
|
+
"@fluentui/react-field": "^9.4.0",
|
|
22
22
|
"@fluentui/react-icons": "^2.0.245",
|
|
23
23
|
"@fluentui/react-jsx-runtime": "^9.1.2",
|
|
24
|
-
"@fluentui/react-label": "^9.
|
|
24
|
+
"@fluentui/react-label": "^9.3.0",
|
|
25
25
|
"@fluentui/react-shared-contexts": "^9.24.0",
|
|
26
|
-
"@fluentui/react-tabster": "^9.
|
|
26
|
+
"@fluentui/react-tabster": "^9.26.0",
|
|
27
27
|
"@fluentui/react-theme": "^9.1.24",
|
|
28
28
|
"@fluentui/react-utilities": "^9.22.0",
|
|
29
29
|
"@griffel/react": "^1.5.22",
|