@melv1c/ui-kit 1.3.0 → 1.5.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 +2 -32
- package/dist/index.cjs +54 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -56
- package/dist/index.d.ts +19 -56
- package/dist/index.js +55 -51
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ This library provides a collection of reusable, accessible UI components that fo
|
|
|
12
12
|
|
|
13
13
|
## Stack
|
|
14
14
|
|
|
15
|
-
- **React
|
|
15
|
+
- **React 19** - JavaScript library for building UI
|
|
16
16
|
- **TypeScript** - Type-safe JavaScript
|
|
17
17
|
- **Tailwind CSS** - Utility-first CSS framework
|
|
18
18
|
- **Storybook** - Component documentation and testing
|
|
@@ -22,7 +22,7 @@ This library provides a collection of reusable, accessible UI components that fo
|
|
|
22
22
|
|
|
23
23
|
### Prerequisites
|
|
24
24
|
|
|
25
|
-
- Node.js
|
|
25
|
+
- Node.js 22+
|
|
26
26
|
- npm
|
|
27
27
|
|
|
28
28
|
### Setup
|
|
@@ -33,33 +33,3 @@ npm run dev
|
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
This starts the Storybook dev server on `http://localhost:6006`.
|
|
36
|
-
|
|
37
|
-
### Available Scripts
|
|
38
|
-
|
|
39
|
-
| Command | Description |
|
|
40
|
-
| ------------------------- | --------------------------------------- |
|
|
41
|
-
| `npm run dev` | Start Storybook dev server on port 6006 |
|
|
42
|
-
| `npm run build` | Build the library with tsup |
|
|
43
|
-
| `npm run build:watch` | Build in watch mode |
|
|
44
|
-
| `npm run lint` | Run ESLint |
|
|
45
|
-
| `npm run lint:fix` | Fix ESLint issues |
|
|
46
|
-
| `npm run format` | Format code with Prettier |
|
|
47
|
-
| `npm run format:check` | Check code formatting |
|
|
48
|
-
| `npm run build-storybook` | Build static Storybook |
|
|
49
|
-
|
|
50
|
-
## Contributing
|
|
51
|
-
|
|
52
|
-
Contributions are welcome! Please follow these steps:
|
|
53
|
-
|
|
54
|
-
1. Create a feature branch (`git checkout -b feature/your-feature`)
|
|
55
|
-
2. Make your changes and commit (`git commit -m 'Add feature'`)
|
|
56
|
-
3. Push to the branch (`git push origin feature/your-feature`)
|
|
57
|
-
4. Open a pull request
|
|
58
|
-
|
|
59
|
-
When adding components:
|
|
60
|
-
|
|
61
|
-
1. Create your component in the appropriate folder under `src/components/`
|
|
62
|
-
2. Add a `.stories.tsx` file for Storybook documentation
|
|
63
|
-
3. Export the component from the folder's `index.ts`
|
|
64
|
-
4. Run `npm run lint:fix` and `npm run format` before submitting
|
|
65
|
-
5. Ensure all tests pass
|
package/dist/index.cjs
CHANGED
|
@@ -4518,65 +4518,69 @@ function DateTimePicker({
|
|
|
4518
4518
|
] })
|
|
4519
4519
|
] });
|
|
4520
4520
|
}
|
|
4521
|
-
function
|
|
4521
|
+
function UIKitProvider({
|
|
4522
4522
|
children,
|
|
4523
|
-
|
|
4524
|
-
|
|
4523
|
+
hasToaster = true,
|
|
4524
|
+
i18nConfig = { locale: "en" },
|
|
4525
|
+
loadingComponent = null
|
|
4525
4526
|
}) {
|
|
4526
4527
|
const [isReady, setIsReady] = React9.useState(false);
|
|
4527
|
-
const
|
|
4528
|
+
const i18nRef = React9.useRef(!i18nConfig.instance ? i18n__default.default.createInstance() : null);
|
|
4529
|
+
const instance = i18nConfig.instance || i18nRef.current;
|
|
4528
4530
|
React9.useEffect(() => {
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
ui: mergedTranslations
|
|
4531
|
+
if (i18nConfig.locale && !instance.isInitialized) {
|
|
4532
|
+
instance.use(reactI18next.initReactI18next).init({
|
|
4533
|
+
lng: i18nConfig.locale,
|
|
4534
|
+
fallbackLng: i18nConfig.locale,
|
|
4535
|
+
defaultNS: "ui",
|
|
4536
|
+
resources: {},
|
|
4537
|
+
interpolation: {
|
|
4538
|
+
escapeValue: false
|
|
4538
4539
|
}
|
|
4539
|
-
}
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
return null;
|
|
4547
|
-
}
|
|
4548
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactI18next.I18nextProvider, { i18n: instance, children });
|
|
4549
|
-
}
|
|
4550
|
-
function TranslationProvider({
|
|
4551
|
-
i18n: i18n2,
|
|
4552
|
-
children,
|
|
4553
|
-
fallback = null,
|
|
4554
|
-
overrides
|
|
4555
|
-
}) {
|
|
4556
|
-
const [isReady, setIsReady] = React9.useState(false);
|
|
4540
|
+
}).then(() => {
|
|
4541
|
+
setIsReady(true);
|
|
4542
|
+
});
|
|
4543
|
+
} else {
|
|
4544
|
+
setIsReady(true);
|
|
4545
|
+
}
|
|
4546
|
+
}, [i18nConfig, instance]);
|
|
4557
4547
|
React9.useEffect(() => {
|
|
4558
|
-
|
|
4559
|
-
const
|
|
4560
|
-
const
|
|
4561
|
-
|
|
4562
|
-
|
|
4548
|
+
if (i18nConfig.locale) {
|
|
4549
|
+
const baseTranslations = chunkH4O6RXFK_cjs.locales_exports[i18nConfig.locale] ?? {};
|
|
4550
|
+
const mergedTranslations = i18nConfig.overrides ? { ...baseTranslations, ...i18nConfig.overrides } : baseTranslations;
|
|
4551
|
+
instance.addResourceBundle(
|
|
4552
|
+
i18nConfig.locale,
|
|
4553
|
+
"ui",
|
|
4554
|
+
mergedTranslations,
|
|
4555
|
+
true,
|
|
4556
|
+
true
|
|
4557
|
+
);
|
|
4558
|
+
instance.changeLanguage(i18nConfig.locale);
|
|
4559
|
+
} else if (i18nConfig.instance) {
|
|
4560
|
+
for (const [lng, resources] of Object.entries(chunkH4O6RXFK_cjs.locales_exports)) {
|
|
4561
|
+
const languageOverrides = i18nConfig.overrides?.[lng];
|
|
4562
|
+
if (instance.hasResourceBundle(lng, "ui") && !languageOverrides) {
|
|
4563
|
+
continue;
|
|
4564
|
+
}
|
|
4565
|
+
const mergedResources = languageOverrides ? { ...resources, ...languageOverrides } : resources;
|
|
4566
|
+
instance.addResourceBundle(lng, "ui", mergedResources, true, true);
|
|
4563
4567
|
}
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
if (supportedLanguages.includes(lng)) continue;
|
|
4571
|
-
i18n2.addResourceBundle(lng, "ui", resources, true, true);
|
|
4568
|
+
if (i18nConfig.overrides) {
|
|
4569
|
+
const supportedLanguages = Object.keys(chunkH4O6RXFK_cjs.locales_exports);
|
|
4570
|
+
for (const [lng, resources] of Object.entries(i18nConfig.overrides)) {
|
|
4571
|
+
if (supportedLanguages.includes(lng)) continue;
|
|
4572
|
+
instance.addResourceBundle(lng, "ui", resources, true, true);
|
|
4573
|
+
}
|
|
4572
4574
|
}
|
|
4573
4575
|
}
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
4576
|
+
}, [i18nConfig, instance]);
|
|
4577
|
+
if (!isReady || !instance.isInitialized) {
|
|
4578
|
+
return loadingComponent;
|
|
4578
4579
|
}
|
|
4579
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
4580
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactI18next.I18nextProvider, { i18n: instance, children: [
|
|
4581
|
+
children,
|
|
4582
|
+
hasToaster && /* @__PURE__ */ jsxRuntime.jsx(Toaster, {})
|
|
4583
|
+
] });
|
|
4580
4584
|
}
|
|
4581
4585
|
|
|
4582
4586
|
Object.defineProperty(exports, "Skeleton", {
|
|
@@ -4760,7 +4764,6 @@ exports.HoverCard = HoverCard;
|
|
|
4760
4764
|
exports.HoverCardContent = HoverCardContent;
|
|
4761
4765
|
exports.HoverCardTrigger = HoverCardTrigger;
|
|
4762
4766
|
exports.Label = Label3;
|
|
4763
|
-
exports.LocaleProvider = LocaleProvider;
|
|
4764
4767
|
exports.LoginForm = LoginForm;
|
|
4765
4768
|
exports.Menubar = Menubar;
|
|
4766
4769
|
exports.MenubarCheckboxItem = MenubarCheckboxItem;
|
|
@@ -4862,7 +4865,7 @@ exports.Tooltip = Tooltip;
|
|
|
4862
4865
|
exports.TooltipContent = TooltipContent;
|
|
4863
4866
|
exports.TooltipProvider = TooltipProvider;
|
|
4864
4867
|
exports.TooltipTrigger = TooltipTrigger;
|
|
4865
|
-
exports.
|
|
4868
|
+
exports.UIKitProvider = UIKitProvider;
|
|
4866
4869
|
exports.appleIconVariants = appleIconVariants;
|
|
4867
4870
|
exports.badgeVariants = badgeVariants;
|
|
4868
4871
|
exports.buttonGroupVariants = buttonGroupVariants;
|