@pantheon-systems/pds-toolkit-react 2.0.0-alpha.10 → 2.0.0-alpha.12
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/Dropdown/Dropdown.d.ts +140 -0
- package/dist/components/Dropdown/DropdownSelectedIcon.d.ts +7 -0
- package/dist/components/Popover/Popover.d.ts +5 -1
- package/dist/components/Table/Table.d.ts +9 -18
- package/dist/components/buttons/IconButton/IconButton.d.ts +4 -0
- package/dist/components/buttons/MenuButton/MenuButton.d.ts +1 -0
- package/dist/components/charts/BarChart/BarChart.d.ts +21 -0
- package/dist/components/charts/LineChart/LineChart.d.ts +22 -0
- package/dist/components/charts/shared/ChartAccessibleTable.d.ts +17 -0
- package/dist/components/charts/shared/ChartLegend.d.ts +25 -0
- package/dist/components/charts/shared/chart-colors.d.ts +18 -0
- package/dist/components/charts/shared/chart-styles.d.ts +16 -0
- package/dist/components/charts/shared/formatters.d.ts +12 -0
- package/dist/components/charts/shared/types.d.ts +97 -0
- package/dist/components/icons/Icon/generated-icon-data.d.ts +1 -1
- package/dist/components/inputs/Combobox/Combobox.d.ts +16 -6
- package/dist/components/inputs/ComboboxMultiselect/ComboboxMultiselect.d.ts +9 -4
- package/dist/components/inputs/Select/Select.d.ts +6 -1
- package/dist/components/inputs/input-utilities.d.ts +1 -0
- package/dist/components/navigation/DropdownMenu/DropdownMenu.d.ts +1 -0
- package/dist/components/navigation/{NavMenu/NavMenu.d.ts → SiteMenu/SiteMenu.d.ts} +5 -4
- package/dist/components/navigation/SiteMenu/SiteMenuDropdown.d.ts +26 -0
- package/dist/components/navigation/WorkspaceSelector/WorkspaceSelector.d.ts +1 -0
- package/dist/css/component-css/pds-bar-chart.css +1 -0
- package/dist/css/component-css/pds-breadcrumb.css +1 -1
- package/dist/css/component-css/pds-chart-legend.css +1 -0
- package/dist/css/component-css/pds-chart-tokens.css +1 -0
- package/dist/css/component-css/pds-chart-wrapper.css +1 -0
- package/dist/css/component-css/pds-combobox-multiselect.css +4 -2
- package/dist/css/component-css/pds-combobox.css +1 -1
- package/dist/css/component-css/pds-dropdown-menu.css +2 -2
- package/dist/css/component-css/pds-dropdown.css +2 -0
- package/dist/css/component-css/pds-icon-button.css +2 -2
- package/dist/css/component-css/pds-index.css +19 -16
- package/dist/css/component-css/pds-input-utilities.css +1 -1
- package/dist/css/component-css/pds-line-chart.css +1 -0
- package/dist/css/component-css/pds-menu-button.css +1 -1
- package/dist/css/component-css/pds-nav-menu.css +2 -2
- package/dist/css/component-css/pds-pantheon-logo.css +1 -1
- package/dist/css/component-css/pds-popover.css +1 -1
- package/dist/css/component-css/pds-select.css +1 -1
- package/dist/css/component-css/pds-side-nav-global.css +6 -6
- package/dist/css/component-css/pds-table.css +1 -1
- package/dist/css/component-css/pds-text-input.css +1 -1
- package/dist/css/component-css/pds-textarea.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/variables.dark.css +11 -2
- package/dist/css/design-tokens/variables.light.css +11 -2
- package/dist/css/layout-css/pds-app-layout.css +2 -2
- package/dist/css/layout-css/pds-index.css +2 -2
- package/dist/css/pds-components.css +19 -16
- package/dist/css/pds-core.css +2 -2
- package/dist/css/pds-layouts.css +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +4724 -2359
- package/dist/index.js.map +1 -1
- package/dist/index.source.d.ts +6 -1
- package/dist/layouts/AppLayout/AppLayout.d.ts +5 -1
- package/dist/utilities/hooks/useDropdown/index.d.ts +1 -0
- package/dist/utilities/hooks/useDropdown/useDropdown.d.ts +121 -0
- package/package.json +4 -3
- package/dist/components/navigation/NavMenu/NavMenuDropdown.d.ts +0 -24
package/dist/index.source.d.ts
CHANGED
|
@@ -23,12 +23,16 @@ export * from './components/cards/NewSiteCard/NewSiteCard';
|
|
|
23
23
|
export * from './components/cards/PaymentCard/PaymentCard';
|
|
24
24
|
export * from './components/cards/PricingCard/PricingCard';
|
|
25
25
|
export * from './components/cards/SiteCard/SiteCard';
|
|
26
|
+
export * from './components/charts/BarChart/BarChart';
|
|
27
|
+
export * from './components/charts/LineChart/LineChart';
|
|
28
|
+
export * from './components/charts/shared/types';
|
|
26
29
|
export * from './components/CodeBlock/CodeBlock';
|
|
27
30
|
export * from './components/ComparisonList/ComparisonList';
|
|
28
31
|
export * from './components/CTALink/CTALink';
|
|
29
32
|
export * from './components/CTASlice/CTASlice';
|
|
30
33
|
export * from './components/DashboardStat/DashboardStat';
|
|
31
34
|
export * from './components/Drawer/Drawer';
|
|
35
|
+
export * from './components/Dropdown/Dropdown';
|
|
32
36
|
export * from './components/empty-states/CompactEmptyState/CompactEmptyState';
|
|
33
37
|
export * from './components/empty-states/HorizontalEmptyState/HorizontalEmptyState';
|
|
34
38
|
export * from './components/empty-states/VerticalEmptyState/VerticalEmptyState';
|
|
@@ -65,11 +69,11 @@ export * from './components/navigation/DashboardNav/DashboardNavItem';
|
|
|
65
69
|
export * from './components/navigation/DashboardSearch/DashboardSearch';
|
|
66
70
|
export * from './components/navigation/DropdownMenu/DropdownMenu';
|
|
67
71
|
export * from './components/navigation/Navbar/Navbar';
|
|
68
|
-
export * from './components/navigation/NavMenu/NavMenu';
|
|
69
72
|
export * from './components/navigation/SideNav/SideNav';
|
|
70
73
|
export * from './components/navigation/SideNavCompact/SideNavCompact';
|
|
71
74
|
export * from './components/navigation/SideNavGlobal/SideNavGlobal';
|
|
72
75
|
export * from './components/navigation/SideNavGlobal/SideNavGlobalItem';
|
|
76
|
+
export * from './components/navigation/SiteMenu/SiteMenu';
|
|
73
77
|
export * from './components/navigation/TabMenu/TabMenu';
|
|
74
78
|
export * from './components/navigation/UserMenu/UserMenu';
|
|
75
79
|
export * from './components/navigation/WorkspaceSelector/WorkspaceSelector';
|
|
@@ -129,6 +133,7 @@ export * from './libs/types/navigation-types';
|
|
|
129
133
|
export * from './utilities/context-providers/ResponsiveContext/ResponsiveContext';
|
|
130
134
|
export * from './utilities/hooks/useBreakpoint/useBreakpoint';
|
|
131
135
|
export * from './utilities/hooks/useClipboard/useClipboard';
|
|
136
|
+
export * from './utilities/hooks/useDropdown';
|
|
132
137
|
export * from './utilities/hooks/useKeyPress/useKeyPress';
|
|
133
138
|
export * from './utilities/hooks/useMediaQuery/useMediaQuery';
|
|
134
139
|
export * from './utilities/hooks/useWindowWidth/useWindowWidth';
|
|
@@ -47,6 +47,10 @@ interface AppLayoutProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
47
47
|
* If not provided, the sidebar will use an internal function to manage collapsed state.
|
|
48
48
|
*/
|
|
49
49
|
onSidebarToggle?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* When true, the sidebar stays fixed and only the main content area scrolls.
|
|
52
|
+
*/
|
|
53
|
+
scrollableContent?: boolean;
|
|
50
54
|
/**
|
|
51
55
|
* Background color for the sidebar. Use a PDS CSS custom property
|
|
52
56
|
* (e.g. 'var(--pds-color-bg-default)') so dark mode works automatically.
|
|
@@ -74,5 +78,5 @@ interface AppLayoutProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
74
78
|
/**
|
|
75
79
|
* AppLayout UI component
|
|
76
80
|
*/
|
|
77
|
-
export declare const AppLayout: ({ children, className, hasSidebarToggle, isSidebarCollapsed, labels, mainBackground, mainContentElement, mainContentProps, onSidebarToggle, sidebarBackground, sidebarCollapsedWidth, sidebarExpandedWidth, sidebarExpandedWidthMin, sidebarProps, ...props }: AppLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export declare const AppLayout: ({ children, className, hasSidebarToggle, isSidebarCollapsed, labels, mainBackground, mainContentElement, mainContentProps, onSidebarToggle, scrollableContent, sidebarBackground, sidebarCollapsedWidth, sidebarExpandedWidth, sidebarExpandedWidthMin, sidebarProps, ...props }: AppLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
78
82
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDropdown';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Placement } from '@floating-ui/react';
|
|
2
|
+
import { useFloating, useInteractions } from '@floating-ui/react';
|
|
3
|
+
export type DropdownRole = 'menu' | 'listbox';
|
|
4
|
+
export type DropdownVariant = 'default' | 'input';
|
|
5
|
+
export interface UseDropdownOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Allow keyboard navigation to escape the list (move past first/last item).
|
|
8
|
+
* Useful for combobox inputs where focus should return to the input.
|
|
9
|
+
*/
|
|
10
|
+
allowEscape?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Enable click-to-toggle interaction via useClick.
|
|
13
|
+
* Set to false for combobox-type inputs where open/close is managed
|
|
14
|
+
* by input events (typing, focus) rather than a click toggle.
|
|
15
|
+
*/
|
|
16
|
+
enableClick?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Enable keyboard list navigation via useListNavigation.
|
|
19
|
+
* Set to false if keyboard nav is managed externally.
|
|
20
|
+
*/
|
|
21
|
+
enableListNavigation?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Enable shift middleware to keep the dropdown within viewport bounds.
|
|
24
|
+
* Set to false for inputs where the dropdown should align flush with the trigger.
|
|
25
|
+
*/
|
|
26
|
+
enableShift?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Enable transition animations on the dropdown panel.
|
|
29
|
+
*/
|
|
30
|
+
enableTransition?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Enable typeahead character search via useTypeahead.
|
|
33
|
+
*/
|
|
34
|
+
enableTypeahead?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Offset distance in pixels between the trigger and the dropdown panel.
|
|
37
|
+
* Ignored when variant is 'input' (uses dynamic offset based on placement).
|
|
38
|
+
*/
|
|
39
|
+
offsetValue?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Open the dropdown on hover (desktop navigation menus).
|
|
42
|
+
* Enables useHover with safePolygon.
|
|
43
|
+
*/
|
|
44
|
+
openOnHover?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Preferred placement of the dropdown panel relative to the trigger.
|
|
47
|
+
*/
|
|
48
|
+
placement?: Placement;
|
|
49
|
+
/**
|
|
50
|
+
* ARIA role for the dropdown container.
|
|
51
|
+
*/
|
|
52
|
+
role?: DropdownRole;
|
|
53
|
+
/**
|
|
54
|
+
* Index of the currently selected item. Used by typeahead to maintain
|
|
55
|
+
* selection context. Only needed for selection-style dropdowns (Select).
|
|
56
|
+
*/
|
|
57
|
+
selectedIndex?: number | null;
|
|
58
|
+
/**
|
|
59
|
+
* Dropdown variant. 'input' applies input-specific positioning: dynamic
|
|
60
|
+
* offset based on placement direction and size constraints with min/max height.
|
|
61
|
+
* Use for Select, Combobox, and other input-attached dropdowns.
|
|
62
|
+
*/
|
|
63
|
+
variant?: DropdownVariant;
|
|
64
|
+
/**
|
|
65
|
+
* Use virtual focus (aria-activedescendant) instead of roving tabindex.
|
|
66
|
+
* Appropriate for combobox-type inputs where focus must stay on the input.
|
|
67
|
+
*/
|
|
68
|
+
virtual?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface UseDropdownReturn {
|
|
71
|
+
/**
|
|
72
|
+
* Index of the currently active/focused item in the list.
|
|
73
|
+
*/
|
|
74
|
+
activeIndex: number | null;
|
|
75
|
+
/**
|
|
76
|
+
* Styles to apply to the floating panel element.
|
|
77
|
+
*/
|
|
78
|
+
floatingStyles: ReturnType<typeof useFloating>['floatingStyles'];
|
|
79
|
+
/**
|
|
80
|
+
* Props to spread on the floating panel element.
|
|
81
|
+
*/
|
|
82
|
+
getFloatingProps: ReturnType<typeof useInteractions>['getFloatingProps'];
|
|
83
|
+
/**
|
|
84
|
+
* Props to spread on each item element.
|
|
85
|
+
*/
|
|
86
|
+
getItemProps: ReturnType<typeof useInteractions>['getItemProps'];
|
|
87
|
+
/**
|
|
88
|
+
* Props to spread on the trigger/reference element.
|
|
89
|
+
*/
|
|
90
|
+
getReferenceProps: ReturnType<typeof useInteractions>['getReferenceProps'];
|
|
91
|
+
/**
|
|
92
|
+
* Whether the floating panel should be mounted in the DOM
|
|
93
|
+
* (accounts for transition animations).
|
|
94
|
+
*/
|
|
95
|
+
isMounted: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the dropdown is currently open.
|
|
98
|
+
*/
|
|
99
|
+
isOpen: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Ref array for list item DOM nodes (used by useListNavigation).
|
|
102
|
+
*/
|
|
103
|
+
listRef: React.MutableRefObject<any[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Floating UI refs for the reference and floating elements.
|
|
106
|
+
*/
|
|
107
|
+
refs: ReturnType<typeof useFloating>['refs'];
|
|
108
|
+
/**
|
|
109
|
+
* Set the active/focused item index.
|
|
110
|
+
*/
|
|
111
|
+
setActiveIndex: React.Dispatch<React.SetStateAction<number | null>>;
|
|
112
|
+
/**
|
|
113
|
+
* Set the open state of the dropdown.
|
|
114
|
+
*/
|
|
115
|
+
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
116
|
+
/**
|
|
117
|
+
* Transition styles to apply to the floating panel element.
|
|
118
|
+
*/
|
|
119
|
+
transitionStyles: React.CSSProperties;
|
|
120
|
+
}
|
|
121
|
+
export declare const useDropdown: ({ allowEscape, enableClick, enableListNavigation, enableShift, enableTransition, enableTypeahead, offsetValue, openOnHover, placement, role, selectedIndex, variant, virtual, }?: UseDropdownOptions) => UseDropdownReturn;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantheon-systems/pds-toolkit-react",
|
|
3
3
|
"technology": "React",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.12",
|
|
5
5
|
"description": "PDS toolkit built using the React framework",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"dependencies": {
|
|
161
161
|
"@floating-ui/react": "^0.24.3",
|
|
162
162
|
"@floating-ui/react-dom": "~1.3.0",
|
|
163
|
-
"@pantheon-systems/pds-design-tokens": "^2.0.0-alpha.
|
|
163
|
+
"@pantheon-systems/pds-design-tokens": "^2.0.0-alpha.34",
|
|
164
164
|
"@reactuses/core": "^5.0.15",
|
|
165
165
|
"date-fns": "^4.1.0",
|
|
166
166
|
"downshift": "^9.0.8",
|
|
@@ -177,7 +177,8 @@
|
|
|
177
177
|
"react-day-picker": "^9.11.1",
|
|
178
178
|
"react-device-detect": "^2.2.3",
|
|
179
179
|
"react-hotkeys-hook": "^4.5.1",
|
|
180
|
-
"react-toastify": "^9.0.3"
|
|
180
|
+
"react-toastify": "^9.0.3",
|
|
181
|
+
"recharts": "^3.8.1"
|
|
181
182
|
},
|
|
182
183
|
"optionalDependencies": {
|
|
183
184
|
"@fortawesome/free-brands-svg-icons": "^7.2.0",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { NavMenuItem } from '../../../libs/types/navigation-types';
|
|
3
|
-
/**
|
|
4
|
-
* Prop types for NavMenuDropdown
|
|
5
|
-
*/
|
|
6
|
-
interface NavMenuDropdownProps extends ComponentPropsWithoutRef<'button'> {
|
|
7
|
-
/**
|
|
8
|
-
* Dropdown items.
|
|
9
|
-
*/
|
|
10
|
-
items?: NavMenuItem[];
|
|
11
|
-
/**
|
|
12
|
-
* Dropdown label.
|
|
13
|
-
*/
|
|
14
|
-
label?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Mobile menu will be enabled when viewport is at or below this number in pixels.
|
|
17
|
-
*/
|
|
18
|
-
mobileMenuMaxWidth?: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* NavMenuDropdown UI component
|
|
22
|
-
*/
|
|
23
|
-
export declare const NavMenuDropdown: ({ items, label, mobileMenuMaxWidth, }: NavMenuDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export {};
|