@xola/ui-kit 3.5.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 (215) hide show
  1. package/README.md +136 -87
  2. package/build/components/Alert.js +18 -13
  3. package/build/components/Animation/FadeIn.js +36 -25
  4. package/build/components/Animation/SlideDown.js +14 -9
  5. package/build/components/Avatar.js +17 -10
  6. package/build/components/Badge.js +33 -24
  7. package/build/components/BottomSheet.js +114 -0
  8. package/build/components/Breadcrumb.js +27 -21
  9. package/build/components/Breakdown.js +66 -74
  10. package/build/components/Buttons/Button.js +53 -47
  11. package/build/components/Buttons/ButtonGroup.js +42 -39
  12. package/build/components/Buttons/SecondaryButton.js +31 -0
  13. package/build/components/Buttons/SubmitButton.js +72 -66
  14. package/build/components/Buttons/ToggleButton.js +15 -16
  15. package/build/components/Counter.js +10 -6
  16. package/build/components/DatePicker/DatePicker.helpers.js +24 -13
  17. package/build/components/DatePicker/DatePicker.js +196 -223
  18. package/build/components/DatePicker/DatePickerPopover.js +75 -66
  19. package/build/components/DatePicker/Day.js +35 -32
  20. package/build/components/DatePicker/LocalizedDayPicker.js +15 -18
  21. package/build/components/DatePicker/MonthGrid.js +35 -48
  22. package/build/components/DatePicker/MonthPicker.js +25 -20
  23. package/build/components/DatePicker/MonthSelector.js +39 -40
  24. package/build/components/DatePicker/MonthYearSelector.js +18 -39
  25. package/build/components/DatePicker/NavbarElement.js +26 -35
  26. package/build/components/DatePicker/RangeDatePicker.js +104 -123
  27. package/build/components/DatePicker/RelativeDateRange.js +153 -143
  28. package/build/components/DatePicker/UpcomingDatePicker.js +29 -25
  29. package/build/components/Dot/Dot.js +13 -8
  30. package/build/components/Dot/DotProgress.js +12 -7
  31. package/build/components/Drawer.js +109 -101
  32. package/build/components/Forms/BaseInput.js +50 -34
  33. package/build/components/Forms/Checkbox.js +33 -30
  34. package/build/components/Forms/ComboBox.js +35 -35
  35. package/build/components/Forms/FormGroup.js +7 -3
  36. package/build/components/Forms/InlineValuePopover.js +33 -39
  37. package/build/components/Forms/Input.js +15 -7
  38. package/build/components/Forms/Label.js +14 -8
  39. package/build/components/Forms/RangeSlider.js +41 -22
  40. package/build/components/Forms/Select.js +5 -6
  41. package/build/components/Forms/Switch.js +46 -38
  42. package/build/components/Forms/Textarea.js +37 -30
  43. package/build/components/Forms/ValuePopoverText.js +5 -8
  44. package/build/components/GooglePlacesAutocomplete.js +112 -0
  45. package/build/components/HeaderToolbar.js +30 -22
  46. package/build/components/ImageUpload.js +76 -79
  47. package/build/components/Key.js +21 -16
  48. package/build/components/Logo.js +12 -5
  49. package/build/components/Modal.js +87 -72
  50. package/build/components/Popover/Popover.js +40 -31
  51. package/build/components/Popover/PopoverList.js +43 -36
  52. package/build/components/Provider.js +7 -8
  53. package/build/components/Screens/Login.js +97 -126
  54. package/build/components/Search.js +114 -144
  55. package/build/components/Sidebar/Sidebar.Account.js +39 -46
  56. package/build/components/Sidebar/Sidebar.Button.js +45 -19
  57. package/build/components/Sidebar/Sidebar.Footer.js +8 -7
  58. package/build/components/Sidebar/Sidebar.Heading.js +11 -8
  59. package/build/components/Sidebar/Sidebar.Link.js +79 -44
  60. package/build/components/Sidebar/Sidebar.Menu.js +52 -28
  61. package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
  62. package/build/components/Sidebar/Sidebar.js +207 -214
  63. package/build/components/Sidebar/SidebarContext.js +15 -0
  64. package/build/components/Sidebar/sidebarWidth.js +41 -0
  65. package/build/components/Sidebar/useSidebarWidthState.js +115 -0
  66. package/build/components/Skeleton.js +19 -20
  67. package/build/components/Spinner.js +18 -10
  68. package/build/components/Table.js +86 -50
  69. package/build/components/Tabs/Tabs.Panel.js +9 -5
  70. package/build/components/Tabs/Tabs.Tab.js +28 -23
  71. package/build/components/Tabs/Tabs.js +23 -23
  72. package/build/components/Tag.js +28 -23
  73. package/build/components/Tooltip.js +19 -5
  74. package/build/components/Utilities/Currency.js +49 -42
  75. package/build/components/Utilities/Number.js +14 -12
  76. package/build/components/Utilities/Phone.js +18 -12
  77. package/build/helpers/environment.js +10 -0
  78. package/build/helpers/flash.js +45 -46
  79. package/build/hooks/useIsMobile.js +8 -0
  80. package/build/hooks/useViewportHeight.js +6 -12
  81. package/build/icons/src/AnnounceIcon.js +3 -4
  82. package/build/icons/src/BellIcon.js +0 -1
  83. package/build/icons/src/CalendarIcon.js +0 -1
  84. package/build/icons/src/CheckIcon.js +0 -1
  85. package/build/icons/src/ChevronDownIcon.js +4 -5
  86. package/build/icons/src/ChevronLeftIcon.js +0 -1
  87. package/build/icons/src/ChevronRightIcon.js +0 -1
  88. package/build/icons/src/CircleNotch.js +0 -1
  89. package/build/icons/src/CloseIcon.js +11 -9
  90. package/build/icons/src/DownArrowIcon.js +0 -1
  91. package/build/icons/src/ImageIcon.js +0 -1
  92. package/build/icons/src/SearchIcon.js +4 -5
  93. package/build/icons/src/TrashIcon.js +0 -1
  94. package/build/icons/src/WarningDiamondIcon.js +0 -1
  95. package/build/icons/src/helpers/icon.js +5 -9
  96. package/build/icons/src/images/XolaLogoSimple.js +2 -3
  97. package/build/index.js +143 -130
  98. package/build/style.css +1 -0
  99. package/build/theme.css +76 -0
  100. package/build/theme.js +2 -0
  101. package/build/utils/currency.js +5 -5
  102. package/build/{helpers → utils}/date.js +17 -20
  103. package/build/utils/numbers.js +12 -12
  104. package/build/utils/phone.js +12 -14
  105. package/build/utils/userLocale.js +6 -0
  106. package/index.css +96 -4
  107. package/index.d.ts +204 -0
  108. package/package.json +87 -77
  109. package/skills/README.md +27 -0
  110. package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
  111. package/tailwind.config.js +5 -2
  112. package/build/base.css +0 -2
  113. package/build/components/Alert.d.ts +0 -18
  114. package/build/components/Animation/FadeIn.d.ts +0 -13
  115. package/build/components/Animation/SlideDown.d.ts +0 -6
  116. package/build/components/Avatar.d.ts +0 -16
  117. package/build/components/Badge.d.ts +0 -28
  118. package/build/components/Breadcrumb.d.ts +0 -21
  119. package/build/components/Breakdown.d.ts +0 -63
  120. package/build/components/Buttons/Button.d.ts +0 -53
  121. package/build/components/Buttons/ButtonGroup.d.ts +0 -35
  122. package/build/components/Buttons/SubmitButton.d.ts +0 -11
  123. package/build/components/Buttons/ToggleButton.d.ts +0 -21
  124. package/build/components/Charts/BaseChartOptions.d.ts +0 -136
  125. package/build/components/Charts/HistogramOptions.d.ts +0 -192
  126. package/build/components/Charts/PieOptions.d.ts +0 -177
  127. package/build/components/Counter.d.ts +0 -5
  128. package/build/components/DatePicker/DatePicker.d.ts +0 -41
  129. package/build/components/DatePicker/DatePicker.helpers.d.ts +0 -17
  130. package/build/components/DatePicker/DatePickerPopover.d.ts +0 -29
  131. package/build/components/DatePicker/Day.d.ts +0 -13
  132. package/build/components/DatePicker/LocalizedDayPicker.d.ts +0 -6
  133. package/build/components/DatePicker/MonthGrid.d.ts +0 -11
  134. package/build/components/DatePicker/MonthPicker.d.ts +0 -7
  135. package/build/components/DatePicker/MonthSelector.d.ts +0 -8
  136. package/build/components/DatePicker/MonthYearSelector.d.ts +0 -8
  137. package/build/components/DatePicker/NavbarElement.d.ts +0 -15
  138. package/build/components/DatePicker/RangeDatePicker.d.ts +0 -25
  139. package/build/components/DatePicker/RelativeDateRange.d.ts +0 -51
  140. package/build/components/DatePicker/UpcomingDatePicker.d.ts +0 -11
  141. package/build/components/Dot/Dot.d.ts +0 -24
  142. package/build/components/Dot/DotProgress.d.ts +0 -6
  143. package/build/components/Drawer.d.ts +0 -28
  144. package/build/components/Forms/BaseInput.d.ts +0 -20
  145. package/build/components/Forms/Checkbox.d.ts +0 -10
  146. package/build/components/Forms/ComboBox.d.ts +0 -8
  147. package/build/components/Forms/FormGroup.d.ts +0 -5
  148. package/build/components/Forms/InlineValuePopover.d.ts +0 -17
  149. package/build/components/Forms/Input.d.ts +0 -6
  150. package/build/components/Forms/Label.d.ts +0 -7
  151. package/build/components/Forms/RangeSlider.d.ts +0 -33
  152. package/build/components/Forms/Select.d.ts +0 -5
  153. package/build/components/Forms/Switch.d.ts +0 -46
  154. package/build/components/Forms/Textarea.d.ts +0 -6
  155. package/build/components/Forms/ValuePopoverText.d.ts +0 -6
  156. package/build/components/GooglePlacesAutocomplete.d.ts +0 -14
  157. package/build/components/HeaderToolbar.d.ts +0 -21
  158. package/build/components/ImageUpload.d.ts +0 -17
  159. package/build/components/Key.d.ts +0 -6
  160. package/build/components/Logo.d.ts +0 -19
  161. package/build/components/Modal.d.ts +0 -52
  162. package/build/components/Popover/Popover.d.ts +0 -20
  163. package/build/components/Popover/PopoverList.d.ts +0 -25
  164. package/build/components/Provider.d.ts +0 -18
  165. package/build/components/Screens/Login.d.ts +0 -25
  166. package/build/components/Search.d.ts +0 -16
  167. package/build/components/Sidebar/Sidebar.Account.d.ts +0 -13
  168. package/build/components/Sidebar/Sidebar.Button.d.ts +0 -10
  169. package/build/components/Sidebar/Sidebar.Footer.d.ts +0 -8
  170. package/build/components/Sidebar/Sidebar.Heading.d.ts +0 -10
  171. package/build/components/Sidebar/Sidebar.Link.d.ts +0 -24
  172. package/build/components/Sidebar/Sidebar.Menu.d.ts +0 -13
  173. package/build/components/Sidebar/Sidebar.d.ts +0 -58
  174. package/build/components/Sidebar/index.d.ts +0 -8
  175. package/build/components/Skeleton.d.ts +0 -13
  176. package/build/components/Spinner.d.ts +0 -26
  177. package/build/components/Table.d.ts +0 -59
  178. package/build/components/Tabs/Tabs.Panel.d.ts +0 -9
  179. package/build/components/Tabs/Tabs.Tab.d.ts +0 -19
  180. package/build/components/Tabs/Tabs.d.ts +0 -27
  181. package/build/components/Tabs/index.d.ts +0 -4
  182. package/build/components/Tag.d.ts +0 -25
  183. package/build/components/Tooltip.d.ts +0 -8
  184. package/build/components/Utilities/Currency.d.ts +0 -32
  185. package/build/components/Utilities/Number.d.ts +0 -8
  186. package/build/components/Utilities/Phone.d.ts +0 -8
  187. package/build/full.css +0 -2
  188. package/build/helpers/avatar.d.ts +0 -1
  189. package/build/helpers/avatar.js +0 -8
  190. package/build/helpers/browser.d.ts +0 -2
  191. package/build/helpers/children.d.ts +0 -3
  192. package/build/helpers/classnames.d.ts +0 -5
  193. package/build/helpers/currency.d.ts +0 -2
  194. package/build/helpers/currency.js +0 -11
  195. package/build/helpers/date.d.ts +0 -12
  196. package/build/helpers/flash.d.ts +0 -21
  197. package/build/helpers/numbers.d.ts +0 -4
  198. package/build/helpers/numbers.js +0 -23
  199. package/build/helpers/phone.d.ts +0 -11
  200. package/build/helpers/phone.js +0 -25
  201. package/build/hooks/useId.d.ts +0 -1
  202. package/build/hooks/useId.js +0 -9
  203. package/build/hooks/useIsClient.d.ts +0 -1
  204. package/build/hooks/useViewportHeight.d.ts +0 -1
  205. package/build/icons/src/helpers/classnames.js +0 -8
  206. package/build/index.d.ts +0 -66
  207. package/build/theme.d.ts +0 -413
  208. package/build/types/index.d.ts +0 -22
  209. package/build/types/migration.d.ts +0 -2
  210. package/build/ui-kit.css +0 -1
  211. package/build/utils/avatar.d.ts +0 -1
  212. package/build/utils/currency.d.ts +0 -2
  213. package/build/utils/index.d.ts +0 -4
  214. package/build/utils/numbers.d.ts +0 -4
  215. package/build/utils/phone.d.ts +0 -2
package/README.md CHANGED
@@ -7,102 +7,147 @@ This repository is published as two pieces:
7
7
  1. [@xola/ui-kit](https://www.npmjs.com/package/@xola/ui-kit)
8
8
  2. [@xola/icons](https://www.npmjs.com/package/@xola/icons)
9
9
 
10
- It's storybook is publicly published at [ui.xola.io](https://ui.xola.io). The icons can be previewed there as well.
10
+ Its Storybook is published at [ui.xola.io](https://ui.xola.io), where you can also preview the icons.
11
11
 
12
12
  ### Requirements
13
13
 
14
- - Node.js v20 or higher
15
- - NPM v7 or higher
16
- - **ESM-only package** - This package uses ES modules exclusively and does not support CommonJS
14
+ - Node.js 20 or newer (CI runs Node.js 24)
15
+ - npm 7 or newer
16
+ - React and React DOM 18.3.1 or newer, or React 19
17
+ - Vite 5, 6 or 7
18
+ - Tailwind CSS v3 or v4 (see the setup for each below)
17
19
 
18
20
  ### Usage
19
21
 
22
+ #### Install with an AI agent
23
+
24
+ Paste the following prompt into your coding agent (Claude Code, Cursor, etc.) to have it install
25
+ and wire up the UI kit for you:
26
+
27
+ ```text
28
+ Install and configure the @xola/ui-kit React component library in this project.
29
+
30
+ 1. Install the package: npm install @xola/ui-kit@next
31
+ 2. Install its peer dependencies: react react-dom autoprefixer postcss tailwindcss vite
32
+ @types/react @types/react-dom (React 18.3.1+ or 19, Vite 5 to 7)
33
+ 3. @xola/ui-kit is ESM only ("type": "module") with no CommonJS build. Import it, never
34
+ require() it.
35
+ 4. Detect the project's Tailwind CSS major version and configure accordingly:
36
+ - Tailwind v3: create tailwind.config.mjs and postcss.config.mjs that re-export the ui-kit
37
+ configs:
38
+ export { default } from "@xola/ui-kit/tailwind.config.js";
39
+ export { default } from "@xola/ui-kit/postcss.config.js";
40
+ Then import both "@xola/ui-kit/index.css" and "@xola/ui-kit/build/style.css".
41
+ - Tailwind v4: do NOT import "@xola/ui-kit/index.css" (it uses @tailwind/@apply and will
42
+ error). Import only "@xola/ui-kit/build/style.css". In the CSS entry that has
43
+ @import "tailwindcss";, add:
44
+ @source "../node_modules/@xola/ui-kit/build/**/*.js";
45
+ @import "@xola/ui-kit/build/theme.css"; /* after any of your own theme tokens */
46
+ 5. This project uses legacy-peer-deps; run installs with --legacy-peer-deps (or copy ui-kit's
47
+ .npmrc).
48
+ 6. Verify by importing and rendering a component: import { Button } from "@xola/ui-kit";
49
+
50
+ Read the @xola/ui-kit README for the full details before making changes.
51
+ ```
52
+
53
+ Prefer manual setup? Follow the steps below.
54
+
20
55
  Install the UI kit:
21
56
 
22
57
  ```bash
23
- npm install @xola/ui-kit
58
+ npm install @xola/ui-kit@next --legacy-peer-deps
24
59
  ```
25
60
 
26
61
  Install peer dependencies:
27
62
 
28
63
  ```bash
29
- npm install autoprefixer postcss tailwindcss vite
64
+ npm install react react-dom autoprefixer postcss tailwindcss vite @types/react @types/react-dom --legacy-peer-deps
30
65
  ```
31
66
 
32
- #### Option 1: Use configs directly (Recommended)
67
+ UI kit expects you already have a working React dev environment with PostCSS support.
33
68
 
34
- Import and extend the configs in your project:
69
+ > **ESM only.** `@xola/ui-kit` ships as ESM (`"type": "module"`) with no CommonJS build. Consume it
70
+ > from an ESM context; `require("@xola/ui-kit")` is not supported.
35
71
 
36
- **tailwind.config.js:**
37
- ```js
38
- import uiKitConfig from "@xola/ui-kit/tailwind.config.js";
39
-
40
- export default {
41
- ...uiKitConfig,
42
- content: [
43
- ...uiKitConfig.content,
44
- "./src/**/*.{js,jsx,ts,tsx}",
45
- ],
46
- };
47
- ```
72
+ Import and use the components:
48
73
 
49
- **postcss.config.js:**
50
74
  ```js
51
- export default {
52
- plugins: {
53
- tailwindcss: {},
54
- autoprefixer: {},
55
- },
56
- };
75
+ import { Button } from "@xola/ui-kit";
57
76
  ```
58
77
 
59
- #### Option 2: Re-export configs (Simple)
78
+ #### Tailwind v3 projects
60
79
 
61
- If you want to use the UI Kit configs as-is:
80
+ Re-export ui-kit's PostCSS and Tailwind config. Use the `.mjs` extension (or set `"type": "module"`
81
+ in your `package.json`) so the ESM re-export loads regardless of your project's module type:
62
82
 
63
- **tailwind.config.js:**
64
- ```js
65
- export { default } from "@xola/ui-kit/tailwind.config.js";
83
+ ```bash
84
+ echo 'export { default } from "@xola/ui-kit/tailwind.config.js";' > tailwind.config.mjs
85
+ echo 'export { default } from "@xola/ui-kit/postcss.config.js";' > postcss.config.mjs
66
86
  ```
67
87
 
68
- **postcss.config.js:**
88
+ Import main CSS files in your project:
89
+
69
90
  ```js
70
- export { default } from "@xola/ui-kit/postcss.config.js";
91
+ import "@xola/ui-kit/index.css";
92
+ import "@xola/ui-kit/build/style.css";
71
93
  ```
72
94
 
73
- #### Import Styles and Components
95
+ `index.css` is raw source (`@tailwind base/components/utilities`) that your own
96
+ Tailwind v3 pipeline compiles, using `tailwind.config.js` above to pick up
97
+ ui-kit's theme and scan its components for classes.
74
98
 
75
- Import CSS files in your project's entry point (e.g., `main.tsx` or `App.tsx`):
99
+ #### Tailwind v4 projects
76
100
 
77
- ```js
78
- // Full Tailwind setup with base styles, fonts, and CSS reset
79
- import "@xola/ui-kit/index.css";
101
+ UI kit is still built on Tailwind v3, so there's no native way for it to hand
102
+ its config to a v4 project (v3's JS config format and v4's CSS-first `@theme`
103
+ aren't directly compatible). Two things bridge the gap:
80
104
 
81
- // Component-specific styles (Popover, Checkbox, RangeSlider, Sidebar, Skeleton, etc.)
82
- import "@xola/ui-kit/build/ui-kit.css";
83
- ```
105
+ 1. **Don't import `@xola/ui-kit/index.css`.** It uses `@tailwind` directives
106
+ and `@apply`, which v4's compiler doesn't understand and will error on.
107
+ Only import the prebuilt CSS:
84
108
 
85
- **Both imports are required** for components to render correctly. The first provides Tailwind base styles and fonts, while the second includes all component CSS modules.
109
+ ```js
110
+ import "@xola/ui-kit/build/style.css";
111
+ ```
86
112
 
87
- UI kit expects you already have a working React 18+ dev environment with PostCSS support.
113
+ 2. **Scan ui-kit's bundle and import its color palette**, in your app's main
114
+ CSS entry point (the file with `@import "tailwindcss";`):
88
115
 
89
- Import and use the components (with full TypeScript support):
116
+ ```css
117
+ @import "tailwindcss";
90
118
 
91
- ```tsx
92
- import { Button, Modal, Input } from "@xola/ui-kit";
119
+ /* v4 excludes node_modules from class scanning by default, so ui-kit's
120
+ own utility classes (px-4.5, disabled:bg-gray-lighter, etc.) won't be
121
+ generated unless something in your own source happens to use the same
122
+ class string. Opt ui-kit's bundle back in explicitly. */
123
+ @source "../node_modules/@xola/ui-kit/build/**/*.js";
93
124
 
94
- // TypeScript types are automatically included
95
- function MyComponent() {
96
- return (
97
- <>
98
- <Button variant="primary">Click me</Button>
99
- <Input type="text" placeholder="Enter text" />
100
- </>
101
- );
102
- }
103
- ```
125
+ /* ui-kit's color palette (primary, gray, success, warning, ...),
126
+ auto-generated from its tailwind.config.js. Import this instead of
127
+ hand-copying hex values, otherwise names like "primary" will
128
+ silently resolve to your own theme's colors instead of Xola's. */
129
+ @import "@xola/ui-kit/build/theme.css";
130
+ ```
131
+
132
+ If your app defines its own `primary`/`secondary`/`success`/etc. tokens (e.g.
133
+ via shadcn/ui), those will collide with ui-kit's, so `build/theme.css` must be
134
+ imported after your own theme so ui-kit's classNames resolve to ui-kit's
135
+ colors, not yours.
136
+
137
+ ### Agent skills
104
138
 
105
- > **Note:** This package is ESM-only. Ensure your project has `"type": "module"` in package.json or use `.mjs` file extensions for configuration files.
139
+ Agent skills ship in the package under `node_modules/@xola/ui-kit/skills/`, version-matched to the
140
+ installed ui-kit. See [`skills/README.md`](skills/README.md) for the list and how to point your
141
+ coding agent at one.
142
+
143
+ ### Upgrading
144
+
145
+ Each upgrade guide is an agent skill that ships in the package. To upgrade an app:
146
+
147
+ 1. Install the new version: `npm install @xola/ui-kit@next --legacy-peer-deps`.
148
+ 2. Tell your coding agent which guide to follow:
149
+ - From 2.6 to 3.7: "Follow node_modules/@xola/ui-kit/skills/migrate-2.6-to-3.7/SKILL.md to upgrade this repo to ui-kit 3.7."
150
+ 3. Run your type check, linter and tests. Each guide ends with a Verify section listing the checks that must pass.
106
151
 
107
152
  ## Development
108
153
 
@@ -111,7 +156,7 @@ function MyComponent() {
111
156
  Install all required dependencies:
112
157
 
113
158
  ```bash
114
- $ nvm use # Project needs Node.js v20+ with NPM v7+
159
+ $ nvm use # .nvmrc pins Node.js 20; any newer version works too
115
160
  $ npm install
116
161
  ```
117
162
 
@@ -121,6 +166,29 @@ Start the Storybook development server:
121
166
  $ npm start
122
167
  ```
123
168
 
169
+ ### Testing
170
+
171
+ Tests run on [Vitest](https://vitest.dev). Pure helpers in `src/utils` and `src/helpers` have unit tests. Component behavior is tested by Storybook interaction (`play`) tests that run in Chromium through `@storybook/addon-vitest` and Playwright.
172
+
173
+ ```bash
174
+ npm test # Unit tests (Vitest, node environment)
175
+ npm run test:storybook # Storybook interaction tests (Playwright/Chromium)
176
+ npm run test:all # Both projects
177
+ ```
178
+
179
+ The Storybook tests need Playwright's Chromium browser the first time:
180
+
181
+ ```bash
182
+ npx playwright install chromium
183
+ ```
184
+
185
+ Two more checks run in CI and are worth running before you open a release PR:
186
+
187
+ ```bash
188
+ npm run build
189
+ npm run test:ssr # Imports build/index.js in Node
190
+ ```
191
+
124
192
  ## Advanced
125
193
  ### Integrate your app with a locally installed UI Kit
126
194
 
@@ -169,27 +237,7 @@ $ rm -rf node_modules/@xola
169
237
 
170
238
  ### Troubleshooting
171
239
 
172
- #### Missing Component Styles
173
-
174
- If components are rendering without styles (e.g., Popover, Checkbox, RangeSlider), ensure both CSS imports are present:
175
-
176
- ```js
177
- import "@xola/ui-kit/index.css"; // Tailwind base + fonts
178
- import "tippy.js/dist/tippy.css";
179
- import "@xola/ui-kit/build/ui-kit.css"; // Component CSS modules
180
- ```
181
-
182
- All component-specific styles are bundled in `ui-kit.css`, including:
183
- - Popover (`.main` with arrow styles)
184
- - PopoverScroll (scrollbar customization)
185
- - Checkbox (custom checkmark)
186
- - RangeSlider (noUiSlider styling)
187
- - Sidebar (menu and scroll styles)
188
- - Skeleton (shimmer animation)
189
-
190
- #### Package Installation Issues
191
-
192
- If you encounter package related issues, try removing the following directories and running the install command again:
240
+ If you encounter some package related issues, try removing the following directories and running the install command again:
193
241
 
194
242
  ```bash
195
243
  $ cd workspace
@@ -199,16 +247,15 @@ $ npm install
199
247
 
200
248
  ### Lint & Auto-fix
201
249
 
202
- To automatically fix lint issues in this project you have the following commands:
203
-
204
250
  ```bash
205
- npm run lint # Run lint on `src` and output issues
206
- npm run lint:fix # Run lint and automatically fix any issues. Any that are not fixed are output to screen.
251
+ npm run lint # Lint `src` and auto-fix whatever can be fixed
252
+ npm run lint:ci # Lint `src` without fixing (used in CI)
253
+ npm run lint:report # Write a JSON report to eslint_report.json
207
254
  ```
208
255
 
209
256
  ## Notes
210
257
 
211
- To avoid issues with how npm v7 resolves peer dependencies, we enabled `legacy-peer-deps` rule in `.npmrc`.
258
+ This repo's `.npmrc` sets `legacy-peer-deps`. ui-kit depends on `react-day-picker` 7, whose `react` peer range stops at 17, so a strict npm install fails with `ERESOLVE` on React 18 or 19.
212
259
 
213
260
  In order to avoid issues in your projects that are using this UI Kit, use the same `.npmrc` file or always run installs with `--legacy-peer-deps` flag.
214
261
 
@@ -226,7 +273,9 @@ $ npm install some-package --legacy-peer-deps
226
273
 
227
274
  ## Publishing the Package
228
275
 
229
- Install [np](https://github.com/sindresorhus/np#readme) which will help you publish the package
276
+ The *Publish @xola/ui-kit* GitHub Actions workflow (`.github/workflows/deploy.yml`) builds and publishes the package. Run it from the Actions tab and enter the npm dist-tag; it defaults to `next`, which is what 3.x prereleases from this branch publish under. *Publish @xola/icons* does the same for the icons package.
277
+
278
+ To publish from your machine instead, install [np](https://github.com/sindresorhus/np#readme):
230
279
 
231
280
  ```bash
232
281
  npm -g install np
@@ -236,7 +285,7 @@ Once you're ready, run this command to publish your package
236
285
 
237
286
  ```bash
238
287
  npm run build
239
- np <your-new-version> --tag=latest --yolo
288
+ np <your-new-version> --tag=next --yolo
240
289
  ```
241
290
 
242
291
  Then make sure to push all the tags upstream to `xola/ui-kit` repo:
@@ -1,24 +1,29 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import n from "../helpers/classnames.js";
3
- import { CloseIcon as s } from "../icons/src/CloseIcon.js";
4
- const o = {
1
+ import e from "prop-types";
2
+ import t from "react";
3
+ import s from "../helpers/classnames.js";
4
+ import { CloseIcon as i } from "../icons/src/CloseIcon.js";
5
+ const a = {
5
6
  primary: "bg-primary-lighter text-black",
6
7
  secondary: "bg-secondary-lighter text-black",
7
8
  success: "bg-success-lighter text-black",
8
9
  warning: "bg-warning-lighter text-black",
9
10
  danger: "bg-danger-lighter text-black",
10
11
  caution: "bg-caution-lighter text-black"
11
- }, u = ({ color: r = "primary", children: a, className: l, onClose: e, ...c }) => /* @__PURE__ */ i(
12
+ }, m = ({ className: l, color: c = "primary", onClose: r, children: n, ...o }) => /* @__PURE__ */ t.createElement(
12
13
  "div",
13
14
  {
14
- className: n("ui-alert flex items-start rounded px-3 py-3 text-base leading-4", o[r], l),
15
- ...c,
16
- children: [
17
- /* @__PURE__ */ t("span", { className: "ui-alert-content w-full leading-p1", children: a }),
18
- e ? /* @__PURE__ */ t("button", { type: "button", className: "ui-alert-close ml-3 cursor-pointer hover:text-gray-dark", children: /* @__PURE__ */ t(s, { onClick: e }) }) : null
19
- ]
20
- }
15
+ className: s("ui-alert flex items-start rounded px-3 py-3 text-base leading-4", a[c], l),
16
+ ...o
17
+ },
18
+ /* @__PURE__ */ t.createElement("span", { className: "ui-alert-content w-full leading-p1" }, n),
19
+ r ? /* @__PURE__ */ t.createElement("button", { type: "button", className: "ui-alert-close ml-3 cursor-pointer hover:text-gray-dark" }, /* @__PURE__ */ t.createElement(i, { onClick: r })) : null
21
20
  );
21
+ m.propTypes = {
22
+ className: e.string,
23
+ color: e.oneOf(Object.keys(a)),
24
+ onClose: e.func,
25
+ children: e.node.isRequired
26
+ };
22
27
  export {
23
- u as Alert
28
+ m as Alert
24
29
  };
@@ -1,29 +1,40 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { Transition as m } from "@headlessui/react";
3
- const y = ({
4
- shouldShow: t = !0,
5
- shouldAppear: o = !0,
6
- tag: r = "div",
7
- enter: i = "transition-opacity duration-700",
8
- enterFrom: a = "opacity-0",
9
- enterTo: n = "opacity-100",
10
- children: p,
11
- className: e,
12
- ...s
13
- }) => /* @__PURE__ */ c(
14
- m,
1
+ import { Transition as c } from "@headlessui/react";
2
+ import r from "prop-types";
3
+ import d from "react";
4
+ const l = ({
5
+ shouldShow: o = !0,
6
+ shouldAppear: t = !0,
7
+ tag: e = "div",
8
+ enter: n = "transition-opacity duration-700",
9
+ enterFrom: i = "opacity-0",
10
+ enterTo: a = "opacity-100",
11
+ className: p,
12
+ children: s,
13
+ ...m
14
+ }) => /* @__PURE__ */ d.createElement(
15
+ c,
15
16
  {
16
- show: t,
17
- appear: o,
18
- as: r,
19
- className: e,
20
- enter: i,
21
- enterFrom: a,
22
- enterTo: n,
23
- ...s,
24
- children: p
25
- }
17
+ show: o,
18
+ appear: t,
19
+ as: e,
20
+ className: p,
21
+ enter: n,
22
+ enterFrom: i,
23
+ enterTo: a,
24
+ ...m
25
+ },
26
+ s
26
27
  );
28
+ l.propTypes = {
29
+ shouldShow: r.bool,
30
+ shouldAppear: r.bool,
31
+ tag: r.string,
32
+ enter: r.string,
33
+ enterFrom: r.string,
34
+ enterTo: r.string,
35
+ className: r.string,
36
+ children: r.node
37
+ };
27
38
  export {
28
- y as FadeIn
39
+ l as FadeIn
29
40
  };
@@ -1,7 +1,8 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { Transition as o } from "@headlessui/react";
3
- const i = ({ isOpen: r, children: a }) => /* @__PURE__ */ t("div", { className: "overflow-hidden", children: /* @__PURE__ */ t(
4
- o,
1
+ import { Transition as a } from "@headlessui/react";
2
+ import t from "prop-types";
3
+ import e from "react";
4
+ const n = ({ isOpen: r, children: o }) => /* @__PURE__ */ e.createElement("div", { className: "overflow-hidden" }, /* @__PURE__ */ e.createElement(
5
+ a,
5
6
  {
6
7
  show: r,
7
8
  appear: r,
@@ -11,10 +12,14 @@ const i = ({ isOpen: r, children: a }) => /* @__PURE__ */ t("div", { className:
11
12
  enterTo: "transform translate-y-0 opacity-100",
12
13
  leave: "transition duration-500",
13
14
  leaveFrom: "transform translate-y-0 opacity-100",
14
- leaveTo: "transform -translate-y-full opacity-0",
15
- children: a
16
- }
17
- ) });
15
+ leaveTo: "transform -translate-y-full opacity-0"
16
+ },
17
+ o
18
+ ));
19
+ n.propTypes = {
20
+ isOpen: t.bool,
21
+ children: t.node
22
+ };
18
23
  export {
19
- i as SlideDown
24
+ n as SlideDown
20
25
  };
@@ -1,21 +1,28 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { getInitials as n } from "../helpers/avatar.js";
1
+ import e from "prop-types";
2
+ import o from "react";
3
3
  import m from "../helpers/classnames.js";
4
- const o = {
4
+ import { getInitials as c } from "../utils/avatar.js";
5
+ const r = {
5
6
  tiny: "h-7 w-7 text-base",
6
7
  small: "h-10 w-10 text-base",
7
8
  medium: "h-12 w-12 text-md",
8
9
  large: "h-15 w-15 text-xl"
9
- }, f = ({ name: t, color: e = "bg-primary-lighter", size: r = "large", className: i, ...l }) => {
10
- const s = m(
10
+ }, p = ({ className: s, name: t, color: i = "bg-primary-lighter", size: a = "large", ...n }) => {
11
+ const l = m(
11
12
  "ui-avatar",
12
13
  "inline-flex items-center justify-center rounded-full text-black leading-none",
13
- o[r],
14
- e,
15
- i
14
+ r[a],
15
+ i,
16
+ s
16
17
  );
17
- return /* @__PURE__ */ a("div", { title: t, className: s, ...l, children: n(t) });
18
+ return /* @__PURE__ */ o.createElement("div", { title: t, className: l, ...n }, c(t));
19
+ };
20
+ p.propTypes = {
21
+ className: e.string,
22
+ color: e.string,
23
+ name: e.string,
24
+ size: e.oneOf(Object.keys(r))
18
25
  };
19
26
  export {
20
- f as Avatar
27
+ p as Avatar
21
28
  };
@@ -1,7 +1,7 @@
1
- import { jsxs as l } from "react/jsx-runtime";
2
- import { cloneElement as g } from "react";
3
- import r from "../helpers/classnames.js";
4
- const m = {
1
+ import e from "prop-types";
2
+ import o, { cloneElement as m } from "react";
3
+ import a from "../helpers/classnames.js";
4
+ const i = {
5
5
  primary: "bg-primary-lighter text-primary-dark",
6
6
  secondary: "bg-secondary-lighter text-black",
7
7
  success: "bg-success-lightish text-success-darker",
@@ -10,33 +10,42 @@ const m = {
10
10
  danger: "bg-danger-lightish text-danger-dark",
11
11
  problem: "bg-warning text-white",
12
12
  critical: "bg-danger text-white"
13
- }, c = {
14
- tiny: "px-2 py-0.5 h-4 text-xs",
13
+ }, n = {
14
+ tiny: "px-1.5 py-0.5 h-4 text-xs leading-xs",
15
+ // 16px
15
16
  small: "px-2 py-0.75 h-5 text-sm leading-sm",
17
+ // 20px
16
18
  medium: "px-3 py-1.5 h-7.5 text-base leading-base",
17
- large: "px-3.5 py-0.75 h-8 text-md leading-md"
18
- }, d = {
19
- tiny: "!w-2.5 !h-2.5",
20
- small: "!w-3 !h-3",
21
- medium: "!w-4 !h-4",
22
- large: "!w-4.5 !h-4.5 mr-1"
23
- }, x = ({ color: a = "primary", size: e = "small", icon: t, children: i, className: n, ...s }) => /* @__PURE__ */ l(
19
+ // 30px
20
+ large: "px-3.5 py-0.75 h-10 text-lg leading-lg"
21
+ // 40px
22
+ }, p = {
23
+ tiny: "w-2.5 h-2.5",
24
+ small: "w-3 h-3",
25
+ medium: "w-4 h-4",
26
+ large: "w-5 h-5 mr-1.5"
27
+ }, d = ({ color: s = "primary", size: t = "small", icon: r, className: l, children: c, ...g }) => /* @__PURE__ */ o.createElement(
24
28
  "span",
25
29
  {
26
- className: r(
30
+ className: a(
27
31
  "ui-badge",
28
32
  "inline-flex items-center whitespace-nowrap rounded-full",
29
- m[a],
30
- c[e],
31
- n
33
+ i[s],
34
+ n[t],
35
+ l
32
36
  ),
33
- ...s,
34
- children: [
35
- t ? g(t, { className: r("mr-1", d[e]) }) : null,
36
- i
37
- ]
38
- }
37
+ ...g
38
+ },
39
+ r ? m(r, { className: a("mr-1", p[t]) }) : null,
40
+ c
39
41
  );
42
+ d.propTypes = {
43
+ className: e.string,
44
+ color: e.oneOf(Object.keys(i)),
45
+ size: e.oneOf(Object.keys(n)),
46
+ icon: e.element,
47
+ children: e.node.isRequired
48
+ };
40
49
  export {
41
- x as Badge
50
+ d as Badge
42
51
  };