@fluentui/react-label 9.0.0-alpha.45 → 9.0.0-alpha.46
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +48 -1
- package/CHANGELOG.md +15 -2
- package/dist/react-label.d.ts +26 -41
- package/lib/components/Label/Label.d.ts +2 -5
- package/lib/components/Label/Label.types.d.ts +15 -26
- package/lib/components/Label/renderLabel.js +3 -3
- package/lib/components/Label/renderLabel.js.map +1 -1
- package/lib/components/Label/useLabel.d.ts +3 -4
- package/lib/components/Label/useLabel.js +28 -40
- package/lib/components/Label/useLabel.js.map +1 -1
- package/lib/components/Label/useLabelStyles.js +1 -1
- package/lib/components/Label/useLabelStyles.js.map +1 -1
- package/lib-commonjs/components/Label/Label.d.ts +2 -5
- package/lib-commonjs/components/Label/Label.types.d.ts +15 -26
- package/lib-commonjs/components/Label/renderLabel.js +2 -2
- package/lib-commonjs/components/Label/renderLabel.js.map +1 -1
- package/lib-commonjs/components/Label/useLabel.d.ts +3 -4
- package/lib-commonjs/components/Label/useLabel.js +30 -41
- package/lib-commonjs/components/Label/useLabel.js.map +1 -1
- package/lib-commonjs/components/Label/useLabelStyles.js +1 -1
- package/lib-commonjs/components/Label/useLabelStyles.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,54 @@
|
|
2
2
|
"name": "@fluentui/react-label",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Mon, 27 Sep 2021 08:04:28 GMT",
|
6
|
+
"tag": "@fluentui/react-label_v9.0.0-alpha.46",
|
7
|
+
"version": "9.0.0-alpha.46",
|
8
|
+
"comments": {
|
9
|
+
"none": [
|
10
|
+
{
|
11
|
+
"author": "email not defined",
|
12
|
+
"package": "@fluentui/react-label",
|
13
|
+
"comment": "refactor: simplify mergeprops for label",
|
14
|
+
"commit": "7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e"
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"prerelease": [
|
18
|
+
{
|
19
|
+
"author": "beachball",
|
20
|
+
"package": "@fluentui/react-label",
|
21
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-alpha.73",
|
22
|
+
"commit": "7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"author": "beachball",
|
26
|
+
"package": "@fluentui/react-label",
|
27
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-alpha.53",
|
28
|
+
"commit": "7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"author": "beachball",
|
32
|
+
"package": "@fluentui/react-label",
|
33
|
+
"comment": "Bump @fluentui/babel-make-styles to v9.0.0-alpha.55",
|
34
|
+
"commit": "7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"author": "beachball",
|
38
|
+
"package": "@fluentui/react-label",
|
39
|
+
"comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.48",
|
40
|
+
"commit": "7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"author": "beachball",
|
44
|
+
"package": "@fluentui/react-label",
|
45
|
+
"comment": "Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.17",
|
46
|
+
"commit": "7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e"
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"date": "Fri, 24 Sep 2021 09:17:17 GMT",
|
6
53
|
"tag": "@fluentui/react-label_v9.0.0-alpha.45",
|
7
54
|
"version": "9.0.0-alpha.45",
|
8
55
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
# Change Log - @fluentui/react-label
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 27 Sep 2021 08:04:28 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-alpha.46](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.0.0-alpha.46)
|
8
|
+
|
9
|
+
Mon, 27 Sep 2021 08:04:28 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-label_v9.0.0-alpha.45..@fluentui/react-label_v9.0.0-alpha.46)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/react-make-styles to v9.0.0-alpha.73 ([commit](https://github.com/microsoft/fluentui/commit/7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e) by beachball)
|
15
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.53 ([commit](https://github.com/microsoft/fluentui/commit/7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e) by beachball)
|
16
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-alpha.55 ([commit](https://github.com/microsoft/fluentui/commit/7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e) by beachball)
|
17
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.48 ([commit](https://github.com/microsoft/fluentui/commit/7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e) by beachball)
|
18
|
+
- Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.17 ([commit](https://github.com/microsoft/fluentui/commit/7a6d4d03fc1157272a6641fd05fc27f51ba1cc0e) by beachball)
|
19
|
+
|
7
20
|
## [9.0.0-alpha.45](https://github.com/microsoft/fluentui/tree/@fluentui/react-label_v9.0.0-alpha.45)
|
8
21
|
|
9
|
-
Fri, 24 Sep 2021 09:
|
22
|
+
Fri, 24 Sep 2021 09:17:17 GMT
|
10
23
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-label_v9.0.0-alpha.44..@fluentui/react-label_v9.0.0-alpha.45)
|
11
24
|
|
12
25
|
### Changes
|
package/dist/react-label.d.ts
CHANGED
@@ -1,75 +1,61 @@
|
|
1
|
-
import {
|
2
|
-
import type {
|
3
|
-
import {
|
1
|
+
import { ComponentProps } from '@fluentui/react-utilities';
|
2
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
3
|
+
import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
4
|
+
import { ObjectShorthandProps } from '@fluentui/react-utilities';
|
4
5
|
import * as React_2 from 'react';
|
5
|
-
import type { ShorthandPropsCompat } from '@fluentui/react-utilities';
|
6
6
|
|
7
7
|
/**
|
8
8
|
* A label component provides a title or name to a component.
|
9
9
|
*/
|
10
|
-
export declare const Label: React_2.ForwardRefExoticComponent<
|
11
|
-
|
12
|
-
required?: string | number | boolean | React_2.ReactElement<any, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)> | React_2.ReactNodeArray | React_2.ReactPortal | ObjectShorthandPropsCompat<ComponentPropsCompat> | null | undefined;
|
13
|
-
size?: "small" | "medium" | "large" | undefined;
|
14
|
-
strong?: boolean | undefined;
|
10
|
+
export declare const Label: React_2.ForwardRefExoticComponent<Pick<ComponentProps<LabelSlots, "root">, "form" | "slot" | "style" | "title" | "key" | "htmlFor" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as"> & Partial<LabelCommons> & {
|
11
|
+
required?: string | number | boolean | {} | React_2.ReactElement<any, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)> | React_2.ReactNodeArray | React_2.ReactPortal | ObjectShorthandProps<React_2.HTMLAttributes<HTMLElement>> | null | undefined;
|
15
12
|
} & React_2.RefAttributes<HTMLElement>>;
|
16
13
|
|
17
|
-
/**
|
18
|
-
* Names of LabelProps that have a default value in useLabel
|
19
|
-
*/
|
20
|
-
export declare type LabelDefaultedProps = 'size';
|
21
|
-
|
22
14
|
/**
|
23
15
|
* Label Props
|
24
16
|
*/
|
25
|
-
export declare type
|
17
|
+
export declare type LabelCommons = {
|
26
18
|
/**
|
27
19
|
* Renders the label as disabled
|
28
20
|
* @defaultvalue false
|
29
21
|
*/
|
30
|
-
disabled
|
31
|
-
/**
|
32
|
-
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
33
|
-
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
34
|
-
* @defaultvalue false
|
35
|
-
*/
|
36
|
-
required?: boolean | ShorthandPropsCompat<ComponentPropsCompat>;
|
22
|
+
disabled: boolean;
|
37
23
|
/**
|
38
24
|
* A label supports different sizes.
|
39
25
|
* @defaultvalue 'medium'
|
40
26
|
*/
|
41
|
-
size
|
27
|
+
size: 'small' | 'medium' | 'large';
|
42
28
|
/**
|
43
29
|
* A label supports semibold/strong fontweight.
|
44
30
|
* @defaultvalue false
|
45
31
|
*/
|
46
|
-
strong
|
32
|
+
strong: boolean;
|
47
33
|
};
|
48
34
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
35
|
+
export declare type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & Partial<LabelCommons> & {
|
36
|
+
/**
|
37
|
+
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
38
|
+
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
39
|
+
* @defaultvalue false
|
40
|
+
*/
|
41
|
+
required?: boolean | ObjectShorthandProps<React_2.HTMLAttributes<HTMLElement>> | React_2.ReactNode;
|
42
|
+
};
|
53
43
|
|
54
44
|
/**
|
55
45
|
* Array of all shorthand properties listed in LabelShorthandProps
|
56
46
|
* {@docCatergory Label}
|
57
47
|
*/
|
58
|
-
export declare const labelShorthandProps:
|
48
|
+
export declare const labelShorthandProps: Array<keyof LabelSlots>;
|
49
|
+
|
50
|
+
export declare type LabelSlots = {
|
51
|
+
root: IntrinsicShorthandProps<'label'>;
|
52
|
+
required?: IntrinsicShorthandProps<'span'>;
|
53
|
+
};
|
59
54
|
|
60
55
|
/**
|
61
56
|
* State used in rendering Label
|
62
57
|
*/
|
63
|
-
export declare type LabelState =
|
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?: ObjectShorthandPropsCompat<ComponentPropsCompat>;
|
72
|
-
};
|
58
|
+
export declare type LabelState = ComponentState<LabelSlots> & LabelCommons;
|
73
59
|
|
74
60
|
/**
|
75
61
|
* Render the final JSX of Label
|
@@ -84,9 +70,8 @@ export declare const renderLabel: (state: LabelState) => JSX.Element;
|
|
84
70
|
*
|
85
71
|
* @param props - props from this instance of Label
|
86
72
|
* @param ref - reference to root HTMLElement of Label
|
87
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
88
73
|
*/
|
89
|
-
export declare const useLabel: (props: LabelProps, ref: React_2.Ref<HTMLElement
|
74
|
+
export declare const useLabel: (props: LabelProps, ref: React_2.Ref<HTMLElement>) => LabelState;
|
90
75
|
|
91
76
|
/**
|
92
77
|
* Apply styling to the Label slots based on the state
|
@@ -2,9 +2,6 @@ import * as React from 'react';
|
|
2
2
|
/**
|
3
3
|
* A label component provides a title or name to a component.
|
4
4
|
*/
|
5
|
-
export declare const Label: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").
|
6
|
-
|
7
|
-
required?: string | number | boolean | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | import("@fluentui/react-utilities").ObjectShorthandPropsCompat<import("@fluentui/react-utilities").ComponentPropsCompat> | null | undefined;
|
8
|
-
size?: "small" | "medium" | "large" | undefined;
|
9
|
-
strong?: boolean | undefined;
|
5
|
+
export declare const Label: React.ForwardRefExoticComponent<Pick<import("@fluentui/react-utilities").ComponentProps<import("./Label.types").LabelSlots, "root">, "form" | "slot" | "style" | "title" | "key" | "htmlFor" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as"> & Partial<import("./Label.types").LabelCommons> & {
|
6
|
+
required?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | import("@fluentui/react-utilities").ObjectShorthandProps<React.HTMLAttributes<HTMLElement>> | null | undefined;
|
10
7
|
} & React.RefAttributes<HTMLElement>>;
|
@@ -1,49 +1,38 @@
|
|
1
|
+
import type { ComponentProps, ComponentState, IntrinsicShorthandProps, ObjectShorthandProps } from '@fluentui/react-utilities';
|
1
2
|
import * as React from 'react';
|
2
|
-
import type { ComponentPropsCompat, ComponentStateCompat, ObjectShorthandPropsCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Label Props
|
5
5
|
*/
|
6
|
-
export declare type
|
6
|
+
export declare type LabelCommons = {
|
7
7
|
/**
|
8
8
|
* Renders the label as disabled
|
9
9
|
* @defaultvalue false
|
10
10
|
*/
|
11
|
-
disabled
|
12
|
-
/**
|
13
|
-
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
14
|
-
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
15
|
-
* @defaultvalue false
|
16
|
-
*/
|
17
|
-
required?: boolean | ShorthandPropsCompat<ComponentPropsCompat>;
|
11
|
+
disabled: boolean;
|
18
12
|
/**
|
19
13
|
* A label supports different sizes.
|
20
14
|
* @defaultvalue 'medium'
|
21
15
|
*/
|
22
|
-
size
|
16
|
+
size: 'small' | 'medium' | 'large';
|
23
17
|
/**
|
24
18
|
* A label supports semibold/strong fontweight.
|
25
19
|
* @defaultvalue false
|
26
20
|
*/
|
27
|
-
strong
|
21
|
+
strong: boolean;
|
22
|
+
};
|
23
|
+
export declare type LabelSlots = {
|
24
|
+
root: IntrinsicShorthandProps<'label'>;
|
25
|
+
required?: IntrinsicShorthandProps<'span'>;
|
28
26
|
};
|
29
|
-
/**
|
30
|
-
* Names of the shorthand properties in LabelProps
|
31
|
-
*/
|
32
|
-
export declare type LabelShorthandProps = 'required';
|
33
|
-
/**
|
34
|
-
* Names of LabelProps that have a default value in useLabel
|
35
|
-
*/
|
36
|
-
export declare type LabelDefaultedProps = 'size';
|
37
27
|
/**
|
38
28
|
* State used in rendering Label
|
39
29
|
*/
|
40
|
-
export declare type LabelState =
|
41
|
-
|
42
|
-
* Ref to the root element
|
43
|
-
*/
|
44
|
-
ref: React.Ref<HTMLElement>;
|
30
|
+
export declare type LabelState = ComponentState<LabelSlots> & LabelCommons;
|
31
|
+
export declare type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & Partial<LabelCommons> & {
|
45
32
|
/**
|
46
|
-
* 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
|
47
36
|
*/
|
48
|
-
required?:
|
37
|
+
required?: boolean | ObjectShorthandProps<React.HTMLAttributes<HTMLElement>> | React.ReactNode;
|
49
38
|
};
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import { __assign } from "tslib";
|
2
2
|
import * as React from 'react';
|
3
|
-
import {
|
3
|
+
import { getSlots } from '@fluentui/react-utilities';
|
4
4
|
import { labelShorthandProps } from './useLabel';
|
5
5
|
/**
|
6
6
|
* Render the final JSX of Label
|
7
7
|
*/
|
8
8
|
|
9
9
|
export var renderLabel = function (state) {
|
10
|
-
var _a =
|
10
|
+
var _a = getSlots(state, labelShorthandProps),
|
11
11
|
slots = _a.slots,
|
12
12
|
slotProps = _a.slotProps;
|
13
13
|
|
14
|
-
return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), state.children,
|
14
|
+
return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), state.root.children, /*#__PURE__*/React.createElement(slots.required, __assign({}, slotProps.required)));
|
15
15
|
};
|
16
16
|
//# sourceMappingURL=renderLabel.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Label/renderLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,
|
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,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,QAAQ,CAAa,KAAb,EAAoB,mBAApB,CAA/B;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,IAAN,CAAW,QADd,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,QAAA,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 type { 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,6 +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
16
|
*/
|
18
|
-
export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement
|
17
|
+
export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement>) => LabelState;
|
@@ -1,14 +1,12 @@
|
|
1
1
|
import { __assign } from "tslib";
|
2
|
-
import {
|
2
|
+
import { getNativeElementProps } from '@fluentui/react-utilities';
|
3
|
+
import { resolveShorthand } from '@fluentui/react-utilities';
|
3
4
|
/**
|
4
5
|
* Array of all shorthand properties listed in LabelShorthandProps
|
5
6
|
* {@docCatergory Label}
|
6
7
|
*/
|
7
8
|
|
8
|
-
export var labelShorthandProps = ['required'];
|
9
|
-
var mergeProps = /*#__PURE__*/makeMergeProps({
|
10
|
-
deepMerge: labelShorthandProps
|
11
|
-
});
|
9
|
+
export var labelShorthandProps = ['root', 'required'];
|
12
10
|
/**
|
13
11
|
* Create the state required to render Label.
|
14
12
|
*
|
@@ -17,44 +15,34 @@ var mergeProps = /*#__PURE__*/makeMergeProps({
|
|
17
15
|
*
|
18
16
|
* @param props - props from this instance of Label
|
19
17
|
* @param ref - reference to root HTMLElement of Label
|
20
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
21
18
|
*/
|
22
19
|
|
23
|
-
export var useLabel = function (props, ref
|
24
|
-
var
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
return
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
* or a custom required text.
|
38
|
-
*/
|
39
|
-
|
40
|
-
var resolveLabelShorthandProps = function (props) {
|
41
|
-
var propsNormalized;
|
42
|
-
|
43
|
-
if (props.required === true) {
|
44
|
-
propsNormalized = __assign(__assign({}, props), {
|
45
|
-
required: {
|
20
|
+
export var useLabel = function (props, ref) {
|
21
|
+
var _a = props.disabled,
|
22
|
+
disabled = _a === void 0 ? false : _a,
|
23
|
+
_b = props.required,
|
24
|
+
required = _b === void 0 ? false : _b,
|
25
|
+
_c = props.strong,
|
26
|
+
strong = _c === void 0 ? false : _c,
|
27
|
+
_d = props.size,
|
28
|
+
size = _d === void 0 ? 'medium' : _d;
|
29
|
+
return {
|
30
|
+
disabled: disabled,
|
31
|
+
required: resolveShorthand(required === false ? null : required, {
|
32
|
+
required: !!required,
|
33
|
+
defaultProps: {
|
46
34
|
children: '*'
|
47
35
|
}
|
48
|
-
})
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
36
|
+
}),
|
37
|
+
strong: strong,
|
38
|
+
size: size,
|
39
|
+
components: {
|
40
|
+
root: 'label',
|
41
|
+
required: 'span'
|
42
|
+
},
|
43
|
+
root: getNativeElementProps('label', __assign({
|
44
|
+
ref: ref
|
45
|
+
}, props))
|
46
|
+
};
|
59
47
|
};
|
60
48
|
//# sourceMappingURL=useLabel.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Label/useLabel.tsx"],"names":[],"mappings":";AACA,SAAS,
|
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,IAAM,mBAAmB,GAA4B,CAAC,MAAD,EAAS,UAAT,CAArD;AAEP;;;;;;;;AAQG;;AACH,OAAO,IAAM,QAAQ,GAAG,UAAC,KAAD,EAAoB,GAApB,EAA+C;AAC7D,MAAA,EAAA,GAAwE,KAAK,CAA7D,QAAhB;AAAA,MAAA,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAhB;AAAA,MAAkB,EAAA,GAAsD,KAAK,CAA3C,QAAlC;AAAA,MAAkB,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAlC;AAAA,MAAoC,EAAA,GAAoC,KAAK,CAA3B,MAAlD;AAAA,MAAoC,MAAM,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAlD;AAAA,MAAoD,EAAA,GAAoB,KAAK,CAAV,IAAnE;AAAA,MAAoD,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,QAAH,GAAW,EAAnE;AACR,SAAO;AACL,IAAA,QAAQ,EAAA,QADH;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;AAAZ;AAFiD,KAAvC,CAFrB;AAML,IAAA,MAAM,EAAA,MAND;AAOL,IAAA,IAAI,EAAA,IAPC;AAQL,IAAA,UAAU,EAAE;AAAE,MAAA,IAAI,EAAE,OAAR;AAAiB,MAAA,QAAQ,EAAE;AAA3B,KARP;AASL,IAAA,IAAI,EAAE,qBAAqB,CAAC,OAAD,EAAQ,QAAA,CAAA;AAAI,MAAA,GAAG,EAAA;AAAP,KAAA,EAAY,KAAZ,CAAR;AATtB,GAAP;AAWD,CAbM","sourceRoot":""}
|
@@ -41,7 +41,7 @@ var useStyles = /*#__PURE__*/__styles({
|
|
41
41
|
|
42
42
|
export var useLabelStyles = function (state) {
|
43
43
|
var styles = useStyles();
|
44
|
-
state.className = mergeClasses(styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.className);
|
44
|
+
state.root.className = mergeClasses(styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.root.className);
|
45
45
|
|
46
46
|
if (state.required) {
|
47
47
|
state.required.className = mergeClasses(styles.required, state.required.className);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Label/useLabelStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAGA;;AAEG;;AACH,IAAM,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,IAAM,cAAc,GAAG,UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/useLabelStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAGA;;AAEG;;AACH,IAAM,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,IAAM,cAAc,GAAG,UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,MAAM,CAAC,IAD0B,EAEjC,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAFQ,EAGjC,MAAM,CAAC,KAAK,CAAC,IAAP,CAH2B,EAIjC,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MAJU,EAKjC,KAAK,CAAC,IAAN,CAAW,SALsB,CAAnC;;AAQA,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,CAfM","sourceRoot":""}
|
@@ -2,9 +2,6 @@ import * as React from 'react';
|
|
2
2
|
/**
|
3
3
|
* A label component provides a title or name to a component.
|
4
4
|
*/
|
5
|
-
export declare const Label: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").
|
6
|
-
|
7
|
-
required?: string | number | boolean | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | import("@fluentui/react-utilities").ObjectShorthandPropsCompat<import("@fluentui/react-utilities").ComponentPropsCompat> | null | undefined;
|
8
|
-
size?: "small" | "medium" | "large" | undefined;
|
9
|
-
strong?: boolean | undefined;
|
5
|
+
export declare const Label: React.ForwardRefExoticComponent<Pick<import("@fluentui/react-utilities").ComponentProps<import("./Label.types").LabelSlots, "root">, "form" | "slot" | "style" | "title" | "key" | "htmlFor" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as"> & Partial<import("./Label.types").LabelCommons> & {
|
6
|
+
required?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | import("@fluentui/react-utilities").ObjectShorthandProps<React.HTMLAttributes<HTMLElement>> | null | undefined;
|
10
7
|
} & React.RefAttributes<HTMLElement>>;
|
@@ -1,49 +1,38 @@
|
|
1
|
+
import type { ComponentProps, ComponentState, IntrinsicShorthandProps, ObjectShorthandProps } from '@fluentui/react-utilities';
|
1
2
|
import * as React from 'react';
|
2
|
-
import type { ComponentPropsCompat, ComponentStateCompat, ObjectShorthandPropsCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* Label Props
|
5
5
|
*/
|
6
|
-
export declare type
|
6
|
+
export declare type LabelCommons = {
|
7
7
|
/**
|
8
8
|
* Renders the label as disabled
|
9
9
|
* @defaultvalue false
|
10
10
|
*/
|
11
|
-
disabled
|
12
|
-
/**
|
13
|
-
* Displays and indicator that the label is for a required field. The required prop can be set to true to display
|
14
|
-
* an asterisk (*). Or it can be set to a string or jsx content to display a different indicator.
|
15
|
-
* @defaultvalue false
|
16
|
-
*/
|
17
|
-
required?: boolean | ShorthandPropsCompat<ComponentPropsCompat>;
|
11
|
+
disabled: boolean;
|
18
12
|
/**
|
19
13
|
* A label supports different sizes.
|
20
14
|
* @defaultvalue 'medium'
|
21
15
|
*/
|
22
|
-
size
|
16
|
+
size: 'small' | 'medium' | 'large';
|
23
17
|
/**
|
24
18
|
* A label supports semibold/strong fontweight.
|
25
19
|
* @defaultvalue false
|
26
20
|
*/
|
27
|
-
strong
|
21
|
+
strong: boolean;
|
22
|
+
};
|
23
|
+
export declare type LabelSlots = {
|
24
|
+
root: IntrinsicShorthandProps<'label'>;
|
25
|
+
required?: IntrinsicShorthandProps<'span'>;
|
28
26
|
};
|
29
|
-
/**
|
30
|
-
* Names of the shorthand properties in LabelProps
|
31
|
-
*/
|
32
|
-
export declare type LabelShorthandProps = 'required';
|
33
|
-
/**
|
34
|
-
* Names of LabelProps that have a default value in useLabel
|
35
|
-
*/
|
36
|
-
export declare type LabelDefaultedProps = 'size';
|
37
27
|
/**
|
38
28
|
* State used in rendering Label
|
39
29
|
*/
|
40
|
-
export declare type LabelState =
|
41
|
-
|
42
|
-
* Ref to the root element
|
43
|
-
*/
|
44
|
-
ref: React.Ref<HTMLElement>;
|
30
|
+
export declare type LabelState = ComponentState<LabelSlots> & LabelCommons;
|
31
|
+
export declare type LabelProps = Omit<ComponentProps<LabelSlots>, 'required'> & Partial<LabelCommons> & {
|
45
32
|
/**
|
46
|
-
* 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
|
47
36
|
*/
|
48
|
-
required?:
|
37
|
+
required?: boolean | ObjectShorthandProps<React.HTMLAttributes<HTMLElement>> | React.ReactNode;
|
49
38
|
};
|
@@ -18,11 +18,11 @@ var useLabel_1 = /*#__PURE__*/require("./useLabel");
|
|
18
18
|
|
19
19
|
|
20
20
|
var renderLabel = function (state) {
|
21
|
-
var _a = react_utilities_1.
|
21
|
+
var _a = react_utilities_1.getSlots(state, useLabel_1.labelShorthandProps),
|
22
22
|
slots = _a.slots,
|
23
23
|
slotProps = _a.slotProps;
|
24
24
|
|
25
|
-
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), state.children,
|
25
|
+
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), state.root.children, React.createElement(slots.required, tslib_1.__assign({}, slotProps.required)));
|
26
26
|
};
|
27
27
|
|
28
28
|
exports.renderLabel = renderLabel;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Label/renderLabel.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,iBAAA,CAAA,
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/renderLabel.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,WAAW,GAAG,UAAC,KAAD,EAAkB;AACrC,MAAA,EAAA,GAAuB,iBAAA,CAAA,QAAA,CAAqB,KAArB,EAA4B,UAAA,CAAA,mBAA5B,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,IAAN,CAAW,QADd,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAFF,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX","sourceRoot":""}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import type { 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,6 +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
16
|
*/
|
18
|
-
export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement
|
17
|
+
export declare const useLabel: (props: LabelProps, ref: React.Ref<HTMLElement>) => LabelState;
|
@@ -8,16 +8,15 @@ exports.useLabel = exports.labelShorthandProps = void 0;
|
|
8
8
|
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
9
|
|
10
10
|
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
|
12
|
+
var react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
13
|
/**
|
12
14
|
* Array of all shorthand properties listed in LabelShorthandProps
|
13
15
|
* {@docCatergory Label}
|
14
16
|
*/
|
15
17
|
|
16
18
|
|
17
|
-
exports.labelShorthandProps = ['required'];
|
18
|
-
var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
|
19
|
-
deepMerge: exports.labelShorthandProps
|
20
|
-
});
|
19
|
+
exports.labelShorthandProps = ['root', 'required'];
|
21
20
|
/**
|
22
21
|
* Create the state required to render Label.
|
23
22
|
*
|
@@ -26,46 +25,36 @@ var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
|
|
26
25
|
*
|
27
26
|
* @param props - props from this instance of Label
|
28
27
|
* @param ref - reference to root HTMLElement of Label
|
29
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
30
|
-
*/
|
31
|
-
|
32
|
-
var useLabel = function (props, ref, defaultProps) {
|
33
|
-
var state = mergeProps({
|
34
|
-
ref: ref,
|
35
|
-
as: 'label',
|
36
|
-
size: 'medium',
|
37
|
-
required: {
|
38
|
-
as: 'span'
|
39
|
-
}
|
40
|
-
}, defaultProps && resolveLabelShorthandProps(defaultProps), resolveLabelShorthandProps(props));
|
41
|
-
return state;
|
42
|
-
};
|
43
|
-
|
44
|
-
exports.useLabel = useLabel;
|
45
|
-
/**
|
46
|
-
* Label will first need to check if required is a boolean or shorthandprops,
|
47
|
-
* this allows for the required prop to handle both the default asterisk for required
|
48
|
-
* or a custom required text.
|
49
28
|
*/
|
50
29
|
|
51
|
-
var
|
52
|
-
var
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
30
|
+
var useLabel = function (props, ref) {
|
31
|
+
var _a = props.disabled,
|
32
|
+
disabled = _a === void 0 ? false : _a,
|
33
|
+
_b = props.required,
|
34
|
+
required = _b === void 0 ? false : _b,
|
35
|
+
_c = props.strong,
|
36
|
+
strong = _c === void 0 ? false : _c,
|
37
|
+
_d = props.size,
|
38
|
+
size = _d === void 0 ? 'medium' : _d;
|
39
|
+
return {
|
40
|
+
disabled: disabled,
|
41
|
+
required: react_utilities_2.resolveShorthand(required === false ? null : required, {
|
42
|
+
required: !!required,
|
43
|
+
defaultProps: {
|
57
44
|
children: '*'
|
58
45
|
}
|
59
|
-
})
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
46
|
+
}),
|
47
|
+
strong: strong,
|
48
|
+
size: size,
|
49
|
+
components: {
|
50
|
+
root: 'label',
|
51
|
+
required: 'span'
|
52
|
+
},
|
53
|
+
root: react_utilities_1.getNativeElementProps('label', tslib_1.__assign({
|
54
|
+
ref: ref
|
55
|
+
}, props))
|
56
|
+
};
|
70
57
|
};
|
58
|
+
|
59
|
+
exports.useLabel = useLabel;
|
71
60
|
//# sourceMappingURL=useLabel.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Label/useLabel.tsx"],"names":[],"mappings":";;;;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/useLabel.tsx"],"names":[],"mappings":";;;;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAEA;;;AAGG;;;AACU,OAAA,CAAA,mBAAA,GAA+C,CAAC,MAAD,EAAS,UAAT,CAA/C;AAEb;;;;;;;;AAQG;;AACI,IAAM,QAAQ,GAAG,UAAC,KAAD,EAAoB,GAApB,EAA+C;AAC7D,MAAA,EAAA,GAAwE,KAAK,CAA7D,QAAhB;AAAA,MAAA,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAhB;AAAA,MAAkB,EAAA,GAAsD,KAAK,CAA3C,QAAlC;AAAA,MAAkB,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAlC;AAAA,MAAoC,EAAA,GAAoC,KAAK,CAA3B,MAAlD;AAAA,MAAoC,MAAM,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAAlD;AAAA,MAAoD,EAAA,GAAoB,KAAK,CAAV,IAAnE;AAAA,MAAoD,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,QAAH,GAAW,EAAnE;AACR,SAAO;AACL,IAAA,QAAQ,EAAA,QADH;AAEL,IAAA,QAAQ,EAAE,iBAAA,CAAA,gBAAA,CAAiB,QAAQ,KAAK,KAAb,GAAqB,IAArB,GAA4B,QAA7C,EAAuD;AAC/D,MAAA,QAAQ,EAAE,CAAC,CAAC,QADmD;AAE/D,MAAA,YAAY,EAAE;AAAE,QAAA,QAAQ,EAAE;AAAZ;AAFiD,KAAvD,CAFL;AAML,IAAA,MAAM,EAAA,MAND;AAOL,IAAA,IAAI,EAAA,IAPC;AAQL,IAAA,UAAU,EAAE;AAAE,MAAA,IAAI,EAAE,OAAR;AAAiB,MAAA,QAAQ,EAAE;AAA3B,KARP;AASL,IAAA,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,OAAtB,EAA6B,OAAA,CAAA,QAAA,CAAA;AAAI,MAAA,GAAG,EAAA;AAAP,KAAA,EAAY,KAAZ,CAA7B;AATD,GAAP;AAWD,CAbM;;AAAM,OAAA,CAAA,QAAA,GAAQ,QAAR","sourceRoot":""}
|
@@ -49,7 +49,7 @@ var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
49
49
|
|
50
50
|
var useLabelStyles = function (state) {
|
51
51
|
var styles = useStyles();
|
52
|
-
state.className = react_make_styles_1.mergeClasses(styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.className);
|
52
|
+
state.root.className = react_make_styles_1.mergeClasses(styles.root, state.disabled && styles.disabled, styles[state.size], state.strong && styles.strong, state.root.className);
|
53
53
|
|
54
54
|
if (state.required) {
|
55
55
|
state.required.className = react_make_styles_1.mergeClasses(styles.required, state.required.className);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Label/useLabelStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAGA;;AAEG;;;AACH,IAAM,SAAS,gBAAG,mBAAA,SAAA;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;;;AACI,IAAM,cAAc,GAAG,UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,
|
1
|
+
{"version":3,"sources":["../../../src/components/Label/useLabelStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAGA;;AAEG;;;AACH,IAAM,SAAS,gBAAG,mBAAA,SAAA;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;;;AACI,IAAM,cAAc,GAAG,UAAC,KAAD,EAAkB;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CACrB,MAAM,CAAC,IADc,EAErB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAFJ,EAGrB,MAAM,CAAC,KAAK,CAAC,IAAP,CAHe,EAIrB,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MAJF,EAKrB,KAAK,CAAC,IAAN,CAAW,SALU,CAAvB;;AAQA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,mBAAA,CAAA,YAAA,CAAa,MAAM,CAAC,QAApB,EAA8B,KAAK,CAAC,QAAN,CAAe,SAA7C,CAA3B;AACD;;AAED,SAAO,KAAP;AACD,CAfM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourceRoot":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-label",
|
3
|
-
"version": "9.0.0-alpha.
|
3
|
+
"version": "9.0.0-alpha.46",
|
4
4
|
"description": "Label component for FluentUI library.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -25,11 +25,11 @@
|
|
25
25
|
"storybook": "start-storybook"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
|
-
"@fluentui/babel-make-styles": "9.0.0-alpha.
|
28
|
+
"@fluentui/babel-make-styles": "9.0.0-alpha.55",
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
|
-
"@fluentui/jest-serializer-make-styles": "9.0.0-alpha.
|
30
|
+
"@fluentui/jest-serializer-make-styles": "9.0.0-alpha.48",
|
31
31
|
"@fluentui/react-conformance": "*",
|
32
|
-
"@fluentui/react-conformance-make-styles": "9.0.0-alpha.
|
32
|
+
"@fluentui/react-conformance-make-styles": "9.0.0-alpha.17",
|
33
33
|
"@fluentui/scripts": "^1.0.0",
|
34
34
|
"@types/enzyme": "3.10.3",
|
35
35
|
"@types/enzyme-adapter-react-16": "1.0.3",
|
@@ -43,8 +43,8 @@
|
|
43
43
|
"react-test-renderer": "^16.3.0"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@fluentui/react-make-styles": "9.0.0-alpha.
|
47
|
-
"@fluentui/react-utilities": "9.0.0-alpha.
|
46
|
+
"@fluentui/react-make-styles": "9.0.0-alpha.73",
|
47
|
+
"@fluentui/react-utilities": "9.0.0-alpha.53",
|
48
48
|
"tslib": "^2.1.0"
|
49
49
|
},
|
50
50
|
"peerDependencies": {
|