@ttoss/components 2.5.0 → 2.6.0

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.
@@ -0,0 +1,235 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { Icon } from "../chunk-2R7AUPJL.js";
3
+ import { __name } from "../chunk-V4MHYKRI.js";
4
+
5
+ // src/components/NavList/NavList.tsx
6
+ import { Divider, Flex, Link, Text } from "@ttoss/ui";
7
+ import * as React from "react";
8
+ var getVariantStyles = /* @__PURE__ */__name(variant => {
9
+ switch (variant) {
10
+ case "sidebar":
11
+ return {
12
+ container: {
13
+ flexDirection: "column",
14
+ gap: "6",
15
+ width: "full"
16
+ },
17
+ item: {
18
+ padding: "4",
19
+ borderRadius: "none",
20
+ fontSize: "md",
21
+ transition: "background-color 0.15s ease",
22
+ "&:hover": {
23
+ backgroundColor: "navigation.background.muted.default",
24
+ textDecoration: "none"
25
+ }
26
+ },
27
+ activeItem: {
28
+ backgroundColor: "navigation.background.primary.default",
29
+ borderLeft: "4px solid",
30
+ borderColor: "navigation.border.primary.default",
31
+ paddingLeft: "calc(1rem - 4px)"
32
+ },
33
+ icon: {
34
+ size: 20
35
+ },
36
+ groupLabel: {
37
+ fontSize: "xs",
38
+ fontWeight: "bold",
39
+ color: "navigation.text.muted.default",
40
+ textTransform: "uppercase",
41
+ marginBottom: "2",
42
+ marginTop: "4"
43
+ }
44
+ };
45
+ case "menu":
46
+ return {
47
+ container: {
48
+ flexDirection: "column",
49
+ gap: "3",
50
+ width: "full"
51
+ },
52
+ item: {
53
+ backgroundColor: "display.background.secondary.default",
54
+ borderRadius: "md",
55
+ padding: "3",
56
+ fontSize: "md",
57
+ transition: "all 0.2s ease",
58
+ "&:hover": {
59
+ backgroundColor: "navigation.background.muted.default",
60
+ transform: "translateX(4px)",
61
+ textDecoration: "none"
62
+ }
63
+ },
64
+ activeItem: {
65
+ backgroundColor: "navigation.background.muted.default",
66
+ fontWeight: "bold"
67
+ },
68
+ icon: {
69
+ size: 18
70
+ },
71
+ groupLabel: {
72
+ fontSize: "sm",
73
+ fontWeight: "semibold",
74
+ color: "display.text.secondary.default",
75
+ marginBottom: "2",
76
+ marginTop: "3"
77
+ }
78
+ };
79
+ case "dropdown":
80
+ return {
81
+ container: {
82
+ flexDirection: "column",
83
+ gap: "1",
84
+ width: "full"
85
+ },
86
+ item: {
87
+ padding: "2",
88
+ fontSize: "sm",
89
+ borderBottom: "sm",
90
+ borderColor: "display.border.muted.default",
91
+ transition: "background-color 0.1s ease",
92
+ "&:hover": {
93
+ backgroundColor: "display.background.secondary.default",
94
+ textDecoration: "none"
95
+ }
96
+ },
97
+ activeItem: {
98
+ backgroundColor: "display.background.secondary.default",
99
+ fontWeight: "semibold"
100
+ },
101
+ icon: {
102
+ size: 16
103
+ },
104
+ groupLabel: {
105
+ fontSize: "xs",
106
+ fontWeight: "medium",
107
+ color: "display.text.secondary.default",
108
+ marginBottom: "1",
109
+ marginTop: "2",
110
+ paddingX: "2"
111
+ }
112
+ };
113
+ default:
114
+ return getVariantStyles("menu");
115
+ }
116
+ }, "getVariantStyles");
117
+ var NavListItemComponent = /* @__PURE__ */__name(({
118
+ item,
119
+ onItemClick,
120
+ variantStyles,
121
+ iconSize,
122
+ LinkComponent = Link,
123
+ showDivider = false
124
+ }) => {
125
+ const handleClick = /* @__PURE__ */__name(event => {
126
+ if (item.disabled) {
127
+ event.preventDefault();
128
+ return;
129
+ }
130
+ item.onClick?.(event);
131
+ onItemClick?.(item);
132
+ }, "handleClick");
133
+ const itemStyles = {
134
+ ...variantStyles.item,
135
+ ...(item.active ? variantStyles.activeItem : {}),
136
+ ...(item.disabled ? {
137
+ opacity: 0.5,
138
+ cursor: "not-allowed",
139
+ pointerEvents: "none"
140
+ } : {})
141
+ };
142
+ const linkProps = {
143
+ href: item.href,
144
+ onClick: handleClick,
145
+ sx: itemStyles,
146
+ "aria-disabled": item.disabled,
147
+ "aria-current": item.active ? "page" : void 0,
148
+ quiet: true
149
+ };
150
+ return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(LinkComponent, linkProps, /* @__PURE__ */React.createElement(Flex, {
151
+ sx: {
152
+ alignItems: "center",
153
+ gap: "2",
154
+ color: "navigation.text.primary.default"
155
+ }
156
+ }, item.icon && /* @__PURE__ */React.createElement(Icon, {
157
+ icon: item.icon,
158
+ width: iconSize ?? variantStyles.icon.size,
159
+ height: iconSize ?? variantStyles.icon.size
160
+ }), /* @__PURE__ */React.createElement(Text, null, item.label))), showDivider && /* @__PURE__ */React.createElement(Divider, {
161
+ sx: {
162
+ marginY: "2"
163
+ }
164
+ }));
165
+ }, "NavListItemComponent");
166
+ var NavList = /* @__PURE__ */__name(({
167
+ items = [],
168
+ groups = [],
169
+ variant = "menu",
170
+ onItemClick,
171
+ sx,
172
+ iconSize,
173
+ LinkComponent
174
+ }) => {
175
+ const variantStyles = getVariantStyles(variant);
176
+ const processedGroups = React.useMemo(() => {
177
+ if (groups.length > 0) {
178
+ return groups;
179
+ }
180
+ if (items.length > 0) {
181
+ const groupedItems = items.reduce((acc, item) => {
182
+ const groupKey = item.group || "__ungrouped__";
183
+ if (!acc[groupKey]) {
184
+ acc[groupKey] = [];
185
+ }
186
+ acc[groupKey].push(item);
187
+ return acc;
188
+ }, {});
189
+ return Object.entries(groupedItems).map(([key, groupItems]) => {
190
+ return {
191
+ id: key,
192
+ label: key === "__ungrouped__" ? void 0 : key,
193
+ items: groupItems,
194
+ divider: false
195
+ };
196
+ });
197
+ }
198
+ return [];
199
+ }, [items, groups]);
200
+ return /* @__PURE__ */React.createElement(Flex, {
201
+ as: "nav",
202
+ sx: {
203
+ ...variantStyles.container,
204
+ ...sx
205
+ },
206
+ role: "navigation"
207
+ }, processedGroups.map((group, groupIndex) => {
208
+ return /* @__PURE__ */React.createElement(React.Fragment, {
209
+ key: group.id || `group-${groupIndex}`
210
+ }, group.label && /* @__PURE__ */React.createElement(Text, {
211
+ sx: variantStyles.groupLabel,
212
+ as: "div",
213
+ role: "heading"
214
+ }, group.label), /* @__PURE__ */React.createElement(Flex, {
215
+ sx: {
216
+ flexDirection: "column",
217
+ gap: variantStyles.container.gap
218
+ }
219
+ }, group.items.map((item, itemIndex) => {
220
+ const isLastItem = itemIndex === group.items.length - 1;
221
+ const showDivider = item.divider || isLastItem && group.divider;
222
+ return /* @__PURE__ */React.createElement(NavListItemComponent, {
223
+ key: item.id || `${group.id}-item-${itemIndex}`,
224
+ item,
225
+ onItemClick,
226
+ variantStyles,
227
+ iconSize,
228
+ LinkComponent,
229
+ showDivider
230
+ });
231
+ })));
232
+ }));
233
+ }, "NavList");
234
+ NavList.displayName = "NavList";
235
+ export { NavList };
@@ -1,5 +1,5 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { NotificationCard } from "../chunk-GOISZ4AR.js";
3
- import "../chunk-AZTAV4VC.js";
2
+ import { NotificationCard } from "../chunk-4GBVRL7E.js";
3
+ import "../chunk-2R7AUPJL.js";
4
4
  import "../chunk-V4MHYKRI.js";
5
5
  export { NotificationCard };
@@ -1,6 +1,6 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { NotificationCard } from "../chunk-GOISZ4AR.js";
3
- import { Icon } from "../chunk-AZTAV4VC.js";
2
+ import { NotificationCard } from "../chunk-4GBVRL7E.js";
3
+ import { Icon } from "../chunk-2R7AUPJL.js";
4
4
  import { __name } from "../chunk-V4MHYKRI.js";
5
5
 
6
6
  // src/components/NotificationsMenu/NotificationsMenu.tsx
@@ -1,7 +1,7 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
2
  import { __name } from "./chunk-V4MHYKRI.js";
3
3
 
4
- // ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.1.1/node_modules/@iconify-icon/react/dist/iconify.mjs
4
+ // ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.0/node_modules/@iconify-icon/react/dist/iconify.mjs
5
5
  import React from "react";
6
6
 
7
7
  // ../../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
@@ -2130,7 +2130,7 @@ var {
2130
2130
  _api
2131
2131
  } = IconifyIconComponent;
2132
2132
 
2133
- // ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.1.1/node_modules/@iconify-icon/react/dist/iconify.mjs
2133
+ // ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.0/node_modules/@iconify-icon/react/dist/iconify.mjs
2134
2134
  var Icon = React.forwardRef((props, ref) => {
2135
2135
  const newProps = {
2136
2136
  ...props,
@@ -1,5 +1,5 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { Icon } from "./chunk-AZTAV4VC.js";
2
+ import { Icon } from "./chunk-2R7AUPJL.js";
3
3
  import { __name } from "./chunk-V4MHYKRI.js";
4
4
 
5
5
  // src/components/NotificationCard/NotificationCard.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "React components for ttoss ecosystem.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -16,67 +16,71 @@
16
16
  "exports": {
17
17
  "./Accordion": {
18
18
  "types": "./dist/Accordion/index.d.ts",
19
- "import": "./dist/esm/Accordion/index.js"
19
+ "default": "./dist/esm/Accordion/index.js"
20
20
  },
21
21
  "./Drawer": {
22
22
  "types": "./dist/Drawer/index.d.ts",
23
- "import": "./dist/esm/Drawer/index.js"
23
+ "default": "./dist/esm/Drawer/index.js"
24
24
  },
25
25
  "./InstallPwa": {
26
26
  "types": "./dist/InstallPwa/index.d.ts",
27
- "import": "./dist/esm/InstallPwa/index.js"
27
+ "default": "./dist/esm/InstallPwa/index.js"
28
28
  },
29
29
  "./FileUploader": {
30
30
  "types": "./dist/FileUploader/index.d.ts",
31
- "import": "./dist/esm/FileUploader/index.js"
31
+ "default": "./dist/esm/FileUploader/index.js"
32
32
  },
33
33
  "./JsonEditor": {
34
34
  "types": "./dist/JsonEditor/index.d.ts",
35
- "import": "./dist/esm/JsonEditor/index.js"
35
+ "default": "./dist/esm/JsonEditor/index.js"
36
36
  },
37
37
  "./JsonView": {
38
38
  "types": "./dist/JsonView/index.d.ts",
39
- "import": "./dist/esm/JsonView/index.js"
39
+ "default": "./dist/esm/JsonView/index.js"
40
40
  },
41
41
  "./List": {
42
42
  "types": "./dist/List/index.d.ts",
43
- "import": "./dist/esm/List/index.js"
43
+ "default": "./dist/esm/List/index.js"
44
44
  },
45
45
  "./Markdown": {
46
46
  "types": "./dist/Markdown/index.d.ts",
47
- "import": "./dist/esm/Markdown/index.js"
47
+ "default": "./dist/esm/Markdown/index.js"
48
48
  },
49
49
  "./Menu": {
50
50
  "types": "./dist/Menu/index.d.ts",
51
- "import": "./dist/esm/Menu/index.js"
51
+ "default": "./dist/esm/Menu/index.js"
52
52
  },
53
53
  "./Modal": {
54
54
  "types": "./dist/Modal/index.d.ts",
55
- "import": "./dist/esm/Modal/index.js"
55
+ "default": "./dist/esm/Modal/index.js"
56
+ },
57
+ "./NavList": {
58
+ "types": "./dist/NavList/index.d.ts",
59
+ "default": "./dist/esm/NavList/index.js"
56
60
  },
57
61
  "./NotificationCard": {
58
62
  "types": "./dist/NotificationCard/index.d.ts",
59
- "import": "./dist/esm/NotificationCard/index.js"
63
+ "default": "./dist/esm/NotificationCard/index.js"
60
64
  },
61
65
  "./NotificationsMenu": {
62
66
  "types": "./dist/NotificationsMenu/index.d.ts",
63
- "import": "./dist/esm/NotificationsMenu/index.js"
67
+ "default": "./dist/esm/NotificationsMenu/index.js"
64
68
  },
65
69
  "./Search": {
66
70
  "types": "./dist/Search/index.d.ts",
67
- "import": "./dist/esm/Search/index.js"
71
+ "default": "./dist/esm/Search/index.js"
68
72
  },
69
73
  "./Table": {
70
74
  "types": "./dist/Table/index.d.ts",
71
- "import": "./dist/esm/Table/index.js"
75
+ "default": "./dist/esm/Table/index.js"
72
76
  },
73
77
  "./Tabs": {
74
78
  "types": "./dist/Tabs/index.d.ts",
75
- "import": "./dist/esm/Tabs/index.js"
79
+ "default": "./dist/esm/Tabs/index.js"
76
80
  },
77
81
  "./Toast": {
78
82
  "types": "./dist/Toast/index.d.ts",
79
- "import": "./dist/esm/Toast/index.js"
83
+ "default": "./dist/esm/Toast/index.js"
80
84
  }
81
85
  },
82
86
  "files": [
@@ -101,24 +105,24 @@
101
105
  },
102
106
  "peerDependencies": {
103
107
  "react": ">=16.8.0",
104
- "@ttoss/react-hooks": "^2.1.4",
105
- "@ttoss/ui": "^5.10.2",
106
- "@ttoss/react-i18n": "^2.0.18"
108
+ "@ttoss/react-hooks": "^2.1.5",
109
+ "@ttoss/react-i18n": "^2.0.19",
110
+ "@ttoss/ui": "^5.10.4"
107
111
  },
108
112
  "devDependencies": {
109
113
  "@types/jest": "^30.0.0",
110
- "@types/react": "^19.1.8",
111
- "jest": "^30.0.4",
112
- "react": "^19.1.0",
114
+ "@types/react": "^19.2.2",
115
+ "jest": "^30.2.0",
116
+ "react": "^19.2.0",
113
117
  "tsup": "^8.5.0",
114
118
  "tsx": "^4.19.2",
115
- "@ttoss/config": "^1.35.8",
116
- "@ttoss/i18n-cli": "^0.7.34",
117
- "@ttoss/react-hooks": "^2.1.4",
118
- "@ttoss/react-icons": "^0.4.17",
119
- "@ttoss/ui": "^5.10.2",
120
- "@ttoss/test-utils": "^2.1.28",
121
- "@ttoss/react-i18n": "^2.0.18"
119
+ "@ttoss/config": "^1.35.9",
120
+ "@ttoss/react-hooks": "^2.1.5",
121
+ "@ttoss/i18n-cli": "^0.7.35",
122
+ "@ttoss/react-i18n": "^2.0.19",
123
+ "@ttoss/react-icons": "^0.5.0",
124
+ "@ttoss/ui": "^5.10.4",
125
+ "@ttoss/test-utils": "^3.0.1"
122
126
  },
123
127
  "keywords": [
124
128
  "React",