@kjun-ui/react 0.12.1 → 0.13.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/dist/index.cjs +1469 -1065
- package/dist/index.js +1105 -701
- package/dist/styles.css +30 -3
- package/dist/types/packages/react/src/button.d.cts +2 -0
- package/dist/types/packages/react/src/button.d.ts +2 -0
- package/dist/types/packages/react/src/controls.d.cts +3 -1
- package/dist/types/packages/react/src/controls.d.ts +3 -1
- package/dist/types/packages/react/src/data-state.d.cts +3 -0
- package/dist/types/packages/react/src/data-state.d.ts +3 -0
- package/dist/types/packages/react/src/date-picker.d.cts +3 -1
- package/dist/types/packages/react/src/date-picker.d.ts +3 -1
- package/dist/types/packages/react/src/fab.d.cts +14 -0
- package/dist/types/packages/react/src/fab.d.ts +14 -0
- package/dist/types/packages/react/src/financial-display.d.cts +8 -8
- package/dist/types/packages/react/src/financial-display.d.ts +8 -8
- package/dist/types/packages/react/src/index.d.cts +2 -0
- package/dist/types/packages/react/src/index.d.ts +2 -0
- package/dist/types/packages/react/src/input.d.cts +3 -1
- package/dist/types/packages/react/src/input.d.ts +3 -1
- package/dist/types/packages/react/src/list.d.cts +5 -1
- package/dist/types/packages/react/src/list.d.ts +5 -1
- package/dist/types/packages/react/src/provider.d.cts +6 -1
- package/dist/types/packages/react/src/provider.d.ts +6 -1
- package/dist/types/shared/package-runtime/feedback-dialog.d.cts +2 -1
- package/dist/types/shared/package-runtime/feedback-dialog.d.ts +2 -1
- package/dist/types/shared/package-runtime/messages/en.d.cts +2 -0
- package/dist/types/shared/package-runtime/messages/en.d.ts +2 -0
- package/dist/types/shared/package-runtime/messages/index.d.cts +26 -0
- package/dist/types/shared/package-runtime/messages/index.d.ts +26 -0
- package/dist/types/shared/package-runtime/messages/ko.d.cts +116 -0
- package/dist/types/shared/package-runtime/messages/ko.d.ts +116 -0
- package/dist/types/shared/package-runtime/messages-context.d.cts +124 -0
- package/dist/types/shared/package-runtime/messages-context.d.ts +124 -0
- package/dist/types/shared/package-runtime/options.d.cts +4 -2
- package/dist/types/shared/package-runtime/options.d.ts +4 -2
- package/dist/types/shared/package-runtime/relative-time.d.cts +1 -1
- package/dist/types/shared/package-runtime/relative-time.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -64,6 +64,328 @@ function useIcon(name, filled) {
|
|
|
64
64
|
return resolveIcon(useContext(IconContext), name, filled);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
// shared/package-runtime/messages-context.tsx
|
|
68
|
+
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
|
|
69
|
+
|
|
70
|
+
// shared/package-runtime/messages/en.ts
|
|
71
|
+
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
72
|
+
var plural = (count, one, many) => `${count} ${count === 1 ? one : many}`;
|
|
73
|
+
var kjunMessagesEn = {
|
|
74
|
+
cancel: "Cancel",
|
|
75
|
+
confirm: "Confirm",
|
|
76
|
+
save: "Save",
|
|
77
|
+
close: "Close",
|
|
78
|
+
closeNotification: "Close notification",
|
|
79
|
+
confirmTitle: "Confirm",
|
|
80
|
+
promptTitle: "Input",
|
|
81
|
+
invalidInput: "Please check your input.",
|
|
82
|
+
dialog: "Dialog",
|
|
83
|
+
panel: "Panel",
|
|
84
|
+
details: "Details",
|
|
85
|
+
menu: "Menu",
|
|
86
|
+
remove: (label) => "Remove " + label,
|
|
87
|
+
user: "User",
|
|
88
|
+
loading: "Loading",
|
|
89
|
+
loadingEllipsis: "Loading...",
|
|
90
|
+
refreshing: "Refreshing...",
|
|
91
|
+
chartLoading: "Loading chart",
|
|
92
|
+
noData: "No data",
|
|
93
|
+
noItems: "No items",
|
|
94
|
+
noResults: "No results",
|
|
95
|
+
errorTitle: "Error",
|
|
96
|
+
retry: "Retry",
|
|
97
|
+
somethingWentWrong: "Something went wrong",
|
|
98
|
+
retryHint: "Trying again may fix the problem.",
|
|
99
|
+
refreshError: (error) => `${error} \xB7 Showing the previous results.`,
|
|
100
|
+
progress: "Progress",
|
|
101
|
+
search: "Search...",
|
|
102
|
+
searching: "Searching...",
|
|
103
|
+
searchOrSelect: "Search or select",
|
|
104
|
+
searchFailed: "Search failed. Please try again.",
|
|
105
|
+
minChars: (count) => `Type at least ${plural(count, "character", "characters")}`,
|
|
106
|
+
select: "Select",
|
|
107
|
+
optional: "(optional)",
|
|
108
|
+
clearSelection: "Clear selection",
|
|
109
|
+
searchOptions: "Search options",
|
|
110
|
+
selectedCount: (count) => `${count} selected`,
|
|
111
|
+
loadMore: "Show more",
|
|
112
|
+
clearInput: "Clear input",
|
|
113
|
+
clearValue: (label) => "Clear " + label,
|
|
114
|
+
datePlaceholder: "Select date",
|
|
115
|
+
clearDate: "Clear date",
|
|
116
|
+
calendarTitle: (year, month) => `${months[month - 1]} ${year}`,
|
|
117
|
+
weekdays: "Sun,Mon,Tue,Wed,Thu,Fri,Sat",
|
|
118
|
+
previousMonth: "Previous month",
|
|
119
|
+
nextMonth: "Next month",
|
|
120
|
+
time: "Time",
|
|
121
|
+
hour: "Hour",
|
|
122
|
+
minute: "Minute",
|
|
123
|
+
second: "Second",
|
|
124
|
+
value: "Value",
|
|
125
|
+
minimum: "Minimum",
|
|
126
|
+
maximum: "Maximum",
|
|
127
|
+
increase: "Increase",
|
|
128
|
+
decrease: "Decrease",
|
|
129
|
+
increaseQuantity: "Increase quantity",
|
|
130
|
+
decreaseQuantity: "Decrease quantity",
|
|
131
|
+
quantity: "Quantity",
|
|
132
|
+
relativeTimeFallback: (amount, unit) => {
|
|
133
|
+
const text = plural(Math.abs(amount), unit, unit + "s");
|
|
134
|
+
return amount < 0 ? text + " ago" : "in " + text;
|
|
135
|
+
},
|
|
136
|
+
copy: "Copy",
|
|
137
|
+
copied: "Copied",
|
|
138
|
+
copyFailed: "Copy failed",
|
|
139
|
+
refresh: "Refresh",
|
|
140
|
+
externalLink: "External link",
|
|
141
|
+
newWindow: " (opens in a new window)",
|
|
142
|
+
dataTable: "Data table",
|
|
143
|
+
selectRow: (row) => `Select row ${row}`,
|
|
144
|
+
selectAll: "Select all",
|
|
145
|
+
selectAllPartial: "Select all (some selected)",
|
|
146
|
+
deselectAll: "Deselect all",
|
|
147
|
+
selectionActions: "Selection actions",
|
|
148
|
+
selectedItems: (count) => `${count} selected`,
|
|
149
|
+
searchTable: "Search table",
|
|
150
|
+
expandRow: "Expand row",
|
|
151
|
+
collapse: "Collapse",
|
|
152
|
+
showDetails: "Show details",
|
|
153
|
+
ascending: "Ascending",
|
|
154
|
+
descending: "Descending",
|
|
155
|
+
tabs: "Tabs",
|
|
156
|
+
breadcrumb: "Breadcrumb",
|
|
157
|
+
mainNavigation: "Main navigation",
|
|
158
|
+
pagination: "Pagination",
|
|
159
|
+
itemsPerPage: "Items per page",
|
|
160
|
+
perPage: (count) => `${count} per page`,
|
|
161
|
+
pageRange: (from, to, total) => `${from}\u2013${to} of ${total}`,
|
|
162
|
+
page: (page) => `Page ${page}`,
|
|
163
|
+
firstPage: "First page",
|
|
164
|
+
previousPage: "Previous page",
|
|
165
|
+
nextPage: "Next page",
|
|
166
|
+
lastPage: "Last page",
|
|
167
|
+
marketData: "Market data",
|
|
168
|
+
metrics: "Displayed metrics",
|
|
169
|
+
watchToggle: (name, active) => active ? `Remove ${name || "item"} from watchlist` : `Add ${name || "item"} to watchlist`,
|
|
170
|
+
favoriteToggle: (name, active) => active ? `Remove ${name || "item"} from favorites` : `Add ${name || "item"} to favorites`,
|
|
171
|
+
lastUpdated: "Last updated: ",
|
|
172
|
+
unitLabel: "items",
|
|
173
|
+
totalCount: (count, unit) => `Total ${count} ${unit}`,
|
|
174
|
+
closePrice: "Close",
|
|
175
|
+
delayed: "Delayed",
|
|
176
|
+
noRealtimeQuote: "No real-time quote \xB7 showing the last close",
|
|
177
|
+
realtimeDelayed: "Real-time quote delayed",
|
|
178
|
+
arbitrage: "Arbitrage opportunity",
|
|
179
|
+
deviationWarning: (threshold) => `Deviation over ${threshold}% \u2014 possible arbitrage opportunity`,
|
|
180
|
+
statusQueued: "Queued",
|
|
181
|
+
statusStarting: "Starting",
|
|
182
|
+
statusRunning: "Running",
|
|
183
|
+
statusStopping: "Stopping",
|
|
184
|
+
statusStopped: "Stopped",
|
|
185
|
+
statusCompleted: "Completed",
|
|
186
|
+
statusCompletedWithErrors: "Completed with errors",
|
|
187
|
+
statusFailed: "Failed",
|
|
188
|
+
statusUnknown: "Unknown",
|
|
189
|
+
statusNoRuns: "No runs yet"
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// shared/package-runtime/messages/ko.ts
|
|
193
|
+
var relativeUnits = { year: "\uB144", month: "\uAC1C\uC6D4", day: "\uC77C", hour: "\uC2DC\uAC04", minute: "\uBD84", second: "\uCD08" };
|
|
194
|
+
var kjunMessagesKo = {
|
|
195
|
+
// Actions and dialogs
|
|
196
|
+
cancel: "\uCDE8\uC18C",
|
|
197
|
+
confirm: "\uD655\uC778",
|
|
198
|
+
save: "\uC800\uC7A5",
|
|
199
|
+
close: "\uB2EB\uAE30",
|
|
200
|
+
closeNotification: "\uC54C\uB9BC \uB2EB\uAE30",
|
|
201
|
+
confirmTitle: "\uD655\uC778",
|
|
202
|
+
promptTitle: "\uC785\uB825",
|
|
203
|
+
invalidInput: "\uC785\uB825 \uB0B4\uC6A9\uC744 \uD655\uC778\uD558\uC138\uC694.",
|
|
204
|
+
dialog: "\uB300\uD654\uC0C1\uC790",
|
|
205
|
+
panel: "\uD328\uB110",
|
|
206
|
+
details: "\uC0C1\uC138 \uC815\uBCF4",
|
|
207
|
+
menu: "\uBA54\uB274",
|
|
208
|
+
remove: (label) => label + " \uC0AD\uC81C",
|
|
209
|
+
user: "\uC0AC\uC6A9\uC790",
|
|
210
|
+
// Loading and states
|
|
211
|
+
loading: "\uB85C\uB529 \uC911",
|
|
212
|
+
loadingEllipsis: "\uB85C\uB529 \uC911...",
|
|
213
|
+
refreshing: "\uAC31\uC2E0 \uC911...",
|
|
214
|
+
chartLoading: "\uCC28\uD2B8\uB97C \uBD88\uB7EC\uC624\uB294 \uC911",
|
|
215
|
+
noData: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
216
|
+
noItems: "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
217
|
+
noResults: "\uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
218
|
+
errorTitle: "\uC624\uB958 \uBC1C\uC0DD",
|
|
219
|
+
retry: "\uB2E4\uC2DC \uC2DC\uB3C4",
|
|
220
|
+
somethingWentWrong: "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
|
|
221
|
+
retryHint: "\uB2E4\uC2DC \uC2DC\uB3C4\uD558\uBA74 \uBB38\uC81C\uAC00 \uD574\uACB0\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
|
|
222
|
+
refreshError: (error) => `${error} \xB7 \uC774\uC804 \uC870\uD68C \uACB0\uACFC\uB97C \uD45C\uC2DC\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4.`,
|
|
223
|
+
progress: "\uC9C4\uD589\uB960",
|
|
224
|
+
// Search and selection
|
|
225
|
+
search: "\uAC80\uC0C9...",
|
|
226
|
+
searching: "\uAC80\uC0C9 \uC911...",
|
|
227
|
+
searchOrSelect: "\uAC80\uC0C9 \uB610\uB294 \uC120\uD0DD",
|
|
228
|
+
searchFailed: "\uAC80\uC0C9\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.",
|
|
229
|
+
minChars: (count) => `${count}\uC790 \uC774\uC0C1 \uC785\uB825\uD558\uC138\uC694`,
|
|
230
|
+
select: "\uC120\uD0DD",
|
|
231
|
+
optional: "(\uC120\uD0DD)",
|
|
232
|
+
clearSelection: "\uC120\uD0DD \uC9C0\uC6B0\uAE30",
|
|
233
|
+
searchOptions: "\uC120\uD0DD \uD56D\uBAA9 \uAC80\uC0C9",
|
|
234
|
+
selectedCount: (count) => `${count}\uAC1C \uC120\uD0DD\uB428`,
|
|
235
|
+
loadMore: "\uB354 \uBCF4\uAE30",
|
|
236
|
+
clearInput: "\uC785\uB825 \uC9C0\uC6B0\uAE30",
|
|
237
|
+
clearValue: (label) => label + " \uC9C0\uC6B0\uAE30",
|
|
238
|
+
// Date, time and numbers
|
|
239
|
+
datePlaceholder: "\uB0A0\uC9DC \uC120\uD0DD",
|
|
240
|
+
clearDate: "\uB0A0\uC9DC \uC9C0\uC6B0\uAE30",
|
|
241
|
+
calendarTitle: (year, month) => `${year}\uB144 ${month}\uC6D4`,
|
|
242
|
+
weekdays: "\uC77C,\uC6D4,\uD654,\uC218,\uBAA9,\uAE08,\uD1A0",
|
|
243
|
+
previousMonth: "\uC774\uC804 \uB2EC",
|
|
244
|
+
nextMonth: "\uB2E4\uC74C \uB2EC",
|
|
245
|
+
time: "\uC2DC\uAC04",
|
|
246
|
+
hour: "\uC2DC",
|
|
247
|
+
minute: "\uBD84",
|
|
248
|
+
second: "\uCD08",
|
|
249
|
+
value: "\uAC12",
|
|
250
|
+
minimum: "\uCD5C\uC19F\uAC12",
|
|
251
|
+
maximum: "\uCD5C\uB313\uAC12",
|
|
252
|
+
increase: "\uB298\uB9AC\uAE30",
|
|
253
|
+
decrease: "\uC904\uC774\uAE30",
|
|
254
|
+
increaseQuantity: "\uC218\uB7C9 \uB298\uB9AC\uAE30",
|
|
255
|
+
decreaseQuantity: "\uC218\uB7C9 \uC904\uC774\uAE30",
|
|
256
|
+
quantity: "\uC218\uB7C9",
|
|
257
|
+
relativeTimeFallback: (amount, unit) => Math.abs(amount) + relativeUnits[unit] + (amount < 0 ? " \uC804" : " \uD6C4"),
|
|
258
|
+
// Actions
|
|
259
|
+
copy: "\uBCF5\uC0AC",
|
|
260
|
+
copied: "\uBCF5\uC0AC\uB428",
|
|
261
|
+
copyFailed: "\uBCF5\uC0AC \uC2E4\uD328",
|
|
262
|
+
refresh: "\uC0C8\uB85C\uACE0\uCE68",
|
|
263
|
+
externalLink: "\uC678\uBD80 \uB9C1\uD06C",
|
|
264
|
+
newWindow: " (\uC0C8 \uCC3D)",
|
|
265
|
+
// Table
|
|
266
|
+
dataTable: "\uB370\uC774\uD130 \uD45C",
|
|
267
|
+
selectRow: (row) => `\uD589 \uC120\uD0DD ${row}`,
|
|
268
|
+
selectAll: "\uC804\uCCB4 \uC120\uD0DD",
|
|
269
|
+
selectAllPartial: "\uC804\uCCB4 \uC120\uD0DD (\uC77C\uBD80 \uC120\uD0DD\uB428)",
|
|
270
|
+
deselectAll: "\uC120\uD0DD \uD574\uC81C",
|
|
271
|
+
selectionActions: "\uC120\uD0DD \uC791\uC5C5",
|
|
272
|
+
selectedItems: (count) => `${count}\uAC1C \uC120\uD0DD`,
|
|
273
|
+
searchTable: "\uD45C \uAC80\uC0C9",
|
|
274
|
+
expandRow: "\uD589 \uD655\uC7A5",
|
|
275
|
+
collapse: "\uC811\uAE30",
|
|
276
|
+
showDetails: "\uC0C1\uC138 \uBCF4\uAE30",
|
|
277
|
+
ascending: "\uC624\uB984\uCC28\uC21C",
|
|
278
|
+
descending: "\uB0B4\uB9BC\uCC28\uC21C",
|
|
279
|
+
// Navigation
|
|
280
|
+
tabs: "\uD0ED",
|
|
281
|
+
breadcrumb: "\uD604\uC7AC \uC704\uCE58",
|
|
282
|
+
mainNavigation: "\uC8FC\uC694 \uD0D0\uC0C9",
|
|
283
|
+
pagination: "\uD398\uC774\uC9C0 \uD0D0\uC0C9",
|
|
284
|
+
itemsPerPage: "\uD398\uC774\uC9C0\uB2F9 \uD56D\uBAA9 \uC218",
|
|
285
|
+
perPage: (count) => `${count}\uAC1C\uC529`,
|
|
286
|
+
pageRange: (from, to, total) => `${from} - ${to} / ${total}\uAC1C`,
|
|
287
|
+
page: (page) => `${page} \uD398\uC774\uC9C0`,
|
|
288
|
+
firstPage: "\uCCAB \uD398\uC774\uC9C0",
|
|
289
|
+
previousPage: "\uC774\uC804 \uD398\uC774\uC9C0",
|
|
290
|
+
nextPage: "\uB2E4\uC74C \uD398\uC774\uC9C0",
|
|
291
|
+
lastPage: "\uB9C8\uC9C0\uB9C9 \uD398\uC774\uC9C0",
|
|
292
|
+
// Market and financial
|
|
293
|
+
marketData: "\uC2DC\uC7A5 \uB370\uC774\uD130",
|
|
294
|
+
metrics: "\uD45C\uC2DC \uC9C0\uD45C",
|
|
295
|
+
watchToggle: (name, active) => [name, "\uAD00\uC2EC", active ? "\uD574\uC81C" : "\uB4F1\uB85D"].filter(Boolean).join(" "),
|
|
296
|
+
favoriteToggle: (name, active) => [name, "\uC990\uACA8\uCC3E\uAE30", active ? "\uD574\uC81C" : "\uB4F1\uB85D"].filter(Boolean).join(" "),
|
|
297
|
+
lastUpdated: "\uB9C8\uC9C0\uB9C9 \uC5C5\uB370\uC774\uD2B8: ",
|
|
298
|
+
unitLabel: "\uAC1C",
|
|
299
|
+
totalCount: (count, unit) => `\uCD1D ${count}${unit}`,
|
|
300
|
+
closePrice: "\uC885\uAC00",
|
|
301
|
+
delayed: "\uC9C0\uC5F0",
|
|
302
|
+
noRealtimeQuote: "\uC2E4\uC2DC\uAC04 \uC2DC\uC138 \uC5C6\uC74C \xB7 \uCD5C\uADFC \uC885\uAC00 \uD45C\uC2DC",
|
|
303
|
+
realtimeDelayed: "\uC2E4\uC2DC\uAC04 \uC2DC\uC138 \uC9C0\uC5F0",
|
|
304
|
+
arbitrage: "\uCC28\uC775\uAC70\uB798 \uAE30\uD68C",
|
|
305
|
+
deviationWarning: (threshold) => `\uAD34\uB9AC\uC728 ${threshold}% \uCD08\uACFC \u2014 \uCC28\uC775\uAC70\uB798 \uAE30\uD68C \uAC00\uB2A5`,
|
|
306
|
+
statusQueued: "\uB300\uAE30 \uC911",
|
|
307
|
+
statusStarting: "\uC2DC\uC791 \uC911",
|
|
308
|
+
statusRunning: "\uC2E4\uD589 \uC911",
|
|
309
|
+
statusStopping: "\uC911\uB2E8 \uC911",
|
|
310
|
+
statusStopped: "\uC911\uB2E8\uB428",
|
|
311
|
+
statusCompleted: "\uC644\uB8CC",
|
|
312
|
+
statusCompletedWithErrors: "\uC644\uB8CC (\uC624\uB958)",
|
|
313
|
+
statusFailed: "\uC2E4\uD328",
|
|
314
|
+
statusUnknown: "\uC54C \uC218 \uC5C6\uC74C",
|
|
315
|
+
statusNoRuns: "\uC2E4\uD589 \uC774\uB825 \uC5C6\uC74C"
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
// shared/package-runtime/messages/index.ts
|
|
319
|
+
var defaultMessageScope = { messages: kjunMessagesKo, overrides: {} };
|
|
320
|
+
function developmentMode2() {
|
|
321
|
+
try {
|
|
322
|
+
return true;
|
|
323
|
+
} catch (e) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
var warnedLocales = /* @__PURE__ */ new Set();
|
|
328
|
+
function normalizeLocale(locale) {
|
|
329
|
+
if (!locale) return {};
|
|
330
|
+
const tag = locale.trim().replace(/_/g, "-");
|
|
331
|
+
const language = tag.split("-")[0].toLowerCase() || void 0;
|
|
332
|
+
try {
|
|
333
|
+
return { intl: Intl.getCanonicalLocales(tag)[0], language };
|
|
334
|
+
} catch (e) {
|
|
335
|
+
if (developmentMode2() && !warnedLocales.has(locale)) {
|
|
336
|
+
warnedLocales.add(locale);
|
|
337
|
+
console.warn(`KJUN Provider: locale "${locale}" is not a valid BCP 47 tag; dates and numbers keep their default format.`);
|
|
338
|
+
}
|
|
339
|
+
return { language };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
var packFor = (language) => language === void 0 || language === "ko" ? kjunMessagesKo : kjunMessagesEn;
|
|
343
|
+
function resolveMessageScope(parent, locale, messages) {
|
|
344
|
+
var _a, _b;
|
|
345
|
+
const base = parent != null ? parent : defaultMessageScope;
|
|
346
|
+
const next = locale ? normalizeLocale(locale) : { intl: base.intl, language: base.language };
|
|
347
|
+
const sameLanguage = ((_a = next.language) != null ? _a : "ko") === ((_b = base.language) != null ? _b : "ko");
|
|
348
|
+
const overrides = { ...sameLanguage ? base.overrides : {}, ...messages };
|
|
349
|
+
return { ...next, overrides, messages: { ...packFor(next.language), ...overrides } };
|
|
350
|
+
}
|
|
351
|
+
var units = [
|
|
352
|
+
["year", 31536e3],
|
|
353
|
+
["month", 2592e3],
|
|
354
|
+
["day", 86400],
|
|
355
|
+
["hour", 3600],
|
|
356
|
+
["minute", 60]
|
|
357
|
+
];
|
|
358
|
+
function formatRelativeTime(value, now = Date.now(), scope = defaultMessageScope) {
|
|
359
|
+
var _a, _b;
|
|
360
|
+
const time = new Date(value).getTime();
|
|
361
|
+
if (!Number.isFinite(time)) return String(value);
|
|
362
|
+
const seconds = Math.round((time - now) / 1e3);
|
|
363
|
+
const [unit, size] = (_a = units.find(([, size2]) => Math.abs(seconds) >= size2)) != null ? _a : ["second", 1];
|
|
364
|
+
const amount = Math.round(seconds / size);
|
|
365
|
+
if (typeof Intl.RelativeTimeFormat === "function")
|
|
366
|
+
return new Intl.RelativeTimeFormat((_b = scope.intl) != null ? _b : !scope.language || scope.language === "ko" ? "ko-KR" : "en", { numeric: "auto" }).format(amount, unit);
|
|
367
|
+
return scope.messages.relativeTimeFallback(amount, unit);
|
|
368
|
+
}
|
|
369
|
+
function formatDateValue(iso, scope = defaultMessageScope) {
|
|
370
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
|
|
371
|
+
if (!scope.intl || !match) return iso.replace(/-/g, ". ") + ".";
|
|
372
|
+
return new Intl.DateTimeFormat(scope.intl, { year: "numeric", month: "2-digit", day: "2-digit" }).format(new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// shared/package-runtime/messages-context.tsx
|
|
376
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
377
|
+
var KjunMessageContext = createContext2(defaultMessageScope);
|
|
378
|
+
function KjunMessagesProvider({ locale, messages, children }) {
|
|
379
|
+
const parent = useContext2(KjunMessageContext);
|
|
380
|
+
const value = useMemo2(() => resolveMessageScope(parent, locale, messages), [parent, locale, messages]);
|
|
381
|
+
return /* @__PURE__ */ jsx2(KjunMessageContext.Provider, { value, children });
|
|
382
|
+
}
|
|
383
|
+
var useKjunMessageScope = () => useContext2(KjunMessageContext);
|
|
384
|
+
var useKjunMessages = () => useContext2(KjunMessageContext).messages;
|
|
385
|
+
|
|
386
|
+
// packages/react/src/provider.tsx
|
|
387
|
+
import { I18nProvider, useLocale } from "react-aria-components";
|
|
388
|
+
|
|
67
389
|
// shared/package-runtime/layer-keyboard.ts
|
|
68
390
|
import { isComposingKey } from "@kjun-ui/tokens";
|
|
69
391
|
function installLayerKeyboard(document2, state, keyupFallback = false) {
|
|
@@ -130,7 +452,7 @@ function installLayerKeyboard(document2, state, keyupFallback = false) {
|
|
|
130
452
|
}
|
|
131
453
|
|
|
132
454
|
// shared/package-runtime/use-layer.tsx
|
|
133
|
-
import { createContext as
|
|
455
|
+
import { createContext as createContext3, useContext as useContext3, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
134
456
|
|
|
135
457
|
// shared/package-runtime/layer-state.ts
|
|
136
458
|
function chooseReturnTarget(chosen, fallback2) {
|
|
@@ -283,21 +605,21 @@ function createLayerState() {
|
|
|
283
605
|
}
|
|
284
606
|
|
|
285
607
|
// shared/package-runtime/use-layer.tsx
|
|
286
|
-
import { jsx as
|
|
608
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
287
609
|
var fallback = createLayerState();
|
|
288
|
-
var LayerContext =
|
|
289
|
-
var LayerScope =
|
|
610
|
+
var LayerContext = createContext3(fallback);
|
|
611
|
+
var LayerScope = createContext3(void 0);
|
|
290
612
|
function LayerProvider({ children, escapeKeyUpFallback = false }) {
|
|
291
|
-
const parent =
|
|
613
|
+
const parent = useContext3(LayerContext);
|
|
292
614
|
const [state] = useState(() => parent === fallback ? createLayerState() : parent);
|
|
293
615
|
useLayoutEffect(() => {
|
|
294
616
|
if (parent !== fallback || typeof document === "undefined") return;
|
|
295
617
|
return installLayerKeyboard(document, state, escapeKeyUpFallback);
|
|
296
618
|
}, [state, parent, escapeKeyUpFallback]);
|
|
297
|
-
return /* @__PURE__ */
|
|
619
|
+
return /* @__PURE__ */ jsx3(LayerContext.Provider, { value: state, children });
|
|
298
620
|
}
|
|
299
621
|
function useLayerState() {
|
|
300
|
-
const state =
|
|
622
|
+
const state = useContext3(LayerContext);
|
|
301
623
|
useSyncExternalStore(state.subscribe, state.snapshot, state.snapshot);
|
|
302
624
|
return state;
|
|
303
625
|
}
|
|
@@ -306,7 +628,7 @@ function usePopupExpanded(open, trigger) {
|
|
|
306
628
|
return open && ![...state.entries.values()].some((layer) => layer.kind === "popup" && layer.blocked && layer.returnTarget === target);
|
|
307
629
|
}
|
|
308
630
|
function usePopupFocusGuard(trigger) {
|
|
309
|
-
const state =
|
|
631
|
+
const state = useContext3(LayerContext);
|
|
310
632
|
return {
|
|
311
633
|
canOpen: () => !state.isRestoredFocus(focusTrigger(trigger.current)),
|
|
312
634
|
clear: () => state.clearRestoredFocus(focusTrigger(trigger.current))
|
|
@@ -341,7 +663,7 @@ function restoreFocus(target, state, id, fallback2) {
|
|
|
341
663
|
}
|
|
342
664
|
function useLayer(open, present, kind, close, trigger, returnFocus) {
|
|
343
665
|
var _a;
|
|
344
|
-
const state = useLayerState(), parent =
|
|
666
|
+
const state = useLayerState(), parent = useContext3(LayerScope), id = useId();
|
|
345
667
|
const callback = useRef(close);
|
|
346
668
|
callback.current = close;
|
|
347
669
|
const returnRef = useRef(returnFocus);
|
|
@@ -450,21 +772,24 @@ var domainColorRef = (required) => required ? (element) => {
|
|
|
450
772
|
|
|
451
773
|
// packages/react/src/provider.tsx
|
|
452
774
|
import {
|
|
453
|
-
createContext as
|
|
454
|
-
useContext as
|
|
775
|
+
createContext as createContext4,
|
|
776
|
+
useContext as useContext4,
|
|
455
777
|
useEffect,
|
|
456
778
|
useLayoutEffect as useLayoutEffect2,
|
|
457
779
|
useState as useState2
|
|
458
780
|
} from "react";
|
|
459
|
-
import { jsx as
|
|
460
|
-
var PortalContext =
|
|
461
|
-
var useKjunPortalContainer = () =>
|
|
781
|
+
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
782
|
+
var PortalContext = createContext4(void 0);
|
|
783
|
+
var useKjunPortalContainer = () => useContext4(PortalContext);
|
|
462
784
|
function KjunProvider({
|
|
463
785
|
icons,
|
|
786
|
+
locale,
|
|
787
|
+
messages,
|
|
464
788
|
children,
|
|
465
789
|
className = "",
|
|
466
790
|
...props
|
|
467
791
|
}) {
|
|
792
|
+
var _a;
|
|
468
793
|
const [portal, setPortal] = useState2(null);
|
|
469
794
|
const [container, setContainer] = useState2(null);
|
|
470
795
|
const parentPortal = useKjunPortalContainer();
|
|
@@ -485,10 +810,13 @@ function KjunProvider({
|
|
|
485
810
|
if (!container) return;
|
|
486
811
|
validateKjunCssScope(container);
|
|
487
812
|
});
|
|
488
|
-
|
|
813
|
+
const outerLocale = useLocale().locale;
|
|
814
|
+
const intl = (_a = normalizeLocale(locale).intl) != null ? _a : outerLocale;
|
|
815
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
489
816
|
children,
|
|
490
|
-
parentPortal === void 0 && /* @__PURE__ */
|
|
491
|
-
] })
|
|
817
|
+
parentPortal === void 0 && /* @__PURE__ */ jsx4("div", { ref: setPortal, "data-kjun-layer-host": "" })
|
|
818
|
+
] });
|
|
819
|
+
return /* @__PURE__ */ jsx4("div", { ...props, ref: setContainer, className: "kjun-scope " + className, children: /* @__PURE__ */ jsx4(KjunMessagesProvider, { locale, messages, children: /* @__PURE__ */ jsx4(IconProvider, { icons, children: /* @__PURE__ */ jsx4(PortalContext.Provider, { value: portal, children: /* @__PURE__ */ jsx4(LayerProvider, { children: /* @__PURE__ */ jsx4(I18nProvider, { locale: intl, children: content }) }) }) }) }) });
|
|
492
820
|
}
|
|
493
821
|
|
|
494
822
|
// shared/package-runtime/typography.ts
|
|
@@ -514,20 +842,20 @@ function inputTypeStyle(size) {
|
|
|
514
842
|
}
|
|
515
843
|
|
|
516
844
|
// packages/react/src/top-navigation-context.ts
|
|
517
|
-
import { createContext as
|
|
518
|
-
var TopNavigationContext =
|
|
845
|
+
import { createContext as createContext5 } from "react";
|
|
846
|
+
var TopNavigationContext = createContext5(null);
|
|
519
847
|
|
|
520
848
|
// shared/package-runtime/action-size.ts
|
|
521
|
-
import { createContext as
|
|
849
|
+
import { createContext as createContext6, useContext as useContext5 } from "react";
|
|
522
850
|
|
|
523
851
|
// shared/package-runtime/alert-action-size.ts
|
|
524
852
|
var alertActionSizes = { sm: "xs", md: "sm" };
|
|
525
853
|
|
|
526
854
|
// shared/package-runtime/action-size.ts
|
|
527
|
-
var ActionSizeContext =
|
|
855
|
+
var ActionSizeContext = createContext6(null);
|
|
528
856
|
function useActionSize(requested, fallback2) {
|
|
529
857
|
var _a;
|
|
530
|
-
const inherited =
|
|
858
|
+
const inherited = useContext5(ActionSizeContext);
|
|
531
859
|
return (_a = requested != null ? requested : inherited) != null ? _a : fallback2;
|
|
532
860
|
}
|
|
533
861
|
|
|
@@ -535,13 +863,13 @@ function useActionSize(requested, fallback2) {
|
|
|
535
863
|
import { tokens as tokens3 } from "@kjun-ui/tokens";
|
|
536
864
|
import {
|
|
537
865
|
createElement,
|
|
538
|
-
useContext as
|
|
866
|
+
useContext as useContext6,
|
|
539
867
|
forwardRef,
|
|
540
868
|
useEffect as useEffect2,
|
|
541
869
|
useRef as useRef2,
|
|
542
870
|
useState as useState3
|
|
543
871
|
} from "react";
|
|
544
|
-
import { jsx as
|
|
872
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
545
873
|
function KjunIcon({
|
|
546
874
|
name,
|
|
547
875
|
size = "1em",
|
|
@@ -551,7 +879,7 @@ function KjunIcon({
|
|
|
551
879
|
...props
|
|
552
880
|
}) {
|
|
553
881
|
const { nodes, filled: renderFilled } = useIcon(name, filled);
|
|
554
|
-
return /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ jsx5(
|
|
555
883
|
"svg",
|
|
556
884
|
{
|
|
557
885
|
width: size,
|
|
@@ -593,6 +921,7 @@ var KjunButton = forwardRef(
|
|
|
593
921
|
var _a, _b;
|
|
594
922
|
const {
|
|
595
923
|
variant = "primary",
|
|
924
|
+
shape = "default",
|
|
596
925
|
size: declaredSize = "md",
|
|
597
926
|
loading = false,
|
|
598
927
|
disabled = false,
|
|
@@ -615,7 +944,7 @@ var KjunButton = forwardRef(
|
|
|
615
944
|
const busy = useMinimumLoading(loading);
|
|
616
945
|
const hasContent2 = children !== void 0 && children !== null && children !== "" && children !== false;
|
|
617
946
|
const iconOnly = !hasContent2 && !!(prefixIcon || suffixIcon || busy);
|
|
618
|
-
const navigation =
|
|
947
|
+
const navigation = useContext6(TopNavigationContext);
|
|
619
948
|
const height = Math.max(tokens3.button.heights[size], (_a = navigation == null ? void 0 : navigation.controlSize) != null ? _a : 0);
|
|
620
949
|
const iconSize = (_b = navigation == null ? void 0 : navigation.iconSize) != null ? _b : tokens3.button.iconSizes[size];
|
|
621
950
|
const contentHeight = Math.max(
|
|
@@ -644,18 +973,19 @@ var KjunButton = forwardRef(
|
|
|
644
973
|
style: {
|
|
645
974
|
height,
|
|
646
975
|
minHeight: height,
|
|
647
|
-
width: block ? "100%" : iconOnly ? height : void 0,
|
|
976
|
+
width: block ? "100%" : iconOnly || shape === "circle" ? height : void 0,
|
|
648
977
|
// A width set by the caller (fixed square controls) wins over the label minimum.
|
|
649
978
|
minWidth: hasContent2 && !block && (style == null ? void 0 : style.width) == null ? tokens3.button.minWidths[size] : void 0,
|
|
650
979
|
padding: iconOnly ? 0 : `0 ${suffixIcon ? iconSide : paddingX}px 0 ${prefixIcon ? iconSide : paddingX}px`,
|
|
651
980
|
...typeStyle(tokens3.button.typography[size]),
|
|
652
|
-
borderRadius: tokens3.button.radii[size],
|
|
981
|
+
borderRadius: shape === "circle" ? tokens3.shape.pill : tokens3.button.radii[size],
|
|
653
982
|
gap: hasContent2 ? tokens3.button.contentGaps[size] : 0,
|
|
654
983
|
...navigation || wrap ? {
|
|
655
984
|
height: "auto",
|
|
656
985
|
maxWidth: "100%",
|
|
657
986
|
paddingBlock: Math.max(0, (height - contentHeight) / 2)
|
|
658
987
|
} : {},
|
|
988
|
+
...variant === "link" ? { height: "auto", minHeight: 0, minWidth: void 0, width: void 0, padding: 0, borderRadius: 0 } : {},
|
|
659
989
|
...style
|
|
660
990
|
},
|
|
661
991
|
onClick: (e) => {
|
|
@@ -663,7 +993,7 @@ var KjunButton = forwardRef(
|
|
|
663
993
|
if (!disabled && !busy) onClick == null ? void 0 : onClick(e);
|
|
664
994
|
},
|
|
665
995
|
children: [
|
|
666
|
-
before && /* @__PURE__ */
|
|
996
|
+
before && /* @__PURE__ */ jsx5(
|
|
667
997
|
KjunIcon,
|
|
668
998
|
{
|
|
669
999
|
name: before,
|
|
@@ -672,8 +1002,8 @@ var KjunButton = forwardRef(
|
|
|
672
1002
|
size: iconSize
|
|
673
1003
|
}
|
|
674
1004
|
),
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
suffixIcon && /* @__PURE__ */
|
|
1005
|
+
/* @__PURE__ */ jsx5("span", { className: "kjun-button-label", style: { opacity: overlayLoading ? 0 : 1 }, children }),
|
|
1006
|
+
suffixIcon && /* @__PURE__ */ jsx5(
|
|
677
1007
|
KjunIcon,
|
|
678
1008
|
{
|
|
679
1009
|
name: busy && !prefixIcon ? "loader-2" : suffixIcon,
|
|
@@ -683,7 +1013,7 @@ var KjunButton = forwardRef(
|
|
|
683
1013
|
size: iconSize
|
|
684
1014
|
}
|
|
685
1015
|
),
|
|
686
|
-
overlayLoading && /* @__PURE__ */
|
|
1016
|
+
overlayLoading && /* @__PURE__ */ jsx5("span", { className: "kjun-button-loader", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(KjunIcon, { name: "loader-2", spin: true, size: iconSize }) })
|
|
687
1017
|
]
|
|
688
1018
|
}
|
|
689
1019
|
);
|
|
@@ -701,9 +1031,9 @@ function mergeIds(...lists) {
|
|
|
701
1031
|
|
|
702
1032
|
// packages/react/src/input.tsx
|
|
703
1033
|
import {
|
|
704
|
-
createContext as
|
|
1034
|
+
createContext as createContext7,
|
|
705
1035
|
forwardRef as forwardRef2,
|
|
706
|
-
useContext as
|
|
1036
|
+
useContext as useContext7,
|
|
707
1037
|
useId as useId2,
|
|
708
1038
|
useImperativeHandle,
|
|
709
1039
|
useLayoutEffect as useLayoutEffect3,
|
|
@@ -728,37 +1058,43 @@ function useCompositionGuard() {
|
|
|
728
1058
|
}
|
|
729
1059
|
|
|
730
1060
|
// packages/react/src/input.tsx
|
|
731
|
-
import { jsx as
|
|
732
|
-
var FieldContext =
|
|
733
|
-
var useKjunField = () =>
|
|
1061
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1062
|
+
var FieldContext = createContext7(null);
|
|
1063
|
+
var useKjunField = () => useContext7(FieldContext);
|
|
734
1064
|
function KjunFormGroup({
|
|
735
1065
|
label,
|
|
736
1066
|
id,
|
|
737
1067
|
required = false,
|
|
1068
|
+
optional = false,
|
|
738
1069
|
error = "",
|
|
739
1070
|
hint = "",
|
|
740
1071
|
labelHidden = false,
|
|
741
1072
|
children
|
|
742
1073
|
}) {
|
|
1074
|
+
const m = useKjunMessages();
|
|
743
1075
|
const uid = useId2().replace(/:/g, "");
|
|
744
1076
|
const fieldId = id || "kjun-field-" + uid;
|
|
745
1077
|
const labelId = label ? fieldId + "-label" : void 0;
|
|
746
1078
|
const hintId = hint ? fieldId + "-hint" : void 0, errorId = error ? fieldId + "-error" : void 0;
|
|
747
1079
|
const describedBy = mergeIds(hintId, errorId);
|
|
748
1080
|
const [controlId, setControlId] = useState4();
|
|
749
|
-
return /* @__PURE__ */
|
|
1081
|
+
return /* @__PURE__ */ jsx6(
|
|
750
1082
|
FieldContext.Provider,
|
|
751
1083
|
{
|
|
752
1084
|
value: { id: fieldId, labelId, describedBy, error, required, setControlId },
|
|
753
1085
|
children: /* @__PURE__ */ jsxs3("div", { className: "kjun-form-group", children: [
|
|
754
1086
|
label && /* @__PURE__ */ jsxs3("label", { className: "kjun-form-label" + (labelHidden ? " kjun-sr-only" : ""), id: labelId, htmlFor: controlId || fieldId, children: [
|
|
755
1087
|
label,
|
|
756
|
-
required && /* @__PURE__ */
|
|
1088
|
+
required && /* @__PURE__ */ jsx6("span", { style: { color: "var(--_kjun-color-danger)" }, children: " *" }),
|
|
1089
|
+
optional && !required && /* @__PURE__ */ jsxs3("span", { className: "kjun-form-optional", children: [
|
|
1090
|
+
" ",
|
|
1091
|
+
m.optional
|
|
1092
|
+
] })
|
|
757
1093
|
] }),
|
|
758
1094
|
children,
|
|
759
|
-
hint && /* @__PURE__ */
|
|
1095
|
+
hint && /* @__PURE__ */ jsx6("p", { id: hintId, className: "kjun-form-hint", children: hint }),
|
|
760
1096
|
error && /* @__PURE__ */ jsxs3("p", { id: errorId, className: "kjun-form-error", role: "alert", children: [
|
|
761
|
-
/* @__PURE__ */
|
|
1097
|
+
/* @__PURE__ */ jsx6(KjunIcon, { name: "alert-circle", size: tokens4.extensions.form.messageIconSize }),
|
|
762
1098
|
error
|
|
763
1099
|
] })
|
|
764
1100
|
] })
|
|
@@ -792,7 +1128,8 @@ var KjunInput = forwardRef2(
|
|
|
792
1128
|
required,
|
|
793
1129
|
...props
|
|
794
1130
|
}, ref) {
|
|
795
|
-
const
|
|
1131
|
+
const m = useKjunMessages();
|
|
1132
|
+
const field = useContext7(FieldContext);
|
|
796
1133
|
const uid = "kjun-" + useId2().replace(/:/g, "");
|
|
797
1134
|
const input = useRef4(null);
|
|
798
1135
|
const composition = useCompositionGuard();
|
|
@@ -821,16 +1158,16 @@ var KjunInput = forwardRef2(
|
|
|
821
1158
|
const describedBy = mergeIds(props["aria-describedby"], field == null ? void 0 : field.describedBy, showError ? ownErrorId : void 0);
|
|
822
1159
|
return /* @__PURE__ */ jsxs3("div", { style: { minWidth: 0 }, children: [
|
|
823
1160
|
/* @__PURE__ */ jsxs3("div", { className: "kjun-input-wrap", "data-disabled": disabled || void 0, children: [
|
|
824
|
-
(prefix || prefixIcon) && /* @__PURE__ */
|
|
1161
|
+
(prefix || prefixIcon) && /* @__PURE__ */ jsx6(
|
|
825
1162
|
"span",
|
|
826
1163
|
{
|
|
827
1164
|
ref: before,
|
|
828
1165
|
className: "kjun-input-affix",
|
|
829
1166
|
style: { left: spec.padding, pointerEvents: "none" },
|
|
830
|
-
children: prefix || /* @__PURE__ */
|
|
1167
|
+
children: prefix || /* @__PURE__ */ jsx6(KjunIcon, { name: prefixIcon, size: spec.iconSize })
|
|
831
1168
|
}
|
|
832
1169
|
),
|
|
833
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ jsx6(
|
|
834
1171
|
"input",
|
|
835
1172
|
{
|
|
836
1173
|
...props,
|
|
@@ -881,12 +1218,12 @@ var KjunInput = forwardRef2(
|
|
|
881
1218
|
className: "kjun-input-affix",
|
|
882
1219
|
style: { right: spec.padding },
|
|
883
1220
|
children: [
|
|
884
|
-
clearable && !!value && /* @__PURE__ */
|
|
1221
|
+
clearable && !!value && /* @__PURE__ */ jsx6(
|
|
885
1222
|
KjunButton,
|
|
886
1223
|
{
|
|
887
1224
|
variant: "ghost",
|
|
888
1225
|
size: "sm",
|
|
889
|
-
ariaLabel:
|
|
1226
|
+
ariaLabel: m.clearInput,
|
|
890
1227
|
disabled: disabled || readOnly,
|
|
891
1228
|
style: {
|
|
892
1229
|
padding: 0,
|
|
@@ -908,15 +1245,15 @@ var KjunInput = forwardRef2(
|
|
|
908
1245
|
onClear == null ? void 0 : onClear();
|
|
909
1246
|
el.focus();
|
|
910
1247
|
},
|
|
911
|
-
children: /* @__PURE__ */
|
|
1248
|
+
children: /* @__PURE__ */ jsx6(KjunIcon, { name: "x", size: spec.iconSize })
|
|
912
1249
|
}
|
|
913
1250
|
),
|
|
914
|
-
suffix || suffixIcon && /* @__PURE__ */
|
|
1251
|
+
suffix || suffixIcon && /* @__PURE__ */ jsx6(KjunIcon, { name: suffixIcon, size: spec.iconSize })
|
|
915
1252
|
]
|
|
916
1253
|
}
|
|
917
1254
|
)
|
|
918
1255
|
] }),
|
|
919
|
-
showError && /* @__PURE__ */
|
|
1256
|
+
showError && /* @__PURE__ */ jsx6("p", { className: "kjun-form-error", id: ownErrorId, role: "alert", children: errorMessage })
|
|
920
1257
|
] });
|
|
921
1258
|
}
|
|
922
1259
|
);
|
|
@@ -1023,30 +1360,30 @@ import { Dialog, Heading, Modal, ModalOverlay } from "react-aria-components";
|
|
|
1023
1360
|
|
|
1024
1361
|
// packages/react/src/overlay-host.tsx
|
|
1025
1362
|
import {
|
|
1026
|
-
createContext as
|
|
1027
|
-
useContext as
|
|
1363
|
+
createContext as createContext8,
|
|
1364
|
+
useContext as useContext8,
|
|
1028
1365
|
useLayoutEffect as useLayoutEffect5,
|
|
1029
1366
|
useId as useId3
|
|
1030
1367
|
} from "react";
|
|
1031
|
-
var FeedbackOverlayContext =
|
|
1368
|
+
var FeedbackOverlayContext = createContext8(
|
|
1032
1369
|
null
|
|
1033
1370
|
);
|
|
1034
1371
|
function FeedbackLayerOutlet() {
|
|
1035
1372
|
var _a;
|
|
1036
|
-
const layers = useLayerState(), scope =
|
|
1373
|
+
const layers = useLayerState(), scope = useContext8(LayerScope);
|
|
1037
1374
|
const entry = scope ? layers.entries.get(scope) : void 0;
|
|
1038
1375
|
const active = !!entry && layers.isActive(entry.id), order = (_a = entry == null ? void 0 : entry.order) != null ? _a : 0;
|
|
1039
|
-
const host =
|
|
1376
|
+
const host = useContext8(FeedbackOverlayContext), id = "kjun-" + useId3(), register = host == null ? void 0 : host.register;
|
|
1040
1377
|
useLayoutEffect5(() => active ? register == null ? void 0 : register(id, order) : void 0, [register, id, active, order]);
|
|
1041
1378
|
return (host == null ? void 0 : host.top) === id ? host.render() : null;
|
|
1042
1379
|
}
|
|
1043
1380
|
|
|
1044
1381
|
// packages/react/src/modal.tsx
|
|
1045
|
-
import { jsx as
|
|
1382
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1046
1383
|
function KjunFormActions({
|
|
1047
1384
|
size = "lg",
|
|
1048
|
-
cancelText
|
|
1049
|
-
confirmText
|
|
1385
|
+
cancelText,
|
|
1386
|
+
confirmText,
|
|
1050
1387
|
showCancel = true,
|
|
1051
1388
|
showConfirm = true,
|
|
1052
1389
|
cancelDisabled = false,
|
|
@@ -1057,10 +1394,13 @@ function KjunFormActions({
|
|
|
1057
1394
|
onCancel,
|
|
1058
1395
|
onConfirm
|
|
1059
1396
|
}) {
|
|
1397
|
+
const m = useKjunMessages();
|
|
1398
|
+
cancelText != null ? cancelText : cancelText = m.cancel;
|
|
1399
|
+
confirmText != null ? confirmText : confirmText = m.save;
|
|
1060
1400
|
const ref = useRef6(null);
|
|
1061
1401
|
useLayoutEffect6(() => observeFormActions(ref.current), []);
|
|
1062
1402
|
return /* @__PURE__ */ jsxs4("div", { className: "kjun-form-actions", ref, children: [
|
|
1063
|
-
showCancel && /* @__PURE__ */
|
|
1403
|
+
showCancel && /* @__PURE__ */ jsx7(
|
|
1064
1404
|
KjunButton,
|
|
1065
1405
|
{
|
|
1066
1406
|
size,
|
|
@@ -1070,7 +1410,7 @@ function KjunFormActions({
|
|
|
1070
1410
|
children: cancelText
|
|
1071
1411
|
}
|
|
1072
1412
|
),
|
|
1073
|
-
showConfirm && /* @__PURE__ */
|
|
1413
|
+
showConfirm && /* @__PURE__ */ jsx7(
|
|
1074
1414
|
KjunButton,
|
|
1075
1415
|
{
|
|
1076
1416
|
size,
|
|
@@ -1098,8 +1438,8 @@ function KjunModal({
|
|
|
1098
1438
|
showFooter = false,
|
|
1099
1439
|
showConfirmButton = true,
|
|
1100
1440
|
showCancelButton = true,
|
|
1101
|
-
confirmText
|
|
1102
|
-
cancelText
|
|
1441
|
+
confirmText,
|
|
1442
|
+
cancelText,
|
|
1103
1443
|
confirmDisabled = false,
|
|
1104
1444
|
loading = false,
|
|
1105
1445
|
noPadding = false,
|
|
@@ -1111,6 +1451,9 @@ function KjunModal({
|
|
|
1111
1451
|
children,
|
|
1112
1452
|
ariaLabel
|
|
1113
1453
|
}) {
|
|
1454
|
+
const m = useKjunMessages();
|
|
1455
|
+
confirmText != null ? confirmText : confirmText = m.confirm;
|
|
1456
|
+
cancelText != null ? cancelText : cancelText = m.cancel;
|
|
1114
1457
|
const motion = usePresence(open, useReducedMotion());
|
|
1115
1458
|
const portalContainer = useKjunPortalContainer();
|
|
1116
1459
|
const id = "kjun-" + useId4();
|
|
@@ -1126,7 +1469,7 @@ function KjunModal({
|
|
|
1126
1469
|
if (closeOnEsc) close();
|
|
1127
1470
|
});
|
|
1128
1471
|
if (portalContainer === null) return null;
|
|
1129
|
-
return /* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ jsx7(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx7(
|
|
1130
1473
|
ModalOverlay,
|
|
1131
1474
|
{
|
|
1132
1475
|
style: { zIndex: layer.zIndex },
|
|
@@ -1143,7 +1486,7 @@ function KjunModal({
|
|
|
1143
1486
|
"data-motion-open": String(motion.active),
|
|
1144
1487
|
inert: !open || !layer.active,
|
|
1145
1488
|
UNSTABLE_portalContainer: portalContainer,
|
|
1146
|
-
children: /* @__PURE__ */
|
|
1489
|
+
children: /* @__PURE__ */ jsx7(
|
|
1147
1490
|
Modal,
|
|
1148
1491
|
{
|
|
1149
1492
|
className: "kjun-modal",
|
|
@@ -1162,23 +1505,23 @@ function KjunModal({
|
|
|
1162
1505
|
const entry = layer.state.entries.get(layer.id);
|
|
1163
1506
|
if (entry) entry.root = node;
|
|
1164
1507
|
},
|
|
1165
|
-
"aria-label": explicitLabel || (labelledByHeading ? void 0 : title.trim() ||
|
|
1508
|
+
"aria-label": explicitLabel || (labelledByHeading ? void 0 : title.trim() || m.dialog),
|
|
1166
1509
|
"aria-labelledby": labelledByHeading ? id : void 0,
|
|
1167
1510
|
children: [
|
|
1168
1511
|
showHeader && /* @__PURE__ */ jsxs4("div", { className: "kjun-modal-header", children: [
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
closable && /* @__PURE__ */
|
|
1512
|
+
/* @__PURE__ */ jsx7(Heading, { slot: "title", id, className: "kjun-modal-title", children: heading }),
|
|
1513
|
+
closable && /* @__PURE__ */ jsx7(
|
|
1171
1514
|
"button",
|
|
1172
1515
|
{
|
|
1173
1516
|
type: "button",
|
|
1174
1517
|
className: "kjun-modal-close",
|
|
1175
|
-
"aria-label":
|
|
1518
|
+
"aria-label": m.close,
|
|
1176
1519
|
onClick: close,
|
|
1177
|
-
children: /* @__PURE__ */
|
|
1520
|
+
children: /* @__PURE__ */ jsx7(KjunIcon, { name: "x", size: tokens6.modal.closeIconSize })
|
|
1178
1521
|
}
|
|
1179
1522
|
)
|
|
1180
1523
|
] }),
|
|
1181
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ jsx7(
|
|
1182
1525
|
"div",
|
|
1183
1526
|
{
|
|
1184
1527
|
className: "kjun-modal-body",
|
|
@@ -1186,7 +1529,7 @@ function KjunModal({
|
|
|
1186
1529
|
children
|
|
1187
1530
|
}
|
|
1188
1531
|
),
|
|
1189
|
-
(showFooter || footer) && /* @__PURE__ */
|
|
1532
|
+
(showFooter || footer) && /* @__PURE__ */ jsx7("div", { className: "kjun-modal-footer", children: footer || /* @__PURE__ */ jsx7(
|
|
1190
1533
|
KjunFormActions,
|
|
1191
1534
|
{
|
|
1192
1535
|
size: footerSize,
|
|
@@ -1205,7 +1548,7 @@ function KjunModal({
|
|
|
1205
1548
|
}
|
|
1206
1549
|
}
|
|
1207
1550
|
) }),
|
|
1208
|
-
/* @__PURE__ */
|
|
1551
|
+
/* @__PURE__ */ jsx7(FeedbackLayerOutlet, {})
|
|
1209
1552
|
]
|
|
1210
1553
|
}
|
|
1211
1554
|
)
|
|
@@ -1216,12 +1559,12 @@ function KjunModal({
|
|
|
1216
1559
|
}
|
|
1217
1560
|
|
|
1218
1561
|
// shared/package-runtime/content-presence.ts
|
|
1219
|
-
import { Fragment, isValidElement } from "react";
|
|
1562
|
+
import { Fragment as Fragment2, isValidElement } from "react";
|
|
1220
1563
|
function hasContent(node) {
|
|
1221
1564
|
if (node == null || typeof node === "boolean") return false;
|
|
1222
1565
|
if (typeof node === "string") return node.trim().length > 0;
|
|
1223
1566
|
if (Array.isArray(node)) return node.some(hasContent);
|
|
1224
|
-
if (isValidElement(node) && node.type ===
|
|
1567
|
+
if (isValidElement(node) && node.type === Fragment2)
|
|
1225
1568
|
return hasContent(node.props.children);
|
|
1226
1569
|
return true;
|
|
1227
1570
|
}
|
|
@@ -1240,7 +1583,7 @@ import {
|
|
|
1240
1583
|
} from "react";
|
|
1241
1584
|
|
|
1242
1585
|
// packages/react/src/card.tsx
|
|
1243
|
-
import { Fragment as
|
|
1586
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1244
1587
|
function KjunCard({
|
|
1245
1588
|
title,
|
|
1246
1589
|
subtitle,
|
|
@@ -1281,23 +1624,23 @@ function KjunCard({
|
|
|
1281
1624
|
...style
|
|
1282
1625
|
},
|
|
1283
1626
|
children: [
|
|
1284
|
-
hasContent(media) && /* @__PURE__ */
|
|
1627
|
+
hasContent(media) && /* @__PURE__ */ jsx8("div", { className: "kjun-card-media", children: media }),
|
|
1285
1628
|
hasHeader && /* @__PURE__ */ jsxs5("div", { className: "kjun-card-header", "data-description": !hasContent(header) && hasContent(subtitle), children: [
|
|
1286
|
-
hasHeading && /* @__PURE__ */
|
|
1287
|
-
title && /* @__PURE__ */
|
|
1288
|
-
subtitle && /* @__PURE__ */
|
|
1629
|
+
hasHeading && /* @__PURE__ */ jsx8("div", { className: "kjun-card-heading", children: hasContent(header) ? header : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1630
|
+
title && /* @__PURE__ */ jsx8("h3", { children: title }),
|
|
1631
|
+
subtitle && /* @__PURE__ */ jsx8("p", { children: subtitle })
|
|
1289
1632
|
] }) }),
|
|
1290
|
-
hasContent(headerActions) && /* @__PURE__ */
|
|
1633
|
+
hasContent(headerActions) && /* @__PURE__ */ jsx8("div", { className: "kjun-card-actions", children: headerActions })
|
|
1291
1634
|
] }),
|
|
1292
|
-
hasContent(children) && /* @__PURE__ */
|
|
1293
|
-
hasContent(footer) && /* @__PURE__ */
|
|
1635
|
+
hasContent(children) && /* @__PURE__ */ jsx8("div", { className: "kjun-card-body", children }),
|
|
1636
|
+
hasContent(footer) && /* @__PURE__ */ jsx8("div", { className: "kjun-card-footer", children: footer })
|
|
1294
1637
|
]
|
|
1295
1638
|
}
|
|
1296
1639
|
);
|
|
1297
1640
|
}
|
|
1298
1641
|
|
|
1299
1642
|
// packages/react/src/display.tsx
|
|
1300
|
-
import { jsx as
|
|
1643
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1301
1644
|
var role = (name) => `var(--_kjun-color-${name})`;
|
|
1302
1645
|
function KjunBadge({
|
|
1303
1646
|
variant = "default",
|
|
@@ -1327,28 +1670,31 @@ function KjunBadge({
|
|
|
1327
1670
|
...style
|
|
1328
1671
|
},
|
|
1329
1672
|
children: [
|
|
1330
|
-
dot && /* @__PURE__ */
|
|
1673
|
+
dot && /* @__PURE__ */ jsx9("span", { className: "kjun-badge-dot" }),
|
|
1331
1674
|
children
|
|
1332
1675
|
]
|
|
1333
1676
|
}
|
|
1334
1677
|
);
|
|
1335
1678
|
}
|
|
1336
1679
|
function KjunEmpty({
|
|
1337
|
-
text
|
|
1680
|
+
text,
|
|
1338
1681
|
description,
|
|
1339
1682
|
icon,
|
|
1340
1683
|
children
|
|
1341
1684
|
}) {
|
|
1685
|
+
const m = useKjunMessages();
|
|
1686
|
+
text != null ? text : text = m.noData;
|
|
1342
1687
|
return /* @__PURE__ */ jsxs6("div", { className: "kjun-empty", children: [
|
|
1343
|
-
icon && /* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
description && /* @__PURE__ */
|
|
1346
|
-
children && /* @__PURE__ */
|
|
1688
|
+
icon && /* @__PURE__ */ jsx9(KjunIcon, { name: icon, size: tokens7.extensions.empty.iconSize }),
|
|
1689
|
+
/* @__PURE__ */ jsx9("p", { children: text }),
|
|
1690
|
+
description && /* @__PURE__ */ jsx9("small", { children: description }),
|
|
1691
|
+
children && /* @__PURE__ */ jsx9("div", { children })
|
|
1347
1692
|
] });
|
|
1348
1693
|
}
|
|
1349
1694
|
function KjunSpinner({ size = "md", text }) {
|
|
1695
|
+
const m = useKjunMessages();
|
|
1350
1696
|
const stroke = tokens7.extensions.spinner.strokeWidths[size] * 24 / tokens7.extensions.spinner.sizes[size];
|
|
1351
|
-
return /* @__PURE__ */ jsxs6("span", { role: "status", "aria-label": text ||
|
|
1697
|
+
return /* @__PURE__ */ jsxs6("span", { role: "status", "aria-label": text || m.loading, className: "kjun-spinner", children: [
|
|
1352
1698
|
/* @__PURE__ */ jsxs6(
|
|
1353
1699
|
"svg",
|
|
1354
1700
|
{
|
|
@@ -1359,7 +1705,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
1359
1705
|
fill: "none",
|
|
1360
1706
|
"aria-hidden": "true",
|
|
1361
1707
|
children: [
|
|
1362
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ jsx9(
|
|
1363
1709
|
"circle",
|
|
1364
1710
|
{
|
|
1365
1711
|
cx: "12",
|
|
@@ -1370,7 +1716,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
1370
1716
|
opacity: ".25"
|
|
1371
1717
|
}
|
|
1372
1718
|
),
|
|
1373
|
-
/* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ jsx9(
|
|
1374
1720
|
"path",
|
|
1375
1721
|
{
|
|
1376
1722
|
d: "M22 12A10 10 0 0 0 12 2",
|
|
@@ -1381,7 +1727,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
1381
1727
|
]
|
|
1382
1728
|
}
|
|
1383
1729
|
),
|
|
1384
|
-
text && /* @__PURE__ */
|
|
1730
|
+
text && /* @__PURE__ */ jsx9("span", { children: text })
|
|
1385
1731
|
] });
|
|
1386
1732
|
}
|
|
1387
1733
|
function KjunAlert({
|
|
@@ -1395,6 +1741,7 @@ function KjunAlert({
|
|
|
1395
1741
|
actions,
|
|
1396
1742
|
onClose
|
|
1397
1743
|
}) {
|
|
1744
|
+
const m = useKjunMessages();
|
|
1398
1745
|
const [visible, setVisible] = useState6(true);
|
|
1399
1746
|
if (!visible) return null;
|
|
1400
1747
|
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
@@ -1409,7 +1756,7 @@ function KjunAlert({
|
|
|
1409
1756
|
borderColor: role(tone === "primary" ? "brand-light" : tone + "-light")
|
|
1410
1757
|
},
|
|
1411
1758
|
children: [
|
|
1412
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ jsx9("span", { className: "kjun-alert-icon", style: { color: role(tone === "primary" ? "brand" : tone + "-accent") }, children: /* @__PURE__ */ jsx9(
|
|
1413
1760
|
KjunIcon,
|
|
1414
1761
|
{
|
|
1415
1762
|
name: {
|
|
@@ -1423,21 +1770,21 @@ function KjunAlert({
|
|
|
1423
1770
|
}
|
|
1424
1771
|
) }),
|
|
1425
1772
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-alert-content", children: [
|
|
1426
|
-
hasContent(title) && /* @__PURE__ */
|
|
1427
|
-
hasContent(children) && /* @__PURE__ */
|
|
1428
|
-
hasContent(actions) && /* @__PURE__ */
|
|
1773
|
+
hasContent(title) && /* @__PURE__ */ jsx9("div", { className: "kjun-alert-title", children: title }),
|
|
1774
|
+
hasContent(children) && /* @__PURE__ */ jsx9("div", { className: "kjun-alert-description", children }),
|
|
1775
|
+
hasContent(actions) && /* @__PURE__ */ jsx9(ActionSizeContext.Provider, { value: alertActionSizes[small ? "sm" : "md"], children: /* @__PURE__ */ jsx9("div", { className: "kjun-alert-actions", children: actions }) })
|
|
1429
1776
|
] }),
|
|
1430
|
-
closable && /* @__PURE__ */
|
|
1777
|
+
closable && /* @__PURE__ */ jsx9(
|
|
1431
1778
|
"button",
|
|
1432
1779
|
{
|
|
1433
1780
|
className: "kjun-alert-close",
|
|
1434
1781
|
type: "button",
|
|
1435
|
-
"aria-label":
|
|
1782
|
+
"aria-label": m.close,
|
|
1436
1783
|
onClick: () => {
|
|
1437
1784
|
setVisible(false);
|
|
1438
1785
|
onClose == null ? void 0 : onClose();
|
|
1439
1786
|
},
|
|
1440
|
-
children: /* @__PURE__ */
|
|
1787
|
+
children: /* @__PURE__ */ jsx9(KjunIcon, { name: "x", size: tokens7.extensions.alert.closeIconSize })
|
|
1441
1788
|
}
|
|
1442
1789
|
)
|
|
1443
1790
|
]
|
|
@@ -1453,26 +1800,27 @@ function KjunProgress({
|
|
|
1453
1800
|
label,
|
|
1454
1801
|
subLabel
|
|
1455
1802
|
}) {
|
|
1803
|
+
const m = useKjunMessages();
|
|
1456
1804
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
1457
1805
|
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", children: [
|
|
1458
1806
|
(label || showLabel) && /* @__PURE__ */ jsxs6("div", { className: "kjun-progress-label", children: [
|
|
1459
|
-
label && /* @__PURE__ */
|
|
1807
|
+
label && /* @__PURE__ */ jsx9("span", { children: label }),
|
|
1460
1808
|
showLabel && /* @__PURE__ */ jsxs6("span", { children: [
|
|
1461
1809
|
percentage,
|
|
1462
1810
|
"%"
|
|
1463
1811
|
] })
|
|
1464
1812
|
] }),
|
|
1465
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsx9(
|
|
1466
1814
|
"div",
|
|
1467
1815
|
{
|
|
1468
1816
|
role: "progressbar",
|
|
1469
|
-
"aria-label": typeof label === "string" ? label :
|
|
1817
|
+
"aria-label": typeof label === "string" ? label : m.progress,
|
|
1470
1818
|
"aria-valuemin": 0,
|
|
1471
1819
|
"aria-valuemax": 100,
|
|
1472
1820
|
"aria-valuenow": percentage,
|
|
1473
1821
|
className: "kjun-progress-track",
|
|
1474
1822
|
style: { height: tokens7.extensions.progress.heights[size] },
|
|
1475
|
-
children: /* @__PURE__ */
|
|
1823
|
+
children: /* @__PURE__ */ jsx9(
|
|
1476
1824
|
"div",
|
|
1477
1825
|
{
|
|
1478
1826
|
style: {
|
|
@@ -1483,7 +1831,7 @@ function KjunProgress({
|
|
|
1483
1831
|
)
|
|
1484
1832
|
}
|
|
1485
1833
|
),
|
|
1486
|
-
subLabel && /* @__PURE__ */
|
|
1834
|
+
subLabel && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-sub", children: subLabel })
|
|
1487
1835
|
] });
|
|
1488
1836
|
}
|
|
1489
1837
|
function KjunSkeleton({
|
|
@@ -1495,7 +1843,7 @@ function KjunSkeleton({
|
|
|
1495
1843
|
animated = true,
|
|
1496
1844
|
rounded = true
|
|
1497
1845
|
}) {
|
|
1498
|
-
const line = (w, key, h) => /* @__PURE__ */
|
|
1846
|
+
const line = (w, key, h) => /* @__PURE__ */ jsx9(
|
|
1499
1847
|
"div",
|
|
1500
1848
|
{
|
|
1501
1849
|
className: "kjun-skeleton-line",
|
|
@@ -1503,7 +1851,7 @@ function KjunSkeleton({
|
|
|
1503
1851
|
},
|
|
1504
1852
|
key
|
|
1505
1853
|
);
|
|
1506
|
-
const avatar = (sm = false) => /* @__PURE__ */
|
|
1854
|
+
const avatar = (sm = false) => /* @__PURE__ */ jsx9(
|
|
1507
1855
|
"div",
|
|
1508
1856
|
{
|
|
1509
1857
|
className: "kjun-skeleton-avatar" + (sm ? " kjun-skeleton-avatar-sm" : ""),
|
|
@@ -1545,11 +1893,11 @@ function KjunSkeleton({
|
|
|
1545
1893
|
line("60%")
|
|
1546
1894
|
] })
|
|
1547
1895
|
] }),
|
|
1548
|
-
type === "table" && /* @__PURE__ */
|
|
1896
|
+
type === "table" && /* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-table", children: [0, ...count(rows)].map((row) => /* @__PURE__ */ jsx9(
|
|
1549
1897
|
"div",
|
|
1550
1898
|
{
|
|
1551
1899
|
className: row === 0 ? "kjun-skeleton-table-header" : "kjun-skeleton-table-row",
|
|
1552
|
-
children: count(columns).map((col) => /* @__PURE__ */
|
|
1900
|
+
children: count(columns).map((col) => /* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-table-cell", children: line(
|
|
1553
1901
|
row === 0 ? "70%" : ["45%", "55%", "65%", "75%", "85%"][(row + col) % 5]
|
|
1554
1902
|
) }, col))
|
|
1555
1903
|
},
|
|
@@ -1561,9 +1909,9 @@ function KjunSkeleton({
|
|
|
1561
1909
|
line("60%", 1, tokens7.extensions.skeleton.lineHeights.lg),
|
|
1562
1910
|
line("30%", 2, tokens7.extensions.skeleton.lineHeights.sm)
|
|
1563
1911
|
] }),
|
|
1564
|
-
/* @__PURE__ */
|
|
1912
|
+
/* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-stat-chart", children: /* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-sparkline" }) })
|
|
1565
1913
|
] }),
|
|
1566
|
-
type === "block" && /* @__PURE__ */
|
|
1914
|
+
type === "block" && /* @__PURE__ */ jsx9(
|
|
1567
1915
|
"div",
|
|
1568
1916
|
{
|
|
1569
1917
|
className: "kjun-skeleton-block",
|
|
@@ -1584,7 +1932,7 @@ var textTypeClass = (variant) => "kjun-type-" + variant.replace(/[A-Z]/g, (lette
|
|
|
1584
1932
|
var defaultTextTag = (variant) => variant === "pageTitle" ? "h1" : variant === "sectionTitle" ? "h2" : variant === "cardTitle" ? "h3" : numeric.test(variant) ? "span" : "p";
|
|
1585
1933
|
|
|
1586
1934
|
// packages/react/src/layout-primitives.tsx
|
|
1587
|
-
import { jsx as
|
|
1935
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1588
1936
|
var join = (...names) => names.filter(Boolean).join(" ");
|
|
1589
1937
|
function KjunText({ variant = "body", tone = "default", as, align, maxLines, className, style, children, ...rest }) {
|
|
1590
1938
|
const lines = maxLines && maxLines > 0 ? Math.floor(maxLines) : void 0;
|
|
@@ -1610,7 +1958,7 @@ function KjunStack({ gap = "md", align = "stretch", as = "div", className, style
|
|
|
1610
1958
|
}, children);
|
|
1611
1959
|
}
|
|
1612
1960
|
function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = true, className, style, children, ...rest }) {
|
|
1613
|
-
return /* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsx10(
|
|
1614
1962
|
"div",
|
|
1615
1963
|
{
|
|
1616
1964
|
...rest,
|
|
@@ -1628,7 +1976,7 @@ function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = tr
|
|
|
1628
1976
|
|
|
1629
1977
|
// shared/package-runtime/feedback-dialog.ts
|
|
1630
1978
|
import { useRef as useRef7, useState as useState7 } from "react";
|
|
1631
|
-
function useFeedbackDialog(controller, request) {
|
|
1979
|
+
function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
1632
1980
|
const options = request.options;
|
|
1633
1981
|
const [value, setValue] = useState7(options.initialValue || "");
|
|
1634
1982
|
const [error, setError] = useState7("");
|
|
@@ -1656,7 +2004,7 @@ function useFeedbackDialog(controller, request) {
|
|
|
1656
2004
|
if (request.kind === "prompt") {
|
|
1657
2005
|
const valid = (_a = options.validator) == null ? void 0 : _a.call(options, value);
|
|
1658
2006
|
if (valid === false || typeof valid === "string") {
|
|
1659
|
-
setError(typeof valid === "string" ? valid :
|
|
2007
|
+
setError(typeof valid === "string" ? valid : messages.invalidInput);
|
|
1660
2008
|
return;
|
|
1661
2009
|
}
|
|
1662
2010
|
controller.settle(value, void 0, request.id);
|
|
@@ -1722,10 +2070,10 @@ function usePresentedRequest(current, reduced) {
|
|
|
1722
2070
|
}
|
|
1723
2071
|
|
|
1724
2072
|
// packages/react/src/feedback-context.ts
|
|
1725
|
-
import { createContext as
|
|
1726
|
-
var KjunFeedbackContext =
|
|
2073
|
+
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
2074
|
+
var KjunFeedbackContext = createContext9(null);
|
|
1727
2075
|
function useOptionalKjunFeedback() {
|
|
1728
|
-
return
|
|
2076
|
+
return useContext9(KjunFeedbackContext);
|
|
1729
2077
|
}
|
|
1730
2078
|
|
|
1731
2079
|
// packages/react/src/toast-stack.tsx
|
|
@@ -1793,11 +2141,12 @@ function createToastLayout() {
|
|
|
1793
2141
|
|
|
1794
2142
|
// packages/react/src/toast.tsx
|
|
1795
2143
|
import { useEffect as useEffect3, useRef as useRef9 } from "react";
|
|
1796
|
-
import { jsx as
|
|
2144
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1797
2145
|
function ToastView({
|
|
1798
2146
|
toast,
|
|
1799
2147
|
controller
|
|
1800
2148
|
}) {
|
|
2149
|
+
const m = useKjunMessages();
|
|
1801
2150
|
const previous = useRef9(null);
|
|
1802
2151
|
const reasons = useRef9({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
1803
2152
|
useEffect3(() => {
|
|
@@ -1835,18 +2184,18 @@ function ToastView({
|
|
|
1835
2184
|
controller.resumeToast(toast.id, reasons.focus);
|
|
1836
2185
|
},
|
|
1837
2186
|
children: [
|
|
1838
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ jsx11(
|
|
1839
2188
|
"span",
|
|
1840
2189
|
{
|
|
1841
2190
|
className: "kjun-toast-icon",
|
|
1842
2191
|
style: { color: `var(--_kjun-color-${tone}-accent)` },
|
|
1843
|
-
children: /* @__PURE__ */
|
|
2192
|
+
children: /* @__PURE__ */ jsx11(KjunIcon, { name: icon })
|
|
1844
2193
|
}
|
|
1845
2194
|
),
|
|
1846
2195
|
/* @__PURE__ */ jsxs7("div", { className: "kjun-toast-content", children: [
|
|
1847
|
-
toast.title && /* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
toast.action && /* @__PURE__ */
|
|
2196
|
+
toast.title && /* @__PURE__ */ jsx11("strong", { children: toast.title }),
|
|
2197
|
+
/* @__PURE__ */ jsx11("span", { className: "kjun-toast-message", children: toast.message }),
|
|
2198
|
+
toast.action && /* @__PURE__ */ jsx11(
|
|
1850
2199
|
"button",
|
|
1851
2200
|
{
|
|
1852
2201
|
type: "button",
|
|
@@ -1863,17 +2212,17 @@ function ToastView({
|
|
|
1863
2212
|
}
|
|
1864
2213
|
)
|
|
1865
2214
|
] }),
|
|
1866
|
-
toast.closable !== false && /* @__PURE__ */
|
|
2215
|
+
toast.closable !== false && /* @__PURE__ */ jsx11(
|
|
1867
2216
|
"button",
|
|
1868
2217
|
{
|
|
1869
2218
|
type: "button",
|
|
1870
2219
|
className: "kjun-toast-close",
|
|
1871
|
-
"aria-label":
|
|
2220
|
+
"aria-label": m.closeNotification,
|
|
1872
2221
|
onClick: () => dismiss(),
|
|
1873
|
-
children: /* @__PURE__ */
|
|
2222
|
+
children: /* @__PURE__ */ jsx11(KjunIcon, { name: "x" })
|
|
1874
2223
|
}
|
|
1875
2224
|
),
|
|
1876
|
-
toast.showProgress !== false && !!toast.duration && /* @__PURE__ */
|
|
2225
|
+
toast.showProgress !== false && !!toast.duration && /* @__PURE__ */ jsx11(
|
|
1877
2226
|
"div",
|
|
1878
2227
|
{
|
|
1879
2228
|
"aria-hidden": "true",
|
|
@@ -1893,7 +2242,7 @@ function ToastView({
|
|
|
1893
2242
|
}
|
|
1894
2243
|
|
|
1895
2244
|
// packages/react/src/toast-stack.tsx
|
|
1896
|
-
import { jsx as
|
|
2245
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1897
2246
|
function ToastSurface({ item, controller }) {
|
|
1898
2247
|
const ref = useRef10(null), reduced = useReducedMotion();
|
|
1899
2248
|
const current = useRef10(null);
|
|
@@ -1927,7 +2276,7 @@ function ToastSurface({ item, controller }) {
|
|
|
1927
2276
|
for (const animation of animations) animation.cancel();
|
|
1928
2277
|
};
|
|
1929
2278
|
}, [item.exiting, item.born, reduced]);
|
|
1930
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ jsx12("div", { ref, inert: item.exiting, "aria-hidden": item.exiting || void 0, children: /* @__PURE__ */ jsx12(ToastView, { toast: item.toast, controller }) });
|
|
1931
2280
|
}
|
|
1932
2281
|
function ToastStack({ items, controller }) {
|
|
1933
2282
|
var _a;
|
|
@@ -1938,13 +2287,13 @@ function ToastStack({ items, controller }) {
|
|
|
1938
2287
|
if (root.current) layout.current.update(root.current, reduced);
|
|
1939
2288
|
});
|
|
1940
2289
|
useLayoutEffect8(() => () => layout.current.destroy(), []);
|
|
1941
|
-
return /* @__PURE__ */
|
|
2290
|
+
return /* @__PURE__ */ jsx12("div", { ref: root, className: "kjun-toast-stack", style: { zIndex: layers.zIndex((_a = layers.topWindow()) == null ? void 0 : _a.id, "toast") }, children: items.map((item) => /* @__PURE__ */ jsx12(
|
|
1942
2291
|
"div",
|
|
1943
2292
|
{
|
|
1944
2293
|
"data-toast-id": item.toast.id,
|
|
1945
2294
|
"data-exiting": item.exiting,
|
|
1946
2295
|
className: "kjun-toast-slot",
|
|
1947
|
-
children: /* @__PURE__ */
|
|
2296
|
+
children: /* @__PURE__ */ jsx12(ToastSurface, { item, controller })
|
|
1948
2297
|
},
|
|
1949
2298
|
item.toast.id
|
|
1950
2299
|
)) });
|
|
@@ -1961,7 +2310,7 @@ import {
|
|
|
1961
2310
|
useState as useState9,
|
|
1962
2311
|
useSyncExternalStore as useSyncExternalStore3
|
|
1963
2312
|
} from "react";
|
|
1964
|
-
import { jsx as
|
|
2313
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1965
2314
|
function useKjunFeedback() {
|
|
1966
2315
|
const value = useOptionalKjunFeedback();
|
|
1967
2316
|
if (!value) throw Error("useKjunFeedback requires KjunFeedbackProvider.");
|
|
@@ -1972,7 +2321,8 @@ function FeedbackDialog({
|
|
|
1972
2321
|
request,
|
|
1973
2322
|
open
|
|
1974
2323
|
}) {
|
|
1975
|
-
const
|
|
2324
|
+
const m = useKjunMessages();
|
|
2325
|
+
const { options, value, error, busy, edit, cancel, submit } = useFeedbackDialog(controller, request, m);
|
|
1976
2326
|
return /* @__PURE__ */ jsxs8(
|
|
1977
2327
|
KjunModal,
|
|
1978
2328
|
{
|
|
@@ -1980,10 +2330,10 @@ function FeedbackDialog({
|
|
|
1980
2330
|
onOpenChange: (open2) => {
|
|
1981
2331
|
if (!open2) cancel();
|
|
1982
2332
|
},
|
|
1983
|
-
title: options.title || (request.kind === "prompt" ?
|
|
2333
|
+
title: options.title || (request.kind === "prompt" ? m.promptTitle : m.confirmTitle),
|
|
1984
2334
|
showFooter: true,
|
|
1985
|
-
confirmText: options.confirmText ||
|
|
1986
|
-
cancelText: options.cancelText ||
|
|
2335
|
+
confirmText: options.confirmText || m.confirm,
|
|
2336
|
+
cancelText: options.cancelText || m.cancel,
|
|
1987
2337
|
loading: busy,
|
|
1988
2338
|
closable: !busy,
|
|
1989
2339
|
closeOnEsc: !busy,
|
|
@@ -1991,13 +2341,13 @@ function FeedbackDialog({
|
|
|
1991
2341
|
onConfirm: submit,
|
|
1992
2342
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
1993
2343
|
children: [
|
|
1994
|
-
options.message && /* @__PURE__ */
|
|
1995
|
-
request.kind === "prompt" && /* @__PURE__ */
|
|
2344
|
+
options.message && /* @__PURE__ */ jsx13("p", { children: options.message }),
|
|
2345
|
+
request.kind === "prompt" && /* @__PURE__ */ jsx13(
|
|
1996
2346
|
KjunInput,
|
|
1997
2347
|
{
|
|
1998
2348
|
autoFocus: true,
|
|
1999
2349
|
value,
|
|
2000
|
-
ariaLabel: options.title ||
|
|
2350
|
+
ariaLabel: options.title || m.promptTitle,
|
|
2001
2351
|
placeholder: options.placeholder,
|
|
2002
2352
|
errorMessage: error,
|
|
2003
2353
|
onValueChange: edit,
|
|
@@ -2034,15 +2384,15 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2034
2384
|
return () => setLayers((current) => current.filter((value) => value.id !== id));
|
|
2035
2385
|
}, []);
|
|
2036
2386
|
const top = (_a = [...layers].sort((a, b) => a.order - b.order).at(-1)) == null ? void 0 : _a.id;
|
|
2037
|
-
const renderToasts = () => /* @__PURE__ */
|
|
2038
|
-
return /* @__PURE__ */
|
|
2387
|
+
const renderToasts = () => /* @__PURE__ */ jsx13(ToastStack, { items: toasts, controller });
|
|
2388
|
+
return /* @__PURE__ */ jsx13(KjunFeedbackContext.Provider, { value: controller.api, children: /* @__PURE__ */ jsxs8(
|
|
2039
2389
|
FeedbackOverlayContext.Provider,
|
|
2040
2390
|
{
|
|
2041
2391
|
value: { top, register, render: renderToasts },
|
|
2042
2392
|
children: [
|
|
2043
2393
|
children,
|
|
2044
2394
|
!layers.length && renderToasts(),
|
|
2045
|
-
dialog.request && /* @__PURE__ */
|
|
2395
|
+
dialog.request && /* @__PURE__ */ jsx13(
|
|
2046
2396
|
FeedbackDialog,
|
|
2047
2397
|
{
|
|
2048
2398
|
request: dialog.request,
|
|
@@ -2059,10 +2409,10 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2059
2409
|
// packages/react/src/controls.tsx
|
|
2060
2410
|
import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
2061
2411
|
import {
|
|
2062
|
-
createContext as
|
|
2412
|
+
createContext as createContext10,
|
|
2063
2413
|
forwardRef as forwardRef3,
|
|
2064
2414
|
useCallback as useCallback2,
|
|
2065
|
-
useContext as
|
|
2415
|
+
useContext as useContext10,
|
|
2066
2416
|
useId as useId5
|
|
2067
2417
|
} from "react";
|
|
2068
2418
|
import {
|
|
@@ -2177,7 +2527,7 @@ function groupKeydown(event) {
|
|
|
2177
2527
|
}
|
|
2178
2528
|
|
|
2179
2529
|
// packages/react/src/controls.tsx
|
|
2180
|
-
import { jsx as
|
|
2530
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2181
2531
|
function KjunCheckbox({
|
|
2182
2532
|
value,
|
|
2183
2533
|
val,
|
|
@@ -2208,14 +2558,14 @@ function KjunCheckbox({
|
|
|
2208
2558
|
onChange == null ? void 0 : onChange(result);
|
|
2209
2559
|
},
|
|
2210
2560
|
children: [
|
|
2211
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ jsx14(
|
|
2212
2562
|
"span",
|
|
2213
2563
|
{
|
|
2214
2564
|
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2215
|
-
children: checked && /* @__PURE__ */
|
|
2565
|
+
children: checked && /* @__PURE__ */ jsx14(KjunIcon, { name: "check", size: tokens12.extensions.checkbox.iconSizes[size] })
|
|
2216
2566
|
}
|
|
2217
2567
|
),
|
|
2218
|
-
(children || label) && /* @__PURE__ */
|
|
2568
|
+
(children || label) && /* @__PURE__ */ jsx14("span", { className: "kjun-choice-label", children: children || label })
|
|
2219
2569
|
]
|
|
2220
2570
|
}
|
|
2221
2571
|
);
|
|
@@ -2226,11 +2576,13 @@ function KjunSwitch({
|
|
|
2226
2576
|
ariaLabel,
|
|
2227
2577
|
disabled = false,
|
|
2228
2578
|
size = "md",
|
|
2579
|
+
description,
|
|
2229
2580
|
children,
|
|
2230
2581
|
onValueChange,
|
|
2231
2582
|
onChange
|
|
2232
2583
|
}) {
|
|
2233
2584
|
const field = useKjunField();
|
|
2585
|
+
const descriptionId = "kjun-" + useId5().replace(/:/g, "") + "-description";
|
|
2234
2586
|
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
2235
2587
|
const markInput = useCallback2((input) => {
|
|
2236
2588
|
if (!input) return;
|
|
@@ -2245,7 +2597,7 @@ function KjunSwitch({
|
|
|
2245
2597
|
isSelected: value,
|
|
2246
2598
|
isDisabled: disabled,
|
|
2247
2599
|
"aria-label": ariaLabel || label,
|
|
2248
|
-
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
2600
|
+
"aria-describedby": [field == null ? void 0 : field.describedBy, description ? descriptionId : void 0].filter(Boolean).join(" ") || void 0,
|
|
2249
2601
|
inputRef: markInput,
|
|
2250
2602
|
className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""),
|
|
2251
2603
|
onChange: (next) => {
|
|
@@ -2253,19 +2605,22 @@ function KjunSwitch({
|
|
|
2253
2605
|
onChange == null ? void 0 : onChange(next);
|
|
2254
2606
|
},
|
|
2255
2607
|
children: [
|
|
2256
|
-
/* @__PURE__ */
|
|
2608
|
+
/* @__PURE__ */ jsx14(
|
|
2257
2609
|
"span",
|
|
2258
2610
|
{
|
|
2259
2611
|
className: `kjun-switch kjun-switch--${size}${value ? " kjun-switch--on" : ""}`,
|
|
2260
|
-
children: /* @__PURE__ */
|
|
2612
|
+
children: /* @__PURE__ */ jsx14("span", { className: "kjun-switch-thumb" })
|
|
2261
2613
|
}
|
|
2262
2614
|
),
|
|
2263
|
-
|
|
2615
|
+
description ? /* @__PURE__ */ jsxs9("span", { className: "kjun-choice-text", children: [
|
|
2616
|
+
(children || label) && /* @__PURE__ */ jsx14("span", { className: "kjun-choice-label", children: children || label }),
|
|
2617
|
+
/* @__PURE__ */ jsx14("span", { id: descriptionId, className: "kjun-choice-description", children: description })
|
|
2618
|
+
] }) : (children || label) && /* @__PURE__ */ jsx14("span", { className: "kjun-choice-label", children: children || label })
|
|
2264
2619
|
]
|
|
2265
2620
|
}
|
|
2266
2621
|
);
|
|
2267
2622
|
}
|
|
2268
|
-
var RadioContext =
|
|
2623
|
+
var RadioContext = createContext10(null);
|
|
2269
2624
|
function KjunRadio({
|
|
2270
2625
|
value,
|
|
2271
2626
|
val,
|
|
@@ -2277,9 +2632,9 @@ function KjunRadio({
|
|
|
2277
2632
|
onValueChange,
|
|
2278
2633
|
onChange
|
|
2279
2634
|
}) {
|
|
2280
|
-
const group =
|
|
2635
|
+
const group = useContext10(RadioContext), selected = (group ? group.value : value) === val;
|
|
2281
2636
|
return /* @__PURE__ */ jsxs9("label", { className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""), children: [
|
|
2282
|
-
/* @__PURE__ */
|
|
2637
|
+
/* @__PURE__ */ jsx14(
|
|
2283
2638
|
"input",
|
|
2284
2639
|
{
|
|
2285
2640
|
type: "radio",
|
|
@@ -2297,14 +2652,14 @@ function KjunRadio({
|
|
|
2297
2652
|
}
|
|
2298
2653
|
}
|
|
2299
2654
|
),
|
|
2300
|
-
/* @__PURE__ */
|
|
2655
|
+
/* @__PURE__ */ jsx14(
|
|
2301
2656
|
"span",
|
|
2302
2657
|
{
|
|
2303
2658
|
className: "kjun-choice-control kjun-radio" + (selected ? " kjun-radio--checked" : ""),
|
|
2304
|
-
children: selected && /* @__PURE__ */
|
|
2659
|
+
children: selected && /* @__PURE__ */ jsx14("span", { className: "kjun-radio-dot" })
|
|
2305
2660
|
}
|
|
2306
2661
|
),
|
|
2307
|
-
(children || label) && /* @__PURE__ */
|
|
2662
|
+
(children || label) && /* @__PURE__ */ jsx14("span", { className: "kjun-choice-label", children: children || label })
|
|
2308
2663
|
] });
|
|
2309
2664
|
}
|
|
2310
2665
|
function KjunRadioGroup({
|
|
@@ -2317,7 +2672,7 @@ function KjunRadioGroup({
|
|
|
2317
2672
|
onChange
|
|
2318
2673
|
}) {
|
|
2319
2674
|
const name = "kjun-" + useId5();
|
|
2320
|
-
return /* @__PURE__ */
|
|
2675
|
+
return /* @__PURE__ */ jsx14(
|
|
2321
2676
|
RadioContext.Provider,
|
|
2322
2677
|
{
|
|
2323
2678
|
value: {
|
|
@@ -2328,7 +2683,7 @@ function KjunRadioGroup({
|
|
|
2328
2683
|
onChange == null ? void 0 : onChange(next);
|
|
2329
2684
|
}
|
|
2330
2685
|
},
|
|
2331
|
-
children: /* @__PURE__ */
|
|
2686
|
+
children: /* @__PURE__ */ jsx14(
|
|
2332
2687
|
"div",
|
|
2333
2688
|
{
|
|
2334
2689
|
role: "radiogroup",
|
|
@@ -2340,7 +2695,7 @@ function KjunRadioGroup({
|
|
|
2340
2695
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2341
2696
|
gap: direction === "vertical" ? tokens12.dimension.value8 : tokens12.dimension.value16
|
|
2342
2697
|
},
|
|
2343
|
-
children: children || options.map((option) => /* @__PURE__ */
|
|
2698
|
+
children: children || options.map((option) => /* @__PURE__ */ jsx14(
|
|
2344
2699
|
KjunRadio,
|
|
2345
2700
|
{
|
|
2346
2701
|
val: option.value,
|
|
@@ -2371,7 +2726,7 @@ var KjunTextarea = forwardRef3(
|
|
|
2371
2726
|
var _a;
|
|
2372
2727
|
const field = useKjunField();
|
|
2373
2728
|
const spec = tokens12.input[size];
|
|
2374
|
-
return /* @__PURE__ */
|
|
2729
|
+
return /* @__PURE__ */ jsx14(
|
|
2375
2730
|
"textarea",
|
|
2376
2731
|
{
|
|
2377
2732
|
...props,
|
|
@@ -2428,7 +2783,7 @@ function KjunButtonGroup({
|
|
|
2428
2783
|
width: fullWidth ? "100%" : "fit-content"
|
|
2429
2784
|
},
|
|
2430
2785
|
children: [
|
|
2431
|
-
/* @__PURE__ */
|
|
2786
|
+
/* @__PURE__ */ jsx14(
|
|
2432
2787
|
"span",
|
|
2433
2788
|
{
|
|
2434
2789
|
ref: indicator,
|
|
@@ -2455,10 +2810,10 @@ function KjunButtonGroup({
|
|
|
2455
2810
|
onChange == null ? void 0 : onChange(option.value);
|
|
2456
2811
|
},
|
|
2457
2812
|
children: [
|
|
2458
|
-
option.icon && /* @__PURE__ */
|
|
2813
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens12.extensions.selection.iconSize }),
|
|
2459
2814
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-button-group-label", children: [
|
|
2460
|
-
/* @__PURE__ */
|
|
2461
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens12.button.typography[size]), children: option.label }),
|
|
2816
|
+
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
2462
2817
|
] })
|
|
2463
2818
|
]
|
|
2464
2819
|
},
|
|
@@ -2480,7 +2835,7 @@ function KjunFilterGroup({
|
|
|
2480
2835
|
onChange
|
|
2481
2836
|
}) {
|
|
2482
2837
|
const selected = (v) => multiple ? Array.isArray(value) && (v === null ? value.length === 0 : value.includes(v)) : value === v;
|
|
2483
|
-
return /* @__PURE__ */
|
|
2838
|
+
return /* @__PURE__ */ jsx14(
|
|
2484
2839
|
"div",
|
|
2485
2840
|
{
|
|
2486
2841
|
role: "group",
|
|
@@ -2488,7 +2843,7 @@ function KjunFilterGroup({
|
|
|
2488
2843
|
className: "kjun-filter-group",
|
|
2489
2844
|
"data-scroll": scroll,
|
|
2490
2845
|
onKeyDown: groupKeydown,
|
|
2491
|
-
children: options.map((option) => /* @__PURE__ */
|
|
2846
|
+
children: options.map((option) => /* @__PURE__ */ jsx14(
|
|
2492
2847
|
"button",
|
|
2493
2848
|
{
|
|
2494
2849
|
type: "button",
|
|
@@ -2510,11 +2865,11 @@ function KjunFilterGroup({
|
|
|
2510
2865
|
...selectionTypeStyle(size, selected(option.value))
|
|
2511
2866
|
},
|
|
2512
2867
|
children: [
|
|
2513
|
-
option.dot && /* @__PURE__ */
|
|
2514
|
-
option.icon && /* @__PURE__ */
|
|
2868
|
+
option.dot && /* @__PURE__ */ jsx14("i", { style: { background: option.dot } }),
|
|
2869
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens12.extensions.selection.iconSize }),
|
|
2515
2870
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-filter-label", children: [
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2871
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens12.button.typography[size]), children: option.label }),
|
|
2872
|
+
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
2518
2873
|
] })
|
|
2519
2874
|
]
|
|
2520
2875
|
}
|
|
@@ -2530,7 +2885,7 @@ function KjunFilterGroup({
|
|
|
2530
2885
|
import { isComposingKey as isComposingKey3, tokens as tokens13 } from "@kjun-ui/tokens";
|
|
2531
2886
|
import { useEffect as useEffect5, useRef as useRef13 } from "react";
|
|
2532
2887
|
import { Popover as AriaPopover } from "react-aria-components";
|
|
2533
|
-
import { jsx as
|
|
2888
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2534
2889
|
function FloatingPanel({
|
|
2535
2890
|
open,
|
|
2536
2891
|
onOpenChange,
|
|
@@ -2568,7 +2923,7 @@ function FloatingPanel({
|
|
|
2568
2923
|
return () => document2.removeEventListener("keydown", dismissBeforeFocus, true);
|
|
2569
2924
|
}, [open, nonModal, triggerRef, onOpenChange, layer.keyboardManaged]);
|
|
2570
2925
|
if (container === null || layer.blocked) return null;
|
|
2571
|
-
return /* @__PURE__ */
|
|
2926
|
+
return /* @__PURE__ */ jsx15(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx15(
|
|
2572
2927
|
AriaPopover,
|
|
2573
2928
|
{
|
|
2574
2929
|
ref: panel,
|
|
@@ -2663,7 +3018,7 @@ function installNonModalPopover({ panel, trigger, close }) {
|
|
|
2663
3018
|
}
|
|
2664
3019
|
|
|
2665
3020
|
// packages/react/src/popover.tsx
|
|
2666
|
-
import { Fragment as
|
|
3021
|
+
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2667
3022
|
function KjunPopover({
|
|
2668
3023
|
noPadding = false,
|
|
2669
3024
|
open: controlled,
|
|
@@ -2681,6 +3036,7 @@ function KjunPopover({
|
|
|
2681
3036
|
trigger,
|
|
2682
3037
|
children
|
|
2683
3038
|
}) {
|
|
3039
|
+
const m = useKjunMessages();
|
|
2684
3040
|
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref = useRef14(null), id = "kjun-" + useId6();
|
|
2685
3041
|
const expanded = usePopupExpanded(open, ref);
|
|
2686
3042
|
const focusOnMount = useRef14(focusOnOpen);
|
|
@@ -2709,9 +3065,9 @@ function KjunPopover({
|
|
|
2709
3065
|
}
|
|
2710
3066
|
});
|
|
2711
3067
|
});
|
|
2712
|
-
const content = /* @__PURE__ */
|
|
2713
|
-
return /* @__PURE__ */ jsxs10(
|
|
2714
|
-
/* @__PURE__ */
|
|
3068
|
+
const content = /* @__PURE__ */ jsx16("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
|
|
3069
|
+
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
3070
|
+
/* @__PURE__ */ jsx16(
|
|
2715
3071
|
"div",
|
|
2716
3072
|
{
|
|
2717
3073
|
ref,
|
|
@@ -2731,7 +3087,7 @@ function KjunPopover({
|
|
|
2731
3087
|
children: typeof trigger === "function" ? trigger(open) : trigger
|
|
2732
3088
|
}
|
|
2733
3089
|
),
|
|
2734
|
-
/* @__PURE__ */
|
|
3090
|
+
/* @__PURE__ */ jsx16(
|
|
2735
3091
|
FloatingPanel,
|
|
2736
3092
|
{
|
|
2737
3093
|
open,
|
|
@@ -2748,17 +3104,17 @@ function KjunPopover({
|
|
|
2748
3104
|
children: (() => {
|
|
2749
3105
|
const dialogProps = {
|
|
2750
3106
|
id,
|
|
2751
|
-
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel ||
|
|
3107
|
+
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
2752
3108
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
2753
3109
|
className: "kjun-popover-dialog",
|
|
2754
3110
|
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${tokens14.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
2755
3111
|
};
|
|
2756
|
-
const body = /* @__PURE__ */ jsxs10(
|
|
2757
|
-
header != null && /* @__PURE__ */
|
|
2758
|
-
header != null ? /* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
3112
|
+
const body = /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
3113
|
+
header != null && /* @__PURE__ */ jsx16("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
3114
|
+
header != null ? /* @__PURE__ */ jsx16("div", { className: "kjun-popover-body", children: content }) : content,
|
|
3115
|
+
/* @__PURE__ */ jsx16(FeedbackLayerOutlet, {})
|
|
2760
3116
|
] });
|
|
2761
|
-
return modal ? /* @__PURE__ */
|
|
3117
|
+
return modal ? /* @__PURE__ */ jsx16(Dialog2, { ...dialogProps, ref: focusContent, children: body }) : /* @__PURE__ */ jsx16("section", { ...dialogProps, role: "dialog", tabIndex: -1, ref: focusContent, children: body });
|
|
2762
3118
|
})()
|
|
2763
3119
|
}
|
|
2764
3120
|
)
|
|
@@ -2780,7 +3136,7 @@ function KjunTooltip({
|
|
|
2780
3136
|
};
|
|
2781
3137
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
2782
3138
|
return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !content || !layer.scopeActive, children: [
|
|
2783
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsx16(Focusable, { children }),
|
|
2784
3140
|
container !== null && /* @__PURE__ */ jsxs10(
|
|
2785
3141
|
Tooltip,
|
|
2786
3142
|
{
|
|
@@ -2790,7 +3146,7 @@ function KjunTooltip({
|
|
|
2790
3146
|
offset: tokens14.extensions.floating.anchorGap,
|
|
2791
3147
|
className: "kjun-scope kjun-tooltip",
|
|
2792
3148
|
children: [
|
|
2793
|
-
/* @__PURE__ */
|
|
3149
|
+
/* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width: tokens14.extensions.tooltip.arrowSize, height: tokens14.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx16("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
2794
3150
|
content
|
|
2795
3151
|
]
|
|
2796
3152
|
}
|
|
@@ -2800,10 +3156,10 @@ function KjunTooltip({
|
|
|
2800
3156
|
|
|
2801
3157
|
// packages/react/src/dropdown.tsx
|
|
2802
3158
|
import { tokens as tokens15 } from "@kjun-ui/tokens";
|
|
2803
|
-
import { cloneElement, createContext as
|
|
3159
|
+
import { cloneElement, createContext as createContext11, isValidElement as isValidElement2, useCallback as useCallback4, useContext as useContext11, useEffect as useEffect7, useId as useId7, useRef as useRef15, useState as useState11 } from "react";
|
|
2804
3160
|
import { Menu, MenuItem, Separator } from "react-aria-components";
|
|
2805
|
-
import { jsx as
|
|
2806
|
-
var DropdownContext =
|
|
3161
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3162
|
+
var DropdownContext = createContext11(null);
|
|
2807
3163
|
function KjunDropdown({
|
|
2808
3164
|
disabled = false,
|
|
2809
3165
|
placement = "bottom-start",
|
|
@@ -2873,7 +3229,7 @@ function KjunDropdown({
|
|
|
2873
3229
|
if (unavailable) change(false);
|
|
2874
3230
|
}, [unavailable]);
|
|
2875
3231
|
return /* @__PURE__ */ jsxs11(DropdownContext.Provider, { value: () => change(false), children: [
|
|
2876
|
-
/* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ jsx17(
|
|
2877
3233
|
"div",
|
|
2878
3234
|
{
|
|
2879
3235
|
ref,
|
|
@@ -2885,10 +3241,10 @@ function KjunDropdown({
|
|
|
2885
3241
|
change(true);
|
|
2886
3242
|
}
|
|
2887
3243
|
},
|
|
2888
|
-
children: /* @__PURE__ */
|
|
3244
|
+
children: /* @__PURE__ */ jsx17("span", { children: bindTrigger(trigger) })
|
|
2889
3245
|
}
|
|
2890
3246
|
),
|
|
2891
|
-
/* @__PURE__ */
|
|
3247
|
+
/* @__PURE__ */ jsx17(
|
|
2892
3248
|
FloatingPanel,
|
|
2893
3249
|
{
|
|
2894
3250
|
open,
|
|
@@ -2896,7 +3252,7 @@ function KjunDropdown({
|
|
|
2896
3252
|
triggerRef: ref,
|
|
2897
3253
|
placement,
|
|
2898
3254
|
className: "kjun-dropdown",
|
|
2899
|
-
children: /* @__PURE__ */
|
|
3255
|
+
children: /* @__PURE__ */ jsx17(
|
|
2900
3256
|
Menu,
|
|
2901
3257
|
{
|
|
2902
3258
|
ref: bindMenu,
|
|
@@ -2922,7 +3278,7 @@ function KjunDropdownItem({
|
|
|
2922
3278
|
children,
|
|
2923
3279
|
onClick
|
|
2924
3280
|
}) {
|
|
2925
|
-
const close =
|
|
3281
|
+
const close = useContext11(DropdownContext);
|
|
2926
3282
|
const node = useCallback4((element) => {
|
|
2927
3283
|
if (!element) return;
|
|
2928
3284
|
if (selected === null) {
|
|
@@ -2948,9 +3304,9 @@ function KjunDropdownItem({
|
|
|
2948
3304
|
close == null ? void 0 : close();
|
|
2949
3305
|
},
|
|
2950
3306
|
children: [
|
|
2951
|
-
icon && /* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
selected !== null && /* @__PURE__ */
|
|
3307
|
+
icon && /* @__PURE__ */ jsx17(KjunIcon, { name: icon, className: "kjun-menu-icon", size: tokens15.extensions.menu.iconSize }),
|
|
3308
|
+
/* @__PURE__ */ jsx17("span", { children }),
|
|
3309
|
+
selected !== null && /* @__PURE__ */ jsx17(
|
|
2954
3310
|
KjunIcon,
|
|
2955
3311
|
{
|
|
2956
3312
|
name: "check",
|
|
@@ -2964,7 +3320,7 @@ function KjunDropdownItem({
|
|
|
2964
3320
|
);
|
|
2965
3321
|
}
|
|
2966
3322
|
function KjunDropdownDivider() {
|
|
2967
|
-
return /* @__PURE__ */
|
|
3323
|
+
return /* @__PURE__ */ jsx17(Separator, { className: "kjun-menu-divider" });
|
|
2968
3324
|
}
|
|
2969
3325
|
function KjunMenuButton({
|
|
2970
3326
|
label,
|
|
@@ -2980,8 +3336,9 @@ function KjunMenuButton({
|
|
|
2980
3336
|
onClose,
|
|
2981
3337
|
...props
|
|
2982
3338
|
}) {
|
|
3339
|
+
const m = useKjunMessages();
|
|
2983
3340
|
const [open, setOpen] = useState11(false);
|
|
2984
|
-
const button = /* @__PURE__ */
|
|
3341
|
+
const button = /* @__PURE__ */ jsx17(
|
|
2985
3342
|
KjunButton,
|
|
2986
3343
|
{
|
|
2987
3344
|
className: "kjun-menu-button",
|
|
@@ -2991,11 +3348,11 @@ function KjunMenuButton({
|
|
|
2991
3348
|
loading,
|
|
2992
3349
|
prefixIcon: compact || !label ? "dots-vertical" : void 0,
|
|
2993
3350
|
suffixIcon: !compact && label ? open ? "chevron-up" : "chevron-down" : void 0,
|
|
2994
|
-
ariaLabel: ariaLabel || label || tooltip ||
|
|
3351
|
+
ariaLabel: ariaLabel || label || tooltip || m.menu,
|
|
2995
3352
|
children: compact ? void 0 : label
|
|
2996
3353
|
}
|
|
2997
3354
|
);
|
|
2998
|
-
return /* @__PURE__ */
|
|
3355
|
+
return /* @__PURE__ */ jsx17(
|
|
2999
3356
|
KjunDropdown,
|
|
3000
3357
|
{
|
|
3001
3358
|
...props,
|
|
@@ -3007,7 +3364,7 @@ function KjunMenuButton({
|
|
|
3007
3364
|
setOpen(false);
|
|
3008
3365
|
onClose == null ? void 0 : onClose();
|
|
3009
3366
|
},
|
|
3010
|
-
trigger: tooltip ? /* @__PURE__ */
|
|
3367
|
+
trigger: tooltip ? /* @__PURE__ */ jsx17(
|
|
3011
3368
|
KjunTooltip,
|
|
3012
3369
|
{
|
|
3013
3370
|
content: open ? "" : tooltip,
|
|
@@ -3034,7 +3391,7 @@ function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
|
3034
3391
|
|
|
3035
3392
|
// packages/react/src/drawer.tsx
|
|
3036
3393
|
import { Dialog as Dialog3, Modal as Modal2, ModalOverlay as ModalOverlay2 } from "react-aria-components";
|
|
3037
|
-
import { jsx as
|
|
3394
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3038
3395
|
function KjunDrawer({
|
|
3039
3396
|
open,
|
|
3040
3397
|
onOpenChange,
|
|
@@ -3054,6 +3411,7 @@ function KjunDrawer({
|
|
|
3054
3411
|
safeAreaBottom = 0,
|
|
3055
3412
|
maxHeight
|
|
3056
3413
|
}) {
|
|
3414
|
+
const m = useKjunMessages();
|
|
3057
3415
|
const motion = usePresence(open, useReducedMotion(), tokens16.motion.layerExit);
|
|
3058
3416
|
const container = useKjunPortalContainer();
|
|
3059
3417
|
const close = () => {
|
|
@@ -3065,7 +3423,7 @@ function KjunDrawer({
|
|
|
3065
3423
|
if (closeOnEsc) close();
|
|
3066
3424
|
});
|
|
3067
3425
|
if (container === null) return null;
|
|
3068
|
-
return /* @__PURE__ */
|
|
3426
|
+
return /* @__PURE__ */ jsx18(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx18(
|
|
3069
3427
|
ModalOverlay2,
|
|
3070
3428
|
{
|
|
3071
3429
|
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
@@ -3082,7 +3440,7 @@ function KjunDrawer({
|
|
|
3082
3440
|
"data-motion-open": String(motion.active),
|
|
3083
3441
|
inert: !open || !layer.active,
|
|
3084
3442
|
"data-position": position,
|
|
3085
|
-
children: /* @__PURE__ */
|
|
3443
|
+
children: /* @__PURE__ */ jsx18(
|
|
3086
3444
|
Modal2,
|
|
3087
3445
|
{
|
|
3088
3446
|
className: "kjun-drawer",
|
|
@@ -3093,7 +3451,7 @@ function KjunDrawer({
|
|
|
3093
3451
|
children: /* @__PURE__ */ jsxs12(
|
|
3094
3452
|
Dialog3,
|
|
3095
3453
|
{
|
|
3096
|
-
"aria-label": ariaLabel || title ||
|
|
3454
|
+
"aria-label": ariaLabel || title || m.panel,
|
|
3097
3455
|
className: "kjun-drawer-dialog",
|
|
3098
3456
|
ref: (node) => {
|
|
3099
3457
|
const entry = layer.state.entries.get(layer.id);
|
|
@@ -3101,20 +3459,20 @@ function KjunDrawer({
|
|
|
3101
3459
|
},
|
|
3102
3460
|
children: [
|
|
3103
3461
|
(title || header || closable) && /* @__PURE__ */ jsxs12("div", { className: "kjun-drawer-header", children: [
|
|
3104
|
-
/* @__PURE__ */
|
|
3105
|
-
closable && /* @__PURE__ */
|
|
3462
|
+
/* @__PURE__ */ jsx18("div", { children: header || /* @__PURE__ */ jsx18("h2", { children: title }) }),
|
|
3463
|
+
closable && /* @__PURE__ */ jsx18(
|
|
3106
3464
|
KjunButton,
|
|
3107
3465
|
{
|
|
3108
3466
|
size: "sm",
|
|
3109
3467
|
variant: "ghost",
|
|
3110
|
-
ariaLabel:
|
|
3468
|
+
ariaLabel: m.close,
|
|
3111
3469
|
onClick: close,
|
|
3112
3470
|
style: { borderRadius: tokens16.extensions.drawer.closeRadius, width: tokens16.extensions.drawer.closeSize, height: tokens16.extensions.drawer.closeSize, padding: 0 },
|
|
3113
|
-
children: /* @__PURE__ */
|
|
3471
|
+
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", size: tokens16.extensions.drawer.closeIconSize })
|
|
3114
3472
|
}
|
|
3115
3473
|
)
|
|
3116
3474
|
] }),
|
|
3117
|
-
/* @__PURE__ */
|
|
3475
|
+
/* @__PURE__ */ jsx18(
|
|
3118
3476
|
"div",
|
|
3119
3477
|
{
|
|
3120
3478
|
className: "kjun-drawer-body",
|
|
@@ -3122,8 +3480,8 @@ function KjunDrawer({
|
|
|
3122
3480
|
children
|
|
3123
3481
|
}
|
|
3124
3482
|
),
|
|
3125
|
-
footer && /* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
3483
|
+
footer && /* @__PURE__ */ jsx18("div", { className: "kjun-drawer-footer", children: footer }),
|
|
3484
|
+
/* @__PURE__ */ jsx18(FeedbackLayerOutlet, {})
|
|
3127
3485
|
]
|
|
3128
3486
|
}
|
|
3129
3487
|
)
|
|
@@ -3178,14 +3536,15 @@ function selectOptions({
|
|
|
3178
3536
|
loading,
|
|
3179
3537
|
multiple,
|
|
3180
3538
|
filterFn,
|
|
3181
|
-
searchKeys = []
|
|
3539
|
+
searchKeys = [],
|
|
3540
|
+
selectedCount = (count) => String(count)
|
|
3182
3541
|
}) {
|
|
3183
3542
|
const selected = (option) => optionSelected(value, option, valueKey);
|
|
3184
3543
|
const indexed = options.map((option, index) => ({ option, key: optionKey(option, valueKey, index) }));
|
|
3185
3544
|
const matching = filterFn ? indexed.filter(({ option }) => filterFn(option, query2)) : indexed.map((item, index) => ({ item, index, rank: optionMatchRank(item.option, query2, labelKey, searchKeys) })).filter(({ rank }) => rank >= 0).sort((a, b) => a.rank - b.rank || a.index - b.index).map(({ item }) => item);
|
|
3186
3545
|
const visible = loading ? [] : pageSize > 0 ? matching.slice(0, limit) : matching;
|
|
3187
3546
|
const selectedOption = options.find(selected);
|
|
3188
|
-
const label = multiple && Array.isArray(value) && value.length > 1 ?
|
|
3547
|
+
const label = multiple && Array.isArray(value) && value.length > 1 ? selectedCount(value.length) : selectedOption !== void 0 ? optionLabel(selectedOption, labelKey) : "";
|
|
3189
3548
|
return {
|
|
3190
3549
|
selected,
|
|
3191
3550
|
matching,
|
|
@@ -3253,11 +3612,11 @@ import {
|
|
|
3253
3612
|
useRef as useRef16,
|
|
3254
3613
|
useState as useState13
|
|
3255
3614
|
} from "react";
|
|
3256
|
-
import { Fragment as
|
|
3615
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3257
3616
|
function KjunCombobox({
|
|
3258
3617
|
value,
|
|
3259
3618
|
options = [],
|
|
3260
|
-
placeholder
|
|
3619
|
+
placeholder,
|
|
3261
3620
|
ariaLabel,
|
|
3262
3621
|
labelKey = "label",
|
|
3263
3622
|
valueKey = "value",
|
|
@@ -3266,13 +3625,16 @@ function KjunCombobox({
|
|
|
3266
3625
|
disabled = false,
|
|
3267
3626
|
error = false,
|
|
3268
3627
|
clearable = false,
|
|
3269
|
-
emptyText
|
|
3628
|
+
emptyText,
|
|
3270
3629
|
renderOption,
|
|
3271
3630
|
onValueChange,
|
|
3272
3631
|
onChange,
|
|
3273
3632
|
onSearch,
|
|
3274
3633
|
onClear
|
|
3275
3634
|
}) {
|
|
3635
|
+
const m = useKjunMessages();
|
|
3636
|
+
placeholder != null ? placeholder : placeholder = m.searchOrSelect;
|
|
3637
|
+
emptyText != null ? emptyText : emptyText = m.noResults;
|
|
3276
3638
|
const model = useComboboxModel({
|
|
3277
3639
|
value,
|
|
3278
3640
|
options,
|
|
@@ -3285,7 +3647,7 @@ function KjunCombobox({
|
|
|
3285
3647
|
onSearch,
|
|
3286
3648
|
onClear
|
|
3287
3649
|
});
|
|
3288
|
-
return /* @__PURE__ */
|
|
3650
|
+
return /* @__PURE__ */ jsx19(
|
|
3289
3651
|
SearchField,
|
|
3290
3652
|
{
|
|
3291
3653
|
error,
|
|
@@ -3331,6 +3693,7 @@ function SearchField({
|
|
|
3331
3693
|
onClear,
|
|
3332
3694
|
onEnter
|
|
3333
3695
|
}) {
|
|
3696
|
+
const m = useKjunMessages();
|
|
3334
3697
|
const composition = useCompositionGuard();
|
|
3335
3698
|
const clearing = useRef16(false);
|
|
3336
3699
|
const ref = useRef16(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
|
|
@@ -3358,8 +3721,8 @@ function SearchField({
|
|
|
3358
3721
|
onOpenChange(false);
|
|
3359
3722
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3360
3723
|
};
|
|
3361
|
-
return /* @__PURE__ */ jsxs13(
|
|
3362
|
-
/* @__PURE__ */
|
|
3724
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3725
|
+
/* @__PURE__ */ jsx19(
|
|
3363
3726
|
KjunInput,
|
|
3364
3727
|
{
|
|
3365
3728
|
error,
|
|
@@ -3434,7 +3797,7 @@ function SearchField({
|
|
|
3434
3797
|
}
|
|
3435
3798
|
}
|
|
3436
3799
|
),
|
|
3437
|
-
/* @__PURE__ */
|
|
3800
|
+
/* @__PURE__ */ jsx19(
|
|
3438
3801
|
FloatingPanel,
|
|
3439
3802
|
{
|
|
3440
3803
|
field: true,
|
|
@@ -3445,14 +3808,14 @@ function SearchField({
|
|
|
3445
3808
|
placement: "bottom-start",
|
|
3446
3809
|
matchTriggerWidth: true,
|
|
3447
3810
|
className: "kjun-select-panel",
|
|
3448
|
-
children: /* @__PURE__ */
|
|
3811
|
+
children: /* @__PURE__ */ jsx19(
|
|
3449
3812
|
"div",
|
|
3450
3813
|
{
|
|
3451
3814
|
id,
|
|
3452
3815
|
role: "listbox",
|
|
3453
3816
|
"aria-label": ariaLabel || placeholder,
|
|
3454
3817
|
onMouseDown: (e) => e.preventDefault(),
|
|
3455
|
-
children: loading ? /* @__PURE__ */
|
|
3818
|
+
children: loading ? /* @__PURE__ */ jsx19("div", { className: "kjun-select-empty", children: /* @__PURE__ */ jsx19(KjunSpinner, { size: "sm", text: m.searching }) }) : failed ? /* @__PURE__ */ jsx19("div", { className: "kjun-select-empty", role: "alert", children: errorText }) : options.length ? options.map((o, i) => /* @__PURE__ */ jsx19(
|
|
3456
3819
|
"div",
|
|
3457
3820
|
{
|
|
3458
3821
|
id: id + "-" + i,
|
|
@@ -3470,7 +3833,7 @@ function SearchField({
|
|
|
3470
3833
|
children: (renderOption == null ? void 0 : renderOption(o)) || optionLabel(o, labelKey)
|
|
3471
3834
|
},
|
|
3472
3835
|
optionKey(o, itemKey, i)
|
|
3473
|
-
)) : /* @__PURE__ */
|
|
3836
|
+
)) : /* @__PURE__ */ jsx19("div", { className: "kjun-select-empty", children: emptyText })
|
|
3474
3837
|
}
|
|
3475
3838
|
)
|
|
3476
3839
|
}
|
|
@@ -3483,11 +3846,12 @@ import { tokens as tokens17 } from "@kjun-ui/tokens";
|
|
|
3483
3846
|
import {
|
|
3484
3847
|
useState as useState14
|
|
3485
3848
|
} from "react";
|
|
3486
|
-
import { jsx as
|
|
3849
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3487
3850
|
function KjunDatePicker({
|
|
3488
3851
|
value,
|
|
3489
3852
|
size = "md",
|
|
3490
|
-
|
|
3853
|
+
clearable = false,
|
|
3854
|
+
placeholder,
|
|
3491
3855
|
ariaLabel,
|
|
3492
3856
|
error,
|
|
3493
3857
|
onValueChange,
|
|
@@ -3495,7 +3859,10 @@ function KjunDatePicker({
|
|
|
3495
3859
|
onBlur,
|
|
3496
3860
|
...props
|
|
3497
3861
|
}) {
|
|
3862
|
+
const scope = useKjunMessageScope();
|
|
3863
|
+
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
3498
3864
|
const [focus, setFocus] = useState14(false);
|
|
3865
|
+
const clear = clearable && !!value && !props.disabled && !props.readOnly;
|
|
3499
3866
|
return (
|
|
3500
3867
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
3501
3868
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
@@ -3504,7 +3871,7 @@ function KjunDatePicker({
|
|
|
3504
3871
|
["--_kjun-date-icon-inset"]: tokens17.input[size].padding + "px",
|
|
3505
3872
|
["--_kjun-date-icon-size"]: tokens17.input[size].iconSize + "px"
|
|
3506
3873
|
}, children: [
|
|
3507
|
-
/* @__PURE__ */
|
|
3874
|
+
/* @__PURE__ */ jsx20(
|
|
3508
3875
|
KjunInput,
|
|
3509
3876
|
{
|
|
3510
3877
|
...props,
|
|
@@ -3526,18 +3893,37 @@ function KjunDatePicker({
|
|
|
3526
3893
|
}
|
|
3527
3894
|
}
|
|
3528
3895
|
),
|
|
3529
|
-
!focus && /* @__PURE__ */
|
|
3896
|
+
!focus && /* @__PURE__ */ jsx20(
|
|
3530
3897
|
"span",
|
|
3531
3898
|
{
|
|
3532
3899
|
"aria-hidden": "true",
|
|
3533
3900
|
className: "kjun-date-overlay",
|
|
3534
3901
|
style: {
|
|
3535
3902
|
left: tokens17.input[size].padding,
|
|
3536
|
-
right: tokens17.input[size].padding + tokens17.input[size].iconSize + tokens17.input[size].affixGap,
|
|
3903
|
+
right: tokens17.input[size].padding + tokens17.input[size].iconSize + tokens17.input[size].affixGap + (clear ? tokens17.input[size].clearSize + tokens17.input[size].affixGap : 0),
|
|
3537
3904
|
...inputTypeStyle(size),
|
|
3538
3905
|
color: props.disabled ? "var(--_kjun-color-text-disabled)" : props.readOnly ? "var(--_kjun-color-text-secondary)" : value ? "var(--_kjun-color-text)" : "var(--_kjun-color-input-placeholder)"
|
|
3539
3906
|
},
|
|
3540
|
-
children: value ? value
|
|
3907
|
+
children: value ? formatDateValue(value, scope) : placeholder
|
|
3908
|
+
}
|
|
3909
|
+
),
|
|
3910
|
+
clear && /* @__PURE__ */ jsx20(
|
|
3911
|
+
KjunButton,
|
|
3912
|
+
{
|
|
3913
|
+
size: "sm",
|
|
3914
|
+
variant: "ghost",
|
|
3915
|
+
ariaLabel: scope.messages.clearDate,
|
|
3916
|
+
className: "kjun-select-clear",
|
|
3917
|
+
style: {
|
|
3918
|
+
padding: 0,
|
|
3919
|
+
right: tokens17.input[size].padding + tokens17.input[size].iconSize + tokens17.input[size].affixGap,
|
|
3920
|
+
width: tokens17.input[size].clearSize,
|
|
3921
|
+
height: tokens17.input[size].clearSize,
|
|
3922
|
+
minHeight: tokens17.input[size].clearSize,
|
|
3923
|
+
borderRadius: "50%"
|
|
3924
|
+
},
|
|
3925
|
+
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
3926
|
+
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size: tokens17.input[size].iconSize })
|
|
3541
3927
|
}
|
|
3542
3928
|
)
|
|
3543
3929
|
] })
|
|
@@ -3635,10 +4021,10 @@ function useSearchInputModel({
|
|
|
3635
4021
|
}
|
|
3636
4022
|
|
|
3637
4023
|
// packages/react/src/search-input.tsx
|
|
3638
|
-
import { jsx as
|
|
4024
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3639
4025
|
function KjunSearchInput({
|
|
3640
4026
|
value,
|
|
3641
|
-
placeholder
|
|
4027
|
+
placeholder,
|
|
3642
4028
|
ariaLabel,
|
|
3643
4029
|
disabled = false,
|
|
3644
4030
|
error = false,
|
|
@@ -3649,8 +4035,8 @@ function KjunSearchInput({
|
|
|
3649
4035
|
itemKey = "id",
|
|
3650
4036
|
labelField = "name",
|
|
3651
4037
|
minChars = 2,
|
|
3652
|
-
emptyText
|
|
3653
|
-
errorText
|
|
4038
|
+
emptyText,
|
|
4039
|
+
errorText,
|
|
3654
4040
|
renderOption,
|
|
3655
4041
|
onValueChange,
|
|
3656
4042
|
onSelect,
|
|
@@ -3658,6 +4044,10 @@ function KjunSearchInput({
|
|
|
3658
4044
|
onEnter,
|
|
3659
4045
|
onClear
|
|
3660
4046
|
}) {
|
|
4047
|
+
const m = useKjunMessages();
|
|
4048
|
+
placeholder != null ? placeholder : placeholder = m.search;
|
|
4049
|
+
emptyText != null ? emptyText : emptyText = m.noResults;
|
|
4050
|
+
errorText != null ? errorText : errorText = m.searchFailed;
|
|
3661
4051
|
const [open, setOpen] = useState16(false);
|
|
3662
4052
|
const model = useSearchInputModel({ value, disabled, debounce, loadOptions, minChars, onValueChange, onSearchError }, open);
|
|
3663
4053
|
const { query: query2, options, loading, failed } = model;
|
|
@@ -3671,7 +4061,7 @@ function KjunSearchInput({
|
|
|
3671
4061
|
onClear == null ? void 0 : onClear();
|
|
3672
4062
|
};
|
|
3673
4063
|
if (!loadOptions)
|
|
3674
|
-
return /* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ jsx21(
|
|
3675
4065
|
KjunInput,
|
|
3676
4066
|
{
|
|
3677
4067
|
error,
|
|
@@ -3687,7 +4077,7 @@ function KjunSearchInput({
|
|
|
3687
4077
|
onEnter
|
|
3688
4078
|
}
|
|
3689
4079
|
);
|
|
3690
|
-
return /* @__PURE__ */
|
|
4080
|
+
return /* @__PURE__ */ jsx21(
|
|
3691
4081
|
SearchField,
|
|
3692
4082
|
{
|
|
3693
4083
|
error,
|
|
@@ -3723,7 +4113,7 @@ function KjunSearchInput({
|
|
|
3723
4113
|
import { tokens as tokens18 } from "@kjun-ui/tokens";
|
|
3724
4114
|
import {
|
|
3725
4115
|
useId as useId9,
|
|
3726
|
-
useContext as
|
|
4116
|
+
useContext as useContext12,
|
|
3727
4117
|
useRef as useRef19,
|
|
3728
4118
|
useEffect as useEffect12
|
|
3729
4119
|
} from "react";
|
|
@@ -3764,15 +4154,15 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3764
4154
|
}
|
|
3765
4155
|
|
|
3766
4156
|
// packages/react/src/compound-control.ts
|
|
3767
|
-
import { createContext as
|
|
3768
|
-
var CompoundControlContext =
|
|
4157
|
+
import { createContext as createContext12 } from "react";
|
|
4158
|
+
var CompoundControlContext = createContext12(null);
|
|
3769
4159
|
|
|
3770
4160
|
// packages/react/src/select-control.tsx
|
|
3771
|
-
import { Fragment as
|
|
4161
|
+
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3772
4162
|
function KjunSelect({
|
|
3773
4163
|
value,
|
|
3774
4164
|
options = [],
|
|
3775
|
-
placeholder
|
|
4165
|
+
placeholder,
|
|
3776
4166
|
ariaLabel,
|
|
3777
4167
|
labelKey = "label",
|
|
3778
4168
|
id: triggerId,
|
|
@@ -3783,7 +4173,7 @@ function KjunSelect({
|
|
|
3783
4173
|
searchable = false,
|
|
3784
4174
|
open: controlled,
|
|
3785
4175
|
loading = false,
|
|
3786
|
-
searchPlaceholder
|
|
4176
|
+
searchPlaceholder,
|
|
3787
4177
|
optionPageSize = 0,
|
|
3788
4178
|
clearable = false,
|
|
3789
4179
|
multiple = false,
|
|
@@ -3799,10 +4189,13 @@ function KjunSelect({
|
|
|
3799
4189
|
filterFn,
|
|
3800
4190
|
searchKeys
|
|
3801
4191
|
}) {
|
|
4192
|
+
const m = useKjunMessages();
|
|
4193
|
+
placeholder != null ? placeholder : placeholder = m.select;
|
|
4194
|
+
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
3802
4195
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
3803
4196
|
const composition = useCompositionGuard();
|
|
3804
4197
|
const ref = useRef19(null), menu = useRef19(null), field = useKjunField(), id = "kjun-" + useId9();
|
|
3805
|
-
const segment =
|
|
4198
|
+
const segment = useContext12(CompoundControlContext) !== null;
|
|
3806
4199
|
const spec = tokens18.input[size];
|
|
3807
4200
|
const expanded = usePopupExpanded(open, ref);
|
|
3808
4201
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
@@ -3831,9 +4224,10 @@ function KjunSelect({
|
|
|
3831
4224
|
loading,
|
|
3832
4225
|
multiple,
|
|
3833
4226
|
filterFn,
|
|
3834
|
-
searchKeys
|
|
4227
|
+
searchKeys,
|
|
4228
|
+
selectedCount: m.selectedCount
|
|
3835
4229
|
});
|
|
3836
|
-
return /* @__PURE__ */ jsxs15(
|
|
4230
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
3837
4231
|
/* @__PURE__ */ jsxs15("div", { className: "kjun-select-shell", children: [
|
|
3838
4232
|
/* @__PURE__ */ jsxs15(
|
|
3839
4233
|
"button",
|
|
@@ -3866,17 +4260,17 @@ function KjunSelect({
|
|
|
3866
4260
|
}
|
|
3867
4261
|
},
|
|
3868
4262
|
children: [
|
|
3869
|
-
/* @__PURE__ */
|
|
3870
|
-
/* @__PURE__ */
|
|
4263
|
+
/* @__PURE__ */ jsx22("span", { className: !label ? "kjun-placeholder" : void 0, style: { flex: 1, paddingRight: clearable && label ? spec.clearSize + spec.affixGap : void 0 }, children: (renderSelected == null ? void 0 : renderSelected(selectedOption)) || label || placeholder }),
|
|
4264
|
+
/* @__PURE__ */ jsx22(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ? tokens18.extensions.timePicker.iconSize : spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
3871
4265
|
]
|
|
3872
4266
|
}
|
|
3873
4267
|
),
|
|
3874
|
-
clearable && !!label && /* @__PURE__ */
|
|
4268
|
+
clearable && !!label && /* @__PURE__ */ jsx22(
|
|
3875
4269
|
KjunButton,
|
|
3876
4270
|
{
|
|
3877
4271
|
size: "sm",
|
|
3878
4272
|
variant: "ghost",
|
|
3879
|
-
ariaLabel:
|
|
4273
|
+
ariaLabel: m.clearSelection,
|
|
3880
4274
|
disabled,
|
|
3881
4275
|
className: "kjun-select-clear",
|
|
3882
4276
|
style: {
|
|
@@ -3893,11 +4287,11 @@ function KjunSelect({
|
|
|
3893
4287
|
onClear == null ? void 0 : onClear();
|
|
3894
4288
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3895
4289
|
},
|
|
3896
|
-
children: /* @__PURE__ */
|
|
4290
|
+
children: /* @__PURE__ */ jsx22(KjunIcon, { name: "x", size: spec.iconSize })
|
|
3897
4291
|
}
|
|
3898
4292
|
)
|
|
3899
4293
|
] }),
|
|
3900
|
-
/* @__PURE__ */
|
|
4294
|
+
/* @__PURE__ */ jsx22(
|
|
3901
4295
|
FloatingPanel,
|
|
3902
4296
|
{
|
|
3903
4297
|
field: true,
|
|
@@ -3907,15 +4301,15 @@ function KjunSelect({
|
|
|
3907
4301
|
placement: "bottom-start",
|
|
3908
4302
|
matchTriggerWidth: true,
|
|
3909
4303
|
className: "kjun-select-panel kjun-select-options-panel",
|
|
3910
|
-
children: /* @__PURE__ */
|
|
3911
|
-
menuHeader && /* @__PURE__ */
|
|
3912
|
-
searchable && /* @__PURE__ */
|
|
4304
|
+
children: /* @__PURE__ */ jsx22(FieldContext.Provider, { value: null, children: /* @__PURE__ */ jsxs15("div", { ref: menu, className: "kjun-select-content", children: [
|
|
4305
|
+
menuHeader && /* @__PURE__ */ jsx22("div", { className: "kjun-select-header", children: menuHeader }),
|
|
4306
|
+
searchable && /* @__PURE__ */ jsx22("div", { className: "kjun-select-search", children: /* @__PURE__ */ jsx22(
|
|
3913
4307
|
KjunInput,
|
|
3914
4308
|
{
|
|
3915
4309
|
autoFocus: true,
|
|
3916
4310
|
value: query2,
|
|
3917
4311
|
placeholder: searchPlaceholder,
|
|
3918
|
-
ariaLabel:
|
|
4312
|
+
ariaLabel: m.searchOptions,
|
|
3919
4313
|
size: "sm",
|
|
3920
4314
|
prefixIcon: "search",
|
|
3921
4315
|
onValueChange: (v) => {
|
|
@@ -3940,8 +4334,8 @@ function KjunSelect({
|
|
|
3940
4334
|
}
|
|
3941
4335
|
}
|
|
3942
4336
|
) }),
|
|
3943
|
-
loading && /* @__PURE__ */
|
|
3944
|
-
/* @__PURE__ */
|
|
4337
|
+
loading && /* @__PURE__ */ jsx22("div", { className: "kjun-select-empty", children: /* @__PURE__ */ jsx22(KjunSpinner, { size: "sm", text: m.searching }) }),
|
|
4338
|
+
/* @__PURE__ */ jsx22(
|
|
3945
4339
|
ListBox,
|
|
3946
4340
|
{
|
|
3947
4341
|
id,
|
|
@@ -3970,8 +4364,8 @@ function KjunSelect({
|
|
|
3970
4364
|
textValue: optionLabel(o, labelKey),
|
|
3971
4365
|
className: "kjun-option",
|
|
3972
4366
|
children: [
|
|
3973
|
-
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */
|
|
3974
|
-
selected(o) && /* @__PURE__ */
|
|
4367
|
+
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ jsx22("span", { children: optionLabel(o, labelKey) }),
|
|
4368
|
+
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size: tokens18.extensions.menu.iconSize })
|
|
3975
4369
|
]
|
|
3976
4370
|
},
|
|
3977
4371
|
key
|
|
@@ -3979,15 +4373,15 @@ function KjunSelect({
|
|
|
3979
4373
|
},
|
|
3980
4374
|
session
|
|
3981
4375
|
),
|
|
3982
|
-
!loading && !matching.length && /* @__PURE__ */
|
|
3983
|
-
!loading && visible.length < matching.length && /* @__PURE__ */
|
|
4376
|
+
!loading && !matching.length && /* @__PURE__ */ jsx22("div", { className: "kjun-select-empty", children: m.noResults }),
|
|
4377
|
+
!loading && visible.length < matching.length && /* @__PURE__ */ jsx22(
|
|
3984
4378
|
KjunButton,
|
|
3985
4379
|
{
|
|
3986
4380
|
size: "sm",
|
|
3987
4381
|
variant: "ghost",
|
|
3988
4382
|
block: true,
|
|
3989
4383
|
onClick: showMore,
|
|
3990
|
-
children:
|
|
4384
|
+
children: m.loadMore
|
|
3991
4385
|
}
|
|
3992
4386
|
)
|
|
3993
4387
|
] }) })
|
|
@@ -4002,7 +4396,7 @@ import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
|
4002
4396
|
// packages/react/src/collapse.tsx
|
|
4003
4397
|
import { tokens as tokens19 } from "@kjun-ui/tokens";
|
|
4004
4398
|
import { useLayoutEffect as useLayoutEffect11, useRef as useRef20, useState as useState18 } from "react";
|
|
4005
|
-
import { jsx as
|
|
4399
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4006
4400
|
function Collapse({ open, children }) {
|
|
4007
4401
|
const reduced = useReducedMotion();
|
|
4008
4402
|
const [retained, setRetained] = useState18(open);
|
|
@@ -4062,7 +4456,7 @@ function Collapse({ open, children }) {
|
|
|
4062
4456
|
}
|
|
4063
4457
|
};
|
|
4064
4458
|
}, [open, reduced, present]);
|
|
4065
|
-
return present ? /* @__PURE__ */
|
|
4459
|
+
return present ? /* @__PURE__ */ jsx23("div", { ref: root, className: "kjun-motion-collapse", inert: !open, "aria-hidden": !open || void 0, children: /* @__PURE__ */ jsx23("div", { ref: body, children }) }) : null;
|
|
4066
4460
|
}
|
|
4067
4461
|
|
|
4068
4462
|
// shared/package-runtime/navigation.ts
|
|
@@ -4167,10 +4561,10 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4167
4561
|
// packages/react/src/navigation.tsx
|
|
4168
4562
|
import {
|
|
4169
4563
|
Children,
|
|
4170
|
-
createContext as
|
|
4171
|
-
Fragment as
|
|
4564
|
+
createContext as createContext13,
|
|
4565
|
+
Fragment as Fragment7,
|
|
4172
4566
|
isValidElement as isValidElement3,
|
|
4173
|
-
useContext as
|
|
4567
|
+
useContext as useContext13,
|
|
4174
4568
|
useEffect as useEffect14,
|
|
4175
4569
|
useLayoutEffect as useLayoutEffect12,
|
|
4176
4570
|
useId as useId10,
|
|
@@ -4178,7 +4572,7 @@ import {
|
|
|
4178
4572
|
useState as useState20
|
|
4179
4573
|
} from "react";
|
|
4180
4574
|
import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
|
|
4181
|
-
import { Fragment as
|
|
4575
|
+
import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4182
4576
|
function KjunTabs({
|
|
4183
4577
|
value,
|
|
4184
4578
|
items = [],
|
|
@@ -4186,12 +4580,14 @@ function KjunTabs({
|
|
|
4186
4580
|
variant = "underline",
|
|
4187
4581
|
actions,
|
|
4188
4582
|
children,
|
|
4189
|
-
ariaLabel
|
|
4583
|
+
ariaLabel,
|
|
4190
4584
|
onValueChange,
|
|
4191
4585
|
onChange,
|
|
4192
4586
|
onTabMenu
|
|
4193
4587
|
}) {
|
|
4194
4588
|
var _a;
|
|
4589
|
+
const m = useKjunMessages();
|
|
4590
|
+
ariaLabel != null ? ariaLabel : ariaLabel = m.tabs;
|
|
4195
4591
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4196
4592
|
const panes = Children.toArray(children).filter(
|
|
4197
4593
|
isValidElement3
|
|
@@ -4238,7 +4634,7 @@ function KjunTabs({
|
|
|
4238
4634
|
children: [
|
|
4239
4635
|
/* @__PURE__ */ jsxs16("div", { className: "kjun-tabs-header", children: [
|
|
4240
4636
|
/* @__PURE__ */ jsxs16("div", { className: "kjun-tabs-track", ref: group, tabIndex: -1, children: [
|
|
4241
|
-
/* @__PURE__ */
|
|
4637
|
+
/* @__PURE__ */ jsx24(TabList, { "aria-label": ariaLabel, className: "kjun-tabs-list", children: tabs.map((tab) => /* @__PURE__ */ jsxs16(
|
|
4242
4638
|
Tab,
|
|
4243
4639
|
{
|
|
4244
4640
|
id: tab.name,
|
|
@@ -4278,10 +4674,10 @@ function KjunTabs({
|
|
|
4278
4674
|
onTouchEnd: clear,
|
|
4279
4675
|
onTouchCancel: clear,
|
|
4280
4676
|
children: [
|
|
4281
|
-
tab.icon && /* @__PURE__ */
|
|
4677
|
+
tab.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: tab.icon, size: tokens20.extensions.tabs.iconSize }),
|
|
4282
4678
|
" ",
|
|
4283
|
-
/* @__PURE__ */
|
|
4284
|
-
tab.badge != null && /* @__PURE__ */
|
|
4679
|
+
/* @__PURE__ */ jsx24("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ jsx24("span", { children: tab.label }) }),
|
|
4680
|
+
tab.badge != null && /* @__PURE__ */ jsx24(
|
|
4285
4681
|
"span",
|
|
4286
4682
|
{
|
|
4287
4683
|
className: "kjun-tab-badge",
|
|
@@ -4295,17 +4691,17 @@ function KjunTabs({
|
|
|
4295
4691
|
},
|
|
4296
4692
|
tab.name
|
|
4297
4693
|
)) }),
|
|
4298
|
-
/* @__PURE__ */
|
|
4694
|
+
/* @__PURE__ */ jsx24("span", { ref: indicator, className: "kjun-tab-indicator", "aria-hidden": "true", hidden: true })
|
|
4299
4695
|
] }),
|
|
4300
4696
|
actions
|
|
4301
4697
|
] }),
|
|
4302
|
-
children && /* @__PURE__ */
|
|
4698
|
+
children && /* @__PURE__ */ jsx24("div", { className: "kjun-tab-content", children })
|
|
4303
4699
|
]
|
|
4304
4700
|
}
|
|
4305
4701
|
);
|
|
4306
4702
|
}
|
|
4307
4703
|
function KjunTabPane({ name, children }) {
|
|
4308
|
-
return /* @__PURE__ */
|
|
4704
|
+
return /* @__PURE__ */ jsx24(
|
|
4309
4705
|
TabPanel,
|
|
4310
4706
|
{
|
|
4311
4707
|
id: name,
|
|
@@ -4316,18 +4712,18 @@ function KjunTabPane({ name, children }) {
|
|
|
4316
4712
|
}
|
|
4317
4713
|
);
|
|
4318
4714
|
}
|
|
4319
|
-
var AccordionContext =
|
|
4715
|
+
var AccordionContext = createContext13(null);
|
|
4320
4716
|
function KjunAccordion({
|
|
4321
4717
|
multiple = false,
|
|
4322
4718
|
tone = "card",
|
|
4323
4719
|
children
|
|
4324
4720
|
}) {
|
|
4325
4721
|
const state = useAccordionState(multiple);
|
|
4326
|
-
return /* @__PURE__ */
|
|
4722
|
+
return /* @__PURE__ */ jsx24(
|
|
4327
4723
|
AccordionContext.Provider,
|
|
4328
4724
|
{
|
|
4329
4725
|
value: state,
|
|
4330
|
-
children: /* @__PURE__ */
|
|
4726
|
+
children: /* @__PURE__ */ jsx24("div", { className: "kjun-accordion", "data-tone": tone, children })
|
|
4331
4727
|
}
|
|
4332
4728
|
);
|
|
4333
4729
|
}
|
|
@@ -4338,7 +4734,7 @@ function KjunAccordionItem({
|
|
|
4338
4734
|
header,
|
|
4339
4735
|
children
|
|
4340
4736
|
}) {
|
|
4341
|
-
const group =
|
|
4737
|
+
const group = useContext13(AccordionContext), id = "kjun-" + useId10(), [own, setOwn] = useState20(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
4342
4738
|
useEffect14(() => {
|
|
4343
4739
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4344
4740
|
}, []);
|
|
@@ -4354,8 +4750,8 @@ function KjunAccordionItem({
|
|
|
4354
4750
|
className: "kjun-accordion-trigger",
|
|
4355
4751
|
onClick: () => group ? group.toggle(id) : setOwn(!own),
|
|
4356
4752
|
children: [
|
|
4357
|
-
/* @__PURE__ */
|
|
4358
|
-
/* @__PURE__ */
|
|
4753
|
+
/* @__PURE__ */ jsx24("span", { className: "kjun-accordion-heading", children: header || title }),
|
|
4754
|
+
/* @__PURE__ */ jsx24(
|
|
4359
4755
|
KjunIcon,
|
|
4360
4756
|
{
|
|
4361
4757
|
name: "chevron-down",
|
|
@@ -4367,7 +4763,7 @@ function KjunAccordionItem({
|
|
|
4367
4763
|
]
|
|
4368
4764
|
}
|
|
4369
4765
|
),
|
|
4370
|
-
/* @__PURE__ */
|
|
4766
|
+
/* @__PURE__ */ jsx24(Collapse, { open, children: /* @__PURE__ */ jsx24(
|
|
4371
4767
|
"div",
|
|
4372
4768
|
{
|
|
4373
4769
|
role: "region",
|
|
@@ -4382,18 +4778,20 @@ function KjunAccordionItem({
|
|
|
4382
4778
|
function KjunBreadcrumb({
|
|
4383
4779
|
items,
|
|
4384
4780
|
renderLink,
|
|
4385
|
-
ariaLabel
|
|
4781
|
+
ariaLabel
|
|
4386
4782
|
}) {
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4783
|
+
const m = useKjunMessages();
|
|
4784
|
+
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
4785
|
+
return /* @__PURE__ */ jsx24("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4786
|
+
const label = /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
4787
|
+
item.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: item.icon, size: tokens20.extensions.breadcrumb.iconSize }),
|
|
4390
4788
|
" ",
|
|
4391
4789
|
item.label
|
|
4392
4790
|
] });
|
|
4393
|
-
return /* @__PURE__ */ jsxs16(
|
|
4394
|
-
i > 0 && /* @__PURE__ */
|
|
4791
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
4792
|
+
i > 0 && /* @__PURE__ */ jsx24(KjunIcon, { name: "chevron-right", size: tokens20.extensions.breadcrumb.separatorSize }),
|
|
4395
4793
|
" ",
|
|
4396
|
-
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */
|
|
4794
|
+
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ jsx24("a", { href: item.to, children: label }) : /* @__PURE__ */ jsx24("span", { "aria-current": i === items.length - 1 ? "page" : void 0, children: label })
|
|
4397
4795
|
] }, i);
|
|
4398
4796
|
}) });
|
|
4399
4797
|
}
|
|
@@ -4414,6 +4812,7 @@ function KjunPagination({
|
|
|
4414
4812
|
onPageSizeChange
|
|
4415
4813
|
}) {
|
|
4416
4814
|
var _a;
|
|
4815
|
+
const m = useKjunMessages();
|
|
4417
4816
|
const current = Math.max(1, Math.min(totalPages, (_a = currentPage != null ? currentPage : page) != null ? _a : 1));
|
|
4418
4817
|
if (totalPages <= 1 && !showSizeSelector && !(showInfo && totalRows > 0)) return null;
|
|
4419
4818
|
const change = (v) => {
|
|
@@ -4430,34 +4829,26 @@ function KjunPagination({
|
|
|
4430
4829
|
).filter((v) => v >= 1 && v <= totalPages)
|
|
4431
4830
|
]);
|
|
4432
4831
|
const pages = [...visible].sort((a, b) => a - b).flatMap((v, i, all) => i && v - all[i - 1] > 1 ? ["...", v] : [v]);
|
|
4433
|
-
const button = (target, label, icon) => /* @__PURE__ */
|
|
4832
|
+
const button = (target, label, icon) => /* @__PURE__ */ jsx24(
|
|
4434
4833
|
"button",
|
|
4435
4834
|
{
|
|
4436
4835
|
type: "button",
|
|
4437
4836
|
"aria-label": label,
|
|
4438
4837
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4439
4838
|
onClick: () => change(target),
|
|
4440
|
-
children: /* @__PURE__ */
|
|
4839
|
+
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size: tokens20.extensions.pagination.iconSize })
|
|
4441
4840
|
}
|
|
4442
4841
|
);
|
|
4443
|
-
return /* @__PURE__ */ jsxs16("nav", { "aria-label":
|
|
4444
|
-
showInfo && totalRows > 0 ? /* @__PURE__ */
|
|
4445
|
-
(current - 1) * pageSize + 1,
|
|
4446
|
-
" -",
|
|
4447
|
-
" ",
|
|
4448
|
-
Math.min(current * pageSize, totalRows),
|
|
4449
|
-
" / ",
|
|
4450
|
-
formatter(totalRows),
|
|
4451
|
-
"\uAC1C"
|
|
4452
|
-
] }) : /* @__PURE__ */ jsx23("span", {}),
|
|
4842
|
+
return /* @__PURE__ */ jsxs16("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
4843
|
+
showInfo && totalRows > 0 ? /* @__PURE__ */ jsx24("span", { children: m.pageRange((current - 1) * pageSize + 1, Math.min(current * pageSize, totalRows), formatter(totalRows)) }) : /* @__PURE__ */ jsx24("span", {}),
|
|
4453
4844
|
/* @__PURE__ */ jsxs16("div", { className: "kjun-pagination-controls", children: [
|
|
4454
|
-
showSizeSelector && /* @__PURE__ */
|
|
4845
|
+
showSizeSelector && /* @__PURE__ */ jsx24("div", { className: "kjun-pagination-size", children: /* @__PURE__ */ jsx24(
|
|
4455
4846
|
KjunSelect,
|
|
4456
4847
|
{
|
|
4457
4848
|
size: "sm",
|
|
4458
|
-
ariaLabel:
|
|
4849
|
+
ariaLabel: m.itemsPerPage,
|
|
4459
4850
|
value: pageSize,
|
|
4460
|
-
options: pageSizeOptions.map((n) => ({ value: n, label:
|
|
4851
|
+
options: pageSizeOptions.map((n) => ({ value: n, label: m.perPage(n) })),
|
|
4461
4852
|
onValueChange: (value) => {
|
|
4462
4853
|
onPageSizeChange == null ? void 0 : onPageSizeChange(Number(value));
|
|
4463
4854
|
onPageChange == null ? void 0 : onPageChange(1);
|
|
@@ -4466,23 +4857,23 @@ function KjunPagination({
|
|
|
4466
4857
|
}
|
|
4467
4858
|
) }),
|
|
4468
4859
|
totalPages > 1 && /* @__PURE__ */ jsxs16("div", { className: "kjun-pagination-mobile", children: [
|
|
4469
|
-
button(current - 1,
|
|
4860
|
+
button(current - 1, m.previousPage, "chevron-left"),
|
|
4470
4861
|
/* @__PURE__ */ jsxs16("span", { children: [
|
|
4471
|
-
/* @__PURE__ */
|
|
4862
|
+
/* @__PURE__ */ jsx24("strong", { children: current }),
|
|
4472
4863
|
" / ",
|
|
4473
4864
|
totalPages
|
|
4474
4865
|
] }),
|
|
4475
|
-
button(current + 1,
|
|
4866
|
+
button(current + 1, m.nextPage, "chevron-right")
|
|
4476
4867
|
] }),
|
|
4477
4868
|
totalPages > 1 && /* @__PURE__ */ jsxs16("div", { className: "kjun-pagination-desktop", children: [
|
|
4478
|
-
showFirstLast && button(1,
|
|
4479
|
-
button(current - 1,
|
|
4869
|
+
showFirstLast && button(1, m.firstPage, "chevrons-left"),
|
|
4870
|
+
button(current - 1, m.previousPage, "chevron-left"),
|
|
4480
4871
|
pages.map(
|
|
4481
|
-
(n, i) => typeof n === "string" ? /* @__PURE__ */
|
|
4872
|
+
(n, i) => typeof n === "string" ? /* @__PURE__ */ jsx24("span", { children: "..." }, "dots" + i) : /* @__PURE__ */ jsx24(
|
|
4482
4873
|
"button",
|
|
4483
4874
|
{
|
|
4484
4875
|
type: "button",
|
|
4485
|
-
"aria-label":
|
|
4876
|
+
"aria-label": m.page(n),
|
|
4486
4877
|
"aria-current": current === n ? "page" : void 0,
|
|
4487
4878
|
onClick: () => change(n),
|
|
4488
4879
|
children: n
|
|
@@ -4490,8 +4881,8 @@ function KjunPagination({
|
|
|
4490
4881
|
n
|
|
4491
4882
|
)
|
|
4492
4883
|
),
|
|
4493
|
-
button(current + 1,
|
|
4494
|
-
showFirstLast && button(totalPages,
|
|
4884
|
+
button(current + 1, m.nextPage, "chevron-right"),
|
|
4885
|
+
showFirstLast && button(totalPages, m.lastPage, "chevrons-right")
|
|
4495
4886
|
] })
|
|
4496
4887
|
] })
|
|
4497
4888
|
] });
|
|
@@ -4500,12 +4891,12 @@ function KjunPagination({
|
|
|
4500
4891
|
// packages/react/src/actions.tsx
|
|
4501
4892
|
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
4502
4893
|
import {
|
|
4503
|
-
useContext as
|
|
4894
|
+
useContext as useContext14,
|
|
4504
4895
|
useEffect as useEffect15,
|
|
4505
4896
|
useRef as useRef23,
|
|
4506
4897
|
useState as useState21
|
|
4507
4898
|
} from "react";
|
|
4508
|
-
import { Fragment as
|
|
4899
|
+
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4509
4900
|
function KjunIconToggle({
|
|
4510
4901
|
active = false,
|
|
4511
4902
|
activeIcon,
|
|
@@ -4524,8 +4915,8 @@ function KjunIconToggle({
|
|
|
4524
4915
|
onToggle
|
|
4525
4916
|
}) {
|
|
4526
4917
|
var _a;
|
|
4527
|
-
const navigation =
|
|
4528
|
-
return /* @__PURE__ */
|
|
4918
|
+
const navigation = useContext14(TopNavigationContext);
|
|
4919
|
+
return /* @__PURE__ */ jsx25(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ jsx25(
|
|
4529
4920
|
"button",
|
|
4530
4921
|
{
|
|
4531
4922
|
type: "button",
|
|
@@ -4540,7 +4931,7 @@ function KjunIconToggle({
|
|
|
4540
4931
|
e.stopPropagation();
|
|
4541
4932
|
onToggle == null ? void 0 : onToggle();
|
|
4542
4933
|
},
|
|
4543
|
-
children: loading ? navigation ? /* @__PURE__ */
|
|
4934
|
+
children: loading ? navigation ? /* @__PURE__ */ jsx25(KjunIcon, { name: "loader-2", spin: true, size: navigation.iconSize }) : /* @__PURE__ */ jsx25(KjunSpinner, { size: "sm" }) : /* @__PURE__ */ jsx25(
|
|
4544
4935
|
KjunIcon,
|
|
4545
4936
|
{
|
|
4546
4937
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
@@ -4575,7 +4966,7 @@ function KjunCopyButton({
|
|
|
4575
4966
|
value,
|
|
4576
4967
|
ariaLabel,
|
|
4577
4968
|
text,
|
|
4578
|
-
successText
|
|
4969
|
+
successText,
|
|
4579
4970
|
inline = false,
|
|
4580
4971
|
size = "sm",
|
|
4581
4972
|
disabled = false,
|
|
@@ -4583,6 +4974,8 @@ function KjunCopyButton({
|
|
|
4583
4974
|
onCopied,
|
|
4584
4975
|
onCopyError
|
|
4585
4976
|
}) {
|
|
4977
|
+
const m = useKjunMessages();
|
|
4978
|
+
successText != null ? successText : successText = m.copied;
|
|
4586
4979
|
const feedback = useOptionalKjunFeedback();
|
|
4587
4980
|
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy = useRef23(false), timer = useRef23(void 0), mounted = useRef23(true);
|
|
4588
4981
|
useEffect15(() => {
|
|
@@ -4592,13 +4985,13 @@ function KjunCopyButton({
|
|
|
4592
4985
|
clearTimeout(timer.current);
|
|
4593
4986
|
};
|
|
4594
4987
|
}, []);
|
|
4595
|
-
return /* @__PURE__ */ jsxs17(
|
|
4988
|
+
return /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
4596
4989
|
/* @__PURE__ */ jsxs17(
|
|
4597
4990
|
"button",
|
|
4598
4991
|
{
|
|
4599
4992
|
type: "button",
|
|
4600
4993
|
disabled,
|
|
4601
|
-
"aria-label": ariaLabel || text ||
|
|
4994
|
+
"aria-label": ariaLabel || text || m.copy,
|
|
4602
4995
|
className: "kjun-copy-button",
|
|
4603
4996
|
"data-inline": inline,
|
|
4604
4997
|
style: {
|
|
@@ -4623,7 +5016,7 @@ function KjunCopyButton({
|
|
|
4623
5016
|
} catch (error) {
|
|
4624
5017
|
if (mounted.current) {
|
|
4625
5018
|
setFailed(true);
|
|
4626
|
-
feedback == null ? void 0 : feedback.toast.error(
|
|
5019
|
+
feedback == null ? void 0 : feedback.toast.error(m.copyFailed);
|
|
4627
5020
|
onCopyError == null ? void 0 : onCopyError(error);
|
|
4628
5021
|
}
|
|
4629
5022
|
} finally {
|
|
@@ -4631,7 +5024,7 @@ function KjunCopyButton({
|
|
|
4631
5024
|
}
|
|
4632
5025
|
},
|
|
4633
5026
|
children: [
|
|
4634
|
-
/* @__PURE__ */
|
|
5027
|
+
/* @__PURE__ */ jsx25(
|
|
4635
5028
|
KjunIcon,
|
|
4636
5029
|
{
|
|
4637
5030
|
name: copied ? "check" : "copy",
|
|
@@ -4639,17 +5032,17 @@ function KjunCopyButton({
|
|
|
4639
5032
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
4640
5033
|
}
|
|
4641
5034
|
),
|
|
4642
|
-
text && !inline && /* @__PURE__ */
|
|
5035
|
+
text && !inline && /* @__PURE__ */ jsx25("span", { children: copied ? successText : text })
|
|
4643
5036
|
]
|
|
4644
5037
|
}
|
|
4645
5038
|
),
|
|
4646
|
-
/* @__PURE__ */
|
|
5039
|
+
/* @__PURE__ */ jsx25("span", { role: feedback ? void 0 : "status", "aria-hidden": feedback ? true : void 0, className: "kjun-sr-only", children: copied ? successText : failed ? m.copyFailed : "" })
|
|
4647
5040
|
] });
|
|
4648
5041
|
}
|
|
4649
5042
|
function KjunRefreshButton({
|
|
4650
5043
|
targetName = "",
|
|
4651
5044
|
mode = "icon",
|
|
4652
|
-
text
|
|
5045
|
+
text,
|
|
4653
5046
|
size = "sm",
|
|
4654
5047
|
variant = "ghost",
|
|
4655
5048
|
ariaLabel,
|
|
@@ -4662,10 +5055,12 @@ function KjunRefreshButton({
|
|
|
4662
5055
|
...props
|
|
4663
5056
|
}) {
|
|
4664
5057
|
var _a;
|
|
5058
|
+
const m = useKjunMessages();
|
|
5059
|
+
text != null ? text : text = m.refresh;
|
|
4665
5060
|
const reduced = useReducedMotion();
|
|
4666
|
-
const label = ariaLabel || [targetName, mode === "text" ? text :
|
|
5061
|
+
const label = ariaLabel || [targetName, mode === "text" ? text : m.refresh].filter(Boolean).join(" ");
|
|
4667
5062
|
const hint = (_a = tooltip != null ? tooltip : title) != null ? _a : mode === "icon" ? label : "";
|
|
4668
|
-
return /* @__PURE__ */
|
|
5063
|
+
return /* @__PURE__ */ jsx25(KjunTooltip, { content: props.disabled || props.loading ? "" : hint, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ jsx25(
|
|
4669
5064
|
KjunButton,
|
|
4670
5065
|
{
|
|
4671
5066
|
...props,
|
|
@@ -4693,24 +5088,25 @@ function KjunExternalLink({
|
|
|
4693
5088
|
label,
|
|
4694
5089
|
children
|
|
4695
5090
|
}) {
|
|
4696
|
-
const
|
|
5091
|
+
const m = useKjunMessages();
|
|
5092
|
+
const url = safeExternalUrl(href), name = label || (mode === "icon" ? m.externalLink : void 0), body = mode === "icon" ? /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link" }) : children;
|
|
4697
5093
|
return url ? /* @__PURE__ */ jsxs17(
|
|
4698
5094
|
"a",
|
|
4699
5095
|
{
|
|
4700
5096
|
href: url,
|
|
4701
5097
|
target: "_blank",
|
|
4702
5098
|
rel: "noopener noreferrer",
|
|
4703
|
-
"aria-label": name ? name +
|
|
5099
|
+
"aria-label": name ? name + m.newWindow : void 0,
|
|
4704
5100
|
title: name,
|
|
4705
5101
|
className: "kjun-external-link",
|
|
4706
5102
|
onClick: (e) => e.stopPropagation(),
|
|
4707
5103
|
children: [
|
|
4708
5104
|
body,
|
|
4709
|
-
mode === "text" && /* @__PURE__ */
|
|
4710
|
-
!name && /* @__PURE__ */
|
|
5105
|
+
mode === "text" && /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link", size: tokens21.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
5106
|
+
!name && /* @__PURE__ */ jsx25("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
4711
5107
|
]
|
|
4712
5108
|
}
|
|
4713
|
-
) : /* @__PURE__ */
|
|
5109
|
+
) : /* @__PURE__ */ jsx25("span", { "aria-label": name, children: body });
|
|
4714
5110
|
}
|
|
4715
5111
|
function KjunScrollFade({ children }) {
|
|
4716
5112
|
const ref = useRef23(null), [edges, setEdges] = useState21({ left: false, right: false });
|
|
@@ -4735,7 +5131,7 @@ function KjunScrollFade({ children }) {
|
|
|
4735
5131
|
return () => observer.disconnect();
|
|
4736
5132
|
}, [children]);
|
|
4737
5133
|
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${tokens21.extensions.scrollFade.width}px` : "currentColor"}, ${edges.right ? `currentColor calc(100% - ${tokens21.extensions.scrollFade.width}px), transparent` : "currentColor"})` : void 0;
|
|
4738
|
-
return /* @__PURE__ */
|
|
5134
|
+
return /* @__PURE__ */ jsx25(
|
|
4739
5135
|
"div",
|
|
4740
5136
|
{
|
|
4741
5137
|
ref,
|
|
@@ -4770,7 +5166,7 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
4770
5166
|
}
|
|
4771
5167
|
|
|
4772
5168
|
// packages/react/src/data-state.tsx
|
|
4773
|
-
import { jsx as
|
|
5169
|
+
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4774
5170
|
function useQueryDisplay(props) {
|
|
4775
5171
|
var _a;
|
|
4776
5172
|
const [state, setState] = useState23(() => initialQueryDisplay(props));
|
|
@@ -4785,15 +5181,15 @@ function KjunDataState({
|
|
|
4785
5181
|
preserveContent = false,
|
|
4786
5182
|
refreshing = false,
|
|
4787
5183
|
refreshError,
|
|
4788
|
-
refreshingText
|
|
5184
|
+
refreshingText,
|
|
4789
5185
|
loadingPadding = "default",
|
|
4790
5186
|
empty = false,
|
|
4791
|
-
emptyText
|
|
5187
|
+
emptyText,
|
|
4792
5188
|
emptyIcon,
|
|
4793
5189
|
emptyActionText,
|
|
4794
|
-
loadingText
|
|
5190
|
+
loadingText,
|
|
4795
5191
|
loadingDelay = 0,
|
|
4796
|
-
retryText
|
|
5192
|
+
retryText,
|
|
4797
5193
|
size = "md",
|
|
4798
5194
|
skeleton = false,
|
|
4799
5195
|
skeletonType = "text",
|
|
@@ -4806,13 +5202,18 @@ function KjunDataState({
|
|
|
4806
5202
|
onEmptyAction,
|
|
4807
5203
|
...query2
|
|
4808
5204
|
}) {
|
|
5205
|
+
const m = useKjunMessages();
|
|
5206
|
+
refreshingText != null ? refreshingText : refreshingText = m.refreshing;
|
|
5207
|
+
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5208
|
+
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5209
|
+
retryText != null ? retryText : retryText = m.retry;
|
|
4809
5210
|
const state = useQueryDisplay(query2), blockingError = query2.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query2.error : null), concealed = state.initialLoading || !!blockingError || empty, padding = tokens22.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
4810
5211
|
return /* @__PURE__ */ jsxs18("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
4811
|
-
/* @__PURE__ */
|
|
4812
|
-
/* @__PURE__ */
|
|
4813
|
-
/* @__PURE__ */
|
|
5212
|
+
/* @__PURE__ */ jsx26("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ jsxs18("div", { className: "kjun-data-status", role: "status", children: [
|
|
5213
|
+
/* @__PURE__ */ jsx26(KjunSpinner, { size: "xs" }),
|
|
5214
|
+
/* @__PURE__ */ jsx26("span", { children: refreshingText })
|
|
4814
5215
|
] }) }),
|
|
4815
|
-
state.initialLoading ? /* @__PURE__ */
|
|
5216
|
+
state.initialLoading ? /* @__PURE__ */ jsx26(
|
|
4816
5217
|
"div",
|
|
4817
5218
|
{
|
|
4818
5219
|
className: "kjun-data-loading-block",
|
|
@@ -4820,13 +5221,13 @@ function KjunDataState({
|
|
|
4820
5221
|
"aria-label": revealed ? loadingText : void 0,
|
|
4821
5222
|
"aria-hidden": revealed ? void 0 : true,
|
|
4822
5223
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
4823
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */
|
|
4824
|
-
/* @__PURE__ */
|
|
4825
|
-
/* @__PURE__ */
|
|
5224
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx26("div", { style: { display: "grid", gap: tokens22.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx26(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ jsxs18("div", { className: "kjun-data-loading", children: [
|
|
5225
|
+
/* @__PURE__ */ jsx26(KjunSpinner, { size: "md" }),
|
|
5226
|
+
/* @__PURE__ */ jsx26("p", { children: loadingText })
|
|
4826
5227
|
] }))
|
|
4827
5228
|
}
|
|
4828
|
-
) : blockingError ? /* @__PURE__ */
|
|
4829
|
-
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */
|
|
5229
|
+
) : blockingError ? /* @__PURE__ */ jsx26("div", { className: "kjun-data-error kjun-state-actions", style: { paddingBlock: padding }, children: errorContent || /* @__PURE__ */ jsx26(KjunAlert, { type: "danger", title: m.errorTitle, actions: onRetry && /* @__PURE__ */ jsx26(KjunButton, { variant: "secondary", onClick: onRetry, children: retryText }), children: query2.error }) }) : empty ? /* @__PURE__ */ jsx26("div", { className: "kjun-data-empty kjun-state-actions", style: { paddingBlock: padding }, children: emptyContent || /* @__PURE__ */ jsx26(KjunEmpty, { text: emptyText, icon: emptyIcon, children: emptyActionText && /* @__PURE__ */ jsx26(KjunButton, { onClick: onEmptyAction, children: emptyActionText }) }) }) : null,
|
|
5230
|
+
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */ jsx26(
|
|
4830
5231
|
"div",
|
|
4831
5232
|
{
|
|
4832
5233
|
className: "kjun-data-content" + (concealed ? " kjun-data-concealed" : ""),
|
|
@@ -4839,10 +5240,7 @@ function KjunDataState({
|
|
|
4839
5240
|
},
|
|
4840
5241
|
"content"
|
|
4841
5242
|
),
|
|
4842
|
-
visibleRefreshError && !state.initialLoading && /* @__PURE__ */
|
|
4843
|
-
visibleRefreshError,
|
|
4844
|
-
" \xB7 \uC774\uC804 \uC870\uD68C \uACB0\uACFC\uB97C \uD45C\uC2DC\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4."
|
|
4845
|
-
] }) })
|
|
5243
|
+
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ jsx26("div", { className: "kjun-data-warning kjun-state-actions", children: /* @__PURE__ */ jsx26(KjunAlert, { type: "warning", size: "sm", actions: onRetry && /* @__PURE__ */ jsx26(KjunButton, { variant: "secondary", onClick: onRetry, children: retryText }), children: m.refreshError(String(visibleRefreshError)) }) })
|
|
4846
5244
|
] });
|
|
4847
5245
|
}
|
|
4848
5246
|
var KjunErrorBoundary = class extends Component {
|
|
@@ -4859,9 +5257,9 @@ var KjunErrorBoundary = class extends Component {
|
|
|
4859
5257
|
}
|
|
4860
5258
|
render() {
|
|
4861
5259
|
return this.state.error ? this.props.fallback || /* @__PURE__ */ jsxs18("div", { className: "kjun-error-fallback", children: [
|
|
4862
|
-
/* @__PURE__ */
|
|
4863
|
-
/* @__PURE__ */
|
|
4864
|
-
/* @__PURE__ */
|
|
5260
|
+
/* @__PURE__ */ jsx26("h3", { children: this.props.fallbackMessage || this.context.messages.somethingWentWrong }),
|
|
5261
|
+
/* @__PURE__ */ jsx26("p", { children: this.context.messages.retryHint }),
|
|
5262
|
+
/* @__PURE__ */ jsx26(
|
|
4865
5263
|
KjunButton,
|
|
4866
5264
|
{
|
|
4867
5265
|
onClick: () => {
|
|
@@ -4869,12 +5267,13 @@ var KjunErrorBoundary = class extends Component {
|
|
|
4869
5267
|
this.setState({ error: false });
|
|
4870
5268
|
(_b = (_a = this.props).onReset) == null ? void 0 : _b.call(_a);
|
|
4871
5269
|
},
|
|
4872
|
-
children:
|
|
5270
|
+
children: this.context.messages.retry
|
|
4873
5271
|
}
|
|
4874
5272
|
)
|
|
4875
5273
|
] }) : this.props.children;
|
|
4876
5274
|
}
|
|
4877
5275
|
};
|
|
5276
|
+
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
4878
5277
|
|
|
4879
5278
|
// packages/react/src/skeletons.tsx
|
|
4880
5279
|
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
@@ -4923,37 +5322,37 @@ function webMarketLayout(columns, showActions, widthClass) {
|
|
|
4923
5322
|
}
|
|
4924
5323
|
|
|
4925
5324
|
// packages/react/src/market-layout.tsx
|
|
4926
|
-
import { jsx as
|
|
5325
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4927
5326
|
function MarketColumns({ columns, showActions, widthClass }) {
|
|
4928
5327
|
const layout = webMarketLayout(columns, showActions, widthClass);
|
|
4929
5328
|
return /* @__PURE__ */ jsxs19("colgroup", { children: [
|
|
4930
|
-
showActions && /* @__PURE__ */
|
|
4931
|
-
layout.columns.map((column, index) => /* @__PURE__ */
|
|
5329
|
+
showActions && /* @__PURE__ */ jsx27("col", { style: { width: marketGeometry.actionsWidth } }),
|
|
5330
|
+
layout.columns.map((column, index) => /* @__PURE__ */ jsx27("col", { ...column }, columns[index].key || index))
|
|
4932
5331
|
] });
|
|
4933
5332
|
}
|
|
4934
5333
|
|
|
4935
5334
|
// packages/react/src/market-skeleton.tsx
|
|
4936
|
-
import { jsx as
|
|
5335
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4937
5336
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false, alignClass, widthClass }) {
|
|
4938
5337
|
const cols = normalizeMarketColumns(columns);
|
|
4939
|
-
return /* @__PURE__ */
|
|
4940
|
-
/* @__PURE__ */
|
|
4941
|
-
/* @__PURE__ */
|
|
4942
|
-
showActions && /* @__PURE__ */
|
|
4943
|
-
cols.map((col, i) => /* @__PURE__ */
|
|
5338
|
+
return /* @__PURE__ */ jsx28("div", { "aria-hidden": "true", className: "kjun-table-scroll", children: /* @__PURE__ */ jsxs20("table", { className: "kjun-market-table-grid", style: webMarketLayout(cols, showActions, widthClass).tableStyle, children: [
|
|
5339
|
+
/* @__PURE__ */ jsx28(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5340
|
+
/* @__PURE__ */ jsx28("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5341
|
+
showActions && /* @__PURE__ */ jsx28("th", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens24.extensions.marketTable.actionSkeletonWidth, height: tokens24.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
5342
|
+
cols.map((col, i) => /* @__PURE__ */ jsx28("th", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: col.label }, col.key || i))
|
|
4944
5343
|
] }) }),
|
|
4945
|
-
/* @__PURE__ */
|
|
4946
|
-
showActions && /* @__PURE__ */
|
|
4947
|
-
cols.map((col, i) => /* @__PURE__ */
|
|
4948
|
-
/* @__PURE__ */
|
|
4949
|
-
/* @__PURE__ */
|
|
4950
|
-
] }) : /* @__PURE__ */
|
|
5344
|
+
/* @__PURE__ */ jsx28("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5345
|
+
showActions && /* @__PURE__ */ jsx28("td", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens24.extensions.marketTable.actionSkeletonWidth, height: tokens24.extensions.financial.priceSkeletonHeight }) }) }),
|
|
5346
|
+
cols.map((col, i) => /* @__PURE__ */ jsx28("td", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: isMarketIdentity(col.key) ? /* @__PURE__ */ jsxs20("div", { className: "kjun-market-skeleton-identity", children: [
|
|
5347
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "80%", height: tokens24.extensions.skeleton.lineHeights.md }),
|
|
5348
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "60%", height: tokens24.extensions.skeleton.lineHeights.sm })
|
|
5349
|
+
] }) : /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens24.extensions.financial.priceSkeletonWidth, height: tokens24.extensions.financial.priceSkeletonHeight }) }) }, col.key || i))
|
|
4951
5350
|
] }, row)) })
|
|
4952
5351
|
] }) });
|
|
4953
5352
|
}
|
|
4954
5353
|
|
|
4955
5354
|
// packages/react/src/skeletons.tsx
|
|
4956
|
-
import { Fragment as
|
|
5355
|
+
import { Fragment as Fragment10, jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4957
5356
|
function KjunListSkeleton({
|
|
4958
5357
|
rows = 8,
|
|
4959
5358
|
variant = "market",
|
|
@@ -4961,10 +5360,10 @@ function KjunListSkeleton({
|
|
|
4961
5360
|
avatarSize = tokens25.extensions.skeleton.listAvatarSize,
|
|
4962
5361
|
quote = true
|
|
4963
5362
|
}) {
|
|
4964
|
-
return /* @__PURE__ */
|
|
4965
|
-
avatar && /* @__PURE__ */
|
|
5363
|
+
return /* @__PURE__ */ jsx29("div", { "aria-hidden": "true", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-row", "data-variant": variant, children: [
|
|
5364
|
+
avatar && /* @__PURE__ */ jsx29(KjunSkeleton, { type: "avatar", width: avatarSize, height: avatarSize }),
|
|
4966
5365
|
/* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-label", children: [
|
|
4967
|
-
/* @__PURE__ */
|
|
5366
|
+
/* @__PURE__ */ jsx29(
|
|
4968
5367
|
KjunSkeleton,
|
|
4969
5368
|
{
|
|
4970
5369
|
type: "block",
|
|
@@ -4972,11 +5371,11 @@ function KjunListSkeleton({
|
|
|
4972
5371
|
width: i % 2 ? "80%" : "65%"
|
|
4973
5372
|
}
|
|
4974
5373
|
),
|
|
4975
|
-
/* @__PURE__ */
|
|
5374
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens25.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
4976
5375
|
] }),
|
|
4977
5376
|
quote && /* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-quote", children: [
|
|
4978
|
-
/* @__PURE__ */
|
|
4979
|
-
/* @__PURE__ */
|
|
5377
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens25.extensions.skeleton.quoteHeight, width: tokens25.extensions.skeleton.quoteWidth }),
|
|
5378
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens25.extensions.skeleton.lineHeights.sm, width: tokens25.extensions.skeleton.detailWidth })
|
|
4980
5379
|
] })
|
|
4981
5380
|
] }, i)) });
|
|
4982
5381
|
}
|
|
@@ -4986,7 +5385,7 @@ function KjunFormSkeleton({
|
|
|
4986
5385
|
multiline = false,
|
|
4987
5386
|
size = "md"
|
|
4988
5387
|
}) {
|
|
4989
|
-
return /* @__PURE__ */
|
|
5388
|
+
return /* @__PURE__ */ jsx29(
|
|
4990
5389
|
"div",
|
|
4991
5390
|
{
|
|
4992
5391
|
"aria-hidden": "true",
|
|
@@ -4994,11 +5393,11 @@ function KjunFormSkeleton({
|
|
|
4994
5393
|
"data-columns": columns,
|
|
4995
5394
|
style: { "--_kjun-form-skeleton-radius": `${tokens25.input[size].radius}px` },
|
|
4996
5395
|
children: fields.map((field, i) => /* @__PURE__ */ jsxs21("div", { children: [
|
|
4997
|
-
field ? /* @__PURE__ */
|
|
5396
|
+
field ? /* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
4998
5397
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
4999
|
-
/* @__PURE__ */
|
|
5398
|
+
/* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens25.extensions.skeleton.formLabelHeight, width: tokens25.extensions.skeleton.formLabelWidth }) })
|
|
5000
5399
|
),
|
|
5001
|
-
/* @__PURE__ */
|
|
5400
|
+
/* @__PURE__ */ jsx29(
|
|
5002
5401
|
KjunSkeleton,
|
|
5003
5402
|
{
|
|
5004
5403
|
type: "block",
|
|
@@ -5012,14 +5411,16 @@ function KjunFormSkeleton({
|
|
|
5012
5411
|
function KjunChartSkeleton({
|
|
5013
5412
|
kind: requestedKind = "frame",
|
|
5014
5413
|
height = tokens25.extensions.chartSkeleton.height,
|
|
5015
|
-
loadingText
|
|
5414
|
+
loadingText,
|
|
5016
5415
|
skeleton = true,
|
|
5017
5416
|
loadingDelay = 0,
|
|
5018
5417
|
rows = 8,
|
|
5019
5418
|
columns = 14
|
|
5020
5419
|
}) {
|
|
5420
|
+
const m = useKjunMessages();
|
|
5421
|
+
loadingText != null ? loadingText : loadingText = m.chartLoading;
|
|
5021
5422
|
const kind = chartSkeletonKind(requestedKind), revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
|
|
5022
|
-
return /* @__PURE__ */
|
|
5423
|
+
return /* @__PURE__ */ jsx29(
|
|
5023
5424
|
"div",
|
|
5024
5425
|
{
|
|
5025
5426
|
className: "kjun-chart-skeleton",
|
|
@@ -5028,10 +5429,10 @@ function KjunChartSkeleton({
|
|
|
5028
5429
|
"aria-hidden": revealed ? void 0 : true,
|
|
5029
5430
|
style: { height, visibility: revealed ? void 0 : "hidden" },
|
|
5030
5431
|
children: !skeleton ? /* @__PURE__ */ jsxs21("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
loadingText && /* @__PURE__ */
|
|
5033
|
-
] }) : /* @__PURE__ */ jsxs21(
|
|
5034
|
-
kind === "donut" ? /* @__PURE__ */
|
|
5432
|
+
/* @__PURE__ */ jsx29("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29(KjunSpinner, { size: "md" }) }),
|
|
5433
|
+
loadingText && /* @__PURE__ */ jsx29("p", { children: loadingText })
|
|
5434
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment10, { children: [
|
|
5435
|
+
kind === "donut" ? /* @__PURE__ */ jsx29("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut", "aria-hidden": "true" }) : kind === "matrix" ? /* @__PURE__ */ jsx29(
|
|
5035
5436
|
"div",
|
|
5036
5437
|
{
|
|
5037
5438
|
className: "kjun-chart-skeleton-matrix",
|
|
@@ -5041,7 +5442,7 @@ function KjunChartSkeleton({
|
|
|
5041
5442
|
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
5042
5443
|
gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
|
|
5043
5444
|
},
|
|
5044
|
-
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */
|
|
5445
|
+
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ jsx29(
|
|
5045
5446
|
"div",
|
|
5046
5447
|
{
|
|
5047
5448
|
className: "kjun-chart-skeleton-cell",
|
|
@@ -5051,7 +5452,7 @@ function KjunChartSkeleton({
|
|
|
5051
5452
|
i
|
|
5052
5453
|
))
|
|
5053
5454
|
}
|
|
5054
|
-
) : /* @__PURE__ */
|
|
5455
|
+
) : /* @__PURE__ */ jsx29(
|
|
5055
5456
|
"svg",
|
|
5056
5457
|
{
|
|
5057
5458
|
viewBox: chartFrameViewBox,
|
|
@@ -5059,7 +5460,7 @@ function KjunChartSkeleton({
|
|
|
5059
5460
|
className: "kjun-chart-skeleton-plot",
|
|
5060
5461
|
"data-kjun-chart-part": "plot",
|
|
5061
5462
|
"aria-hidden": "true",
|
|
5062
|
-
children: /* @__PURE__ */
|
|
5463
|
+
children: /* @__PURE__ */ jsx29(
|
|
5063
5464
|
"path",
|
|
5064
5465
|
{
|
|
5065
5466
|
d: chartFramePath,
|
|
@@ -5071,7 +5472,7 @@ function KjunChartSkeleton({
|
|
|
5071
5472
|
)
|
|
5072
5473
|
}
|
|
5073
5474
|
),
|
|
5074
|
-
loadingText && /* @__PURE__ */
|
|
5475
|
+
loadingText && /* @__PURE__ */ jsx29("div", { className: "kjun-chart-skeleton-status", "data-kjun-chart-part": "status", role: status, children: /* @__PURE__ */ jsx29("span", { children: loadingText }) })
|
|
5075
5476
|
] })
|
|
5076
5477
|
}
|
|
5077
5478
|
);
|
|
@@ -5148,29 +5549,8 @@ function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
|
5148
5549
|
return display;
|
|
5149
5550
|
}
|
|
5150
5551
|
|
|
5151
|
-
// shared/package-runtime/relative-time.ts
|
|
5152
|
-
var units = [
|
|
5153
|
-
["year", 31536e3],
|
|
5154
|
-
["month", 2592e3],
|
|
5155
|
-
["day", 86400],
|
|
5156
|
-
["hour", 3600],
|
|
5157
|
-
["minute", 60]
|
|
5158
|
-
];
|
|
5159
|
-
function formatRelativeTime(value, now = Date.now()) {
|
|
5160
|
-
var _a;
|
|
5161
|
-
const time = new Date(value).getTime();
|
|
5162
|
-
if (!Number.isFinite(time)) return String(value);
|
|
5163
|
-
const seconds = Math.round((time - now) / 1e3);
|
|
5164
|
-
const [unit, size] = (_a = units.find(([, size2]) => Math.abs(seconds) >= size2)) != null ? _a : ["second", 1];
|
|
5165
|
-
const amount = Math.round(seconds / size);
|
|
5166
|
-
if (typeof Intl.RelativeTimeFormat === "function")
|
|
5167
|
-
return new Intl.RelativeTimeFormat("ko-KR", { numeric: "auto" }).format(amount, unit);
|
|
5168
|
-
const names = { year: "\uB144", month: "\uAC1C\uC6D4", day: "\uC77C", hour: "\uC2DC\uAC04", minute: "\uBD84", second: "\uCD08" };
|
|
5169
|
-
return Math.abs(amount) + names[unit] + (amount < 0 ? " \uC804" : " \uD6C4");
|
|
5170
|
-
}
|
|
5171
|
-
|
|
5172
5552
|
// packages/react/src/number-display.tsx
|
|
5173
|
-
import { Fragment as
|
|
5553
|
+
import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5174
5554
|
var finiteNumber = (value) => value == null || typeof value === "boolean" || typeof value === "string" && !value.trim() || !["number", "string"].includes(typeof value) || !Number.isFinite(Number(value)) ? null : Number(value) || 0;
|
|
5175
5555
|
var format = (value, decimals = 0) => new Intl.NumberFormat(void 0, {
|
|
5176
5556
|
minimumFractionDigits: Math.max(0, Math.min(20, decimals)),
|
|
@@ -5191,9 +5571,9 @@ function KjunAnimatedNumber({
|
|
|
5191
5571
|
}) {
|
|
5192
5572
|
const n = useCountUp(value, animated, fromPrevious);
|
|
5193
5573
|
return /* @__PURE__ */ jsxs22("span", { className: "kjun-animated-number " + className, children: [
|
|
5194
|
-
prefix && /* @__PURE__ */
|
|
5195
|
-
/* @__PURE__ */
|
|
5196
|
-
suffix && /* @__PURE__ */
|
|
5574
|
+
prefix && /* @__PURE__ */ jsx30("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
5575
|
+
/* @__PURE__ */ jsx30("span", { children: typeof n === "string" ? n : formatter ? formatter(n) : format(n, decimals) }),
|
|
5576
|
+
suffix && /* @__PURE__ */ jsx30("span", { className: "kjun-number-affix", "data-side": "suffix", children: suffix })
|
|
5197
5577
|
] });
|
|
5198
5578
|
}
|
|
5199
5579
|
function KjunFreshness({
|
|
@@ -5202,11 +5582,12 @@ function KjunFreshness({
|
|
|
5202
5582
|
fetchedAt,
|
|
5203
5583
|
formatter
|
|
5204
5584
|
}) {
|
|
5205
|
-
|
|
5585
|
+
const scope = useKjunMessageScope();
|
|
5586
|
+
return stale ? /* @__PURE__ */ jsx30(
|
|
5206
5587
|
KjunTooltip,
|
|
5207
5588
|
{
|
|
5208
|
-
content: (source === "close" ?
|
|
5209
|
-
children: /* @__PURE__ */
|
|
5589
|
+
content: (source === "close" ? scope.messages.noRealtimeQuote : scope.messages.realtimeDelayed) + (fetchedAt ? " \xB7 " + ((formatter == null ? void 0 : formatter(fetchedAt)) || formatRelativeTime(fetchedAt, void 0, scope)) : ""),
|
|
5590
|
+
children: /* @__PURE__ */ jsx30("span", { tabIndex: 0, className: "kjun-freshness", children: /* @__PURE__ */ jsx30(KjunBadge, { variant: "warning", size: "xs", children: source === "close" ? scope.messages.closePrice : scope.messages.delayed }) })
|
|
5210
5591
|
}
|
|
5211
5592
|
) : null;
|
|
5212
5593
|
}
|
|
@@ -5220,14 +5601,14 @@ function KjunPriceCell({
|
|
|
5220
5601
|
flashClass = "",
|
|
5221
5602
|
fromPrevious = true
|
|
5222
5603
|
}) {
|
|
5223
|
-
return value == null ? /* @__PURE__ */
|
|
5224
|
-
/* @__PURE__ */
|
|
5604
|
+
return value == null ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", height: tokens27.extensions.financial.priceSkeletonHeight, width: tokens27.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs22(Fragment11, { children: [
|
|
5605
|
+
/* @__PURE__ */ jsx30(
|
|
5225
5606
|
"span",
|
|
5226
5607
|
{
|
|
5227
5608
|
className: "kjun-price-cell " + flashClass,
|
|
5228
5609
|
ref: domainColorRef(/\bkjun-price-flash-(up|down)/.test(flashClass)),
|
|
5229
5610
|
style: { color: stale ? "var(--_kjun-color-text-tertiary)" : void 0 },
|
|
5230
|
-
children: /* @__PURE__ */
|
|
5611
|
+
children: /* @__PURE__ */ jsx30(
|
|
5231
5612
|
KjunAnimatedNumber,
|
|
5232
5613
|
{
|
|
5233
5614
|
value,
|
|
@@ -5237,7 +5618,7 @@ function KjunPriceCell({
|
|
|
5237
5618
|
)
|
|
5238
5619
|
}
|
|
5239
5620
|
),
|
|
5240
|
-
showFreshness && /* @__PURE__ */
|
|
5621
|
+
showFreshness && /* @__PURE__ */ jsx30(KjunFreshness, { stale, source, fetchedAt })
|
|
5241
5622
|
] });
|
|
5242
5623
|
}
|
|
5243
5624
|
function KjunSignedValue({
|
|
@@ -5268,15 +5649,15 @@ function KjunSignedValue({
|
|
|
5268
5649
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5269
5650
|
},
|
|
5270
5651
|
children: [
|
|
5271
|
-
loading ? /* @__PURE__ */
|
|
5272
|
-
!loading && showFreshness && stale && n !== null && /* @__PURE__ */
|
|
5652
|
+
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width: tokens27.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5653
|
+
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ jsx30(KjunFreshness, { stale: true })
|
|
5273
5654
|
]
|
|
5274
5655
|
}
|
|
5275
5656
|
);
|
|
5276
5657
|
}
|
|
5277
5658
|
|
|
5278
5659
|
// packages/react/src/financial-display.tsx
|
|
5279
|
-
import { Fragment as
|
|
5660
|
+
import { Fragment as Fragment12, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5280
5661
|
var deviationFill = { neutral: 1, low: tokens28.states.opacity.deviationLow, medium: tokens28.states.opacity.deviationMedium, strong: tokens28.states.opacity.deviationStrong };
|
|
5281
5662
|
function KjunDeviation({
|
|
5282
5663
|
value,
|
|
@@ -5285,13 +5666,14 @@ function KjunDeviation({
|
|
|
5285
5666
|
decimals = 2,
|
|
5286
5667
|
formatter
|
|
5287
5668
|
}) {
|
|
5669
|
+
const m = useKjunMessages();
|
|
5288
5670
|
const n = finiteNumber(value);
|
|
5289
5671
|
if (n === null)
|
|
5290
|
-
return /* @__PURE__ */
|
|
5672
|
+
return /* @__PURE__ */ jsx31("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5291
5673
|
const abs = Math.abs(n), signal = abs >= signalThreshold, level = deviationLevel(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
5292
5674
|
if (variant === "badge")
|
|
5293
5675
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-deviation-badge", children: [
|
|
5294
|
-
/* @__PURE__ */
|
|
5676
|
+
/* @__PURE__ */ jsx31(
|
|
5295
5677
|
KjunBadge,
|
|
5296
5678
|
{
|
|
5297
5679
|
variant: neutral ? "secondary" : n > 0 ? "price-up" : "price-down",
|
|
@@ -5300,11 +5682,11 @@ function KjunDeviation({
|
|
|
5300
5682
|
children: label
|
|
5301
5683
|
}
|
|
5302
5684
|
),
|
|
5303
|
-
!signal ? /* @__PURE__ */
|
|
5685
|
+
!signal ? /* @__PURE__ */ jsx31("span", { className: "kjun-deviation-signal-slot", "aria-hidden": "true" }) : /* @__PURE__ */ jsx31(
|
|
5304
5686
|
KjunTooltip,
|
|
5305
5687
|
{
|
|
5306
|
-
content:
|
|
5307
|
-
children: /* @__PURE__ */
|
|
5688
|
+
content: m.deviationWarning(signalThreshold),
|
|
5689
|
+
children: /* @__PURE__ */ jsx31("span", { tabIndex: 0, role: "img", "aria-label": m.arbitrage, className: "kjun-deviation-signal", children: /* @__PURE__ */ jsx31(
|
|
5308
5690
|
KjunIcon,
|
|
5309
5691
|
{
|
|
5310
5692
|
name: "alert-triangle",
|
|
@@ -5323,7 +5705,7 @@ function KjunDeviation({
|
|
|
5323
5705
|
"data-variant": variant,
|
|
5324
5706
|
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? tokens28.typography.numberLg.fontWeight : tokens28.typography.control.fontWeight },
|
|
5325
5707
|
children: [
|
|
5326
|
-
variant === "pill" && /* @__PURE__ */
|
|
5708
|
+
variant === "pill" && /* @__PURE__ */ jsx31(
|
|
5327
5709
|
"span",
|
|
5328
5710
|
{
|
|
5329
5711
|
"aria-hidden": "true",
|
|
@@ -5334,7 +5716,7 @@ function KjunDeviation({
|
|
|
5334
5716
|
}
|
|
5335
5717
|
}
|
|
5336
5718
|
),
|
|
5337
|
-
/* @__PURE__ */
|
|
5719
|
+
/* @__PURE__ */ jsx31("span", { children: label })
|
|
5338
5720
|
]
|
|
5339
5721
|
}
|
|
5340
5722
|
);
|
|
@@ -5351,7 +5733,7 @@ function KjunHeatmapCell({
|
|
|
5351
5733
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5352
5734
|
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = tokens28.states.opacity;
|
|
5353
5735
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5354
|
-
/* @__PURE__ */
|
|
5736
|
+
/* @__PURE__ */ jsx31(
|
|
5355
5737
|
"span",
|
|
5356
5738
|
{
|
|
5357
5739
|
"aria-hidden": "true",
|
|
@@ -5359,7 +5741,7 @@ function KjunHeatmapCell({
|
|
|
5359
5741
|
style: magnitude ? { background: `var(--_kjun-color-${role2})`, opacity: heatMinimum + (heatMaximum - heatMinimum) * magnitude } : { background: "var(--_kjun-color-secondary)" }
|
|
5360
5742
|
}
|
|
5361
5743
|
),
|
|
5362
|
-
/* @__PURE__ */
|
|
5744
|
+
/* @__PURE__ */ jsx31("span", { children: children != null ? children : value })
|
|
5363
5745
|
] });
|
|
5364
5746
|
}
|
|
5365
5747
|
function KjunProgressCell({
|
|
@@ -5372,7 +5754,7 @@ function KjunProgressCell({
|
|
|
5372
5754
|
}) {
|
|
5373
5755
|
const percent = max > 0 && Number.isFinite(value) ? Math.min(100, Math.max(0, value / max * 100)) : 0, role2 = color === "auto" ? percent < 30 ? "danger" : percent < 70 ? "warning" : "success" : color;
|
|
5374
5756
|
return /* @__PURE__ */ jsxs23("div", { className: "kjun-progress-cell", children: [
|
|
5375
|
-
/* @__PURE__ */
|
|
5757
|
+
/* @__PURE__ */ jsx31("div", { style: { height }, children: /* @__PURE__ */ jsx31(
|
|
5376
5758
|
"span",
|
|
5377
5759
|
{
|
|
5378
5760
|
style: {
|
|
@@ -5393,7 +5775,7 @@ function KjunCollectionMark({
|
|
|
5393
5775
|
size = "md"
|
|
5394
5776
|
}) {
|
|
5395
5777
|
const box = tokens28.extensions.financial.markSizes[size], glyph = kind === "interest" ? tokens28.extensions.financial.heartMarkSizes[size] : box;
|
|
5396
|
-
return /* @__PURE__ */
|
|
5778
|
+
return /* @__PURE__ */ jsx31(
|
|
5397
5779
|
KjunIcon,
|
|
5398
5780
|
{
|
|
5399
5781
|
ref: domainColorRef(active),
|
|
@@ -5408,22 +5790,23 @@ function KjunCollectionMark({
|
|
|
5408
5790
|
);
|
|
5409
5791
|
}
|
|
5410
5792
|
var executionStates = {
|
|
5411
|
-
queued: ["secondary", "
|
|
5412
|
-
starting: ["primary", "
|
|
5413
|
-
running: ["primary", "
|
|
5414
|
-
stopping: ["warning", "
|
|
5415
|
-
stopped: ["secondary", "
|
|
5416
|
-
completed: ["success", "
|
|
5417
|
-
completed_with_errors: ["warning", "
|
|
5418
|
-
failed: ["danger", "
|
|
5793
|
+
queued: ["secondary", "statusQueued"],
|
|
5794
|
+
starting: ["primary", "statusStarting"],
|
|
5795
|
+
running: ["primary", "statusRunning"],
|
|
5796
|
+
stopping: ["warning", "statusStopping"],
|
|
5797
|
+
stopped: ["secondary", "statusStopped"],
|
|
5798
|
+
completed: ["success", "statusCompleted"],
|
|
5799
|
+
completed_with_errors: ["warning", "statusCompletedWithErrors"],
|
|
5800
|
+
failed: ["danger", "statusFailed"]
|
|
5419
5801
|
};
|
|
5420
5802
|
function KjunExecutionStatusBadge({
|
|
5421
5803
|
status,
|
|
5422
5804
|
label,
|
|
5423
5805
|
size = "md"
|
|
5424
5806
|
}) {
|
|
5807
|
+
const m = useKjunMessages();
|
|
5425
5808
|
const state = status ? executionStates[status] : void 0;
|
|
5426
|
-
return /* @__PURE__ */
|
|
5809
|
+
return /* @__PURE__ */ jsx31(KjunBadge, { variant: (state == null ? void 0 : state[0]) || "secondary", size, dot: status === "running", children: label || (state ? m[state[1]] : void 0) || (status ? m.statusUnknown : m.statusNoRuns) });
|
|
5427
5810
|
}
|
|
5428
5811
|
function KjunSparkline({
|
|
5429
5812
|
data = [],
|
|
@@ -5452,12 +5835,12 @@ function KjunSparkline({
|
|
|
5452
5835
|
"aria-hidden": !ariaLabel || void 0,
|
|
5453
5836
|
className: "kjun-sparkline",
|
|
5454
5837
|
children: [
|
|
5455
|
-
fill && values.length > 1 && /* @__PURE__ */ jsxs23(
|
|
5456
|
-
/* @__PURE__ */
|
|
5457
|
-
/* @__PURE__ */
|
|
5458
|
-
/* @__PURE__ */
|
|
5838
|
+
fill && values.length > 1 && /* @__PURE__ */ jsxs23(Fragment12, { children: [
|
|
5839
|
+
/* @__PURE__ */ jsx31("defs", { children: /* @__PURE__ */ jsxs23("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
5840
|
+
/* @__PURE__ */ jsx31("stop", { offset: "0%", stopColor: line, stopOpacity: 0.3 }),
|
|
5841
|
+
/* @__PURE__ */ jsx31("stop", { offset: "100%", stopColor: line, stopOpacity: 0.05 })
|
|
5459
5842
|
] }) }),
|
|
5460
|
-
/* @__PURE__ */
|
|
5843
|
+
/* @__PURE__ */ jsx31(
|
|
5461
5844
|
"polygon",
|
|
5462
5845
|
{
|
|
5463
5846
|
points: `2,${height - 2} ${points} ${width - 2},${height - 2}`,
|
|
@@ -5465,7 +5848,7 @@ function KjunSparkline({
|
|
|
5465
5848
|
}
|
|
5466
5849
|
)
|
|
5467
5850
|
] }),
|
|
5468
|
-
values.length > 1 ? /* @__PURE__ */
|
|
5851
|
+
values.length > 1 ? /* @__PURE__ */ jsx31(
|
|
5469
5852
|
"polyline",
|
|
5470
5853
|
{
|
|
5471
5854
|
points,
|
|
@@ -5476,7 +5859,7 @@ function KjunSparkline({
|
|
|
5476
5859
|
strokeLinejoin: "round",
|
|
5477
5860
|
vectorEffect: stretch ? "non-scaling-stroke" : void 0
|
|
5478
5861
|
}
|
|
5479
|
-
) : values.length === 1 ? /* @__PURE__ */
|
|
5862
|
+
) : values.length === 1 ? /* @__PURE__ */ jsx31("circle", { cx: width / 2, cy: height / 2, r: 2, fill: line }) : null
|
|
5480
5863
|
]
|
|
5481
5864
|
}
|
|
5482
5865
|
);
|
|
@@ -5622,7 +6005,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
5622
6005
|
|
|
5623
6006
|
// packages/react/src/table-toolbar.tsx
|
|
5624
6007
|
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5625
|
-
import { Fragment as
|
|
6008
|
+
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5626
6009
|
function TableToolbar({
|
|
5627
6010
|
selectable,
|
|
5628
6011
|
selected,
|
|
@@ -5635,26 +6018,24 @@ function TableToolbar({
|
|
|
5635
6018
|
searchPlaceholder,
|
|
5636
6019
|
toolbar
|
|
5637
6020
|
}) {
|
|
5638
|
-
|
|
6021
|
+
const m = useKjunMessages();
|
|
6022
|
+
return /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
5639
6023
|
selectable && selected.length > 0 && /* @__PURE__ */ jsxs24(
|
|
5640
6024
|
"div",
|
|
5641
6025
|
{
|
|
5642
6026
|
role: "group",
|
|
5643
|
-
"aria-label":
|
|
6027
|
+
"aria-label": m.selectionActions,
|
|
5644
6028
|
className: "kjun-table-selection",
|
|
5645
6029
|
children: [
|
|
5646
|
-
/* @__PURE__ */
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
] }),
|
|
5650
|
-
/* @__PURE__ */ jsx31(KjunButton, { size: "xs", variant: "ghost", onClick: toggleAll, children: "\uC804\uCCB4 \uC120\uD0DD" }),
|
|
5651
|
-
/* @__PURE__ */ jsx31(
|
|
6030
|
+
/* @__PURE__ */ jsx32("strong", { children: m.selectedItems(selected.length) }),
|
|
6031
|
+
/* @__PURE__ */ jsx32(KjunButton, { size: "xs", variant: "ghost", onClick: toggleAll, children: m.selectAll }),
|
|
6032
|
+
/* @__PURE__ */ jsx32(
|
|
5652
6033
|
KjunButton,
|
|
5653
6034
|
{
|
|
5654
6035
|
size: "xs",
|
|
5655
6036
|
variant: "ghost",
|
|
5656
6037
|
onClick: clearSelection,
|
|
5657
|
-
children:
|
|
6038
|
+
children: m.deselectAll
|
|
5658
6039
|
}
|
|
5659
6040
|
),
|
|
5660
6041
|
renderSelectionToolbar == null ? void 0 : renderSelectionToolbar(selected)
|
|
@@ -5662,13 +6043,13 @@ function TableToolbar({
|
|
|
5662
6043
|
}
|
|
5663
6044
|
),
|
|
5664
6045
|
(searchable || toolbar) && /* @__PURE__ */ jsxs24("div", { className: "kjun-table-toolbar", children: [
|
|
5665
|
-
searchable && /* @__PURE__ */
|
|
6046
|
+
searchable && /* @__PURE__ */ jsx32(
|
|
5666
6047
|
KjunInput,
|
|
5667
6048
|
{
|
|
5668
6049
|
size: "sm",
|
|
5669
6050
|
style: { width: tokens29.table.searchWidth, maxWidth: "100%" },
|
|
5670
6051
|
value: search,
|
|
5671
|
-
ariaLabel:
|
|
6052
|
+
ariaLabel: m.searchTable,
|
|
5672
6053
|
placeholder: searchPlaceholder,
|
|
5673
6054
|
prefixIcon: "search",
|
|
5674
6055
|
clearable: true,
|
|
@@ -5683,7 +6064,7 @@ function TableToolbar({
|
|
|
5683
6064
|
|
|
5684
6065
|
// packages/react/src/table-grid.tsx
|
|
5685
6066
|
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
5686
|
-
import { Fragment as
|
|
6067
|
+
import { Fragment as Fragment14 } from "react";
|
|
5687
6068
|
|
|
5688
6069
|
// packages/react/src/table-check.tsx
|
|
5689
6070
|
import { forwardRef as forwardRef4 } from "react";
|
|
@@ -5694,22 +6075,23 @@ var componentIcons = { minus };
|
|
|
5694
6075
|
|
|
5695
6076
|
// packages/react/src/table-check.tsx
|
|
5696
6077
|
import { tokens as tokens30 } from "@kjun-ui/tokens";
|
|
5697
|
-
import { jsx as
|
|
6078
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5698
6079
|
var TableCheck = forwardRef4(
|
|
5699
6080
|
function TableCheck2(props, ref) {
|
|
5700
6081
|
const size = tokens30.extensions.checkbox.iconSizes.sm;
|
|
5701
|
-
return /* @__PURE__ */
|
|
5702
|
-
/* @__PURE__ */
|
|
5703
|
-
/* @__PURE__ */
|
|
5704
|
-
/* @__PURE__ */
|
|
6082
|
+
return /* @__PURE__ */ jsx33(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs25("span", { className: "kjun-table-check", children: [
|
|
6083
|
+
/* @__PURE__ */ jsx33("input", { ...props, ref, type: "checkbox" }),
|
|
6084
|
+
/* @__PURE__ */ jsx33(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
6085
|
+
/* @__PURE__ */ jsx33(KjunIcon, { name: "minus", size, className: "kjun-table-check-dash" })
|
|
5705
6086
|
] }) });
|
|
5706
6087
|
}
|
|
5707
6088
|
);
|
|
5708
6089
|
|
|
5709
6090
|
// packages/react/src/table-grid.tsx
|
|
5710
|
-
import { jsx as
|
|
6091
|
+
import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5711
6092
|
function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }) {
|
|
5712
|
-
|
|
6093
|
+
const m = useKjunMessages();
|
|
6094
|
+
return /* @__PURE__ */ jsx34("div", { className: "kjun-table-scroll", style: { maxHeight, visibility: skeletonHidden ? "hidden" : void 0 }, "aria-hidden": skeletonHidden || void 0, children: /* @__PURE__ */ jsxs26(
|
|
5713
6095
|
"table",
|
|
5714
6096
|
{
|
|
5715
6097
|
className: "kjun-table",
|
|
@@ -5718,15 +6100,15 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5718
6100
|
"data-hoverable": hoverable,
|
|
5719
6101
|
"data-striped": striped,
|
|
5720
6102
|
children: [
|
|
5721
|
-
/* @__PURE__ */
|
|
6103
|
+
/* @__PURE__ */ jsx34(
|
|
5722
6104
|
"thead",
|
|
5723
6105
|
{
|
|
5724
6106
|
style: stickyHeader ? { position: "sticky", top: 0, zIndex: 2 } : void 0,
|
|
5725
6107
|
children: /* @__PURE__ */ jsxs26("tr", { children: [
|
|
5726
|
-
selectable && /* @__PURE__ */
|
|
6108
|
+
selectable && /* @__PURE__ */ jsx34("th", { scope: "col", className: "kjun-table-action-cell", children: /* @__PURE__ */ jsx34(
|
|
5727
6109
|
TableCheck,
|
|
5728
6110
|
{
|
|
5729
|
-
"aria-label":
|
|
6111
|
+
"aria-label": m.selectAll,
|
|
5730
6112
|
checked: state.all,
|
|
5731
6113
|
ref: (node) => {
|
|
5732
6114
|
if (node) node.indeterminate = state.some;
|
|
@@ -5734,8 +6116,8 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5734
6116
|
onChange: state.toggleAll
|
|
5735
6117
|
}
|
|
5736
6118
|
) }),
|
|
5737
|
-
expandable && /* @__PURE__ */
|
|
5738
|
-
visible.map((col) => /* @__PURE__ */
|
|
6119
|
+
expandable && /* @__PURE__ */ jsx34("th", { scope: "col", className: "kjun-table-action-cell" }),
|
|
6120
|
+
visible.map((col) => /* @__PURE__ */ jsx34(
|
|
5739
6121
|
"th",
|
|
5740
6122
|
{
|
|
5741
6123
|
scope: "col",
|
|
@@ -5749,7 +6131,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5749
6131
|
onClick: () => state.sortColumn(col),
|
|
5750
6132
|
children: [
|
|
5751
6133
|
col.label,
|
|
5752
|
-
state.sort.key === col.key && /* @__PURE__ */
|
|
6134
|
+
state.sort.key === col.key && /* @__PURE__ */ jsx34(
|
|
5753
6135
|
KjunIcon,
|
|
5754
6136
|
{
|
|
5755
6137
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
@@ -5765,10 +6147,10 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5765
6147
|
] })
|
|
5766
6148
|
}
|
|
5767
6149
|
),
|
|
5768
|
-
/* @__PURE__ */
|
|
5769
|
-
selectable && /* @__PURE__ */
|
|
5770
|
-
expandable && /* @__PURE__ */
|
|
5771
|
-
visible.map((col) => /* @__PURE__ */
|
|
6150
|
+
/* @__PURE__ */ jsx34("tbody", { children: initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsxs26("tr", { "aria-hidden": "true", children: [
|
|
6151
|
+
selectable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ jsx34(KjunSkeleton, { type: "block", height: tokens31.table.selectionSize, width: tokens31.table.selectionSize }) }),
|
|
6152
|
+
expandable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell" }),
|
|
6153
|
+
visible.map((col) => /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(
|
|
5772
6154
|
KjunSkeleton,
|
|
5773
6155
|
{
|
|
5774
6156
|
type: "block",
|
|
@@ -5776,14 +6158,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5776
6158
|
width: col.key === "actions" ? tokens31.table.actionColumnWidth : "75%"
|
|
5777
6159
|
}
|
|
5778
6160
|
) }, col.key))
|
|
5779
|
-
] }, i)) : !state.rows.length ? /* @__PURE__ */
|
|
6161
|
+
] }, i)) : !state.rows.length ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34(
|
|
5780
6162
|
"td",
|
|
5781
6163
|
{
|
|
5782
6164
|
colSpan: visible.length + Number(selectable) + Number(expandable),
|
|
5783
6165
|
className: "kjun-table-empty",
|
|
5784
6166
|
children: emptyContent || emptyText
|
|
5785
6167
|
}
|
|
5786
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ jsxs26(
|
|
6168
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
5787
6169
|
/* @__PURE__ */ jsxs26(
|
|
5788
6170
|
"tr",
|
|
5789
6171
|
{
|
|
@@ -5793,9 +6175,9 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5793
6175
|
"data-selected": state.selectedRow(row) || void 0,
|
|
5794
6176
|
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5795
6177
|
children: [
|
|
5796
|
-
selectable && /* @__PURE__ */
|
|
5797
|
-
expandable && /* @__PURE__ */
|
|
5798
|
-
visible.map((col) => /* @__PURE__ */
|
|
6178
|
+
selectable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: checkbox(row, i) }),
|
|
6179
|
+
expandable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: expand(row, i) }),
|
|
6180
|
+
visible.map((col) => /* @__PURE__ */ jsx34(
|
|
5799
6181
|
"td",
|
|
5800
6182
|
{
|
|
5801
6183
|
style: { textAlign: col.align },
|
|
@@ -5808,7 +6190,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5808
6190
|
]
|
|
5809
6191
|
}
|
|
5810
6192
|
),
|
|
5811
|
-
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */
|
|
6193
|
+
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ jsx34("tr", { className: "kjun-table-expanded", children: /* @__PURE__ */ jsx34(
|
|
5812
6194
|
"td",
|
|
5813
6195
|
{
|
|
5814
6196
|
colSpan: visible.length + Number(selectable) + 1,
|
|
@@ -5822,7 +6204,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5822
6204
|
}
|
|
5823
6205
|
|
|
5824
6206
|
// packages/react/src/table-cards.tsx
|
|
5825
|
-
import { jsx as
|
|
6207
|
+
import { jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5826
6208
|
function TableCards({
|
|
5827
6209
|
initialLoading,
|
|
5828
6210
|
skeletonRows,
|
|
@@ -5852,7 +6234,7 @@ function TableCards({
|
|
|
5852
6234
|
style: skeletonHidden ? { visibility: "hidden" } : void 0,
|
|
5853
6235
|
"aria-hidden": skeletonHidden || void 0,
|
|
5854
6236
|
children: [
|
|
5855
|
-
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */
|
|
6237
|
+
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsx35("div", { className: "kjun-table-card", children: /* @__PURE__ */ jsx35(KjunSkeleton, { type: "card" }) }, i)) : state.rows.map((row, i) => /* @__PURE__ */ jsxs27(
|
|
5856
6238
|
"div",
|
|
5857
6239
|
{
|
|
5858
6240
|
role: "listitem",
|
|
@@ -5864,15 +6246,15 @@ function TableCards({
|
|
|
5864
6246
|
/* @__PURE__ */ jsxs27("div", { className: "kjun-table-card-header", children: [
|
|
5865
6247
|
/* @__PURE__ */ jsxs27("div", { className: "kjun-table-card-header-left", children: [
|
|
5866
6248
|
selectable && checkbox(row, i),
|
|
5867
|
-
/* @__PURE__ */
|
|
6249
|
+
/* @__PURE__ */ jsx35("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
|
|
5868
6250
|
] }),
|
|
5869
|
-
badges.length ? /* @__PURE__ */
|
|
5870
|
-
inline.length > 0 && /* @__PURE__ */
|
|
6251
|
+
badges.length ? /* @__PURE__ */ jsx35("div", { className: "kjun-table-card-badges", children: badges.map((col) => /* @__PURE__ */ jsx35("span", { children: cell(col, row, i) }, col.key)) }) : subtitle ? /* @__PURE__ */ jsx35("span", { className: "kjun-table-card-subtitle", children: cell(subtitle, row, i) }) : null,
|
|
6252
|
+
inline.length > 0 && /* @__PURE__ */ jsx35(
|
|
5871
6253
|
"div",
|
|
5872
6254
|
{
|
|
5873
6255
|
className: "kjun-table-card-header-actions",
|
|
5874
6256
|
onClick: (e) => e.stopPropagation(),
|
|
5875
|
-
children: inline.map((col) => /* @__PURE__ */
|
|
6257
|
+
children: inline.map((col) => /* @__PURE__ */ jsx35("span", { children: cell(col, row, i) }, col.key))
|
|
5876
6258
|
}
|
|
5877
6259
|
)
|
|
5878
6260
|
] }),
|
|
@@ -5883,8 +6265,8 @@ function TableCards({
|
|
|
5883
6265
|
{
|
|
5884
6266
|
className: "kjun-table-card-section",
|
|
5885
6267
|
children: [
|
|
5886
|
-
section.label && /* @__PURE__ */
|
|
5887
|
-
/* @__PURE__ */
|
|
6268
|
+
section.label && /* @__PURE__ */ jsx35("div", { className: "kjun-table-card-section-label", children: section.label }),
|
|
6269
|
+
/* @__PURE__ */ jsx35(
|
|
5888
6270
|
"div",
|
|
5889
6271
|
{
|
|
5890
6272
|
className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
|
|
@@ -5893,8 +6275,8 @@ function TableCards({
|
|
|
5893
6275
|
{
|
|
5894
6276
|
className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
|
|
5895
6277
|
children: [
|
|
5896
|
-
/* @__PURE__ */
|
|
5897
|
-
/* @__PURE__ */
|
|
6278
|
+
/* @__PURE__ */ jsx35("span", { className: "kjun-table-card-label", children: col.label }),
|
|
6279
|
+
/* @__PURE__ */ jsx35("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
|
|
5898
6280
|
]
|
|
5899
6281
|
},
|
|
5900
6282
|
col.key
|
|
@@ -5906,9 +6288,9 @@ function TableCards({
|
|
|
5906
6288
|
section.key || index
|
|
5907
6289
|
) : null;
|
|
5908
6290
|
}),
|
|
5909
|
-
expandable && /* @__PURE__ */
|
|
5910
|
-
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */
|
|
5911
|
-
actions && !actions.inlineInCard && /* @__PURE__ */
|
|
6291
|
+
expandable && /* @__PURE__ */ jsx35("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
|
|
6292
|
+
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ jsx35("div", { className: "kjun-table-card-expand-content", children: renderExpand == null ? void 0 : renderExpand(row, i) }),
|
|
6293
|
+
actions && !actions.inlineInCard && /* @__PURE__ */ jsx35(
|
|
5912
6294
|
"div",
|
|
5913
6295
|
{
|
|
5914
6296
|
className: "kjun-table-card-actions",
|
|
@@ -5920,7 +6302,7 @@ function TableCards({
|
|
|
5920
6302
|
},
|
|
5921
6303
|
state.key(row, i)
|
|
5922
6304
|
)),
|
|
5923
|
-
!initialLoading && !state.rows.length && /* @__PURE__ */
|
|
6305
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ jsx35("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
|
|
5924
6306
|
]
|
|
5925
6307
|
}
|
|
5926
6308
|
);
|
|
@@ -5929,23 +6311,24 @@ function TableCards({
|
|
|
5929
6311
|
// packages/react/src/table-view.tsx
|
|
5930
6312
|
import { useEffect as useEffect18, useState as useState26 } from "react";
|
|
5931
6313
|
import { isComposingKey as isComposingKey4, tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5932
|
-
import { jsx as
|
|
6314
|
+
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5933
6315
|
function KjunTable(props) {
|
|
6316
|
+
const m = useKjunMessages();
|
|
5934
6317
|
const {
|
|
5935
6318
|
skeletonRows = 8,
|
|
5936
6319
|
skeleton = true,
|
|
5937
|
-
loadingText =
|
|
6320
|
+
loadingText = m.loadingEllipsis,
|
|
5938
6321
|
loadingDelay = 0,
|
|
5939
|
-
emptyText =
|
|
6322
|
+
emptyText = m.noData,
|
|
5940
6323
|
hoverable = true,
|
|
5941
6324
|
searchable = false,
|
|
5942
|
-
searchPlaceholder =
|
|
6325
|
+
searchPlaceholder = m.search,
|
|
5943
6326
|
stickyHeader = false,
|
|
5944
6327
|
maxHeight,
|
|
5945
6328
|
pagination,
|
|
5946
6329
|
compact = false,
|
|
5947
6330
|
striped = false,
|
|
5948
|
-
ariaLabel =
|
|
6331
|
+
ariaLabel = m.dataTable,
|
|
5949
6332
|
expandable = false,
|
|
5950
6333
|
rowClass,
|
|
5951
6334
|
selectable = false,
|
|
@@ -5969,7 +6352,7 @@ function KjunTable(props) {
|
|
|
5969
6352
|
const { card, visible } = layout;
|
|
5970
6353
|
const cell = (col, row, index) => {
|
|
5971
6354
|
const { value, body } = tableCellValue(props, col, row, index);
|
|
5972
|
-
return col.pill ? /* @__PURE__ */
|
|
6355
|
+
return col.pill ? /* @__PURE__ */ jsx36(
|
|
5973
6356
|
"span",
|
|
5974
6357
|
{
|
|
5975
6358
|
className: "kjun-table-pill " + (Number(value) > 0 ? "kjun-table-pill-up" : Number(value) < 0 ? "kjun-table-pill-down" : ""),
|
|
@@ -5985,25 +6368,25 @@ function KjunTable(props) {
|
|
|
5985
6368
|
onRowClick(row, index);
|
|
5986
6369
|
}
|
|
5987
6370
|
};
|
|
5988
|
-
const checkbox = (row, i) => /* @__PURE__ */
|
|
6371
|
+
const checkbox = (row, i) => /* @__PURE__ */ jsx36(
|
|
5989
6372
|
TableCheck,
|
|
5990
6373
|
{
|
|
5991
|
-
"aria-label":
|
|
6374
|
+
"aria-label": m.selectRow(i + 1),
|
|
5992
6375
|
checked: state.selectedRow(row),
|
|
5993
6376
|
onClick: (e) => e.stopPropagation(),
|
|
5994
6377
|
onChange: () => state.toggleRow(row)
|
|
5995
6378
|
}
|
|
5996
6379
|
);
|
|
5997
|
-
const expand = (row, i) => /* @__PURE__ */
|
|
6380
|
+
const expand = (row, i) => /* @__PURE__ */ jsx36(
|
|
5998
6381
|
KjunButton,
|
|
5999
6382
|
{
|
|
6000
6383
|
variant: "ghost",
|
|
6001
6384
|
size: "xs",
|
|
6002
6385
|
prefixIcon: state.expanded.includes(state.key(row, i)) ? "chevron-down" : "chevron-right",
|
|
6003
|
-
ariaLabel:
|
|
6386
|
+
ariaLabel: m.expandRow,
|
|
6004
6387
|
"aria-expanded": state.expanded.includes(state.key(row, i)),
|
|
6005
6388
|
onClick: () => state.toggleExpand(row, i),
|
|
6006
|
-
children: card ? state.expanded.includes(state.key(row, i)) ?
|
|
6389
|
+
children: card ? state.expanded.includes(state.key(row, i)) ? m.collapse : m.showDetails : void 0
|
|
6007
6390
|
}
|
|
6008
6391
|
);
|
|
6009
6392
|
return /* @__PURE__ */ jsxs28(
|
|
@@ -6013,7 +6396,7 @@ function KjunTable(props) {
|
|
|
6013
6396
|
"aria-busy": !!props.loading,
|
|
6014
6397
|
ref: domainColorRef(!query2.initialLoading && state.rows.length > 0 && props.columns.some((column) => column.pill)),
|
|
6015
6398
|
children: [
|
|
6016
|
-
/* @__PURE__ */
|
|
6399
|
+
/* @__PURE__ */ jsx36(
|
|
6017
6400
|
TableToolbar,
|
|
6018
6401
|
{
|
|
6019
6402
|
...{ selectable, selected, renderSelectionToolbar, searchable, searchPlaceholder, toolbar },
|
|
@@ -6040,8 +6423,8 @@ function KjunTable(props) {
|
|
|
6040
6423
|
loadingText,
|
|
6041
6424
|
loadingDelay: skeleton ? 0 : loadingDelay,
|
|
6042
6425
|
children: [
|
|
6043
|
-
card ? /* @__PURE__ */
|
|
6044
|
-
pagination && /* @__PURE__ */
|
|
6426
|
+
card ? /* @__PURE__ */ jsx36(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown } }) : /* @__PURE__ */ jsx36(TableGrid, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }, sortable: props.sortable }),
|
|
6427
|
+
pagination && /* @__PURE__ */ jsx36(
|
|
6045
6428
|
KjunPagination,
|
|
6046
6429
|
{
|
|
6047
6430
|
currentPage: pagination.page,
|
|
@@ -6064,7 +6447,7 @@ function KjunTable(props) {
|
|
|
6064
6447
|
|
|
6065
6448
|
// packages/react/src/kpi.tsx
|
|
6066
6449
|
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6067
|
-
import { Fragment as
|
|
6450
|
+
import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6068
6451
|
var kpiFormat = (item, value = item.value) => {
|
|
6069
6452
|
var _a, _b;
|
|
6070
6453
|
return typeof value === "string" ? value : item.formatter ? item.formatter(value) : (item.showSign && value > 0 ? "+" : item.semantic === "price" && value < 0 ? "\u2212" : "") + new Intl.NumberFormat(void 0, {
|
|
@@ -6096,14 +6479,14 @@ function KjunKpiHero(props) {
|
|
|
6096
6479
|
const showDelta = deltaAbsolute !== null || deltaPercent !== null || !!deltaDescription || loading && ["deltaAbsolute", "deltaPercent", "deltaDescription"].some(
|
|
6097
6480
|
(key) => Object.prototype.hasOwnProperty.call(props, key)
|
|
6098
6481
|
);
|
|
6099
|
-
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs29(
|
|
6482
|
+
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs29(Fragment15, { children: [
|
|
6100
6483
|
v > 0 ? "+" : v < 0 ? "\u2212" : "",
|
|
6101
|
-
kind === "absolute" && prefix && /* @__PURE__ */
|
|
6484
|
+
kind === "absolute" && prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
6102
6485
|
new Intl.NumberFormat(void 0, {
|
|
6103
6486
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
6104
6487
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
6105
6488
|
}).format(Math.abs(v)),
|
|
6106
|
-
kind === "percent" && /* @__PURE__ */
|
|
6489
|
+
kind === "percent" && /* @__PURE__ */ jsx37("span", { className: "kjun-number-affix", "data-side": "suffix", children: "%" })
|
|
6107
6490
|
] });
|
|
6108
6491
|
return /* @__PURE__ */ jsxs29(
|
|
6109
6492
|
"div",
|
|
@@ -6115,10 +6498,10 @@ function KjunKpiHero(props) {
|
|
|
6115
6498
|
children: [
|
|
6116
6499
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-hero__layout", children: [
|
|
6117
6500
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-hero__main", children: [
|
|
6118
|
-
/* @__PURE__ */
|
|
6119
|
-
/* @__PURE__ */
|
|
6120
|
-
prefix && /* @__PURE__ */
|
|
6121
|
-
/* @__PURE__ */
|
|
6501
|
+
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__label", children: label }),
|
|
6502
|
+
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__value", children: loading ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : /* @__PURE__ */ jsxs29(Fragment15, { children: [
|
|
6503
|
+
prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__affix", children: prefix }),
|
|
6504
|
+
/* @__PURE__ */ jsx37(
|
|
6122
6505
|
KjunAnimatedNumber,
|
|
6123
6506
|
{
|
|
6124
6507
|
value,
|
|
@@ -6127,13 +6510,13 @@ function KjunKpiHero(props) {
|
|
|
6127
6510
|
formatter
|
|
6128
6511
|
}
|
|
6129
6512
|
),
|
|
6130
|
-
suffix && /* @__PURE__ */
|
|
6513
|
+
suffix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__affix", children: suffix })
|
|
6131
6514
|
] }) }),
|
|
6132
|
-
showDelta && /* @__PURE__ */
|
|
6515
|
+
showDelta && /* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6133
6516
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
) : /* @__PURE__ */ jsxs29(
|
|
6136
|
-
deltaAbsolute !== null && /* @__PURE__ */
|
|
6517
|
+
/* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: tokens33.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6518
|
+
) : /* @__PURE__ */ jsxs29(Fragment15, { children: [
|
|
6519
|
+
deltaAbsolute !== null && /* @__PURE__ */ jsx37(
|
|
6137
6520
|
"span",
|
|
6138
6521
|
{
|
|
6139
6522
|
className: "kjun-kpi-hero__delta-abs",
|
|
@@ -6147,7 +6530,7 @@ function KjunKpiHero(props) {
|
|
|
6147
6530
|
children: delta(deltaAbsolute, "absolute")
|
|
6148
6531
|
}
|
|
6149
6532
|
),
|
|
6150
|
-
deltaPercent !== null && /* @__PURE__ */
|
|
6533
|
+
deltaPercent !== null && /* @__PURE__ */ jsx37(
|
|
6151
6534
|
"span",
|
|
6152
6535
|
{
|
|
6153
6536
|
className: "kjun-kpi-hero__delta-pct",
|
|
@@ -6157,31 +6540,31 @@ function KjunKpiHero(props) {
|
|
|
6157
6540
|
children: delta(deltaPercent, "percent")
|
|
6158
6541
|
}
|
|
6159
6542
|
),
|
|
6160
|
-
deltaDescription && /* @__PURE__ */
|
|
6543
|
+
deltaDescription && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-desc", children: deltaDescription })
|
|
6161
6544
|
] }) })
|
|
6162
6545
|
] }),
|
|
6163
|
-
aside && /* @__PURE__ */
|
|
6546
|
+
aside && /* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__aside", children: aside })
|
|
6164
6547
|
] }),
|
|
6165
|
-
secondary.length > 0 && /* @__PURE__ */
|
|
6166
|
-
/* @__PURE__ */
|
|
6167
|
-
/* @__PURE__ */
|
|
6548
|
+
secondary.length > 0 && /* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__secondary", children: secondary.map((item, i) => /* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-hero__sec-item", children: [
|
|
6549
|
+
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__sec-label", children: item.label }),
|
|
6550
|
+
/* @__PURE__ */ jsx37(
|
|
6168
6551
|
"div",
|
|
6169
6552
|
{
|
|
6170
6553
|
className: "kjun-kpi-hero__sec-value",
|
|
6171
6554
|
style: { color: kpiColor(item.value, item.semantic) },
|
|
6172
|
-
children: loading ? /* @__PURE__ */
|
|
6173
|
-
item.prefix && /* @__PURE__ */
|
|
6174
|
-
/* @__PURE__ */
|
|
6175
|
-
item.suffix && /* @__PURE__ */
|
|
6555
|
+
children: loading ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderSecondary == null ? void 0 : renderSecondary(item, i)) || /* @__PURE__ */ jsxs29(Fragment15, { children: [
|
|
6556
|
+
item.prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__sec-affix", children: item.prefix }),
|
|
6557
|
+
/* @__PURE__ */ jsx37("span", { children: kpiFormat(item) }),
|
|
6558
|
+
item.suffix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__sec-affix", children: item.suffix })
|
|
6176
6559
|
] })
|
|
6177
6560
|
}
|
|
6178
6561
|
),
|
|
6179
|
-
item.desc && /* @__PURE__ */
|
|
6562
|
+
item.desc && /* @__PURE__ */ jsx37(
|
|
6180
6563
|
"div",
|
|
6181
6564
|
{
|
|
6182
6565
|
className: "kjun-kpi-hero__sec-desc " + (item.descClass || ""),
|
|
6183
6566
|
style: { color: "var(--_kjun-color-text-tertiary)" },
|
|
6184
|
-
children: loading ? /* @__PURE__ */
|
|
6567
|
+
children: loading ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", width: "7ch", height: "1lh" }) : item.desc
|
|
6185
6568
|
}
|
|
6186
6569
|
)
|
|
6187
6570
|
] }, i)) })
|
|
@@ -6220,7 +6603,7 @@ function KjunKpiRow({
|
|
|
6220
6603
|
background: `var(--_kjun-color-${v === "neutral" ? "secondary" : v === "info" ? "info-bg" : v + "-bg"})`
|
|
6221
6604
|
},
|
|
6222
6605
|
children: [
|
|
6223
|
-
dot && /* @__PURE__ */
|
|
6606
|
+
dot && /* @__PURE__ */ jsx37(
|
|
6224
6607
|
"span",
|
|
6225
6608
|
{
|
|
6226
6609
|
className: "kjun-kpi-row__badge-dot",
|
|
@@ -6232,7 +6615,7 @@ function KjunKpiRow({
|
|
|
6232
6615
|
}
|
|
6233
6616
|
);
|
|
6234
6617
|
};
|
|
6235
|
-
return /* @__PURE__ */
|
|
6618
|
+
return /* @__PURE__ */ jsx37(
|
|
6236
6619
|
"div",
|
|
6237
6620
|
{
|
|
6238
6621
|
className: "kjun-kpi-row" + (size === "sm" ? " kjun-kpi-row--sm" : "") + (((_a = items[0]) == null ? void 0 : _a.mobileFull) ? " kjun-kpi-row--hero-first" : "") + (mobileSummary && size !== "sm" ? " kjun-kpi-row--mobile-summary" : ""),
|
|
@@ -6263,11 +6646,11 @@ function KjunKpiRow({
|
|
|
6263
6646
|
},
|
|
6264
6647
|
children: [
|
|
6265
6648
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6266
|
-
/* @__PURE__ */
|
|
6649
|
+
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", width: tokens33.extensions.kpiRow.labelSkeletonWidth, height: tokens33.extensions.kpiRow.labelSkeletonHeight }) : item.label }),
|
|
6267
6650
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6268
6651
|
] }),
|
|
6269
6652
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__value-row", children: [
|
|
6270
|
-
/* @__PURE__ */
|
|
6653
|
+
/* @__PURE__ */ jsx37(
|
|
6271
6654
|
"div",
|
|
6272
6655
|
{
|
|
6273
6656
|
className: "kjun-kpi-row__value " + (item.valueClass || "") + (item.valueKind === "text" ? " kjun-kpi-row__value--text" : "") + (item.mobileNeutral ? " kjun-kpi-row__value--mobile-neutral" : ""),
|
|
@@ -6280,14 +6663,14 @@ function KjunKpiRow({
|
|
|
6280
6663
|
{
|
|
6281
6664
|
className: (seg.class || "") + (seg.label ? " kjun-kpi-row__segment--labeled" : "") + (seg.separator ? " kjun-kpi-row__segment--separator" : ""),
|
|
6282
6665
|
children: [
|
|
6283
|
-
seg.label && /* @__PURE__ */
|
|
6284
|
-
busy && !seg.separator ? /* @__PURE__ */
|
|
6666
|
+
seg.label && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-row__segment-label", children: seg.label }),
|
|
6667
|
+
busy && !seg.separator ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "3ch" }) : seg.text
|
|
6285
6668
|
]
|
|
6286
6669
|
},
|
|
6287
6670
|
j
|
|
6288
|
-
)) : busy ? /* @__PURE__ */
|
|
6289
|
-
item.prefix && /* @__PURE__ */
|
|
6290
|
-
item.animated && typeof item.value === "number" ? /* @__PURE__ */
|
|
6671
|
+
)) : busy ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderValue == null ? void 0 : renderValue(item, i)) || /* @__PURE__ */ jsxs29(Fragment15, { children: [
|
|
6672
|
+
item.prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-row__affix", children: item.prefix }),
|
|
6673
|
+
item.animated && typeof item.value === "number" ? /* @__PURE__ */ jsx37(
|
|
6291
6674
|
KjunAnimatedNumber,
|
|
6292
6675
|
{
|
|
6293
6676
|
fromPrevious: true,
|
|
@@ -6295,20 +6678,20 @@ function KjunKpiRow({
|
|
|
6295
6678
|
formatter: (v) => kpiFormat(item, v)
|
|
6296
6679
|
}
|
|
6297
6680
|
) : kpiFormat(item),
|
|
6298
|
-
item.suffix && /* @__PURE__ */
|
|
6681
|
+
item.suffix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6299
6682
|
] })
|
|
6300
6683
|
}
|
|
6301
6684
|
),
|
|
6302
6685
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
6303
6686
|
] }),
|
|
6304
|
-
item.desc && /* @__PURE__ */
|
|
6687
|
+
item.desc && /* @__PURE__ */ jsx37(
|
|
6305
6688
|
"div",
|
|
6306
6689
|
{
|
|
6307
6690
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6308
6691
|
style: {
|
|
6309
6692
|
color: item.descClass ? void 0 : kpiColor(item.value, item.semantic, "text-secondary")
|
|
6310
6693
|
},
|
|
6311
|
-
children: busy ? /* @__PURE__ */
|
|
6694
|
+
children: busy ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6312
6695
|
}
|
|
6313
6696
|
)
|
|
6314
6697
|
]
|
|
@@ -6386,31 +6769,32 @@ function useMarketCards(props) {
|
|
|
6386
6769
|
}
|
|
6387
6770
|
|
|
6388
6771
|
// packages/react/src/market-parts.tsx
|
|
6389
|
-
import { Fragment as
|
|
6772
|
+
import { Fragment as Fragment16, jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6390
6773
|
function MarketIdentity({
|
|
6391
6774
|
row,
|
|
6392
6775
|
props
|
|
6393
6776
|
}) {
|
|
6394
6777
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
6395
6778
|
const label = (_c = (_a = props.primaryLabel) == null ? void 0 : _a.call(props, row)) != null ? _c : String((_b = getValue(row, "name")) != null ? _b : ""), meta = ((_d = props.subMeta) == null ? void 0 : _d.call(props, row)) || "", id = getValue(row, props.rowKey || "id");
|
|
6396
|
-
const body = /* @__PURE__ */ jsxs30(
|
|
6779
|
+
const body = /* @__PURE__ */ jsxs30(Fragment16, { children: [
|
|
6397
6780
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
6398
6781
|
/* @__PURE__ */ jsxs30("div", { className: "kjun-market-identity-text", children: [
|
|
6399
6782
|
/* @__PURE__ */ jsxs30("div", { className: "kjun-market-name", children: [
|
|
6400
|
-
/* @__PURE__ */
|
|
6401
|
-
((_f = props.interestKeys) == null ? void 0 : _f.has(id)) && /* @__PURE__ */
|
|
6402
|
-
((_g = props.favoriteKeys) == null ? void 0 : _g.has(id)) && /* @__PURE__ */
|
|
6783
|
+
/* @__PURE__ */ jsx38("span", { title: label, children: label }),
|
|
6784
|
+
((_f = props.interestKeys) == null ? void 0 : _f.has(id)) && /* @__PURE__ */ jsx38(KjunCollectionMark, { kind: "interest", size: "sm", active: true }),
|
|
6785
|
+
((_g = props.favoriteKeys) == null ? void 0 : _g.has(id)) && /* @__PURE__ */ jsx38(KjunCollectionMark, { kind: "favorite", size: "sm", active: true }),
|
|
6403
6786
|
(_h = props.renderNameSuffix) == null ? void 0 : _h.call(props, row)
|
|
6404
6787
|
] }),
|
|
6405
|
-
(meta || props.renderSubMeta) && /* @__PURE__ */
|
|
6788
|
+
(meta || props.renderSubMeta) && /* @__PURE__ */ jsx38("div", { className: "kjun-market-meta", children: ((_i = props.renderSubMeta) == null ? void 0 : _i.call(props, row)) || meta })
|
|
6406
6789
|
] })
|
|
6407
6790
|
] });
|
|
6408
|
-
return /* @__PURE__ */
|
|
6791
|
+
return /* @__PURE__ */ jsx38("div", { className: "kjun-market-identity", children: ((_j = props.renderIdentity) == null ? void 0 : _j.call(props, row, body)) || body });
|
|
6409
6792
|
}
|
|
6410
6793
|
function MarketFooter({
|
|
6411
6794
|
props
|
|
6412
6795
|
}) {
|
|
6413
6796
|
var _a;
|
|
6797
|
+
const m = useKjunMessages();
|
|
6414
6798
|
const state = useQueryDisplay(props), {
|
|
6415
6799
|
pagination,
|
|
6416
6800
|
rows = [],
|
|
@@ -6418,10 +6802,10 @@ function MarketFooter({
|
|
|
6418
6802
|
calculatedAt,
|
|
6419
6803
|
footerNote,
|
|
6420
6804
|
totalCount = 0,
|
|
6421
|
-
unitLabel =
|
|
6805
|
+
unitLabel = m.unitLabel
|
|
6422
6806
|
} = props;
|
|
6423
|
-
return /* @__PURE__ */ jsxs30(
|
|
6424
|
-
pagination && /* @__PURE__ */
|
|
6807
|
+
return /* @__PURE__ */ jsxs30(Fragment16, { children: [
|
|
6808
|
+
pagination && /* @__PURE__ */ jsx38(
|
|
6425
6809
|
KjunPagination,
|
|
6426
6810
|
{
|
|
6427
6811
|
currentPage: pagination.page,
|
|
@@ -6434,19 +6818,16 @@ function MarketFooter({
|
|
|
6434
6818
|
),
|
|
6435
6819
|
" ",
|
|
6436
6820
|
showFooter && !state.initialLoading && rows.length > 0 && /* @__PURE__ */ jsxs30("div", { className: "kjun-market-footer", children: [
|
|
6437
|
-
/* @__PURE__ */
|
|
6438
|
-
/* @__PURE__ */
|
|
6439
|
-
"\uCD1D ",
|
|
6440
|
-
totalCount,
|
|
6441
|
-
unitLabel
|
|
6442
|
-
] })
|
|
6821
|
+
/* @__PURE__ */ jsx38("span", { children: calculatedAt ? m.lastUpdated + (((_a = props.formatDate) == null ? void 0 : _a.call(props, calculatedAt)) || calculatedAt) : footerNote }),
|
|
6822
|
+
/* @__PURE__ */ jsx38("span", { children: m.totalCount(totalCount, unitLabel) })
|
|
6443
6823
|
] })
|
|
6444
6824
|
] });
|
|
6445
6825
|
}
|
|
6446
6826
|
|
|
6447
6827
|
// packages/react/src/market-cards.tsx
|
|
6448
|
-
import { Fragment as
|
|
6828
|
+
import { Fragment as Fragment17, jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6449
6829
|
function KjunMarketCards(props) {
|
|
6830
|
+
const m = useKjunMessages();
|
|
6450
6831
|
const {
|
|
6451
6832
|
rows = [],
|
|
6452
6833
|
rowKey = "id",
|
|
@@ -6457,7 +6838,7 @@ function KjunMarketCards(props) {
|
|
|
6457
6838
|
changeMetricKey = "change_rate",
|
|
6458
6839
|
priceMetricKeys = ["current_price", "close_price"],
|
|
6459
6840
|
metricLoading = () => false,
|
|
6460
|
-
emptyMessage =
|
|
6841
|
+
emptyMessage = m.noItems,
|
|
6461
6842
|
emptySubMessage = ""
|
|
6462
6843
|
} = props;
|
|
6463
6844
|
const state = useMarketCards(props), isPrice = priceMetricKeys.includes(state.key), isChange = state.key === changeMetricKey;
|
|
@@ -6471,7 +6852,7 @@ function KjunMarketCards(props) {
|
|
|
6471
6852
|
}) : value == null ? "-" : String(value);
|
|
6472
6853
|
};
|
|
6473
6854
|
return /* @__PURE__ */ jsxs31("div", { className: "kjun-market-cards", children: [
|
|
6474
|
-
/* @__PURE__ */
|
|
6855
|
+
/* @__PURE__ */ jsx39("div", { className: "kjun-metric-pills", role: "group", "aria-label": m.metrics, children: state.pills.map((pill) => /* @__PURE__ */ jsxs31(
|
|
6475
6856
|
"button",
|
|
6476
6857
|
{
|
|
6477
6858
|
type: "button",
|
|
@@ -6486,7 +6867,7 @@ function KjunMarketCards(props) {
|
|
|
6486
6867
|
},
|
|
6487
6868
|
children: [
|
|
6488
6869
|
pill.label,
|
|
6489
|
-
state.key === pill.key && pill.sortKey && (emitSortOnMount || pill.sortKey === sortKey) && /* @__PURE__ */
|
|
6870
|
+
state.key === pill.key && pill.sortKey && (emitSortOnMount || pill.sortKey === sortKey) && /* @__PURE__ */ jsx39("span", { children: sortOrder === "desc" ? "\u2193" : "\u2191" })
|
|
6490
6871
|
]
|
|
6491
6872
|
},
|
|
6492
6873
|
pill.key
|
|
@@ -6495,17 +6876,17 @@ function KjunMarketCards(props) {
|
|
|
6495
6876
|
selectedKey: state.key,
|
|
6496
6877
|
selectedPill: state.pill,
|
|
6497
6878
|
metricDisplay: display
|
|
6498
|
-
}) : /* @__PURE__ */ jsxs31(
|
|
6499
|
-
/* @__PURE__ */
|
|
6879
|
+
}) : /* @__PURE__ */ jsxs31(Fragment17, { children: [
|
|
6880
|
+
/* @__PURE__ */ jsx39(
|
|
6500
6881
|
KjunDataState,
|
|
6501
6882
|
{
|
|
6502
6883
|
...props,
|
|
6503
6884
|
loadingPadding: "none",
|
|
6504
6885
|
empty: !rows.length,
|
|
6505
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */
|
|
6506
|
-
emptyContent: /* @__PURE__ */
|
|
6886
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx39(KjunListSkeleton, { variant: "compact" }),
|
|
6887
|
+
emptyContent: /* @__PURE__ */ jsx39(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6507
6888
|
children: /* @__PURE__ */ jsxs31("div", { children: [
|
|
6508
|
-
state.pill && /* @__PURE__ */
|
|
6889
|
+
state.pill && /* @__PURE__ */ jsx39("div", { className: "kjun-market-column-label", children: state.pill.label }),
|
|
6509
6890
|
rows.map((row, i) => {
|
|
6510
6891
|
var _a, _b, _c;
|
|
6511
6892
|
return /* @__PURE__ */ jsxs31(
|
|
@@ -6526,15 +6907,15 @@ function KjunMarketCards(props) {
|
|
|
6526
6907
|
}
|
|
6527
6908
|
},
|
|
6528
6909
|
children: [
|
|
6529
|
-
/* @__PURE__ */
|
|
6530
|
-
/* @__PURE__ */
|
|
6910
|
+
/* @__PURE__ */ jsx39(MarketIdentity, { row, props }),
|
|
6911
|
+
/* @__PURE__ */ jsx39("div", { className: "kjun-market-quote", children: ((_b = state.pill) == null ? void 0 : _b.format) === "sparkline" ? /* @__PURE__ */ jsx39(
|
|
6531
6912
|
KjunSparkline,
|
|
6532
6913
|
{
|
|
6533
6914
|
data: getValue(row, state.key) || [],
|
|
6534
6915
|
width: tokens34.extensions.marketTable.sparklineWidth,
|
|
6535
6916
|
height: tokens34.extensions.marketTable.sparklineHeight
|
|
6536
6917
|
}
|
|
6537
|
-
) : state.pill ? /* @__PURE__ */
|
|
6918
|
+
) : state.pill ? /* @__PURE__ */ jsx39(Fragment17, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height: tokens34.extensions.marketTable.valueSkeletonHeight, width: tokens34.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ jsx39(
|
|
6538
6919
|
KjunSignedValue,
|
|
6539
6920
|
{
|
|
6540
6921
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6542,7 +6923,7 @@ function KjunMarketCards(props) {
|
|
|
6542
6923
|
stale: !!getValue(row, "stale"),
|
|
6543
6924
|
tone: "pill"
|
|
6544
6925
|
}
|
|
6545
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */
|
|
6926
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height: tokens34.extensions.financial.priceSkeletonHeight, width: tokens34.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs31("div", { className: "kjun-market-metric", children: [
|
|
6546
6927
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6547
6928
|
props,
|
|
6548
6929
|
row,
|
|
@@ -6559,15 +6940,16 @@ function KjunMarketCards(props) {
|
|
|
6559
6940
|
] })
|
|
6560
6941
|
}
|
|
6561
6942
|
),
|
|
6562
|
-
/* @__PURE__ */
|
|
6943
|
+
/* @__PURE__ */ jsx39(MarketFooter, { props })
|
|
6563
6944
|
] })
|
|
6564
6945
|
] });
|
|
6565
6946
|
}
|
|
6566
6947
|
|
|
6567
6948
|
// packages/react/src/market-list.tsx
|
|
6568
6949
|
import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
6569
|
-
import { jsx as
|
|
6950
|
+
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6570
6951
|
function KjunMarketSimpleList(props) {
|
|
6952
|
+
const m = useKjunMessages();
|
|
6571
6953
|
const {
|
|
6572
6954
|
rows = [],
|
|
6573
6955
|
rowKey = "id",
|
|
@@ -6576,20 +6958,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6576
6958
|
changeLoading = () => false,
|
|
6577
6959
|
priceFormatter,
|
|
6578
6960
|
closingPrice = false,
|
|
6579
|
-
emptyMessage =
|
|
6961
|
+
emptyMessage = m.noItems,
|
|
6580
6962
|
emptySubMessage = ""
|
|
6581
6963
|
} = props;
|
|
6582
6964
|
return /* @__PURE__ */ jsxs32("div", { className: "kjun-market-simple-list", children: [
|
|
6583
|
-
/* @__PURE__ */
|
|
6965
|
+
/* @__PURE__ */ jsx40(
|
|
6584
6966
|
KjunDataState,
|
|
6585
6967
|
{
|
|
6586
6968
|
...props,
|
|
6587
6969
|
loadingPadding: "none",
|
|
6588
6970
|
empty: !rows.length,
|
|
6589
6971
|
emptyText: emptyMessage,
|
|
6590
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */
|
|
6591
|
-
emptyContent: /* @__PURE__ */
|
|
6592
|
-
children: /* @__PURE__ */
|
|
6972
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx40(KjunListSkeleton, {}),
|
|
6973
|
+
emptyContent: /* @__PURE__ */ jsx40(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6974
|
+
children: /* @__PURE__ */ jsx40("div", { children: rows.map((row, i) => {
|
|
6593
6975
|
var _a, _b;
|
|
6594
6976
|
const price = priceValue(row), change = changeValue(row), stale = !!getValue(row, "stale"), source = String(getValue(row, "source") || ""), fetchedAt = String(getValue(row, "fetched_at") || "");
|
|
6595
6977
|
return /* @__PURE__ */ jsxs32(
|
|
@@ -6610,9 +6992,9 @@ function KjunMarketSimpleList(props) {
|
|
|
6610
6992
|
}
|
|
6611
6993
|
},
|
|
6612
6994
|
children: [
|
|
6613
|
-
/* @__PURE__ */
|
|
6995
|
+
/* @__PURE__ */ jsx40(MarketIdentity, { row, props }),
|
|
6614
6996
|
/* @__PURE__ */ jsxs32("div", { className: "kjun-market-quote", children: [
|
|
6615
|
-
/* @__PURE__ */
|
|
6997
|
+
/* @__PURE__ */ jsx40("div", { className: "kjun-market-price", children: /* @__PURE__ */ jsx40(
|
|
6616
6998
|
KjunPriceCell,
|
|
6617
6999
|
{
|
|
6618
7000
|
value: price,
|
|
@@ -6623,7 +7005,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6623
7005
|
) }),
|
|
6624
7006
|
/* @__PURE__ */ jsxs32("div", { className: "kjun-market-change", children: [
|
|
6625
7007
|
price !== null && ((_b = props.renderPricePrefix) == null ? void 0 : _b.call(props, row)),
|
|
6626
|
-
(finiteNumber(price) !== null || !changeLoading(row) && finiteNumber(change) !== null) && (closingPrice && !stale ? /* @__PURE__ */
|
|
7008
|
+
(finiteNumber(price) !== null || !changeLoading(row) && finiteNumber(change) !== null) && (closingPrice && !stale ? /* @__PURE__ */ jsx40(KjunBadge, { variant: "secondary", size: "xs", children: m.closePrice }) : /* @__PURE__ */ jsx40(
|
|
6627
7009
|
KjunFreshness,
|
|
6628
7010
|
{
|
|
6629
7011
|
stale,
|
|
@@ -6631,7 +7013,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6631
7013
|
fetchedAt
|
|
6632
7014
|
}
|
|
6633
7015
|
)),
|
|
6634
|
-
changeLoading(row) ? /* @__PURE__ */
|
|
7016
|
+
changeLoading(row) ? /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", height: tokens35.extensions.marketList.changeSkeletonHeight, width: tokens35.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ jsx40(
|
|
6635
7017
|
KjunSignedValue,
|
|
6636
7018
|
{
|
|
6637
7019
|
value: change,
|
|
@@ -6640,7 +7022,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6640
7022
|
format: "percent",
|
|
6641
7023
|
isRaw: true
|
|
6642
7024
|
}
|
|
6643
|
-
) : /* @__PURE__ */
|
|
7025
|
+
) : /* @__PURE__ */ jsx40("span", { children: "-" })
|
|
6644
7026
|
] })
|
|
6645
7027
|
] })
|
|
6646
7028
|
]
|
|
@@ -6650,20 +7032,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6650
7032
|
}) })
|
|
6651
7033
|
}
|
|
6652
7034
|
),
|
|
6653
|
-
/* @__PURE__ */
|
|
7035
|
+
/* @__PURE__ */ jsx40(MarketFooter, { props })
|
|
6654
7036
|
] });
|
|
6655
7037
|
}
|
|
6656
7038
|
|
|
6657
7039
|
// packages/react/src/market-panel.tsx
|
|
6658
7040
|
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6659
|
-
import { jsx as
|
|
7041
|
+
import { jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
6660
7042
|
function KjunMarketListPanel({
|
|
6661
7043
|
controls,
|
|
6662
7044
|
children
|
|
6663
7045
|
}) {
|
|
6664
7046
|
return /* @__PURE__ */ jsxs33(KjunCard, { children: [
|
|
6665
|
-
/* @__PURE__ */
|
|
6666
|
-
/* @__PURE__ */
|
|
7047
|
+
/* @__PURE__ */ jsx41("div", { children: controls }),
|
|
7048
|
+
/* @__PURE__ */ jsx41("div", { style: { marginTop: tokens36.dimension.value16, borderTop: `${tokens36.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
6667
7049
|
] });
|
|
6668
7050
|
}
|
|
6669
7051
|
|
|
@@ -6686,8 +7068,9 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6686
7068
|
|
|
6687
7069
|
// packages/react/src/market-table.tsx
|
|
6688
7070
|
import { useEffect as useEffect20, useRef as useRef27, useState as useState28 } from "react";
|
|
6689
|
-
import { jsx as
|
|
7071
|
+
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6690
7072
|
function KjunMarketTable(props) {
|
|
7073
|
+
const m = useKjunMessages();
|
|
6691
7074
|
const {
|
|
6692
7075
|
rows = [],
|
|
6693
7076
|
columns,
|
|
@@ -6701,7 +7084,7 @@ function KjunMarketTable(props) {
|
|
|
6701
7084
|
priceFormatter,
|
|
6702
7085
|
currency = "krw",
|
|
6703
7086
|
embedded = false,
|
|
6704
|
-
emptyMessage =
|
|
7087
|
+
emptyMessage = m.noItems,
|
|
6705
7088
|
emptySubMessage = "",
|
|
6706
7089
|
formatMetric,
|
|
6707
7090
|
renderCell
|
|
@@ -6711,12 +7094,12 @@ function KjunMarketTable(props) {
|
|
|
6711
7094
|
const render = (row, col) => {
|
|
6712
7095
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6713
7096
|
if (cellLoading(row, col))
|
|
6714
|
-
return /* @__PURE__ */
|
|
7097
|
+
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height: tokens37.extensions.marketTable.valueSkeletonHeight, width: tokens37.extensions.marketTable.valueSkeletonWidth });
|
|
6715
7098
|
if (renderCell) return renderCell(row, col);
|
|
6716
7099
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
6717
|
-
return /* @__PURE__ */
|
|
7100
|
+
return /* @__PURE__ */ jsx42(MarketIdentity, { row, props });
|
|
6718
7101
|
if (col.type === "sparkline")
|
|
6719
|
-
return /* @__PURE__ */
|
|
7102
|
+
return /* @__PURE__ */ jsx42(
|
|
6720
7103
|
KjunSparkline,
|
|
6721
7104
|
{
|
|
6722
7105
|
data: Array.isArray(value) ? value : [],
|
|
@@ -6725,7 +7108,7 @@ function KjunMarketTable(props) {
|
|
|
6725
7108
|
}
|
|
6726
7109
|
);
|
|
6727
7110
|
if (col.type === "price")
|
|
6728
|
-
return /* @__PURE__ */
|
|
7111
|
+
return /* @__PURE__ */ jsx42(
|
|
6729
7112
|
KjunPriceCell,
|
|
6730
7113
|
{
|
|
6731
7114
|
value: finiteNumber(value),
|
|
@@ -6735,7 +7118,7 @@ function KjunMarketTable(props) {
|
|
|
6735
7118
|
}
|
|
6736
7119
|
);
|
|
6737
7120
|
if (col.type === "percent")
|
|
6738
|
-
return value == null ? "-" : /* @__PURE__ */
|
|
7121
|
+
return value == null ? "-" : /* @__PURE__ */ jsx42(
|
|
6739
7122
|
KjunSignedValue,
|
|
6740
7123
|
{
|
|
6741
7124
|
value: finiteNumber(value),
|
|
@@ -6751,7 +7134,7 @@ function KjunMarketTable(props) {
|
|
|
6751
7134
|
}
|
|
6752
7135
|
);
|
|
6753
7136
|
const text = formatMetric ? formatMetric(value, col.type || "text", { currency, row, column: col }) : value == null ? "-" : String(value);
|
|
6754
|
-
return ["investor", "net_amount", "net_volume"].includes(col.type || "") ? /* @__PURE__ */
|
|
7137
|
+
return ["investor", "net_amount", "net_volume"].includes(col.type || "") ? /* @__PURE__ */ jsx42(
|
|
6755
7138
|
KjunSignedValue,
|
|
6756
7139
|
{
|
|
6757
7140
|
value: finiteNumber(value),
|
|
@@ -6768,23 +7151,23 @@ function KjunMarketTable(props) {
|
|
|
6768
7151
|
"data-embedded": embedded,
|
|
6769
7152
|
ref: domainColorRef(showActions && rows.length > 0 && !props.loading),
|
|
6770
7153
|
children: [
|
|
6771
|
-
/* @__PURE__ */
|
|
7154
|
+
/* @__PURE__ */ jsx42(
|
|
6772
7155
|
KjunDataState,
|
|
6773
7156
|
{
|
|
6774
7157
|
...props,
|
|
6775
7158
|
loadingPadding: "none",
|
|
6776
7159
|
empty: !rows.length,
|
|
6777
7160
|
emptyText: emptyMessage,
|
|
6778
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */
|
|
6779
|
-
emptyContent: /* @__PURE__ */
|
|
6780
|
-
children: /* @__PURE__ */
|
|
6781
|
-
/* @__PURE__ */
|
|
6782
|
-
/* @__PURE__ */
|
|
7161
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx42(KjunMarketTableSkeleton, { columns, showActions }),
|
|
7162
|
+
emptyContent: /* @__PURE__ */ jsx42(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
7163
|
+
children: /* @__PURE__ */ jsx42("div", { className: "kjun-table-scroll", ref: scroller, "data-fade-end": fadeEnd || void 0, children: /* @__PURE__ */ jsxs34("table", { "aria-label": m.marketData, className: "kjun-market-table-grid", style: webMarketLayout(columns, showActions).tableStyle, children: [
|
|
7164
|
+
/* @__PURE__ */ jsx42(MarketColumns, { columns, showActions }),
|
|
7165
|
+
/* @__PURE__ */ jsx42("thead", { children: /* @__PURE__ */ jsxs34("tr", { children: [
|
|
6783
7166
|
showActions && /* @__PURE__ */ jsxs34("th", { className: "kjun-market-actions", children: [
|
|
6784
|
-
/* @__PURE__ */
|
|
6785
|
-
/* @__PURE__ */
|
|
7167
|
+
/* @__PURE__ */ jsx42("span", { className: "kjun-market-actions-mark", children: /* @__PURE__ */ jsx42(KjunCollectionMark, { kind: "interest", size: "md" }) }),
|
|
7168
|
+
/* @__PURE__ */ jsx42("span", { className: "kjun-market-actions-mark", children: /* @__PURE__ */ jsx42(KjunCollectionMark, { kind: "favorite", size: "md" }) })
|
|
6786
7169
|
] }),
|
|
6787
|
-
columns.map((col) => /* @__PURE__ */
|
|
7170
|
+
columns.map((col) => /* @__PURE__ */ jsx42(
|
|
6788
7171
|
"th",
|
|
6789
7172
|
{
|
|
6790
7173
|
style: { textAlign: col.align },
|
|
@@ -6799,7 +7182,7 @@ function KjunMarketTable(props) {
|
|
|
6799
7182
|
},
|
|
6800
7183
|
children: [
|
|
6801
7184
|
col.label,
|
|
6802
|
-
/* @__PURE__ */
|
|
7185
|
+
/* @__PURE__ */ jsx42(
|
|
6803
7186
|
KjunIcon,
|
|
6804
7187
|
{
|
|
6805
7188
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
@@ -6813,7 +7196,7 @@ function KjunMarketTable(props) {
|
|
|
6813
7196
|
col.key
|
|
6814
7197
|
))
|
|
6815
7198
|
] }) }),
|
|
6816
|
-
/* @__PURE__ */
|
|
7199
|
+
/* @__PURE__ */ jsx42("tbody", { children: rows.map((row, i) => {
|
|
6817
7200
|
var _a, _b, _c, _d, _e, _f;
|
|
6818
7201
|
const id = getValue(row, rowKey), priceCol = columns.find(
|
|
6819
7202
|
(c) => c.type === "price" && !cellLoading(row, c) && getValue(row, c.key) != null
|
|
@@ -6827,18 +7210,14 @@ function KjunMarketTable(props) {
|
|
|
6827
7210
|
},
|
|
6828
7211
|
children: [
|
|
6829
7212
|
showActions && /* @__PURE__ */ jsxs34("td", { className: "kjun-market-actions", children: [
|
|
6830
|
-
/* @__PURE__ */
|
|
7213
|
+
/* @__PURE__ */ jsx42(
|
|
6831
7214
|
KjunIconToggle,
|
|
6832
7215
|
{
|
|
6833
7216
|
size: "xs",
|
|
6834
7217
|
active: (_a = props.interestKeys) == null ? void 0 : _a.has(id),
|
|
6835
7218
|
activeIcon: "heart",
|
|
6836
7219
|
activeColor: "var(--_kjun-color-interest)",
|
|
6837
|
-
ariaLabel:
|
|
6838
|
-
((_b = props.primaryLabel) == null ? void 0 : _b.call(props, row)) || String(getValue(row, "name") || ""),
|
|
6839
|
-
"\uAD00\uC2EC",
|
|
6840
|
-
((_c = props.interestKeys) == null ? void 0 : _c.has(id)) ? "\uD574\uC81C" : "\uB4F1\uB85D"
|
|
6841
|
-
].filter(Boolean).join(" "),
|
|
7220
|
+
ariaLabel: m.watchToggle(((_b = props.primaryLabel) == null ? void 0 : _b.call(props, row)) || String(getValue(row, "name") || ""), !!((_c = props.interestKeys) == null ? void 0 : _c.has(id))),
|
|
6842
7221
|
loading: togglingInterest === id,
|
|
6843
7222
|
onToggle: () => {
|
|
6844
7223
|
var _a2;
|
|
@@ -6846,18 +7225,14 @@ function KjunMarketTable(props) {
|
|
|
6846
7225
|
}
|
|
6847
7226
|
}
|
|
6848
7227
|
),
|
|
6849
|
-
/* @__PURE__ */
|
|
7228
|
+
/* @__PURE__ */ jsx42(
|
|
6850
7229
|
KjunIconToggle,
|
|
6851
7230
|
{
|
|
6852
7231
|
size: "xs",
|
|
6853
7232
|
active: (_d = props.favoriteKeys) == null ? void 0 : _d.has(id),
|
|
6854
7233
|
activeIcon: "star",
|
|
6855
7234
|
activeColor: "var(--_kjun-color-favorite)",
|
|
6856
|
-
ariaLabel:
|
|
6857
|
-
((_e = props.primaryLabel) == null ? void 0 : _e.call(props, row)) || String(getValue(row, "name") || ""),
|
|
6858
|
-
"\uC990\uACA8\uCC3E\uAE30",
|
|
6859
|
-
((_f = props.favoriteKeys) == null ? void 0 : _f.has(id)) ? "\uD574\uC81C" : "\uB4F1\uB85D"
|
|
6860
|
-
].filter(Boolean).join(" "),
|
|
7235
|
+
ariaLabel: m.favoriteToggle(((_e = props.primaryLabel) == null ? void 0 : _e.call(props, row)) || String(getValue(row, "name") || ""), !!((_f = props.favoriteKeys) == null ? void 0 : _f.has(id))),
|
|
6861
7236
|
loading: togglingFavorite === id,
|
|
6862
7237
|
onToggle: () => {
|
|
6863
7238
|
var _a2;
|
|
@@ -6875,7 +7250,7 @@ function KjunMarketTable(props) {
|
|
|
6875
7250
|
},
|
|
6876
7251
|
children: [
|
|
6877
7252
|
render(row, col),
|
|
6878
|
-
col.key === (priceCol == null ? void 0 : priceCol.key) && /* @__PURE__ */
|
|
7253
|
+
col.key === (priceCol == null ? void 0 : priceCol.key) && /* @__PURE__ */ jsx42(
|
|
6879
7254
|
KjunFreshness,
|
|
6880
7255
|
{
|
|
6881
7256
|
stale: !!getValue(row, "stale"),
|
|
@@ -6897,7 +7272,7 @@ function KjunMarketTable(props) {
|
|
|
6897
7272
|
] }) })
|
|
6898
7273
|
}
|
|
6899
7274
|
),
|
|
6900
|
-
/* @__PURE__ */
|
|
7275
|
+
/* @__PURE__ */ jsx42(MarketFooter, { props })
|
|
6901
7276
|
]
|
|
6902
7277
|
}
|
|
6903
7278
|
);
|
|
@@ -6905,60 +7280,62 @@ function KjunMarketTable(props) {
|
|
|
6905
7280
|
|
|
6906
7281
|
// packages/react/src/list.tsx
|
|
6907
7282
|
import { useId as useId12 } from "react";
|
|
6908
|
-
import { Fragment as
|
|
7283
|
+
import { Fragment as Fragment18, jsx as jsx43, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
6909
7284
|
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
6910
|
-
const contents = /* @__PURE__ */ jsxs35(
|
|
6911
|
-
leading && /* @__PURE__ */
|
|
7285
|
+
const contents = /* @__PURE__ */ jsxs35(Fragment18, { children: [
|
|
7286
|
+
leading && /* @__PURE__ */ jsx43("span", { className: "kjun-list-leading", children: leading }),
|
|
6912
7287
|
/* @__PURE__ */ jsxs35("span", { className: "kjun-list-body", children: [
|
|
6913
|
-
/* @__PURE__ */
|
|
6914
|
-
description && /* @__PURE__ */
|
|
7288
|
+
/* @__PURE__ */ jsx43("span", { className: "kjun-list-title", children: title }),
|
|
7289
|
+
description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description })
|
|
6915
7290
|
] }),
|
|
6916
|
-
trailing && /* @__PURE__ */
|
|
7291
|
+
trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing })
|
|
6917
7292
|
] });
|
|
6918
|
-
const main = href ? /* @__PURE__ */
|
|
7293
|
+
const main = href ? /* @__PURE__ */ jsx43("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ jsx43("button", { className: "kjun-list-main", type: "button", disabled, onClick, children: contents }) : /* @__PURE__ */ jsx43("div", { className: "kjun-list-main", children: contents });
|
|
6919
7294
|
return /* @__PURE__ */ jsxs35("li", { className: "kjun-list-row", children: [
|
|
6920
7295
|
main,
|
|
6921
|
-
actions && /* @__PURE__ */
|
|
7296
|
+
actions && /* @__PURE__ */ jsx43("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
6922
7297
|
] });
|
|
6923
7298
|
}
|
|
6924
|
-
function KjunListSection({ title, description, actions, children, ariaLabel }) {
|
|
7299
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
6925
7300
|
const id = "kjun-" + useId12();
|
|
6926
7301
|
return /* @__PURE__ */ jsxs35("section", { className: "kjun-list-section", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
6927
7302
|
(title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", children: [
|
|
6928
7303
|
/* @__PURE__ */ jsxs35("div", { children: [
|
|
6929
|
-
title && /* @__PURE__ */
|
|
6930
|
-
description && /* @__PURE__ */
|
|
7304
|
+
title && /* @__PURE__ */ jsx43("h3", { id, children: title }),
|
|
7305
|
+
description && /* @__PURE__ */ jsx43("p", { children: description })
|
|
6931
7306
|
] }),
|
|
6932
7307
|
actions
|
|
6933
7308
|
] }),
|
|
6934
|
-
/* @__PURE__ */
|
|
7309
|
+
/* @__PURE__ */ jsx43("ul", { className: "kjun-list", "aria-label": ariaLabel || title, "data-divider": divider ? void 0 : "false", "data-density": density === "compact" ? "compact" : void 0, children })
|
|
6935
7310
|
] });
|
|
6936
7311
|
}
|
|
6937
7312
|
|
|
6938
7313
|
// packages/react/src/app-navigation.tsx
|
|
6939
7314
|
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
6940
|
-
import { jsx as
|
|
7315
|
+
import { jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6941
7316
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
6942
|
-
return /* @__PURE__ */
|
|
6943
|
-
leading && /* @__PURE__ */
|
|
7317
|
+
return /* @__PURE__ */ jsx44(TopNavigationContext.Provider, { value: tokens38.extensions.topNavigation, children: /* @__PURE__ */ jsx44("header", { className: "kjun-top-navigation", style: { paddingTop: Math.max(0, safeAreaTop) }, children: /* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-content", children: [
|
|
7318
|
+
leading && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-leading", children: leading }),
|
|
6944
7319
|
/* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-title", children: [
|
|
6945
|
-
/* @__PURE__ */
|
|
6946
|
-
description && /* @__PURE__ */
|
|
7320
|
+
/* @__PURE__ */ jsx44("strong", { children: title }),
|
|
7321
|
+
description && /* @__PURE__ */ jsx44("p", { children: description })
|
|
6947
7322
|
] }),
|
|
6948
|
-
actions && /* @__PURE__ */
|
|
7323
|
+
actions && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children: actions })
|
|
6949
7324
|
] }) }) });
|
|
6950
7325
|
}
|
|
6951
|
-
function KjunBottomNavigation({ items, value, ariaLabel
|
|
7326
|
+
function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
7327
|
+
const m = useKjunMessages();
|
|
7328
|
+
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
6952
7329
|
const hasIcons = items.some((item) => item.icon);
|
|
6953
7330
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6954
|
-
return /* @__PURE__ */
|
|
6955
|
-
const badge = item.badge != null && /* @__PURE__ */
|
|
7331
|
+
return /* @__PURE__ */ jsx44("nav", { className: "kjun-bottom-navigation", "data-icons": hasIcons || void 0, "aria-label": ariaLabel, style: { paddingBottom: Math.max(0, safeAreaBottom) }, children: items.map((item) => {
|
|
7332
|
+
const badge = item.badge != null && /* @__PURE__ */ jsx44("span", { className: "kjun-navigation-badge", "aria-hidden": "true", children: item.badge });
|
|
6956
7333
|
return /* @__PURE__ */ jsxs36("a", { href: item.disabled ? void 0 : item.href, "aria-label": item.label + (item.badge != null ? ", " + item.badge : ""), "aria-disabled": item.disabled || void 0, "aria-current": value === item.key ? "page" : void 0, onClick: (event) => {
|
|
6957
7334
|
if (item.disabled) event.preventDefault();
|
|
6958
7335
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
6959
7336
|
}, children: [
|
|
6960
7337
|
hasIcons && /* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-icon", children: [
|
|
6961
|
-
item.icon && /* @__PURE__ */
|
|
7338
|
+
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size: tokens38.extensions.bottomNavigation.iconSize }),
|
|
6962
7339
|
badge
|
|
6963
7340
|
] }),
|
|
6964
7341
|
/* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-label", children: [
|
|
@@ -6970,16 +7347,16 @@ function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\u
|
|
|
6970
7347
|
}
|
|
6971
7348
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
6972
7349
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6973
|
-
return /* @__PURE__ */
|
|
6974
|
-
description && /* @__PURE__ */
|
|
6975
|
-
/* @__PURE__ */
|
|
7350
|
+
return /* @__PURE__ */ jsx44("div", { className: "kjun-bottom-action-bar", style: { paddingBottom: tokens38.extensions.navigation.padding + Math.max(0, safeAreaBottom) }, children: /* @__PURE__ */ jsxs36("div", { className: "kjun-bottom-action-content", children: [
|
|
7351
|
+
description && /* @__PURE__ */ jsx44("p", { children: description }),
|
|
7352
|
+
/* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children })
|
|
6976
7353
|
] }) });
|
|
6977
7354
|
}
|
|
6978
7355
|
|
|
6979
7356
|
// packages/react/src/media.tsx
|
|
6980
7357
|
import { useRef as useRef28, useState as useState29 } from "react";
|
|
6981
7358
|
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
6982
|
-
import { jsx as
|
|
7359
|
+
import { jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
6983
7360
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6984
7361
|
const current = useRef28({ src, version: 0 });
|
|
6985
7362
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
@@ -6988,7 +7365,7 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
6988
7365
|
const state = result.version === version ? result.state : "loading";
|
|
6989
7366
|
const failed = !src || state === "error";
|
|
6990
7367
|
return /* @__PURE__ */ jsxs37("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
6991
|
-
!failed && /* @__PURE__ */
|
|
7368
|
+
!failed && /* @__PURE__ */ jsx45("img", { src, alt: decorative ? "" : alt, loading: lazy ? "lazy" : "eager", style: { objectFit: fit }, onLoad: () => {
|
|
6992
7369
|
if (current.current.version !== version) return;
|
|
6993
7370
|
setResult({ version, state: "loaded" });
|
|
6994
7371
|
onLoad == null ? void 0 : onLoad();
|
|
@@ -6997,31 +7374,52 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
6997
7374
|
setResult({ version, state: "error" });
|
|
6998
7375
|
onError == null ? void 0 : onError();
|
|
6999
7376
|
} }, version),
|
|
7000
|
-
failed && /* @__PURE__ */
|
|
7377
|
+
failed && /* @__PURE__ */ jsx45("span", { className: "kjun-image-fallback", role: decorative ? void 0 : "img", "aria-label": decorative ? void 0 : alt, "aria-hidden": decorative || void 0, children: fallback2 != null ? fallback2 : /* @__PURE__ */ jsx45(KjunIcon, { name: "image", size: tokens39.extensions.image.fallbackIconSize }) })
|
|
7001
7378
|
] });
|
|
7002
7379
|
}
|
|
7003
7380
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
7004
|
-
|
|
7381
|
+
const m = useKjunMessages();
|
|
7382
|
+
return /* @__PURE__ */ jsx45("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: tokens39.extensions.avatar[size], height: tokens39.extensions.avatar[size] }, children: /* @__PURE__ */ jsx45(KjunImage, { src, alt: alt || name || m.user, decorative, fallback: fallback2 != null ? fallback2 : Array.from(name.trim())[0] || /* @__PURE__ */ jsx45(KjunIcon, { name: "user", size: tokens39.extensions.avatar.fallbackIconSizes[size] }), onLoad, onError }) });
|
|
7005
7383
|
}
|
|
7006
7384
|
|
|
7007
7385
|
// packages/react/src/chip.tsx
|
|
7008
7386
|
import { tokens as tokens40 } from "@kjun-ui/tokens";
|
|
7009
|
-
import { jsx as
|
|
7387
|
+
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7010
7388
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7389
|
+
const m = useKjunMessages();
|
|
7011
7390
|
return /* @__PURE__ */ jsxs38("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7012
|
-
icon && /* @__PURE__ */
|
|
7013
|
-
/* @__PURE__ */
|
|
7014
|
-
removable && /* @__PURE__ */
|
|
7391
|
+
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size: tokens40.extensions.chip.iconSizes[size] }),
|
|
7392
|
+
/* @__PURE__ */ jsx46("span", { children: label }),
|
|
7393
|
+
removable && /* @__PURE__ */ jsx46("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ jsx46(KjunIcon, { name: "x", size: tokens40.extensions.chip.removeIconSizes[size] }) })
|
|
7015
7394
|
] });
|
|
7016
7395
|
}
|
|
7017
7396
|
|
|
7397
|
+
// packages/react/src/fab.tsx
|
|
7398
|
+
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7399
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7400
|
+
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7401
|
+
return /* @__PURE__ */ jsx47(
|
|
7402
|
+
"button",
|
|
7403
|
+
{
|
|
7404
|
+
type: "button",
|
|
7405
|
+
className: "kjun-fab",
|
|
7406
|
+
"aria-label": ariaLabel,
|
|
7407
|
+
disabled,
|
|
7408
|
+
onClick,
|
|
7409
|
+
style: { bottom: tokens41.extensions.fab.inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom) },
|
|
7410
|
+
children: /* @__PURE__ */ jsx47(KjunIcon, { name: icon, size: tokens41.extensions.fab.iconSize })
|
|
7411
|
+
}
|
|
7412
|
+
);
|
|
7413
|
+
}
|
|
7414
|
+
|
|
7018
7415
|
// packages/react/src/range-input.tsx
|
|
7019
7416
|
import { useEffect as useEffect21, useRef as useRef29 } from "react";
|
|
7020
7417
|
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
|
|
7021
7418
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
7022
|
-
import { Fragment as
|
|
7419
|
+
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
7023
7420
|
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, onValueChange, onChangeCommit, ...rest }) {
|
|
7024
|
-
const
|
|
7421
|
+
const m = useKjunMessages();
|
|
7422
|
+
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
|
|
7025
7423
|
const domain = createSliderDomain(min, max, step);
|
|
7026
7424
|
const list = Array.isArray(value) ? value : [value];
|
|
7027
7425
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
@@ -7040,37 +7438,38 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7040
7438
|
active.current = true;
|
|
7041
7439
|
onValueChange == null ? void 0 : onValueChange(result);
|
|
7042
7440
|
};
|
|
7043
|
-
return /* @__PURE__ */ jsxs39(Slider, { className: "kjun-slider", "data-disabled": disabled || !valid, "aria-label": ariaLabel || label ||
|
|
7441
|
+
return /* @__PURE__ */ jsxs39(Slider, { className: "kjun-slider", "data-disabled": disabled || !valid, "aria-label": ariaLabel || label || m.value, value: valid ? value : Array.isArray(value) ? [0, 100] : 0, minValue: valid ? min : 0, maxValue: valid ? domain.snap(max) : 100, step: valid ? step : 1, isDisabled: disabled || !valid, onChange: change, onChangeEnd: () => {
|
|
7044
7442
|
if (valid && !disabled && active.current) {
|
|
7045
7443
|
active.current = false;
|
|
7046
7444
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7047
7445
|
}
|
|
7048
7446
|
}, children: [
|
|
7049
7447
|
/* @__PURE__ */ jsxs39("div", { className: "kjun-slider-caption", children: [
|
|
7050
|
-
label && /* @__PURE__ */
|
|
7051
|
-
/* @__PURE__ */
|
|
7448
|
+
label && /* @__PURE__ */ jsx48(Label, { className: "kjun-slider-label", children: label }),
|
|
7449
|
+
/* @__PURE__ */ jsx48(SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.join(" \u2013 ") })
|
|
7052
7450
|
] }),
|
|
7053
|
-
/* @__PURE__ */
|
|
7054
|
-
/* @__PURE__ */
|
|
7055
|
-
/* @__PURE__ */
|
|
7056
|
-
list.map((_, i) => /* @__PURE__ */
|
|
7451
|
+
/* @__PURE__ */ jsx48(SliderTrack, { className: "kjun-slider-track", children: ({ state }) => /* @__PURE__ */ jsxs39(Fragment19, { children: [
|
|
7452
|
+
/* @__PURE__ */ jsx48("div", { className: "kjun-slider-rail" }),
|
|
7453
|
+
/* @__PURE__ */ jsx48("div", { className: "kjun-slider-fill", style: { left: (list.length === 2 ? state.getThumbPercent(0) * 100 : 0) + "%", width: (state.getThumbPercent(list.length - 1) - (list.length === 2 ? state.getThumbPercent(0) : 0)) * 100 + "%" } }),
|
|
7454
|
+
list.map((_, i) => /* @__PURE__ */ jsx48(SliderThumb, { index: i, className: "kjun-slider-thumb", "aria-label": list.length === 2 ? thumbLabels[i] : ariaLabel || label || m.value }, i))
|
|
7057
7455
|
] }) })
|
|
7058
7456
|
] });
|
|
7059
7457
|
}
|
|
7060
7458
|
function KjunSlider(props) {
|
|
7061
|
-
return /* @__PURE__ */
|
|
7459
|
+
return /* @__PURE__ */ jsx48(RangeInput, { ...props });
|
|
7062
7460
|
}
|
|
7063
7461
|
function KjunRangeSlider(props) {
|
|
7064
|
-
return /* @__PURE__ */
|
|
7462
|
+
return /* @__PURE__ */ jsx48(RangeInput, { ...props });
|
|
7065
7463
|
}
|
|
7066
7464
|
|
|
7067
7465
|
// packages/react/src/quantity-stepper.tsx
|
|
7068
7466
|
import { useEffect as useEffect22, useRef as useRef30, useState as useState30 } from "react";
|
|
7069
|
-
import { createNumberDomain, quantityKeyAction, tokens as
|
|
7070
|
-
import { jsx as
|
|
7467
|
+
import { createNumberDomain, quantityKeyAction, tokens as tokens42 } from "@kjun-ui/tokens";
|
|
7468
|
+
import { jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7071
7469
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7072
|
-
const
|
|
7073
|
-
const
|
|
7470
|
+
const m = useKjunMessages();
|
|
7471
|
+
const geometry = tokens42.extensions.compound;
|
|
7472
|
+
const buttonStyle = { width: tokens42.input[size].height, padding: 0 };
|
|
7074
7473
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
7075
7474
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7076
7475
|
const [draft, setDraft] = useState30(String(value));
|
|
@@ -7115,9 +7514,9 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7115
7514
|
} else if (action === "commit") commit();
|
|
7116
7515
|
else move(action === "increment" ? 1 : -1);
|
|
7117
7516
|
};
|
|
7118
|
-
return /* @__PURE__ */
|
|
7119
|
-
/* @__PURE__ */
|
|
7120
|
-
/* @__PURE__ */
|
|
7517
|
+
return /* @__PURE__ */ jsx49(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs40("div", { className: "kjun-quantity", "data-size": size, "data-block": block, "data-error": error || !!(field == null ? void 0 : field.error), children: [
|
|
7518
|
+
/* @__PURE__ */ jsx49(KjunButton, { size, style: buttonStyle, variant: "ghost", ariaLabel: m.decreaseQuantity, disabled: blocked || value <= min, onMouseDown: (e) => e.preventDefault(), onClick: () => move(-1), prefixIcon: "minus" }),
|
|
7519
|
+
/* @__PURE__ */ jsx49(
|
|
7121
7520
|
"input",
|
|
7122
7521
|
{
|
|
7123
7522
|
className: "kjun-input",
|
|
@@ -7125,7 +7524,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7125
7524
|
type: "text",
|
|
7126
7525
|
inputMode: precision ? "decimal" : "numeric",
|
|
7127
7526
|
role: "spinbutton",
|
|
7128
|
-
"aria-label": ariaLabel || ((field == null ? void 0 : field.labelId) ? void 0 :
|
|
7527
|
+
"aria-label": ariaLabel || ((field == null ? void 0 : field.labelId) ? void 0 : m.quantity),
|
|
7129
7528
|
"aria-labelledby": ariaLabel ? void 0 : field == null ? void 0 : field.labelId,
|
|
7130
7529
|
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
7131
7530
|
"aria-invalid": error || !!(field == null ? void 0 : field.error) || void 0,
|
|
@@ -7151,19 +7550,21 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7151
7550
|
"aria-required": (field == null ? void 0 : field.required) || void 0
|
|
7152
7551
|
}
|
|
7153
7552
|
),
|
|
7154
|
-
/* @__PURE__ */
|
|
7553
|
+
/* @__PURE__ */ jsx49(KjunButton, { size, style: buttonStyle, variant: "ghost", ariaLabel: m.increaseQuantity, disabled: blocked || max !== void 0 && value >= max, onMouseDown: (e) => e.preventDefault(), onClick: () => move(1), prefixIcon: "plus" })
|
|
7155
7554
|
] }) });
|
|
7156
7555
|
}
|
|
7157
7556
|
|
|
7158
7557
|
// packages/react/src/time-picker.tsx
|
|
7159
|
-
import { Fragment as
|
|
7558
|
+
import { Fragment as Fragment20, useEffect as useEffect23, useId as useId13, useMemo as useMemo3, useRef as useRef31 } from "react";
|
|
7160
7559
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
7161
|
-
import { jsx as
|
|
7162
|
-
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel
|
|
7560
|
+
import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
7561
|
+
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7562
|
+
const m = useKjunMessages();
|
|
7563
|
+
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
7163
7564
|
const root = useRef31(null);
|
|
7164
7565
|
const field = useKjunField(), uid = useId13();
|
|
7165
7566
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7166
|
-
const domain =
|
|
7567
|
+
const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7167
7568
|
const valid = domain.valid && domain.accepts(value);
|
|
7168
7569
|
useEffect23(() => {
|
|
7169
7570
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
@@ -7176,14 +7577,14 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7176
7577
|
};
|
|
7177
7578
|
const time = value === null ? null : domain.parse(value);
|
|
7178
7579
|
return /* @__PURE__ */ jsxs41("div", { ref: root, className: "kjun-time-picker", "data-size": size, "data-error": error || !!(field == null ? void 0 : field.error), "data-disabled": disabled || !valid, role: "group", "aria-label": ariaLabel, "aria-labelledby": field == null ? void 0 : field.labelId, "aria-describedby": field == null ? void 0 : field.describedBy, children: [
|
|
7179
|
-
/* @__PURE__ */
|
|
7580
|
+
/* @__PURE__ */ jsx50(CompoundControlContext.Provider, { value: size, children: /* @__PURE__ */ jsx50("div", { className: "kjun-time-segments", children: [m.hour, m.minute, m.second].slice(0, precision === "second" ? 3 : 2).map((label, index) => {
|
|
7180
7581
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7181
7582
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7182
|
-
return /* @__PURE__ */ jsxs41(
|
|
7183
|
-
index > 0 && /* @__PURE__ */
|
|
7184
|
-
/* @__PURE__ */
|
|
7185
|
-
/* @__PURE__ */
|
|
7186
|
-
/* @__PURE__ */
|
|
7583
|
+
return /* @__PURE__ */ jsxs41(Fragment20, { children: [
|
|
7584
|
+
index > 0 && /* @__PURE__ */ jsx50("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
7585
|
+
/* @__PURE__ */ jsx50(FieldContext.Provider, { value: { ...field, id: segmentId, labelId: (field == null ? void 0 : field.labelId) ? `${field.labelId} ${labelId}` : void 0 }, children: /* @__PURE__ */ jsxs41("div", { className: "kjun-time-segment", children: [
|
|
7586
|
+
/* @__PURE__ */ jsx50("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|
|
7587
|
+
/* @__PURE__ */ jsx50(
|
|
7187
7588
|
KjunSelect,
|
|
7188
7589
|
{
|
|
7189
7590
|
value: time === null ? null : domain.part(time, index),
|
|
@@ -7203,7 +7604,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7203
7604
|
] }) })
|
|
7204
7605
|
] }, label);
|
|
7205
7606
|
}) }) }),
|
|
7206
|
-
clearable && value !== null && /* @__PURE__ */
|
|
7607
|
+
clearable && value !== null && /* @__PURE__ */ jsx50(KjunButton, { className: "kjun-time-clear", size, variant: "ghost", prefixIcon: "x", ariaLabel: m.clearValue(ariaLabel), disabled: disabled || !valid, onClick: () => {
|
|
7207
7608
|
var _a, _b;
|
|
7208
7609
|
change(null);
|
|
7209
7610
|
(_b = (_a = root.current) == null ? void 0 : _a.querySelector(".kjun-select-trigger")) == null ? void 0 : _b.focus();
|
|
@@ -7240,6 +7641,7 @@ export {
|
|
|
7240
7641
|
KjunErrorBoundary,
|
|
7241
7642
|
KjunExecutionStatusBadge,
|
|
7242
7643
|
KjunExternalLink,
|
|
7644
|
+
KjunFab,
|
|
7243
7645
|
KjunFeedbackProvider,
|
|
7244
7646
|
KjunFilterGroup,
|
|
7245
7647
|
KjunFormActions,
|
|
@@ -7294,5 +7696,7 @@ export {
|
|
|
7294
7696
|
KjunTooltip,
|
|
7295
7697
|
KjunTopNavigation,
|
|
7296
7698
|
groupKeydown,
|
|
7699
|
+
kjunMessagesEn,
|
|
7700
|
+
kjunMessagesKo,
|
|
7297
7701
|
useKjunFeedback
|
|
7298
7702
|
};
|