@xola/ui-kit 3.6.0 → 3.7.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 (126) hide show
  1. package/README.md +98 -19
  2. package/build/components/Alert.js +29 -0
  3. package/build/components/Animation/FadeIn.js +40 -0
  4. package/build/components/Animation/SlideDown.js +25 -0
  5. package/build/components/Avatar.js +28 -0
  6. package/build/components/Badge.js +51 -0
  7. package/build/components/BottomSheet.js +114 -0
  8. package/build/components/Breadcrumb.js +33 -0
  9. package/build/components/Breakdown.js +81 -0
  10. package/build/components/Buttons/Button.js +89 -0
  11. package/build/components/Buttons/ButtonGroup.js +58 -0
  12. package/build/components/Buttons/SecondaryButton.js +31 -0
  13. package/build/components/Buttons/SubmitButton.js +89 -0
  14. package/build/components/Buttons/ToggleButton.js +33 -0
  15. package/build/components/Charts/BaseChartOptions.js +95 -0
  16. package/build/components/Charts/HistogramOptions.js +69 -0
  17. package/build/components/Charts/PieOptions.js +55 -0
  18. package/build/components/Counter.js +20 -0
  19. package/build/components/DatePicker/DatePicker.helpers.js +33 -0
  20. package/build/components/DatePicker/DatePicker.js +214 -0
  21. package/build/components/DatePicker/DatePickerPopover.js +90 -0
  22. package/build/components/DatePicker/Day.js +43 -0
  23. package/build/components/DatePicker/LocalizedDayPicker.js +17 -0
  24. package/build/components/DatePicker/MonthGrid.js +39 -0
  25. package/build/components/DatePicker/MonthPicker.js +33 -0
  26. package/build/components/DatePicker/MonthSelector.js +46 -0
  27. package/build/components/DatePicker/MonthYearSelector.js +23 -0
  28. package/build/components/DatePicker/NavbarElement.js +34 -0
  29. package/build/components/DatePicker/RangeDatePicker.js +111 -0
  30. package/build/components/DatePicker/RelativeDateRange.js +290 -0
  31. package/build/components/DatePicker/UpcomingDatePicker.js +31 -0
  32. package/build/components/Dot/Dot.js +29 -0
  33. package/build/components/Dot/DotProgress.js +15 -0
  34. package/build/components/Drawer.js +134 -0
  35. package/build/components/Forms/BaseInput.js +57 -0
  36. package/build/components/Forms/Checkbox.js +37 -0
  37. package/build/components/Forms/Checkbox.module.css.js +7 -0
  38. package/build/components/Forms/ComboBox.js +41 -0
  39. package/build/components/Forms/FormGroup.js +10 -0
  40. package/build/components/Forms/InlineValuePopover.js +41 -0
  41. package/build/components/Forms/Input.js +17 -0
  42. package/build/components/Forms/Label.js +23 -0
  43. package/build/components/Forms/RangeSlider.js +58 -0
  44. package/build/components/Forms/Select.js +7 -0
  45. package/build/components/Forms/Switch.js +70 -0
  46. package/build/components/Forms/Textarea.js +42 -0
  47. package/build/components/Forms/ValuePopoverText.js +7 -0
  48. package/build/components/GooglePlacesAutocomplete.js +112 -0
  49. package/build/components/HeaderToolbar.js +41 -0
  50. package/build/components/ImageUpload.js +83 -0
  51. package/build/components/Key.js +33 -0
  52. package/build/components/Logo.js +17 -0
  53. package/build/components/Modal.js +141 -0
  54. package/build/components/Popover/Popover.js +53 -0
  55. package/build/components/Popover/Popover.module.css.js +7 -0
  56. package/build/components/Popover/PopoverList.js +57 -0
  57. package/build/components/Popover/PopoverScroll.module.css.js +4 -0
  58. package/build/components/Provider.js +16 -0
  59. package/build/components/Screens/Login.js +115 -0
  60. package/build/components/Search.js +144 -0
  61. package/build/components/Sidebar/Sidebar.Account.js +49 -0
  62. package/build/components/Sidebar/Sidebar.Button.js +47 -0
  63. package/build/components/Sidebar/Sidebar.Footer.js +10 -0
  64. package/build/components/Sidebar/Sidebar.Heading.js +13 -0
  65. package/build/components/Sidebar/Sidebar.Link.js +92 -0
  66. package/build/components/Sidebar/Sidebar.Menu.js +54 -0
  67. package/build/components/Sidebar/Sidebar.Menu.module.css.js +7 -0
  68. package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
  69. package/build/components/Sidebar/Sidebar.js +212 -0
  70. package/build/components/Sidebar/SidebarContext.js +15 -0
  71. package/build/components/Sidebar/SidebarScroll.module.css.js +4 -0
  72. package/build/components/Sidebar/sidebarWidth.js +41 -0
  73. package/build/components/Sidebar/useSidebarWidthState.js +115 -0
  74. package/build/components/Skeleton.js +28 -0
  75. package/build/components/Skeleton.module.css.js +7 -0
  76. package/build/components/Spinner.js +35 -0
  77. package/build/components/Table.js +107 -0
  78. package/build/components/Tabs/Tabs.Panel.js +11 -0
  79. package/build/components/Tabs/Tabs.Tab.js +42 -0
  80. package/build/components/Tabs/Tabs.js +28 -0
  81. package/build/components/Tag.js +41 -0
  82. package/build/components/Tooltip.js +22 -0
  83. package/build/components/Utilities/Currency.js +56 -0
  84. package/build/components/Utilities/Number.js +17 -0
  85. package/build/components/Utilities/Phone.js +25 -0
  86. package/build/helpers/browser.js +9 -0
  87. package/build/helpers/children.js +6 -0
  88. package/build/helpers/classnames.js +8 -0
  89. package/build/helpers/environment.js +10 -0
  90. package/build/helpers/flash.js +86 -0
  91. package/build/hooks/useIsClient.js +10 -0
  92. package/build/hooks/useIsMobile.js +8 -0
  93. package/build/hooks/useViewportHeight.js +9 -0
  94. package/build/icons/src/AnnounceIcon.js +12 -0
  95. package/build/icons/src/BellIcon.js +26 -0
  96. package/build/icons/src/CalendarIcon.js +15 -0
  97. package/build/icons/src/CheckIcon.js +7 -0
  98. package/build/icons/src/ChevronDownIcon.js +7 -0
  99. package/build/icons/src/ChevronLeftIcon.js +7 -0
  100. package/build/icons/src/ChevronRightIcon.js +7 -0
  101. package/build/icons/src/CircleNotch.js +5 -0
  102. package/build/icons/src/CloseIcon.js +13 -0
  103. package/build/icons/src/DownArrowIcon.js +15 -0
  104. package/build/icons/src/ImageIcon.js +26 -0
  105. package/build/icons/src/SearchIcon.js +15 -0
  106. package/build/icons/src/TrashIcon.js +19 -0
  107. package/build/icons/src/WarningDiamondIcon.js +26 -0
  108. package/build/icons/src/helpers/icon.js +7 -0
  109. package/build/icons/src/helpers/iconSizes.js +13 -0
  110. package/build/icons/src/images/XolaLogoSimple.js +13 -0
  111. package/build/index.js +155 -0
  112. package/build/style.css +1 -1
  113. package/build/theme.js +374 -0
  114. package/build/utils/avatar.js +8 -0
  115. package/build/utils/currency.js +11 -0
  116. package/build/utils/date.js +46 -0
  117. package/build/utils/numbers.js +19 -0
  118. package/build/utils/phone.js +15 -0
  119. package/build/utils/userLocale.js +6 -0
  120. package/index.d.ts +132 -79
  121. package/package.json +76 -45
  122. package/postcss.config.js +1 -1
  123. package/skills/README.md +27 -0
  124. package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
  125. package/tailwind.config.js +9 -5
  126. package/build/ui-kit.es.js +0 -16771
package/index.d.ts CHANGED
@@ -1,55 +1,144 @@
1
+ import type { TippyProps } from "@tippyjs/react";
2
+ import type * as React from "react";
3
+
4
+ // The only three widths a sidebar can render at. Shared by the `variant` prop, `onVariantChange`,
5
+ // and `useSidebar()`'s return value so the three sites can't drift apart.
6
+ export type SidebarVariant = "icons" | "text" | "iconsAndText";
7
+
8
+ export interface SidebarNotificationSection {
9
+ count?: number;
10
+ content?: React.ReactNode;
11
+ title?: string;
12
+ onClose?: () => void;
13
+ }
14
+
15
+ export interface SidebarProps {
16
+ logo?: React.ReactElement;
17
+ children: React.ReactNode;
18
+ className?: string;
19
+ footer?: React.ReactElement;
20
+ isFixed?: boolean;
21
+ isStickyHeader?: boolean;
22
+ isStickyFooter?: boolean;
23
+ onLogoClick?: () => void;
24
+ isLeftDrawerOpen?: boolean;
25
+ isRightDrawerOpen?: boolean;
26
+ handleDrawerStateChange?: (side: "left" | "right") => void;
27
+ onSidebarResize?: (width: number) => void;
28
+ variant?: SidebarVariant;
29
+ minWidth?: number;
30
+ maxWidth?: number;
31
+ isCollapsed?: boolean;
32
+ onCollapsedChange?: (isCollapsed: boolean) => void;
33
+ onVariantChange?: (variant: SidebarVariant) => void;
34
+ autoCollapseBelow?: number | null;
35
+ storageKey?: string | null;
36
+ cssVariableTarget?: HTMLElement | null;
37
+ notifications?: {
38
+ announcements?: SidebarNotificationSection & { hide?: boolean };
39
+ notices?: SidebarNotificationSection;
40
+ };
41
+ }
42
+
43
+ export interface SidebarAccountProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
44
+ name: string;
45
+ description?: string;
46
+ image?: React.ReactNode;
47
+ icon?: React.ReactNode;
48
+ /**
49
+ * @deprecated No-op. The sidebar's variant (see `useSidebar`) now drives this presentation.
50
+ * Kept only so consumers built against the pre-variant API still compile. Warns in development.
51
+ */
52
+ isResponsive?: boolean;
53
+ }
54
+
55
+ export interface SidebarButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
56
+ /** "solid" gives a filled, card-like button with a larger icon; defaults to "plain". */
57
+ appearance?: "plain" | "solid";
58
+ icon: React.ComponentType<{ className?: string }>;
59
+ label: string;
60
+ }
61
+
62
+ export interface SidebarFooterProps extends React.HTMLAttributes<HTMLDivElement> {
63
+ children: React.ReactNode;
64
+ }
65
+
66
+ // A bare thunk is a real call shape: consumers pass `() => Icon` for an already-built element,
67
+ // ignoring `className`. The runtime gate is `PropTypes.func`, which permits both.
68
+ export type SidebarLinkIcon = React.ComponentType<{ className?: string }> | (() => React.ReactElement | null);
69
+
70
+ export interface SidebarLinkProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
71
+ align?: "center" | "left" | "right";
72
+ isActive?: boolean;
73
+ /** Renders the trailing chevron that promises a `Sidebar.Menu` flyout. */
74
+ hasSubmenu?: boolean;
75
+ icon?: SidebarLinkIcon;
76
+ // A consumer-supplied trailing node. Rendered in every variant, unlike the default chevron.
77
+ info?: React.ReactNode;
78
+ children: React.ReactNode;
79
+ isSubMenuItem?: boolean;
80
+ classNames?: { button?: string; text?: string };
81
+ }
82
+
83
+ export interface SidebarSeparatorProps {
84
+ className?: string;
85
+ }
86
+
87
+ // Extends Tippy's own props, not just `{ children, content }`: Sidebar.Menu.jsx spreads
88
+ // `...rest` onto the underlying Tippy, so x2-seller's `visible`/`onMount`/`onHide` pass-through
89
+ // props need to type-check too.
90
+ export interface SidebarMenuProps extends Omit<TippyProps, "children" | "content"> {
91
+ children: React.ReactNode;
92
+ content: React.ReactNode;
93
+ }
94
+
95
+ export interface SidebarHeadingProps {
96
+ icon: React.ComponentType<{ className?: string }>;
97
+ label: string;
98
+ className?: string;
99
+ }
100
+
101
+ export declare const SIDEBAR_WIDTH: { MIN: number; MAX: number };
102
+ export declare const SIDEBAR_VARIANT: { ICONS: "icons"; TEXT: "text"; ICONS_AND_TEXT: "iconsAndText" };
103
+ export declare const SIDEBAR_VARIANT_WIDTH: { TEXT: number; ICONS_AND_TEXT: number };
104
+
105
+ export declare function useSidebar(): {
106
+ variant: SidebarVariant;
107
+ showIcons: boolean;
108
+ showText: boolean;
109
+ isCollapsed: boolean;
110
+ };
111
+
112
+ export declare function useSidebarWidth(): number;
113
+
114
+ export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLDivElement>> & {
115
+ Account: React.ComponentType<SidebarAccountProps>;
116
+ Button: React.ComponentType<SidebarButtonProps>;
117
+ Footer: React.ComponentType<SidebarFooterProps>;
118
+ Link: React.ComponentType<SidebarLinkProps>;
119
+ Separator: React.ComponentType<SidebarSeparatorProps>;
120
+ Menu: React.ComponentType<SidebarMenuProps>;
121
+ Heading: React.ComponentType<SidebarHeadingProps>;
122
+ };
123
+
1
124
  // This is just to make the auto-import work.
2
125
  // Next step is to add types for the props.
3
126
  export {
4
127
  Alert,
5
128
  almostZero,
6
- AppStoreBadge,
7
129
  Avatar,
8
130
  Badge,
9
- BalloonIcon,
10
- BankCheckIcon,
11
- BarGraphIcon,
12
- BaseInput,
13
- BellIcon,
14
- BookIcon,
15
- BookmarkIcon,
131
+ BaseChartOptions,
16
132
  BottomSheet,
17
- BoxIcon,
18
- BugIcon,
19
133
  Breadcrumb,
20
134
  Breakdown,
21
135
  Button,
22
136
  ButtonGroup,
23
- CakeIcon,
24
- CalendarDayIcon,
25
- CalendarIcon,
26
- CalendarListIcon,
27
- CalendarMonthIcon,
28
- CalendarWeekIcon,
29
- CapacityIcon,
30
- CardAltIcon,
31
- CardIcon,
32
- CartIcon,
33
- CashIcon,
34
137
  Checkbox,
35
- CircleNotch,
36
- CirclePauseIcon,
37
- CirclePlusIcon,
38
- CircleSubtractIcon,
39
- ClipboardIcon,
40
- ClockAltIcon,
41
- ClockIcon,
42
- ClockManualIcon,
43
- CloseCircleIcon,
44
- CloseIcon,
45
- CollapseIcon,
46
- CollectionIcon,
47
138
  ComboBox,
48
139
  compactNumber,
49
140
  Counter,
50
141
  Currency,
51
- CustomizeColumnsIcon,
52
- DashboardIcon,
53
142
  dateFromObjectId,
54
143
  DatePicker,
55
144
  DatePickerPopover,
@@ -59,93 +148,57 @@ export {
59
148
  FadeIn,
60
149
  flash,
61
150
  formatDate,
151
+ formatPhoneNumber,
62
152
  formatTime,
63
153
  FormGroup,
64
154
  getChildByType,
65
155
  getChildrenByType,
66
156
  getInitials,
67
157
  getSymbol,
158
+ GooglePlacesAutocomplete,
68
159
  HeaderToolbar,
160
+ HistogramOptions,
69
161
  ImageUpload,
70
162
  InlineValuePopover,
71
163
  Input,
164
+ isIosBrowser,
72
165
  isOSX,
73
166
  isZeroDecimal,
74
- ItemsIcon,
75
167
  Key,
76
168
  Label,
77
169
  Login,
78
170
  Logo,
79
171
  Modal,
80
- MoneyAddIcon,
81
- MoneyBackIcon,
82
- MoneyIcon,
83
- MountainIcon,
84
172
  MonthPicker,
85
- MouseIcon,
86
173
  Number,
87
174
  numberFormat,
88
175
  Phone,
89
- PlayMarketBadge,
176
+ PieOptions,
90
177
  Popover,
91
178
  PopoverList,
92
179
  Provider,
180
+ rangeLabels,
181
+ rangeOptions,
93
182
  RangeSlider,
94
183
  RelativeDateRange,
95
184
  roundNumber,
96
- RulerIcon,
97
- ScanQrCodeIcon,
98
185
  Search,
186
+ SecondaryButton,
99
187
  Select,
100
- Sidebar,
101
188
  Skeleton,
102
189
  SlideDown,
103
190
  Spinner,
104
- SplitArrowIcon,
105
- SplitPaymentIcon,
106
- SquareIcon,
107
- StackIcon,
108
- StarFilledIcon,
109
- StarIcon,
110
- StoreCreditIcon,
111
191
  SubmitButton,
112
192
  Switch,
113
193
  Table,
114
194
  Tabs,
115
195
  Tag,
116
- TaxIcon,
117
- TableIcon,
118
196
  Textarea,
119
197
  theme,
120
198
  Tooltip,
121
199
  ToggleButton,
122
- TransferArrowIcon,
123
- TranslationIcon,
124
- TrashIcon,
125
- TutorialsBadgeIcon,
126
- TutorialsButtonIcon,
127
- TutorialsSquareIcon,
128
- UnlinkIcon,
129
200
  useIsClient,
130
201
  useIsMobile,
131
202
  useViewportHeight,
132
- UserAddIcon,
133
- UserChangedIcon,
134
- UserIcon,
135
- UserSubtractIcon,
136
203
  ValuePopoverText,
137
- VariantIcon,
138
- VerifiedTickIcon,
139
- VeteranIcon,
140
- ViewNotesIcon,
141
- VoucherIcon,
142
- WaitlistIcon,
143
- WarningDiamondIcon,
144
- WarningIcon,
145
- WarningTriangleIcon,
146
- WeightIcon,
147
- WifiIcon,
148
- WriteIcon,
149
- XolaBotIcon,
150
- XrayIcon,
151
204
  } from "./build/ui-kit.es";
package/package.json CHANGED
@@ -1,23 +1,41 @@
1
1
  {
2
2
  "name": "@xola/ui-kit",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "Xola UI Kit",
5
5
  "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": [
8
+ "**/*.css"
9
+ ],
6
10
  "repository": {
7
11
  "type": "git",
8
12
  "url": "git://github.com/xola/ui-kit.git"
9
13
  },
10
14
  "files": [
11
15
  "build",
16
+ "README.md",
12
17
  "index.css",
13
18
  "index.d.ts",
19
+ "skills",
14
20
  "tailwind.config.js",
15
- "postcss.config.js",
16
- "ui-kit.es.js"
21
+ "postcss.config.js"
17
22
  ],
18
- "main": "build/ui-kit.es.js",
19
- "module": "build/ui-kit.es.js",
23
+ "main": "build/index.js",
24
+ "module": "build/index.js",
20
25
  "types": "build/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./build/index.d.ts",
29
+ "import": "./build/index.js"
30
+ },
31
+ "./index.css": "./index.css",
32
+ "./build/*": "./build/*",
33
+ "./tailwind.config": "./tailwind.config.js",
34
+ "./tailwind.config.js": "./tailwind.config.js",
35
+ "./postcss.config": "./postcss.config.js",
36
+ "./postcss.config.js": "./postcss.config.js",
37
+ "./package.json": "./package.json"
38
+ },
21
39
  "scripts": {
22
40
  "prepare": "node scripts/prepare && vite build",
23
41
  "start": "./scripts/storybook",
@@ -25,81 +43,94 @@
25
43
  "build": "npm run prepare && vite build && cp index.d.ts build",
26
44
  "build:storybook": "npm run build && ./scripts/storybook build",
27
45
  "clean": "rm -rf node_modules/.vite",
28
- "lint": "xola-lint src",
29
- "lint:fix": "xola-lint src --fix",
30
- "lint:report": "xola-lint src --reporter=json src > eslint_report.json",
46
+ "lint": "eslint --cache --cache-strategy content --fix src",
47
+ "lint:ci": "eslint --cache --cache-strategy content src",
48
+ "lint:report": "eslint --cache --cache-strategy content --output-file=eslint_report.json --format=json src",
31
49
  "format": "prettier -l --write src",
32
- "test": "vitest run",
33
- "chromatic": "chromatic --exit-zero-on-changes --build-script-name build:storybook"
50
+ "test": "vitest run --project unit",
51
+ "test:ssr": "node -e 'import(\"./build/index.js\").then(() => console.log(\"✅ ssr import ok\"))'",
52
+ "test:bundle-size": "node scripts/checkBundleSize.js",
53
+ "test:storybook": "vitest run --project storybook",
54
+ "test:all": "vitest run",
55
+ "knip": "knip"
34
56
  },
35
57
  "dependencies": {
36
58
  "@headlessui/react": "1.7",
37
59
  "@tailwindcss/forms": "^0.5.11",
38
- "@tailwindcss/line-clamp": "^0.4.4",
39
60
  "@tippyjs/react": "^4.2.6",
61
+ "ahooks": "^3.9.6",
62
+ "axios": "^1.13.2",
40
63
  "clsx": "^1.2.1",
41
64
  "dayjs": "^1.11.21",
42
65
  "downshift": "^6.1.12",
43
- "get-user-locale": "^1.5.1",
44
- "google-libphonenumber": "^3.2.44",
66
+ "get-user-locale": "^3.0.0",
67
+ "libphonenumber-js": "^1.13.10",
45
68
  "lodash-es": "^4.18.1",
46
69
  "nouislider-react": "^3.4.2",
47
70
  "prop-types": "^15.8.1",
48
- "react": "^18.3.1",
49
71
  "react-day-picker": "^7.4.10",
50
- "react-dom": "^18.3.1",
51
72
  "react-hot-toast": "^2.6.0",
52
73
  "react-hotkeys-hook": "^3.4.7",
53
74
  "react-select": "^5.10.2",
54
75
  "react-textarea-autosize": "^8.5.9",
55
- "react18-json-view": "^0.2.10",
56
76
  "tailwind-merge": "^2.6.1",
57
77
  "tippy.js": "^6.3.7",
58
- "ahooks": "^3.9.6",
59
- "axios": "^1.13.2",
60
78
  "use-debounce": "^10.0.6"
61
79
  },
62
80
  "devDependencies": {
63
- "@babel/core": "^7.29.7",
64
- "@babel/preset-env": "^7.29.7",
65
- "@babel/preset-react": "^7.29.7",
66
- "@babel/preset-typescript": "^7.29.7",
67
- "@storybook/addon-actions": "8.6.18",
68
- "@storybook/addon-essentials": "8.6.18",
69
- "@storybook/addon-links": "8.6.18",
70
- "@storybook/addon-styling-webpack": "^1.0.1",
71
- "@storybook/addon-webpack5-compiler-babel": "^4.0.1",
72
- "@storybook/manager-api": "^8.6.18",
73
- "@storybook/react": "8.6.18",
74
- "@storybook/react-webpack5": "^8.6.18",
75
- "@storybook/test": "^8.6.18",
76
- "@storybook/theming": "8.6.18",
81
+ "@storybook/addon-docs": "^10.5.2",
82
+ "@storybook/addon-links": "^10.5.2",
83
+ "@storybook/addon-vitest": "^10.5.2",
84
+ "@storybook/react-vite": "^10.5.2",
77
85
  "@types/react": "^18.3.31",
78
86
  "@types/react-dom": "^18.3.7",
79
- "@xola/jslint": "^3.0.1",
87
+ "@vitest/browser": "^3.2.7",
88
+ "@vitest/coverage-v8": "3.2.7",
89
+ "@xola/jslint": "^4.0.1",
80
90
  "autoprefixer": "^10.5.2",
81
- "babel-loader": "^8.4.1",
82
- "chromatic": "^6.24.1",
83
- "css-loader": "^7.1.4",
91
+ "eslint": "^9.18.0",
92
+ "knip": "^6.27.0",
93
+ "playwright": "^1.61.1",
84
94
  "postcss": "8.5",
85
- "postcss-loader": "^8.2.1",
86
95
  "prettier": "^3.9.5",
87
96
  "prettier-plugin-tailwindcss": "^0.8.0",
88
- "storybook": "^8.6.18",
89
- "style-loader": "^4.0.0",
97
+ "react": "^18.3.1",
98
+ "react-dom": "^18.3.1",
99
+ "storybook": "^10.5.2",
90
100
  "tailwindcss": "3.4",
91
- "typescript": "4.9",
101
+ "typescript": "^5.7.2",
92
102
  "vite": "^5.4.21",
93
- "vitest": "^2.1.9",
94
- "webpack": "^5.108.4"
103
+ "vitest": "^3.2.7"
95
104
  },
96
105
  "peerDependencies": {
97
- "@types/react": "^18.2.22",
98
- "@types/react-dom": "^18.2.7",
106
+ "@types/react": "^18.2.22 || ^19.0.0",
107
+ "@types/react-dom": "^18.2.7 || ^19.0.0",
99
108
  "autoprefixer": "^10.3.1",
100
109
  "postcss": "^8.3.6",
110
+ "react": "^18.3.1 || ^19.0.0",
111
+ "react-dom": "^18.3.1 || ^19.0.0",
101
112
  "tailwindcss": "^3.1.8",
102
- "vite": "^5.4.11"
113
+ "vite": "^5.4.11 || ^6.0.0 || ^7.0.0"
114
+ },
115
+ "peerDependenciesMeta": {
116
+ "@types/react": {
117
+ "optional": true
118
+ },
119
+ "@types/react-dom": {
120
+ "optional": true
121
+ },
122
+ "autoprefixer": {
123
+ "optional": true
124
+ },
125
+ "postcss": {
126
+ "optional": true
127
+ },
128
+ "tailwindcss": {
129
+ "optional": true
130
+ },
131
+ "vite": {
132
+ "optional": true
133
+ }
103
134
  },
104
135
  "engines": {
105
136
  "node": ">=20"
package/postcss.config.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  plugins: {
3
3
  tailwindcss: {},
4
4
  autoprefixer: {},
@@ -0,0 +1,27 @@
1
+ # @xola/ui-kit agent skills
2
+
3
+ Skills follow the Agent Skills standard (`SKILL.md` with `name` and `description` frontmatter), readable by Claude Code, Codex and Cursor. They ship inside the npm package, so the guide you read always matches the installed ui-kit version.
4
+
5
+ ## Skills
6
+
7
+ - `node_modules/@xola/ui-kit/skills/migrate-2.6-to-3.7/SKILL.md`: upgrading an app from ui-kit 2.6.x to 3.7.x (ESM-only config loading, `exports` map, React 18.3 peer, removed exports)
8
+
9
+ ## Use a skill
10
+
11
+ No tooling required. Either way, reference the file in `node_modules`.
12
+
13
+ Point your agent at the file for one task:
14
+
15
+ ```text
16
+ Follow node_modules/@xola/ui-kit/skills/migrate-2.6-to-3.7/SKILL.md to upgrade this repo to ui-kit 3.7
17
+ ```
18
+
19
+ Or reference it from your `AGENTS.md` / `CLAUDE.md` so every session sees it:
20
+
21
+ ```text
22
+ - node_modules/@xola/ui-kit/skills/migrate-2.6-to-3.7/SKILL.md : upgrading an app from ui-kit 2.6.x to 3.7.x
23
+ ```
24
+
25
+ ## Why the `node_modules` path
26
+
27
+ A copy in `.claude/skills` goes stale on the next ui-kit bump. The `node_modules` path always matches the installed version.
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: migrate-2.6-to-3.7
3
+ description: Use when upgrading an app from @xola/ui-kit 2.6.x to 3.7.x, or when a 2.6 app fails to load ui-kit config, resolve its entry points or import a removed export after the bump.
4
+ ---
5
+
6
+ # Migrate @xola/ui-kit 2.6 to 3.7
7
+
8
+ ui-kit 3.7 is ESM-only, requires React 18.3 or newer, and resolves entry points through an `exports` map. Work through the steps in order. Each ends with a check; do not start the next step until it passes.
9
+
10
+ Out of scope: the consuming app's own bundler jump (for example Vite 3 to 8). The app's own upgrade plan covers it.
11
+
12
+ ## 1. Preflight
13
+
14
+ - `git status` shows a clean working tree.
15
+ - Node is 20 or newer (`node -v`). 3.7 sets `engines.node` to `>=20`; 2.6.2 allowed 16.
16
+ - `react` and `react-dom` resolve to 18.3.1 or newer (`npm ls react react-dom`). 2.6.2 peered on React 17; 3.7 peers on `^18.3.1 || ^19.0.0`.
17
+ - `@types/react` and `@types/react-dom` are `^18.2.22` or `^19` (`@types/react`) and `^18.2.7` or `^19` (`@types/react-dom`) if the app uses TypeScript.
18
+
19
+ Done when all four hold.
20
+
21
+ ## 2. Install
22
+
23
+ ```bash
24
+ npm install @xola/ui-kit@3.7 --legacy-peer-deps
25
+ ```
26
+
27
+ Keep `legacy-peer-deps=true` in the app's `.npmrc`; ui-kit's own `.npmrc` sets it. The `lodash` peer is gone (ui-kit depends on `lodash-es` directly), so remove `lodash` from the app only if nothing else uses it.
28
+
29
+ Done when `npm ls @xola/ui-kit` shows 3.7.x with no `invalid` peer lines.
30
+
31
+ ## 3. Load ui-kit as ESM
32
+
33
+ The package has `"type": "module"` and no CommonJS build. `main`/`module` now point at `build/index.js`; the 2.6.2 `build/ui-kit.umd.js` and `build/ui-kit.mjs` are gone.
34
+
35
+ - Replace every `require("@xola/ui-kit")` with `import`.
36
+ - Replace CommonJS config files that require ui-kit's configs. Use the `.mjs` extension (or `"type": "module"` in the app's `package.json`):
37
+
38
+ ```js
39
+ // tailwind.config.mjs
40
+ export { default } from "@xola/ui-kit/tailwind.config.js";
41
+ // postcss.config.mjs
42
+ export { default } from "@xola/ui-kit/postcss.config.js";
43
+ ```
44
+
45
+ 2.6.2 used `module.exports = require("@xola/ui-kit/tailwind.config");` in `tailwind.config.js` and `postcss.config.js`. Delete those files after the `.mjs` versions exist, or the tools pick up the old ones.
46
+ - Test runners that load packages as CommonJS (Jest without ESM support) must transform `@xola/ui-kit` and its ESM-only dependencies, for example through `transformIgnorePatterns`.
47
+
48
+ Done when `node -e 'import("@xola/ui-kit").then(() => console.log("ok"))'` prints `ok` and `rg -n "require\(['\"]@xola/ui-kit" -g '*.{js,cjs,cts,ts,tsx,jsx}' -g '!node_modules' .` finds nothing.
49
+
50
+ ## 4. Fix entry points (`exports` map)
51
+
52
+ Only these subpaths resolve:
53
+
54
+ | Import | Resolves to |
55
+ | --- | --- |
56
+ | `@xola/ui-kit` | `build/index.js` (types: `build/index.d.ts`) |
57
+ | `@xola/ui-kit/index.css` | `index.css` |
58
+ | `@xola/ui-kit/build/*` | `build/*` |
59
+ | `@xola/ui-kit/tailwind.config` and `.js` | `tailwind.config.js` |
60
+ | `@xola/ui-kit/postcss.config` and `.js` | `postcss.config.js` |
61
+ | `@xola/ui-kit/package.json` | `package.json` |
62
+
63
+ Any other deep import (`@xola/ui-kit/index.d.ts`, `@xola/ui-kit/src/...`) throws `ERR_PACKAGE_PATH_NOT_EXPORTED`. `build/` is now one file per module (mirrors `src/`), so imports of the old `build/ui-kit.*` bundles break. Import from `@xola/ui-kit`.
64
+
65
+ Done when `grep -rn "@xola/ui-kit/" src` lists only paths from the table.
66
+
67
+ ## 5. Check the CSS import path
68
+
69
+ Tailwind v3 apps keep the same two imports as 2.6.2:
70
+
71
+ ```js
72
+ import "@xola/ui-kit/index.css";
73
+ import "@xola/ui-kit/build/style.css";
74
+ ```
75
+
76
+ Tailwind v4 apps import only `@xola/ui-kit/build/style.css` (never `index.css`), plus `@source` and `@import "@xola/ui-kit/build/theme.css"` in the CSS entry. The ui-kit README sections "Tailwind v3 projects" and "Tailwind v4 projects" are the reference.
77
+
78
+ Done when the app's CSS entry matches its Tailwind major version's imports above.
79
+
80
+ ## 6. Replace removed exports
81
+
82
+ `useId` is the one runtime export removed between 2.6.2 and 3.7. Use React's own hook:
83
+
84
+ ```diff
85
+ -import { useId } from "@xola/ui-kit";
86
+ +import { useId } from "react";
87
+ ```
88
+
89
+ The 2.6.2 `index.d.ts` also declared `BaseInput`, `CloseCircleIcon` and `SquareIcon`, which were never exported at runtime, so any import of them is `undefined`. Remove those imports.
90
+
91
+ Added since 2.6.2, available if you need them: `SecondaryButton`, `ValuePopoverText`, `getInitials`, `compactNumber`, `getChildByType`, `getChildrenByType`, `useIsClient`, `useViewportHeight`.
92
+
93
+ Types: `index.d.ts` now declares every runtime export. Every component except Sidebar is still typed `any`, as in 2.6.2. One signature changed: `Sidebar`'s `onSidebarResize` was `(width: string) => void` and is now `(width: number) => void`. TypeScript consumers must update handlers that parse the string (`parseInt(width)`, `width.replace(...)`) to use the number directly.
94
+
95
+ The Sidebar parts are typed too, and a consumer that had no types for them (an `any` shim) sees new errors. `Sidebar.Link`, `Sidebar.Button` and `Sidebar.Account` extend the HTML button attributes, so an unknown prop such as `to` on `Sidebar.Link` is an error: delete it, it only became an inert attribute, and change the route in `onClick`. `Sidebar.Link`, `Sidebar.Heading` and `Sidebar.Button` `icon` take a component (`icon={UserIcon}`), not an element (`icon={<UserIcon />}`); `Sidebar.Account` `icon` is the exception and is a `ReactNode`; `Sidebar.Link` also accepts a thunk `() => ReactElement | null`. Type an app prop that carries an icon as `React.ComponentType<{ className?: string }>`. `Sidebar.Button` and `Sidebar.Heading` `label` is a `string`, so `label={user?.name}` needs `?? ""` or a guard.
96
+
97
+ Done when `rg -nU "import\s*(type\s*)?\{[^}]*\b(useId|BaseInput|CloseCircleIcon|SquareIcon)\b[^}]*\}\s*from\s*['\"]@xola/ui-kit['\"]" -g '!node_modules' .` finds nothing (it matches multi-line imports) and `npx tsc --noEmit` accepts every `onSidebarResize` handler.
98
+
99
+ ## 7. Verify
100
+
101
+ Run the app's own scripts, all green:
102
+
103
+ ```bash
104
+ npm run lint
105
+ npx tsc --noEmit # TypeScript apps
106
+ npm test
107
+ npm run build
108
+ ```
109
+
110
+ Then start the dev server and render a page with a ui-kit `Button`. Done when the page renders with ui-kit styles and the console shows no React or module-resolution errors.
@@ -1,5 +1,9 @@
1
- const defaultTheme = require("tailwindcss/defaultTheme");
2
- const path = require("path");
1
+ import defaultTheme from "tailwindcss/defaultTheme.js";
2
+ import forms from "@tailwindcss/forms";
3
+ import path from "path";
4
+ import { fileURLToPath } from "url";
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
3
7
 
4
8
  const colors = {
5
9
  transparent: "transparent",
@@ -125,13 +129,13 @@ const spacing = {
125
129
  200: "800px",
126
130
  };
127
131
 
128
- module.exports = {
132
+ export default {
129
133
  content: [
130
134
  "./src/**/*.js",
131
135
  "./src/**/*.jsx",
132
136
  "./src/**/*.ts",
133
137
  "./src/**/*.tsx",
134
- path.join(__dirname, "build/ui-kit.es.js"),
138
+ path.join(__dirname, "build/**/*.js"),
135
139
  ],
136
140
 
137
141
  theme: {
@@ -240,5 +244,5 @@ module.exports = {
240
244
  },
241
245
  },
242
246
 
243
- plugins: [require("@tailwindcss/forms")],
247
+ plugins: [forms],
244
248
  };