@pantheon-systems/pds-toolkit-react 1.0.0-dev.160 → 1.0.0-dev.161

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,4 +1,4 @@
1
- import React, { ReactNode, ComponentPropsWithoutRef } from 'react';
1
+ import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
2
2
  import './avatar.css';
3
3
  interface AvatarProps extends ComponentPropsWithoutRef<'div'> {
4
4
  /**
@@ -16,7 +16,7 @@ export interface IconProps {
16
16
  /**
17
17
  * Which size of icon to render
18
18
  */
19
- iconSize: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
19
+ iconSize?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
20
20
  /**
21
21
  * Additional class names
22
22
  */
@@ -1,6 +1,18 @@
1
1
  import React from 'react';
2
2
  import { PDSIcon } from '@components/Icon/Icon';
3
3
  import './segmented-button.css';
4
+ /**
5
+ * Structure for each option in the SegmentedButton component.
6
+ */
7
+ interface OptionType {
8
+ value: string;
9
+ label: string;
10
+ iconName?: PDSIcon;
11
+ tally?: {
12
+ label: string | number;
13
+ type: 'neutral' | 'critical' | 'warning' | 'info' | 'success';
14
+ };
15
+ }
4
16
  /**
5
17
  * Prop types for SegmentedButton
6
18
  */
@@ -29,11 +41,7 @@ export interface SegmentedButtonProps {
29
41
  /**
30
42
  * Array of button options — must be between 2 and 6 options.
31
43
  */
32
- options: {
33
- value: string;
34
- label: string;
35
- iconName?: PDSIcon;
36
- }[];
44
+ options: OptionType[];
37
45
  /**
38
46
  * Additional class names
39
47
  */
@@ -43,3 +51,4 @@ export interface SegmentedButtonProps {
43
51
  * SegmentedButton UI component
44
52
  */
45
53
  export declare const SegmentedButton: ({ disabled, id, initialSelection, label, onChange, options, className, ...props }: SegmentedButtonProps) => React.JSX.Element;
54
+ export {};
@@ -2,7 +2,7 @@ import React, { ComponentPropsWithoutRef } from 'react';
2
2
  import { NavigationItem } from '@components/navigation/navigation-types';
3
3
  import { PDSIcon } from '@components/Icon/Icon';
4
4
  import './dashboard-nav.css';
5
- type DashboardNavItem = NavigationItem & {
5
+ export type DashboardNavItem = NavigationItem & {
6
6
  /**
7
7
  * Icon to display next to the link content.
8
8
  */
@@ -40,4 +40,3 @@ export interface DashboardNavProps extends ComponentPropsWithoutRef<'nav'> {
40
40
  * DashboardNav UI component
41
41
  */
42
42
  export declare const DashboardNav: ({ ariaLabel, labels, menuItems, mobileMenuSelectTextFallback, className, ...props }: DashboardNavProps) => React.JSX.Element;
43
- export {};
@@ -0,0 +1,3 @@
1
+ import { DashboardNavItem } from './DashboardNav';
2
+ export declare const dashboardNavSampleMenuItems: DashboardNavItem[];
3
+ export declare const dashboardNavSampleMenuItemsRR: DashboardNavItem[];
@@ -1,44 +1,69 @@
1
- export function UserMenu({ ariaLabel, menuItems, userEmail, userImageSrc, userName, withinNavbar, className, ...props }: {
2
- [x: string]: any;
1
+ import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import { PDSIcon } from '@components/Icon/Icon';
3
+ import './user-menu.css';
4
+ /**
5
+ * Prop types for UserMenuItem
6
+ */
7
+ export type UserMenuItem = {
8
+ /**
9
+ * Use if the menu item should perform an action. This should be a function to be called when the menu item is clicked. Do not use if `linkContent` is provided.
10
+ */
11
+ callback?: () => void;
12
+ /**
13
+ * Is the menu item disabled?
14
+ */
15
+ disabled?: boolean;
16
+ /**
17
+ * Icon name for the menu item.
18
+ */
19
+ iconName?: PDSIcon;
20
+ /**
21
+ * Unique ID for the menu item. Optional.
22
+ */
23
+ id?: string;
24
+ /**
25
+ * The text to be displayed as the menu item label if a `callback` is provided.
26
+ */
27
+ label?: string;
28
+ /**
29
+ * Use if the menu item should navigate to another location. This should be a fully-formed link using the router of your choice. Should be used in place of `callback` and `label`.
30
+ */
31
+ linkContent?: ReactNode;
32
+ };
33
+ /**
34
+ * Prop types for UserMenu
35
+ */
36
+ export interface UserMenuProps extends ComponentPropsWithoutRef<'span'> {
37
+ /**
38
+ * Aria label for the user menu.
39
+ */
3
40
  ariaLabel?: string;
4
- menuItems: any;
5
- userEmail: any;
6
- userImageSrc: any;
7
- userName: any;
41
+ /**
42
+ * Array of menu items.
43
+ */
44
+ menuItems?: UserMenuItem[];
45
+ /**
46
+ * User email address.
47
+ */
48
+ userEmail?: string;
49
+ /**
50
+ * Image source for the user avatar.
51
+ */
52
+ userImageSrc?: string;
53
+ /**
54
+ * User display name.
55
+ */
56
+ userName?: string;
57
+ /**
58
+ * If true, the workspace selector will be styled and rendered to work with the mobile version of the navbar menu. Defaults to true.
59
+ */
8
60
  withinNavbar?: boolean;
9
- className: any;
10
- }): React.JSX.Element;
11
- export namespace UserMenu {
12
- namespace propTypes {
13
- let ariaLabel: PropTypes.Requireable<string>;
14
- let menuItems: PropTypes.Requireable<PropTypes.InferProps<{
15
- /**
16
- * Callback function for the menu item.
17
- */
18
- callback: PropTypes.Requireable<(...args: any[]) => any>;
19
- /**
20
- * Is the menu item disabled?
21
- */
22
- disabled: PropTypes.Requireable<boolean>;
23
- /**
24
- * Icon name for the menu item.
25
- */
26
- iconName: PropTypes.Requireable<string>;
27
- /**
28
- * Unique ID for the menu item. Optional.
29
- */
30
- id: PropTypes.Requireable<string>;
31
- /**
32
- * Label for the menu item.
33
- */
34
- label: PropTypes.Requireable<string>;
35
- }>[]>;
36
- let userEmail: PropTypes.Requireable<string>;
37
- let userImageSrc: PropTypes.Requireable<string>;
38
- let userName: PropTypes.Requireable<string>;
39
- let withinNavbar: PropTypes.Requireable<boolean>;
40
- let className: PropTypes.Requireable<string>;
41
- }
61
+ /**
62
+ * Additional class names.
63
+ */
64
+ className?: string;
42
65
  }
43
- import React from 'react';
44
- import PropTypes from 'prop-types';
66
+ /**
67
+ * UserMenu UI component
68
+ */
69
+ export declare const UserMenu: ({ ariaLabel, menuItems, userEmail, userImageSrc, userName, withinNavbar, className, ...props }: UserMenuProps) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { UserMenuItem } from './UserMenu';
2
+ export declare const userMenuItems: UserMenuItem[];
@@ -1,35 +1,53 @@
1
- export function ProgressBar({ colorBreakpoints, id, label, message, messagePosition, percentage, showLabel, showPercentage, size, className, ...props }: {
2
- [x: string]: any;
3
- colorBreakpoints?: {
4
- colorType: string;
5
- percentage: number;
6
- }[];
7
- id: any;
8
- label: any;
9
- message: any;
10
- messagePosition?: string;
11
- percentage: any;
1
+ import React, { ComponentPropsWithoutRef } from 'react';
2
+ import './progress-bar.css';
3
+ interface ProgressBarBreakpoint {
4
+ colorType: 'neutral' | 'info' | 'success' | 'warning' | 'critical';
5
+ percentage: number;
6
+ }
7
+ interface ProgressBarProps extends ComponentPropsWithoutRef<'div'> {
8
+ /**
9
+ * Array of color breakpoints. Each breakpoint should have a `colorType` and `percentage` value.
10
+ */
11
+ colorBreakpoints: ProgressBarBreakpoint[];
12
+ /**
13
+ * ID of the Progress Bar. If not provided, a unique ID will be generated.
14
+ */
15
+ id?: string;
16
+ /**
17
+ * Progress Bar label. Will be available to screen readers if `showLabel` is false.
18
+ */
19
+ label: string;
20
+ /**
21
+ * Message or description used to help clarify the usage of the progress bar.
22
+ */
23
+ message?: string;
24
+ /**
25
+ * Position of the message relative to the progress bar.
26
+ */
27
+ messagePosition?: 'above' | 'below';
28
+ /**
29
+ * Percent complete.
30
+ */
31
+ percentage: number;
32
+ /**
33
+ * Should the label be visible? If false, it will render for screen readers only.
34
+ */
12
35
  showLabel?: boolean;
36
+ /**
37
+ * Should the percentage label be visible?
38
+ */
13
39
  showPercentage?: boolean;
14
- size?: string;
15
- className: any;
16
- }): React.JSX.Element;
17
- export namespace ProgressBar {
18
- namespace propTypes {
19
- let colorBreakpoints: PropTypes.Requireable<PropTypes.InferProps<{
20
- colorType: PropTypes.Validator<string>;
21
- percentage: PropTypes.Validator<number>;
22
- }>[]>;
23
- let id: PropTypes.Requireable<string>;
24
- let label: PropTypes.Validator<string>;
25
- let message: PropTypes.Requireable<string>;
26
- let messagePosition: PropTypes.Requireable<string>;
27
- let percentage: PropTypes.Validator<number>;
28
- let showLabel: PropTypes.Requireable<boolean>;
29
- let showPercentage: PropTypes.Requireable<boolean>;
30
- let size: PropTypes.Requireable<string>;
31
- let className: PropTypes.Requireable<string>;
32
- }
40
+ /**
41
+ * Size of the progress bar.
42
+ */
43
+ size?: 'sm' | 'md' | 'lg';
44
+ /**
45
+ * Additional class names
46
+ */
47
+ className?: string;
33
48
  }
34
- import React from 'react';
35
- import PropTypes from 'prop-types';
49
+ /**
50
+ * ProgressBar UI component
51
+ */
52
+ export declare const ProgressBar: ({ colorBreakpoints, id, label, message, messagePosition, percentage, showLabel, showPercentage, size, className, ...props }: ProgressBarProps) => React.JSX.Element;
53
+ export {};
@@ -1,25 +1,41 @@
1
- export function ProgressRing({ id, innerLabel, label, percentage, showLabel, showPercentage, size, className, ...props }: {
2
- [x: string]: any;
3
- id: any;
4
- innerLabel: any;
5
- label: any;
6
- percentage: any;
1
+ import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import './progress-ring.css';
3
+ interface ProgressRingProps extends ComponentPropsWithoutRef<'div'> {
4
+ /**
5
+ * ID of the Progress Ring. If not provided, a unique ID will be generated.
6
+ */
7
+ id?: string;
8
+ /**
9
+ * Inner label for the Progress Ring. May be used for showing a percentage or a count of steps.
10
+ */
11
+ innerLabel?: ReactNode;
12
+ /**
13
+ * Label for the Progress Ring. Will be available to screen readers if `showLabel` is false.
14
+ */
15
+ label: string;
16
+ /**
17
+ * Percentage of progress.
18
+ */
19
+ percentage: number;
20
+ /**
21
+ * Should the label be visible? If false, it will render for screen readers only.
22
+ */
7
23
  showLabel?: boolean;
24
+ /**
25
+ * Should the percentage be visible? Will be overridden by `innerLabel` if one is provided.
26
+ */
8
27
  showPercentage?: boolean;
9
- size?: string;
10
- className: any;
11
- }): React.JSX.Element;
12
- export namespace ProgressRing {
13
- namespace propTypes {
14
- let id: PropTypes.Requireable<string>;
15
- let innerLabel: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
16
- let label: PropTypes.Validator<string>;
17
- let percentage: PropTypes.Validator<number>;
18
- let showLabel: PropTypes.Requireable<boolean>;
19
- let showPercentage: PropTypes.Requireable<boolean>;
20
- let size: PropTypes.Requireable<string>;
21
- let className: PropTypes.Requireable<string>;
22
- }
28
+ /**
29
+ * Size of the progress ring.
30
+ */
31
+ size?: 'sm' | 'md' | 'lg';
32
+ /**
33
+ * Additional class names
34
+ */
35
+ className?: string;
23
36
  }
24
- import React from 'react';
25
- import PropTypes from 'prop-types';
37
+ /**
38
+ * ProgressRing UI component
39
+ */
40
+ export declare const ProgressRing: ({ id, innerLabel, label, percentage, showLabel, showPercentage, size, className, ...props }: ProgressRingProps) => React.JSX.Element;
41
+ export {};
@@ -1 +1 @@
1
- .pds-avatar{display:inline-block}.pds-avatar,.pds-avatar__inner{--pds-avatar-size:1.953rem;border:.0625rem solid transparent;height:var(--pds-avatar-size);justify-content:center;width:var(--pds-avatar-size)}.pds-avatar__inner{align-items:center;background-color:var(--pds-color-background-default);border-radius:100%;display:inline-flex}.pds-avatar--image{border-color:var(--pds-color-border-default)}.pds-avatar--xs,.pds-avatar__inner--xs .pds-avatar__inner{--pds-avatar-size:1rem}.pds-avatar--sm,.pds-avatar__inner--sm .pds-avatar__inner{--pds-avatar-size:1.563rem}.pds-avatar--md,.pds-avatar__inner--md .pds-avatar__inner{--pds-avatar-size:1.953rem}.pds-avatar--lg,.pds-avatar__inner--lg .pds-avatar__inner{--pds-avatar-size:2.441rem}a.pds-avatar__inner{outline:1px solid transparent;outline-offset:.03125rem;transition:all 0s ease-out}a.pds-avatar__inner:hover{outline:1px solid var(--pds-color-interactive-link-hover)}a.pds-avatar__inner:focus-visible{outline-width:2px}.pds-avatar__inner img{border-radius:100%;height:100%;width:auto}.pds-avatar__user-fallback{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' fill='none'%3E%3Ccircle cx='12.5' cy='12.5' r='12.5' fill='%23CFCFD3'/%3E%3Cpath fill='%2323232D' d='M12.5 11.75A3.48 3.48 0 0 1 9.465 10a3.48 3.48 0 0 1 0-3.5A3.54 3.54 0 0 1 12.5 4.75c1.23 0 2.379.684 3.008 1.75a3.48 3.48 0 0 1 0 3.5 3.47 3.47 0 0 1-3.008 1.75m-1.258 1.313h2.488a4.89 4.89 0 0 1 4.895 4.894c0 .438-.383.793-.82.793H7.168a.794.794 0 0 1-.793-.793c0-2.707 2.16-4.895 4.867-4.895'/%3E%3C/svg%3E")}
1
+ .pds-avatar{--pds-avatar-size:1.953rem;align-items:center;border:.0625rem solid transparent;border-radius:100%;display:inline-flex;justify-content:center}.pds-avatar__content{border-radius:100%;display:flex;height:var(--pds-avatar-size);width:var(--pds-avatar-size)}.pds-avatar__content--link:hover{cursor:pointer;outline:1px solid var(--pds-color-interactive-link-hover);outline-offset:.09375rem}.pds-avatar__content--link:focus-visible{outline:1px solid var(--pds-color-interactive-focus);outline-offset:.09375rem}.pds-avatar--image{border-color:var(--pds-color-border-default)}.pds-avatar--image img{border-radius:100%;height:100%;width:auto}.pds-avatar--xs{--pds-avatar-size:1rem}.pds-avatar--sm{--pds-avatar-size:1.563rem}.pds-avatar--md{--pds-avatar-size:1.953rem}.pds-avatar--lg{--pds-avatar-size:2.441rem}