@cerberus-design/react 0.25.1-rc.1 → 0.25.2-rc.1
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/components/accordion/primitives.cjs +2 -2
- package/dist/components/accordion/primitives.js +2 -2
- package/dist/components/admonition/primitives.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/button/primitives.js +1 -1
- package/dist/components/carousel/parts.js +1 -1
- package/dist/components/carousel/primitives.cjs +3 -3
- package/dist/components/carousel/primitives.js +3 -3
- package/dist/components/circular-progress/primitives.cjs +4 -4
- package/dist/components/circular-progress/primitives.js +5 -5
- package/dist/components/clipboard/primitives.cjs +4 -4
- package/dist/components/clipboard/primitives.js +4 -4
- package/dist/components/collapsible/index.cjs +1 -0
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/collapsible/parts.cjs +1 -0
- package/dist/components/collapsible/parts.d.cts +4 -0
- package/dist/components/collapsible/parts.d.ts +4 -0
- package/dist/components/collapsible/parts.js +2 -1
- package/dist/components/collapsible/primitives.cjs +3 -0
- package/dist/components/collapsible/primitives.d.cts +6 -1
- package/dist/components/collapsible/primitives.d.ts +6 -1
- package/dist/components/collapsible/primitives.js +3 -1
- package/dist/components/combobox/combobox.cjs +1 -2
- package/dist/components/combobox/combobox.d.cts +0 -5
- package/dist/components/combobox/combobox.d.ts +0 -5
- package/dist/components/combobox/combobox.js +1 -2
- package/dist/components/combobox/primitives.cjs +7 -7
- package/dist/components/combobox/primitives.js +7 -7
- package/dist/components/date-picker/calendar.cjs +1 -1
- package/dist/components/date-picker/calendar.d.cts +0 -5
- package/dist/components/date-picker/calendar.d.ts +0 -5
- package/dist/components/date-picker/calendar.js +1 -1
- package/dist/components/date-picker/index.cjs +4 -4
- package/dist/components/date-picker/index.js +2 -2
- package/dist/components/date-picker/primitives.cjs +7 -7
- package/dist/components/date-picker/primitives.js +7 -7
- package/dist/components/deprecated/Legend.js +1 -1
- package/dist/components/deprecated/NavMenuLink.js +1 -1
- package/dist/components/dialog/primitives.cjs +2 -2
- package/dist/components/dialog/primitives.js +2 -2
- package/dist/components/field/primitives.cjs +2 -2
- package/dist/components/field/primitives.js +2 -2
- package/dist/components/file-upload/file-status.js +1 -1
- package/dist/components/file-upload/file-uploader.cjs +1 -1
- package/dist/components/file-upload/file-uploader.js +1 -1
- package/dist/components/file-upload/index.cjs +1 -0
- package/dist/components/file-upload/index.js +1 -1
- package/dist/components/file-upload/parts.cjs +1 -0
- package/dist/components/file-upload/parts.d.cts +4 -0
- package/dist/components/file-upload/parts.d.ts +4 -0
- package/dist/components/file-upload/parts.js +2 -1
- package/dist/components/file-upload/primitives.cjs +11 -9
- package/dist/components/file-upload/primitives.d.cts +2 -0
- package/dist/components/file-upload/primitives.d.ts +2 -0
- package/dist/components/file-upload/primitives.js +11 -10
- package/dist/components/file-upload/utils.cjs +1 -1
- package/dist/components/file-upload/utils.js +1 -1
- package/dist/components/menu/menu.js +1 -1
- package/dist/components/notifications/index.cjs +4 -4
- package/dist/components/notifications/index.js +1 -1
- package/dist/components/number-input/primitives.cjs +3 -3
- package/dist/components/number-input/primitives.js +3 -3
- package/dist/components/pin-input/primitives.cjs +1 -1
- package/dist/components/pin-input/primitives.js +1 -1
- package/dist/components/progress/primitives.js +1 -1
- package/dist/components/radio/primitives.cjs +3 -3
- package/dist/components/radio/primitives.js +3 -3
- package/dist/components/rating/primitives.cjs +2 -2
- package/dist/components/rating/primitives.js +2 -2
- package/dist/components/select/primitives.cjs +8 -8
- package/dist/components/select/primitives.js +8 -8
- package/dist/components/select/select.d.cts +0 -5
- package/dist/components/select/select.d.ts +0 -5
- package/dist/components/switch/primitives.cjs +2 -2
- package/dist/components/switch/primitives.js +2 -2
- package/dist/components/table/primitives.js +1 -1
- package/dist/components/tabs/parts.js +1 -1
- package/dist/components/tabs/primitives.cjs +2 -2
- package/dist/components/tabs/primitives.js +2 -2
- package/dist/components/tooltip/primitives.cjs +4 -4
- package/dist/components/tooltip/primitives.js +4 -4
- package/dist/context/cerberus.js +1 -1
- package/dist/context/confirm-modal.js +1 -1
- package/dist/context/feature-flags.js +1 -1
- package/dist/context/navMenu.js +1 -1
- package/dist/context/prompt-modal.js +1 -1
- package/dist/context/theme.js +1 -1
- package/dist/index.cjs +266 -256
- package/dist/index.client.d.cts +1 -1
- package/dist/index.client.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/node_modules/.pnpm/@ark-ui_react@5.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-root-provider.cjs +21 -0
- package/dist/node_modules/.pnpm/@ark-ui_react@5.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-root-provider.js +17 -0
- package/dist/node_modules/.pnpm/{@floating-ui_core@1.7.3 → @floating-ui_core@1.7.4}/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +79 -73
- package/dist/node_modules/.pnpm/{@floating-ui_core@1.7.3 → @floating-ui_core@1.7.4}/node_modules/@floating-ui/core/dist/floating-ui.core.js +80 -74
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +1 -1
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +2 -2
- package/dist/node_modules/.pnpm/@internationalized_date@3.10.0/node_modules/@internationalized/date/src/queries.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_accordion@1.31.1/node_modules/@zag-js/accordion/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@zag-js_avatar@1.31.1/node_modules/@zag-js/avatar/dist/index.cjs +5 -5
- package/dist/node_modules/.pnpm/@zag-js_carousel@1.31.1/node_modules/@zag-js/carousel/dist/index.cjs +16 -16
- package/dist/node_modules/.pnpm/@zag-js_carousel@1.31.1/node_modules/@zag-js/carousel/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@zag-js_clipboard@1.31.1/node_modules/@zag-js/clipboard/dist/index.cjs +4 -4
- package/dist/node_modules/.pnpm/@zag-js_clipboard@1.31.1/node_modules/@zag-js/clipboard/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_collapsible@1.31.1/node_modules/@zag-js/collapsible/dist/index.cjs +11 -11
- package/dist/node_modules/.pnpm/@zag-js_collapsible@1.31.1/node_modules/@zag-js/collapsible/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_combobox@1.31.1/node_modules/@zag-js/combobox/dist/index.cjs +84 -84
- package/dist/node_modules/.pnpm/@zag-js_combobox@1.31.1/node_modules/@zag-js/combobox/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_date-picker@1.31.1_@internationalized_date@3.10.0/node_modules/@zag-js/date-picker/dist/index.cjs +154 -154
- package/dist/node_modules/.pnpm/@zag-js_date-picker@1.31.1_@internationalized_date@3.10.0/node_modules/@zag-js/date-picker/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@zag-js_date-utils@1.31.1_@internationalized_date@3.10.0/node_modules/@zag-js/date-utils/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/@zag-js_date-utils@1.31.1_@internationalized_date@3.10.0/node_modules/@zag-js/date-utils/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@zag-js_dialog@1.31.1/node_modules/@zag-js/dialog/dist/index.cjs +14 -14
- package/dist/node_modules/.pnpm/@zag-js_file-upload@1.31.1/node_modules/@zag-js/file-upload/dist/index.cjs +47 -47
- package/dist/node_modules/.pnpm/@zag-js_file-upload@1.31.1/node_modules/@zag-js/file-upload/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@zag-js_number-input@1.31.1/node_modules/@zag-js/number-input/dist/index.cjs +53 -53
- package/dist/node_modules/.pnpm/@zag-js_number-input@1.31.1/node_modules/@zag-js/number-input/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@zag-js_pin-input@1.31.1/node_modules/@zag-js/pin-input/dist/index.cjs +44 -44
- package/dist/node_modules/.pnpm/@zag-js_pin-input@1.31.1/node_modules/@zag-js/pin-input/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_progress@1.31.1/node_modules/@zag-js/progress/dist/index.cjs +6 -6
- package/dist/node_modules/.pnpm/@zag-js_rating-group@1.31.1/node_modules/@zag-js/rating-group/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_react@1.31.1_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@zag-js/react/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_remove-scroll@1.31.1/node_modules/@zag-js/remove-scroll/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_select@1.31.1/node_modules/@zag-js/select/dist/index.cjs +5 -5
- package/dist/node_modules/.pnpm/@zag-js_tabs@1.31.1/node_modules/@zag-js/tabs/dist/index.cjs +37 -37
- package/dist/node_modules/.pnpm/@zag-js_tabs@1.31.1/node_modules/@zag-js/tabs/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@zag-js_toast@1.31.1/node_modules/@zag-js/toast/dist/index.cjs +33 -33
- package/dist/node_modules/.pnpm/@zag-js_toast@1.31.1/node_modules/@zag-js/toast/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@zag-js_tooltip@1.31.1/node_modules/@zag-js/tooltip/dist/index.cjs +9 -9
- package/dist/node_modules/.pnpm/@zag-js_tooltip@1.31.1/node_modules/@zag-js/tooltip/dist/index.js +1 -1
- package/package.json +3 -3
- package/src/components/collapsible/parts.ts +6 -0
- package/src/components/collapsible/primitives.tsx +6 -0
- package/src/components/combobox/combobox.tsx +0 -6
- package/src/components/date-picker/calendar.tsx +1 -6
- package/src/components/file-upload/file-uploader.tsx +2 -2
- package/src/components/file-upload/parts.tsx +6 -0
- package/src/components/file-upload/primitives.ts +5 -0
- package/src/components/file-upload/utils.ts +1 -1
- package/src/components/select/select.tsx +0 -5
- package/src/index.client.ts +2 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAnatomy } from '../../../../../@zag-js_anatomy@1.31.1/node_modules/@zag-js/anatomy/dist/index.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { getDateRangePreset, getDecadeRange, constrainValue, getTodayDate, getWeekDays, getMonthFormatter, getDaysInWeek, isDateOutsideRange, getDayFormatter, getUnitDuration, isDateEqual, isDateUnavailable, getMonthNames, getYearsRange, getMonthDays, alignDate, getPreviousSection, getNextSection, getPreviousPage, getNextPage, formatSelectedDate, isNextRangeInvalid, isPreviousRangeInvalid, getEndDate, parseDateString, getAdjustedDateFn } from '../../../../../@zag-js_date-utils@1.31.1_@internationalized_date@3.10.0/node_modules/@zag-js/date-utils/dist/index.js';
|
|
3
|
+
import { getNativeEvent, dataAttr, ariaAttr, getEventKey, isComposingEvent, setElementValue, raf, restoreTextSelection, disableTextSelection, queryAll, query } from '../../../../../@zag-js_dom-query@1.31.1/node_modules/@zag-js/dom-query/dist/index.js';
|
|
4
|
+
import { getPlacementStyles, getPlacement } from '../../../../../@zag-js_popper@1.31.1/node_modules/@zag-js/popper/dist/index.js';
|
|
5
5
|
import { chunk, isValueWithinRange, match, clampValue } from '../../../../../@zag-js_utils@1.31.1/node_modules/@zag-js/utils/dist/index.js';
|
|
6
6
|
import { createMachine, createGuards } from '../../../../../@zag-js_core@1.31.1/node_modules/@zag-js/core/dist/index.js';
|
|
7
7
|
import { trackDismissableElement } from '../../../../../@zag-js_dismissable@1.31.1/node_modules/@zag-js/dismissable/dist/index.js';
|
|
@@ -9,8 +9,8 @@ import { createLiveRegion } from '../../../../../@zag-js_live-region@1.31.1/node
|
|
|
9
9
|
import { createProps } from '../../../../../@zag-js_types@1.31.1/node_modules/@zag-js/types/dist/index.js';
|
|
10
10
|
import { CalendarDate } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/CalendarDate.js';
|
|
11
11
|
import { parseDate } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/string.js';
|
|
12
|
-
import { DateFormatter } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/DateFormatter.js';
|
|
13
12
|
import { isEqualYear, isEqualMonth, isEqualDay, isWeekend, isToday } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/queries.js';
|
|
13
|
+
import { DateFormatter } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/DateFormatter.js';
|
|
14
14
|
|
|
15
15
|
// src/date-picker.anatomy.ts
|
|
16
16
|
var anatomy = createAnatomy("date-picker").parts(
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
|
|
5
5
|
const conversion = require('../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/conversion.cjs');
|
|
6
6
|
const queries = require('../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/queries.cjs');
|
|
7
|
-
const CalendarDate = require('../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/CalendarDate.cjs');
|
|
8
7
|
const DateFormatter = require('../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/DateFormatter.cjs');
|
|
8
|
+
const CalendarDate = require('../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/CalendarDate.cjs');
|
|
9
9
|
|
|
10
10
|
// src/constrain.ts
|
|
11
11
|
function alignCenter(date, duration, locale, min, max) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toCalendarDate, toCalendarDateTime } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/conversion.js';
|
|
2
|
-
import {
|
|
3
|
-
import { CalendarDate } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/CalendarDate.js';
|
|
2
|
+
import { now, startOfYear, endOfYear, startOfWeek, endOfWeek, startOfMonth, endOfMonth, maxDate, minDate, today, getLocalTimeZone, isSameDay, getWeeksInMonth } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/queries.js';
|
|
4
3
|
import { DateFormatter } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/DateFormatter.js';
|
|
4
|
+
import { CalendarDate } from '../../../../../@internationalized_date@3.10.0/node_modules/@internationalized/date/src/CalendarDate.js';
|
|
5
5
|
|
|
6
6
|
// src/constrain.ts
|
|
7
7
|
function alignCenter(date, duration, locale, min, max) {
|
package/dist/node_modules/.pnpm/@zag-js_dialog@1.31.1/node_modules/@zag-js/dialog/dist/index.cjs
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const index$
|
|
6
|
-
const index$
|
|
5
|
+
const index$1 = require('../../../../../@zag-js_anatomy@1.31.1/node_modules/@zag-js/anatomy/dist/index.cjs');
|
|
6
|
+
const index$3 = require('../../../../../@zag-js_aria-hidden@1.31.1/node_modules/@zag-js/aria-hidden/dist/index.cjs');
|
|
7
7
|
const index = require('../../../../../@zag-js_core@1.31.1/node_modules/@zag-js/core/dist/index.cjs');
|
|
8
|
-
const index$
|
|
9
|
-
const index$
|
|
10
|
-
const index$
|
|
11
|
-
const index$
|
|
8
|
+
const index$6 = require('../../../../../@zag-js_dismissable@1.31.1/node_modules/@zag-js/dismissable/dist/index.cjs');
|
|
9
|
+
const index$2 = require('../../../../../@zag-js_dom-query@1.31.1/node_modules/@zag-js/dom-query/dist/index.cjs');
|
|
10
|
+
const index$4 = require('../../../../../@zag-js_focus-trap@1.31.1/node_modules/@zag-js/focus-trap/dist/index.cjs');
|
|
11
|
+
const index$5 = require('../../../../../@zag-js_remove-scroll@1.31.1/node_modules/@zag-js/remove-scroll/dist/index.cjs');
|
|
12
12
|
const index$7 = require('../../../../../@zag-js_types@1.31.1/node_modules/@zag-js/types/dist/index.cjs');
|
|
13
13
|
|
|
14
14
|
// src/dialog.anatomy.ts
|
|
15
|
-
var anatomy = index$
|
|
15
|
+
var anatomy = index$1.createAnatomy("dialog").parts(
|
|
16
16
|
"trigger",
|
|
17
17
|
"backdrop",
|
|
18
18
|
"positioner",
|
|
@@ -229,7 +229,7 @@ var machine = index.createMachine({
|
|
|
229
229
|
effects: {
|
|
230
230
|
trackDismissableElement({ scope, send, prop }) {
|
|
231
231
|
const getContentEl2 = () => getContentEl(scope);
|
|
232
|
-
return index$
|
|
232
|
+
return index$6.trackDismissableElement(getContentEl2, {
|
|
233
233
|
type: "dialog",
|
|
234
234
|
defer: true,
|
|
235
235
|
pointerBlocking: prop("modal"),
|
|
@@ -257,12 +257,12 @@ var machine = index.createMachine({
|
|
|
257
257
|
},
|
|
258
258
|
preventScroll({ scope, prop }) {
|
|
259
259
|
if (!prop("preventScroll")) return;
|
|
260
|
-
return index$
|
|
260
|
+
return index$5.preventBodyScroll(scope.getDoc());
|
|
261
261
|
},
|
|
262
262
|
trapFocus({ scope, prop }) {
|
|
263
263
|
if (!prop("trapFocus")) return;
|
|
264
264
|
const contentEl = () => getContentEl(scope);
|
|
265
|
-
return index$
|
|
265
|
+
return index$4.trapFocus(contentEl, {
|
|
266
266
|
preventScroll: true,
|
|
267
267
|
returnFocusOnDeactivate: !!prop("restoreFocus"),
|
|
268
268
|
initialFocus: prop("initialFocusEl"),
|
|
@@ -273,12 +273,12 @@ var machine = index.createMachine({
|
|
|
273
273
|
hideContentBelow({ scope, prop }) {
|
|
274
274
|
if (!prop("modal")) return;
|
|
275
275
|
const getElements = () => [getContentEl(scope)];
|
|
276
|
-
return index$
|
|
276
|
+
return index$3.ariaHidden(getElements, { defer: true });
|
|
277
277
|
}
|
|
278
278
|
},
|
|
279
279
|
actions: {
|
|
280
280
|
checkRenderedElements({ context, scope }) {
|
|
281
|
-
index$
|
|
281
|
+
index$2.raf(() => {
|
|
282
282
|
context.set("rendered", {
|
|
283
283
|
title: !!getTitleEl(scope),
|
|
284
284
|
description: !!getDescriptionEl(scope)
|
|
@@ -286,10 +286,10 @@ var machine = index.createMachine({
|
|
|
286
286
|
});
|
|
287
287
|
},
|
|
288
288
|
syncZIndex({ scope }) {
|
|
289
|
-
index$
|
|
289
|
+
index$2.raf(() => {
|
|
290
290
|
const contentEl = getContentEl(scope);
|
|
291
291
|
if (!contentEl) return;
|
|
292
|
-
const styles = index$
|
|
292
|
+
const styles = index$2.getComputedStyle(contentEl);
|
|
293
293
|
const elems = [getPositionerEl(scope), getBackdropEl(scope)];
|
|
294
294
|
elems.forEach((node) => {
|
|
295
295
|
node?.style.setProperty("--z-index", styles.zIndex);
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const index$
|
|
6
|
-
const index$
|
|
7
|
-
const index$
|
|
8
|
-
const index$
|
|
5
|
+
const index$5 = require('../../../../../@zag-js_anatomy@1.31.1/node_modules/@zag-js/anatomy/dist/index.cjs');
|
|
6
|
+
const index$1 = require('../../../../../@zag-js_dom-query@1.31.1/node_modules/@zag-js/dom-query/dist/index.cjs');
|
|
7
|
+
const index$2 = require('../../../../../@zag-js_file-utils@1.31.1/node_modules/@zag-js/file-utils/dist/index.cjs');
|
|
8
|
+
const index$4 = require('../../../../../@zag-js_i18n-utils@1.31.1/node_modules/@zag-js/i18n-utils/dist/index.cjs');
|
|
9
9
|
const index$6 = require('../../../../../@zag-js_types@1.31.1/node_modules/@zag-js/types/dist/index.cjs');
|
|
10
|
-
const index$
|
|
10
|
+
const index$3 = require('../../../../../@zag-js_utils@1.31.1/node_modules/@zag-js/utils/dist/index.cjs');
|
|
11
11
|
const index = require('../../../../../@zag-js_core@1.31.1/node_modules/@zag-js/core/dist/index.cjs');
|
|
12
12
|
|
|
13
13
|
// src/file-upload.anatomy.ts
|
|
14
|
-
var anatomy = index$
|
|
14
|
+
var anatomy = index$5.createAnatomy("file-upload").parts(
|
|
15
15
|
"root",
|
|
16
16
|
"dropzone",
|
|
17
17
|
"item",
|
|
@@ -41,7 +41,7 @@ var getRootEl = (ctx) => ctx.getById(getRootId(ctx));
|
|
|
41
41
|
var getHiddenInputEl = (ctx) => ctx.getById(getHiddenInputId(ctx));
|
|
42
42
|
var getDropzoneEl = (ctx) => ctx.getById(getDropzoneId(ctx));
|
|
43
43
|
function isEventWithFiles(event) {
|
|
44
|
-
const target = index$
|
|
44
|
+
const target = index$1.getEventTarget(event);
|
|
45
45
|
if (!event.dataTransfer) return !!target && "files" in target;
|
|
46
46
|
return event.dataTransfer.types.some((type) => {
|
|
47
47
|
return type === "Files" || type === "application/x-moz-file";
|
|
@@ -63,8 +63,8 @@ function getEventFiles(ctx, files, currentAcceptedFiles = [], currentRejectedFil
|
|
|
63
63
|
rejectedFiles: currentRejectedFiles
|
|
64
64
|
};
|
|
65
65
|
files.forEach((file) => {
|
|
66
|
-
const [accepted, acceptError] = index$
|
|
67
|
-
const [sizeMatch, sizeError] = index$
|
|
66
|
+
const [accepted, acceptError] = index$2.isValidFileType(file, computed("acceptAttr"));
|
|
67
|
+
const [sizeMatch, sizeError] = index$2.isValidFileSize(file, prop("minFileSize"), prop("maxFileSize"));
|
|
68
68
|
const validateErrors = prop("validate")?.(file, validateParams);
|
|
69
69
|
const valid = validateErrors ? validateErrors.length === 0 : true;
|
|
70
70
|
if (accepted && sizeMatch && valid) {
|
|
@@ -87,7 +87,7 @@ function getEventFiles(ctx, files, currentAcceptedFiles = [], currentRejectedFil
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
function setInputFiles(inputEl, files) {
|
|
90
|
-
const win = index$
|
|
90
|
+
const win = index$1.getWindow(inputEl);
|
|
91
91
|
try {
|
|
92
92
|
if ("DataTransfer" in win) {
|
|
93
93
|
const dataTransfer = new win.DataTransfer();
|
|
@@ -106,7 +106,7 @@ var INTERACTIVE_SELECTOR = "button, a[href], input:not([type='file']), select, t
|
|
|
106
106
|
function isInteractiveTarget(element, container) {
|
|
107
107
|
if (!element || element.getAttribute("type") === "file") return false;
|
|
108
108
|
const interactive = element.closest(INTERACTIVE_SELECTOR);
|
|
109
|
-
return interactive != container && index$
|
|
109
|
+
return interactive != container && index$1.contains(container, interactive);
|
|
110
110
|
}
|
|
111
111
|
function connect(service, normalize) {
|
|
112
112
|
const { state, send, prop, computed, scope, context } = service;
|
|
@@ -140,7 +140,7 @@ function connect(service, normalize) {
|
|
|
140
140
|
send({ type: "FILES.CLEAR" });
|
|
141
141
|
},
|
|
142
142
|
getFileSize(file) {
|
|
143
|
-
return index$
|
|
143
|
+
return index$4.formatBytes(file.size, prop("locale"));
|
|
144
144
|
},
|
|
145
145
|
createFileUrl(file, cb) {
|
|
146
146
|
const win = scope.getWin();
|
|
@@ -166,8 +166,8 @@ function connect(service, normalize) {
|
|
|
166
166
|
...parts.root.attrs,
|
|
167
167
|
dir: prop("dir"),
|
|
168
168
|
id: getRootId(scope),
|
|
169
|
-
"data-disabled": index$
|
|
170
|
-
"data-dragging": index$
|
|
169
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
170
|
+
"data-dragging": index$1.dataAttr(dragging)
|
|
171
171
|
});
|
|
172
172
|
},
|
|
173
173
|
getDropzoneProps(props2 = {}) {
|
|
@@ -179,14 +179,14 @@ function connect(service, normalize) {
|
|
|
179
179
|
role: props2.disableClick ? "application" : "button",
|
|
180
180
|
"aria-label": translations.dropzone,
|
|
181
181
|
"aria-disabled": disabled,
|
|
182
|
-
"data-invalid": index$
|
|
183
|
-
"data-disabled": index$
|
|
184
|
-
"data-dragging": index$
|
|
182
|
+
"data-invalid": index$1.dataAttr(prop("invalid")),
|
|
183
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
184
|
+
"data-dragging": index$1.dataAttr(dragging),
|
|
185
185
|
onKeyDown(event) {
|
|
186
186
|
if (disabled) return;
|
|
187
187
|
if (event.defaultPrevented) return;
|
|
188
|
-
const target = index$
|
|
189
|
-
if (!index$
|
|
188
|
+
const target = index$1.getEventTarget(event);
|
|
189
|
+
if (!index$1.contains(event.currentTarget, target)) return;
|
|
190
190
|
if (isInteractiveTarget(target, event.currentTarget)) return;
|
|
191
191
|
if (props2.disableClick) return;
|
|
192
192
|
if (event.key !== "Enter" && event.key !== " ") return;
|
|
@@ -196,8 +196,8 @@ function connect(service, normalize) {
|
|
|
196
196
|
if (disabled) return;
|
|
197
197
|
if (event.defaultPrevented) return;
|
|
198
198
|
if (props2.disableClick) return;
|
|
199
|
-
const target = index$
|
|
200
|
-
if (!index$
|
|
199
|
+
const target = index$1.getEventTarget(event);
|
|
200
|
+
if (!index$1.contains(event.currentTarget, target)) return;
|
|
201
201
|
if (isInteractiveTarget(target, event.currentTarget)) return;
|
|
202
202
|
if (event.currentTarget.localName === "label") {
|
|
203
203
|
event.preventDefault();
|
|
@@ -221,7 +221,7 @@ function connect(service, normalize) {
|
|
|
221
221
|
onDragLeave(event) {
|
|
222
222
|
if (disabled) return;
|
|
223
223
|
if (!allowDrop) return;
|
|
224
|
-
if (index$
|
|
224
|
+
if (index$1.contains(event.currentTarget, event.relatedTarget)) return;
|
|
225
225
|
send({ type: "DROPZONE.DRAG_LEAVE" });
|
|
226
226
|
},
|
|
227
227
|
onDrop(event) {
|
|
@@ -232,8 +232,8 @@ function connect(service, normalize) {
|
|
|
232
232
|
}
|
|
233
233
|
const hasFiles = isEventWithFiles(event);
|
|
234
234
|
if (disabled || !hasFiles) return;
|
|
235
|
-
index$
|
|
236
|
-
send({ type: "DROPZONE.DROP", files: index$
|
|
235
|
+
index$2.getFileEntries(event.dataTransfer.items, prop("directory")).then((files) => {
|
|
236
|
+
send({ type: "DROPZONE.DROP", files: index$3.flatArray(files) });
|
|
237
237
|
});
|
|
238
238
|
},
|
|
239
239
|
onFocus() {
|
|
@@ -252,12 +252,12 @@ function connect(service, normalize) {
|
|
|
252
252
|
dir: prop("dir"),
|
|
253
253
|
id: getTriggerId(scope),
|
|
254
254
|
disabled,
|
|
255
|
-
"data-disabled": index$
|
|
256
|
-
"data-invalid": index$
|
|
255
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
256
|
+
"data-invalid": index$1.dataAttr(prop("invalid")),
|
|
257
257
|
type: "button",
|
|
258
258
|
onClick(event) {
|
|
259
259
|
if (disabled) return;
|
|
260
|
-
if (index$
|
|
260
|
+
if (index$1.contains(getDropzoneEl(scope), event.currentTarget)) {
|
|
261
261
|
event.stopPropagation();
|
|
262
262
|
}
|
|
263
263
|
send({ type: "OPEN" });
|
|
@@ -285,7 +285,7 @@ function connect(service, normalize) {
|
|
|
285
285
|
const { files } = event.currentTarget;
|
|
286
286
|
send({ type: "FILE.SELECT", files: files ? Array.from(files) : [] });
|
|
287
287
|
},
|
|
288
|
-
style: index$
|
|
288
|
+
style: index$1.visuallyHiddenStyle
|
|
289
289
|
});
|
|
290
290
|
},
|
|
291
291
|
getItemGroupProps(props2 = {}) {
|
|
@@ -293,7 +293,7 @@ function connect(service, normalize) {
|
|
|
293
293
|
return normalize.element({
|
|
294
294
|
...parts.itemGroup.attrs,
|
|
295
295
|
dir: prop("dir"),
|
|
296
|
-
"data-disabled": index$
|
|
296
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
297
297
|
"data-type": type
|
|
298
298
|
});
|
|
299
299
|
},
|
|
@@ -303,7 +303,7 @@ function connect(service, normalize) {
|
|
|
303
303
|
...parts.item.attrs,
|
|
304
304
|
dir: prop("dir"),
|
|
305
305
|
id: getItemId(scope, file.name),
|
|
306
|
-
"data-disabled": index$
|
|
306
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
307
307
|
"data-type": type
|
|
308
308
|
});
|
|
309
309
|
},
|
|
@@ -313,7 +313,7 @@ function connect(service, normalize) {
|
|
|
313
313
|
...parts.itemName.attrs,
|
|
314
314
|
dir: prop("dir"),
|
|
315
315
|
id: getItemNameId(scope, file.name),
|
|
316
|
-
"data-disabled": index$
|
|
316
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
317
317
|
"data-type": type
|
|
318
318
|
});
|
|
319
319
|
},
|
|
@@ -323,7 +323,7 @@ function connect(service, normalize) {
|
|
|
323
323
|
...parts.itemSizeText.attrs,
|
|
324
324
|
dir: prop("dir"),
|
|
325
325
|
id: getItemSizeTextId(scope, file.name),
|
|
326
|
-
"data-disabled": index$
|
|
326
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
327
327
|
"data-type": type
|
|
328
328
|
});
|
|
329
329
|
},
|
|
@@ -333,7 +333,7 @@ function connect(service, normalize) {
|
|
|
333
333
|
...parts.itemPreview.attrs,
|
|
334
334
|
dir: prop("dir"),
|
|
335
335
|
id: getItemPreviewId(scope, file.name),
|
|
336
|
-
"data-disabled": index$
|
|
336
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
337
337
|
"data-type": type
|
|
338
338
|
});
|
|
339
339
|
},
|
|
@@ -347,7 +347,7 @@ function connect(service, normalize) {
|
|
|
347
347
|
...parts.itemPreviewImage.attrs,
|
|
348
348
|
alt: translations.itemPreview?.(file),
|
|
349
349
|
src: url,
|
|
350
|
-
"data-disabled": index$
|
|
350
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
351
351
|
"data-type": type
|
|
352
352
|
});
|
|
353
353
|
},
|
|
@@ -358,7 +358,7 @@ function connect(service, normalize) {
|
|
|
358
358
|
dir: prop("dir"),
|
|
359
359
|
type: "button",
|
|
360
360
|
disabled,
|
|
361
|
-
"data-disabled": index$
|
|
361
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
362
362
|
"data-type": type,
|
|
363
363
|
"aria-label": translations.deleteFile?.(file),
|
|
364
364
|
onClick() {
|
|
@@ -373,8 +373,8 @@ function connect(service, normalize) {
|
|
|
373
373
|
dir: prop("dir"),
|
|
374
374
|
id: getLabelId(scope),
|
|
375
375
|
htmlFor: getHiddenInputId(scope),
|
|
376
|
-
"data-disabled": index$
|
|
377
|
-
"data-required": index$
|
|
376
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
377
|
+
"data-required": index$1.dataAttr(required)
|
|
378
378
|
});
|
|
379
379
|
},
|
|
380
380
|
getClearTriggerProps() {
|
|
@@ -384,7 +384,7 @@ function connect(service, normalize) {
|
|
|
384
384
|
type: "button",
|
|
385
385
|
disabled,
|
|
386
386
|
hidden: context.get("acceptedFiles").length === 0,
|
|
387
|
-
"data-disabled": index$
|
|
387
|
+
"data-disabled": index$1.dataAttr(disabled),
|
|
388
388
|
onClick(event) {
|
|
389
389
|
if (event.defaultPrevented) return;
|
|
390
390
|
if (disabled) return;
|
|
@@ -420,7 +420,7 @@ var machine = index.createMachine({
|
|
|
420
420
|
acceptedFiles: bindable(() => ({
|
|
421
421
|
defaultValue: prop("defaultAcceptedFiles"),
|
|
422
422
|
value: prop("acceptedFiles"),
|
|
423
|
-
isEqual: (a, b) => a.length === b?.length && a.every((file, i) => index$
|
|
423
|
+
isEqual: (a, b) => a.length === b?.length && a.every((file, i) => index$2.isFileEqual(file, b[i])),
|
|
424
424
|
hash(value) {
|
|
425
425
|
return value.map((file) => `${file.name}-${file.size}`).join(",");
|
|
426
426
|
},
|
|
@@ -432,7 +432,7 @@ var machine = index.createMachine({
|
|
|
432
432
|
})),
|
|
433
433
|
rejectedFiles: bindable(() => ({
|
|
434
434
|
defaultValue: [],
|
|
435
|
-
isEqual: (a, b) => a.length === b?.length && a.every((file, i) => index$
|
|
435
|
+
isEqual: (a, b) => a.length === b?.length && a.every((file, i) => index$2.isFileEqual(file.file, b[i].file)),
|
|
436
436
|
onChange(value) {
|
|
437
437
|
const ctx = getContext();
|
|
438
438
|
prop("onFileReject")?.({ files: value });
|
|
@@ -445,7 +445,7 @@ var machine = index.createMachine({
|
|
|
445
445
|
};
|
|
446
446
|
},
|
|
447
447
|
computed: {
|
|
448
|
-
acceptAttr: ({ prop }) => index$
|
|
448
|
+
acceptAttr: ({ prop }) => index$2.getAcceptAttrString(prop("accept")),
|
|
449
449
|
multiple: ({ prop }) => prop("maxFiles") > 1
|
|
450
450
|
},
|
|
451
451
|
watch({ track, context, action }) {
|
|
@@ -527,10 +527,10 @@ var machine = index.createMachine({
|
|
|
527
527
|
event?.preventDefault();
|
|
528
528
|
};
|
|
529
529
|
const onDrop = (event) => {
|
|
530
|
-
if (index$
|
|
530
|
+
if (index$1.contains(getRootEl(scope), index$1.getEventTarget(event))) return;
|
|
531
531
|
event.preventDefault();
|
|
532
532
|
};
|
|
533
|
-
return index$
|
|
533
|
+
return index$3.callAll(index$1.addDomEvent(doc, "dragover", onDragOver, false), index$1.addDomEvent(doc, "drop", onDrop, false));
|
|
534
534
|
}
|
|
535
535
|
},
|
|
536
536
|
actions: {
|
|
@@ -544,7 +544,7 @@ var machine = index.createMachine({
|
|
|
544
544
|
});
|
|
545
545
|
},
|
|
546
546
|
openFilePicker({ scope }) {
|
|
547
|
-
index$
|
|
547
|
+
index$1.raf(() => {
|
|
548
548
|
getHiddenInputEl(scope)?.click();
|
|
549
549
|
});
|
|
550
550
|
},
|
|
@@ -587,7 +587,7 @@ var machine = index.createMachine({
|
|
|
587
587
|
if (transform) {
|
|
588
588
|
context.set("transforming", true);
|
|
589
589
|
transform(acceptedFiles).then(set).catch((err) => {
|
|
590
|
-
index$
|
|
590
|
+
index$3.warn(`[zag-js/file-upload] error transforming files
|
|
591
591
|
${err}`);
|
|
592
592
|
}).finally(() => {
|
|
593
593
|
context.set("transforming", false);
|
|
@@ -598,10 +598,10 @@ ${err}`);
|
|
|
598
598
|
},
|
|
599
599
|
removeFile({ context, event }) {
|
|
600
600
|
if (event.itemType === "rejected") {
|
|
601
|
-
const rejectedFiles = context.get("rejectedFiles").filter((item) => !index$
|
|
601
|
+
const rejectedFiles = context.get("rejectedFiles").filter((item) => !index$2.isFileEqual(item.file, event.file));
|
|
602
602
|
context.set("rejectedFiles", rejectedFiles);
|
|
603
603
|
} else {
|
|
604
|
-
const files = context.get("acceptedFiles").filter((file) => !index$
|
|
604
|
+
const files = context.get("acceptedFiles").filter((file) => !index$2.isFileEqual(file, event.file));
|
|
605
605
|
context.set("acceptedFiles", files);
|
|
606
606
|
}
|
|
607
607
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createAnatomy } from '../../../../../@zag-js_anatomy@1.31.1/node_modules/@zag-js/anatomy/dist/index.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { dataAttr, visuallyHiddenStyle, contains, getEventTarget, raf, addDomEvent, getWindow } from '../../../../../@zag-js_dom-query@1.31.1/node_modules/@zag-js/dom-query/dist/index.js';
|
|
3
|
+
import { getFileEntries, isFileEqual, getAcceptAttrString, isValidFileType, isValidFileSize } from '../../../../../@zag-js_file-utils@1.31.1/node_modules/@zag-js/file-utils/dist/index.js';
|
|
4
4
|
import { formatBytes } from '../../../../../@zag-js_i18n-utils@1.31.1/node_modules/@zag-js/i18n-utils/dist/index.js';
|
|
5
5
|
import { createProps } from '../../../../../@zag-js_types@1.31.1/node_modules/@zag-js/types/dist/index.js';
|
|
6
|
-
import { warn, callAll
|
|
6
|
+
import { flatArray, warn, callAll } from '../../../../../@zag-js_utils@1.31.1/node_modules/@zag-js/utils/dist/index.js';
|
|
7
7
|
import { createMachine } from '../../../../../@zag-js_core@1.31.1/node_modules/@zag-js/core/dist/index.js';
|
|
8
8
|
|
|
9
9
|
// src/file-upload.anatomy.ts
|