@ttoss/components 2.14.20 → 2.14.21
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/Accordion/index.d.mts +157 -0
- package/dist/Accordion/index.mjs +175 -0
- package/dist/DatePicker/index.d.mts +26 -0
- package/dist/DatePicker/index.mjs +339 -0
- package/dist/Drawer/index.d.mts +17 -0
- package/dist/{esm/Drawer/index.js → Drawer/index.mjs} +21 -14
- package/dist/EnhancedTitle/{index.d.ts → index.d.mts} +57 -47
- package/dist/EnhancedTitle/index.mjs +234 -0
- package/dist/FileUploader/index.d.mts +77 -0
- package/dist/FileUploader/index.mjs +386 -0
- package/dist/InstallPwa/index.d.mts +13 -0
- package/dist/InstallPwa/index.mjs +64 -0
- package/dist/JsonEditor/index.d.mts +3 -0
- package/dist/{esm/JsonEditor/index.js → JsonEditor/index.mjs} +0 -3
- package/dist/JsonView/index.d.mts +3 -0
- package/dist/{esm/JsonView/index.js → JsonView/index.mjs} +0 -3
- package/dist/List/{index.d.ts → index.d.mts} +9 -6
- package/dist/List/index.mjs +34 -0
- package/dist/LockedOverlay/index.d.mts +162 -0
- package/dist/LockedOverlay/index.mjs +386 -0
- package/dist/Markdown/index.d.mts +16 -0
- package/dist/Markdown/index.mjs +26 -0
- package/dist/Menu/index.d.mts +16 -0
- package/dist/{esm/Menu/index.js → Menu/index.mjs} +56 -51
- package/dist/MetricCard/index.d.mts +153 -0
- package/dist/MetricCard/index.mjs +408 -0
- package/dist/Modal/index.d.mts +11 -0
- package/dist/{esm/Modal/index.js → Modal/index.mjs} +11 -12
- package/dist/NavList/index.d.mts +64 -0
- package/dist/{esm/NavList/index.js → NavList/index.mjs} +79 -73
- package/dist/NotificationCard/index.d.mts +22 -0
- package/dist/NotificationCard/index.mjs +173 -0
- package/dist/NotificationsMenu/index.d.mts +47 -0
- package/dist/NotificationsMenu/index.mjs +380 -0
- package/dist/Search/index.d.mts +18 -0
- package/dist/{esm/Search/index.js → Search/index.mjs} +11 -9
- package/dist/SpotlightCard/index.d.mts +36 -0
- package/dist/SpotlightCard/index.mjs +219 -0
- package/dist/Table/index.d.mts +17 -0
- package/dist/Table/index.mjs +64 -0
- package/dist/Tabs/index.d.mts +17 -0
- package/dist/{esm/Tabs/index.js → Tabs/index.mjs} +24 -12
- package/dist/Toast/index.d.mts +8 -0
- package/dist/Toast/index.mjs +43 -0
- package/package.json +15 -15
- package/dist/Accordion/index.d.ts +0 -148
- package/dist/DatePicker/index.d.ts +0 -20
- package/dist/Drawer/index.d.ts +0 -12
- package/dist/LockedOverlay/index.d.ts +0 -151
- package/dist/Markdown/index.d.ts +0 -11
- package/dist/Menu/index.d.ts +0 -11
- package/dist/MetricCard/index.d.ts +0 -148
- package/dist/Modal/index.d.ts +0 -10
- package/dist/NavList/index.d.ts +0 -55
- package/dist/NotificationCard/index.d.ts +0 -21
- package/dist/NotificationsMenu/index.d.ts +0 -36
- package/dist/Search/index.d.ts +0 -11
- package/dist/SpotlightCard/index.d.ts +0 -27
- package/dist/Table/index.d.ts +0 -16
- package/dist/esm/Accordion/index.js +0 -119
- package/dist/esm/DatePicker/index.js +0 -331
- package/dist/esm/EnhancedTitle/index.js +0 -190
- package/dist/esm/FileUploader/index.js +0 -401
- package/dist/esm/InstallPwa/index.js +0 -61
- package/dist/esm/List/index.js +0 -30
- package/dist/esm/LockedOverlay/index.js +0 -316
- package/dist/esm/Markdown/index.js +0 -23
- package/dist/esm/MetricCard/index.js +0 -327
- package/dist/esm/NotificationCard/index.js +0 -156
- package/dist/esm/NotificationsMenu/index.js +0 -359
- package/dist/esm/SpotlightCard/index.js +0 -212
- package/dist/esm/Table/index.js +0 -63
- package/dist/esm/Toast/index.js +0 -38
- package/dist/esm/chunk-V4MHYKRI.js +0 -7
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { IconType } from '@ttoss/react-icons';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Base metric properties shared by all metric types.
|
|
6
|
-
*/
|
|
7
|
-
interface BaseMetric {
|
|
8
|
-
/**
|
|
9
|
-
* Label displayed above the metric value.
|
|
10
|
-
*/
|
|
11
|
-
label: string;
|
|
12
|
-
/**
|
|
13
|
-
* Optional tooltip text or action handler for additional context.
|
|
14
|
-
* When a string is provided, it displays a simple tooltip.
|
|
15
|
-
* When a function is provided, it's called when the tooltip icon is clicked.
|
|
16
|
-
*/
|
|
17
|
-
tooltip?: string | (() => void);
|
|
18
|
-
/**
|
|
19
|
-
* Icon to display alongside the metric.
|
|
20
|
-
*/
|
|
21
|
-
icon?: IconType;
|
|
22
|
-
/**
|
|
23
|
-
* Optional click handler to make the metric card interactive.
|
|
24
|
-
*/
|
|
25
|
-
onClick?: () => void;
|
|
26
|
-
/**
|
|
27
|
-
* Optional help article action handler.
|
|
28
|
-
*/
|
|
29
|
-
helpArticleAction?: () => void;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Date-based metric for displaying dates like expiration or renewal.
|
|
33
|
-
*/
|
|
34
|
-
interface DateMetric extends BaseMetric {
|
|
35
|
-
type: 'date';
|
|
36
|
-
/**
|
|
37
|
-
* The date value to display.
|
|
38
|
-
*/
|
|
39
|
-
date: string;
|
|
40
|
-
/**
|
|
41
|
-
* Optional message showing remaining days.
|
|
42
|
-
*/
|
|
43
|
-
remainingDaysMessage?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Whether to show a warning indicator.
|
|
46
|
-
*/
|
|
47
|
-
isWarning?: boolean;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Percentage-based metric with progress bar.
|
|
51
|
-
*/
|
|
52
|
-
interface PercentageMetric extends BaseMetric {
|
|
53
|
-
type: 'percentage';
|
|
54
|
-
/**
|
|
55
|
-
* Current value.
|
|
56
|
-
*/
|
|
57
|
-
current: number;
|
|
58
|
-
/**
|
|
59
|
-
* Maximum value. Use null for unlimited.
|
|
60
|
-
*/
|
|
61
|
-
max: number | null;
|
|
62
|
-
/**
|
|
63
|
-
* Custom formatter for displaying values.
|
|
64
|
-
*/
|
|
65
|
-
formatValue?: (value: number) => string;
|
|
66
|
-
/**
|
|
67
|
-
* Percentage threshold at which to show an alert.
|
|
68
|
-
*/
|
|
69
|
-
showAlertThreshold?: number;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Number-based metric for displaying counts.
|
|
73
|
-
*/
|
|
74
|
-
interface NumberMetric extends BaseMetric {
|
|
75
|
-
type: 'number';
|
|
76
|
-
/**
|
|
77
|
-
* Current value.
|
|
78
|
-
*/
|
|
79
|
-
current: number;
|
|
80
|
-
/**
|
|
81
|
-
* Maximum value. Use null for unlimited.
|
|
82
|
-
*/
|
|
83
|
-
max: number | null;
|
|
84
|
-
/**
|
|
85
|
-
* Custom formatter for displaying values.
|
|
86
|
-
*/
|
|
87
|
-
formatValue?: (value: number) => string;
|
|
88
|
-
/**
|
|
89
|
-
* Optional footer text below the metric.
|
|
90
|
-
*/
|
|
91
|
-
footerText?: string;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Union type for all supported metric types.
|
|
95
|
-
*/
|
|
96
|
-
type Metric = DateMetric | PercentageMetric | NumberMetric;
|
|
97
|
-
/**
|
|
98
|
-
* Props for the MetricCard component.
|
|
99
|
-
*/
|
|
100
|
-
interface MetricCardProps {
|
|
101
|
-
/**
|
|
102
|
-
* The metric configuration to display.
|
|
103
|
-
*/
|
|
104
|
-
metric: Metric;
|
|
105
|
-
/**
|
|
106
|
-
* Whether the card is in loading state.
|
|
107
|
-
*/
|
|
108
|
-
isLoading?: boolean;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* MetricCard component displays a metric in a consistent card layout.
|
|
113
|
-
*
|
|
114
|
-
* It supports three metric types:
|
|
115
|
-
* - **date**: displays a date and optional remaining-days message
|
|
116
|
-
* - **percentage**: displays current/max values and a progress bar
|
|
117
|
-
* - **number**: displays current/max values and an optional footer text
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```tsx
|
|
121
|
-
* <MetricCard
|
|
122
|
-
* metric={{
|
|
123
|
-
* type: 'date',
|
|
124
|
-
* label: 'Renewal date',
|
|
125
|
-
* date: '31/12/2025',
|
|
126
|
-
* icon: 'fluent:calendar-24-regular',
|
|
127
|
-
* remainingDaysMessage: '10 days remaining',
|
|
128
|
-
* }}
|
|
129
|
-
* />
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```tsx
|
|
134
|
-
* <MetricCard
|
|
135
|
-
* metric={{
|
|
136
|
-
* type: 'percentage',
|
|
137
|
-
* label: 'Plan usage',
|
|
138
|
-
* current: 350,
|
|
139
|
-
* max: 1000,
|
|
140
|
-
* icon: 'fluent:gauge-24-regular',
|
|
141
|
-
* showAlertThreshold: 80,
|
|
142
|
-
* }}
|
|
143
|
-
* />
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
declare const MetricCard: ({ metric, isLoading }: MetricCardProps) => react_jsx_runtime.JSX.Element | null;
|
|
147
|
-
|
|
148
|
-
export { type BaseMetric, type DateMetric, type Metric, MetricCard, type MetricCardProps, type NumberMetric, type PercentageMetric };
|
package/dist/Modal/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import ReactModal from 'react-modal';
|
|
3
|
-
|
|
4
|
-
type ModalProps = ReactModal.Props;
|
|
5
|
-
declare const Modal: {
|
|
6
|
-
(props: ModalProps): react_jsx_runtime.JSX.Element;
|
|
7
|
-
setAppElement: typeof ReactModal.setAppElement;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { Modal, type ModalProps };
|
package/dist/NavList/index.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
type NavListItem = {
|
|
5
|
-
id?: string;
|
|
6
|
-
label: string;
|
|
7
|
-
href: string;
|
|
8
|
-
icon?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
active?: boolean;
|
|
11
|
-
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
12
|
-
group?: string;
|
|
13
|
-
divider?: boolean;
|
|
14
|
-
};
|
|
15
|
-
type NavListGroup = {
|
|
16
|
-
id?: string;
|
|
17
|
-
label?: string;
|
|
18
|
-
items: NavListItem[];
|
|
19
|
-
divider?: boolean;
|
|
20
|
-
};
|
|
21
|
-
type LinkComponentProps = {
|
|
22
|
-
href: string;
|
|
23
|
-
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
24
|
-
children: React.ReactNode;
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
};
|
|
27
|
-
type NavListProps = {
|
|
28
|
-
items?: NavListItem[];
|
|
29
|
-
groups?: NavListGroup[];
|
|
30
|
-
variant?: 'sidebar' | 'menu' | 'dropdown';
|
|
31
|
-
onItemClick?: (item: NavListItem) => void;
|
|
32
|
-
sx?: Record<string, unknown>;
|
|
33
|
-
iconSize?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Custom Link component to use for rendering links.
|
|
36
|
-
* Useful for integrating with Next.js Link, React Router Link, etc.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* // Next.js
|
|
40
|
-
* import NextLink from 'next/link';
|
|
41
|
-
* <NavList LinkComponent={NextLink} ... />
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* // React Router
|
|
45
|
-
* import { Link as RouterLink } from 'react-router-dom';
|
|
46
|
-
* <NavList LinkComponent={RouterLink} ... />
|
|
47
|
-
*/
|
|
48
|
-
LinkComponent?: React.ComponentType<LinkComponentProps>;
|
|
49
|
-
};
|
|
50
|
-
declare const NavList: {
|
|
51
|
-
({ items, groups, variant, onItemClick, sx, iconSize, LinkComponent, }: NavListProps): react_jsx_runtime.JSX.Element;
|
|
52
|
-
displayName: string;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export { type LinkComponentProps, NavList, type NavListGroup, type NavListItem, type NavListProps };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
type NotificationType = 'success' | 'error' | 'warning' | 'info' | 'neutral';
|
|
5
|
-
type NotificationAction = {
|
|
6
|
-
action?: 'open_url';
|
|
7
|
-
url?: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
};
|
|
10
|
-
type NotificationCardProps = {
|
|
11
|
-
type: NotificationType;
|
|
12
|
-
title?: string | React.ReactNode;
|
|
13
|
-
message: string | React.ReactNode;
|
|
14
|
-
actions?: NotificationAction[];
|
|
15
|
-
caption?: string | React.ReactNode;
|
|
16
|
-
tags?: string[] | React.ReactNode;
|
|
17
|
-
onClose?: () => void;
|
|
18
|
-
};
|
|
19
|
-
declare const NotificationCard: (props: NotificationCardProps) => react_jsx_runtime.JSX.Element;
|
|
20
|
-
|
|
21
|
-
export { type NotificationAction, NotificationCard, type NotificationCardProps };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
type NotificationType = 'success' | 'error' | 'warning' | 'info' | 'neutral';
|
|
5
|
-
type NotificationAction = {
|
|
6
|
-
action?: 'open_url';
|
|
7
|
-
url?: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
};
|
|
10
|
-
type NotificationCardProps = {
|
|
11
|
-
type: NotificationType;
|
|
12
|
-
title?: string | React.ReactNode;
|
|
13
|
-
message: string | React.ReactNode;
|
|
14
|
-
actions?: NotificationAction[];
|
|
15
|
-
caption?: string | React.ReactNode;
|
|
16
|
-
tags?: string[] | React.ReactNode;
|
|
17
|
-
onClose?: () => void;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
type Notification = NotificationCardProps & {
|
|
21
|
-
id: string;
|
|
22
|
-
group?: string;
|
|
23
|
-
};
|
|
24
|
-
type Props = {
|
|
25
|
-
notifications: Notification[];
|
|
26
|
-
defaultOpen?: boolean;
|
|
27
|
-
hasMore?: boolean;
|
|
28
|
-
count: number;
|
|
29
|
-
onLoadMore?: () => void;
|
|
30
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
31
|
-
onClose?: () => void;
|
|
32
|
-
onClearAll?: () => void;
|
|
33
|
-
};
|
|
34
|
-
declare const NotificationsMenu: ({ notifications, defaultOpen, hasMore, onLoadMore, onOpenChange, count, onClose, onClearAll, }: Props) => react_jsx_runtime.JSX.Element;
|
|
35
|
-
|
|
36
|
-
export { type Notification, NotificationsMenu };
|
package/dist/Search/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { InputProps } from '@ttoss/ui';
|
|
3
|
-
|
|
4
|
-
type SearchProps = Omit<InputProps, 'onChange'> & {
|
|
5
|
-
loading?: boolean;
|
|
6
|
-
debounce?: number;
|
|
7
|
-
onChange: (value?: InputProps['value']) => void;
|
|
8
|
-
};
|
|
9
|
-
declare const Search: ({ value, defaultValue, loading, onChange, ...props }: SearchProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
-
|
|
11
|
-
export { Search, type SearchProps };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { IconType } from '@ttoss/react-icons';
|
|
3
|
-
import { ButtonProps } from '@ttoss/ui';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
|
|
6
|
-
type ButtonPropType = ButtonProps | React.ReactNode;
|
|
7
|
-
type SpotlightCardProps = {
|
|
8
|
-
icon: IconType;
|
|
9
|
-
/**
|
|
10
|
-
* Title of the card. Pass a ReactNode for styling.
|
|
11
|
-
*/
|
|
12
|
-
title: string | React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Badge text. Renders as a badge/tag next to the title.
|
|
15
|
-
*/
|
|
16
|
-
badge?: string | React.ReactNode;
|
|
17
|
-
description: string;
|
|
18
|
-
firstButton?: ButtonPropType;
|
|
19
|
-
secondButton?: ButtonPropType;
|
|
20
|
-
variant?: 'accent' | 'primary';
|
|
21
|
-
};
|
|
22
|
-
declare const SpotlightCard: {
|
|
23
|
-
({ icon, title, badge, description, firstButton, secondButton, variant, }: SpotlightCardProps): react_jsx_runtime.JSX.Element;
|
|
24
|
-
displayName: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export { SpotlightCard, type SpotlightCardProps };
|
package/dist/Table/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { BoxProps } from '@ttoss/ui';
|
|
3
|
-
export { createCell, createColumnHelper, flexRender, getCoreRowModel, useReactTable } from '@tanstack/react-table';
|
|
4
|
-
|
|
5
|
-
declare const Table: {
|
|
6
|
-
(props: BoxProps): react_jsx_runtime.JSX.Element;
|
|
7
|
-
Head: (props: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
8
|
-
Body: (props: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
-
Row: (props: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
-
Cell: (props: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
-
Header: (props: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
-
Caption: (props: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
13
|
-
Footer: (props: BoxProps) => react_jsx_runtime.JSX.Element;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { Table };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { __name } from "../chunk-V4MHYKRI.js";
|
|
3
|
-
|
|
4
|
-
// src/components/Accordion/Accordion.tsx
|
|
5
|
-
import { Box, Button } from "@ttoss/ui";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
var Accordion = /* @__PURE__ */__name(({
|
|
8
|
-
items,
|
|
9
|
-
multiple = false,
|
|
10
|
-
defaultExpanded,
|
|
11
|
-
onAccordionChange,
|
|
12
|
-
renderItem,
|
|
13
|
-
sx,
|
|
14
|
-
...boxProps
|
|
15
|
-
}) => {
|
|
16
|
-
const [expandedIndices, setExpandedIndices] = React.useState(() => {
|
|
17
|
-
if (defaultExpanded === void 0) {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
return Array.isArray(defaultExpanded) ? defaultExpanded : [defaultExpanded];
|
|
21
|
-
});
|
|
22
|
-
const toggleItem = React.useCallback(index => {
|
|
23
|
-
setExpandedIndices(prev => {
|
|
24
|
-
const isExpanded = prev.includes(index);
|
|
25
|
-
let newExpanded;
|
|
26
|
-
if (isExpanded) {
|
|
27
|
-
newExpanded = prev.filter(i => {
|
|
28
|
-
return i !== index;
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
newExpanded = multiple ? [...prev, index] : [index];
|
|
32
|
-
}
|
|
33
|
-
onAccordionChange?.(newExpanded);
|
|
34
|
-
return newExpanded;
|
|
35
|
-
});
|
|
36
|
-
}, [multiple, onAccordionChange]);
|
|
37
|
-
return /* @__PURE__ */React.createElement(Box, {
|
|
38
|
-
sx: {
|
|
39
|
-
display: "flex",
|
|
40
|
-
flexDirection: "column",
|
|
41
|
-
gap: 2,
|
|
42
|
-
...sx
|
|
43
|
-
},
|
|
44
|
-
...boxProps
|
|
45
|
-
}, items.map((item, index) => {
|
|
46
|
-
const isExpanded = expandedIndices.includes(index);
|
|
47
|
-
const itemId = item.id || `accordion-item-${index}`;
|
|
48
|
-
const headingId = `${itemId}-heading`;
|
|
49
|
-
const panelId = `${itemId}-panel`;
|
|
50
|
-
if (renderItem) {
|
|
51
|
-
return /* @__PURE__ */React.createElement(React.Fragment, {
|
|
52
|
-
key: itemId
|
|
53
|
-
}, renderItem({
|
|
54
|
-
item,
|
|
55
|
-
index,
|
|
56
|
-
isExpanded,
|
|
57
|
-
toggle: /* @__PURE__ */__name(() => {
|
|
58
|
-
return toggleItem(index);
|
|
59
|
-
}, "toggle"),
|
|
60
|
-
ids: {
|
|
61
|
-
itemId,
|
|
62
|
-
headingId,
|
|
63
|
-
panelId
|
|
64
|
-
}
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
return /* @__PURE__ */React.createElement(Box, {
|
|
68
|
-
key: itemId,
|
|
69
|
-
sx: {
|
|
70
|
-
border: "sm",
|
|
71
|
-
borderColor: "display.border.muted.default",
|
|
72
|
-
borderRadius: "md",
|
|
73
|
-
overflow: "hidden"
|
|
74
|
-
}
|
|
75
|
-
}, /* @__PURE__ */React.createElement(Button, {
|
|
76
|
-
id: headingId,
|
|
77
|
-
type: "button",
|
|
78
|
-
disabled: item.disabled,
|
|
79
|
-
onClick: /* @__PURE__ */__name(() => {
|
|
80
|
-
toggleItem(index);
|
|
81
|
-
}, "onClick"),
|
|
82
|
-
"aria-expanded": isExpanded,
|
|
83
|
-
"aria-controls": panelId,
|
|
84
|
-
rightIcon: isExpanded ? "chevron-up" : "chevron-down",
|
|
85
|
-
sx: {
|
|
86
|
-
width: "100%",
|
|
87
|
-
justifyContent: "space-between",
|
|
88
|
-
backgroundColor: isExpanded ? "display.background.muted.default" : "display.background.primary.default",
|
|
89
|
-
color: item.disabled ? "display.text.muted.default" : "display.text.primary.default",
|
|
90
|
-
fontWeight: 500,
|
|
91
|
-
border: "none",
|
|
92
|
-
borderRadius: 0,
|
|
93
|
-
transition: "background-color 0.2s ease",
|
|
94
|
-
"&:hover:not(:disabled)": {
|
|
95
|
-
backgroundColor: "display.background.muted.default"
|
|
96
|
-
},
|
|
97
|
-
"&:focus": {
|
|
98
|
-
outline: "none",
|
|
99
|
-
boxShadow: /* @__PURE__ */__name(theme => {
|
|
100
|
-
return `inset 0 0 0 1px ${
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
-
theme.colors?.input?.border?.accent?.default || "currentColor"}`;
|
|
103
|
-
}, "boxShadow")
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, item.title), isExpanded && /* @__PURE__ */React.createElement(Box, {
|
|
107
|
-
id: panelId,
|
|
108
|
-
role: "region",
|
|
109
|
-
"aria-labelledby": headingId,
|
|
110
|
-
sx: {
|
|
111
|
-
padding: 4,
|
|
112
|
-
borderTop: "sm",
|
|
113
|
-
borderColor: "display.border.muted.default",
|
|
114
|
-
backgroundColor: "display.background.primary.default"
|
|
115
|
-
}
|
|
116
|
-
}, item.content));
|
|
117
|
-
}));
|
|
118
|
-
}, "Accordion");
|
|
119
|
-
export { Accordion };
|