@fluentui/react-divider 9.0.0-nightly.d730088d7f.0 → 9.0.0-rc.10
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.json +535 -20
- package/CHANGELOG.md +236 -89
- package/Spec.md +22 -132
- package/dist/index.d.ts +70 -0
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/Divider.js.map +1 -1
- package/lib/components/Divider/Divider.js +8 -8
- package/lib/components/Divider/Divider.js.map +1 -1
- package/lib/components/Divider/Divider.types.js.map +1 -1
- package/lib/components/Divider/index.js.map +1 -1
- package/lib/components/Divider/renderDivider.js +9 -8
- package/lib/components/Divider/renderDivider.js.map +1 -1
- package/lib/components/Divider/useDivider.js +21 -20
- package/lib/components/Divider/useDivider.js.map +1 -1
- package/lib/components/Divider/useDividerStyles.js +152 -108
- package/lib/components/Divider/useDividerStyles.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Divider.js +1 -1
- package/lib-commonjs/Divider.js.map +1 -1
- package/lib-commonjs/components/Divider/Divider.js +9 -9
- package/lib-commonjs/components/Divider/Divider.js.map +1 -1
- package/lib-commonjs/components/Divider/Divider.types.js.map +1 -1
- package/lib-commonjs/components/Divider/index.js +1 -1
- package/lib-commonjs/components/Divider/index.js.map +1 -1
- package/lib-commonjs/components/Divider/renderDivider.js +13 -13
- package/lib-commonjs/components/Divider/renderDivider.js.map +1 -1
- package/lib-commonjs/components/Divider/useDivider.js +24 -24
- package/lib-commonjs/components/Divider/useDivider.js.map +1 -1
- package/lib-commonjs/components/Divider/useDividerStyles.js +156 -110
- package/lib-commonjs/components/Divider/useDividerStyles.js.map +1 -1
- package/lib-commonjs/index.js +32 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +18 -22
- package/dist/react-divider.d.ts +0 -65
- package/lib/Divider.d.ts +0 -1
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -11
- package/lib/common/isConformant.js.map +0 -1
- package/lib/components/Divider/Divider.d.ts +0 -6
- package/lib/components/Divider/Divider.types.d.ts +0 -35
- package/lib/components/Divider/index.d.ts +0 -5
- package/lib/components/Divider/renderDivider.d.ts +0 -5
- package/lib/components/Divider/useDivider.d.ts +0 -8
- package/lib/components/Divider/useDividerStyles.d.ts +0 -3
- package/lib/index.d.ts +0 -1
- package/lib-commonjs/Divider.d.ts +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -22
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/components/Divider/Divider.d.ts +0 -6
- package/lib-commonjs/components/Divider/Divider.types.d.ts +0 -35
- package/lib-commonjs/components/Divider/index.d.ts +0 -5
- package/lib-commonjs/components/Divider/renderDivider.d.ts +0 -5
- package/lib-commonjs/components/Divider/useDivider.d.ts +0 -8
- package/lib-commonjs/components/Divider/useDividerStyles.d.ts +0 -3
- package/lib-commonjs/index.d.ts +0 -1
package/Spec.md
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
## Background
|
4
4
|
|
5
|
-
|
6
|
-
The purpose of redoing the component is to add minor structural updates and new engineering practices and update the naming conventions in the API to match naming conventions indicated by OpenUI research.
|
5
|
+
A `Divider` is used to visually segment content into groups.
|
7
6
|
|
8
7
|
## Prior Art
|
9
8
|
|
@@ -30,7 +29,7 @@ The purpose of redoing the component is to add minor structural updates and new
|
|
30
29
|
|
31
30
|
Basic Examples:
|
32
31
|
|
33
|
-
```
|
32
|
+
```tsx
|
34
33
|
<Divider />
|
35
34
|
<Divider vertical />
|
36
35
|
<Divider>This is a divider with content</Divider>
|
@@ -38,144 +37,33 @@ Basic Examples:
|
|
38
37
|
|
39
38
|
## Variants
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
Standard default horizontal
|
44
|
-
|
45
|
-
```html
|
46
|
-
<Divider />
|
47
|
-
```
|
48
|
-
|
49
|
-
Vertical
|
50
|
-
|
51
|
-
```html
|
52
|
-
<Divider vertical />
|
53
|
-
```
|
54
|
-
|
55
|
-
Color
|
40
|
+
### Layout
|
56
41
|
|
57
|
-
|
58
|
-
<Divider color="black" />
|
59
|
-
```
|
42
|
+
The `Divider` component has two layout variants:
|
60
43
|
|
61
|
-
|
44
|
+
- The default `Divider` is separates contents by rendering a horizontal line.
|
45
|
+
- A `Divider` with the `vertical` prop set to true separates contents by rendering a vertical line.
|
62
46
|
|
63
|
-
|
64
|
-
<Divider>My Content</Divider>
|
65
|
-
```
|
47
|
+
### Inset
|
66
48
|
|
67
|
-
|
49
|
+
A `Divider` with the `inset` prop adds padding to the beginning and end of the component.
|
68
50
|
|
69
|
-
|
70
|
-
<Divider><Icon /></Divider>
|
71
|
-
```
|
51
|
+
### Appearance
|
72
52
|
|
73
|
-
|
53
|
+
The `Divider` component has four appearance variants:
|
74
54
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
Appearance
|
80
|
-
|
81
|
-
```html
|
82
|
-
<Divider apperance="subtle" />
|
83
|
-
<Divider apperance="brand" />
|
84
|
-
<Divider apperance="strong" />
|
85
|
-
```
|
55
|
+
- The default `Divider` is styled with the neutral foreground color from the theme.
|
56
|
+
- appearance="brand": The `Divider` is styled with the brand color from the theme.
|
57
|
+
- appearance="strong": The `Divider` is styled with a strong color that emphasizes the visual separation.
|
58
|
+
- appearance="subtle": The `Divider` is styled with a subtle color to de-emphasize the visual separation.
|
86
59
|
|
87
60
|
## API
|
88
61
|
|
89
62
|
From [Divider.types.tsx](https://github.com/microsoft/fluentui/blob/master/packages/react-divider/src/components/Divider/Divider.types.ts)
|
90
63
|
|
91
|
-
|
92
|
-
|
93
|
-
- root
|
94
|
-
|
95
|
-
### Props
|
96
|
-
|
97
|
-
```ts
|
98
|
-
export type DividerProps = ComponentProps &
|
99
|
-
React.HTMLAttributes<HTMLElement> & {
|
100
|
-
/**
|
101
|
-
* Determines the alignment of the content within the divider.
|
102
|
-
* @defaultvalue 'center'
|
103
|
-
*/
|
104
|
-
alignContent?: 'start' | 'end' | 'center';
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Predefined visual styles
|
108
|
-
* @defaultvalue 'default'
|
109
|
-
*/
|
110
|
-
appearance?: 'default' | 'subtle' | 'brand' | 'strong';
|
111
|
-
|
112
|
-
/**
|
113
|
-
* A divider can have a overriding border color
|
114
|
-
*/
|
115
|
-
color?: string;
|
116
|
-
|
117
|
-
/**
|
118
|
-
* A divider can be classified as important to emphasize its content
|
119
|
-
*/
|
120
|
-
important?: boolean;
|
121
|
-
|
122
|
-
/**
|
123
|
-
* Adds a 12px padding to the begining and end of the divider
|
124
|
-
*/
|
125
|
-
inset?: boolean;
|
126
|
-
|
127
|
-
/**
|
128
|
-
* A divider can be horizontal (default) or vertical
|
129
|
-
*/
|
130
|
-
vertical?: boolean;
|
131
|
-
|
132
|
-
/**
|
133
|
-
* Overrides for border visuals
|
134
|
-
*/
|
135
|
-
borderStyle?: string;
|
136
|
-
borderSize?: string | number;
|
137
|
-
|
138
|
-
/**
|
139
|
-
* Accessibility wrapper for content when presented.
|
140
|
-
* A shorthand prop can be a literal, object, or
|
141
|
-
* JSX. The `children` prop of the object can be a render function,
|
142
|
-
* taking in the original slot component and props.
|
143
|
-
*/
|
144
|
-
wrapper?: ShorthandProps<React.HTMLAttributes<HTMLDivElement>>;
|
145
|
-
};
|
146
|
-
```
|
147
|
-
|
148
|
-
## Styling Tokens
|
149
|
-
|
150
|
-
The current exposed tokens and default values are listed below:
|
151
|
-
|
152
|
-
**Default**
|
153
|
-
|
154
|
-
Font Color : tokens.alias.color.neutral.neutralForeground2
|
155
|
-
|
156
|
-
Border Color: tokens.alias.color.neutral.neutralStroke2
|
157
|
-
|
158
|
-
**Subtle**
|
159
|
-
|
160
|
-
Font Color : tokens.alias.color.neutral.neutralForeground2
|
161
|
-
|
162
|
-
Border Color: tokens.alias.color.neutral.neutralStroke3
|
64
|
+
## HTML Structure
|
163
65
|
|
164
|
-
|
165
|
-
|
166
|
-
Font Color : tokens.alias.color.brand.brandBackgroundStatic
|
167
|
-
|
168
|
-
Border Color: tokens.alias.color.brand.brandBackgroundStatic
|
169
|
-
|
170
|
-
**Brand**
|
171
|
-
|
172
|
-
Font Color : tokens.alias.color.neutral.neutralForeground2
|
173
|
-
|
174
|
-
Border Color: tokens.alias.color.neutral.neutralStroke1
|
175
|
-
|
176
|
-
## Structure
|
177
|
-
|
178
|
-
```
|
66
|
+
```html
|
179
67
|
<div>
|
180
68
|
<!-- ::before to handle the divider line independent of the divider having content or not -->
|
181
69
|
<div>Content</div>
|
@@ -190,11 +78,13 @@ Border Color: tokens.alias.color.neutral.neutralStroke1
|
|
190
78
|
## Behaviors
|
191
79
|
|
192
80
|
This component has no state.
|
193
|
-
This control will have no interactions.
|
194
|
-
This control will have no effect on screen readers.
|
195
81
|
|
196
|
-
|
82
|
+
This component has no mouse, touch or keyboard interactions.
|
83
|
+
|
84
|
+
Content, if provided, will self-determine its behaviors.
|
197
85
|
|
198
86
|
## Accessibility
|
199
87
|
|
200
|
-
|
88
|
+
- The `Divider` component should be assigned a `role="separator"` by default.
|
89
|
+
- The `Divider` component should be named by its content.
|
90
|
+
- The `Divider` component should have no other accessibility concerns otherwise. The descendant content in the divider must handle any required accessibility behaviors itself when appropriate.
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
2
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
3
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
4
|
+
import * as React_2 from 'react';
|
5
|
+
import type { Slot } from '@fluentui/react-utilities';
|
6
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* A divider visually segments content into groups.
|
10
|
+
*/
|
11
|
+
export declare const Divider: ForwardRefComponent<DividerProps>;
|
12
|
+
|
13
|
+
export declare const dividerClassNames: SlotClassNames<DividerSlots>;
|
14
|
+
|
15
|
+
export declare type DividerProps = ComponentProps<Partial<DividerSlots>> & {
|
16
|
+
/**
|
17
|
+
* Determines the alignment of the content within the divider.
|
18
|
+
*
|
19
|
+
* @default 'center'
|
20
|
+
*/
|
21
|
+
alignContent?: 'start' | 'center' | 'end';
|
22
|
+
/**
|
23
|
+
* A divider can have one of the preset appearances.
|
24
|
+
* When not specified, the divider has its default appearance.
|
25
|
+
*
|
26
|
+
* @default 'default'
|
27
|
+
*/
|
28
|
+
appearance?: 'brand' | 'default' | 'strong' | 'subtle';
|
29
|
+
/**
|
30
|
+
* Adds padding to the beginning and end of the divider.
|
31
|
+
*
|
32
|
+
* @default false
|
33
|
+
*/
|
34
|
+
inset?: boolean;
|
35
|
+
/**
|
36
|
+
* A divider can be horizontal (default) or vertical.
|
37
|
+
*
|
38
|
+
* @default false
|
39
|
+
*/
|
40
|
+
vertical?: boolean;
|
41
|
+
};
|
42
|
+
|
43
|
+
export declare type DividerSlots = {
|
44
|
+
/**
|
45
|
+
* Root of the component that renders as a `<div>` tag.
|
46
|
+
*/
|
47
|
+
root: Slot<'div'>;
|
48
|
+
/**
|
49
|
+
* Accessibility wrapper for content when presented.
|
50
|
+
*/
|
51
|
+
wrapper: Slot<'div'>;
|
52
|
+
};
|
53
|
+
|
54
|
+
export declare type DividerState = ComponentState<DividerSlots> & Required<Pick<DividerProps, 'alignContent' | 'appearance' | 'inset' | 'vertical'>>;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Renders a Divider component by passing the slot props (defined in `state`) to the appropriate slots.
|
58
|
+
*/
|
59
|
+
export declare const renderDivider_unstable: (state: DividerState) => JSX.Element;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Returns the props and state required to render the component
|
63
|
+
* @param props - User-provided props to the Divider component.
|
64
|
+
* @param ref - User-provided ref to be passed to the Divider component.
|
65
|
+
*/
|
66
|
+
export declare const useDivider_unstable: (props: DividerProps, ref: React_2.Ref<HTMLElement>) => DividerState;
|
67
|
+
|
68
|
+
export declare const useDividerStyles_unstable: (state: DividerState) => DividerState;
|
69
|
+
|
70
|
+
export { }
|
File without changes
|
package/lib/Divider.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Divider.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"Divider.js","sourceRoot":"../src/","sources":["Divider.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Divider/index';\n"]}
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { renderDivider_unstable } from './renderDivider';
|
3
|
+
import { useDivider_unstable } from './useDivider';
|
4
|
+
import { useDividerStyles_unstable } from './useDividerStyles';
|
5
5
|
/**
|
6
|
-
*
|
6
|
+
* A divider visually segments content into groups.
|
7
7
|
*/
|
8
8
|
|
9
|
-
export
|
10
|
-
|
11
|
-
|
12
|
-
return
|
9
|
+
export const Divider = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const state = useDivider_unstable(props, ref);
|
11
|
+
useDividerStyles_unstable(state);
|
12
|
+
return renderDivider_unstable(state);
|
13
13
|
});
|
14
14
|
Divider.displayName = 'Divider';
|
15
15
|
//# sourceMappingURL=Divider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/Divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAIA;;AAEG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxF,QAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,EAAQ,GAAR,CAAjC;AAEA,EAAA,yBAAyB,CAAC,KAAD,CAAzB;AAEA,SAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CANyD,CAAnD;AAQP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { renderDivider_unstable } from './renderDivider';\nimport { useDivider_unstable } from './useDivider';\nimport { useDividerStyles_unstable } from './useDividerStyles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { DividerProps } from './Divider.types';\n\n/**\n * A divider visually segments content into groups.\n */\nexport const Divider: ForwardRefComponent<DividerProps> = React.forwardRef((props, ref) => {\n const state = useDivider_unstable(props, ref);\n\n useDividerStyles_unstable(state);\n\n return renderDivider_unstable(state);\n});\n\nDivider.displayName = 'Divider';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Divider.types.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"Divider.types.js","sourceRoot":"../src/","sources":["components/Divider/Divider.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type DividerSlots = {\n /**\n * Root of the component that renders as a `<div>` tag.\n */\n root: Slot<'div'>;\n\n /**\n * Accessibility wrapper for content when presented.\n */\n wrapper: Slot<'div'>;\n};\n\nexport type DividerProps = ComponentProps<Partial<DividerSlots>> & {\n /**\n * Determines the alignment of the content within the divider.\n *\n * @default 'center'\n */\n alignContent?: 'start' | 'center' | 'end';\n\n /**\n * A divider can have one of the preset appearances.\n * When not specified, the divider has its default appearance.\n *\n * @default 'default'\n */\n appearance?: 'brand' | 'default' | 'strong' | 'subtle';\n\n /**\n * Adds padding to the beginning and end of the divider.\n *\n * @default false\n */\n inset?: boolean;\n\n /**\n * A divider can be horizontal (default) or vertical.\n *\n * @default false\n */\n vertical?: boolean;\n};\n\nexport type DividerState = ComponentState<DividerSlots> &\n Required<Pick<DividerProps, 'alignContent' | 'appearance' | 'inset' | 'vertical'>>;\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Divider/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Divider';\nexport * from './Divider.types';\nexport * from './renderDivider';\nexport * from './useDivider';\nexport * from './useDividerStyles';\n"]}
|
@@ -1,15 +1,16 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
4
3
|
/**
|
5
|
-
*
|
4
|
+
* Renders a Divider component by passing the slot props (defined in `state`) to the appropriate slots.
|
6
5
|
*/
|
7
6
|
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
7
|
+
export const renderDivider_unstable = state => {
|
8
|
+
const {
|
9
|
+
slots,
|
10
|
+
slotProps
|
11
|
+
} = getSlots(state);
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
13
|
+
}, slotProps.root.children !== undefined && /*#__PURE__*/React.createElement(slots.wrapper, { ...slotProps.wrapper
|
14
|
+
}, slotProps.root.children));
|
14
15
|
};
|
15
16
|
//# sourceMappingURL=renderDivider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/Divider/renderDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAe,KAAf,CAArC;AACA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,SAAS,CAAC,IAAV,CAAe,QAAf,KAA4B,SAA5B,iBACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,EAAuC,SAAS,CAAC,IAAV,CAAe,QAAtD,CAFJ,CADF;AAOD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { DividerSlots, DividerState } from './Divider.types';\n\n/**\n * Renders a Divider component by passing the slot props (defined in `state`) to the appropriate slots.\n */\nexport const renderDivider_unstable = (state: DividerState) => {\n const { slots, slotProps } = getSlots<DividerSlots>(state);\n return (\n <slots.root {...slotProps.root}>\n {slotProps.root.children !== undefined && (\n <slots.wrapper {...slotProps.wrapper}>{slotProps.root.children}</slots.wrapper>\n )}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,35 +1,36 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';
|
3
2
|
/**
|
4
3
|
* Returns the props and state required to render the component
|
5
|
-
* @param props - Divider
|
6
|
-
* @param ref -
|
4
|
+
* @param props - User-provided props to the Divider component.
|
5
|
+
* @param ref - User-provided ref to be passed to the Divider component.
|
7
6
|
*/
|
8
7
|
|
9
|
-
export
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
var dividerId = useId('divider-');
|
8
|
+
export const useDivider_unstable = (props, ref) => {
|
9
|
+
const {
|
10
|
+
alignContent = 'center',
|
11
|
+
appearance = 'default',
|
12
|
+
inset = false,
|
13
|
+
vertical = false,
|
14
|
+
wrapper
|
15
|
+
} = props;
|
16
|
+
const dividerId = useId('divider-');
|
19
17
|
return {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
// Props passed at the top-level
|
19
|
+
alignContent,
|
20
|
+
appearance,
|
21
|
+
inset,
|
22
|
+
vertical,
|
23
|
+
// Slots definition
|
24
24
|
components: {
|
25
25
|
root: 'div',
|
26
26
|
wrapper: 'div'
|
27
27
|
},
|
28
|
-
root: getNativeElementProps('div',
|
29
|
-
ref
|
28
|
+
root: getNativeElementProps('div', { ...props,
|
29
|
+
ref,
|
30
30
|
role: 'separator',
|
31
|
+
'aria-orientation': vertical ? 'vertical' : 'horizontal',
|
31
32
|
'aria-labelledby': props.children ? dividerId : undefined
|
32
|
-
})
|
33
|
+
}),
|
33
34
|
wrapper: resolveShorthand(wrapper, {
|
34
35
|
required: true,
|
35
36
|
defaultProps: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/Divider/useDivider.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AAGA;;;;AAIG;;AACH,OAAO,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAmE;AACpG,QAAM;AAAE,IAAA,YAAY,GAAG,QAAjB;AAA2B,IAAA,UAAU,GAAG,SAAxC;AAAmD,IAAA,KAAK,GAAG,KAA3D;AAAkE,IAAA,QAAQ,GAAG,KAA7E;AAAoF,IAAA;AAApF,MAAgG,KAAtG;AACA,QAAM,SAAS,GAAG,KAAK,CAAC,UAAD,CAAvB;AAEA,SAAO;AACL;AACA,IAAA,YAFK;AAGL,IAAA,UAHK;AAIL,IAAA,KAJK;AAKL,IAAA,QALK;AAOL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,KADI;AAEV,MAAA,OAAO,EAAE;AAFC,KARP;AAaL,IAAA,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ,EACjC,GAAG,KAD8B;AAEjC,MAAA,GAFiC;AAGjC,MAAA,IAAI,EAAE,WAH2B;AAIjC,0BAAoB,QAAQ,GAAG,UAAH,GAAgB,YAJX;AAKjC,yBAAmB,KAAK,CAAC,QAAN,GAAiB,SAAjB,GAA6B;AALf,KAAR,CAbtB;AAoBL,IAAA,OAAO,EAAE,gBAAgB,CAAC,OAAD,EAAU;AACjC,MAAA,QAAQ,EAAE,IADuB;AAEjC,MAAA,YAAY,EAAE;AACZ,QAAA,EAAE,EAAE,SADQ;AAEZ,QAAA,QAAQ,EAAE,KAAK,CAAC;AAFJ;AAFmB,KAAV;AApBpB,GAAP;AA4BD,CAhCM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type { DividerProps, DividerState } from './Divider.types';\n\n/**\n * Returns the props and state required to render the component\n * @param props - User-provided props to the Divider component.\n * @param ref - User-provided ref to be passed to the Divider component.\n */\nexport const useDivider_unstable = (props: DividerProps, ref: React.Ref<HTMLElement>): DividerState => {\n const { alignContent = 'center', appearance = 'default', inset = false, vertical = false, wrapper } = props;\n const dividerId = useId('divider-');\n\n return {\n // Props passed at the top-level\n alignContent,\n appearance,\n inset,\n vertical,\n\n // Slots definition\n components: {\n root: 'div',\n wrapper: 'div',\n },\n\n root: getNativeElementProps('div', {\n ...props,\n ref,\n role: 'separator',\n 'aria-orientation': vertical ? 'vertical' : 'horizontal',\n 'aria-labelledby': props.children ? dividerId : undefined,\n }),\n wrapper: resolveShorthand(wrapper, {\n required: true,\n defaultProps: {\n id: dividerId,\n children: props.children,\n },\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|