@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.
- package/README.md +136 -87
- package/build/components/Alert.js +18 -13
- package/build/components/Animation/FadeIn.js +36 -25
- package/build/components/Animation/SlideDown.js +14 -9
- package/build/components/Avatar.js +17 -10
- package/build/components/Badge.js +33 -24
- package/build/components/BottomSheet.js +114 -0
- package/build/components/Breadcrumb.js +27 -21
- package/build/components/Breakdown.js +66 -74
- package/build/components/Buttons/Button.js +53 -47
- package/build/components/Buttons/ButtonGroup.js +42 -39
- package/build/components/Buttons/SecondaryButton.js +31 -0
- package/build/components/Buttons/SubmitButton.js +72 -66
- package/build/components/Buttons/ToggleButton.js +15 -16
- package/build/components/Counter.js +10 -6
- package/build/components/DatePicker/DatePicker.helpers.js +24 -13
- package/build/components/DatePicker/DatePicker.js +196 -223
- package/build/components/DatePicker/DatePickerPopover.js +75 -66
- package/build/components/DatePicker/Day.js +35 -32
- package/build/components/DatePicker/LocalizedDayPicker.js +15 -18
- package/build/components/DatePicker/MonthGrid.js +35 -48
- package/build/components/DatePicker/MonthPicker.js +25 -20
- package/build/components/DatePicker/MonthSelector.js +39 -40
- package/build/components/DatePicker/MonthYearSelector.js +18 -39
- package/build/components/DatePicker/NavbarElement.js +26 -35
- package/build/components/DatePicker/RangeDatePicker.js +104 -123
- package/build/components/DatePicker/RelativeDateRange.js +153 -143
- package/build/components/DatePicker/UpcomingDatePicker.js +29 -25
- package/build/components/Dot/Dot.js +13 -8
- package/build/components/Dot/DotProgress.js +12 -7
- package/build/components/Drawer.js +109 -101
- package/build/components/Forms/BaseInput.js +50 -34
- package/build/components/Forms/Checkbox.js +33 -30
- package/build/components/Forms/ComboBox.js +35 -35
- package/build/components/Forms/FormGroup.js +7 -3
- package/build/components/Forms/InlineValuePopover.js +33 -39
- package/build/components/Forms/Input.js +15 -7
- package/build/components/Forms/Label.js +14 -8
- package/build/components/Forms/RangeSlider.js +41 -22
- package/build/components/Forms/Select.js +5 -6
- package/build/components/Forms/Switch.js +46 -38
- package/build/components/Forms/Textarea.js +37 -30
- package/build/components/Forms/ValuePopoverText.js +5 -8
- package/build/components/GooglePlacesAutocomplete.js +112 -0
- package/build/components/HeaderToolbar.js +30 -22
- package/build/components/ImageUpload.js +76 -79
- package/build/components/Key.js +21 -16
- package/build/components/Logo.js +12 -5
- package/build/components/Modal.js +87 -72
- package/build/components/Popover/Popover.js +40 -31
- package/build/components/Popover/PopoverList.js +43 -36
- package/build/components/Provider.js +7 -8
- package/build/components/Screens/Login.js +97 -126
- package/build/components/Search.js +114 -144
- package/build/components/Sidebar/Sidebar.Account.js +39 -46
- package/build/components/Sidebar/Sidebar.Button.js +45 -19
- package/build/components/Sidebar/Sidebar.Footer.js +8 -7
- package/build/components/Sidebar/Sidebar.Heading.js +11 -8
- package/build/components/Sidebar/Sidebar.Link.js +79 -44
- package/build/components/Sidebar/Sidebar.Menu.js +52 -28
- package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
- package/build/components/Sidebar/Sidebar.js +207 -214
- package/build/components/Sidebar/SidebarContext.js +15 -0
- package/build/components/Sidebar/sidebarWidth.js +41 -0
- package/build/components/Sidebar/useSidebarWidthState.js +115 -0
- package/build/components/Skeleton.js +19 -20
- package/build/components/Spinner.js +18 -10
- package/build/components/Table.js +86 -50
- package/build/components/Tabs/Tabs.Panel.js +9 -5
- package/build/components/Tabs/Tabs.Tab.js +28 -23
- package/build/components/Tabs/Tabs.js +23 -23
- package/build/components/Tag.js +28 -23
- package/build/components/Tooltip.js +19 -5
- package/build/components/Utilities/Currency.js +49 -42
- package/build/components/Utilities/Number.js +14 -12
- package/build/components/Utilities/Phone.js +18 -12
- package/build/helpers/environment.js +10 -0
- package/build/helpers/flash.js +45 -46
- package/build/hooks/useIsMobile.js +8 -0
- package/build/hooks/useViewportHeight.js +6 -12
- package/build/icons/src/AnnounceIcon.js +3 -4
- package/build/icons/src/BellIcon.js +0 -1
- package/build/icons/src/CalendarIcon.js +0 -1
- package/build/icons/src/CheckIcon.js +0 -1
- package/build/icons/src/ChevronDownIcon.js +4 -5
- package/build/icons/src/ChevronLeftIcon.js +0 -1
- package/build/icons/src/ChevronRightIcon.js +0 -1
- package/build/icons/src/CircleNotch.js +0 -1
- package/build/icons/src/CloseIcon.js +11 -9
- package/build/icons/src/DownArrowIcon.js +0 -1
- package/build/icons/src/ImageIcon.js +0 -1
- package/build/icons/src/SearchIcon.js +4 -5
- package/build/icons/src/TrashIcon.js +0 -1
- package/build/icons/src/WarningDiamondIcon.js +0 -1
- package/build/icons/src/helpers/icon.js +5 -9
- package/build/icons/src/images/XolaLogoSimple.js +2 -3
- package/build/index.js +143 -130
- package/build/style.css +1 -0
- package/build/theme.css +76 -0
- package/build/theme.js +2 -0
- package/build/utils/currency.js +5 -5
- package/build/{helpers → utils}/date.js +17 -20
- package/build/utils/numbers.js +12 -12
- package/build/utils/phone.js +12 -14
- package/build/utils/userLocale.js +6 -0
- package/index.css +96 -4
- package/index.d.ts +204 -0
- package/package.json +87 -77
- package/skills/README.md +27 -0
- package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
- package/tailwind.config.js +5 -2
- package/build/base.css +0 -2
- package/build/components/Alert.d.ts +0 -18
- package/build/components/Animation/FadeIn.d.ts +0 -13
- package/build/components/Animation/SlideDown.d.ts +0 -6
- package/build/components/Avatar.d.ts +0 -16
- package/build/components/Badge.d.ts +0 -28
- package/build/components/Breadcrumb.d.ts +0 -21
- package/build/components/Breakdown.d.ts +0 -63
- package/build/components/Buttons/Button.d.ts +0 -53
- package/build/components/Buttons/ButtonGroup.d.ts +0 -35
- package/build/components/Buttons/SubmitButton.d.ts +0 -11
- package/build/components/Buttons/ToggleButton.d.ts +0 -21
- package/build/components/Charts/BaseChartOptions.d.ts +0 -136
- package/build/components/Charts/HistogramOptions.d.ts +0 -192
- package/build/components/Charts/PieOptions.d.ts +0 -177
- package/build/components/Counter.d.ts +0 -5
- package/build/components/DatePicker/DatePicker.d.ts +0 -41
- package/build/components/DatePicker/DatePicker.helpers.d.ts +0 -17
- package/build/components/DatePicker/DatePickerPopover.d.ts +0 -29
- package/build/components/DatePicker/Day.d.ts +0 -13
- package/build/components/DatePicker/LocalizedDayPicker.d.ts +0 -6
- package/build/components/DatePicker/MonthGrid.d.ts +0 -11
- package/build/components/DatePicker/MonthPicker.d.ts +0 -7
- package/build/components/DatePicker/MonthSelector.d.ts +0 -8
- package/build/components/DatePicker/MonthYearSelector.d.ts +0 -8
- package/build/components/DatePicker/NavbarElement.d.ts +0 -15
- package/build/components/DatePicker/RangeDatePicker.d.ts +0 -25
- package/build/components/DatePicker/RelativeDateRange.d.ts +0 -51
- package/build/components/DatePicker/UpcomingDatePicker.d.ts +0 -11
- package/build/components/Dot/Dot.d.ts +0 -24
- package/build/components/Dot/DotProgress.d.ts +0 -6
- package/build/components/Drawer.d.ts +0 -28
- package/build/components/Forms/BaseInput.d.ts +0 -20
- package/build/components/Forms/Checkbox.d.ts +0 -10
- package/build/components/Forms/ComboBox.d.ts +0 -8
- package/build/components/Forms/FormGroup.d.ts +0 -5
- package/build/components/Forms/InlineValuePopover.d.ts +0 -17
- package/build/components/Forms/Input.d.ts +0 -6
- package/build/components/Forms/Label.d.ts +0 -7
- package/build/components/Forms/RangeSlider.d.ts +0 -33
- package/build/components/Forms/Select.d.ts +0 -5
- package/build/components/Forms/Switch.d.ts +0 -46
- package/build/components/Forms/Textarea.d.ts +0 -6
- package/build/components/Forms/ValuePopoverText.d.ts +0 -6
- package/build/components/GooglePlacesAutocomplete.d.ts +0 -14
- package/build/components/HeaderToolbar.d.ts +0 -21
- package/build/components/ImageUpload.d.ts +0 -17
- package/build/components/Key.d.ts +0 -6
- package/build/components/Logo.d.ts +0 -19
- package/build/components/Modal.d.ts +0 -52
- package/build/components/Popover/Popover.d.ts +0 -20
- package/build/components/Popover/PopoverList.d.ts +0 -25
- package/build/components/Provider.d.ts +0 -18
- package/build/components/Screens/Login.d.ts +0 -25
- package/build/components/Search.d.ts +0 -16
- package/build/components/Sidebar/Sidebar.Account.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.Button.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Footer.d.ts +0 -8
- package/build/components/Sidebar/Sidebar.Heading.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Link.d.ts +0 -24
- package/build/components/Sidebar/Sidebar.Menu.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.d.ts +0 -58
- package/build/components/Sidebar/index.d.ts +0 -8
- package/build/components/Skeleton.d.ts +0 -13
- package/build/components/Spinner.d.ts +0 -26
- package/build/components/Table.d.ts +0 -59
- package/build/components/Tabs/Tabs.Panel.d.ts +0 -9
- package/build/components/Tabs/Tabs.Tab.d.ts +0 -19
- package/build/components/Tabs/Tabs.d.ts +0 -27
- package/build/components/Tabs/index.d.ts +0 -4
- package/build/components/Tag.d.ts +0 -25
- package/build/components/Tooltip.d.ts +0 -8
- package/build/components/Utilities/Currency.d.ts +0 -32
- package/build/components/Utilities/Number.d.ts +0 -8
- package/build/components/Utilities/Phone.d.ts +0 -8
- package/build/full.css +0 -2
- package/build/helpers/avatar.d.ts +0 -1
- package/build/helpers/avatar.js +0 -8
- package/build/helpers/browser.d.ts +0 -2
- package/build/helpers/children.d.ts +0 -3
- package/build/helpers/classnames.d.ts +0 -5
- package/build/helpers/currency.d.ts +0 -2
- package/build/helpers/currency.js +0 -11
- package/build/helpers/date.d.ts +0 -12
- package/build/helpers/flash.d.ts +0 -21
- package/build/helpers/numbers.d.ts +0 -4
- package/build/helpers/numbers.js +0 -23
- package/build/helpers/phone.d.ts +0 -11
- package/build/helpers/phone.js +0 -25
- package/build/hooks/useId.d.ts +0 -1
- package/build/hooks/useId.js +0 -9
- package/build/hooks/useIsClient.d.ts +0 -1
- package/build/hooks/useViewportHeight.d.ts +0 -1
- package/build/icons/src/helpers/classnames.js +0 -8
- package/build/index.d.ts +0 -66
- package/build/theme.d.ts +0 -413
- package/build/types/index.d.ts +0 -22
- package/build/types/migration.d.ts +0 -2
- package/build/ui-kit.css +0 -1
- package/build/utils/avatar.d.ts +0 -1
- package/build/utils/currency.d.ts +0 -2
- package/build/utils/index.d.ts +0 -4
- package/build/utils/numbers.d.ts +0 -4
- 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
|
-
|
|
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
|
|
15
|
-
-
|
|
16
|
-
-
|
|
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
|
-
|
|
67
|
+
UI kit expects you already have a working React dev environment with PostCSS support.
|
|
33
68
|
|
|
34
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
-
plugins: {
|
|
53
|
-
tailwindcss: {},
|
|
54
|
-
autoprefixer: {},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
75
|
+
import { Button } from "@xola/ui-kit";
|
|
57
76
|
```
|
|
58
77
|
|
|
59
|
-
####
|
|
78
|
+
#### Tailwind v3 projects
|
|
60
79
|
|
|
61
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
export { default } from "@xola/ui-kit/
|
|
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
|
-
|
|
88
|
+
Import main CSS files in your project:
|
|
89
|
+
|
|
69
90
|
```js
|
|
70
|
-
|
|
91
|
+
import "@xola/ui-kit/index.css";
|
|
92
|
+
import "@xola/ui-kit/build/style.css";
|
|
71
93
|
```
|
|
72
94
|
|
|
73
|
-
|
|
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
|
-
|
|
99
|
+
#### Tailwind v4 projects
|
|
76
100
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
82
|
-
|
|
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
|
-
|
|
109
|
+
```js
|
|
110
|
+
import "@xola/ui-kit/build/style.css";
|
|
111
|
+
```
|
|
86
112
|
|
|
87
|
-
|
|
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
|
-
|
|
116
|
+
```css
|
|
117
|
+
@import "tailwindcss";
|
|
90
118
|
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
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 #
|
|
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
|
-
|
|
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
|
|
206
|
-
npm run lint:
|
|
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
|
-
|
|
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
|
-
|
|
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=
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
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
|
-
},
|
|
12
|
+
}, m = ({ className: l, color: c = "primary", onClose: r, children: n, ...o }) => /* @__PURE__ */ t.createElement(
|
|
12
13
|
"div",
|
|
13
14
|
{
|
|
14
|
-
className:
|
|
15
|
-
...
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
28
|
+
m as Alert
|
|
24
29
|
};
|
|
@@ -1,29 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
className:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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:
|
|
17
|
-
appear:
|
|
18
|
-
as:
|
|
19
|
-
className:
|
|
20
|
-
enter:
|
|
21
|
-
enterFrom:
|
|
22
|
-
enterTo:
|
|
23
|
-
...
|
|
24
|
-
|
|
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
|
-
|
|
39
|
+
l as FadeIn
|
|
29
40
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
24
|
+
n as SlideDown
|
|
20
25
|
};
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import o from "react";
|
|
3
3
|
import m from "../helpers/classnames.js";
|
|
4
|
-
|
|
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
|
-
},
|
|
10
|
-
const
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
r[a],
|
|
15
|
+
i,
|
|
16
|
+
s
|
|
16
17
|
);
|
|
17
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
27
|
+
p as Avatar
|
|
21
28
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cloneElement as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
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
|
-
},
|
|
14
|
-
tiny: "px-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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:
|
|
30
|
+
className: a(
|
|
27
31
|
"ui-badge",
|
|
28
32
|
"inline-flex items-center whitespace-nowrap rounded-full",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
i[s],
|
|
34
|
+
n[t],
|
|
35
|
+
l
|
|
32
36
|
),
|
|
33
|
-
...
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
50
|
+
d as Badge
|
|
42
51
|
};
|