@pantheon-systems/pds-toolkit-react 1.0.0-dev.152 → 1.0.0-dev.154
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/_dist/components/Tabs/Tabs.d.ts +58 -38
- package/_dist/components/Tooltip/Tooltip.d.ts +5 -1
- package/_dist/components/buttons/IconButton/IconButton.d.ts +10 -6
- package/_dist/components/inputs/Checkbox/Checkbox.d.ts +85 -2
- package/_dist/components/inputs/CheckboxFieldset/CheckboxFieldset.d.ts +60 -0
- package/_dist/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +73 -41
- package/_dist/components/inputs/InputGroup/InputGroup.d.ts +18 -12
- package/_dist/components/inputs/Switch/Switch.d.ts +74 -0
- package/_dist/components/inputs/TextInput/TextInput.d.ts +2 -2
- package/_dist/components/inputs/input-types.d.ts +1 -0
- package/_dist/components/inputs/input-utilities.d.ts +15 -4
- package/_dist/css/component-css/pds-checkbox-group.css +1 -1
- package/_dist/css/component-css/pds-checkbox.css +1 -1
- package/_dist/css/component-css/pds-icon-button.css +1 -1
- package/_dist/css/component-css/pds-index.css +7 -13
- package/_dist/css/component-css/pds-input-text.css +1 -1
- package/_dist/css/component-css/pds-input-utilities.css +1 -1
- package/_dist/css/component-css/pds-input-wrapper.css +1 -1
- package/_dist/css/component-css/pds-inputs-common-deprecated.css +1 -1
- package/_dist/css/component-css/pds-inputs-common.css +1 -1
- package/_dist/css/component-css/pds-panel.css +1 -1
- package/_dist/css/component-css/pds-switch.css +3 -0
- package/_dist/css/component-css/pds-text-input.css +1 -1
- package/_dist/css/component-css/pds-tooltip.css +1 -1
- package/_dist/css/component-css/pds-workspace-selector.css +1 -1
- package/_dist/css/design-tokens/pds-design-tokens.css +2 -0
- package/_dist/css/pds-components.css +7 -13
- package/_dist/css/pds-core.css +3 -3
- package/_dist/index.css +1 -1
- package/_dist/index.d.ts +6 -5
- package/_dist/index.js +3792 -3674
- package/_dist/index.js.map +1 -1
- package/_dist/libs/components/utils.d.ts +3 -2
- package/package.json +2 -2
- package/_dist/components/buttons/AnimatedButton/AnimatedButton.d.ts +0 -42
- package/_dist/css/component-css/pds-animated-button.css +0 -9
|
@@ -1,40 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { PDSIcon } from '@components/Icon/Icon';
|
|
3
|
+
import './tabs.css';
|
|
4
|
+
interface Tabs {
|
|
5
|
+
/**
|
|
6
|
+
* Sets if tab disabled (optional)
|
|
7
|
+
*/
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Adds tab icon (optional)
|
|
11
|
+
*/
|
|
12
|
+
icon?: PDSIcon;
|
|
13
|
+
/**
|
|
14
|
+
* Sets tab label
|
|
15
|
+
*/
|
|
16
|
+
tabLabel: string;
|
|
17
|
+
/**
|
|
18
|
+
* Sets id for tab (optional)
|
|
19
|
+
*/
|
|
20
|
+
tabId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Sets content inside tab
|
|
23
|
+
*/
|
|
24
|
+
panelContent: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
interface TabsProps extends ComponentPropsWithoutRef<'div'> {
|
|
27
|
+
/**
|
|
28
|
+
* Function to call when the active tab changes
|
|
29
|
+
*/
|
|
30
|
+
onActiveTabChange?: (activeTabIndex: number) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Sets tabset aria label
|
|
33
|
+
*/
|
|
34
|
+
ariaLabel: string;
|
|
35
|
+
/**
|
|
36
|
+
* Sets default selected tab using a zero-based index, defaults to 0
|
|
37
|
+
*/
|
|
4
38
|
defaultSelected?: number;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
icon: PropTypes.Requireable<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Sets tab label
|
|
25
|
-
*/
|
|
26
|
-
tabLabel: PropTypes.Validator<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Sets id for tab (optional)
|
|
29
|
-
*/
|
|
30
|
-
tabId: PropTypes.Requireable<string>;
|
|
31
|
-
/**
|
|
32
|
-
* Sets content inside tab
|
|
33
|
-
*/
|
|
34
|
-
panelContent: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
35
|
-
}>[]>;
|
|
36
|
-
let className: PropTypes.Requireable<string>;
|
|
37
|
-
}
|
|
39
|
+
/**
|
|
40
|
+
* Sets currently selected tab using a zero-based index
|
|
41
|
+
*/
|
|
42
|
+
selectedTab?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Sets size of tab
|
|
45
|
+
*/
|
|
46
|
+
size?: 'sm' | 'md';
|
|
47
|
+
/**
|
|
48
|
+
* Array of objects for tab data
|
|
49
|
+
*/
|
|
50
|
+
tabs: Tabs[];
|
|
51
|
+
/**
|
|
52
|
+
* Additional class names
|
|
53
|
+
*/
|
|
54
|
+
className?: string;
|
|
38
55
|
}
|
|
39
|
-
|
|
40
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Tabs UI component
|
|
58
|
+
*/
|
|
59
|
+
export declare const Tabs: ({ onActiveTabChange, ariaLabel, defaultSelected, selectedTab, size, tabs, className, ...props }: TabsProps) => React.JSX.Element;
|
|
60
|
+
export {};
|
|
@@ -9,6 +9,10 @@ interface TooltipProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
9
9
|
* Text or HTML content to use as the trigger instead of an icon. Leave null to use the icon. This allows passing HTML content to customize the trigger appearance or functionality.
|
|
10
10
|
*/
|
|
11
11
|
customTrigger?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Number to provide custom z-index value for the tooltip container
|
|
14
|
+
*/
|
|
15
|
+
customZIndex?: number;
|
|
12
16
|
/**
|
|
13
17
|
* The spacing between the trigger and the tooltip in pixels. Only applies to tooltips with a custom trigger. Icon triggers have a fixed spacing.
|
|
14
18
|
*/
|
|
@@ -29,5 +33,5 @@ interface TooltipProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
29
33
|
/**
|
|
30
34
|
* Tooltip UI component
|
|
31
35
|
*/
|
|
32
|
-
export declare const Tooltip: ({ content, customTrigger, offsetValue, triggerAccessibleText, triggerIcon, className, ...props }: TooltipProps) => React.JSX.Element;
|
|
36
|
+
export declare const Tooltip: ({ content, customTrigger, customZIndex, offsetValue, triggerAccessibleText, triggerIcon, className, ...props }: TooltipProps) => React.JSX.Element;
|
|
33
37
|
export {};
|
|
@@ -19,28 +19,32 @@ interface IconButtonProps extends ComponentPropsWithoutRef<'button'> {
|
|
|
19
19
|
*/
|
|
20
20
|
hasTooltip?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* Which icon to render
|
|
22
|
+
* Which icon to render.
|
|
23
23
|
*/
|
|
24
24
|
iconName: PDSIcon;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Which icon to render second. If this is set, the button will be animated.
|
|
27
|
+
*/
|
|
28
|
+
icon2Name?: PDSIcon;
|
|
29
|
+
/**
|
|
30
|
+
* Click event handler callback.
|
|
27
31
|
*/
|
|
28
32
|
onClick?: () => void;
|
|
29
33
|
/**
|
|
30
|
-
* Which size of button to render
|
|
34
|
+
* Which size of button to render.
|
|
31
35
|
*/
|
|
32
36
|
size?: 'sm' | 'md' | 'lg';
|
|
33
37
|
/**
|
|
34
|
-
* Which variant of button to render
|
|
38
|
+
* Which variant of button to render.
|
|
35
39
|
*/
|
|
36
40
|
variant?: 'standard' | 'critical';
|
|
37
41
|
/**
|
|
38
|
-
* Additional class names
|
|
42
|
+
* Additional class names.
|
|
39
43
|
*/
|
|
40
44
|
className?: string;
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* IconButton UI component
|
|
44
48
|
*/
|
|
45
|
-
export declare const IconButton: ({ ariaLabel, buttonType, disabled, hasTooltip, iconName, onClick, size, variant, className, ...props }: IconButtonProps) => React.JSX.Element;
|
|
49
|
+
export declare const IconButton: ({ ariaLabel, buttonType, disabled, hasTooltip, iconName, icon2Name, onClick, size, variant, className, ...props }: IconButtonProps) => React.JSX.Element;
|
|
46
50
|
export {};
|
|
@@ -1,5 +1,88 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef, ChangeEvent, FocusEvent } from 'react';
|
|
2
|
+
import { ValidationStatus } from '../input-types';
|
|
3
|
+
import './checkbox.css';
|
|
4
|
+
/**
|
|
5
|
+
* Prop types for Checkbox
|
|
6
|
+
*/
|
|
7
|
+
export interface CheckboxProps extends ComponentPropsWithoutRef<'div'> {
|
|
8
|
+
/**
|
|
9
|
+
* Checked state of the input. Used to set the checked status of the input field when controlled. Cannot be used in conjunction with the `defaultChecked` prop.
|
|
10
|
+
*/
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Default checked state. Setting this prop automatically makes the input uncontrolled. Cannot be used with the checked prop.
|
|
14
|
+
*/
|
|
15
|
+
defaultChecked?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Is the field disabled?
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The ID of the checkbox.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* Indeterminate state
|
|
26
|
+
*/
|
|
27
|
+
indeterminate?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Additional props for the `<input>` element.
|
|
30
|
+
*/
|
|
31
|
+
inputProps?: ComponentPropsWithoutRef<'input'>;
|
|
32
|
+
/**
|
|
33
|
+
* Width of the input field. Accepts a number in pixels. Leave blank for width: 100%.
|
|
34
|
+
*/
|
|
35
|
+
inputWidth?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Input label.
|
|
38
|
+
*/
|
|
39
|
+
label: string;
|
|
40
|
+
/**
|
|
41
|
+
* Input message. Used to provide supplemental text. Will be displayed below the input field.
|
|
42
|
+
*/
|
|
43
|
+
message?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Name attribute of the checkbox.
|
|
46
|
+
*/
|
|
47
|
+
name?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Indent level of the checkbox. Visual styles for creating nested checkboxes. Styles are only applied when the checkbox is an ancestor of a div with the class `pds-checkbox-group`.
|
|
50
|
+
*/
|
|
51
|
+
nestingLevel?: 0 | 1 | 2;
|
|
52
|
+
/**
|
|
53
|
+
* onBlur event handler
|
|
54
|
+
*/
|
|
55
|
+
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
56
|
+
/**
|
|
57
|
+
* onChange event handler
|
|
58
|
+
*/
|
|
59
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
60
|
+
/**
|
|
61
|
+
* onFocus event handler
|
|
62
|
+
*/
|
|
63
|
+
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Is the field required?
|
|
66
|
+
*/
|
|
67
|
+
required?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Validation message for the input field based on the validation status.
|
|
70
|
+
*/
|
|
71
|
+
validationMessage?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Validation status of the input field.
|
|
74
|
+
*/
|
|
75
|
+
validationStatus?: ValidationStatus;
|
|
76
|
+
/**
|
|
77
|
+
* Value attribute of the checkbox.
|
|
78
|
+
*/
|
|
79
|
+
value?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Additional class names
|
|
82
|
+
*/
|
|
83
|
+
className?: string;
|
|
84
|
+
}
|
|
1
85
|
/**
|
|
2
86
|
* Checkbox UI component
|
|
3
87
|
*/
|
|
4
|
-
export const Checkbox: React.ForwardRefExoticComponent<React.RefAttributes<
|
|
5
|
-
import React from 'react';
|
|
88
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { ValidationStatus } from '../input-types';
|
|
3
|
+
import '../CheckboxGroup/checkbox-group.css';
|
|
4
|
+
/**
|
|
5
|
+
* Prop types for CheckboxFieldset
|
|
6
|
+
*/
|
|
7
|
+
export interface CheckboxGroupWrapperProps extends ComponentPropsWithoutRef<'div'> {
|
|
8
|
+
/**
|
|
9
|
+
* Individual checkboxes to be rendered within the group.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Is the field disabled?
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Additional props for the `<fieldset>` element.
|
|
18
|
+
*/
|
|
19
|
+
fieldsetProps?: ComponentPropsWithoutRef<'fieldset'>;
|
|
20
|
+
/**
|
|
21
|
+
* The ID of the checkbox group.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* Width of the field. Accepts a number in pixels. Leave blank for width: 100%.
|
|
26
|
+
*/
|
|
27
|
+
inputWidth?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Field label. Will be rendered as the fieldset legend.
|
|
30
|
+
*/
|
|
31
|
+
label: string;
|
|
32
|
+
/**
|
|
33
|
+
* Input message. Used to provide supplemental text. Will be displayed below the field.
|
|
34
|
+
*/
|
|
35
|
+
message?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Is the field required?
|
|
38
|
+
*/
|
|
39
|
+
required?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Should the label (legend) be visible? If false, it will render for screen readers only.
|
|
42
|
+
*/
|
|
43
|
+
showLabel?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Validation message for the input field based on the validation status.
|
|
46
|
+
*/
|
|
47
|
+
validationMessage?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Validation status of the input field.
|
|
50
|
+
*/
|
|
51
|
+
validationStatus?: ValidationStatus;
|
|
52
|
+
/**
|
|
53
|
+
* Additional class names
|
|
54
|
+
*/
|
|
55
|
+
className?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* CheckboxFieldset UI component
|
|
59
|
+
*/
|
|
60
|
+
export declare const CheckboxFieldset: ({ children, disabled, fieldsetProps, id, inputWidth, label, message, required, showLabel, validationMessage, validationStatus, className, ...props }: CheckboxGroupWrapperProps) => React.JSX.Element;
|
|
@@ -1,44 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { ValidationStatus } from '../input-types';
|
|
3
|
+
import './checkbox-group.css';
|
|
4
|
+
export type CheckboxOption = {
|
|
5
|
+
checked?: boolean;
|
|
3
6
|
disabled?: boolean;
|
|
4
|
-
id
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
id?: string;
|
|
8
|
+
label: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
value: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Prop types for CheckboxGroup
|
|
14
|
+
*/
|
|
15
|
+
export interface CheckboxGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
16
|
+
/**
|
|
17
|
+
* Is the field disabled?
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Additional props for the `<fieldset>` element.
|
|
22
|
+
*/
|
|
23
|
+
fieldsetProps?: ComponentPropsWithoutRef<'fieldset'>;
|
|
24
|
+
/**
|
|
25
|
+
* The ID of the checkbox group.
|
|
26
|
+
*/
|
|
27
|
+
id: string;
|
|
28
|
+
/**
|
|
29
|
+
* Width of the field. Accepts a number in pixels. Leave blank for width: 100%.
|
|
30
|
+
*/
|
|
31
|
+
inputWidth?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Field label. Will be rendered as the fieldset legend.
|
|
34
|
+
*/
|
|
35
|
+
label: string;
|
|
36
|
+
/**
|
|
37
|
+
* Input message. Used to provide supplemental text. Will be displayed below the field.
|
|
38
|
+
*/
|
|
39
|
+
message?: string;
|
|
40
|
+
/**
|
|
41
|
+
* onGroupBlur function. Called when all checkboxes have lost focus. Provides an array of checked values.
|
|
42
|
+
*/
|
|
43
|
+
onGroupBlur?: (checkedOptions: string[]) => void;
|
|
44
|
+
/**
|
|
45
|
+
* onValueChange function. Called when the value of any checkbox changes. Provides an array of checked values.
|
|
46
|
+
*/
|
|
47
|
+
onValueChange?: (updatedOptions: string[]) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Array of checkbox options for group.
|
|
50
|
+
*/
|
|
51
|
+
options: CheckboxOption[];
|
|
52
|
+
/**
|
|
53
|
+
* Is the field required?
|
|
54
|
+
*/
|
|
10
55
|
required?: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* Value attribute of the checkbox.
|
|
28
|
-
*/
|
|
29
|
-
value: PropTypes.Validator<string>;
|
|
30
|
-
/**
|
|
31
|
-
* Is the checkbox checked initially?
|
|
32
|
-
*/
|
|
33
|
-
checked: PropTypes.Requireable<boolean>;
|
|
34
|
-
/**
|
|
35
|
-
* Is the checkbox disabled?
|
|
36
|
-
*/
|
|
37
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
38
|
-
}>[]>;
|
|
39
|
-
let required: PropTypes.Requireable<boolean>;
|
|
40
|
-
let className: PropTypes.Requireable<string>;
|
|
41
|
-
}
|
|
56
|
+
/**
|
|
57
|
+
* Should the label (legend) be visible? If false, it will render for screen readers only.
|
|
58
|
+
*/
|
|
59
|
+
showLabel?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Validation message for the input field based on the validation status.
|
|
62
|
+
*/
|
|
63
|
+
validationMessage?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Validation status of the input field.
|
|
66
|
+
*/
|
|
67
|
+
validationStatus?: ValidationStatus;
|
|
68
|
+
/**
|
|
69
|
+
* Additional class names
|
|
70
|
+
*/
|
|
71
|
+
className?: string;
|
|
42
72
|
}
|
|
43
|
-
|
|
44
|
-
|
|
73
|
+
/**
|
|
74
|
+
* CheckboxGroup UI component
|
|
75
|
+
*/
|
|
76
|
+
export declare const CheckboxGroup: ({ disabled, fieldsetProps, id, inputWidth, label, message, onGroupBlur, onValueChange, options, required, showLabel, validationMessage, validationStatus, className, ...props }: CheckboxGroupProps) => React.JSX.Element;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import './input-group.css';
|
|
3
|
+
/**
|
|
4
|
+
* Prop types for InputGroup
|
|
5
|
+
*/
|
|
6
|
+
export interface InputGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
7
|
+
/**
|
|
8
|
+
* Input and button elements
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Additional class names
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
11
15
|
}
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* InputGroup UI component
|
|
18
|
+
*/
|
|
19
|
+
export declare const InputGroup: ({ children, className, ...props }: InputGroupProps) => React.JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { ChangeEvent, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import './switch.css';
|
|
3
|
+
type SwitchPlacement = 'right' | 'below';
|
|
4
|
+
/**
|
|
5
|
+
* Prop types for Switch
|
|
6
|
+
*/
|
|
7
|
+
export interface SwitchProps extends ComponentPropsWithoutRef<'div'> {
|
|
8
|
+
/**
|
|
9
|
+
* Is the field checked?
|
|
10
|
+
*/
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Initial value for the input field. Only valid if the input is uncontrolled. Cannot be used in conjunction with the `checked` prop.
|
|
14
|
+
*/
|
|
15
|
+
defaultChecked?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Is the field disabled?
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Input ID.
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* Additional props for the `<input>` element.
|
|
26
|
+
*/
|
|
27
|
+
inputProps?: ComponentPropsWithoutRef<'input'>;
|
|
28
|
+
/**
|
|
29
|
+
* Width of the input field. Accepts a number in pixels. Leave blank for width: 100%.
|
|
30
|
+
*/
|
|
31
|
+
inputWidth?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Label of the switch field.
|
|
34
|
+
*/
|
|
35
|
+
label: string;
|
|
36
|
+
/**
|
|
37
|
+
* Message or description used to help clarify the usage of the input.
|
|
38
|
+
*/
|
|
39
|
+
message?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Status text for when switch is off.
|
|
42
|
+
*/
|
|
43
|
+
offLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* onChange event handler. Controlled inputs should use this to manage the input value. Uncontrolled inputs will manage their own state, but may still use this to access the event object.
|
|
46
|
+
*/
|
|
47
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Status text for when switch is on.
|
|
50
|
+
*/
|
|
51
|
+
onLabel?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Is this field required?
|
|
54
|
+
*/
|
|
55
|
+
required?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Should the label be visible? If false, it will render for screen readers only.
|
|
58
|
+
*/
|
|
59
|
+
showLabel?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Show toggle status label next to switch. If false, icons will render and the text will still be available to screen readers.
|
|
62
|
+
*/
|
|
63
|
+
showStatusLabel?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Determines switch placement, default set to `right`.
|
|
66
|
+
*/
|
|
67
|
+
switchPlacement?: SwitchPlacement;
|
|
68
|
+
/**
|
|
69
|
+
* Additional class names for input.
|
|
70
|
+
*/
|
|
71
|
+
className?: string;
|
|
72
|
+
}
|
|
73
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
74
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ComponentPropsWithoutRef, ChangeEvent, FocusEvent } from 'react';
|
|
2
|
+
import { ValidationStatus } from '../input-types';
|
|
2
3
|
import './text-input.css';
|
|
3
4
|
type TranslationStringProps = {
|
|
4
5
|
clearButton: string;
|
|
@@ -9,7 +10,6 @@ type TranslationStringProps = {
|
|
|
9
10
|
visibilityToggleShow: string;
|
|
10
11
|
};
|
|
11
12
|
type HtmlInputTypes = 'text' | 'number' | 'email' | 'password' | 'tel' | 'url' | 'search';
|
|
12
|
-
type ValidationStatus = 'success' | 'error';
|
|
13
13
|
/**
|
|
14
14
|
* Prop types for TextInput
|
|
15
15
|
*/
|
|
@@ -23,7 +23,7 @@ export interface TextInputProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
23
23
|
*/
|
|
24
24
|
counterMaxLength?: number;
|
|
25
25
|
/**
|
|
26
|
-
* Initial value for the input field.
|
|
26
|
+
* Initial value for the input field. Setting this prop automatically makes the input uncontrolled. Cannot be used in conjunction with the `value` prop.
|
|
27
27
|
*/
|
|
28
28
|
defaultValue?: string;
|
|
29
29
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ValidationStatus = 'success' | 'error';
|
|
@@ -8,19 +8,23 @@ export declare const inputCommonClasses: {
|
|
|
8
8
|
success: string;
|
|
9
9
|
readonly: string;
|
|
10
10
|
};
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const RequiredIcon: () => React.JSX.Element;
|
|
12
|
+
export declare const InputLabel: ({ id, label, showLabel, required, disabled, isLegend, className, }: {
|
|
12
13
|
id: string;
|
|
13
14
|
label: string;
|
|
14
15
|
showLabel: boolean;
|
|
15
|
-
required
|
|
16
|
-
disabled
|
|
16
|
+
required: boolean;
|
|
17
|
+
disabled: boolean;
|
|
17
18
|
isLegend?: boolean;
|
|
19
|
+
className?: string;
|
|
18
20
|
}) => React.JSX.Element;
|
|
19
|
-
export declare const InputMessage: ({ id, message, hasValidationMessage, validationStatus, }: {
|
|
21
|
+
export declare const InputMessage: ({ id, message, hasValidationMessage, validationMessageHasDecorators, validationStatus, className, }: {
|
|
20
22
|
id: string;
|
|
21
23
|
message: string;
|
|
22
24
|
hasValidationMessage: boolean;
|
|
25
|
+
validationMessageHasDecorators?: boolean;
|
|
23
26
|
validationStatus: string;
|
|
27
|
+
className?: string;
|
|
24
28
|
}) => React.JSX.Element;
|
|
25
29
|
type DecoratorVariants = 'search' | 'error' | 'success';
|
|
26
30
|
export declare const InputDecorator: ({ variant }: {
|
|
@@ -41,4 +45,11 @@ export declare const CharacterCounter: ({ id, currentLength, maxLength, overLimi
|
|
|
41
45
|
maxLength: number;
|
|
42
46
|
overLimitMessage: string;
|
|
43
47
|
}) => React.JSX.Element;
|
|
48
|
+
export declare const HiddenLabel: ({ label, ...props }: {
|
|
49
|
+
[x: string]: any;
|
|
50
|
+
label: any;
|
|
51
|
+
}) => React.JSX.Element;
|
|
52
|
+
export declare const getInputWidthStyle: (inputWidth: number) => {
|
|
53
|
+
width: string;
|
|
54
|
+
};
|
|
44
55
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pds-checkbox-group__options{display:flex;flex-direction:column;
|
|
1
|
+
.pds-checkbox-group__options{display:flex;flex-direction:column;margin-block-end:.512rem;margin-inline-start:.125rem;row-gap:.8rem}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pds-checkbox{--pds-checkbox-input-size:1rem
|
|
1
|
+
.pds-checkbox{--pds-checkbox-input-size:1rem;--pds-checkbox-input-gap:0.512rem}.pds-checkbox__input-wrapper{display:flex}.pds-checkbox input[type=checkbox]{appearance:none}.pds-checkbox__label{align-items:start;column-gap:var(--pds-checkbox-input-gap);display:grid;grid-template-columns:var(--pds-checkbox-input-size) auto}.pds-checkbox__label-text{color:var(--pds-color-text-default);font-size:1rem;font-weight:400;margin-block-end:0}.pds-checkbox__box{align-items:center;background-color:var(--pds-color-input-background);border:.125rem solid var(--pds-color-input-border-default);border-radius:.1875rem;box-sizing:border-box;display:flex;height:var(--pds-checkbox-input-size);padding:.0625rem;position:relative;top:.09375rem;width:var(--pds-checkbox-input-size)}.pds-checkbox__box--checked,.pds-checkbox__box--indeterminate{background-color:var(--pds-color-input-checked-background);border-color:var(--pds-color-input-checked-background)}.pds-checkbox__icon{color:var(--pds-color-input-checked-foreground)}.pds-checkbox:hover .pds-checkbox__box{cursor:pointer}.pds-checkbox:focus-within .pds-checkbox__box{outline:.0625rem solid var(--pds-color-interactive-focus);outline-offset:.0625rem}.pds-checkbox.pds-is-disabled .pds-checkbox__label{cursor:not-allowed;opacity:50%}.pds-checkbox .pds-input-label__required{margin-inline-start:.125rem}div.pds-checkbox-group .pds-checkbox--indent-1{margin-inline-start:calc(var(--pds-checkbox-input-size)*2 - var(--pds-checkbox-input-gap))}div.pds-checkbox-group .pds-checkbox--indent-2{margin-inline-start:calc(var(--pds-checkbox-input-size)*4 - var(--pds-checkbox-input-gap)*2)}
|
|
@@ -14,4 +14,4 @@ button.pds-icon-button{--pds-button-size:2.441rem;--pds-button-color-foreground:
|
|
|
14
14
|
--pds-color-icon-button-critical-background-active
|
|
15
15
|
);--pds-button-color-foreground:var(
|
|
16
16
|
--pds-color-icon-button-critical-foreground-default
|
|
17
|
-
)}button.pds-icon-button--sm{--pds-button-size:1.953rem}button.pds-icon-button--lg{--pds-button-size:3.052rem}.pds-icon-button__tooltip .pds-tooltip__container{padding:.328rem .512rem}
|
|
17
|
+
)}button.pds-icon-button--sm{--pds-button-size:1.953rem}button.pds-icon-button--lg{--pds-button-size:3.052rem}.pds-icon-button__tooltip .pds-tooltip__container{padding:.328rem .512rem}.pds-icon-button__icon-wrapper{align-items:center;display:flex;justify-content:center;position:absolute}.pds-icon-button--fadeOut{-webkit-animation:scale-down-center .4s cubic-bezier(.25,.46,.45,.94) both;animation:scale-down-center .4s cubic-bezier(.25,.46,.45,.94) both;opacity:0;transition:.2s ease-in}.pds-icon-button--hide{display:none}.pds-icon-button--scaleIn{-webkit-animation:scale-in-center .2s cubic-bezier(.175,.885,.32,1.275) both;animation:scale-in-center .2s cubic-bezier(.175,.885,.32,1.275) both}@keyframes scale-in-center{0%{opacity:1;-webkit-transform:scale(0);transform:scale(0)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}
|