Skip to content

Commit 853ed68

Browse files
committed
fixup
1 parent c77d466 commit 853ed68

21 files changed

Lines changed: 262 additions & 337 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix: drop unnecessary dependencies from base hooks",
4+
"packageName": "@fluentui/react-avatar",
5+
"email": "dmytrokirpa@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix: drop unnecessary dependencies from base hooks",
4+
"packageName": "@fluentui/react-progress",
5+
"email": "dmytrokirpa@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix: drop unnecessary dependencies from base hooks",
4+
"packageName": "@fluentui/react-slider",
5+
"email": "dmytrokirpa@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix: drop unnecessary dependencies from base hooks",
4+
"packageName": "@fluentui/react-spinner",
5+
"email": "dmytrokirpa@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-avatar/library/src/components/AvatarGroupPopover/useAvatarGroupPopover.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ export const useAvatarGroupPopoverBase_unstable = (props: AvatarGroupPopoverBase
103103
popoverOpen,
104104

105105
components: {
106-
root: Popover,
106+
root: 'div',
107107
triggerButton: 'button',
108108
content: 'ul',
109-
popoverSurface: PopoverSurface,
110-
tooltip: Tooltip,
109+
popoverSurface: 'div',
110+
tooltip: 'div',
111111
},
112112
root: slot.always(
113113
{

packages/react-components/react-field/library/src/components/Field/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export type {
1010
} from './Field.types';
1111
export { Field } from './Field';
1212
export { renderField_unstable } from './renderField';
13-
export { useField_unstable, useFieldBase_unstable } from './useField';
13+
export { useField_unstable } from './useField';
14+
export { useFieldBase_unstable } from './useFieldBase';
1415
export { fieldClassNames, useFieldStyles_unstable } from './useFieldStyles.styles';

packages/react-components/react-field/library/src/components/Field/useField.tsx

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import * as React from 'react';
44

55
import { CheckmarkCircle12Filled, DiamondDismiss12Filled, Warning12Filled } from '@fluentui/react-icons';
66
import { Label } from '@fluentui/react-label';
7-
import { getIntrinsicElementProps, useId, slot } from '@fluentui/react-utilities';
8-
import type { FieldBaseProps, FieldBaseState, FieldProps, FieldState } from './Field.types';
7+
import { slot } from '@fluentui/react-utilities';
8+
import type { FieldProps, FieldState } from './Field.types';
9+
import { useFieldBase_unstable } from './useFieldBase';
910

1011
const validationMessageIcons = {
1112
error: <DiamondDismiss12Filled />,
@@ -46,50 +47,3 @@ export const useField_unstable = (props: FieldProps, ref: React.Ref<HTMLDivEleme
4647
size,
4748
};
4849
};
49-
50-
/**
51-
* Base hook for Field component, which manages state related to validation, ARIA attributes,
52-
* ID generation, and slot structure without design props.
53-
*
54-
* @param props - Props passed to this field
55-
* @param ref - Ref to the root
56-
*/
57-
export const useFieldBase_unstable = (props: FieldBaseProps, ref: React.Ref<HTMLDivElement>): FieldBaseState => {
58-
const { children, required = false, validationState = props.validationMessage ? 'error' : 'none' } = props;
59-
60-
const baseId = useId('field-');
61-
const generatedControlId = baseId + '__control';
62-
63-
const root = slot.always(getIntrinsicElementProps('div', { ...props, ref }, /*excludedPropNames:*/ ['children']), {
64-
elementType: 'div',
65-
});
66-
const label = slot.optional(props.label, {
67-
defaultProps: { htmlFor: generatedControlId, id: baseId + '__label', required },
68-
elementType: 'label',
69-
});
70-
const validationMessage = slot.optional(props.validationMessage, {
71-
defaultProps: {
72-
id: baseId + '__validationMessage',
73-
role: validationState === 'error' || validationState === 'warning' ? 'alert' : undefined,
74-
},
75-
elementType: 'div',
76-
});
77-
const hint = slot.optional(props.hint, { defaultProps: { id: baseId + '__hint' }, elementType: 'div' });
78-
const validationMessageIcon = slot.optional(props.validationMessageIcon, {
79-
renderByDefault: false,
80-
elementType: 'span',
81-
});
82-
83-
return {
84-
children,
85-
generatedControlId,
86-
required,
87-
validationState,
88-
components: { root: 'div', label: 'label', validationMessage: 'div', validationMessageIcon: 'span', hint: 'div' },
89-
root,
90-
label,
91-
validationMessageIcon,
92-
validationMessage,
93-
hint,
94-
};
95-
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use client';
2+
3+
import * as React from 'react';
4+
5+
import { getIntrinsicElementProps, useId, slot } from '@fluentui/react-utilities';
6+
import type { FieldBaseProps, FieldBaseState } from './Field.types';
7+
8+
/**
9+
* Base hook for Field component, which manages state related to validation, ARIA attributes,
10+
* ID generation, and slot structure without design props.
11+
*
12+
* @param props - Props passed to this field
13+
* @param ref - Ref to the root
14+
*/
15+
export const useFieldBase_unstable = (props: FieldBaseProps, ref: React.Ref<HTMLDivElement>): FieldBaseState => {
16+
const { children, required = false, validationState = props.validationMessage ? 'error' : 'none' } = props;
17+
18+
const baseId = useId('field-');
19+
const generatedControlId = baseId + '__control';
20+
21+
const root = slot.always(getIntrinsicElementProps('div', { ...props, ref }, /*excludedPropNames:*/ ['children']), {
22+
elementType: 'div',
23+
});
24+
const label = slot.optional(props.label, {
25+
defaultProps: { htmlFor: generatedControlId, id: baseId + '__label', required },
26+
elementType: 'label',
27+
});
28+
const validationMessage = slot.optional(props.validationMessage, {
29+
defaultProps: {
30+
id: baseId + '__validationMessage',
31+
role: validationState === 'error' || validationState === 'warning' ? 'alert' : undefined,
32+
},
33+
elementType: 'div',
34+
});
35+
const hint = slot.optional(props.hint, { defaultProps: { id: baseId + '__hint' }, elementType: 'div' });
36+
const validationMessageIcon = slot.optional(props.validationMessageIcon, {
37+
renderByDefault: false,
38+
elementType: 'span',
39+
});
40+
41+
return {
42+
children,
43+
generatedControlId,
44+
required,
45+
validationState,
46+
components: { root: 'div', label: 'label', validationMessage: 'div', validationMessageIcon: 'span', hint: 'div' },
47+
root,
48+
label,
49+
validationMessageIcon,
50+
validationMessage,
51+
hint,
52+
};
53+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// @ts-check
2+
const path = require('path');
3+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
4+
5+
const libraryRoot = path.resolve(__dirname, '..');
6+
7+
/** @type {import('webpack').Configuration} */
8+
module.exports = {
9+
mode: 'production',
10+
entry: path.resolve(__dirname, 'ReactComponents.fixture.js'),
11+
output: {
12+
filename: 'bundle.js',
13+
path: path.resolve(__dirname, '../dist/bundle-analyze'),
14+
},
15+
resolve: {
16+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
17+
// Resolve @fluentui/react-headless to the local lib (ESM for best tree-shaking)
18+
alias: {
19+
'@fluentui/react-headless': path.resolve(libraryRoot, 'lib/index.js'),
20+
},
21+
},
22+
externals: {
23+
react: 'React',
24+
'react-dom': 'ReactDOM',
25+
},
26+
optimization: {
27+
// Disable scope hoisting so bundle-analyzer shows each module individually
28+
concatenateModules: false,
29+
},
30+
plugins: [
31+
new BundleAnalyzerPlugin({
32+
analyzerMode: 'static',
33+
reportFilename: path.resolve(__dirname, '../dist/bundle-analyze/report.html'),
34+
openAnalyzer: true,
35+
generateStatsFile: true,
36+
statsFilename: path.resolve(__dirname, '../dist/bundle-analyze/stats.json'),
37+
}),
38+
],
39+
};

0 commit comments

Comments
 (0)