ab-nextjs-components 0.1.13 โ†’ 0.1.14

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 (53) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +30 -0
  3. package/ab-app-bar/index.tsx +39 -10
  4. package/ab-app-bar/styles.module.css +43 -4
  5. package/ab-bottom-drawer/index.tsx +71 -0
  6. package/ab-bottom-drawer/styles.module.css +66 -0
  7. package/ab-breadcrumbs/index.tsx +92 -0
  8. package/ab-breadcrumbs/styles.module.css +54 -0
  9. package/ab-button/helpers.ts +6 -1
  10. package/ab-button/index.tsx +8 -2
  11. package/ab-button/styles.module.css +39 -0
  12. package/ab-card/styles.module.css +1 -1
  13. package/ab-carousel/styles.module.css +1 -1
  14. package/ab-chip/index.tsx +16 -4
  15. package/ab-chip/styles.module.css +12 -1
  16. package/ab-confirm-drawer/index.tsx +97 -0
  17. package/ab-confirm-drawer/styles.module.css +41 -0
  18. package/ab-drawer/index.tsx +307 -0
  19. package/ab-drawer/styles.module.css +127 -0
  20. package/ab-drawer/use-ab-drawer.ts +89 -0
  21. package/ab-drawer-list/index.tsx +118 -0
  22. package/ab-drawer-list/styles.module.css +65 -0
  23. package/ab-flow-diagram/styles.module.css +2 -2
  24. package/ab-icon/builtin.ts +4 -0
  25. package/ab-icon-button/index.tsx +12 -1
  26. package/ab-icon-button/styles.module.css +1 -1
  27. package/ab-install-snippet/index.tsx +51 -29
  28. package/ab-install-snippet/styles.module.css +34 -2
  29. package/ab-kbd/styles.module.css +1 -1
  30. package/ab-list/index.tsx +107 -0
  31. package/ab-list/styles.module.css +82 -0
  32. package/ab-locale-switcher/index.tsx +42 -10
  33. package/ab-locale-switcher/styles.module.css +4 -4
  34. package/ab-navbar/styles.module.css +20 -2
  35. package/ab-navbar/view.tsx +7 -4
  36. package/ab-package-card/index.tsx +49 -2
  37. package/ab-package-card/styles.module.css +40 -0
  38. package/ab-search-trigger/index.tsx +17 -2
  39. package/ab-search-trigger/styles.module.css +27 -1
  40. package/ab-sidebar/index.tsx +5 -2
  41. package/ab-sidebar/styles.module.css +48 -5
  42. package/ab-sidebar/view.tsx +14 -4
  43. package/ab-theme-toggle/index.tsx +21 -6
  44. package/ab-theme-toggle/styles.module.css +18 -3
  45. package/ab-toc/index.tsx +9 -2
  46. package/ab-toc/styles.module.css +20 -8
  47. package/ab-version-switcher/index.tsx +143 -0
  48. package/ab-version-switcher/styles.module.css +76 -0
  49. package/index.ts +27 -0
  50. package/package.json +18 -3
  51. package/server/ab-button/index.tsx +6 -2
  52. package/server/ab-button/styles.module.css +39 -0
  53. package/types/index.d.ts +19 -0
package/index.ts CHANGED
@@ -130,6 +130,14 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
130
130
  { name: 'AbPackageCard', file: 'ab-package-card/index.tsx', kind: 'server', status: 'Done' },
131
131
  // ๐Ÿ†• 0.1.13 docs shell (AbToc) โ€” server-safe, no hooks
132
132
  { name: 'AbToc', file: 'ab-toc/index.tsx', kind: 'server', status: 'Done' },
133
+ // ๐Ÿ†• 0.1.14 (G53): AbDrawer + presets
134
+ { name: 'AbDrawer', file: 'ab-drawer/index.tsx', kind: 'client', status: 'Done' },
135
+ { name: 'AbDrawerList', file: 'ab-drawer-list/index.tsx', kind: 'client', status: 'Done' },
136
+ { name: 'AbConfirmDrawer', file: 'ab-confirm-drawer/index.tsx', kind: 'client', status: 'Done' },
137
+ { name: 'AbBottomDrawer', file: 'ab-bottom-drawer/index.tsx', kind: 'client', status: 'Done' },
138
+ { name: 'AbVersionSwitcher', file: 'ab-version-switcher/index.tsx', kind: 'client', status: 'Done' },
139
+ { name: 'AbBreadcrumbs', file: 'ab-breadcrumbs/index.tsx', kind: 'server', status: 'Done' },
140
+ { name: 'AbList', file: 'ab-list/index.tsx', kind: 'server', status: 'Done' },
133
141
  ]
134
142
 
135
143
  const abComponents = { supportedComponents }
@@ -169,6 +177,25 @@ export { default as AbSidebar } from './ab-sidebar/index.tsx'
169
177
  // ๐Ÿ“‘ 0.1.13 (Joseph): AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
170
178
  export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from './ab-toc/index.tsx'
171
179
  export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
180
+ // ๐Ÿ—„๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
181
+ export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION } from './ab-drawer/index.tsx'
182
+ export type { AbDrawerProps, AbDrawerSide, AbDrawerScope, UseAbDrawer } from './ab-drawer/index.tsx'
183
+ export { default as AbDrawerList } from './ab-drawer-list/index.tsx'
184
+ export type { AbDrawerListItem, AbDrawerListProps } from './ab-drawer-list/index.tsx'
185
+ export { default as AbConfirmDrawer } from './ab-confirm-drawer/index.tsx'
186
+ export type { AbConfirmDrawerProps } from './ab-confirm-drawer/index.tsx'
187
+ // ๐Ÿ“ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
188
+ export { default as AbBottomDrawer } from './ab-bottom-drawer/index.tsx'
189
+ export type { AbBottomDrawerProps } from './ab-bottom-drawer/index.tsx'
190
+ // ๐Ÿท๏ธ 0.1.14 (P9): AbVersionSwitcher
191
+ export { default as AbVersionSwitcher } from './ab-version-switcher/index.tsx'
192
+ export type { AbVersionOption, AbVersionSwitcherProps } from './ab-version-switcher/index.tsx'
193
+ // ๐Ÿž 0.1.14 (P2): AbBreadcrumbs
194
+ export { default as AbBreadcrumbs } from './ab-breadcrumbs/index.tsx'
195
+ export type { AbBreadcrumbItem, AbBreadcrumbsProps } from './ab-breadcrumbs/index.tsx'
196
+ // ๐Ÿ“‹ 0.1.14 (P13): AbList + AbListItem
197
+ export { default as AbList, AbListItem } from './ab-list/index.tsx'
198
+ export type { AbListProps, AbListItemProps } from './ab-list/index.tsx'
172
199
  export { default as AbText } from './ab-text/index.tsx'
173
200
  export { default as AbTestHello } from './ab-test-hello/index.tsx'
174
201
  export { default as AbKeyFeature } from './ab-key-feature/index.tsx'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-nextjs-components",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "๐Ÿš€ A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications ๐Ÿ˜Ž.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -43,7 +43,7 @@
43
43
  "ab-nextjs-animations": "^0.2.4",
44
44
  "ab-nextjs-hooks": "^0.1.7",
45
45
  "ab-nextjs-icons": "^0.2.4",
46
- "ab-nextjs-theme": "^0.3.4",
46
+ "ab-nextjs-theme": "^0.3.5",
47
47
  "clsx": "^2",
48
48
  "next": "^16.3.4",
49
49
  "react": "^19",
@@ -56,7 +56,7 @@
56
56
  "ab-nextjs-animations": "^0.2.4",
57
57
  "ab-nextjs-hooks": "^0.1.7",
58
58
  "ab-nextjs-icons": "^0.2.4",
59
- "ab-nextjs-theme": "^0.3.4",
59
+ "ab-nextjs-theme": "^0.3.5",
60
60
  "clsx": "^2.1.1",
61
61
  "esbuild": "^0.28.2",
62
62
  "eslint": "^9.39.0",
@@ -114,6 +114,13 @@
114
114
  "ab-splash",
115
115
  "ab-linear-progress",
116
116
  "ab-carousel",
117
+ "ab-drawer",
118
+ "ab-drawer-list",
119
+ "ab-confirm-drawer",
120
+ "ab-bottom-drawer",
121
+ "ab-version-switcher",
122
+ "ab-breadcrumbs",
123
+ "ab-list",
117
124
  "ab-flow-diagram",
118
125
  "ab-locale-switcher",
119
126
  "ab-install-snippet",
@@ -153,6 +160,14 @@
153
160
  "./ab-locale-switcher": "./ab-locale-switcher/index.tsx",
154
161
  "./ab-flow-diagram": "./ab-flow-diagram/index.tsx",
155
162
  "./ab-flow-diagram/helpers": "./ab-flow-diagram/helpers.ts",
163
+ "./ab-drawer": "./ab-drawer/index.tsx",
164
+ "./ab-drawer/use-ab-drawer": "./ab-drawer/use-ab-drawer.ts",
165
+ "./ab-drawer-list": "./ab-drawer-list/index.tsx",
166
+ "./ab-confirm-drawer": "./ab-confirm-drawer/index.tsx",
167
+ "./ab-bottom-drawer": "./ab-bottom-drawer/index.tsx",
168
+ "./ab-version-switcher": "./ab-version-switcher/index.tsx",
169
+ "./ab-breadcrumbs": "./ab-breadcrumbs/index.tsx",
170
+ "./ab-list": "./ab-list/index.tsx",
156
171
  "./ab-splash/gate": "./ab-splash/gate.ts",
157
172
  "./ab-splash/csp": {
158
173
  "types": "./ab-splash/csp.d.ts",
@@ -48,7 +48,7 @@ import {
48
48
  getAbButtonSrReason,
49
49
  type AbButtonBadgeTone,
50
50
  type AbButtonColor,
51
- type AbButtonType,
51
+ type AbButtonType, type AbButtonShape, type AbButtonSize,
52
52
  } from '../../ab-button/helpers';
53
53
 
54
54
  // ๐Ÿ“ฆ shared types
@@ -63,6 +63,8 @@ export interface AbButtonProps {
63
63
  hidden?: boolean; // ๐Ÿ™ˆ
64
64
  style?: CSSProperties; // ๐ŸŽจ
65
65
  rounded?: boolean; // ๐Ÿ’Š
66
+ shape?: AbButtonShape; // ๐Ÿ”ท 0.1.14 (P16)
67
+ size?: AbButtonSize; // ๐Ÿ“ 0.1.14 (P16)
66
68
  raised?: boolean; // ๐Ÿ”๏ธ
67
69
  shrinks?: boolean; // ๐Ÿค
68
70
  expands?: boolean; // ๐Ÿ”
@@ -84,7 +86,7 @@ export interface AbButtonProps {
84
86
 
85
87
  /** ๐Ÿ–ฅ๏ธ Server AbButton: no onClick. Use href for links or htmlType for form submit. No-JS safe. */
86
88
  const AbButton = ({
87
- id, type = 'contained', htmlType = 'button', className, hidden = false, style, rounded = true, raised = false,
89
+ id, type = 'contained', htmlType = 'button', className, hidden = false, style, rounded = true, shape, size, raised = false,
88
90
  shrinks = false, expands = false, withIcon = false, disabled = false, iconPosition = 'left', label, icon,
89
91
  color = 'primary', href, children, startIcon, endIcon, badge, badgeTone = 'neutral', disabledReason, focusableWhenDisabled,
90
92
  }: AbButtonProps): ReactElement => {
@@ -106,6 +108,8 @@ const AbButton = ({
106
108
  'data-iconpos': iconPosition, // โ†”๏ธ
107
109
  'data-color': color, // ๐ŸŽจ
108
110
  'data-disabled-mode': mode, // ๐Ÿšฆ
111
+ 'data-shape': shape, // ๐Ÿ”ท P16
112
+ 'data-size': size, // ๐Ÿ“ P16
109
113
  } as const;
110
114
 
111
115
  // ๐Ÿ”ฃ legacy icon (decorative)
@@ -150,3 +150,42 @@
150
150
  white-space: nowrap; /* ๐Ÿšซ */
151
151
  border: 0; /* ๐Ÿงน */
152
152
  }
153
+
154
+ /* ===== ๐Ÿ”ท 0.1.14 (P16, Home fidelity spec ยง4 CTAs): shape="rounded" ยท size="md" ยท type="secondary" =====
155
+ * Doubled class (0,3,0+) beats the theme's `button[data-type="filled"]` (0,1,1) and its :hover (0,3,1 โ†’ we use 0,5,0). */
156
+ .abButton.abButton[data-shape="rounded"] {
157
+ gap: 6px; /* ๐Ÿงฑ icon โ†” label */
158
+ border-radius: var(--ab-radius-button, 10px); /* ๐Ÿ”ท */
159
+ padding: 0 var(--ab-button-padding-inline, 16px); /* ๐Ÿ“ฆ */
160
+ font-size: 14px; font-weight: 650; line-height: 1; white-space: nowrap; /* ๐Ÿ”ค */
161
+ overflow: visible; /* ๐ŸŒ— the primary shadow must show */
162
+ }
163
+ .abButton.abButton[data-size="md"] { height: var(--ab-button-height, 40px); box-sizing: border-box; } /* ๐Ÿ“ */
164
+ .abButton.abButton[data-shape="rounded"] .abButtonSlot { width: 18px; height: 18px; } /* ๐Ÿ–ผ๏ธ 18px icons */
165
+ .abButton.abButton[data-shape="rounded"] .abButtonSlot svg { width: 100%; height: 100%; }
166
+ /* ๐Ÿฅ‰ primary (filled) */
167
+ .abButton.abButton[data-shape="rounded"][data-type="filled"] {
168
+ background: var(--ab-color-btn, #8b6340); color: var(--ab-color-btn-text, #fff); /* ๐ŸŽจ AA (theme 0.3.5) */
169
+ border: 0; box-shadow: var(--ab-shadow-button, 0 1px 0 rgb(255 255 255 / 0.2) inset, 0 4px 12px rgb(139 99 64 / 0.25)); /* โœจ */
170
+ }
171
+ .abButton.abButton[data-shape="rounded"][data-type="filled"]:not(:disabled, [aria-disabled="true"]):hover {
172
+ background: color-mix(in srgb, var(--ab-color-btn, #8b6340) 90%, #000); /* ๐Ÿ–ฑ๏ธ */
173
+ }
174
+ /* โšช secondary */
175
+ .abButton.abButton[data-type="secondary"] {
176
+ border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); background: var(--ab-color-card, #fff); color: var(--ab-color-text, #211a16); /* ๐ŸŽจ */
177
+ box-sizing: border-box;
178
+ }
179
+ .abButton.abButton[data-type="secondary"]:not(:disabled, [aria-disabled="true"]):hover {
180
+ background: linear-gradient(var(--ab-color-hover, rgb(166 124 82 / 0.08)), var(--ab-color-hover, rgb(166 124 82 / 0.08))), var(--ab-color-card, #fff); /* ๐Ÿ–ฑ๏ธ tint over the card */
181
+ }
182
+ .abButton.abButton[data-shape="rounded"]:not(:disabled, [aria-disabled="true"]):active { transform: translateY(1px); } /* ๐Ÿ‘‡ */
183
+ .abButton.abButton[data-shape="rounded"]:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โ™ฟ */
184
+ /* ๐Ÿ“ฑ touch widths: 44px, 14.5px (mock .M .btn; the app sets flex: 1) */
185
+ @media (max-width: 767px) {
186
+ .abButton.abButton[data-size="md"] { height: var(--ab-button-height-touch, 44px); }
187
+ .abButton.abButton[data-shape="rounded"][data-size="md"] { font-size: 14.5px; }
188
+ }
189
+ @media (prefers-reduced-motion: reduce) {
190
+ .abButton.abButton[data-shape="rounded"]:active { transform: none; } /* โ™ฟ no nudge */
191
+ }
package/types/index.d.ts CHANGED
@@ -78,6 +78,25 @@ export { default as AbSidebar } from '../ab-sidebar/index.tsx';
78
78
  // ๐Ÿ“‘ 0.1.13 (Joseph): 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
  export type { AbTocItem, AbTocProps } from '../ab-toc/index.tsx';
81
+ // ๐Ÿ—„๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
82
+ export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION } from '../ab-drawer/index.tsx';
83
+ export type { AbDrawerProps, AbDrawerSide, AbDrawerScope, UseAbDrawer } from '../ab-drawer/index.tsx';
84
+ export { default as AbDrawerList } from '../ab-drawer-list/index.tsx';
85
+ export type { AbDrawerListItem, AbDrawerListProps } from '../ab-drawer-list/index.tsx';
86
+ export { default as AbConfirmDrawer } from '../ab-confirm-drawer/index.tsx';
87
+ export type { AbConfirmDrawerProps } from '../ab-confirm-drawer/index.tsx';
88
+ // ๐Ÿ“ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
89
+ export { default as AbBottomDrawer } from '../ab-bottom-drawer/index.tsx';
90
+ export type { AbBottomDrawerProps } from '../ab-bottom-drawer/index.tsx';
91
+ // ๐Ÿท๏ธ 0.1.14 (P9): AbVersionSwitcher
92
+ export { default as AbVersionSwitcher } from '../ab-version-switcher/index.tsx';
93
+ export type { AbVersionOption, AbVersionSwitcherProps } from '../ab-version-switcher/index.tsx';
94
+ // ๐Ÿž 0.1.14 (P2): AbBreadcrumbs
95
+ export { default as AbBreadcrumbs } from '../ab-breadcrumbs/index.tsx';
96
+ export type { AbBreadcrumbItem, AbBreadcrumbsProps } from '../ab-breadcrumbs/index.tsx';
97
+ // ๐Ÿ“‹ 0.1.14 (P13): AbList + AbListItem
98
+ export { default as AbList, AbListItem } from '../ab-list/index.tsx';
99
+ export type { AbListProps, AbListItemProps } from '../ab-list/index.tsx';
81
100
  export { default as AbText } from '../ab-text/index.tsx';
82
101
  export { default as AbTestHello } from '../ab-test-hello/index.tsx';
83
102
  export { default as AbKeyFeature } from '../ab-key-feature/index.tsx';