@godxjp/ui 8.3.0 → 9.0.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 (38) hide show
  1. package/dist/{chunk-CAEL2ZD2.js → chunk-2ACNEQOI.js} +1 -1
  2. package/dist/{chunk-ZY5NUG4B.js → chunk-32ZUUKML.js} +18 -4
  3. package/dist/{chunk-CLU46QR2.js → chunk-442ULAA6.js} +12 -4
  4. package/dist/{chunk-GKXPALFT.js → chunk-JOLM73YQ.js} +1 -1
  5. package/dist/{chunk-6YK3IJXW.js → chunk-RSC5K7RP.js} +1 -1
  6. package/dist/{chunk-56NYZNVY.js → chunk-TBXQJCBQ.js} +1 -1
  7. package/dist/components/admin/index.d.ts +3 -8
  8. package/dist/components/admin/index.js +16 -17
  9. package/dist/components/data-display/card.d.ts +2 -2
  10. package/dist/components/data-entry/autocomplete.js +3 -3
  11. package/dist/components/data-entry/command.d.ts +1 -1
  12. package/dist/components/data-entry/index.js +13 -13
  13. package/dist/components/data-entry/select.js +3 -3
  14. package/dist/components/data-entry/upload.js +2 -2
  15. package/dist/components/feedback/index.js +2 -2
  16. package/dist/components/layout/index.d.ts +7 -6
  17. package/dist/components/layout/index.js +2 -2
  18. package/dist/components/navigation/index.d.ts +2 -2
  19. package/dist/components/navigation/index.js +6 -6
  20. package/dist/components/navigation/pagination.js +4 -4
  21. package/dist/components/query/index.d.ts +2 -2
  22. package/dist/components/query/index.js +193 -4
  23. package/dist/components/ui/index.js +18 -18
  24. package/dist/{filter-bar-WjnQOs2C.d.ts → filter-bar-BycYH10i.d.ts} +2 -2
  25. package/dist/form/index.js +71 -3
  26. package/dist/index.d.ts +3 -12
  27. package/dist/index.js +25 -27
  28. package/dist/{inline-DqfYlGKj.d.ts → inline-DCqn4O29.d.ts} +2 -2
  29. package/dist/{layout.prop-Baq9muDN.d.ts → layout.prop-DwJKI6ka.d.ts} +2 -0
  30. package/dist/props/components/index.d.ts +2 -2
  31. package/dist/props/index.d.ts +2 -2
  32. package/dist/{query.prop-DuODxsiU.d.ts → query.prop-BDdz9L1G.d.ts} +1 -1
  33. package/package.json +4 -3
  34. package/dist/chunk-7WRZG2IG.js +0 -71
  35. package/dist/chunk-GLEEJYGQ.js +0 -193
  36. package/dist/{chunk-KDBGFJJI.js → chunk-GKED65NV.js} +1 -1
  37. package/dist/{chunk-HKD6ERY7.js → chunk-LDSLS6HE.js} +0 -0
  38. package/dist/{chunk-PIQXAOWS.js → chunk-Z6HNY2PL.js} +1 -1
@@ -1,193 +0,0 @@
1
- import { AlertQueryError } from './chunk-ZRRLOOBX.js';
2
- import { Button } from './chunk-M4PZNAMV.js';
3
- import { useTranslation } from './chunk-RLGHEV4A.js';
4
- import * as React from 'react';
5
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
6
- import { RefreshCw } from 'lucide-react';
7
- import { Link } from 'react-router-dom';
8
- import { useQueryClient } from '@tanstack/react-query';
9
-
10
- function defaultIsEmpty(data) {
11
- if (!data) return true;
12
- if (Array.isArray(data)) return data.length === 0;
13
- if (typeof data === "object" && data !== null) {
14
- const obj = data;
15
- if (Array.isArray(obj.items)) return obj.items.length === 0;
16
- if (typeof obj.length === "number") return obj.length === 0;
17
- }
18
- return false;
19
- }
20
- function DataState({
21
- query,
22
- skeleton,
23
- empty,
24
- isEmpty = defaultIsEmpty,
25
- errorRenderer,
26
- showRetry = true,
27
- onRetry,
28
- children
29
- }) {
30
- const retry = React.useCallback(() => {
31
- if (onRetry) {
32
- void onRetry();
33
- return;
34
- }
35
- void query.refetch();
36
- }, [onRetry, query]);
37
- if (query.isPending) return /* @__PURE__ */ jsx(Fragment, { children: skeleton });
38
- if (query.isError) {
39
- if (query.isFetching) return /* @__PURE__ */ jsx(Fragment, { children: skeleton });
40
- if (errorRenderer) return /* @__PURE__ */ jsx(Fragment, { children: errorRenderer(query.error, retry) });
41
- return /* @__PURE__ */ jsx(AlertQueryError, { error: query.error, onRetry: showRetry ? retry : void 0 });
42
- }
43
- const data = query.data;
44
- if (data === void 0) return /* @__PURE__ */ jsx(Fragment, { children: skeleton });
45
- if (empty && (data === null || isEmpty(data))) return /* @__PURE__ */ jsx(Fragment, { children: empty });
46
- return /* @__PURE__ */ jsx(Fragment, { children: children(data) });
47
- }
48
- function AlertMutationFeedback({
49
- mutation,
50
- onRetry,
51
- showRetry = true,
52
- pending,
53
- className
54
- }) {
55
- if (mutation.isPending && pending) return /* @__PURE__ */ jsx(Fragment, { children: pending });
56
- if (!mutation.isError || mutation.error == null) return null;
57
- return /* @__PURE__ */ jsx(
58
- AlertQueryError,
59
- {
60
- className,
61
- error: mutation.error,
62
- onRetry: showRetry ? onRetry : void 0
63
- }
64
- );
65
- }
66
- var MutationFeedback = AlertMutationFeedback;
67
- function ButtonRefetch({
68
- query,
69
- label = "Refresh",
70
- children,
71
- variant = "outline",
72
- size = "sm",
73
- className,
74
- ...props
75
- }) {
76
- const text = children ?? label;
77
- return /* @__PURE__ */ jsxs(
78
- Button,
79
- {
80
- type: "button",
81
- variant,
82
- size,
83
- className,
84
- onClick: () => void query.refetch(),
85
- disabled: query.isFetching,
86
- ...props,
87
- children: [
88
- /* @__PURE__ */ jsx(
89
- RefreshCw,
90
- {
91
- className: "ui-query-refetch-icon",
92
- "data-fetching": query.isFetching,
93
- "aria-hidden": "true"
94
- }
95
- ),
96
- text
97
- ]
98
- }
99
- );
100
- }
101
- var QueryRefetchButton = ButtonRefetch;
102
- function flattenItemPages(data) {
103
- if (!data) return [];
104
- return data.pages.flatMap((page) => page.items);
105
- }
106
- function defaultIsEmptyFlat(flat) {
107
- if (Array.isArray(flat)) return flat.length === 0;
108
- return !flat;
109
- }
110
- function InfiniteQueryState({
111
- query,
112
- skeleton,
113
- empty,
114
- flatten,
115
- isEmpty = defaultIsEmptyFlat,
116
- errorRenderer,
117
- showRetry = true,
118
- onRetry,
119
- loadingMore,
120
- loadMore,
121
- showLoadMore = true,
122
- children
123
- }) {
124
- const { t } = useTranslation();
125
- const retry = React.useCallback(() => {
126
- if (onRetry) {
127
- void onRetry();
128
- return;
129
- }
130
- void query.refetch();
131
- }, [onRetry, query]);
132
- if (query.isPending) return /* @__PURE__ */ jsx(Fragment, { children: skeleton });
133
- if (query.isError) {
134
- if (query.isFetching && !query.isFetchingNextPage) return /* @__PURE__ */ jsx(Fragment, { children: skeleton });
135
- if (errorRenderer) return /* @__PURE__ */ jsx(Fragment, { children: errorRenderer(query.error, retry) });
136
- return /* @__PURE__ */ jsx(AlertQueryError, { error: query.error, onRetry: showRetry ? retry : void 0 });
137
- }
138
- const data = query.data;
139
- if (!data) return /* @__PURE__ */ jsx(Fragment, { children: skeleton });
140
- const flat = flatten(data);
141
- if (empty && isEmpty(flat)) return /* @__PURE__ */ jsx(Fragment, { children: empty });
142
- const footer = showLoadMore && query.hasNextPage ? loadMore ?? /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-4", children: /* @__PURE__ */ jsx(
143
- Button,
144
- {
145
- type: "button",
146
- variant: "outline",
147
- size: "sm",
148
- disabled: query.isFetchingNextPage,
149
- onClick: () => void query.fetchNextPage(),
150
- children: query.isFetchingNextPage ? t("common.working") : t("query.loadMore")
151
- }
152
- ) }) : null;
153
- return /* @__PURE__ */ jsxs(Fragment, { children: [
154
- children(flat, {
155
- fetchNextPage: () => void query.fetchNextPage(),
156
- hasNextPage: !!query.hasNextPage,
157
- isFetchingNextPage: query.isFetchingNextPage
158
- }),
159
- query.isFetchingNextPage && (loadingMore ?? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground pt-2 text-center text-xs", children: t("common.working") })),
160
- footer
161
- ] });
162
- }
163
- function PrefetchLink({
164
- queryKey,
165
- queryFn,
166
- prefetchOn = "both",
167
- staleTime = 3e4,
168
- onMouseEnter,
169
- onFocus,
170
- ...linkProps
171
- }) {
172
- const queryClient = useQueryClient();
173
- const prefetch = React.useCallback(() => {
174
- if (prefetchOn === "none") return;
175
- void queryClient.prefetchQuery({ queryKey, queryFn, staleTime });
176
- }, [prefetchOn, queryClient, queryFn, queryKey, staleTime]);
177
- return /* @__PURE__ */ jsx(
178
- Link,
179
- {
180
- ...linkProps,
181
- onMouseEnter: (event) => {
182
- if (prefetchOn === "hover" || prefetchOn === "both") prefetch();
183
- onMouseEnter?.(event);
184
- },
185
- onFocus: (event) => {
186
- if (prefetchOn === "focus" || prefetchOn === "both") prefetch();
187
- onFocus?.(event);
188
- }
189
- }
190
- );
191
- }
192
-
193
- export { AlertMutationFeedback, ButtonRefetch, DataState, InfiniteQueryState, MutationFeedback, PrefetchLink, QueryRefetchButton, flattenItemPages };
@@ -1,5 +1,5 @@
1
- import { Command, CommandList, CommandItem, CommandGroup } from './chunk-HTEL5DQI.js';
2
1
  import { Input } from './chunk-VOHTRR5X.js';
2
+ import { Command, CommandList, CommandItem, CommandGroup } from './chunk-HTEL5DQI.js';
3
3
  import { Button } from './chunk-M4PZNAMV.js';
4
4
  import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
5
5
  import { useTranslation } from './chunk-RLGHEV4A.js';
File without changes
@@ -1,6 +1,6 @@
1
- import { Slider } from './chunk-CRERCLIZ.js';
2
1
  import { formatBytes } from './chunk-4R7QL3MW.js';
3
2
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-P4HFJQID.js';
3
+ import { Slider } from './chunk-CRERCLIZ.js';
4
4
  import { Button } from './chunk-M4PZNAMV.js';
5
5
  import { controlIconClass } from './chunk-IBK5D2Q6.js';
6
6
  import { useTranslation } from './chunk-RLGHEV4A.js';