aplance-ui 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/package.json +1 -1
- package/registry/components/primitives/icon/icon.tsx +4 -6
- package/registry/components/primitives/modal/modal.module.css +5 -0
- package/registry/components/primitives/modal/modal.tsx +32 -34
- package/registry/components/primitives/popover/popover-context.ts +33 -29
- package/registry/components/primitives/popover/popover.module.css +4 -2
- package/registry/components/primitives/popover/popover.tsx +150 -37
- package/registry/components/ui/accordion/accordion.module.css +52 -0
- package/registry/components/ui/accordion/accordion.tsx +97 -25
- package/registry/components/ui/avatar/avatar.tsx +2 -2
- package/registry/components/ui/breadcrumbs/breadcrumbs.module.css +9 -9
- package/registry/components/ui/button/button.module.css +43 -5
- package/registry/components/ui/button/button.tsx +2 -1
- package/registry/components/ui/copy-button/copy-button.module.css +2 -0
- package/registry/components/ui/copy-button/copy-button.tsx +5 -0
- package/registry/components/ui/data-table/data-table.module.css +786 -710
- package/registry/components/ui/data-table/data-table.tsx +1238 -1211
- package/registry/components/ui/data-table/filter-modal.tsx +86 -0
- package/registry/components/ui/data-table/filters.tsx +21 -0
- package/registry/components/ui/data-table/pagination-bar.tsx +31 -17
- package/registry/components/ui/data-table/types.ts +19 -1
- package/registry/components/ui/data-table/useDataTable.tsx +2 -2
- package/registry/components/ui/data-table/utils.ts +30 -4
- package/registry/components/ui/input-fields/common/input-field-common.module.css +8 -2
- package/registry/components/ui/input-fields/common/picker-popover-common.module.css +4 -0
- package/registry/components/ui/input-fields/custom-select/custom-select.module.css +118 -76
- package/registry/components/ui/input-fields/custom-select/custom-select.tsx +552 -484
- package/registry/components/ui/input-fields/date-picker/date-picker.tsx +936 -933
- package/registry/components/ui/input-fields/date-picker/types.ts +2 -0
- package/registry/components/ui/input-fields/emoji-picker/emoji-picker.tsx +8 -0
- package/registry/components/ui/input-fields/input/input.tsx +348 -348
- package/registry/components/ui/input-fields/media-input/media-input.tsx +3 -1
- package/registry/components/ui/input-fields/media-input/types.ts +8 -2
- package/registry/components/ui/input-fields/media-input/useMediaUpload.tsx +5 -5
- package/registry/components/ui/input-fields/media-input/utils.ts +18 -5
- package/registry/components/ui/scroll-rail/scroll-rail.module.css +104 -0
- package/registry/components/ui/scroll-rail/scroll-rail.tsx +159 -0
- package/registry/components/ui/tabs/tabs.module.css +8 -12
- package/registry/components/ui/tabs/tabs.tsx +94 -50
- package/registry/components/ui/tooltip/tooltip.module.css +8 -3
- package/registry/components/ui/tooltip/tooltip.tsx +16 -3
- package/registry/hooks/useMediaQuery.ts +38 -0
- package/registry/lib/string.ts +3 -3
- package/registry/registry.json +54 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
|
|
3
|
+
const noopSubscribe = (): (() => void) => () => {};
|
|
4
|
+
|
|
5
|
+
const canUseMatchMedia = (): boolean =>
|
|
6
|
+
typeof window !== "undefined" && typeof window.matchMedia === "function";
|
|
7
|
+
|
|
8
|
+
const getMatch = (query: string): boolean =>
|
|
9
|
+
canUseMatchMedia() ? window.matchMedia(query).matches : false;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Subscribe to a CSS media query; re-renders whenever it flips.
|
|
13
|
+
*
|
|
14
|
+
* SSR-safe via `useSyncExternalStore`: returns `false` on the server and on the
|
|
15
|
+
* first client render (so the hydrated markup matches the server HTML), then
|
|
16
|
+
* settles to the real `window.matchMedia` result on the next client tick - the
|
|
17
|
+
* same hydration split as `useHasMounted`. Keep the `query` string stable (a
|
|
18
|
+
* module-level const, not an inline template) so the subscription does not
|
|
19
|
+
* re-bind on every render.
|
|
20
|
+
*/
|
|
21
|
+
export const useMediaQuery = (query: string): boolean => {
|
|
22
|
+
const subscribe = useCallback(
|
|
23
|
+
(onStoreChange: () => void) => {
|
|
24
|
+
if (!canUseMatchMedia()) return noopSubscribe();
|
|
25
|
+
|
|
26
|
+
const mql = window.matchMedia(query);
|
|
27
|
+
mql.addEventListener("change", onStoreChange);
|
|
28
|
+
return () => mql.removeEventListener("change", onStoreChange);
|
|
29
|
+
},
|
|
30
|
+
[query],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return useSyncExternalStore(
|
|
34
|
+
subscribe,
|
|
35
|
+
() => getMatch(query),
|
|
36
|
+
() => false,
|
|
37
|
+
);
|
|
38
|
+
};
|
package/registry/lib/string.ts
CHANGED
|
@@ -17,7 +17,7 @@ export function hashName(name: string): number {
|
|
|
17
17
|
* Extract 1-2 letter initials from a name (e.g. "John Doe" -> "JD")
|
|
18
18
|
*/
|
|
19
19
|
export function getInitials(name: string): string {
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
return
|
|
20
|
+
const [first = "", second = ""] = name.trim().split(/\s+/);
|
|
21
|
+
if (second) return first.charAt(0) + second.charAt(0);
|
|
22
|
+
return first.substring(0, 2) || "?";
|
|
23
23
|
}
|
package/registry/registry.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.aplance.com/registry.schema.json",
|
|
3
3
|
"version": 4,
|
|
4
|
-
"generated": "2026-
|
|
4
|
+
"generated": "2026-11-11T06:11:34.254Z",
|
|
5
5
|
"units": [
|
|
6
6
|
{
|
|
7
7
|
"name": "accordion",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"components/ui/accordion/accordion.tsx"
|
|
16
16
|
],
|
|
17
17
|
"deps": [
|
|
18
|
+
"button",
|
|
18
19
|
"useResizeObserver"
|
|
19
20
|
],
|
|
20
21
|
"externalDeps": [
|
|
@@ -213,6 +214,8 @@
|
|
|
213
214
|
"components/ui/data-table/data-table.module.css",
|
|
214
215
|
"components/ui/data-table/data-table.tsx",
|
|
215
216
|
"components/ui/data-table/filter-bar.tsx",
|
|
217
|
+
"components/ui/data-table/filter-modal.tsx",
|
|
218
|
+
"components/ui/data-table/filters.tsx",
|
|
216
219
|
"components/ui/data-table/pagination-bar.tsx",
|
|
217
220
|
"components/ui/data-table/types.ts",
|
|
218
221
|
"components/ui/data-table/useDataTable.tsx",
|
|
@@ -221,6 +224,8 @@
|
|
|
221
224
|
"clientFiles": [
|
|
222
225
|
"components/ui/data-table/checkbox-column.tsx",
|
|
223
226
|
"components/ui/data-table/data-table.tsx",
|
|
227
|
+
"components/ui/data-table/filter-modal.tsx",
|
|
228
|
+
"components/ui/data-table/filters.tsx",
|
|
224
229
|
"components/ui/data-table/pagination-bar.tsx",
|
|
225
230
|
"components/ui/data-table/types.ts",
|
|
226
231
|
"components/ui/data-table/useDataTable.tsx",
|
|
@@ -229,10 +234,14 @@
|
|
|
229
234
|
"deps": [
|
|
230
235
|
"button",
|
|
231
236
|
"custom-select",
|
|
237
|
+
"icon",
|
|
232
238
|
"input",
|
|
233
239
|
"lib-dom",
|
|
234
240
|
"loader",
|
|
235
|
-
"
|
|
241
|
+
"modal",
|
|
242
|
+
"scroll-rail",
|
|
243
|
+
"tooltip",
|
|
244
|
+
"useMediaQuery"
|
|
236
245
|
],
|
|
237
246
|
"externalDeps": [
|
|
238
247
|
"@tabler/icons-react",
|
|
@@ -561,6 +570,27 @@
|
|
|
561
570
|
"react-dom"
|
|
562
571
|
]
|
|
563
572
|
},
|
|
573
|
+
{
|
|
574
|
+
"name": "scroll-rail",
|
|
575
|
+
"kind": "component",
|
|
576
|
+
"group": "ui",
|
|
577
|
+
"files": [
|
|
578
|
+
"components/ui/scroll-rail/scroll-rail.module.css",
|
|
579
|
+
"components/ui/scroll-rail/scroll-rail.tsx"
|
|
580
|
+
],
|
|
581
|
+
"clientFiles": [
|
|
582
|
+
"components/ui/scroll-rail/scroll-rail.tsx"
|
|
583
|
+
],
|
|
584
|
+
"deps": [
|
|
585
|
+
"button",
|
|
586
|
+
"useResizeObserver"
|
|
587
|
+
],
|
|
588
|
+
"externalDeps": [
|
|
589
|
+
"@tabler/icons-react",
|
|
590
|
+
"clsx",
|
|
591
|
+
"react"
|
|
592
|
+
]
|
|
593
|
+
},
|
|
564
594
|
{
|
|
565
595
|
"name": "select",
|
|
566
596
|
"kind": "component",
|
|
@@ -571,7 +601,9 @@
|
|
|
571
601
|
"components/ui/input-fields/common/types.ts",
|
|
572
602
|
"components/ui/input-fields/select/select.tsx"
|
|
573
603
|
],
|
|
574
|
-
"clientFiles": [
|
|
604
|
+
"clientFiles": [
|
|
605
|
+
"components/ui/input-fields/select/select.tsx"
|
|
606
|
+
],
|
|
575
607
|
"deps": [
|
|
576
608
|
"button",
|
|
577
609
|
"field-message",
|
|
@@ -659,7 +691,9 @@
|
|
|
659
691
|
"components/ui/input-fields/switch/switch.module.css",
|
|
660
692
|
"components/ui/input-fields/switch/switch.tsx"
|
|
661
693
|
],
|
|
662
|
-
"clientFiles": [
|
|
694
|
+
"clientFiles": [
|
|
695
|
+
"components/ui/input-fields/switch/switch.tsx"
|
|
696
|
+
],
|
|
663
697
|
"deps": [
|
|
664
698
|
"button",
|
|
665
699
|
"field-message"
|
|
@@ -681,6 +715,7 @@
|
|
|
681
715
|
"components/ui/tabs/tabs.tsx"
|
|
682
716
|
],
|
|
683
717
|
"deps": [
|
|
718
|
+
"scroll-rail",
|
|
684
719
|
"useResizeObserver"
|
|
685
720
|
],
|
|
686
721
|
"externalDeps": [
|
|
@@ -800,6 +835,21 @@
|
|
|
800
835
|
"react"
|
|
801
836
|
]
|
|
802
837
|
},
|
|
838
|
+
{
|
|
839
|
+
"name": "useMediaQuery",
|
|
840
|
+
"kind": "hook",
|
|
841
|
+
"group": null,
|
|
842
|
+
"files": [
|
|
843
|
+
"hooks/useMediaQuery.ts"
|
|
844
|
+
],
|
|
845
|
+
"clientFiles": [
|
|
846
|
+
"hooks/useMediaQuery.ts"
|
|
847
|
+
],
|
|
848
|
+
"deps": [],
|
|
849
|
+
"externalDeps": [
|
|
850
|
+
"react"
|
|
851
|
+
]
|
|
852
|
+
},
|
|
803
853
|
{
|
|
804
854
|
"name": "useResizeObserver",
|
|
805
855
|
"kind": "hook",
|