ab-nextjs-components 0.4.2 → 0.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +81 -17
  2. package/README.md +16 -2
  3. package/ab-app-bar/index.tsx +5 -5
  4. package/ab-app-bar/styles.module.css +5 -5
  5. package/ab-bottom-drawer/index.tsx +3 -3
  6. package/ab-bottom-drawer/styles.module.css +2 -2
  7. package/ab-bottom-drawer/use-ab-swipe-down.ts +1 -1
  8. package/ab-breadcrumbs/index.tsx +1 -1
  9. package/ab-breadcrumbs/styles.module.css +5 -5
  10. package/ab-button/index.tsx +1 -1
  11. package/ab-button/styles.module.css +5 -5
  12. package/ab-callout/index.tsx +1 -1
  13. package/ab-callout/styles.module.css +1 -1
  14. package/ab-carousel/helpers.ts +1 -1
  15. package/ab-carousel/index.tsx +4 -4
  16. package/ab-carousel/styles.module.css +2 -2
  17. package/ab-chip/styles.module.css +1 -1
  18. package/ab-code-block/focus.tsx +63 -0
  19. package/ab-code-block/index.tsx +55 -28
  20. package/ab-code-block/styles.module.css +4 -3
  21. package/ab-content-tabs/index.tsx +25 -3
  22. package/ab-demo-box/index.tsx +45 -7
  23. package/ab-demo-box/styles.module.css +19 -7
  24. package/ab-demo-code/index.tsx +38 -34
  25. package/ab-demo-code/styles.module.css +3 -41
  26. package/ab-doc-pager/index.tsx +1 -1
  27. package/ab-drawer/gestures.ts +1 -1
  28. package/ab-drawer/index.tsx +12 -4
  29. package/ab-drawer/kit.module.css +13 -13
  30. package/ab-drawer/styles.module.css +2 -2
  31. package/ab-drawer/use-ab-edge-swipe.ts +2 -2
  32. package/ab-flow-diagram/helpers.ts +2 -2
  33. package/ab-flow-diagram/index.tsx +2 -2
  34. package/ab-flow-diagram/styles.module.css +3 -3
  35. package/ab-icon/builtin.ts +4 -0
  36. package/ab-icon/helpers.ts +1 -1
  37. package/ab-icon/index.tsx +3 -3
  38. package/ab-icon/registrar.tsx +1 -1
  39. package/ab-icon-button/index.tsx +1 -1
  40. package/ab-install-snippet/styles.module.css +1 -1
  41. package/ab-link/index.tsx +2 -2
  42. package/ab-link/locale.ts +1 -1
  43. package/ab-list/styles.module.css +1 -1
  44. package/ab-locale-switcher/index.tsx +6 -6
  45. package/ab-locale-switcher/styles.module.css +5 -5
  46. package/ab-mobile-header/index.tsx +6 -6
  47. package/ab-nav-drawer/index.tsx +11 -6
  48. package/ab-navbar/index.tsx +1 -1
  49. package/ab-navbar/styles.module.css +1 -1
  50. package/ab-navbar/view.tsx +1 -1
  51. package/ab-package-card/index.tsx +3 -3
  52. package/ab-package-card/previews.tsx +1 -1
  53. package/ab-package-card/styles.module.css +2 -2
  54. package/ab-playground-scene/i18n.module.css +1 -1
  55. package/ab-playground-scene/icons.tsx +1 -1
  56. package/ab-playground-scene/index.tsx +4 -4
  57. package/ab-playground-scene/labels.ts +3 -3
  58. package/ab-playground-scene/scenes.tsx +4 -4
  59. package/ab-playground-scene/styles.module.css +6 -6
  60. package/ab-playground-scene/upgraded.tsx +3 -3
  61. package/ab-playground-scene/welcome.tsx +1 -1
  62. package/ab-preview-code/index.tsx +115 -0
  63. package/ab-preview-code/stage.tsx +153 -0
  64. package/ab-preview-code/styles.module.css +43 -0
  65. package/ab-progress-chips/index.tsx +1 -1
  66. package/ab-search-drawer/index.tsx +4 -4
  67. package/ab-search-trigger/index.tsx +5 -5
  68. package/ab-search-trigger/styles.module.css +3 -3
  69. package/ab-settings-drawer/index.tsx +2 -2
  70. package/ab-sidebar/active.ts +105 -0
  71. package/ab-sidebar/index.tsx +10 -6
  72. package/ab-sidebar/profile-button.tsx +2 -2
  73. package/ab-sidebar/styles.module.css +4 -4
  74. package/ab-sidebar/view.tsx +16 -8
  75. package/ab-theme-mode/index.tsx +3 -3
  76. package/ab-theme-toggle/index.tsx +6 -6
  77. package/ab-theme-toggle/styles.module.css +2 -2
  78. package/ab-toc/index.tsx +3 -3
  79. package/ab-toc/promo.tsx +2 -2
  80. package/ab-toc/styles.module.css +1 -1
  81. package/ab-toc-drawer/index.tsx +1 -1
  82. package/ab-version-switcher/index.tsx +2 -2
  83. package/css/dialog.css +1 -1
  84. package/index.ts +29 -18
  85. package/package.json +3 -1
  86. package/server/ab-button/index.tsx +1 -1
  87. package/server/ab-icon/index.tsx +2 -2
  88. package/server/ab-sidebar/index.tsx +3 -2
  89. package/types/index.d.ts +8 -7
@@ -41,7 +41,7 @@ import type { ReactElement } from 'react';
41
41
  // 🔣 server AbIcon (full AbIcons map; no JS shipped)
42
42
  import AbIcon from '../ab-icon';
43
43
  // 🖼️ shared view (same markup as the client twin)
44
- import { AbSidebarView, isAbSidebarActive, type AbSidebarBaseProps } from '../../ab-sidebar/view';
44
+ import { AbSidebarView, createAbSidebarActive, toAbSidebarSections, type AbSidebarBaseProps } from '../../ab-sidebar/view';
45
45
  // 🌍 0.1.13: strip `/fr` from activeHref when `locales` is given (pure helper, server-safe)
46
46
  import { stripAbLocalePrefix } from '../../ab-link/locale';
47
47
 
@@ -54,7 +54,8 @@ export type AbSidebarProps = AbSidebarBaseProps;
54
54
  /** 🧭 AbSidebar (server, G40): same markup as the client twin; active state from `activeHref` / legacy `page`. */
55
55
  const AbSidebar = (props: AbSidebarProps): ReactElement => {
56
56
  const { page, activeHref } = props;
57
- const active = (href: string, value?: string) => (page ? page === value : isAbSidebarActive(href, activeHref && stripAbLocalePrefix(activeHref, props.locales))); // 🎯
57
+ const isOn = createAbSidebarActive(toAbSidebarSections(props.sections, props.links), activeHref && stripAbLocalePrefix(activeHref, props.locales), props.activeMatch); // 🥇 0.5.0: deepest match by default
58
+ const active = (href: string, value?: string) => (page ? page === value : isOn(href)); // 🎯
58
59
  return <AbSidebarView props={props} Icon={AbIcon} active={active} />;
59
60
  };
60
61
 
package/types/index.d.ts CHANGED
@@ -75,7 +75,7 @@ export { default as AbBrand } from '../ab-brand/index.tsx';
75
75
  export { default as AbName } from '../ab-name/index.tsx';
76
76
  export { default as AbNavbar } from '../ab-navbar/index.tsx';
77
77
  export { default as AbSidebar } from '../ab-sidebar/index.tsx';
78
- // 📑 0.1.13 (Joseph): AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
78
+ // 📑 0.1.13: AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
79
79
  export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from '../ab-toc/index.tsx';
80
80
  // 🆕 0.2.1: the aside "New" card
81
81
  export { default as AbTocPromo } from '../ab-toc/promo.tsx';
@@ -97,14 +97,14 @@ export type { AbConfirmDrawerProps } from '../ab-confirm-drawer/index.tsx';
97
97
  // 📱 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
98
98
  export { default as AbBottomDrawer } from '../ab-bottom-drawer/index.tsx';
99
99
  export type { AbBottomDrawerProps } from '../ab-bottom-drawer/index.tsx';
100
- // 👇 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
100
+ // 👇 0.2.3 (Welcome 0.2.21): swipe a bottom sheet down to close
101
101
  export { useAbSwipeDown, isAbScrolledInside } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
102
102
  export type { UseAbSwipeDownOptions } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
103
103
  // 🆕 0.2.0 drawers v2: AbMobileHeader
104
104
  export { default as AbMobileHeader } from '../ab-mobile-header/index.tsx';
105
105
  export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from '../ab-mobile-header/index.tsx';
106
106
  export { AB_MOBILE_HEADER_THEME_CYCLE } from '../ab-mobile-header/index.tsx'; // 🌗 0.2.3
107
- // 🌗 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
107
+ // 🌗 0.2.3 (Welcome 0.2.21): one shared theme mode for every toggle
108
108
  export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from '../ab-theme-mode/index.tsx';
109
109
  export type { AbThemeModeProviderProps, AbThemeModeContextValue } from '../ab-theme-mode/index.tsx';
110
110
  // 🆕 0.2.0 drawers v2: AbSearchDrawer
@@ -138,18 +138,19 @@ export { default as AbProduct } from '../ab-product/index.tsx';
138
138
  export { default as AbProductItem } from '../ab-product-item/index.tsx';
139
139
  export { default as AbDemoBox } from '../ab-demo-box/index.tsx';
140
140
  export { default as AbDemoCode } from '../ab-demo-code/index.tsx';
141
+ export { default as AbPreviewCode } from '../ab-preview-code/index.tsx';
141
142
  export { default as AbPolygon } from '../server/ab-polygon/index.tsx';
142
- // 💡 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
143
+ // 💡 0.3.4 (0.2.24 MDX docs): AbCallout
143
144
  export { default as AbCallout, AB_CALLOUT_ICONS } from '../ab-callout/index.tsx';
144
145
  export type { AbCalloutProps, AbCalloutVariant } from '../ab-callout/index.tsx';
145
- // 💻 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
146
+ // 💻 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
146
147
  export { default as AbCodeBlock } from '../ab-code-block/index.tsx';
147
148
  export { default as AbCodeBlockCopy } from '../ab-code-block/copy.tsx';
148
149
  export type { AbCodeBlockCopyProps } from '../ab-code-block/copy.tsx';
149
150
  export type { AbCodeBlockProps } from '../ab-code-block/index.tsx';
150
- // 🗂️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
151
+ // 🗂️ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
151
152
  export { default as AbContentTabs, AbContentTab } from '../ab-content-tabs/index.tsx';
152
153
  export type { AbContentTabsProps, AbContentTabProps } from '../ab-content-tabs/index.tsx';
153
- // ⏮️⏭️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
154
+ // ⏮️⏭️ 0.3.4 (0.2.24 MDX docs): AbDocPager
154
155
  export { default as AbDocPager } from '../ab-doc-pager/index.tsx';
155
156
  export type { AbDocPagerProps, AbDocPagerLink } from '../ab-doc-pager/index.tsx';