@pantheon-systems/pds-toolkit-react 1.0.0-dev.174 → 1.0.0-dev.176

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.
@@ -1,45 +1,91 @@
1
- export function Select({ disabled, id, initialValue, inputWidth, label, message, onOptionSelect, options, required, selectOptionsLabel, showLabel, validationFunction, className, ...props }: {
2
- [x: string]: any;
1
+ import React, { ComponentPropsWithoutRef, FocusEvent } from 'react';
2
+ import { ValidationStatus } from '../input-types';
3
+ import './select.css';
4
+ type LabelStrings = {
5
+ selectOptionText: string;
6
+ triggerButton: string;
7
+ };
8
+ export type SelectOptionType = {
9
+ /**
10
+ * Option label.
11
+ */
12
+ label: string;
13
+ /**
14
+ * Option value.
15
+ */
16
+ value: string;
17
+ };
18
+ /**
19
+ * Prop types for Select
20
+ */
21
+ export interface SelectProps extends ComponentPropsWithoutRef<'div'> {
22
+ /**
23
+ * Optional default value for the field. Must match the value of one of the options.
24
+ */
25
+ defaultValue?: string;
26
+ /**
27
+ * Is the field disabled?
28
+ */
3
29
  disabled?: boolean;
4
- id: any;
5
- initialValue: any;
6
- inputWidth: any;
7
- label: any;
8
- message: any;
9
- onOptionSelect: any;
10
- options: any;
30
+ /**
31
+ * Input ID.
32
+ */
33
+ id: string;
34
+ /**
35
+ * Width of the input field. Accepts a number in pixels. Leave blank for width: 100%.
36
+ */
37
+ inputWidth?: number;
38
+ /**
39
+ * Field label.
40
+ */
41
+ label: string;
42
+ /**
43
+ * Translation strings for various labels or other visually-hidden text.
44
+ */
45
+ labelStrings?: LabelStrings;
46
+ /**
47
+ * Message or description used to help clarify the usage of the input.
48
+ */
49
+ message?: string;
50
+ /**
51
+ * onBlur event handler.
52
+ */
53
+ onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
54
+ /**
55
+ * onFocus event handler.
56
+ */
57
+ onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
58
+ /**
59
+ * Callback function when an option is selected.
60
+ */
61
+ onOptionSelect?: (option: SelectOptionType) => void;
62
+ /**
63
+ * Array of options for the select field.
64
+ */
65
+ options?: SelectOptionType[];
66
+ /**
67
+ * Is this field required?
68
+ */
11
69
  required?: boolean;
12
- selectOptionsLabel?: string;
70
+ /**
71
+ * Should the label be visible? If false, it will render for screen readers only.
72
+ */
13
73
  showLabel?: boolean;
14
- validationFunction: any;
15
- className: any;
16
- }): React.JSX.Element;
17
- export namespace Select {
18
- let displayName: string;
19
- namespace propTypes {
20
- let disabled: PropTypes.Requireable<boolean>;
21
- let id: PropTypes.Validator<string>;
22
- let initialValue: PropTypes.Requireable<string>;
23
- let inputWidth: PropTypes.Requireable<number>;
24
- let label: PropTypes.Validator<string>;
25
- let message: PropTypes.Requireable<string>;
26
- let onOptionSelect: PropTypes.Requireable<(...args: any[]) => any>;
27
- let options: PropTypes.Validator<PropTypes.InferProps<{
28
- /**
29
- * Option label.
30
- */
31
- label: PropTypes.Validator<string>;
32
- /**
33
- * Option value. Will default to label if not provided.
34
- */
35
- value: PropTypes.Requireable<string>;
36
- }>[]>;
37
- let required: PropTypes.Requireable<boolean>;
38
- let selectOptionsLabel: PropTypes.Requireable<string>;
39
- let showLabel: PropTypes.Requireable<boolean>;
40
- let validationFunction: PropTypes.Requireable<(...args: any[]) => any>;
41
- let className: PropTypes.Requireable<string>;
42
- }
74
+ /**
75
+ * Validation message for the input field based on the validation status.
76
+ */
77
+ validationMessage?: string;
78
+ /**
79
+ * Validation status of the input field.
80
+ */
81
+ validationStatus?: ValidationStatus;
82
+ /**
83
+ * Additional class names
84
+ */
85
+ className?: string;
43
86
  }
44
- import React from 'react';
45
- import PropTypes from 'prop-types';
87
+ /**
88
+ * Select UI component
89
+ */
90
+ 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;
91
+ export {};
@@ -10,7 +10,7 @@ a.pds-button,button.pds-button{--pds-button-color-background:var(
10
10
  --pds-color-button-primary-background-active
11
11
  );--pds-button-color-border:var(--pds-color-button-primary-border-active);--pds-button-color-foreground:var(
12
12
  --pds-color-button-primary-foreground-active
13
- )}a.pds-button:focus-visible,button.pds-button:focus-visible{outline:.125rem solid var(--pds-color-interactive-focus);outline-offset:.0625rem}a.pds-button.pds-button--sm,button.pds-button.pds-button--sm{font-size:.833rem;gap:.41rem;height:unset;max-height:1.953rem;padding:.41rem .512rem}a.pds-button.pds-button--sm .pds-button__loading-indicator,button.pds-button.pds-button--sm .pds-button__loading-indicator{--pds-spinner-size:0.8rem}a.pds-button.pds-button--lg,button.pds-button.pds-button--lg{font-size:1.2rem;height:unset;max-height:3.052rem;padding:1rem 1.25rem}a.pds-button.pds-button--lg .pds-button__loading-indicator,button.pds-button.pds-button--lg .pds-button__loading-indicator{--pds-spinner-size:1.25rem}a.pds-button.pds-button--secondary,button.pds-button.pds-button--secondary{--pds-button-color-background:var(
13
+ )}a.pds-button:focus-visible,button.pds-button:focus-visible{outline:.0625rem solid var(--pds-color-interactive-focus);outline-offset:.0625rem}a.pds-button.pds-button--sm,button.pds-button.pds-button--sm{font-size:.833rem;gap:.41rem;height:unset;max-height:1.953rem;padding:.41rem .512rem}a.pds-button.pds-button--sm .pds-button__loading-indicator,button.pds-button.pds-button--sm .pds-button__loading-indicator{--pds-spinner-size:0.8rem}a.pds-button.pds-button--lg,button.pds-button.pds-button--lg{font-size:1.2rem;height:unset;max-height:3.052rem;padding:1rem 1.25rem}a.pds-button.pds-button--lg .pds-button__loading-indicator,button.pds-button.pds-button--lg .pds-button__loading-indicator{--pds-spinner-size:1.25rem}a.pds-button.pds-button--secondary,button.pds-button.pds-button--secondary{--pds-button-color-background:var(
14
14
  --pds-color-button-secondary-background-default
15
15
  );--pds-button-color-border:var(--pds-color-button-secondary-border-default);--pds-button-color-foreground:var(
16
16
  --pds-color-button-secondary-foreground-default
@@ -1 +1 @@
1
- .pds-dashboard-search{--dashboard-search-height:2.441rem;height:var(--dashboard-search-height);margin-inline-end:-.64rem;position:absolute;transition:width .375s ease;z-index:400}.pds-dashboard-search--inner{align-content:stretch;display:flex}.pds-dashboard-search__combobox{left:0;position:absolute;right:0}.pds-dashboard-search__search-toggle{align-items:center;background-color:transparent;border:.0625rem solid transparent;border-radius:.1875rem;color:var(--pds-color-text-default);cursor:pointer;display:flex;height:var(--dashboard-search-height);padding-inline:.64rem}.pds-dashboard-search__search-toggle:hover{color:var(--pds-color-interactive-link-hover)}.pds-dashboard-search__search-toggle-icon{pointer-events:none}.pds-dashboard-search__option-display{justify-content:space-between;width:100%}.pds-dashboard-search__option-display,.pds-dashboard-search__option-inner{align-items:center;column-gap:.8rem;display:flex}.pds-dashboard-search__option-icon{align-items:center;color:var(--pds-color-text-default-secondary);display:flex}.pds-dashboard-search__option-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pds-dashboard-search--isMobile{border-bottom:.0625rem solid var(--pds-color-border-default);left:50%;margin-inline-start:-50vw;min-height:3.815rem;position:relative;width:100vw}.pds-dashboard-search--isMobile .pds-dashboard-search__combobox{margin-inline:auto;width:calc(100% - 2.5rem)}.pds-dashboard-search--mobile-inner{padding-block:.64rem}
1
+ .pds-dashboard-search{--dashboard-search-height:2.441rem;height:var(--dashboard-search-height);margin-inline-end:-.64rem;position:absolute;transition:width .375s ease;z-index:400}.pds-dashboard-search--inner{align-content:stretch;display:flex}.pds-dashboard-search__combobox{left:0;position:absolute;right:0}.pds-dashboard-search__search-toggle{align-items:center;background-color:transparent;border:.0625rem solid transparent;border-radius:.1875rem;color:var(--pds-color-text-default);cursor:pointer;display:flex;height:var(--dashboard-search-height);padding-inline:.64rem}.pds-dashboard-search__search-toggle:hover{color:var(--pds-color-interactive-link-hover)}.pds-dashboard-search__search-toggle:focus-visible{outline:.0625rem solid var(--pds-color-interactive-focus);transition:outline .2s ease-in-out 0s}.pds-dashboard-search__search-toggle-icon{pointer-events:none}.pds-dashboard-search__option-display{justify-content:space-between;width:100%}.pds-dashboard-search__option-display,.pds-dashboard-search__option-inner{align-items:center;column-gap:.8rem;display:flex}.pds-dashboard-search__option-icon{align-items:center;color:var(--pds-color-text-default-secondary);display:flex}.pds-dashboard-search__option-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pds-dashboard-search--isMobile{border-bottom:.0625rem solid var(--pds-color-border-default);left:50%;margin-inline-start:-50vw;min-height:3.815rem;position:relative;width:100vw}.pds-dashboard-search--isMobile .pds-dashboard-search__combobox{margin-inline:auto;width:calc(100% - 2.5rem)}.pds-dashboard-search--mobile-inner{padding-block:.64rem}