@fluentui/react-divider 9.0.0-alpha.9 → 9.0.0-beta.4
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 +2010 -1
- package/CHANGELOG.md +768 -2
- package/Spec.md +22 -137
- package/dist/react-divider.d.ts +35 -49
- package/lib/Divider.js.map +1 -1
- package/lib/common/isConformant.d.ts +3 -1
- package/lib/common/isConformant.js +7 -5
- package/lib/common/isConformant.js.map +1 -1
- package/lib/components/Divider/Divider.d.ts +4 -5
- package/lib/components/Divider/Divider.js +6 -6
- package/lib/components/Divider/Divider.js.map +1 -1
- package/lib/components/Divider/Divider.types.d.ts +23 -36
- package/lib/components/Divider/Divider.types.js +1 -0
- package/lib/components/Divider/Divider.types.js.map +1 -1
- package/lib/components/Divider/index.js +1 -0
- package/lib/components/Divider/index.js.map +1 -1
- package/lib/components/Divider/renderDivider.d.ts +1 -1
- package/lib/components/Divider/renderDivider.js +8 -7
- package/lib/components/Divider/renderDivider.js.map +1 -1
- package/lib/components/Divider/useDivider.d.ts +4 -9
- package/lib/components/Divider/useDivider.js +37 -19
- package/lib/components/Divider/useDivider.js.map +1 -1
- package/lib/components/Divider/useDividerStyles.d.ts +2 -2
- package/lib/components/Divider/useDividerStyles.js +169 -204
- package/lib/components/Divider/useDividerStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Divider.js +7 -2
- package/lib-commonjs/Divider.js.map +1 -1
- package/lib-commonjs/common/isConformant.d.ts +3 -1
- package/lib-commonjs/common/isConformant.js +17 -7
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/components/Divider/Divider.d.ts +4 -5
- package/lib-commonjs/components/Divider/Divider.js +20 -11
- package/lib-commonjs/components/Divider/Divider.js.map +1 -1
- package/lib-commonjs/components/Divider/Divider.types.d.ts +23 -36
- package/lib-commonjs/components/Divider/Divider.types.js +4 -1
- package/lib-commonjs/components/Divider/Divider.types.js.map +1 -1
- package/lib-commonjs/components/Divider/index.js +12 -2
- package/lib-commonjs/components/Divider/index.js.map +1 -1
- package/lib-commonjs/components/Divider/renderDivider.d.ts +1 -1
- package/lib-commonjs/components/Divider/renderDivider.js +20 -10
- package/lib-commonjs/components/Divider/renderDivider.js.map +1 -1
- package/lib-commonjs/components/Divider/useDivider.d.ts +4 -9
- package/lib-commonjs/components/Divider/useDivider.js +46 -20
- package/lib-commonjs/components/Divider/useDivider.js.map +1 -1
- package/lib-commonjs/components/Divider/useDividerStyles.d.ts +2 -2
- package/lib-commonjs/components/Divider/useDividerStyles.js +178 -205
- package/lib-commonjs/components/Divider/useDividerStyles.js.map +1 -1
- package/lib-commonjs/index.js +7 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +15 -12
- package/NOTICE.txt +0 -0
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -7
- package/etc/react-divider.api.md +0 -45
- package/just.config.ts +0 -3
- package/lib-amd/Divider.d.ts +0 -1
- package/lib-amd/Divider.js +0 -6
- package/lib-amd/Divider.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -2
- package/lib-amd/common/isConformant.js +0 -13
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Divider/Divider.d.ts +0 -7
- package/lib-amd/components/Divider/Divider.js +0 -15
- package/lib-amd/components/Divider/Divider.js.map +0 -1
- package/lib-amd/components/Divider/Divider.types.d.ts +0 -48
- package/lib-amd/components/Divider/Divider.types.js +0 -5
- package/lib-amd/components/Divider/Divider.types.js.map +0 -1
- package/lib-amd/components/Divider/index.d.ts +0 -5
- package/lib-amd/components/Divider/index.js +0 -9
- package/lib-amd/components/Divider/index.js.map +0 -1
- package/lib-amd/components/Divider/renderDivider.d.ts +0 -5
- package/lib-amd/components/Divider/renderDivider.js +0 -13
- package/lib-amd/components/Divider/renderDivider.js.map +0 -1
- package/lib-amd/components/Divider/useDivider.d.ts +0 -13
- package/lib-amd/components/Divider/useDivider.js +0 -26
- package/lib-amd/components/Divider/useDivider.js.map +0 -1
- package/lib-amd/components/Divider/useDividerStyles.d.ts +0 -3
- package/lib-amd/components/Divider/useDividerStyles.js +0 -210
- package/lib-amd/components/Divider/useDividerStyles.js.map +0 -1
- package/lib-amd/index.d.ts +0 -1
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/src/components/Divider/Divider.types.ts +0 -56
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,149 +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
|
-
```
|
60
|
-
|
61
|
-
Content
|
62
|
-
|
63
|
-
```html
|
64
|
-
<Divider>My Content</Divider>
|
65
|
-
```
|
42
|
+
The `Divider` component has two layout variants:
|
66
43
|
|
67
|
-
|
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.
|
68
46
|
|
69
|
-
|
70
|
-
<Divider><Icon /></Divider>
|
71
|
-
```
|
47
|
+
### Inset
|
72
48
|
|
73
|
-
|
49
|
+
A `Divider` with the `inset` prop adds padding to the beginning and end of the component.
|
74
50
|
|
75
|
-
|
76
|
-
<Divider important>This is important!</Divider>
|
77
|
-
```
|
51
|
+
### Appearance
|
78
52
|
|
79
|
-
|
53
|
+
The `Divider` component has four appearance variants:
|
80
54
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
Appearance
|
86
|
-
|
87
|
-
```html
|
88
|
-
<Divider apperance="subtle" />
|
89
|
-
<Divider apperance="brand" />
|
90
|
-
<Divider apperance="strong" />
|
91
|
-
```
|
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.
|
92
59
|
|
93
60
|
## API
|
94
61
|
|
95
62
|
From [Divider.types.tsx](https://github.com/microsoft/fluentui/blob/master/packages/react-divider/src/components/Divider/Divider.types.ts)
|
96
63
|
|
97
|
-
|
98
|
-
|
99
|
-
- root
|
100
|
-
|
101
|
-
### Props
|
102
|
-
|
103
|
-
```ts
|
104
|
-
export interface DividerProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
|
105
|
-
/**
|
106
|
-
* Determines the alignment of the content within the divider.
|
107
|
-
* @defaultvalue 'center'
|
108
|
-
*/
|
109
|
-
alignContent?: 'start' | 'end' | 'center';
|
110
|
-
|
111
|
-
/**
|
112
|
-
* Predefined visual styles
|
113
|
-
* @defaultvalue 'default'
|
114
|
-
*/
|
115
|
-
appearance?: 'default' | 'subtle' | 'brand' | 'strong';
|
116
|
-
|
117
|
-
/**
|
118
|
-
* A divider can have a overriding border color
|
119
|
-
*/
|
120
|
-
color?: string;
|
121
|
-
|
122
|
-
/**
|
123
|
-
* A divider can be classified as important to emphasize its content
|
124
|
-
*/
|
125
|
-
important?: boolean;
|
126
|
-
|
127
|
-
/**
|
128
|
-
* Adds a 12px padding to the begining and end of the divider
|
129
|
-
*/
|
130
|
-
inset?: boolean;
|
131
|
-
|
132
|
-
/**
|
133
|
-
* A divider can be horizontal (default) or vertical
|
134
|
-
*/
|
135
|
-
vertical?: boolean;
|
136
|
-
|
137
|
-
/**
|
138
|
-
* Overrides for border visuals
|
139
|
-
*/
|
140
|
-
borderStyle?: string;
|
141
|
-
borderSize?: string | number;
|
142
|
-
|
143
|
-
/**
|
144
|
-
* Accessibility wrapper for content when presented.
|
145
|
-
* A shorthand prop can be a literal, object, or
|
146
|
-
* JSX. The `children` prop of the object can be a render function,
|
147
|
-
* taking in the original slot component and props.
|
148
|
-
*/
|
149
|
-
wrapper?: ShorthandProps<React.HTMLAttributes<HTMLDivElement>>;
|
150
|
-
}
|
151
|
-
```
|
152
|
-
|
153
|
-
## Styling Tokens
|
154
|
-
|
155
|
-
The current exposed tokens and default values are listed below:
|
156
|
-
|
157
|
-
**Default**
|
158
|
-
|
159
|
-
Font Color : tokens.alias.color.neutral.neutralForeground2
|
160
|
-
|
161
|
-
Border Color: tokens.alias.color.neutral.neutralStroke2
|
162
|
-
|
163
|
-
**Subtle**
|
164
|
-
|
165
|
-
Font Color : tokens.alias.color.neutral.neutralForeground2
|
64
|
+
## HTML Structure
|
166
65
|
|
167
|
-
|
168
|
-
|
169
|
-
**Brand**
|
170
|
-
|
171
|
-
Font Color : tokens.alias.color.brand.brandBackgroundStatic
|
172
|
-
|
173
|
-
Border Color: tokens.alias.color.brand.brandBackgroundStatic
|
174
|
-
|
175
|
-
**Brand**
|
176
|
-
|
177
|
-
Font Color : tokens.alias.color.neutral.neutralForeground2
|
178
|
-
|
179
|
-
Border Color: tokens.alias.color.neutral.neutralStroke1
|
180
|
-
|
181
|
-
## Structure
|
182
|
-
|
183
|
-
```
|
66
|
+
```html
|
184
67
|
<div>
|
185
68
|
<!-- ::before to handle the divider line independent of the divider having content or not -->
|
186
69
|
<div>Content</div>
|
@@ -195,11 +78,13 @@ Border Color: tokens.alias.color.neutral.neutralStroke1
|
|
195
78
|
## Behaviors
|
196
79
|
|
197
80
|
This component has no state.
|
198
|
-
This control will have no interactions.
|
199
|
-
This control will have no effect on screen readers.
|
200
81
|
|
201
|
-
|
82
|
+
This component has no mouse, touch or keyboard interactions.
|
83
|
+
|
84
|
+
Content, if provided, will self-determine its behaviors.
|
202
85
|
|
203
86
|
## Accessibility
|
204
87
|
|
205
|
-
|
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/react-divider.d.ts
CHANGED
@@ -1,80 +1,66 @@
|
|
1
|
-
import { ComponentProps } from '@fluentui/react-utilities';
|
2
|
-
import
|
3
|
-
import {
|
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 type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
5
|
+
import * as React_2 from 'react';
|
4
6
|
|
5
7
|
/**
|
6
|
-
*
|
7
|
-
* {@docCategory Divider}
|
8
|
+
* A divider visually segments content into groups.
|
8
9
|
*/
|
9
|
-
export declare const Divider:
|
10
|
+
export declare const Divider: ForwardRefComponent<DividerProps>;
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
export declare interface DividerProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
|
12
|
+
export declare const dividerClassName = "fui-Divider";
|
13
|
+
|
14
|
+
export declare type DividerCommons = {
|
15
15
|
/**
|
16
16
|
* Determines the alignment of the content within the divider.
|
17
17
|
* @defaultvalue 'center'
|
18
18
|
*/
|
19
|
-
alignContent
|
19
|
+
alignContent: 'start' | 'center' | 'end';
|
20
20
|
/**
|
21
|
-
*
|
22
|
-
*
|
21
|
+
* A divider can have one of the preset appearances.
|
22
|
+
* When not specified, the divider has its default appearance.
|
23
23
|
*/
|
24
|
-
appearance?: '
|
24
|
+
appearance?: 'brand' | 'strong' | 'subtle';
|
25
25
|
/**
|
26
|
-
*
|
26
|
+
* Adds padding to the beginning and end of the divider.
|
27
|
+
* @default false
|
27
28
|
*/
|
28
|
-
|
29
|
+
inset: boolean;
|
29
30
|
/**
|
30
|
-
*
|
31
|
-
|
32
|
-
inset?: boolean;
|
33
|
-
/**
|
34
|
-
* A divider can be horizontal (default) or vertical*/
|
35
|
-
vertical?: boolean;
|
36
|
-
/**
|
37
|
-
* Accessibility wrapper for content when presented.
|
38
|
-
* A shorthand prop can be a literal, object, or
|
39
|
-
* JSX. The `children` prop of the object can be a render function,
|
40
|
-
* taking in the original slot component and props.
|
31
|
+
* A divider can be horizontal (default) or vertical.
|
32
|
+
* @default false
|
41
33
|
*/
|
42
|
-
|
43
|
-
}
|
34
|
+
vertical: boolean;
|
35
|
+
};
|
44
36
|
|
45
|
-
|
46
|
-
* Consts listing which props are shorthand props.
|
47
|
-
*/
|
48
|
-
export declare const dividerShorthandProps: readonly ["wrapper", "children"];
|
37
|
+
export declare type DividerProps = ComponentProps<DividerSlots> & Partial<DividerCommons>;
|
49
38
|
|
50
|
-
|
51
|
-
* {@docCategory Divider}
|
52
|
-
*/
|
53
|
-
export declare interface DividerState extends DividerProps {
|
39
|
+
export declare type DividerSlots = {
|
54
40
|
/**
|
55
|
-
*
|
41
|
+
* Root of the component that renders as a `<div>` tag.
|
56
42
|
*/
|
57
|
-
|
43
|
+
root: IntrinsicShorthandProps<'div'>;
|
58
44
|
/**
|
59
|
-
*
|
45
|
+
* Accessibility wrapper for content when presented.
|
60
46
|
*/
|
61
|
-
|
62
|
-
}
|
47
|
+
wrapper: IntrinsicShorthandProps<'div'>;
|
48
|
+
};
|
49
|
+
|
50
|
+
export declare type DividerState = ComponentState<DividerSlots> & DividerCommons;
|
63
51
|
|
64
52
|
/**
|
65
|
-
*
|
53
|
+
* Renders a Divider component by passing the slot props (defined in `state`) to the appropriate slots.
|
66
54
|
*/
|
67
55
|
export declare const renderDivider: (state: DividerState) => JSX.Element;
|
68
56
|
|
69
57
|
/**
|
70
58
|
* Returns the props and state required to render the component
|
71
|
-
* @param props - Divider
|
72
|
-
* @param ref -
|
73
|
-
* @param defaultProps - default values for the properties of Divider
|
59
|
+
* @param props - User-provided props to the Divider component.
|
60
|
+
* @param ref - User-provided ref to be passed to the Divider component.
|
74
61
|
*/
|
75
|
-
export declare const useDivider: (props: DividerProps, ref:
|
62
|
+
export declare const useDivider: (props: DividerProps, ref: React_2.Ref<HTMLElement>) => DividerState;
|
76
63
|
|
77
|
-
|
78
|
-
export declare const useDividerStyles: (s: DividerState) => DividerState;
|
64
|
+
export declare const useDividerStyles: (state: DividerState) => DividerState;
|
79
65
|
|
80
66
|
export { }
|
package/lib/Divider.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Divider.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Divider.js","sourceRoot":"","sources":["../src/Divider.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
@@ -1,2 +1,4 @@
|
|
1
1
|
import { IsConformantOptions } from '@fluentui/react-conformance';
|
2
|
-
export declare function isConformant(testInfo: Omit<IsConformantOptions
|
2
|
+
export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
|
3
|
+
componentPath?: string;
|
4
|
+
}): void;
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
|
2
|
+
import makeStylesTests from '@fluentui/react-conformance-make-styles';
|
2
3
|
export function isConformant(testInfo) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
const defaultOptions = {
|
5
|
+
asPropHandlesRef: true,
|
6
|
+
componentPath: module.parent.filename.replace('.test', ''),
|
7
|
+
extraTests: makeStylesTests
|
8
|
+
};
|
9
|
+
baseIsConformant(defaultOptions, testInfo);
|
8
10
|
}
|
9
11
|
//# sourceMappingURL=isConformant.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAkF,6BAAlF;AACA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,QAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,UAAU,EAAE;AAH+C,GAA7D;AAMA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import { DividerProps } from './Divider.types';
|
1
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
2
|
+
import type { DividerProps } from './Divider.types';
|
3
3
|
/**
|
4
|
-
*
|
5
|
-
* {@docCategory Divider}
|
4
|
+
* A divider visually segments content into groups.
|
6
5
|
*/
|
7
|
-
export declare const Divider:
|
6
|
+
export declare const Divider: ForwardRefComponent<DividerProps>;
|
@@ -3,13 +3,13 @@ import { renderDivider } from './renderDivider';
|
|
3
3
|
import { useDivider } from './useDivider';
|
4
4
|
import { useDividerStyles } from './useDividerStyles';
|
5
5
|
/**
|
6
|
-
*
|
7
|
-
* {@docCategory Divider}
|
6
|
+
* A divider visually segments content into groups.
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
|
9
|
+
export const Divider = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const state = useDivider(props, ref);
|
11
|
+
useDividerStyles(state);
|
12
|
+
return renderDivider(state);
|
13
13
|
});
|
14
14
|
Divider.displayName = 'Divider';
|
15
15
|
//# sourceMappingURL=Divider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,aAAT,QAA8B,iBAA9B;AACA,SAAS,UAAT,QAA2B,cAA3B;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AAIA;;AAEG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxF,QAAM,KAAK,GAAG,UAAU,CAAC,KAAD,EAAQ,GAAR,CAAxB;AAEA,EAAA,gBAAgB,CAAC,KAAD,CAAhB;AAEA,SAAO,aAAa,CAAC,KAAD,CAApB;AACD,CANyD,CAAnD;AAQP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourceRoot":""}
|
@@ -1,48 +1,35 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
/**
|
4
|
-
* {@docCategory Divider}
|
5
|
-
*/
|
6
|
-
export interface DividerProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
|
1
|
+
import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
2
|
+
export declare type DividerSlots = {
|
7
3
|
/**
|
8
|
-
*
|
9
|
-
* @defaultvalue 'center'
|
4
|
+
* Root of the component that renders as a `<div>` tag.
|
10
5
|
*/
|
11
|
-
|
6
|
+
root: IntrinsicShorthandProps<'div'>;
|
12
7
|
/**
|
13
|
-
*
|
14
|
-
* @defaultvalue 'default'
|
15
|
-
*/
|
16
|
-
appearance?: 'default' | 'subtle' | 'brand' | 'strong';
|
17
|
-
/**
|
18
|
-
* A divider can be classified as important to emphasize its content
|
8
|
+
* Accessibility wrapper for content when presented.
|
19
9
|
*/
|
20
|
-
|
10
|
+
wrapper: IntrinsicShorthandProps<'div'>;
|
11
|
+
};
|
12
|
+
export declare type DividerCommons = {
|
21
13
|
/**
|
22
|
-
*
|
14
|
+
* Determines the alignment of the content within the divider.
|
15
|
+
* @defaultvalue 'center'
|
23
16
|
*/
|
24
|
-
|
17
|
+
alignContent: 'start' | 'center' | 'end';
|
25
18
|
/**
|
26
|
-
* A divider can
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Accessibility wrapper for content when presented.
|
30
|
-
* A shorthand prop can be a literal, object, or
|
31
|
-
* JSX. The `children` prop of the object can be a render function,
|
32
|
-
* taking in the original slot component and props.
|
19
|
+
* A divider can have one of the preset appearances.
|
20
|
+
* When not specified, the divider has its default appearance.
|
33
21
|
*/
|
34
|
-
|
35
|
-
}
|
36
|
-
/**
|
37
|
-
* {@docCategory Divider}
|
38
|
-
*/
|
39
|
-
export interface DividerState extends DividerProps {
|
22
|
+
appearance?: 'brand' | 'strong' | 'subtle';
|
40
23
|
/**
|
41
|
-
*
|
24
|
+
* Adds padding to the beginning and end of the divider.
|
25
|
+
* @default false
|
42
26
|
*/
|
43
|
-
|
27
|
+
inset: boolean;
|
44
28
|
/**
|
45
|
-
*
|
29
|
+
* A divider can be horizontal (default) or vertical.
|
30
|
+
* @default false
|
46
31
|
*/
|
47
|
-
|
48
|
-
}
|
32
|
+
vertical: boolean;
|
33
|
+
};
|
34
|
+
export declare type DividerProps = ComponentProps<DividerSlots> & Partial<DividerCommons>;
|
35
|
+
export declare type DividerState = ComponentState<DividerSlots> & DividerCommons;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Divider.types.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Divider.types.js","sourceRoot":"","sources":["../../../src/components/Divider/Divider.types.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/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"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DividerState } from './Divider.types';
|
2
2
|
/**
|
3
|
-
*
|
3
|
+
* Renders a Divider component by passing the slot props (defined in `state`) to the appropriate slots.
|
4
4
|
*/
|
5
5
|
export declare const renderDivider: (state: DividerState) => JSX.Element;
|
@@ -1,13 +1,14 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
4
|
-
import { dividerShorthandProps } from './useDivider';
|
5
3
|
/**
|
6
|
-
*
|
4
|
+
* Renders a Divider component by passing the slot props (defined in `state`) to the appropriate slots.
|
7
5
|
*/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
|
7
|
+
export const renderDivider = state => {
|
8
|
+
const {
|
9
|
+
slots,
|
10
|
+
slotProps
|
11
|
+
} = getSlots(state, ['root', 'wrapper']);
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, Object.assign({}, slotProps.root), slotProps.root.children !== undefined && /*#__PURE__*/React.createElement(slots.wrapper, Object.assign({}, slotProps.wrapper), slotProps.root.children));
|
12
13
|
};
|
13
14
|
//# sourceMappingURL=renderDivider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Divider/renderDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,aAAa,GAAI,KAAD,IAAwB;AACnD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAe,KAAf,EAAsB,CAAC,MAAD,EAAS,SAAT,CAAtB,CAArC;AACA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,SAAS,CAAC,IAAV,CAAe,QAAf,KAA4B,SAA5B,iBACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,OAAf,CAAd,EAAuC,SAAS,CAAC,IAAV,CAAe,QAAtD,CAFJ,CADF;AAOD,CATM","sourceRoot":""}
|
@@ -1,13 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { DividerProps, DividerState } from './Divider.types';
|
3
|
-
/**
|
4
|
-
* Consts listing which props are shorthand props.
|
5
|
-
*/
|
6
|
-
export declare const dividerShorthandProps: readonly ["wrapper", "children"];
|
2
|
+
import type { DividerProps, DividerState } from './Divider.types';
|
7
3
|
/**
|
8
4
|
* Returns the props and state required to render the component
|
9
|
-
* @param props - Divider
|
10
|
-
* @param ref -
|
11
|
-
* @param defaultProps - default values for the properties of Divider
|
5
|
+
* @param props - User-provided props to the Divider component.
|
6
|
+
* @param ref - User-provided ref to be passed to the Divider component.
|
12
7
|
*/
|
13
|
-
export declare const useDivider: (props: DividerProps, ref: React.Ref<HTMLElement
|
8
|
+
export declare const useDivider: (props: DividerProps, ref: React.Ref<HTMLElement>) => DividerState;
|
@@ -1,24 +1,42 @@
|
|
1
|
-
import
|
2
|
-
import { makeMergeProps, resolveShorthandProps, useId, useMergedRefs } from '@fluentui/react-utilities';
|
3
|
-
/**
|
4
|
-
* Consts listing which props are shorthand props.
|
5
|
-
*/
|
6
|
-
export var dividerShorthandProps = ['wrapper', 'children'];
|
7
|
-
var mergeProps = makeMergeProps({ deepMerge: dividerShorthandProps });
|
1
|
+
import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';
|
8
2
|
/**
|
9
3
|
* Returns the props and state required to render the component
|
10
|
-
* @param props - Divider
|
11
|
-
* @param ref -
|
12
|
-
* @param defaultProps - default values for the properties of Divider
|
4
|
+
* @param props - User-provided props to the Divider component.
|
5
|
+
* @param ref - User-provided ref to be passed to the Divider component.
|
13
6
|
*/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
7
|
+
|
8
|
+
export const useDivider = (props, ref) => {
|
9
|
+
const {
|
10
|
+
alignContent = 'center',
|
11
|
+
appearance,
|
12
|
+
inset = false,
|
13
|
+
vertical = false,
|
14
|
+
wrapper
|
15
|
+
} = props;
|
16
|
+
const dividerId = useId('divider-');
|
17
|
+
return {
|
18
|
+
// Props passed at the top-level
|
19
|
+
alignContent,
|
20
|
+
appearance,
|
21
|
+
inset,
|
22
|
+
vertical,
|
23
|
+
// Slots definition
|
24
|
+
components: {
|
25
|
+
root: 'div',
|
26
|
+
wrapper: 'div'
|
27
|
+
},
|
28
|
+
root: getNativeElementProps('div', { ...props,
|
29
|
+
ref,
|
30
|
+
role: 'separator',
|
31
|
+
'aria-labelledby': props.children ? dividerId : undefined
|
32
|
+
}),
|
33
|
+
wrapper: resolveShorthand(wrapper, {
|
34
|
+
required: true,
|
35
|
+
defaultProps: {
|
36
|
+
id: dividerId,
|
37
|
+
children: props.children
|
38
|
+
}
|
39
|
+
})
|
40
|
+
};
|
23
41
|
};
|
24
42
|
//# sourceMappingURL=useDivider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Divider/useDivider.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AAGA;;;;AAIG;;AACH,OAAO,MAAM,UAAU,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAmE;AAC3F,QAAM;AAAE,IAAA,YAAY,GAAG,QAAjB;AAA2B,IAAA,UAA3B;AAAuC,IAAA,KAAK,GAAG,KAA/C;AAAsD,IAAA,QAAQ,GAAG,KAAjE;AAAwE,IAAA;AAAxE,MAAoF,KAA1F;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,yBAAmB,KAAK,CAAC,QAAN,GAAiB,SAAjB,GAA6B;AAJf,KAAR,CAbtB;AAmBL,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;AAnBpB,GAAP;AA2BD,CA/BM","sourceRoot":""}
|