@fluentui/react-migration-v8-v9 9.4.44 → 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 CHANGED
@@ -1,12 +1,22 @@
1
1
  # Change Log - @fluentui/react-migration-v8-v9
2
2
 
3
- This log was last generated on Tue, 09 Jan 2024 10:19:07 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 11 Jan 2024 09:02:15 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-migration-v8-v9_v9.5.0)
8
+
9
+ Thu, 11 Jan 2024 09:02:15 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-migration-v8-v9_v9.4.44..@fluentui/react-migration-v8-v9_v9.5.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat: implement CheckboxShim component for Checkbox migration ([PR #29968](https://github.com/microsoft/fluentui/pull/29968) by liminliu@microsoft.com)
15
+ - Bump @fluentui/react-components to v9.44.3 ([PR #30250](https://github.com/microsoft/fluentui/pull/30250) by beachball)
16
+
7
17
  ## [9.4.44](https://github.com/microsoft/fluentui/tree/@fluentui/react-migration-v8-v9_v9.4.44)
8
18
 
9
- Tue, 09 Jan 2024 10:19:07 GMT
19
+ Tue, 09 Jan 2024 10:21:34 GMT
10
20
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-migration-v8-v9_v9.4.43..@fluentui/react-migration-v8-v9_v9.4.44)
11
21
 
12
22
  ### Patches
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { BrandVariants } from '@fluentui/react-components';
4
4
  import type { ButtonProps } from '@fluentui/react-components';
5
5
  import type { IBaseButtonProps } from '@fluentui/react';
6
6
  import type { IButtonProps } from '@fluentui/react';
7
+ import { ICheckboxProps } from '@fluentui/react';
7
8
  import type { IContextualMenuItem } from '@fluentui/react';
8
9
  import type { IContextualMenuProps } from '@fluentui/react';
9
10
  import type { IPalette } from '@fluentui/react';
@@ -31,6 +32,8 @@ export declare const brandWeb: BrandVariants;
31
32
 
32
33
  export declare const ButtonShim: React_2.ForwardRefExoticComponent<IBaseButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
33
34
 
35
+ export declare const CheckboxShim: React_2.ForwardRefExoticComponent<Pick<ICheckboxProps, "label" | "title" | "className" | "key" | "disabled" | "name" | "defaultChecked" | "id" | "onChange" | "componentRef" | "styles" | "theme" | "checked" | "ariaLabel" | "required" | "ariaDescribedBy" | "ariaLabelledBy" | "ariaPositionInSet" | "ariaSetSize" | "boxSide" | "checkmarkIconProps" | "defaultIndeterminate" | "indeterminate" | "inputProps" | "onRenderLabel"> & React_2.RefAttributes<HTMLInputElement>>;
36
+
34
37
  /**
35
38
  * Possible color variant values
36
39
  */
@@ -0,0 +1,9 @@
1
+ import { __styles } from '@fluentui/react-components';
2
+ export const useCheckboxStyles = /*#__PURE__*/__styles({
3
+ root: {
4
+ mc9l5x: "f22iagw"
5
+ }
6
+ }, {
7
+ d: [".f22iagw{display:flex;}"]
8
+ });
9
+ //# sourceMappingURL=Checkbox.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__styles","useCheckboxStyles","root","mc9l5x","d"],"sources":["Checkbox.styles.js"],"sourcesContent":["import { makeStyles } from '@fluentui/react-components';\nexport const useCheckboxStyles = makeStyles({\n root: {\n display: 'flex'\n }\n});\n"],"mappings":"AAAA,SAAAA,QAAA,QAA2B,4BAA4B;AACvD,OAAO,MAAMC,iBAAiB,gBAAGD,QAAA;EAAAE,IAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAIhC,CAAC"}
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+ import { classNamesFunction } from '@fluentui/react';
3
+ import { Checkbox, mergeClasses } from '@fluentui/react-components';
4
+ import { useCheckboxProps } from './shimCheckboxProps';
5
+ import { useCheckboxStyles } from './Checkbox.styles';
6
+ const getClassNames = classNamesFunction({
7
+ useStaticStyles: false
8
+ });
9
+ export const CheckboxShim = /*#__PURE__*/ React.forwardRef((props, _ref)=>{
10
+ const { className, styles: stylesV8, onRenderLabel, label, componentRef } = props;
11
+ const shimProps = useCheckboxProps(props);
12
+ const styles = getClassNames(stylesV8);
13
+ const stylesV9 = useCheckboxStyles();
14
+ const checkboxRef = _ref || /*#__PURE__*/ React.createRef();
15
+ React.useImperativeHandle(componentRef, ()=>{
16
+ var _checkboxRef_current, _checkboxRef_current1;
17
+ var _checkboxRef_current_checked, _checkboxRef_current_indeterminate;
18
+ return {
19
+ checked: (_checkboxRef_current_checked = (_checkboxRef_current = checkboxRef.current) === null || _checkboxRef_current === void 0 ? void 0 : _checkboxRef_current.checked) !== null && _checkboxRef_current_checked !== void 0 ? _checkboxRef_current_checked : false,
20
+ indeterminate: (_checkboxRef_current_indeterminate = (_checkboxRef_current1 = checkboxRef.current) === null || _checkboxRef_current1 === void 0 ? void 0 : _checkboxRef_current1.indeterminate) !== null && _checkboxRef_current_indeterminate !== void 0 ? _checkboxRef_current_indeterminate : false,
21
+ focus: ()=>{
22
+ var _checkboxRef_current;
23
+ return (_checkboxRef_current = checkboxRef.current) === null || _checkboxRef_current === void 0 ? void 0 : _checkboxRef_current.focus();
24
+ }
25
+ };
26
+ });
27
+ const defaultLabelRenderer = (checkboxProps)=>{
28
+ if (!checkboxProps) {
29
+ return null;
30
+ }
31
+ const { label: defualtLabel, title } = checkboxProps;
32
+ return defualtLabel ? /*#__PURE__*/ React.createElement("span", {
33
+ title: title,
34
+ className: styles.text
35
+ }, defualtLabel) : null;
36
+ };
37
+ if (label || onRenderLabel) {
38
+ shimProps.label = {
39
+ className: mergeClasses('ms-Checkbox-text', styles.label, styles.text),
40
+ children: onRenderLabel ? onRenderLabel(props, defaultLabelRenderer) : label
41
+ };
42
+ }
43
+ return /*#__PURE__*/ React.createElement(Checkbox, {
44
+ ...shimProps,
45
+ ref: checkboxRef,
46
+ className: mergeClasses(stylesV9.root, 'ms-Checkbox', className, styles.root),
47
+ indicator: {
48
+ className: mergeClasses('ms-Checkbox-checkbox', styles.checkbox)
49
+ }
50
+ });
51
+ });
52
+ CheckboxShim.displayName = 'CheckboxShim';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["CheckboxShim.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { classNamesFunction, ICheckboxProps, ICheckboxStyles, ICheckboxStyleProps } from '@fluentui/react';\nimport { Checkbox, mergeClasses } from '@fluentui/react-components';\nimport { useCheckboxProps } from './shimCheckboxProps';\nimport { useCheckboxStyles } from './Checkbox.styles';\n\nconst getClassNames = classNamesFunction<ICheckboxStyleProps, ICheckboxStyles>({\n useStaticStyles: false,\n});\n\nexport const CheckboxShim = React.forwardRef((props: ICheckboxProps, _ref: React.ForwardedRef<HTMLInputElement>) => {\n const { className, styles: stylesV8, onRenderLabel, label, componentRef } = props;\n const shimProps = useCheckboxProps(props);\n const styles = getClassNames(stylesV8);\n const stylesV9 = useCheckboxStyles();\n const checkboxRef = (_ref as React.RefObject<HTMLInputElement>) || React.createRef<HTMLInputElement>();\n\n React.useImperativeHandle(componentRef, () => ({\n checked: checkboxRef.current?.checked ?? false,\n indeterminate: checkboxRef.current?.indeterminate ?? false,\n focus: () => checkboxRef.current?.focus(),\n }));\n\n const defaultLabelRenderer = (checkboxProps?: ICheckboxProps): JSX.Element | null => {\n if (!checkboxProps) {\n return null;\n }\n const { label: defualtLabel, title } = checkboxProps;\n return defualtLabel ? (\n <span title={title} className={styles.text}>\n {defualtLabel}\n </span>\n ) : null;\n };\n\n if (label || onRenderLabel) {\n shimProps.label = {\n className: mergeClasses('ms-Checkbox-text', styles.label, styles.text),\n children: onRenderLabel ? onRenderLabel(props, defaultLabelRenderer) : label,\n };\n }\n\n return (\n <Checkbox\n {...shimProps}\n ref={checkboxRef}\n className={mergeClasses(stylesV9.root, 'ms-Checkbox', className, styles.root)}\n indicator={{ className: mergeClasses('ms-Checkbox-checkbox', styles.checkbox) }}\n />\n );\n});\n\nCheckboxShim.displayName = 'CheckboxShim';\n"],"names":["React","classNamesFunction","Checkbox","mergeClasses","useCheckboxProps","useCheckboxStyles","getClassNames","useStaticStyles","CheckboxShim","forwardRef","props","_ref","className","styles","stylesV8","onRenderLabel","label","componentRef","shimProps","stylesV9","checkboxRef","createRef","useImperativeHandle","checked","current","indeterminate","focus","defaultLabelRenderer","checkboxProps","defualtLabel","title","span","text","children","ref","root","indicator","checkbox","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,kBAAkB,QAA8D,kBAAkB;AAC3G,SAASC,QAAQ,EAAEC,YAAY,QAAQ,6BAA6B;AACpE,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,iBAAiB,QAAQ,oBAAoB;AAEtD,MAAMC,gBAAgBL,mBAAyD;IAC7EM,iBAAiB;AACnB;AAEA,OAAO,MAAMC,6BAAeR,MAAMS,UAAU,CAAC,CAACC,OAAuBC;IACnE,MAAM,EAAEC,SAAS,EAAEC,QAAQC,QAAQ,EAAEC,aAAa,EAAEC,KAAK,EAAEC,YAAY,EAAE,GAAGP;IAC5E,MAAMQ,YAAYd,iBAAiBM;IACnC,MAAMG,SAASP,cAAcQ;IAC7B,MAAMK,WAAWd;IACjB,MAAMe,cAAc,AAACT,sBAA8CX,MAAMqB,SAAS;IAElFrB,MAAMsB,mBAAmB,CAACL,cAAc;YAC7BG,sBACMA;YADNA,8BACMA;eAF8B;YAC7CG,SAASH,CAAAA,gCAAAA,uBAAAA,YAAYI,OAAO,cAAnBJ,2CAAAA,qBAAqBG,OAAO,cAA5BH,0CAAAA,+BAAgC;YACzCK,eAAeL,CAAAA,sCAAAA,wBAAAA,YAAYI,OAAO,cAAnBJ,4CAAAA,sBAAqBK,aAAa,cAAlCL,gDAAAA,qCAAsC;YACrDM,OAAO;oBAAMN;wBAAAA,uBAAAA,YAAYI,OAAO,cAAnBJ,2CAAAA,qBAAqBM,KAAK;;QACzC;IAAA;IAEA,MAAMC,uBAAuB,CAACC;QAC5B,IAAI,CAACA,eAAe;YAClB,OAAO;QACT;QACA,MAAM,EAAEZ,OAAOa,YAAY,EAAEC,KAAK,EAAE,GAAGF;QACvC,OAAOC,6BACL,oBAACE;YAAKD,OAAOA;YAAOlB,WAAWC,OAAOmB,IAAI;WACvCH,gBAED;IACN;IAEA,IAAIb,SAASD,eAAe;QAC1BG,UAAUF,KAAK,GAAG;YAChBJ,WAAWT,aAAa,oBAAoBU,OAAOG,KAAK,EAAEH,OAAOmB,IAAI;YACrEC,UAAUlB,gBAAgBA,cAAcL,OAAOiB,wBAAwBX;QACzE;IACF;IAEA,qBACE,oBAACd;QACE,GAAGgB,SAAS;QACbgB,KAAKd;QACLR,WAAWT,aAAagB,SAASgB,IAAI,EAAE,eAAevB,WAAWC,OAAOsB,IAAI;QAC5EC,WAAW;YAAExB,WAAWT,aAAa,wBAAwBU,OAAOwB,QAAQ;QAAE;;AAGpF,GAAG;AAEH7B,aAAa8B,WAAW,GAAG"}
@@ -0,0 +1 @@
1
+ export * from './CheckboxShim';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './CheckboxShim';\n"],"names":[],"mappings":"AAAA,cAAc,iBAAiB"}
@@ -0,0 +1,78 @@
1
+ import * as React from 'react';
2
+ import { useControllableValue } from '@fluentui/react-hooks';
3
+ import { getHTMLAttributes } from '../utils';
4
+ // https://react.fluentui.dev/?path=/docs/concepts-migration-from-v8-components-checkbox-migration--page [Link of the fluent v9 migration guide]
5
+ // https://github.com/microsoft/fluentui/blob/master/packages/react/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v8 checkbox types definition]
6
+ // https://github.com/microsoft/fluentui/blob/103b8977f8d5f8dd8c430bab46ff5308a2c76371/packages/react-components/react-checkbox/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v9 checkbox types definition]
7
+ const CHECKBOX_PROPS_V8 = new Set([
8
+ 'ariaDescribedBy',
9
+ 'ariaLabel',
10
+ 'ariaLabelledBy',
11
+ 'ariaPositionInSet',
12
+ 'ariaSetSize',
13
+ 'boxSide',
14
+ 'checked',
15
+ 'checkmarkIconProps',
16
+ 'className',
17
+ 'componentRef',
18
+ 'defaultChecked',
19
+ 'defaultIndeterminate',
20
+ 'disabled',
21
+ 'indeterminate',
22
+ 'inputProps',
23
+ 'label',
24
+ 'name',
25
+ 'onChange',
26
+ 'onRenderLabel',
27
+ 'required',
28
+ 'styles',
29
+ 'theme',
30
+ 'title'
31
+ ]);
32
+ export const useCheckboxProps = (props)=>{
33
+ const { ariaDescribedBy, ariaLabel, ariaLabelledBy, ariaPositionInSet, ariaSetSize, boxSide, checked: checkedV8, indeterminate, defaultChecked, defaultIndeterminate, disabled, inputProps, name, required, title, onChange: onChangeV8 } = props;
34
+ const [checked, setChecked] = useControllableValue(checkedV8, defaultChecked);
35
+ const [mixed, setMixed] = React.useState(indeterminate || defaultIndeterminate);
36
+ const onChange = React.useCallback((event, data)=>{
37
+ let val = checked !== undefined ? data.checked : undefined;
38
+ // Ensure the checkbox is controlled
39
+ if (checked !== undefined) {
40
+ if (mixed) {
41
+ val = checkedV8 !== undefined ? checkedV8 : defaultChecked !== undefined ? defaultChecked : val;
42
+ }
43
+ }
44
+ if (mixed) {
45
+ setMixed(mixed && !indeterminate ? false : mixed);
46
+ }
47
+ setChecked(val);
48
+ onChangeV8 === null || onChangeV8 === void 0 ? void 0 : onChangeV8(event, data.checked);
49
+ }, [
50
+ setChecked,
51
+ checked,
52
+ onChangeV8,
53
+ mixed,
54
+ indeterminate,
55
+ checkedV8,
56
+ defaultChecked
57
+ ]);
58
+ const v9Props = {
59
+ checked: mixed ? 'mixed' : checked,
60
+ defaultChecked: mixed ? 'mixed' : defaultChecked,
61
+ labelPosition: boxSide === 'end' ? 'before' : 'after',
62
+ disabled,
63
+ required,
64
+ title,
65
+ name,
66
+ onChange
67
+ };
68
+ return {
69
+ ...inputProps,
70
+ 'aria-describedby': ariaDescribedBy,
71
+ 'aria-label': ariaLabel,
72
+ 'aria-labelledby': ariaLabelledBy,
73
+ 'aria-posinset': ariaPositionInSet,
74
+ 'aria-setsize': ariaSetSize,
75
+ ...v9Props,
76
+ ...getHTMLAttributes(props, CHECKBOX_PROPS_V8)
77
+ };
78
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["shimCheckboxProps.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { ICheckboxProps } from '@fluentui/react';\nimport { CheckboxProps, CheckboxOnChangeData } from '@fluentui/react-components';\nimport { useControllableValue } from '@fluentui/react-hooks';\nimport { getHTMLAttributes } from '../utils';\n\n// https://react.fluentui.dev/?path=/docs/concepts-migration-from-v8-components-checkbox-migration--page [Link of the fluent v9 migration guide]\n// https://github.com/microsoft/fluentui/blob/master/packages/react/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v8 checkbox types definition]\n// https://github.com/microsoft/fluentui/blob/103b8977f8d5f8dd8c430bab46ff5308a2c76371/packages/react-components/react-checkbox/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v9 checkbox types definition]\n\nconst CHECKBOX_PROPS_V8: Set<string> = new Set([\n 'ariaDescribedBy',\n 'ariaLabel',\n 'ariaLabelledBy',\n 'ariaPositionInSet',\n 'ariaSetSize',\n 'boxSide',\n 'checked',\n 'checkmarkIconProps', // one case used this\n 'className',\n 'componentRef',\n 'defaultChecked',\n 'defaultIndeterminate',\n 'disabled',\n 'indeterminate',\n 'inputProps',\n 'label',\n 'name',\n 'onChange',\n 'onRenderLabel',\n 'required',\n 'styles',\n 'theme',\n 'title',\n]);\n\nexport const useCheckboxProps = (props: ICheckboxProps): CheckboxProps => {\n const {\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n ariaPositionInSet,\n ariaSetSize,\n boxSide,\n checked: checkedV8,\n indeterminate,\n defaultChecked,\n defaultIndeterminate,\n disabled,\n inputProps,\n name,\n required,\n title,\n onChange: onChangeV8,\n } = props;\n\n const [checked, setChecked] = useControllableValue(checkedV8, defaultChecked);\n const [mixed, setMixed] = React.useState(indeterminate || defaultIndeterminate);\n\n const onChange = React.useCallback(\n (event: React.ChangeEvent<HTMLElement>, data: CheckboxOnChangeData): void => {\n let val: boolean | undefined = checked !== undefined ? (data.checked as boolean) : undefined;\n // Ensure the checkbox is controlled\n if (checked !== undefined) {\n if (mixed) {\n val = checkedV8 !== undefined ? checkedV8 : defaultChecked !== undefined ? defaultChecked : val;\n }\n }\n\n if (mixed) {\n setMixed(mixed && !indeterminate ? false : mixed);\n }\n\n setChecked(val);\n onChangeV8?.(event, data.checked as boolean);\n },\n [setChecked, checked, onChangeV8, mixed, indeterminate, checkedV8, defaultChecked],\n );\n\n const v9Props: Partial<CheckboxProps> = {\n checked: mixed ? 'mixed' : checked,\n defaultChecked: mixed ? 'mixed' : defaultChecked,\n labelPosition: boxSide === 'end' ? 'before' : 'after',\n disabled,\n required,\n title,\n name,\n onChange,\n };\n\n return {\n ...inputProps, // This inputProps is specific for the input element, and the html attributes are also used here instead of props.\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-posinset': ariaPositionInSet,\n 'aria-setsize': ariaSetSize,\n ...v9Props,\n ...getHTMLAttributes(props, CHECKBOX_PROPS_V8),\n } as CheckboxProps;\n};\n"],"names":["React","useControllableValue","getHTMLAttributes","CHECKBOX_PROPS_V8","Set","useCheckboxProps","props","ariaDescribedBy","ariaLabel","ariaLabelledBy","ariaPositionInSet","ariaSetSize","boxSide","checked","checkedV8","indeterminate","defaultChecked","defaultIndeterminate","disabled","inputProps","name","required","title","onChange","onChangeV8","setChecked","mixed","setMixed","useState","useCallback","event","data","val","undefined","v9Props","labelPosition"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,iBAAiB,QAAQ,WAAW;AAE7C,gJAAgJ;AAChJ,+JAA+J;AAC/J,2NAA2N;AAE3N,MAAM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BAAmBC;QACnB,iBAAiBC;QACjB,gBAAgBC;QAChB,GAAGuB,OAAO;QACV,GAAGhC,kBAAkBI,OAAOH,kBAAkB;IAChD;AACF,EAAE"}
@@ -0,0 +1,12 @@
1
+ export function getHTMLAttributes(props, allV8PropsSet) {
2
+ const v8Props = {
3
+ ...props
4
+ };
5
+ const propsKeys = Object.keys(v8Props);
6
+ propsKeys.forEach((key)=>{
7
+ if (allV8PropsSet.has(key)) {
8
+ delete v8Props[key];
9
+ }
10
+ });
11
+ return v8Props;
12
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils.ts"],"sourcesContent":["export function getHTMLAttributes<T extends object>(props: T, allV8PropsSet: Set<string>): T {\n const v8Props: T = { ...props };\n const propsKeys: string[] = Object.keys(v8Props);\n propsKeys.forEach(key => {\n if (allV8PropsSet.has(key)) {\n delete v8Props[key as keyof typeof v8Props];\n }\n });\n return v8Props;\n}\n"],"names":["getHTMLAttributes","props","allV8PropsSet","v8Props","propsKeys","Object","keys","forEach","key","has"],"mappings":"AAAA,OAAO,SAASA,kBAAoCC,KAAQ,EAAEC,aAA0B;IACtF,MAAMC,UAAa;QAAE,GAAGF,KAAK;IAAC;IAC9B,MAAMG,YAAsBC,OAAOC,IAAI,CAACH;IACxCC,UAAUG,OAAO,CAACC,CAAAA;QAChB,IAAIN,cAAcO,GAAG,CAACD,MAAM;YAC1B,OAAOL,OAAO,CAACK,IAA4B;QAC7C;IACF;IACA,OAAOL;AACT"}
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { ActionButtonShim, ButtonShim, CommandButtonShim, CompoundButtonShim, DefaultButtonShim, MenuButtonShim, PrimaryButtonShim, shimButtonProps, ToggleButtonShim } from './components/Button/index';
2
2
  export { MenuItemShim, shimMenuProps } from './components/Menu/index';
3
3
  export { StackItemShim, StackShim } from './components/Stack/index';
4
+ export { CheckboxShim } from './components/Checkbox/index';
4
5
  export { black, blackAlpha, brandWeb, createBrandVariants, createV8Theme, createV9Theme, grey, grey14Alpha, hcButtonFace, hcButtonText, hcCanvas, hcCanvasText, hcDisabled, hcHighlight, hcHighlightText, hcHyperlink, sharedColors, white, whiteAlpha } from './components/Theme/index';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n ActionButtonShim,\n ButtonShim,\n CommandButtonShim,\n CompoundButtonShim,\n DefaultButtonShim,\n MenuButtonShim,\n PrimaryButtonShim,\n shimButtonProps,\n ToggleButtonShim,\n} from './components/Button/index';\n\nexport { MenuItemShim, shimMenuProps } from './components/Menu/index';\n\nexport { StackItemShim, StackShim } from './components/Stack/index';\n\nexport {\n black,\n blackAlpha,\n brandWeb,\n createBrandVariants,\n createV8Theme,\n createV9Theme,\n grey,\n grey14Alpha,\n hcButtonFace,\n hcButtonText,\n hcCanvas,\n hcCanvasText,\n hcDisabled,\n hcHighlight,\n hcHighlightText,\n hcHyperlink,\n sharedColors,\n white,\n whiteAlpha,\n} from './components/Theme/index';\n\nexport type {\n AlphaColors,\n ColorVariants,\n GlobalSharedColors,\n Greys,\n TextAlignment,\n TextAlignments,\n} from './components/Theme/index';\n"],"names":["ActionButtonShim","ButtonShim","CommandButtonShim","CompoundButtonShim","DefaultButtonShim","MenuButtonShim","PrimaryButtonShim","shimButtonProps","ToggleButtonShim","MenuItemShim","shimMenuProps","StackItemShim","StackShim","black","blackAlpha","brandWeb","createBrandVariants","createV8Theme","createV9Theme","grey","grey14Alpha","hcButtonFace","hcButtonText","hcCanvas","hcCanvasText","hcDisabled","hcHighlight","hcHighlightText","hcHyperlink","sharedColors","white","whiteAlpha"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB,EACjBC,eAAe,EACfC,gBAAgB,QACX,4BAA4B;AAEnC,SAASC,YAAY,EAAEC,aAAa,QAAQ,0BAA0B;AAEtE,SAASC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AAEpE,SACEC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,EACbC,IAAI,EACJC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,KAAK,EACLC,UAAU,QACL,2BAA2B"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n ActionButtonShim,\n ButtonShim,\n CommandButtonShim,\n CompoundButtonShim,\n DefaultButtonShim,\n MenuButtonShim,\n PrimaryButtonShim,\n shimButtonProps,\n ToggleButtonShim,\n} from './components/Button/index';\n\nexport { MenuItemShim, shimMenuProps } from './components/Menu/index';\n\nexport { StackItemShim, StackShim } from './components/Stack/index';\n\nexport { CheckboxShim } from './components/Checkbox/index';\n\nexport {\n black,\n blackAlpha,\n brandWeb,\n createBrandVariants,\n createV8Theme,\n createV9Theme,\n grey,\n grey14Alpha,\n hcButtonFace,\n hcButtonText,\n hcCanvas,\n hcCanvasText,\n hcDisabled,\n hcHighlight,\n hcHighlightText,\n hcHyperlink,\n sharedColors,\n white,\n whiteAlpha,\n} from './components/Theme/index';\n\nexport type {\n AlphaColors,\n ColorVariants,\n GlobalSharedColors,\n Greys,\n TextAlignment,\n TextAlignments,\n} from './components/Theme/index';\n"],"names":["ActionButtonShim","ButtonShim","CommandButtonShim","CompoundButtonShim","DefaultButtonShim","MenuButtonShim","PrimaryButtonShim","shimButtonProps","ToggleButtonShim","MenuItemShim","shimMenuProps","StackItemShim","StackShim","CheckboxShim","black","blackAlpha","brandWeb","createBrandVariants","createV8Theme","createV9Theme","grey","grey14Alpha","hcButtonFace","hcButtonText","hcCanvas","hcCanvasText","hcDisabled","hcHighlight","hcHighlightText","hcHyperlink","sharedColors","white","whiteAlpha"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB,EACjBC,eAAe,EACfC,gBAAgB,QACX,4BAA4B;AAEnC,SAASC,YAAY,EAAEC,aAAa,QAAQ,0BAA0B;AAEtE,SAASC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AAEpE,SAASC,YAAY,QAAQ,8BAA8B;AAE3D,SACEC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,EACbC,IAAI,EACJC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,KAAK,EACLC,UAAU,QACL,2BAA2B"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useCheckboxStyles", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useCheckboxStyles;
9
+ }
10
+ });
11
+ const _reactcomponents = require("@fluentui/react-components");
12
+ const useCheckboxStyles = /*#__PURE__*/ (0, _reactcomponents.__styles)({
13
+ root: {
14
+ mc9l5x: "f22iagw"
15
+ }
16
+ }, {
17
+ d: [
18
+ ".f22iagw{display:flex;}"
19
+ ]
20
+ }); //# sourceMappingURL=Checkbox.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Checkbox.styles.js"],"sourcesContent":["import { __styles } from '@fluentui/react-components';\nexport const useCheckboxStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f22iagw\"\n }\n}, {\n d: [\".f22iagw{display:flex;}\"]\n});\n//# sourceMappingURL=Checkbox.styles.js.map"],"names":["useCheckboxStyles","__styles","root","mc9l5x","d"],"mappings":";;;;+BACaA;;;eAAAA;;;iCADY;AAClB,MAAMA,oBAAoB,WAAW,GAAEC,IAAAA,yBAAQ,EAAC;IACrDC,MAAM;QACJC,QAAQ;IACV;AACF,GAAG;IACDC,GAAG;QAAC;KAA0B;AAChC,IACA,2CAA2C"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "CheckboxShim", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return CheckboxShim;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _react1 = require("@fluentui/react");
14
+ const _reactcomponents = require("@fluentui/react-components");
15
+ const _shimCheckboxProps = require("./shimCheckboxProps");
16
+ const _Checkboxstyles = require("./Checkbox.styles");
17
+ const getClassNames = (0, _react1.classNamesFunction)({
18
+ useStaticStyles: false
19
+ });
20
+ const CheckboxShim = /*#__PURE__*/ _react.forwardRef((props, _ref)=>{
21
+ const { className, styles: stylesV8, onRenderLabel, label, componentRef } = props;
22
+ const shimProps = (0, _shimCheckboxProps.useCheckboxProps)(props);
23
+ const styles = getClassNames(stylesV8);
24
+ const stylesV9 = (0, _Checkboxstyles.useCheckboxStyles)();
25
+ const checkboxRef = _ref || /*#__PURE__*/ _react.createRef();
26
+ _react.useImperativeHandle(componentRef, ()=>{
27
+ var _checkboxRef_current, _checkboxRef_current1;
28
+ var _checkboxRef_current_checked, _checkboxRef_current_indeterminate;
29
+ return {
30
+ checked: (_checkboxRef_current_checked = (_checkboxRef_current = checkboxRef.current) === null || _checkboxRef_current === void 0 ? void 0 : _checkboxRef_current.checked) !== null && _checkboxRef_current_checked !== void 0 ? _checkboxRef_current_checked : false,
31
+ indeterminate: (_checkboxRef_current_indeterminate = (_checkboxRef_current1 = checkboxRef.current) === null || _checkboxRef_current1 === void 0 ? void 0 : _checkboxRef_current1.indeterminate) !== null && _checkboxRef_current_indeterminate !== void 0 ? _checkboxRef_current_indeterminate : false,
32
+ focus: ()=>{
33
+ var _checkboxRef_current;
34
+ return (_checkboxRef_current = checkboxRef.current) === null || _checkboxRef_current === void 0 ? void 0 : _checkboxRef_current.focus();
35
+ }
36
+ };
37
+ });
38
+ const defaultLabelRenderer = (checkboxProps)=>{
39
+ if (!checkboxProps) {
40
+ return null;
41
+ }
42
+ const { label: defualtLabel, title } = checkboxProps;
43
+ return defualtLabel ? /*#__PURE__*/ _react.createElement("span", {
44
+ title: title,
45
+ className: styles.text
46
+ }, defualtLabel) : null;
47
+ };
48
+ if (label || onRenderLabel) {
49
+ shimProps.label = {
50
+ className: (0, _reactcomponents.mergeClasses)('ms-Checkbox-text', styles.label, styles.text),
51
+ children: onRenderLabel ? onRenderLabel(props, defaultLabelRenderer) : label
52
+ };
53
+ }
54
+ return /*#__PURE__*/ _react.createElement(_reactcomponents.Checkbox, {
55
+ ...shimProps,
56
+ ref: checkboxRef,
57
+ className: (0, _reactcomponents.mergeClasses)(stylesV9.root, 'ms-Checkbox', className, styles.root),
58
+ indicator: {
59
+ className: (0, _reactcomponents.mergeClasses)('ms-Checkbox-checkbox', styles.checkbox)
60
+ }
61
+ });
62
+ });
63
+ CheckboxShim.displayName = 'CheckboxShim';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["CheckboxShim.js"],"sourcesContent":["import * as React from 'react';\nimport { classNamesFunction } from '@fluentui/react';\nimport { Checkbox, mergeClasses } from '@fluentui/react-components';\nimport { useCheckboxProps } from './shimCheckboxProps';\nimport { useCheckboxStyles } from './Checkbox.styles';\nconst getClassNames = classNamesFunction({\n useStaticStyles: false\n});\nexport const CheckboxShim = /*#__PURE__*/ React.forwardRef((props, _ref)=>{\n const { className, styles: stylesV8, onRenderLabel, label, componentRef } = props;\n const shimProps = useCheckboxProps(props);\n const styles = getClassNames(stylesV8);\n const stylesV9 = useCheckboxStyles();\n const checkboxRef = _ref || /*#__PURE__*/ React.createRef();\n React.useImperativeHandle(componentRef, ()=>{\n var _checkboxRef_current, _checkboxRef_current1;\n var _checkboxRef_current_checked, _checkboxRef_current_indeterminate;\n return {\n checked: (_checkboxRef_current_checked = (_checkboxRef_current = checkboxRef.current) === null || _checkboxRef_current === void 0 ? void 0 : _checkboxRef_current.checked) !== null && _checkboxRef_current_checked !== void 0 ? _checkboxRef_current_checked : false,\n indeterminate: (_checkboxRef_current_indeterminate = (_checkboxRef_current1 = checkboxRef.current) === null || _checkboxRef_current1 === void 0 ? void 0 : _checkboxRef_current1.indeterminate) !== null && _checkboxRef_current_indeterminate !== void 0 ? _checkboxRef_current_indeterminate : false,\n focus: ()=>{\n var _checkboxRef_current;\n return (_checkboxRef_current = checkboxRef.current) === null || _checkboxRef_current === void 0 ? void 0 : _checkboxRef_current.focus();\n }\n };\n });\n const defaultLabelRenderer = (checkboxProps)=>{\n if (!checkboxProps) {\n return null;\n }\n const { label: defualtLabel, title } = checkboxProps;\n return defualtLabel ? /*#__PURE__*/ React.createElement(\"span\", {\n title: title,\n className: styles.text\n }, defualtLabel) : null;\n };\n if (label || onRenderLabel) {\n shimProps.label = {\n className: mergeClasses('ms-Checkbox-text', styles.label, styles.text),\n children: onRenderLabel ? onRenderLabel(props, defaultLabelRenderer) : label\n };\n }\n return /*#__PURE__*/ React.createElement(Checkbox, {\n ...shimProps,\n ref: checkboxRef,\n className: mergeClasses(stylesV9.root, 'ms-Checkbox', className, styles.root),\n indicator: {\n className: mergeClasses('ms-Checkbox-checkbox', styles.checkbox)\n }\n });\n});\nCheckboxShim.displayName = 'CheckboxShim';\n"],"names":["CheckboxShim","getClassNames","classNamesFunction","useStaticStyles","React","forwardRef","props","_ref","className","styles","stylesV8","onRenderLabel","label","componentRef","shimProps","useCheckboxProps","stylesV9","useCheckboxStyles","checkboxRef","createRef","useImperativeHandle","_checkboxRef_current","_checkboxRef_current1","_checkboxRef_current_checked","_checkboxRef_current_indeterminate","checked","current","indeterminate","focus","defaultLabelRenderer","checkboxProps","defualtLabel","title","createElement","text","mergeClasses","children","Checkbox","ref","root","indicator","checkbox","displayName"],"mappings":";;;;+BAQaA;;;eAAAA;;;;i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,aAAa,CAAC,QAAQ;YAC5DD,OAAOA;YACPxB,WAAWC,OAAOyB,IAAI;QAC1B,GAAGH,gBAAgB;IACvB;IACA,IAAInB,SAASD,eAAe;QACxBG,UAAUF,KAAK,GAAG;YACdJ,WAAW2B,IAAAA,6BAAY,EAAC,oBAAoB1B,OAAOG,KAAK,EAAEH,OAAOyB,IAAI;YACrEE,UAAUzB,gBAAgBA,cAAcL,OAAOuB,wBAAwBjB;QAC3E;IACJ;IACA,OAAO,WAAW,GAAGR,OAAM6B,aAAa,CAACI,yBAAQ,EAAE;QAC/C,GAAGvB,SAAS;QACZwB,KAAKpB;QACLV,WAAW2B,IAAAA,6BAAY,EAACnB,SAASuB,IAAI,EAAE,eAAe/B,WAAWC,OAAO8B,IAAI;QAC5EC,WAAW;YACPhC,WAAW2B,IAAAA,6BAAY,EAAC,wBAAwB1B,OAAOgC,QAAQ;QACnE;IACJ;AACJ;AACAzC,aAAa0C,WAAW,GAAG"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./CheckboxShim"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './CheckboxShim';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useCheckboxProps", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useCheckboxProps;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reacthooks = require("@fluentui/react-hooks");
14
+ const _utils = require("../utils");
15
+ // https://react.fluentui.dev/?path=/docs/concepts-migration-from-v8-components-checkbox-migration--page [Link of the fluent v9 migration guide]
16
+ // https://github.com/microsoft/fluentui/blob/master/packages/react/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v8 checkbox types definition]
17
+ // https://github.com/microsoft/fluentui/blob/103b8977f8d5f8dd8c430bab46ff5308a2c76371/packages/react-components/react-checkbox/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v9 checkbox types definition]
18
+ const CHECKBOX_PROPS_V8 = new Set([
19
+ 'ariaDescribedBy',
20
+ 'ariaLabel',
21
+ 'ariaLabelledBy',
22
+ 'ariaPositionInSet',
23
+ 'ariaSetSize',
24
+ 'boxSide',
25
+ 'checked',
26
+ 'checkmarkIconProps',
27
+ 'className',
28
+ 'componentRef',
29
+ 'defaultChecked',
30
+ 'defaultIndeterminate',
31
+ 'disabled',
32
+ 'indeterminate',
33
+ 'inputProps',
34
+ 'label',
35
+ 'name',
36
+ 'onChange',
37
+ 'onRenderLabel',
38
+ 'required',
39
+ 'styles',
40
+ 'theme',
41
+ 'title'
42
+ ]);
43
+ const useCheckboxProps = (props)=>{
44
+ const { ariaDescribedBy, ariaLabel, ariaLabelledBy, ariaPositionInSet, ariaSetSize, boxSide, checked: checkedV8, indeterminate, defaultChecked, defaultIndeterminate, disabled, inputProps, name, required, title, onChange: onChangeV8 } = props;
45
+ const [checked, setChecked] = (0, _reacthooks.useControllableValue)(checkedV8, defaultChecked);
46
+ const [mixed, setMixed] = _react.useState(indeterminate || defaultIndeterminate);
47
+ const onChange = _react.useCallback((event, data)=>{
48
+ let val = checked !== undefined ? data.checked : undefined;
49
+ // Ensure the checkbox is controlled
50
+ if (checked !== undefined) {
51
+ if (mixed) {
52
+ val = checkedV8 !== undefined ? checkedV8 : defaultChecked !== undefined ? defaultChecked : val;
53
+ }
54
+ }
55
+ if (mixed) {
56
+ setMixed(mixed && !indeterminate ? false : mixed);
57
+ }
58
+ setChecked(val);
59
+ onChangeV8 === null || onChangeV8 === void 0 ? void 0 : onChangeV8(event, data.checked);
60
+ }, [
61
+ setChecked,
62
+ checked,
63
+ onChangeV8,
64
+ mixed,
65
+ indeterminate,
66
+ checkedV8,
67
+ defaultChecked
68
+ ]);
69
+ const v9Props = {
70
+ checked: mixed ? 'mixed' : checked,
71
+ defaultChecked: mixed ? 'mixed' : defaultChecked,
72
+ labelPosition: boxSide === 'end' ? 'before' : 'after',
73
+ disabled,
74
+ required,
75
+ title,
76
+ name,
77
+ onChange
78
+ };
79
+ return {
80
+ ...inputProps,
81
+ 'aria-describedby': ariaDescribedBy,
82
+ 'aria-label': ariaLabel,
83
+ 'aria-labelledby': ariaLabelledBy,
84
+ 'aria-posinset': ariaPositionInSet,
85
+ 'aria-setsize': ariaSetSize,
86
+ ...v9Props,
87
+ ...(0, _utils.getHTMLAttributes)(props, CHECKBOX_PROPS_V8)
88
+ };
89
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["shimCheckboxProps.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableValue } from '@fluentui/react-hooks';\nimport { getHTMLAttributes } from '../utils';\n// https://react.fluentui.dev/?path=/docs/concepts-migration-from-v8-components-checkbox-migration--page [Link of the fluent v9 migration guide]\n// https://github.com/microsoft/fluentui/blob/master/packages/react/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v8 checkbox types definition]\n// https://github.com/microsoft/fluentui/blob/103b8977f8d5f8dd8c430bab46ff5308a2c76371/packages/react-components/react-checkbox/src/components/Checkbox/Checkbox.types.ts [Link of the fluent v9 checkbox types definition]\nconst CHECKBOX_PROPS_V8 = new Set([\n 'ariaDescribedBy',\n 'ariaLabel',\n 'ariaLabelledBy',\n 'ariaPositionInSet',\n 'ariaSetSize',\n 'boxSide',\n 'checked',\n 'checkmarkIconProps',\n 'className',\n 'componentRef',\n 'defaultChecked',\n 'defaultIndeterminate',\n 'disabled',\n 'indeterminate',\n 'inputProps',\n 'label',\n 'name',\n 'onChange',\n 'onRenderLabel',\n 'required',\n 'styles',\n 'theme',\n 'title'\n]);\nexport const useCheckboxProps = (props)=>{\n const { ariaDescribedBy, ariaLabel, ariaLabelledBy, ariaPositionInSet, ariaSetSize, boxSide, checked: checkedV8, indeterminate, defaultChecked, defaultIndeterminate, disabled, inputProps, name, required, title, onChange: onChangeV8 } = props;\n const [checked, setChecked] = useControllableValue(checkedV8, defaultChecked);\n const [mixed, setMixed] = React.useState(indeterminate || defaultIndeterminate);\n const onChange = React.useCallback((event, data)=>{\n let val = checked !== undefined ? data.checked : undefined;\n // Ensure the checkbox is controlled\n if (checked !== undefined) {\n if (mixed) {\n val = checkedV8 !== undefined ? checkedV8 : defaultChecked !== undefined ? defaultChecked : val;\n }\n }\n if (mixed) {\n setMixed(mixed && !indeterminate ? false : mixed);\n }\n setChecked(val);\n onChangeV8 === null || onChangeV8 === void 0 ? void 0 : onChangeV8(event, data.checked);\n }, [\n setChecked,\n checked,\n onChangeV8,\n mixed,\n indeterminate,\n checkedV8,\n defaultChecked\n ]);\n const v9Props = {\n checked: mixed ? 'mixed' : checked,\n defaultChecked: mixed ? 'mixed' : defaultChecked,\n labelPosition: boxSide === 'end' ? 'before' : 'after',\n disabled,\n required,\n title,\n name,\n onChange\n };\n return {\n ...inputProps,\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-posinset': ariaPositionInSet,\n 'aria-setsize': ariaSetSize,\n ...v9Props,\n ...getHTMLAttributes(props, CHECKBOX_PROPS_V8)\n };\n};\n"],"names":["useCheckboxProps","CHECKBOX_PROPS_V8","Set","props","ariaDescribedBy","ariaLabel","ariaLabelledBy","ariaPositionInSet","ariaSetSize","boxSide","checked","checkedV8","indeterminate","defaultChecked","defaultIndeterminate","disabled","inputProps","name","required","title","onChange","onChangeV8","setChecked","useControllableValue","mixed","setMixed","React","useState","useCallback","event","data","val","undefined","v9Props","labelPosition","getHTMLAttributes"],"mappings":";;;;+BA+BaA;;;eAAAA;;;;iEA/BU;4BACc;uBACH;AAClC,gJAAgJ;AAChJ,+JAA+J;AAC/J,2NAA2N;AAC3N,MAAMC,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BAAoBZ;QACpB,cAAcC;QACd,mBAAmBC;QACnB,iBAAiBC;QACjB,gBAAgBC;QAChB,GAAGyB,OAAO;QACV,GAAGE,IAAAA,wBAAiB,EAAChC,OAAOF,kBAAkB;IAClD;AACJ"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getHTMLAttributes", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getHTMLAttributes;
9
+ }
10
+ });
11
+ function getHTMLAttributes(props, allV8PropsSet) {
12
+ const v8Props = {
13
+ ...props
14
+ };
15
+ const propsKeys = Object.keys(v8Props);
16
+ propsKeys.forEach((key)=>{
17
+ if (allV8PropsSet.has(key)) {
18
+ delete v8Props[key];
19
+ }
20
+ });
21
+ return v8Props;
22
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils.js"],"sourcesContent":["export function getHTMLAttributes(props, allV8PropsSet) {\n const v8Props = {\n ...props\n };\n const propsKeys = Object.keys(v8Props);\n propsKeys.forEach((key)=>{\n if (allV8PropsSet.has(key)) {\n delete v8Props[key];\n }\n });\n return v8Props;\n}\n"],"names":["getHTMLAttributes","props","allV8PropsSet","v8Props","propsKeys","Object","keys","forEach","key","has"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,KAAK,EAAEC,aAAa;IAClD,MAAMC,UAAU;QACZ,GAAGF,KAAK;IACZ;IACA,MAAMG,YAAYC,OAAOC,IAAI,CAACH;IAC9BC,UAAUG,OAAO,CAAC,CAACC;QACf,IAAIN,cAAcO,GAAG,CAACD,MAAM;YACxB,OAAOL,OAAO,CAACK,IAAI;QACvB;IACJ;IACA,OAAOL;AACX"}
@@ -48,65 +48,69 @@ _export(exports, {
48
48
  StackShim: function() {
49
49
  return _index2.StackShim;
50
50
  },
51
+ CheckboxShim: function() {
52
+ return _index3.CheckboxShim;
53
+ },
51
54
  black: function() {
52
- return _index3.black;
55
+ return _index4.black;
53
56
  },
54
57
  blackAlpha: function() {
55
- return _index3.blackAlpha;
58
+ return _index4.blackAlpha;
56
59
  },
57
60
  brandWeb: function() {
58
- return _index3.brandWeb;
61
+ return _index4.brandWeb;
59
62
  },
60
63
  createBrandVariants: function() {
61
- return _index3.createBrandVariants;
64
+ return _index4.createBrandVariants;
62
65
  },
63
66
  createV8Theme: function() {
64
- return _index3.createV8Theme;
67
+ return _index4.createV8Theme;
65
68
  },
66
69
  createV9Theme: function() {
67
- return _index3.createV9Theme;
70
+ return _index4.createV9Theme;
68
71
  },
69
72
  grey: function() {
70
- return _index3.grey;
73
+ return _index4.grey;
71
74
  },
72
75
  grey14Alpha: function() {
73
- return _index3.grey14Alpha;
76
+ return _index4.grey14Alpha;
74
77
  },
75
78
  hcButtonFace: function() {
76
- return _index3.hcButtonFace;
79
+ return _index4.hcButtonFace;
77
80
  },
78
81
  hcButtonText: function() {
79
- return _index3.hcButtonText;
82
+ return _index4.hcButtonText;
80
83
  },
81
84
  hcCanvas: function() {
82
- return _index3.hcCanvas;
85
+ return _index4.hcCanvas;
83
86
  },
84
87
  hcCanvasText: function() {
85
- return _index3.hcCanvasText;
88
+ return _index4.hcCanvasText;
86
89
  },
87
90
  hcDisabled: function() {
88
- return _index3.hcDisabled;
91
+ return _index4.hcDisabled;
89
92
  },
90
93
  hcHighlight: function() {
91
- return _index3.hcHighlight;
94
+ return _index4.hcHighlight;
92
95
  },
93
96
  hcHighlightText: function() {
94
- return _index3.hcHighlightText;
97
+ return _index4.hcHighlightText;
95
98
  },
96
99
  hcHyperlink: function() {
97
- return _index3.hcHyperlink;
100
+ return _index4.hcHyperlink;
98
101
  },
99
102
  sharedColors: function() {
100
- return _index3.sharedColors;
103
+ return _index4.sharedColors;
101
104
  },
102
105
  white: function() {
103
- return _index3.white;
106
+ return _index4.white;
104
107
  },
105
108
  whiteAlpha: function() {
106
- return _index3.whiteAlpha;
109
+ return _index4.whiteAlpha;
107
110
  }
108
111
  });
109
112
  const _index = require("./components/Button/index");
110
113
  const _index1 = require("./components/Menu/index");
111
114
  const _index2 = require("./components/Stack/index");
112
- const _index3 = require("./components/Theme/index");
115
+ const _index3 = require("./components/Checkbox/index");
116
+ const _index4 = require("./components/Theme/index");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { ActionButtonShim, ButtonShim, CommandButtonShim, CompoundButtonShim, DefaultButtonShim, MenuButtonShim, PrimaryButtonShim, shimButtonProps, ToggleButtonShim } from './components/Button/index';\nexport { MenuItemShim, shimMenuProps } from './components/Menu/index';\nexport { StackItemShim, StackShim } from './components/Stack/index';\nexport { black, blackAlpha, brandWeb, createBrandVariants, createV8Theme, createV9Theme, grey, grey14Alpha, hcButtonFace, hcButtonText, hcCanvas, hcCanvasText, hcDisabled, hcHighlight, hcHighlightText, hcHyperlink, sharedColors, white, whiteAlpha } from './components/Theme/index';\n"],"names":["ActionButtonShim","ButtonShim","CommandButtonShim","CompoundButtonShim","DefaultButtonShim","MenuButtonShim","PrimaryButtonShim","shimButtonProps","ToggleButtonShim","MenuItemShim","shimMenuProps","StackItemShim","StackShim","black","blackAlpha","brandWeb","createBrandVariants","createV8Theme","createV9Theme","grey","grey14Alpha","hcButtonFace","hcButtonText","hcCanvas","hcCanvasText","hcDisabled","hcHighlight","hcHighlightText","hcHyperlink","sharedColors","white","whiteAlpha"],"mappings":";;;;;;;;;;;IAASA,gBAAgB;eAAhBA,uBAAgB;;IAAEC,UAAU;eAAVA,iBAAU;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,kBAAkB;eAAlBA,yBAAkB;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,cAAc;eAAdA,qBAAc;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,eAAe;eAAfA,sBAAe;;IAAEC,gBAAgB;eAAhBA,uBAAgB;;IAC5JC,YAAY;eAAZA,oBAAY;;IAAEC,aAAa;eAAbA,qBAAa;;IAC3BC,aAAa;eAAbA,qBAAa;;IAAEC,SAAS;eAATA,iBAAS;;IACxBC,KAAK;eAALA,aAAK;;IAAEC,UAAU;eAAVA,kBAAU;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,mBAAmB;eAAnBA,2BAAmB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,IAAI;eAAJA,YAAI;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,UAAU;eAAVA,kBAAU;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,eAAe;eAAfA,uBAAe;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,KAAK;eAALA,aAAK;;IAAEC,UAAU;eAAVA,kBAAU;;;uBAHzE;wBACjI;wBACH;wBACqN"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { ActionButtonShim, ButtonShim, CommandButtonShim, CompoundButtonShim, DefaultButtonShim, MenuButtonShim, PrimaryButtonShim, shimButtonProps, ToggleButtonShim } from './components/Button/index';\nexport { MenuItemShim, shimMenuProps } from './components/Menu/index';\nexport { StackItemShim, StackShim } from './components/Stack/index';\nexport { CheckboxShim } from './components/Checkbox/index';\nexport { black, blackAlpha, brandWeb, createBrandVariants, createV8Theme, createV9Theme, grey, grey14Alpha, hcButtonFace, hcButtonText, hcCanvas, hcCanvasText, hcDisabled, hcHighlight, hcHighlightText, hcHyperlink, sharedColors, white, whiteAlpha } from './components/Theme/index';\n"],"names":["ActionButtonShim","ButtonShim","CommandButtonShim","CompoundButtonShim","DefaultButtonShim","MenuButtonShim","PrimaryButtonShim","shimButtonProps","ToggleButtonShim","MenuItemShim","shimMenuProps","StackItemShim","StackShim","CheckboxShim","black","blackAlpha","brandWeb","createBrandVariants","createV8Theme","createV9Theme","grey","grey14Alpha","hcButtonFace","hcButtonText","hcCanvas","hcCanvasText","hcDisabled","hcHighlight","hcHighlightText","hcHyperlink","sharedColors","white","whiteAlpha"],"mappings":";;;;;;;;;;;IAASA,gBAAgB;eAAhBA,uBAAgB;;IAAEC,UAAU;eAAVA,iBAAU;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,kBAAkB;eAAlBA,yBAAkB;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,cAAc;eAAdA,qBAAc;;IAAEC,iBAAiB;eAAjBA,wBAAiB;;IAAEC,eAAe;eAAfA,sBAAe;;IAAEC,gBAAgB;eAAhBA,uBAAgB;;IAC5JC,YAAY;eAAZA,oBAAY;;IAAEC,aAAa;eAAbA,qBAAa;;IAC3BC,aAAa;eAAbA,qBAAa;;IAAEC,SAAS;eAATA,iBAAS;;IACxBC,YAAY;eAAZA,oBAAY;;IACZC,KAAK;eAALA,aAAK;;IAAEC,UAAU;eAAVA,kBAAU;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,mBAAmB;eAAnBA,2BAAmB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,IAAI;eAAJA,YAAI;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,UAAU;eAAVA,kBAAU;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,eAAe;eAAfA,uBAAe;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,KAAK;eAALA,aAAK;;IAAEC,UAAU;eAAVA,kBAAU;;;uBAJzE;wBACjI;wBACH;wBACZ;wBACiO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-migration-v8-v9",
3
- "version": "9.4.44",
3
+ "version": "9.5.0",
4
4
  "description": "Migration shim components and methods for hybrid v8/v9 applications building on Fluent UI React.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -32,10 +32,11 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@ctrl/tinycolor": "3.3.4",
35
- "@fluentui/fluent2-theme": "^8.107.55",
36
- "@fluentui/react": "^8.114.1",
37
- "@fluentui/react-components": "^9.44.2",
35
+ "@fluentui/fluent2-theme": "^8.107.56",
36
+ "@fluentui/react": "^8.114.2",
37
+ "@fluentui/react-components": "^9.44.3",
38
38
  "@fluentui/react-icons": "^2.0.224",
39
+ "@fluentui/react-hooks": "^8.6.35",
39
40
  "@fluentui/react-theme": "^9.1.16",
40
41
  "@fluentui/react-utilities": "^9.15.6",
41
42
  "@griffel/react": "^1.5.14",