@pantheon-systems/pds-toolkit-react 1.0.0-dev.180 → 1.0.0-dev.182

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.
@@ -3,25 +3,32 @@ import { PDSIcon } from '@components/Icon/Icon';
3
3
  import './tabs.css';
4
4
  interface Tabs {
5
5
  /**
6
- * Sets if tab disabled (optional)
6
+ * Is the tab disabled?
7
7
  */
8
8
  disabled?: boolean;
9
9
  /**
10
- * Adds tab icon (optional)
10
+ * Sets optional tab icon.
11
11
  */
12
12
  icon?: PDSIcon;
13
+ /**
14
+ * Sets content inside tab
15
+ */
16
+ panelContent: ReactNode;
13
17
  /**
14
18
  * Sets tab label
15
19
  */
16
- tabLabel: string;
20
+ tabLabel: string | ReactNode;
17
21
  /**
18
- * Sets id for tab (optional)
22
+ * Sets id for tab.
19
23
  */
20
24
  tabId?: string;
21
25
  /**
22
- * Sets content inside tab
26
+ * Sets optional tab tally.
23
27
  */
24
- panelContent: ReactNode;
28
+ tally?: {
29
+ label: string | number;
30
+ type: 'neutral' | 'critical' | 'warning' | 'info' | 'success';
31
+ };
25
32
  }
26
33
  interface TabsProps extends ComponentPropsWithoutRef<'div'> {
27
34
  /**
@@ -40,10 +47,6 @@ interface TabsProps extends ComponentPropsWithoutRef<'div'> {
40
47
  * Sets currently selected tab using a zero-based index
41
48
  */
42
49
  selectedTab?: number;
43
- /**
44
- * Sets size of tab
45
- */
46
- size?: 'sm' | 'md';
47
50
  /**
48
51
  * Array of objects for tab data
49
52
  */
@@ -56,5 +59,5 @@ interface TabsProps extends ComponentPropsWithoutRef<'div'> {
56
59
  /**
57
60
  * Tabs UI component
58
61
  */
59
- export declare const Tabs: ({ onActiveTabChange, ariaLabel, defaultSelected, selectedTab, size, tabs, className, ...props }: TabsProps) => React.JSX.Element;
62
+ export declare const Tabs: ({ ariaLabel, defaultSelected, onActiveTabChange, selectedTab, tabs, className, ...props }: TabsProps) => React.JSX.Element;
60
63
  export {};
@@ -18,15 +18,15 @@ interface OptionType {
18
18
  */
19
19
  export interface SegmentedButtonProps {
20
20
  /**
21
- * Is the ToggleButton disabled?
21
+ * Is the SegmentedButton disabled?
22
22
  */
23
23
  disabled?: boolean;
24
24
  /**
25
- * Unique ID for the ToggleButton
25
+ * Unique ID for the SegmentedButton.
26
26
  */
27
27
  id: string;
28
28
  /**
29
- * Optional initial selected option value
29
+ * Optional initial selected option value.
30
30
  */
31
31
  initialSelection?: string;
32
32
  /**
@@ -35,7 +35,6 @@ export interface SegmentedButtonProps {
35
35
  label: string;
36
36
  /**
37
37
  * Callback function that will return the updated value from the instance when it changes.
38
- * Function should have the shape of: `(value) => { <do stuff here> } `.
39
38
  */
40
39
  onChange?: (value: string) => void;
41
40
  /**
@@ -1,37 +1,77 @@
1
- export function FileUpload({ accept, chooseFileLabel, clearButtonLabel, disabled, fieldLabel, id, inputWidth, message, multiple, onFileChange, required, showLabel, validationFunction, className, ...props }: {
2
- [x: string]: any;
3
- accept: any;
4
- chooseFileLabel?: string;
5
- clearButtonLabel?: string;
1
+ import React, { ComponentPropsWithoutRef } from 'react';
2
+ import { ValidationStatus } from '../input-types';
3
+ import './file-upload.css';
4
+ type LabelStrings = {
5
+ chooseFile: string;
6
+ clearButton: string;
7
+ };
8
+ /**
9
+ * Prop types for FileUpload
10
+ */
11
+ export interface FileUploadProps extends ComponentPropsWithoutRef<'div'> {
12
+ /**
13
+ * File types the input should accept. Leave null for all file types.
14
+ */
15
+ accept?: string;
16
+ /**
17
+ * Is the field disabled?
18
+ */
6
19
  disabled?: boolean;
7
- fieldLabel: any;
8
- id: any;
9
- inputWidth: any;
10
- message: any;
20
+ /**
21
+ * Label to be rendered above the input field. Describes the fields purpose. Optional.
22
+ */
23
+ fieldLabel?: string;
24
+ /**
25
+ * Input ID.
26
+ */
27
+ id: string;
28
+ /**
29
+ * Width of the input field. Accepts a number in pixels. Leave blank for width: 100%.
30
+ */
31
+ inputWidth?: number;
32
+ /**
33
+ * Translation strings for various labels or other visually-hidden text.
34
+ */
35
+ labelStrings?: LabelStrings;
36
+ /**
37
+ * Message or description used to help clarify the usage of the input.
38
+ */
39
+ message?: string;
40
+ /**
41
+ * Should the input accept multiple files?
42
+ */
11
43
  multiple?: boolean;
12
- onFileChange: any;
44
+ /**
45
+ * Callback function that will run when the clear button is clicked.
46
+ */
47
+ onClear?: () => void;
48
+ /**
49
+ * Callback function that will run when the file input changes.
50
+ */
51
+ onFileChange?: (files: FileList) => void;
52
+ /**
53
+ * Is the field required?
54
+ */
13
55
  required?: boolean;
56
+ /**
57
+ * Should the label be visible? If false, it will render for screen readers only.
58
+ */
14
59
  showLabel?: boolean;
15
- validationFunction: any;
16
- className: any;
17
- }): React.JSX.Element;
18
- export namespace FileUpload {
19
- namespace propTypes {
20
- let accept: PropTypes.Requireable<string>;
21
- let chooseFileLabel: PropTypes.Requireable<string>;
22
- let clearButtonLabel: PropTypes.Requireable<string>;
23
- let disabled: PropTypes.Requireable<boolean>;
24
- let fieldLabel: PropTypes.Requireable<string>;
25
- let id: PropTypes.Validator<string>;
26
- let inputWidth: PropTypes.Requireable<number>;
27
- let message: PropTypes.Requireable<string>;
28
- let multiple: PropTypes.Requireable<boolean>;
29
- let onFileChange: PropTypes.Requireable<(...args: any[]) => any>;
30
- let required: PropTypes.Requireable<boolean>;
31
- let showLabel: PropTypes.Requireable<boolean>;
32
- let validationFunction: PropTypes.Requireable<(...args: any[]) => any>;
33
- let className: PropTypes.Requireable<string>;
34
- }
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;
35
72
  }
36
- import React from 'react';
37
- import PropTypes from 'prop-types';
73
+ /**
74
+ * FileUpload UI component
75
+ */
76
+ export declare const FileUpload: ({ accept, disabled, fieldLabel, id, inputWidth, labelStrings, message, multiple, onClear, onFileChange, required, showLabel, validationMessage, validationStatus, className, ...props }: FileUploadProps) => React.JSX.Element;
77
+ export {};
@@ -1,4 +1,4 @@
1
- import React, { ComponentPropsWithoutRef, FocusEvent } from 'react';
1
+ import React from 'react';
2
2
  import { ValidationStatus } from '../input-types';
3
3
  import './select.css';
4
4
  type LabelStrings = {
@@ -22,9 +22,9 @@ export type SelectOptionType = {
22
22
  /**
23
23
  * Prop types for Select
24
24
  */
25
- export interface SelectProps extends ComponentPropsWithoutRef<'div'> {
25
+ export interface SelectProps {
26
26
  /**
27
- * Optional default value for the field. Must match the value of one of the options.
27
+ * Optional default value for the field. Must match the value of one of the options. Cannot be used in conjunction with the `value` prop.
28
28
  */
29
29
  defaultValue?: string;
30
30
  /**
@@ -52,13 +52,13 @@ export interface SelectProps extends ComponentPropsWithoutRef<'div'> {
52
52
  */
53
53
  message?: string;
54
54
  /**
55
- * onBlur event handler.
55
+ * onBlur event handler to provide the current value of the input.
56
56
  */
57
- onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
57
+ onBlur?: (currentValue: string) => void;
58
58
  /**
59
- * onFocus event handler.
59
+ * onFocus event handler to provide the current value of the input.
60
60
  */
61
- onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
61
+ onFocus?: (currentValue: string) => void;
62
62
  /**
63
63
  * Callback function when an option is selected.
64
64
  */
@@ -83,6 +83,10 @@ export interface SelectProps extends ComponentPropsWithoutRef<'div'> {
83
83
  * Validation status of the input field.
84
84
  */
85
85
  validationStatus?: ValidationStatus;
86
+ /**
87
+ * Value of the field. Must match the value of one of the options. Used to set the value of the field when controlled. Cannot be used in conjunction with the `defaultValue` prop.
88
+ */
89
+ value?: string;
86
90
  /**
87
91
  * Additional class names
88
92
  */
@@ -91,5 +95,5 @@ export interface SelectProps extends ComponentPropsWithoutRef<'div'> {
91
95
  /**
92
96
  * Select UI component
93
97
  */
94
- export declare const Select: ({ defaultValue, disabled, id, inputWidth, label, labelStrings, message, onBlur, onFocus, onOptionSelect, options, required, showLabel, validationMessage, validationStatus, className, ...props }: SelectProps) => React.JSX.Element;
98
+ export declare const Select: ({ defaultValue, disabled, id, inputWidth, label, labelStrings, message, onBlur, onFocus, onOptionSelect, options, required, showLabel, validationMessage, validationStatus, value, className, ...props }: SelectProps) => React.JSX.Element;
95
99
  export {};
@@ -12,15 +12,42 @@ export declare const getInputWidthStyle: (inputWidth: number) => {
12
12
  width: string;
13
13
  };
14
14
  export declare const RequiredIcon: () => React.JSX.Element;
15
- export declare const InputLabel: ({ id, label, showLabel, required, disabled, isLegend, className, }: {
15
+ interface InputLabelProps {
16
+ /**
17
+ * Input ID.
18
+ */
16
19
  id: string;
20
+ /**
21
+ * Label text.
22
+ */
17
23
  label: string;
24
+ /**
25
+ * Should the label be visible?
26
+ */
18
27
  showLabel: boolean;
28
+ /**
29
+ * Is the field required?
30
+ */
19
31
  required: boolean;
32
+ /**
33
+ * Is the field disabled?
34
+ */
20
35
  disabled: boolean;
36
+ /**
37
+ * Is the label a legend? Should be used when the input is a fieldset.
38
+ */
21
39
  isLegend?: boolean;
40
+ /**
41
+ * Not a true `label`, but a description of the field.
42
+ * Used for inputs that have their label built into the element itself.
43
+ */
44
+ isPseudoLabel?: boolean;
45
+ /**
46
+ * Additional class names.
47
+ */
22
48
  className?: string;
23
- }) => React.JSX.Element;
49
+ }
50
+ export declare const InputLabel: ({ id, label, showLabel, required, disabled, isLegend, isPseudoLabel, className, }: InputLabelProps) => React.JSX.Element;
24
51
  export declare const InputMessage: ({ id, message, hasValidationMessage, validationMessageHasDecorators, validationStatus, className, }: {
25
52
  id: string;
26
53
  message: string;
@@ -1,23 +1,42 @@
1
- export function Tile({ displayType, headingLevel, headingText, imageSrc, linkContent, summary, className, ...props }: {
2
- [x: string]: any;
3
- displayType?: string;
4
- headingLevel?: string;
5
- headingText: any;
6
- imageSrc: any;
7
- linkContent: any;
8
- summary: any;
9
- className: any;
10
- }): React.JSX.Element;
11
- export namespace Tile {
12
- namespace propTypes {
13
- let displayType: PropTypes.Requireable<string>;
14
- let headingLevel: PropTypes.Requireable<string>;
15
- let headingText: PropTypes.Requireable<string>;
16
- let imageSrc: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
- let linkContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
18
- let summary: PropTypes.Requireable<string>;
19
- let className: PropTypes.Requireable<string>;
20
- }
1
+ import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import { HeadingLevel } from '@libs/types/custom-types';
3
+ import './../tiles-common.css';
4
+ import './tile.css';
5
+ export type TileDisplayType = 'border' | 'clean' | 'clean-static';
6
+ /**
7
+ * Prop types for Tile
8
+ */
9
+ export interface TileProps extends ComponentPropsWithoutRef<'div'> {
10
+ /**
11
+ * Display type.
12
+ */
13
+ displayType?: TileDisplayType;
14
+ /**
15
+ * Heading level or `span`.
16
+ */
17
+ headingLevel?: HeadingLevel;
18
+ /**
19
+ * Heading text.
20
+ */
21
+ headingText?: string;
22
+ /**
23
+ * Image source.
24
+ */
25
+ imageSrc?: string;
26
+ /**
27
+ * A link element using the router of your choice.
28
+ */
29
+ linkContent?: ReactNode;
30
+ /**
31
+ * Summary paragraph.
32
+ */
33
+ summary?: string;
34
+ /**
35
+ * Additional class names
36
+ */
37
+ className?: string;
21
38
  }
22
- import React from 'react';
23
- import PropTypes from 'prop-types';
39
+ /**
40
+ * Tile UI component
41
+ */
42
+ export declare const Tile: ({ displayType, headingLevel, headingText, imageSrc, linkContent, summary, className, ...props }: TileProps) => React.JSX.Element;
@@ -1,38 +1,29 @@
1
- export function TileGrid({ displayType, headingLevel, tiles, className, ...props }: {
2
- [x: string]: any;
3
- displayType?: string;
4
- headingLevel?: string;
5
- tiles: any;
6
- className: any;
7
- }): React.JSX.Element;
8
- export namespace TileGrid {
9
- namespace propTypes {
10
- let displayType: PropTypes.Requireable<string>;
11
- let headingLevel: PropTypes.Requireable<string>;
12
- let tiles: PropTypes.Requireable<PropTypes.InferProps<{
13
- /**
14
- * Tile heading
15
- */
16
- headingText: PropTypes.Requireable<string>;
17
- /**
18
- * Tile image source.
19
- */
20
- imageSrc: PropTypes.Requireable<PropTypes.ReactNodeLike>;
21
- /**
22
- * A link element using the router of your choice.
23
- */
24
- linkContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
25
- /**
26
- * Summary paragraph.
27
- */
28
- summary: PropTypes.Requireable<string>;
29
- /**
30
- * Additional class names.
31
- */
32
- className: PropTypes.Requireable<string>;
33
- }>[]>;
34
- let className: PropTypes.Requireable<string>;
35
- }
1
+ import React, { ComponentPropsWithoutRef } from 'react';
2
+ import { TileDisplayType, TileProps } from '@components/tiles/Tile/Tile';
3
+ import { HeadingLevel } from '@libs/types/custom-types';
4
+ import './../tiles-common.css';
5
+ /**
6
+ * Prop types for TileGrid
7
+ */
8
+ export interface TileGridProps extends ComponentPropsWithoutRef<'div'> {
9
+ /**
10
+ * Display type.
11
+ */
12
+ displayType?: TileDisplayType;
13
+ /**
14
+ * Heading level or `span`. All tiles in the grid will use this heading level.
15
+ */
16
+ headingLevel?: HeadingLevel;
17
+ /**
18
+ * Array of Tiles.
19
+ */
20
+ tiles: TileProps[];
21
+ /**
22
+ * Additional class names
23
+ */
24
+ className?: string;
36
25
  }
37
- import React from 'react';
38
- import PropTypes from 'prop-types';
26
+ /**
27
+ * TileGrid UI component
28
+ */
29
+ export declare const TileGrid: ({ displayType, headingLevel, tiles, className, ...props }: TileGridProps) => React.JSX.Element;
@@ -1,5 +1,7 @@
1
- .pds-input-field--file-upload{align-items:center;border:.0625rem solid var(--pds-color-input-border-default);border-radius:.1875rem;display:flex;gap:.41rem;height:2.441rem;padding-inline:.41rem .25rem}.pds-file-upload::file-selector-button{padding:0;visibility:hidden;width:.1rem}.pds-file-upload:focus{outline:none}.pds-file-upload{color:var(--pds-color-text-default);font-size:1rem;text-align:left;width:100%}.pds-file-upload--has-value{padding-inline-start:0}.pds-file-upload__label{all:unset;align-items:center;background-color:var(
1
+ .pds-file-upload__input-wrapper{align-items:center;background-color:var(--pds-color-input-background-default);border:.0625rem solid var(--pds-color-input-border-default);border-radius:.1875rem;box-sizing:border-box;display:flex;gap:.64rem;column-gap:.512rem;cursor:pointer;height:2.441rem;padding-inline:.512rem;position:relative;transition:background-color .2s ease-in-out 0s,border-color .2s ease-in-out 0s;width:100%}.pds-file-upload__input-wrapper:focus-within{border-color:var(--pds-color-interactive-focus);outline:none;transition:outline .2s ease-in-out 0s}.pds-file-upload__input::file-selector-button{padding:0;visibility:hidden;width:.1rem}.pds-file-upload__input{color:var(--pds-color-text-default);font-size:1rem;text-align:left;width:100%}.pds-file-upload__input:focus{outline:none}.pds-file-upload__input-label{all:unset;align-items:center;background-color:var(
2
2
  --pds-color-input-file-upload-button-background-default
3
- );border-radius:.1875rem;color:var(--pds-color-foreground-default);display:flex;font-family:Poppins,sans-serif;font-size:.833rem;font-weight:400;gap:.41rem;letter-spacing:0;line-height:1;padding:.41rem .512rem;padding-inline-start:.41rem;white-space:nowrap}.pds-file-upload__label:hover{background-color:var(
3
+ );border-radius:.1875rem;color:var(--pds-color-foreground-default);display:flex;font-family:Poppins,sans-serif;font-size:.833rem;font-weight:400;gap:.41rem;letter-spacing:0;line-height:1;padding:.41rem .512rem;white-space:nowrap}.pds-file-upload__input-label:hover{background-color:var(
4
4
  --pds-color-input-file-upload-button-background-hover
5
- )}.pds-input-wrapper.pds-input-wrapper--file-upload.pds-has-error .pds-input-field--file-upload,.pds-input-wrapper.pds-input-wrapper--file-upload.pds-has-success .pds-input-field--file-upload{padding-inline-start:.64rem}.pds-input-wrapper.pds-input-wrapper--file-upload.pds-has-error .pds-file-upload--has-value,.pds-input-wrapper.pds-input-wrapper--file-upload.pds-has-success .pds-file-upload--has-value{padding-inline-start:0}
5
+ )}.pds-file-upload.pds-is-disabled .pds-file-upload__input-label{cursor:not-allowed}.pds-file-upload.pds-is-disabled .pds-file-upload__input-label:hover{background-color:var(
6
+ --pds-color-input-file-upload-button-background-default
7
+ )}