@fluentui/react-label 9.0.0-alpha.9 → 9.0.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +1348 -1
- package/CHANGELOG.md +486 -2
- package/Spec.md +28 -31
- package/dist/react-label.d.ts +28 -45
- package/lib/Label.js.map +1 -1
- package/lib/common/isConformant.d.ts +1 -1
- package/lib/common/isConformant.js +7 -5
- package/lib/common/isConformant.js.map +1 -1
- package/lib/components/Label/Label.d.ts +3 -4
- package/lib/components/Label/Label.js +5 -5
- package/lib/components/Label/Label.js.map +1 -1
- package/lib/components/Label/Label.types.d.ts +17 -32
- package/lib/components/Label/Label.types.js.map +1 -1
- package/lib/components/Label/index.js.map +1 -1
- package/lib/components/Label/renderLabel.d.ts +1 -2
- package/lib/components/Label/renderLabel.js +7 -7
- package/lib/components/Label/renderLabel.js.map +1 -1
- package/lib/components/Label/useLabel.d.ts +3 -6
- package/lib/components/Label/useLabel.js +32 -36
- package/lib/components/Label/useLabel.js.map +1 -1
- package/lib/components/Label/useLabelStyles.d.ts +2 -1
- package/lib/components/Label/useLabelStyles.js +44 -35
- package/lib/components/Label/useLabelStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Label.js +7 -2
- package/lib-commonjs/Label.js.map +1 -1
- package/lib-commonjs/common/isConformant.d.ts +1 -1
- package/lib-commonjs/common/isConformant.js +16 -7
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/components/Label/Label.d.ts +3 -4
- package/lib-commonjs/components/Label/Label.js +18 -10
- package/lib-commonjs/components/Label/Label.js.map +1 -1
- package/lib-commonjs/components/Label/Label.types.d.ts +17 -32
- package/lib-commonjs/components/Label/Label.types.js +4 -1
- package/lib-commonjs/components/Label/Label.types.js.map +1 -1
- package/lib-commonjs/components/Label/index.js +11 -2
- package/lib-commonjs/components/Label/index.js.map +1 -1
- package/lib-commonjs/components/Label/renderLabel.d.ts +1 -2
- package/lib-commonjs/components/Label/renderLabel.js +19 -11
- package/lib-commonjs/components/Label/renderLabel.js.map +1 -1
- package/lib-commonjs/components/Label/useLabel.d.ts +3 -6
- package/lib-commonjs/components/Label/useLabel.js +40 -37
- package/lib-commonjs/components/Label/useLabel.js.map +1 -1
- package/lib-commonjs/components/Label/useLabelStyles.d.ts +2 -1
- package/lib-commonjs/components/Label/useLabelStyles.js +52 -37
- package/lib-commonjs/components/Label/useLabelStyles.js.map +1 -1
- package/lib-commonjs/index.js +7 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +14 -11
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -7
- package/etc/react-label.api.md +0 -51
- package/just.config.ts +0 -3
- package/lib-amd/Label.d.ts +0 -1
- package/lib-amd/Label.js +0 -6
- package/lib-amd/Label.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -4
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Label/Label.d.ts +0 -7
- package/lib-amd/components/Label/Label.js +0 -16
- package/lib-amd/components/Label/Label.js.map +0 -1
- package/lib-amd/components/Label/Label.types.d.ts +0 -53
- package/lib-amd/components/Label/Label.types.js +0 -5
- package/lib-amd/components/Label/Label.types.js.map +0 -1
- package/lib-amd/components/Label/index.d.ts +0 -5
- package/lib-amd/components/Label/index.js +0 -10
- package/lib-amd/components/Label/index.js.map +0 -1
- package/lib-amd/components/Label/renderLabel.d.ts +0 -6
- package/lib-amd/components/Label/renderLabel.js +0 -17
- package/lib-amd/components/Label/renderLabel.js.map +0 -1
- package/lib-amd/components/Label/useLabel.d.ts +0 -20
- package/lib-amd/components/Label/useLabel.js +0 -55
- package/lib-amd/components/Label/useLabel.js.map +0 -1
- package/lib-amd/components/Label/useLabelStyles.d.ts +0 -5
- package/lib-amd/components/Label/useLabelStyles.js +0 -49
- package/lib-amd/components/Label/useLabelStyles.js.map +0 -1
- package/lib-amd/index.d.ts +0 -2
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/src/components/Label/Label.types.ts +0 -61
package/dist/react-label.d.ts
CHANGED
@@ -1,79 +1,65 @@
|
|
1
|
-
import { ComponentProps } from '@fluentui/react-utilities';
|
2
|
-
import { ComponentState } from '@fluentui/react-utilities';
|
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 type { ObjectShorthandProps } from '@fluentui/react-utilities';
|
4
6
|
import * as React_2 from 'react';
|
5
|
-
import { ShorthandProps } from '@fluentui/react-utilities';
|
6
7
|
|
7
8
|
/**
|
8
9
|
* A label component provides a title or name to a component.
|
9
|
-
* {@docCategory Label}
|
10
10
|
*/
|
11
|
-
export declare const Label:
|
11
|
+
export declare const Label: ForwardRefComponent<LabelProps>;
|
12
12
|
|
13
|
-
|
14
|
-
* Names of LabelProps that have a default value in useLabel
|
15
|
-
* {@docCategory Label}
|
16
|
-
*/
|
17
|
-
export declare type LabelDefaultedProps = 'size';
|
13
|
+
export declare const labelClassName = "fui-Label";
|
18
14
|
|
19
15
|
/**
|
20
16
|
* Label Props
|
21
|
-
* {@docCategory Label}
|
22
17
|
*/
|
23
|
-
export declare
|
18
|
+
export declare type LabelCommons = {
|
24
19
|
/**
|
25
20
|
* Renders the label as disabled
|
26
21
|
* @defaultvalue false
|
27
22
|
*/
|
28
|
-
disabled
|
29
|
-
/**
|
30
|
-
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
31
|
-
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
32
|
-
* @defaultvalue false
|
33
|
-
*/
|
34
|
-
required?: boolean | ShorthandProps<ComponentProps>;
|
23
|
+
disabled: boolean;
|
35
24
|
/**
|
36
25
|
* A label supports different sizes.
|
37
26
|
* @defaultvalue 'medium'
|
38
27
|
*/
|
39
|
-
size
|
28
|
+
size: 'small' | 'medium' | 'large';
|
40
29
|
/**
|
41
30
|
* A label supports semibold/strong fontweight.
|
42
31
|
* @defaultvalue false
|
43
32
|
*/
|
44
|
-
strong
|
45
|
-
}
|
33
|
+
strong: boolean;
|
34
|
+
};
|
46
35
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
36
|
+
export declare type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & Partial<LabelCommons> & {
|
37
|
+
/**
|
38
|
+
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
39
|
+
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
40
|
+
* @defaultvalue false
|
41
|
+
*/
|
42
|
+
required?: boolean | ObjectShorthandProps<React_2.HTMLAttributes<HTMLElement>> | React_2.ReactNode;
|
43
|
+
};
|
52
44
|
|
53
45
|
/**
|
54
46
|
* Array of all shorthand properties listed in LabelShorthandProps
|
55
47
|
* {@docCatergory Label}
|
56
48
|
*/
|
57
|
-
export declare const labelShorthandProps:
|
49
|
+
export declare const labelShorthandProps: Array<keyof LabelSlots>;
|
50
|
+
|
51
|
+
export declare type LabelSlots = {
|
52
|
+
root: IntrinsicShorthandProps<'label'>;
|
53
|
+
required?: IntrinsicShorthandProps<'span'>;
|
54
|
+
};
|
58
55
|
|
59
56
|
/**
|
60
57
|
* State used in rendering Label
|
61
|
-
* {@docCategory Label}
|
62
58
|
*/
|
63
|
-
export declare
|
64
|
-
/**
|
65
|
-
* Ref to the root element
|
66
|
-
*/
|
67
|
-
ref: React_2.Ref<HTMLElement>;
|
68
|
-
/**
|
69
|
-
* The required prop resolved to a slot object
|
70
|
-
*/
|
71
|
-
required?: ObjectShorthandProps<ComponentProps>;
|
72
|
-
}
|
59
|
+
export declare type LabelState = ComponentState<LabelSlots> & LabelCommons;
|
73
60
|
|
74
61
|
/**
|
75
62
|
* Render the final JSX of Label
|
76
|
-
* {@docCategory Label}
|
77
63
|
*/
|
78
64
|
export declare const renderLabel: (state: LabelState) => JSX.Element;
|
79
65
|
|
@@ -85,11 +71,8 @@ export declare const renderLabel: (state: LabelState) => JSX.Element;
|
|
85
71
|
*
|
86
72
|
* @param props - props from this instance of Label
|
87
73
|
* @param ref - reference to root HTMLElement of Label
|
88
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
89
|
-
*
|
90
|
-
* {@docCategory Label}
|
91
74
|
*/
|
92
|
-
export declare const useLabel: (props: LabelProps, ref: React_2.Ref<HTMLElement
|
75
|
+
export declare const useLabel: (props: LabelProps, ref: React_2.Ref<HTMLElement>) => LabelState;
|
93
76
|
|
94
77
|
/**
|
95
78
|
* Apply styling to the Label slots based on the state
|
package/lib/Label.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Label.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../src/Label.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IsConformantOptions } from '@fluentui/react-conformance';
|
1
|
+
import type { IsConformantOptions } from '@fluentui/react-conformance';
|
2
2
|
export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
|
3
3
|
componentPath?: string;
|
4
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,QAAiD,6BAAjD;AAEA,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 {
|
1
|
+
import type { LabelProps } from './Label.types';
|
2
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* A label component provides a title or name to a component.
|
5
|
-
* {@docCategory Label}
|
6
5
|
*/
|
7
|
-
export declare const Label:
|
6
|
+
export declare const Label: ForwardRefComponent<LabelProps>;
|
@@ -4,12 +4,12 @@ import { renderLabel } from './renderLabel';
|
|
4
4
|
import { useLabelStyles } from './useLabelStyles';
|
5
5
|
/**
|
6
6
|
* A label component provides a title or name to a component.
|
7
|
-
* {@docCategory Label}
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
|
9
|
+
export const Label = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const state = useLabel(props, ref);
|
11
|
+
useLabelStyles(state);
|
12
|
+
return renderLabel(state);
|
13
13
|
});
|
14
14
|
Label.displayName = 'Label';
|
15
15
|
//# sourceMappingURL=Label.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,YAAzB;AACA,SAAS,WAAT,QAA4B,eAA5B;AACA,SAAS,cAAT,QAA+B,kBAA/B;AAIA;;AAEG;;AACH,OAAO,MAAM,KAAK,gBAAoC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACpF,QAAM,KAAK,GAAG,QAAQ,CAAC,KAAD,EAAQ,GAAR,CAAtB;AAEA,EAAA,cAAc,CAAC,KAAD,CAAd;AACA,SAAO,WAAW,CAAC,KAAD,CAAlB;AACD,CALqD,CAA/C;AAOP,KAAK,CAAC,WAAN,GAAoB,OAApB","sourceRoot":""}
|
@@ -1,53 +1,38 @@
|
|
1
|
+
import type { ComponentProps, ComponentState, IntrinsicShorthandProps, ObjectShorthandProps } from '@fluentui/react-utilities';
|
1
2
|
import * as React from 'react';
|
2
|
-
import { ComponentProps, ComponentState, ObjectShorthandProps, ShorthandProps } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Label Props
|
5
|
-
* {@docCategory Label}
|
6
5
|
*/
|
7
|
-
export
|
6
|
+
export declare type LabelCommons = {
|
8
7
|
/**
|
9
8
|
* Renders the label as disabled
|
10
9
|
* @defaultvalue false
|
11
10
|
*/
|
12
|
-
disabled
|
13
|
-
/**
|
14
|
-
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
15
|
-
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
16
|
-
* @defaultvalue false
|
17
|
-
*/
|
18
|
-
required?: boolean | ShorthandProps<ComponentProps>;
|
11
|
+
disabled: boolean;
|
19
12
|
/**
|
20
13
|
* A label supports different sizes.
|
21
14
|
* @defaultvalue 'medium'
|
22
15
|
*/
|
23
|
-
size
|
16
|
+
size: 'small' | 'medium' | 'large';
|
24
17
|
/**
|
25
18
|
* A label supports semibold/strong fontweight.
|
26
19
|
* @defaultvalue false
|
27
20
|
*/
|
28
|
-
strong
|
29
|
-
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
export declare type LabelShorthandProps = 'required';
|
35
|
-
/**
|
36
|
-
* Names of LabelProps that have a default value in useLabel
|
37
|
-
* {@docCategory Label}
|
38
|
-
*/
|
39
|
-
export declare type LabelDefaultedProps = 'size';
|
21
|
+
strong: boolean;
|
22
|
+
};
|
23
|
+
export declare type LabelSlots = {
|
24
|
+
root: IntrinsicShorthandProps<'label'>;
|
25
|
+
required?: IntrinsicShorthandProps<'span'>;
|
26
|
+
};
|
40
27
|
/**
|
41
28
|
* State used in rendering Label
|
42
|
-
* {@docCategory Label}
|
43
29
|
*/
|
44
|
-
export
|
45
|
-
|
46
|
-
* Ref to the root element
|
47
|
-
*/
|
48
|
-
ref: React.Ref<HTMLElement>;
|
30
|
+
export declare type LabelState = ComponentState<LabelSlots> & LabelCommons;
|
31
|
+
export declare type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & Partial<LabelCommons> & {
|
49
32
|
/**
|
50
|
-
* The required prop
|
33
|
+
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
34
|
+
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
35
|
+
* @defaultvalue false
|
51
36
|
*/
|
52
|
-
required?: ObjectShorthandProps<
|
53
|
-
}
|
37
|
+
required?: boolean | ObjectShorthandProps<React.HTMLAttributes<HTMLElement>> | React.ReactNode;
|
38
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Label.types.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Label.types.js","sourceRoot":"","sources":["../../../src/components/Label/Label.types.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Label/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
4
3
|
import { labelShorthandProps } from './useLabel';
|
5
4
|
/**
|
6
5
|
* Render the final JSX of Label
|
7
|
-
* {@docCategory Label}
|
8
6
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
|
8
|
+
export const renderLabel = state => {
|
9
|
+
const {
|
10
|
+
slots,
|
11
|
+
slotProps
|
12
|
+
} = getSlots(state, labelShorthandProps);
|
13
|
+
return /*#__PURE__*/React.createElement(slots.root, Object.assign({}, slotProps.root), state.root.children, /*#__PURE__*/React.createElement(slots.required, Object.assign({}, slotProps.required)));
|
14
14
|
};
|
15
15
|
//# sourceMappingURL=renderLabel.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/renderLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,mBAAT,QAAoC,YAApC;AAGA;;AAEG;;AACH,OAAO,MAAM,WAAW,GAAI,KAAD,IAAsB;AAC/C,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAa,KAAb,EAAoB,mBAApB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,IAAN,CAAW,QADd,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFF,CADF;AAMD,CATM","sourceRoot":""}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { LabelProps,
|
2
|
+
import type { LabelProps, LabelSlots, LabelState } from './Label.types';
|
3
3
|
/**
|
4
4
|
* Array of all shorthand properties listed in LabelShorthandProps
|
5
5
|
* {@docCatergory Label}
|
6
6
|
*/
|
7
|
-
export declare const labelShorthandProps:
|
7
|
+
export declare const labelShorthandProps: Array<keyof LabelSlots>;
|
8
8
|
/**
|
9
9
|
* Create the state required to render Label.
|
10
10
|
*
|
@@ -13,8 +13,5 @@ export declare const labelShorthandProps: LabelShorthandProps[];
|
|
13
13
|
*
|
14
14
|
* @param props - props from this instance of Label
|
15
15
|
* @param ref - reference to root HTMLElement of Label
|
16
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
17
|
-
*
|
18
|
-
* {@docCategory Label}
|
19
16
|
*/
|
20
|
-
export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement
|
17
|
+
export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement>) => LabelState;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { getNativeElementProps } from '@fluentui/react-utilities';
|
2
|
+
import { resolveShorthand } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Array of all shorthand properties listed in LabelShorthandProps
|
5
5
|
* {@docCatergory Label}
|
6
6
|
*/
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
export const labelShorthandProps = ['root', 'required'];
|
9
9
|
/**
|
10
10
|
* Create the state required to render Label.
|
11
11
|
*
|
@@ -14,38 +14,34 @@ var mergeProps = makeMergeProps({ deepMerge: labelShorthandProps });
|
|
14
14
|
*
|
15
15
|
* @param props - props from this instance of Label
|
16
16
|
* @param ref - reference to root HTMLElement of Label
|
17
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
18
|
-
*
|
19
|
-
* {@docCategory Label}
|
20
|
-
*/
|
21
|
-
export var useLabel = function (props, ref, defaultProps) {
|
22
|
-
var state = mergeProps({
|
23
|
-
ref: ref,
|
24
|
-
as: 'label',
|
25
|
-
size: 'medium',
|
26
|
-
required: {
|
27
|
-
as: 'span',
|
28
|
-
},
|
29
|
-
}, defaultProps && resolveLabelShorthandProps(defaultProps), resolveLabelShorthandProps(props));
|
30
|
-
return state;
|
31
|
-
};
|
32
|
-
/**
|
33
|
-
* Label will first need to check if required is a boolean or shorthandprops,
|
34
|
-
* this allows for the required prop to handle both the default asterisk for required
|
35
|
-
* or a custom required text.
|
36
17
|
*/
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
18
|
+
|
19
|
+
export const useLabel = (props, ref) => {
|
20
|
+
const {
|
21
|
+
disabled = false,
|
22
|
+
required = false,
|
23
|
+
strong = false,
|
24
|
+
size = 'medium'
|
25
|
+
} = props;
|
26
|
+
return {
|
27
|
+
disabled,
|
28
|
+
required: resolveShorthand(required === false ? null : required, {
|
29
|
+
required: !!required,
|
30
|
+
defaultProps: {
|
31
|
+
children: '*',
|
32
|
+
'aria-hidden': 'true'
|
33
|
+
}
|
34
|
+
}),
|
35
|
+
strong,
|
36
|
+
size,
|
37
|
+
components: {
|
38
|
+
root: 'label',
|
39
|
+
required: 'span'
|
40
|
+
},
|
41
|
+
root: getNativeElementProps('label', {
|
42
|
+
ref,
|
43
|
+
...props
|
44
|
+
})
|
45
|
+
};
|
50
46
|
};
|
51
47
|
//# sourceMappingURL=useLabel.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/useLabel.tsx"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,gBAAT,QAAiC,2BAAjC;AAEA;;;AAGG;;AACH,OAAO,MAAM,mBAAmB,GAA4B,CAAC,MAAD,EAAS,UAAT,CAArD;AAEP;;;;;;;;AAQG;;AACH,OAAO,MAAM,QAAQ,GAAG,CAAC,KAAD,EAAoB,GAApB,KAA+D;AACrF,QAAM;AAAE,IAAA,QAAQ,GAAG,KAAb;AAAoB,IAAA,QAAQ,GAAG,KAA/B;AAAsC,IAAA,MAAM,GAAG,KAA/C;AAAsD,IAAA,IAAI,GAAG;AAA7D,MAA0E,KAAhF;AACA,SAAO;AACL,IAAA,QADK;AAEL,IAAA,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,KAAK,KAAb,GAAqB,IAArB,GAA4B,QAA7B,EAAuC;AAC/D,MAAA,QAAQ,EAAE,CAAC,CAAC,QADmD;AAE/D,MAAA,YAAY,EAAE;AAAE,QAAA,QAAQ,EAAE,GAAZ;AAAiB,uBAAe;AAAhC;AAFiD,KAAvC,CAFrB;AAML,IAAA,MANK;AAOL,IAAA,IAPK;AAQL,IAAA,UAAU,EAAE;AAAE,MAAA,IAAI,EAAE,OAAR;AAAiB,MAAA,QAAQ,EAAE;AAA3B,KARP;AASL,IAAA,IAAI,EAAE,qBAAqB,CAAC,OAAD,EAAU;AAAE,MAAA,GAAF;AAAO,SAAG;AAAV,KAAV;AATtB,GAAP;AAWD,CAbM","sourceRoot":""}
|
@@ -1,44 +1,53 @@
|
|
1
|
-
import {
|
1
|
+
import { __styles, mergeClasses } from '@fluentui/react-make-styles';
|
2
|
+
export const labelClassName = 'fui-Label';
|
2
3
|
/**
|
3
4
|
* Styles for the label
|
4
5
|
*/
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
6
|
+
|
7
|
+
const useStyles = /*#__PURE__*/__styles({
|
8
|
+
"root": {
|
9
|
+
"Bahqtrf": "fk6fouc",
|
10
|
+
"sj55zd": "f19n0e5"
|
11
|
+
},
|
12
|
+
"disabled": {
|
13
|
+
"sj55zd": "f1s2aq7o"
|
14
|
+
},
|
15
|
+
"required": {
|
16
|
+
"sj55zd": "f1whyuy6",
|
17
|
+
"uwmqm3": ["fycuoez", "f8wuabp"]
|
18
|
+
},
|
19
|
+
"small": {
|
20
|
+
"Be2twd7": "fy9rknc",
|
21
|
+
"Bg96gwp": "fwrc4pm"
|
22
|
+
},
|
23
|
+
"medium": {
|
24
|
+
"Be2twd7": "fkhj508",
|
25
|
+
"Bg96gwp": "f1i3iumi"
|
26
|
+
},
|
27
|
+
"large": {
|
28
|
+
"Be2twd7": "fod5ikn",
|
29
|
+
"Bg96gwp": "faaz57k",
|
30
|
+
"Bhrd7zp": "fl43uef"
|
31
|
+
},
|
32
|
+
"strong": {
|
33
|
+
"Bhrd7zp": "fl43uef"
|
34
|
+
}
|
35
|
+
}, {
|
36
|
+
"d": [".fk6fouc{font-family:var(--fontFamilyBase);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".f1whyuy6{color:var(--colorPaletteRedForeground3);}", ".fycuoez{padding-left:4px;}", ".f8wuabp{padding-right:4px;}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}"]
|
32
37
|
});
|
33
38
|
/**
|
34
39
|
* Apply styling to the Label slots based on the state
|
35
40
|
*/
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
|
42
|
+
|
43
|
+
export const useLabelStyles = state => {
|
44
|
+
const styles = useStyles();
|
45
|
+
state.root.className = mergeClasses(labelClassName, styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.root.className);
|
46
|
+
|
47
|
+
if (state.required) {
|
48
|
+
state.required.className = mergeClasses(styles.required, state.required.className);
|
49
|
+
}
|
50
|
+
|
51
|
+
return state;
|
43
52
|
};
|
44
53
|
//# sourceMappingURL=useLabelStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/useLabelStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAGA,OAAO,MAAM,cAAc,GAAG,WAAvB;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAoCA;;AAEG;;;AACH,OAAO,MAAM,cAAc,GAAI,KAAD,IAAkC;AAC9D,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,cADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAHQ,EAIjC,MAAM,CAAC,KAAK,CAAC,IAAP,CAJ2B,EAKjC,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MALU,EAMjC,KAAK,CAAC,IAAN,CAAW,SANsB,CAAnC;;AASA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CAAC,MAAM,CAAC,QAAR,EAAkB,KAAK,CAAC,QAAN,CAAe,SAAjC,CAAvC;AACD;;AAED,SAAO,KAAP;AACD,CAhBM","sourceRoot":""}
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC"}
|
package/lib/tsdoc-metadata.json
CHANGED
package/lib-commonjs/Label.js
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
+
|
4
9
|
tslib_1.__exportStar(require("./components/Label/index"), exports);
|
5
10
|
//# sourceMappingURL=Label.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/Label.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IsConformantOptions } from '@fluentui/react-conformance';
|
1
|
+
import type { IsConformantOptions } from '@fluentui/react-conformance';
|
2
2
|
export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
|
3
3
|
componentPath?: string;
|
4
4
|
}): void;
|