@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/README.md CHANGED
@@ -7,29 +7,68 @@ 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
15
- - NPM v7 or higher
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)
16
19
 
17
20
  ### Usage
18
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
+
19
55
  Install the UI kit:
20
56
 
21
57
  ```bash
22
- npm install @xola/ui-kit
58
+ npm install @xola/ui-kit@next --legacy-peer-deps
23
59
  ```
24
60
 
25
61
  Install peer dependencies:
26
62
 
27
63
  ```bash
28
- npm install autoprefixer postcss tailwindcss vite @types/react @types/react-dom
64
+ npm install react react-dom autoprefixer postcss tailwindcss vite @types/react @types/react-dom --legacy-peer-deps
29
65
  ```
30
66
 
31
67
  UI kit expects you already have a working React dev environment with PostCSS support.
32
68
 
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.
71
+
33
72
  Import and use the components:
34
73
 
35
74
  ```js
@@ -38,11 +77,12 @@ import { Button } from "@xola/ui-kit";
38
77
 
39
78
  #### Tailwind v3 projects
40
79
 
41
- Create PostCSS and Tailwind config files:
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:
42
82
 
43
83
  ```bash
44
- echo 'module.exports = require("@xola/ui-kit/tailwind.config");' > tailwind.config.js
45
- echo 'module.exports = require("@xola/ui-kit/postcss.config");' > postcss.config.js
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
46
86
  ```
47
87
 
48
88
  Import main CSS files in your project:
@@ -80,20 +120,35 @@ aren't directly compatible). Two things bridge the gap:
80
120
  own utility classes (px-4.5, disabled:bg-gray-lighter, etc.) won't be
81
121
  generated unless something in your own source happens to use the same
82
122
  class string. Opt ui-kit's bundle back in explicitly. */
83
- @source "./node_modules/@xola/ui-kit/build/ui-kit.es.js";
123
+ @source "../node_modules/@xola/ui-kit/build/**/*.js";
84
124
 
85
125
  /* ui-kit's color palette (primary, gray, success, warning, ...),
86
126
  auto-generated from its tailwind.config.js. Import this instead of
87
- hand-copying hex values — otherwise names like "primary" will
127
+ hand-copying hex values, otherwise names like "primary" will
88
128
  silently resolve to your own theme's colors instead of Xola's. */
89
129
  @import "@xola/ui-kit/build/theme.css";
90
130
  ```
91
131
 
92
132
  If your app defines its own `primary`/`secondary`/`success`/etc. tokens (e.g.
93
- via shadcn/ui), those will collide with ui-kit's — `build/theme.css` must be
133
+ via shadcn/ui), those will collide with ui-kit's, so `build/theme.css` must be
94
134
  imported after your own theme so ui-kit's classNames resolve to ui-kit's
95
135
  colors, not yours.
96
136
 
137
+ ### Agent skills
138
+
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.
151
+
97
152
  ## Development
98
153
 
99
154
  ### Installation
@@ -101,7 +156,7 @@ colors, not yours.
101
156
  Install all required dependencies:
102
157
 
103
158
  ```bash
104
- $ nvm use # Project needs Node.js v20 with NPM v7
159
+ $ nvm use # .nvmrc pins Node.js 20; any newer version works too
105
160
  $ npm install
106
161
  ```
107
162
 
@@ -111,6 +166,29 @@ Start the Storybook development server:
111
166
  $ npm start
112
167
  ```
113
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
+
114
192
  ## Advanced
115
193
  ### Integrate your app with a locally installed UI Kit
116
194
 
@@ -169,16 +247,15 @@ $ npm install
169
247
 
170
248
  ### Lint & Auto-fix
171
249
 
172
- To automatically fix lint issues in this project you have the following commands:
173
-
174
250
  ```bash
175
- npm run lint # Run lint on `src` and output issues
176
- 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
177
254
  ```
178
255
 
179
256
  ## Notes
180
257
 
181
- 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.
182
259
 
183
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.
184
261
 
@@ -196,7 +273,9 @@ $ npm install some-package --legacy-peer-deps
196
273
 
197
274
  ## Publishing the Package
198
275
 
199
- 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):
200
279
 
201
280
  ```bash
202
281
  npm -g install np
@@ -206,7 +285,7 @@ Once you're ready, run this command to publish your package
206
285
 
207
286
  ```bash
208
287
  npm run build
209
- np <your-new-version> --tag=latest --yolo
288
+ np <your-new-version> --tag=next --yolo
210
289
  ```
211
290
 
212
291
  Then make sure to push all the tags upstream to `xola/ui-kit` repo:
@@ -0,0 +1,29 @@
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 = {
6
+ primary: "bg-primary-lighter text-black",
7
+ secondary: "bg-secondary-lighter text-black",
8
+ success: "bg-success-lighter text-black",
9
+ warning: "bg-warning-lighter text-black",
10
+ danger: "bg-danger-lighter text-black",
11
+ caution: "bg-caution-lighter text-black"
12
+ }, m = ({ className: l, color: c = "primary", onClose: r, children: n, ...o }) => /* @__PURE__ */ t.createElement(
13
+ "div",
14
+ {
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
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
+ };
27
+ export {
28
+ m as Alert
29
+ };
@@ -0,0 +1,40 @@
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,
16
+ {
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
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
+ };
38
+ export {
39
+ l as FadeIn
40
+ };
@@ -0,0 +1,25 @@
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,
6
+ {
7
+ show: r,
8
+ appear: r,
9
+ as: "div",
10
+ enter: "transition-all duration-500",
11
+ enterFrom: "transform -translate-y-full opacity-0",
12
+ enterTo: "transform translate-y-0 opacity-100",
13
+ leave: "transition duration-500",
14
+ leaveFrom: "transform translate-y-0 opacity-100",
15
+ leaveTo: "transform -translate-y-full opacity-0"
16
+ },
17
+ o
18
+ ));
19
+ n.propTypes = {
20
+ isOpen: t.bool,
21
+ children: t.node
22
+ };
23
+ export {
24
+ n as SlideDown
25
+ };
@@ -0,0 +1,28 @@
1
+ import e from "prop-types";
2
+ import o from "react";
3
+ import m from "../helpers/classnames.js";
4
+ import { getInitials as c } from "../utils/avatar.js";
5
+ const r = {
6
+ tiny: "h-7 w-7 text-base",
7
+ small: "h-10 w-10 text-base",
8
+ medium: "h-12 w-12 text-md",
9
+ large: "h-15 w-15 text-xl"
10
+ }, p = ({ className: s, name: t, color: i = "bg-primary-lighter", size: a = "large", ...n }) => {
11
+ const l = m(
12
+ "ui-avatar",
13
+ "inline-flex items-center justify-center rounded-full text-black leading-none",
14
+ r[a],
15
+ i,
16
+ s
17
+ );
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))
25
+ };
26
+ export {
27
+ p as Avatar
28
+ };
@@ -0,0 +1,51 @@
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
+ primary: "bg-primary-lighter text-primary-dark",
6
+ secondary: "bg-secondary-lighter text-black",
7
+ success: "bg-success-lightish text-success-darker",
8
+ warning: "bg-warning-lightish text-warning-darker",
9
+ caution: "bg-caution-lighter text-caution-dark",
10
+ danger: "bg-danger-lightish text-danger-dark",
11
+ problem: "bg-warning text-white",
12
+ critical: "bg-danger text-white"
13
+ }, n = {
14
+ tiny: "px-1.5 py-0.5 h-4 text-xs leading-xs",
15
+ // 16px
16
+ small: "px-2 py-0.75 h-5 text-sm leading-sm",
17
+ // 20px
18
+ medium: "px-3 py-1.5 h-7.5 text-base leading-base",
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(
28
+ "span",
29
+ {
30
+ className: a(
31
+ "ui-badge",
32
+ "inline-flex items-center whitespace-nowrap rounded-full",
33
+ i[s],
34
+ n[t],
35
+ l
36
+ ),
37
+ ...g
38
+ },
39
+ r ? m(r, { className: a("mr-1", p[t]) }) : null,
40
+ c
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
+ };
49
+ export {
50
+ d as Badge
51
+ };
@@ -0,0 +1,114 @@
1
+ import { Transition as n, Dialog as h } from "@headlessui/react";
2
+ import s from "clsx";
3
+ import { noop as g } from "lodash-es";
4
+ import t from "prop-types";
5
+ import e, { Fragment as m } from "react";
6
+ import { isIosBrowser as v } from "../helpers/browser.js";
7
+ import { useViewportHeight as N } from "../hooks/useViewportHeight.js";
8
+ import { CloseIcon as E } from "../icons/src/CloseIcon.js";
9
+ const l = ({
10
+ isOpen: a = !1,
11
+ // Configurable: when true, tapping the dark overlay closes the sheet. Default false keeps parity
12
+ // with Modal. Closing is wired to the overlay's own onClick (not the Dialog's built-in
13
+ // outside-click) so interacting with popovers portaled outside the sheet — the DatePicker
14
+ // calendar, the ComboBox menu — is never mistaken for an outside click.
15
+ shouldCloseOnOutsideClick: o = !1,
16
+ onClose: r,
17
+ children: i,
18
+ className: y
19
+ }) => {
20
+ const u = N(), f = v(), x = () => {
21
+ o && r();
22
+ }, b = f && u ? { maxHeight: `${Math.round(u * 0.9)}px` } : void 0;
23
+ return /* @__PURE__ */ e.createElement(n, { appear: !0, show: a, as: m }, /* @__PURE__ */ e.createElement(h, { as: "div", className: "ui-bottom-sheet fixed inset-0 z-30", onClose: g }, /* @__PURE__ */ e.createElement(
24
+ n.Child,
25
+ {
26
+ as: m,
27
+ enter: "ease-out duration-300",
28
+ enterFrom: "opacity-0",
29
+ enterTo: "opacity-100",
30
+ leave: "ease-in duration-200",
31
+ leaveFrom: "opacity-100",
32
+ leaveTo: "opacity-0"
33
+ },
34
+ /* @__PURE__ */ e.createElement(
35
+ "div",
36
+ {
37
+ className: "ui-bottom-sheet-overlay fixed inset-0 bg-black bg-opacity-80 transition-opacity",
38
+ "aria-hidden": "true",
39
+ onClick: x
40
+ }
41
+ )
42
+ ), /* @__PURE__ */ e.createElement(
43
+ n.Child,
44
+ {
45
+ as: m,
46
+ enter: "transform transition ease-out duration-300",
47
+ enterFrom: "translate-y-full",
48
+ enterTo: "translate-y-0",
49
+ leave: "transform transition ease-in duration-200",
50
+ leaveFrom: "translate-y-0",
51
+ leaveTo: "translate-y-full"
52
+ },
53
+ /* @__PURE__ */ e.createElement(
54
+ "div",
55
+ {
56
+ style: b,
57
+ className: s(
58
+ y,
59
+ "ui-bottom-sheet-panel fixed inset-x-0 bottom-0 flex max-h-[90dvh] w-full flex-col rounded-t-2xl bg-white px-6 pb-8 pt-6 text-left shadow-xl"
60
+ )
61
+ },
62
+ /* @__PURE__ */ e.createElement(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ "aria-label": "Close",
67
+ className: "absolute right-4 top-4 z-10 p-1 text-black hover:text-gray-darker",
68
+ onClick: () => r()
69
+ },
70
+ /* @__PURE__ */ e.createElement(E, null)
71
+ ),
72
+ i
73
+ )
74
+ )));
75
+ };
76
+ l.propTypes = {
77
+ isOpen: t.bool.isRequired,
78
+ shouldCloseOnOutsideClick: t.bool,
79
+ onClose: t.func.isRequired,
80
+ children: t.node.isRequired,
81
+ className: t.string
82
+ };
83
+ const c = ({ children: a, description: o, className: r, ...i }) => /* @__PURE__ */ e.createElement(
84
+ h.Title,
85
+ {
86
+ as: "div",
87
+ className: s(r, "ui-bottom-sheet-header shrink-0 px-8 text-center"),
88
+ ...i
89
+ },
90
+ /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-6 text-black" }, a),
91
+ o ? /* @__PURE__ */ e.createElement("p", { className: "mt-2 text-base font-normal leading-normal text-gray-darker" }, o) : null
92
+ );
93
+ c.propTypes = {
94
+ children: t.node.isRequired,
95
+ description: t.string,
96
+ className: t.string
97
+ };
98
+ c.displayName = "BottomSheet.Header";
99
+ l.Header = c;
100
+ const d = ({ className: a, ...o }) => /* @__PURE__ */ e.createElement("div", { className: s(a, "ui-bottom-sheet-body mt-6 min-h-0 overflow-y-auto"), ...o });
101
+ d.propTypes = {
102
+ className: t.string
103
+ };
104
+ d.displayName = "BottomSheet.Body";
105
+ l.Body = d;
106
+ const p = ({ className: a, ...o }) => /* @__PURE__ */ e.createElement("div", { className: s(a, "ui-bottom-sheet-footer mt-6 flex shrink-0 gap-3 [&>*]:flex-1"), ...o });
107
+ p.propTypes = {
108
+ className: t.string
109
+ };
110
+ p.displayName = "BottomSheet.Footer";
111
+ l.Footer = p;
112
+ export {
113
+ l as BottomSheet
114
+ };
@@ -0,0 +1,33 @@
1
+ import e from "prop-types";
2
+ import r, { Children as i } from "react";
3
+ import a from "../helpers/classnames.js";
4
+ const n = ({ className: m, classNames: t = {}, separator: s = "/", children: c, ...l }) => {
5
+ const p = i.count(c) - 1;
6
+ return /* @__PURE__ */ r.createElement("div", { className: a("ui-breadcrumb", "whitespace-nowrap text-2xl font-semibold", m), ...l }, i.map(c, (d, u) => {
7
+ const o = u >= p;
8
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("span", { className: a(t.item, o ? "text-black" : "text-gray-dark") }, d), o ? null : /* @__PURE__ */ r.createElement("span", { className: a(t.separator, "mx-2 text-gray-dark") }, s));
9
+ }));
10
+ };
11
+ n.propTypes = {
12
+ className: e.string,
13
+ classNames: e.object,
14
+ separator: e.string,
15
+ children: e.oneOfType([e.arrayOf(e.node), e.node])
16
+ };
17
+ n.Item = ({ className: m, onClick: t, children: s }) => /* @__PURE__ */ r.createElement(
18
+ "div",
19
+ {
20
+ className: a("ui-breadcrumb-item inline", t && "cursor-pointer hover:underline", m),
21
+ onClick: t
22
+ },
23
+ s
24
+ );
25
+ n.Item.displayName = "Breadcrumb.Item";
26
+ n.Item.propTypes = {
27
+ className: e.string,
28
+ onClick: e.func,
29
+ children: e.node.isRequired
30
+ };
31
+ export {
32
+ n as Breadcrumb
33
+ };
@@ -0,0 +1,81 @@
1
+ import { isNumber as N } from "lodash-es";
2
+ import t from "prop-types";
3
+ import e, { useMemo as x, createContext as S, useContext as y } from "react";
4
+ import a from "../helpers/classnames.js";
5
+ import { Currency as w } from "./Utilities/Currency.js";
6
+ const p = {
7
+ default: "text-gray-darker",
8
+ black: "text-black",
9
+ primary: "text-primary",
10
+ secondary: "text-secondary",
11
+ warning: "text-warning",
12
+ success: "text-success",
13
+ danger: "text-danger",
14
+ caution: "text-caution"
15
+ }, b = S(), s = ({ children: r, className: o, currency: l, locale: n, ...c }) => {
16
+ const d = x(() => ({ currency: l, locale: n }), [l, n]);
17
+ return /* @__PURE__ */ e.createElement(b.Provider, { value: d }, /* @__PURE__ */ e.createElement("table", { className: a("ui-breakdown", "w-full", o), ...c }, /* @__PURE__ */ e.createElement("tbody", null, r)));
18
+ };
19
+ s.propTypes = {
20
+ children: t.node,
21
+ className: t.string,
22
+ currency: t.string.isRequired,
23
+ locale: t.string
24
+ };
25
+ const k = ({
26
+ info: r,
27
+ methodIcon: o,
28
+ secondary: l,
29
+ value: n,
30
+ color: c = "default",
31
+ className: d,
32
+ classNames: m = { key: "", children: "", info: "", value: "" },
33
+ children: i,
34
+ ...u
35
+ }) => {
36
+ const { currency: h, locale: E } = y(b) ?? {};
37
+ return /* @__PURE__ */ e.createElement("tr", { className: a("ui-breakdown-item", p[c], d), ...u }, /* @__PURE__ */ e.createElement("td", { colSpan: 2, className: a("break-words text-left leading-none", m.key) }, /* @__PURE__ */ e.createElement("span", { className: "mr-0.5" }, o), /* @__PURE__ */ e.createElement("span", { className: a("mr-1 break-normal md:break-all", m.children) }, i ?? ""), /* @__PURE__ */ e.createElement("span", { className: a("text-sm", m.info) }, r && /* @__PURE__ */ e.createElement("span", { className: "mr-2 rounded bg-white p-1 uppercase text-black empty:hidden" }, r), l && /* @__PURE__ */ e.createElement("span", { className: "empty:hidden" }, l))), /* @__PURE__ */ e.createElement("td", { className: a("w-[1%] whitespace-nowrap pl-4 text-right", m.value) }, N(n) ? /* @__PURE__ */ e.createElement(w, { shouldRemoveTrailingZeroes: !1, currency: h, locale: E }, n) : /* @__PURE__ */ e.createElement("span", null, n)));
38
+ };
39
+ k.propTypes = {
40
+ children: t.node,
41
+ info: t.node,
42
+ methodIcon: t.node,
43
+ secondary: t.node,
44
+ value: t.node,
45
+ className: t.string,
46
+ classNames: t.object,
47
+ color: t.oneOf(Object.keys(p))
48
+ };
49
+ s.Item = k;
50
+ s.Item.displayName = "Breakdown.Item";
51
+ const f = ({
52
+ info: r,
53
+ value: o,
54
+ color: l = "black",
55
+ className: n,
56
+ classNames: c = { children: "", info: "", value: "" },
57
+ children: d,
58
+ ...m
59
+ }) => {
60
+ const { currency: i, locale: u } = y(b) ?? {};
61
+ return /* @__PURE__ */ e.createElement("tr", { className: a("ui-breakdown-subtotal-item", "font-bold", p[l], n), ...m }, /* @__PURE__ */ e.createElement("td", { className: a("pt-1 pb-4 text-left", c.children) }, d), /* @__PURE__ */ e.createElement("td", { className: a("whitespace-nowrap pt-1 pb-4 text-right", c.info) }, r), /* @__PURE__ */ e.createElement("td", { className: a("w-[1%] whitespace-nowrap pt-1 pb-4 pl-4 text-right", c.value) }, /* @__PURE__ */ e.createElement(w, { shouldRemoveTrailingZeroes: !1, currency: i, locale: u }, o)));
62
+ };
63
+ f.propTypes = {
64
+ children: t.node,
65
+ info: t.node,
66
+ value: t.node,
67
+ className: t.string,
68
+ classNames: t.object,
69
+ color: t.oneOf(Object.keys(p))
70
+ };
71
+ s.SubtotalItem = f;
72
+ s.SubtotalItem.displayName = "Breakdown.SubtotalItem";
73
+ const g = ({ className: r, ...o }) => /* @__PURE__ */ e.createElement("tr", { className: a("ui-breakdown-separator", r), ...o }, /* @__PURE__ */ e.createElement("td", { colSpan: 3, className: "border-b border-gray-light pb-1" }));
74
+ g.propTypes = {
75
+ className: t.string
76
+ };
77
+ s.Separator = g;
78
+ s.Separator.displayName = "Breakdown.Separator";
79
+ export {
80
+ s as Breakdown
81
+ };