@ttoss/components 2.14.30 → 2.14.31

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.
Files changed (3) hide show
  1. package/README.md +15 -5
  2. package/dist/index.mjs +27 -19
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -209,14 +209,24 @@ import { Markdown } from '@ttoss/components';
209
209
 
210
210
  ### Menu
211
211
 
212
- Dropdown menus with customizable triggers. [Docs](https://storybook.ttoss.dev/?path=/docs/components-menu--docs)
212
+ Floating dropdown panel with a configurable trigger icon. Use `NavList` as children for navigation items. [Docs](https://storybook.ttoss.dev/?path=/docs/components-menu--docs)
213
213
 
214
214
  ```tsx
215
- import { Menu } from '@ttoss/components';
215
+ import { Menu, NavList } from '@ttoss/components';
216
+
217
+ <Menu>
218
+ <NavList
219
+ variant="menu"
220
+ items={[
221
+ { href: '/dashboard', label: 'Dashboard', icon: 'mdi:home-outline' },
222
+ { href: '/settings', label: 'Settings', icon: 'mdi:cog-outline' },
223
+ ]}
224
+ />
225
+ </Menu>;
216
226
 
217
- <Menu trigger={<Button>Open Menu</Button>}>
218
- <Menu.Item onClick={() => {}}>Action 1</Menu.Item>
219
- <Menu.Item onClick={() => {}}>Action 2</Menu.Item>
227
+ // Custom trigger icon
228
+ <Menu menuIcon="mdi:dots-vertical">
229
+ <NavList variant="menu" items={items} />
220
230
  </Menu>;
221
231
  ```
222
232
 
package/dist/index.mjs CHANGED
@@ -1764,7 +1764,6 @@ var Menu = ({
1764
1764
  ...stylePos
1765
1765
  },
1766
1766
  children: /* @__PURE__ */jsx(Box, {
1767
- as: "nav",
1768
1767
  children
1769
1768
  })
1770
1769
  }) : null;
@@ -2269,13 +2268,15 @@ var getVariantStyles = variant => {
2269
2268
  width: "full"
2270
2269
  },
2271
2270
  item: {
2272
- backgroundColor: "transparent",
2271
+ backgroundColor: "navigation.background.muted.default",
2272
+ color: "navigation.text.primary.default",
2273
2273
  padding: "3",
2274
2274
  borderRadius: "none",
2275
2275
  fontSize: "md",
2276
- transition: "background-color 0.15s ease",
2276
+ transition: "background-color 0.15s ease, color 0.15s ease",
2277
2277
  "&:hover": {
2278
2278
  backgroundColor: "navigation.background.muted.hover",
2279
+ color: "navigation.text.primary.hover",
2279
2280
  textDecoration: "none"
2280
2281
  }
2281
2282
  },
@@ -2305,13 +2306,15 @@ var getVariantStyles = variant => {
2305
2306
  width: "full"
2306
2307
  },
2307
2308
  item: {
2308
- backgroundColor: "transparent",
2309
+ backgroundColor: "navigation.background.muted.default",
2310
+ color: "navigation.text.primary.default",
2309
2311
  borderRadius: "md",
2310
2312
  padding: "2",
2311
2313
  fontSize: "md",
2312
2314
  transition: "all 0.2s ease",
2313
2315
  "&:hover": {
2314
2316
  backgroundColor: "navigation.background.muted.hover",
2317
+ color: "navigation.text.primary.hover",
2315
2318
  transform: "translateX(4px)",
2316
2319
  textDecoration: "none"
2317
2320
  }
@@ -2339,14 +2342,16 @@ var getVariantStyles = variant => {
2339
2342
  width: "full"
2340
2343
  },
2341
2344
  item: {
2342
- backgroundColor: "transparent",
2345
+ backgroundColor: "navigation.background.muted.default",
2346
+ color: "navigation.text.primary.default",
2343
2347
  padding: "2",
2344
2348
  fontSize: "sm",
2345
2349
  borderBottom: "sm",
2346
2350
  borderColor: "display.border.muted.default",
2347
- transition: "background-color 0.1s ease",
2351
+ transition: "background-color 0.1s ease, color 0.1s ease",
2348
2352
  "&:hover": {
2349
2353
  backgroundColor: "navigation.background.muted.hover",
2354
+ color: "navigation.text.primary.hover",
2350
2355
  textDecoration: "none"
2351
2356
  }
2352
2357
  },
@@ -2370,6 +2375,17 @@ var getVariantStyles = variant => {
2370
2375
  return getVariantStyles("menu");
2371
2376
  }
2372
2377
  };
2378
+ var resolveItemStyles = (item, variantStyles) => {
2379
+ return {
2380
+ ...variantStyles.item,
2381
+ ...(item.active ? variantStyles.activeItem : {}),
2382
+ ...(item.disabled ? {
2383
+ opacity: .5,
2384
+ cursor: "not-allowed",
2385
+ pointerEvents: "none"
2386
+ } : {})
2387
+ };
2388
+ };
2373
2389
  var NavListItemComponent = ({
2374
2390
  item,
2375
2391
  onItemClick,
@@ -2386,21 +2402,13 @@ var NavListItemComponent = ({
2386
2402
  item.onClick?.(event);
2387
2403
  onItemClick?.(item);
2388
2404
  };
2389
- const itemStyles = {
2390
- ...variantStyles.item,
2391
- ...(item.active ? variantStyles.activeItem : {}),
2392
- ...(item.disabled ? {
2393
- opacity: .5,
2394
- cursor: "not-allowed",
2395
- pointerEvents: "none"
2396
- } : {})
2397
- };
2405
+ const itemStyles = resolveItemStyles(item, variantStyles);
2406
+ const ariaCurrent = item.active ? "page" : void 0;
2398
2407
  const isDefaultLink = LinkComponent === Link;
2399
2408
  const linkContent = /* @__PURE__ */jsxs(Flex, {
2400
2409
  sx: {
2401
2410
  alignItems: "center",
2402
- gap: "2",
2403
- color: "navigation.text.primary.default"
2411
+ gap: "2"
2404
2412
  },
2405
2413
  children: [item.icon && /* @__PURE__ */jsx(Icon, {
2406
2414
  icon: item.icon,
@@ -2416,7 +2424,7 @@ var NavListItemComponent = ({
2416
2424
  onClick: handleClick,
2417
2425
  sx: itemStyles,
2418
2426
  "aria-disabled": item.disabled,
2419
- "aria-current": item.active ? "page" : void 0,
2427
+ "aria-current": ariaCurrent,
2420
2428
  quiet: true,
2421
2429
  children: linkContent
2422
2430
  }) : /* @__PURE__ */jsx(Link, {
@@ -2425,7 +2433,7 @@ var NavListItemComponent = ({
2425
2433
  onClick: handleClick,
2426
2434
  sx: itemStyles,
2427
2435
  "aria-disabled": item.disabled,
2428
- "aria-current": item.active ? "page" : void 0,
2436
+ "aria-current": ariaCurrent,
2429
2437
  quiet: true,
2430
2438
  children: linkContent
2431
2439
  }), showDivider && /* @__PURE__ */jsx(Divider, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "2.14.30",
3
+ "version": "2.14.31",
4
4
  "description": "React components for ttoss ecosystem.",
5
5
  "keywords": [
6
6
  "React",
@@ -54,18 +54,18 @@
54
54
  "tsdown": "^0.22.2",
55
55
  "tsx": "^4.21.0",
56
56
  "@ttoss/config": "^1.37.17",
57
- "@ttoss/react-hooks": "^2.3.20",
58
- "@ttoss/react-icons": "^0.7.21",
59
57
  "@ttoss/i18n-cli": "^0.8.17",
60
58
  "@ttoss/react-i18n": "^2.2.21",
61
- "@ttoss/test-utils": "^4.2.18",
62
- "@ttoss/ui": "^6.9.27"
59
+ "@ttoss/react-hooks": "^2.3.20",
60
+ "@ttoss/react-icons": "^0.7.21",
61
+ "@ttoss/ui": "^6.9.27",
62
+ "@ttoss/test-utils": "^4.2.18"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "react": ">=16.8.0",
66
66
  "@ttoss/react-hooks": "^2.3.20",
67
- "@ttoss/react-i18n": "^2.2.21",
68
67
  "@ttoss/react-icons": "^0.7.21",
68
+ "@ttoss/react-i18n": "^2.2.21",
69
69
  "@ttoss/ui": "^6.9.27"
70
70
  },
71
71
  "publishConfig": {