@nation-a/ui 0.9.1 → 0.10.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 +1807 -497
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1809 -499
- package/dist/index.js.map +1 -1
- package/dist/styled-system/styles.css +176 -78
- package/dist/styled-system/tokens/index.mjs +76 -16
- package/dist/styled-system/tokens/tokens.d.ts +3 -3
- package/dist/styled-system/types/prop-type.d.ts +1 -1
- package/dist/types/components/BottomSheet/BottomSheet.stories.d.ts +6 -0
- package/dist/types/components/Button/button.recipe.d.ts +2 -1
- package/dist/types/components/Dialog/dialog.recipe.d.ts +2 -1
- package/dist/types/components/IconButton/icon-button.recipe.d.ts +2 -1
- package/dist/types/components/Input/index.d.ts +2 -8
- package/dist/types/components/Input/input.recipe.d.ts +74 -53
- package/dist/types/components/Navigation/navigation.recipe.d.ts +2 -1
- package/dist/types/components/Spinner/index.d.ts +273 -5
- package/dist/types/components/Spinner/spinner.recipe.d.ts +2 -1
- package/dist/types/components/Tabs/tabs.recipe.d.ts +2 -1
- package/dist/types/components/Tag/index.d.ts +2 -1
- package/dist/types/components/Tag/tag.recipe.d.ts +2 -1
- package/dist/types/components/Text/index.d.ts +273 -1
- package/dist/types/components/Text/text.recipe.d.ts +2 -1
- package/dist/types/components/TextArea/index.d.ts +2 -2
- package/dist/types/components/Toast/Toast.stories.d.ts +9 -0
- package/dist/types/components/Toast/index.d.ts +29 -0
- package/dist/types/components/Toast/toast.recipe.d.ts +24 -0
- package/dist/types/contexts/ToastProvider.d.ts +9 -0
- package/dist/types/contexts/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/toast.d.ts +53 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -790,12 +790,23 @@ var isString = (v2) => typeof v2 === "string";
|
|
|
790
790
|
var isFunction = (v2) => typeof v2 === "function";
|
|
791
791
|
var fnToString = Function.prototype.toString;
|
|
792
792
|
fnToString.call(Object);
|
|
793
|
+
var runIfFn = (v2, ...a) => {
|
|
794
|
+
const res = typeof v2 === "function" ? v2(...a) : v2;
|
|
795
|
+
return res ?? void 0;
|
|
796
|
+
};
|
|
793
797
|
var identity = (v2) => v2();
|
|
794
798
|
var callAll = (...fns2) => (...a) => {
|
|
795
799
|
fns2.forEach(function(fn) {
|
|
796
800
|
fn == null ? void 0 : fn(...a);
|
|
797
801
|
});
|
|
798
802
|
};
|
|
803
|
+
var uuid = /* @__PURE__ */ (() => {
|
|
804
|
+
let id = 0;
|
|
805
|
+
return () => {
|
|
806
|
+
id++;
|
|
807
|
+
return id.toString(36);
|
|
808
|
+
};
|
|
809
|
+
})();
|
|
799
810
|
function compact(obj) {
|
|
800
811
|
if (!isPlainObject2(obj) || obj === void 0) return obj;
|
|
801
812
|
const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
|
|
@@ -811,6 +822,19 @@ function compact(obj) {
|
|
|
811
822
|
var isPlainObject2 = (v2) => {
|
|
812
823
|
return v2 && typeof v2 === "object" && v2.constructor === Object;
|
|
813
824
|
};
|
|
825
|
+
function setRafTimeout(callback, delay2) {
|
|
826
|
+
const start2 = performance.now();
|
|
827
|
+
let handle;
|
|
828
|
+
function loop2(now) {
|
|
829
|
+
handle = requestAnimationFrame(loop2);
|
|
830
|
+
const delta = now - start2;
|
|
831
|
+
if (delta >= delay2) {
|
|
832
|
+
callback();
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
handle = requestAnimationFrame(loop2);
|
|
836
|
+
return () => cancelAnimationFrame(handle);
|
|
837
|
+
}
|
|
814
838
|
function warn(...a) {
|
|
815
839
|
const m2 = a.length === 1 ? a[0] : a[1];
|
|
816
840
|
const c = a.length === 2 ? a[0] : true;
|
|
@@ -821,7 +845,16 @@ function warn(...a) {
|
|
|
821
845
|
function ensure(c, m2) {
|
|
822
846
|
if (c == null) throw new Error(m2);
|
|
823
847
|
}
|
|
848
|
+
function ensureProps(props, keys, scope) {
|
|
849
|
+
let missingKeys = [];
|
|
850
|
+
for (const key of keys) {
|
|
851
|
+
if (props[key] == null) missingKeys.push(key);
|
|
852
|
+
}
|
|
853
|
+
if (missingKeys.length > 0)
|
|
854
|
+
throw new Error(`[zag-js${` > ${scope}`}] missing required props: ${missingKeys.join(", ")}`);
|
|
855
|
+
}
|
|
824
856
|
var isObject = (v2) => typeof v2 === "object" && v2 !== null;
|
|
857
|
+
var MAX_Z_INDEX = 2147483647;
|
|
825
858
|
var dataAttr = (guard) => guard ? "" : void 0;
|
|
826
859
|
var ELEMENT_NODE = 1;
|
|
827
860
|
var DOCUMENT_NODE = 9;
|
|
@@ -2096,6 +2129,27 @@ function trackDismissableElement(nodeOrFn, options) {
|
|
|
2096
2129
|
cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
2097
2130
|
};
|
|
2098
2131
|
}
|
|
2132
|
+
function trackDismissableBranch(nodeOrFn, options = {}) {
|
|
2133
|
+
const { defer } = options;
|
|
2134
|
+
const func = defer ? raf$2 : (v2) => v2();
|
|
2135
|
+
const cleanups2 = [];
|
|
2136
|
+
cleanups2.push(
|
|
2137
|
+
func(() => {
|
|
2138
|
+
const node = isFunction(nodeOrFn) ? nodeOrFn() : nodeOrFn;
|
|
2139
|
+
if (!node) {
|
|
2140
|
+
warn("[@zag-js/dismissable] branch node is `null` or `undefined`");
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
layerStack.addBranch(node);
|
|
2144
|
+
cleanups2.push(() => {
|
|
2145
|
+
layerStack.removeBranch(node);
|
|
2146
|
+
});
|
|
2147
|
+
})
|
|
2148
|
+
);
|
|
2149
|
+
return () => {
|
|
2150
|
+
cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
2099
2153
|
const [RenderStrategyPropsProvider, useRenderStrategyPropsContext] = createContext({
|
|
2100
2154
|
name: "RenderStrategyContext",
|
|
2101
2155
|
hookName: "useRenderStrategyContext",
|
|
@@ -2129,7 +2183,7 @@ const [PresenceProvider, usePresenceContext] = createContext({
|
|
|
2129
2183
|
providerName: "<PresenceProvider />"
|
|
2130
2184
|
});
|
|
2131
2185
|
const splitPresenceProps = (props) => createSplitProps()(props, ["immediate", "lazyMount", "onExitComplete", "present", "unmountOnExit"]);
|
|
2132
|
-
function connect$
|
|
2186
|
+
function connect$3(service, _normalize) {
|
|
2133
2187
|
const { state, send, context: context2 } = service;
|
|
2134
2188
|
const present = state.matches("mounted", "unmountSuspended");
|
|
2135
2189
|
return {
|
|
@@ -2144,7 +2198,7 @@ function connect$2(service, _normalize) {
|
|
|
2144
2198
|
}
|
|
2145
2199
|
};
|
|
2146
2200
|
}
|
|
2147
|
-
var machine$
|
|
2201
|
+
var machine$3 = createMachine({
|
|
2148
2202
|
props({ props: props2 }) {
|
|
2149
2203
|
return { ...props2, present: !!props2.present };
|
|
2150
2204
|
},
|
|
@@ -2311,8 +2365,8 @@ const usePresence = (props = {}) => {
|
|
|
2311
2365
|
present,
|
|
2312
2366
|
onExitComplete: useEvent(props.onExitComplete)
|
|
2313
2367
|
};
|
|
2314
|
-
const service = useMachine(machine$
|
|
2315
|
-
const api = connect$
|
|
2368
|
+
const service = useMachine(machine$3, machineProps);
|
|
2369
|
+
const api = connect$3(service);
|
|
2316
2370
|
if (api.present) {
|
|
2317
2371
|
wasEverPresent.current = true;
|
|
2318
2372
|
}
|
|
@@ -2928,7 +2982,7 @@ var FocusTrap = class {
|
|
|
2928
2982
|
nextTabbableNode
|
|
2929
2983
|
};
|
|
2930
2984
|
});
|
|
2931
|
-
this.state.tabbableGroups = this.state.containerGroups.filter((
|
|
2985
|
+
this.state.tabbableGroups = this.state.containerGroups.filter((group2) => group2.tabbableNodes.length > 0);
|
|
2932
2986
|
if (this.state.tabbableGroups.length <= 0 && !this.getNodeForOption("fallbackFocus")) {
|
|
2933
2987
|
throw new Error(
|
|
2934
2988
|
"Your focus-trap must have at least one container with at least one tabbable node in it at all times"
|
|
@@ -3091,7 +3145,7 @@ function preventBodyScroll(_document) {
|
|
|
3091
3145
|
body.removeAttribute(LOCK_CLASSNAME);
|
|
3092
3146
|
};
|
|
3093
3147
|
}
|
|
3094
|
-
var anatomy$
|
|
3148
|
+
var anatomy$2 = createAnatomy("dialog").parts(
|
|
3095
3149
|
"trigger",
|
|
3096
3150
|
"backdrop",
|
|
3097
3151
|
"positioner",
|
|
@@ -3100,7 +3154,7 @@ var anatomy$1 = createAnatomy("dialog").parts(
|
|
|
3100
3154
|
"description",
|
|
3101
3155
|
"closeTrigger"
|
|
3102
3156
|
);
|
|
3103
|
-
var parts$
|
|
3157
|
+
var parts$2 = anatomy$2.build();
|
|
3104
3158
|
var getPositionerId = (ctx2) => {
|
|
3105
3159
|
var _a;
|
|
3106
3160
|
return ((_a = ctx2.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx2.id}:positioner`;
|
|
@@ -3117,15 +3171,15 @@ var getTriggerId$1 = (ctx2) => {
|
|
|
3117
3171
|
var _a;
|
|
3118
3172
|
return ((_a = ctx2.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx2.id}:trigger`;
|
|
3119
3173
|
};
|
|
3120
|
-
var getTitleId = (ctx2) => {
|
|
3174
|
+
var getTitleId$1 = (ctx2) => {
|
|
3121
3175
|
var _a;
|
|
3122
3176
|
return ((_a = ctx2.ids) == null ? void 0 : _a.title) ?? `dialog:${ctx2.id}:title`;
|
|
3123
3177
|
};
|
|
3124
|
-
var getDescriptionId = (ctx2) => {
|
|
3178
|
+
var getDescriptionId$1 = (ctx2) => {
|
|
3125
3179
|
var _a;
|
|
3126
3180
|
return ((_a = ctx2.ids) == null ? void 0 : _a.description) ?? `dialog:${ctx2.id}:description`;
|
|
3127
3181
|
};
|
|
3128
|
-
var getCloseTriggerId = (ctx2) => {
|
|
3182
|
+
var getCloseTriggerId$1 = (ctx2) => {
|
|
3129
3183
|
var _a;
|
|
3130
3184
|
return ((_a = ctx2.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx2.id}:close`;
|
|
3131
3185
|
};
|
|
@@ -3133,10 +3187,10 @@ var getContentEl$1 = (ctx2) => ctx2.getById(getContentId$1(ctx2));
|
|
|
3133
3187
|
var getPositionerEl = (ctx2) => ctx2.getById(getPositionerId(ctx2));
|
|
3134
3188
|
var getBackdropEl = (ctx2) => ctx2.getById(getBackdropId(ctx2));
|
|
3135
3189
|
var getTriggerEl$1 = (ctx2) => ctx2.getById(getTriggerId$1(ctx2));
|
|
3136
|
-
var getTitleEl = (ctx2) => ctx2.getById(getTitleId(ctx2));
|
|
3137
|
-
var getDescriptionEl = (ctx2) => ctx2.getById(getDescriptionId(ctx2));
|
|
3138
|
-
var getCloseTriggerEl = (ctx2) => ctx2.getById(getCloseTriggerId(ctx2));
|
|
3139
|
-
function connect$
|
|
3190
|
+
var getTitleEl = (ctx2) => ctx2.getById(getTitleId$1(ctx2));
|
|
3191
|
+
var getDescriptionEl = (ctx2) => ctx2.getById(getDescriptionId$1(ctx2));
|
|
3192
|
+
var getCloseTriggerEl = (ctx2) => ctx2.getById(getCloseTriggerId$1(ctx2));
|
|
3193
|
+
function connect$2(service, normalize) {
|
|
3140
3194
|
const { state, send, context: context2, prop, scope } = service;
|
|
3141
3195
|
const ariaLabel = prop("aria-label");
|
|
3142
3196
|
const open = state.matches("open");
|
|
@@ -3149,7 +3203,7 @@ function connect$1(service, normalize) {
|
|
|
3149
3203
|
},
|
|
3150
3204
|
getTriggerProps() {
|
|
3151
3205
|
return normalize.button({
|
|
3152
|
-
...parts$
|
|
3206
|
+
...parts$2.trigger.attrs,
|
|
3153
3207
|
dir: prop("dir"),
|
|
3154
3208
|
id: getTriggerId$1(scope),
|
|
3155
3209
|
"aria-haspopup": "dialog",
|
|
@@ -3165,7 +3219,7 @@ function connect$1(service, normalize) {
|
|
|
3165
3219
|
},
|
|
3166
3220
|
getBackdropProps() {
|
|
3167
3221
|
return normalize.element({
|
|
3168
|
-
...parts$
|
|
3222
|
+
...parts$2.backdrop.attrs,
|
|
3169
3223
|
dir: prop("dir"),
|
|
3170
3224
|
hidden: !open,
|
|
3171
3225
|
id: getBackdropId(scope),
|
|
@@ -3174,7 +3228,7 @@ function connect$1(service, normalize) {
|
|
|
3174
3228
|
},
|
|
3175
3229
|
getPositionerProps() {
|
|
3176
3230
|
return normalize.element({
|
|
3177
|
-
...parts$
|
|
3231
|
+
...parts$2.positioner.attrs,
|
|
3178
3232
|
dir: prop("dir"),
|
|
3179
3233
|
id: getPositionerId(scope),
|
|
3180
3234
|
style: {
|
|
@@ -3185,7 +3239,7 @@ function connect$1(service, normalize) {
|
|
|
3185
3239
|
getContentProps() {
|
|
3186
3240
|
const rendered = context2.get("rendered");
|
|
3187
3241
|
return normalize.element({
|
|
3188
|
-
...parts$
|
|
3242
|
+
...parts$2.content.attrs,
|
|
3189
3243
|
dir: prop("dir"),
|
|
3190
3244
|
role: prop("role"),
|
|
3191
3245
|
hidden: !open,
|
|
@@ -3194,29 +3248,29 @@ function connect$1(service, normalize) {
|
|
|
3194
3248
|
"data-state": open ? "open" : "closed",
|
|
3195
3249
|
"aria-modal": true,
|
|
3196
3250
|
"aria-label": ariaLabel || void 0,
|
|
3197
|
-
"aria-labelledby": ariaLabel || !rendered.title ? void 0 : getTitleId(scope),
|
|
3198
|
-
"aria-describedby": rendered.description ? getDescriptionId(scope) : void 0
|
|
3251
|
+
"aria-labelledby": ariaLabel || !rendered.title ? void 0 : getTitleId$1(scope),
|
|
3252
|
+
"aria-describedby": rendered.description ? getDescriptionId$1(scope) : void 0
|
|
3199
3253
|
});
|
|
3200
3254
|
},
|
|
3201
3255
|
getTitleProps() {
|
|
3202
3256
|
return normalize.element({
|
|
3203
|
-
...parts$
|
|
3257
|
+
...parts$2.title.attrs,
|
|
3204
3258
|
dir: prop("dir"),
|
|
3205
|
-
id: getTitleId(scope)
|
|
3259
|
+
id: getTitleId$1(scope)
|
|
3206
3260
|
});
|
|
3207
3261
|
},
|
|
3208
3262
|
getDescriptionProps() {
|
|
3209
3263
|
return normalize.element({
|
|
3210
|
-
...parts$
|
|
3264
|
+
...parts$2.description.attrs,
|
|
3211
3265
|
dir: prop("dir"),
|
|
3212
|
-
id: getDescriptionId(scope)
|
|
3266
|
+
id: getDescriptionId$1(scope)
|
|
3213
3267
|
});
|
|
3214
3268
|
},
|
|
3215
3269
|
getCloseTriggerProps() {
|
|
3216
3270
|
return normalize.button({
|
|
3217
|
-
...parts$
|
|
3271
|
+
...parts$2.closeTrigger.attrs,
|
|
3218
3272
|
dir: prop("dir"),
|
|
3219
|
-
id: getCloseTriggerId(scope),
|
|
3273
|
+
id: getCloseTriggerId$1(scope),
|
|
3220
3274
|
type: "button",
|
|
3221
3275
|
onClick(event) {
|
|
3222
3276
|
if (event.defaultPrevented) return;
|
|
@@ -3227,7 +3281,7 @@ function connect$1(service, normalize) {
|
|
|
3227
3281
|
}
|
|
3228
3282
|
};
|
|
3229
3283
|
}
|
|
3230
|
-
var machine$
|
|
3284
|
+
var machine$2 = createMachine({
|
|
3231
3285
|
props({ props: props2, scope }) {
|
|
3232
3286
|
const alertDialog = props2.role === "alertdialog";
|
|
3233
3287
|
const initialFocusEl = alertDialog ? () => getCloseTriggerEl(scope) : void 0;
|
|
@@ -3446,8 +3500,8 @@ const useDialog = (props) => {
|
|
|
3446
3500
|
dir,
|
|
3447
3501
|
...props
|
|
3448
3502
|
};
|
|
3449
|
-
const service = useMachine(machine$
|
|
3450
|
-
return connect$
|
|
3503
|
+
const service = useMachine(machine$2, machineProps);
|
|
3504
|
+
return connect$2(service, normalizeProps);
|
|
3451
3505
|
};
|
|
3452
3506
|
const DialogRoot = (props) => {
|
|
3453
3507
|
const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
|
|
@@ -3521,9 +3575,9 @@ const TabTrigger = React.forwardRef((props, ref) => {
|
|
|
3521
3575
|
return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
|
|
3522
3576
|
});
|
|
3523
3577
|
TabTrigger.displayName = "TabTrigger";
|
|
3524
|
-
var anatomy = createAnatomy("tabs").parts("root", "list", "trigger", "content", "indicator");
|
|
3525
|
-
var parts = anatomy.build();
|
|
3526
|
-
var getRootId = (ctx2) => {
|
|
3578
|
+
var anatomy$1 = createAnatomy("tabs").parts("root", "list", "trigger", "content", "indicator");
|
|
3579
|
+
var parts$1 = anatomy$1.build();
|
|
3580
|
+
var getRootId$1 = (ctx2) => {
|
|
3527
3581
|
var _a;
|
|
3528
3582
|
return ((_a = ctx2.ids) == null ? void 0 : _a.root) ?? `tabs:${ctx2.id}`;
|
|
3529
3583
|
};
|
|
@@ -3574,7 +3628,7 @@ var resolveRect = (rect) => ({
|
|
|
3574
3628
|
left: `${rect.left}px`,
|
|
3575
3629
|
top: `${rect.top}px`
|
|
3576
3630
|
});
|
|
3577
|
-
function connect(service, normalize) {
|
|
3631
|
+
function connect$1(service, normalize) {
|
|
3578
3632
|
const { state, send, context: context2, prop, scope } = service;
|
|
3579
3633
|
const translations = prop("translations");
|
|
3580
3634
|
const focused = state.matches("focused");
|
|
@@ -3620,8 +3674,8 @@ function connect(service, normalize) {
|
|
|
3620
3674
|
},
|
|
3621
3675
|
getRootProps() {
|
|
3622
3676
|
return normalize.element({
|
|
3623
|
-
...parts.root.attrs,
|
|
3624
|
-
id: getRootId(scope),
|
|
3677
|
+
...parts$1.root.attrs,
|
|
3678
|
+
id: getRootId$1(scope),
|
|
3625
3679
|
"data-orientation": prop("orientation"),
|
|
3626
3680
|
"data-focus": dataAttr(focused),
|
|
3627
3681
|
dir: prop("dir")
|
|
@@ -3629,7 +3683,7 @@ function connect(service, normalize) {
|
|
|
3629
3683
|
},
|
|
3630
3684
|
getListProps() {
|
|
3631
3685
|
return normalize.element({
|
|
3632
|
-
...parts.list.attrs,
|
|
3686
|
+
...parts$1.list.attrs,
|
|
3633
3687
|
id: getListId(scope),
|
|
3634
3688
|
role: "tablist",
|
|
3635
3689
|
dir: prop("dir"),
|
|
@@ -3685,7 +3739,7 @@ function connect(service, normalize) {
|
|
|
3685
3739
|
const { value, disabled } = props2;
|
|
3686
3740
|
const triggerState = getTriggerState(props2);
|
|
3687
3741
|
return normalize.button({
|
|
3688
|
-
...parts.trigger.attrs,
|
|
3742
|
+
...parts$1.trigger.attrs,
|
|
3689
3743
|
role: "tab",
|
|
3690
3744
|
type: "button",
|
|
3691
3745
|
disabled,
|
|
@@ -3725,7 +3779,7 @@ function connect(service, normalize) {
|
|
|
3725
3779
|
const { value } = props2;
|
|
3726
3780
|
const selected = context2.get("value") === value;
|
|
3727
3781
|
return normalize.element({
|
|
3728
|
-
...parts.content.attrs,
|
|
3782
|
+
...parts$1.content.attrs,
|
|
3729
3783
|
dir: prop("dir"),
|
|
3730
3784
|
id: getContentId(scope, value),
|
|
3731
3785
|
tabIndex: composite ? 0 : -1,
|
|
@@ -3742,7 +3796,7 @@ function connect(service, normalize) {
|
|
|
3742
3796
|
const indicatorTransition = context2.get("indicatorTransition");
|
|
3743
3797
|
return normalize.element({
|
|
3744
3798
|
id: getIndicatorId(scope),
|
|
3745
|
-
...parts.indicator.attrs,
|
|
3799
|
+
...parts$1.indicator.attrs,
|
|
3746
3800
|
dir: prop("dir"),
|
|
3747
3801
|
"data-orientation": prop("orientation"),
|
|
3748
3802
|
style: {
|
|
@@ -3762,8 +3816,8 @@ function connect(service, normalize) {
|
|
|
3762
3816
|
}
|
|
3763
3817
|
};
|
|
3764
3818
|
}
|
|
3765
|
-
var { not } = createGuards();
|
|
3766
|
-
var machine = createMachine({
|
|
3819
|
+
var { not: not$1 } = createGuards();
|
|
3820
|
+
var machine$1 = createMachine({
|
|
3767
3821
|
props({ props: props2 }) {
|
|
3768
3822
|
return {
|
|
3769
3823
|
dir: "ltr",
|
|
@@ -3886,7 +3940,7 @@ var machine = createMachine({
|
|
|
3886
3940
|
}
|
|
3887
3941
|
],
|
|
3888
3942
|
ENTER: {
|
|
3889
|
-
guard: not("selectOnFocus"),
|
|
3943
|
+
guard: not$1("selectOnFocus"),
|
|
3890
3944
|
actions: ["selectFocusedTab"]
|
|
3891
3945
|
},
|
|
3892
3946
|
TAB_FOCUS: {
|
|
@@ -4067,8 +4121,8 @@ const useTabs = (props) => {
|
|
|
4067
4121
|
getRootNode,
|
|
4068
4122
|
...props
|
|
4069
4123
|
};
|
|
4070
|
-
const service = useMachine(machine, machineProps);
|
|
4071
|
-
return connect(service, normalizeProps);
|
|
4124
|
+
const service = useMachine(machine$1, machineProps);
|
|
4125
|
+
return connect$1(service, normalizeProps);
|
|
4072
4126
|
};
|
|
4073
4127
|
const TabsRoot = React.forwardRef((props, ref) => {
|
|
4074
4128
|
const [renderStrategyProps, tabsProps] = splitRenderStrategyProps(props);
|
|
@@ -4092,135 +4146,1218 @@ const TabsRoot = React.forwardRef((props, ref) => {
|
|
|
4092
4146
|
return /* @__PURE__ */ jsxRuntime.jsx(TabsProvider, { value: tabs, children: /* @__PURE__ */ jsxRuntime.jsx(RenderStrategyPropsProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref }) }) });
|
|
4093
4147
|
});
|
|
4094
4148
|
TabsRoot.displayName = "TabsRoot";
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4149
|
+
var anatomy = createAnatomy("toast").parts(
|
|
4150
|
+
"group",
|
|
4151
|
+
"root",
|
|
4152
|
+
"title",
|
|
4153
|
+
"description",
|
|
4154
|
+
"actionTrigger",
|
|
4155
|
+
"closeTrigger"
|
|
4156
|
+
);
|
|
4157
|
+
var parts = anatomy.build();
|
|
4158
|
+
var getRegionId = (placement) => `toast-group:${placement}`;
|
|
4159
|
+
var getRegionEl = (ctx2, placement) => ctx2.getById(`toast-group:${placement}`);
|
|
4160
|
+
var getRootId = (ctx2) => `toast:${ctx2.id}`;
|
|
4161
|
+
var getRootEl = (ctx2) => ctx2.getById(getRootId(ctx2));
|
|
4162
|
+
var getTitleId = (ctx2) => `toast:${ctx2.id}:title`;
|
|
4163
|
+
var getDescriptionId = (ctx2) => `toast:${ctx2.id}:description`;
|
|
4164
|
+
var getCloseTriggerId = (ctx2) => `toast${ctx2.id}:close`;
|
|
4165
|
+
var defaultTimeouts = {
|
|
4166
|
+
info: 5e3,
|
|
4167
|
+
error: 5e3,
|
|
4168
|
+
success: 2e3,
|
|
4169
|
+
loading: Infinity,
|
|
4170
|
+
DEFAULT: 5e3
|
|
4171
|
+
};
|
|
4172
|
+
function getToastDuration(duration, type) {
|
|
4173
|
+
return duration ?? defaultTimeouts[type] ?? defaultTimeouts.DEFAULT;
|
|
4174
|
+
}
|
|
4175
|
+
var getOffsets = (offsets) => typeof offsets === "string" ? { left: offsets, right: offsets, bottom: offsets, top: offsets } : offsets;
|
|
4176
|
+
function getGroupPlacementStyle(service, placement) {
|
|
4177
|
+
var _a;
|
|
4178
|
+
const { prop, computed, context: context2 } = service;
|
|
4179
|
+
const { offsets, gap } = prop("store").attrs;
|
|
4180
|
+
const heights = context2.get("heights");
|
|
4181
|
+
const computedOffset = getOffsets(offsets);
|
|
4182
|
+
const rtl = prop("dir") === "rtl";
|
|
4183
|
+
const computedPlacement = placement.replace("-start", rtl ? "-right" : "-left").replace("-end", rtl ? "-left" : "-right");
|
|
4184
|
+
const isRighty = computedPlacement.includes("right");
|
|
4185
|
+
const isLefty = computedPlacement.includes("left");
|
|
4186
|
+
const styles = {
|
|
4187
|
+
position: "fixed",
|
|
4188
|
+
pointerEvents: computed("count") > 0 ? void 0 : "none",
|
|
4189
|
+
display: "flex",
|
|
4190
|
+
flexDirection: "column",
|
|
4191
|
+
"--gap": `${gap}px`,
|
|
4192
|
+
"--first-height": `${((_a = heights[0]) == null ? void 0 : _a.height) || 0}px`,
|
|
4193
|
+
zIndex: MAX_Z_INDEX
|
|
4194
|
+
};
|
|
4195
|
+
let alignItems = "center";
|
|
4196
|
+
if (isRighty) alignItems = "flex-end";
|
|
4197
|
+
if (isLefty) alignItems = "flex-start";
|
|
4198
|
+
styles.alignItems = alignItems;
|
|
4199
|
+
if (computedPlacement.includes("top")) {
|
|
4200
|
+
const offset = computedOffset.top;
|
|
4201
|
+
styles.top = `max(env(safe-area-inset-top, 0px), ${offset})`;
|
|
4202
|
+
}
|
|
4203
|
+
if (computedPlacement.includes("bottom")) {
|
|
4204
|
+
const offset = computedOffset.bottom;
|
|
4205
|
+
styles.bottom = `max(env(safe-area-inset-bottom, 0px), ${offset})`;
|
|
4206
|
+
}
|
|
4207
|
+
if (!computedPlacement.includes("left")) {
|
|
4208
|
+
const offset = computedOffset.right;
|
|
4209
|
+
styles.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${offset})`;
|
|
4210
|
+
}
|
|
4211
|
+
if (!computedPlacement.includes("right")) {
|
|
4212
|
+
const offset = computedOffset.left;
|
|
4213
|
+
styles.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${offset})`;
|
|
4214
|
+
}
|
|
4215
|
+
return styles;
|
|
4216
|
+
}
|
|
4217
|
+
function getPlacementStyle(service, visible) {
|
|
4218
|
+
const { prop, context: context2, computed } = service;
|
|
4219
|
+
const parent = prop("parent");
|
|
4220
|
+
const placement = parent.computed("placement");
|
|
4221
|
+
const { gap } = parent.prop("store").attrs;
|
|
4222
|
+
const [side] = placement.split("-");
|
|
4223
|
+
const mounted = context2.get("mounted");
|
|
4224
|
+
const remainingTime = context2.get("remainingTime");
|
|
4225
|
+
const height = computed("height");
|
|
4226
|
+
const frontmost = computed("frontmost");
|
|
4227
|
+
const sibling = !frontmost;
|
|
4228
|
+
const overlap = !prop("stacked");
|
|
4229
|
+
const stacked = prop("stacked");
|
|
4230
|
+
const type = prop("type");
|
|
4231
|
+
const duration = type === "loading" ? Number.MAX_SAFE_INTEGER : remainingTime;
|
|
4232
|
+
const offset = computed("heightIndex") * gap + computed("heightBefore");
|
|
4233
|
+
const styles = {
|
|
4234
|
+
position: "absolute",
|
|
4235
|
+
pointerEvents: "auto",
|
|
4236
|
+
"--opacity": "0",
|
|
4237
|
+
"--remove-delay": `${prop("removeDelay")}ms`,
|
|
4238
|
+
"--duration": `${duration}ms`,
|
|
4239
|
+
"--initial-height": `${height}px`,
|
|
4240
|
+
"--offset": `${offset}px`,
|
|
4241
|
+
"--index": prop("index"),
|
|
4242
|
+
"--z-index": computed("zIndex"),
|
|
4243
|
+
"--lift-amount": "calc(var(--lift) * var(--gap))",
|
|
4244
|
+
"--y": "100%",
|
|
4245
|
+
"--x": "0"
|
|
4246
|
+
};
|
|
4247
|
+
const assign2 = (overrides) => Object.assign(styles, overrides);
|
|
4248
|
+
if (side === "top") {
|
|
4249
|
+
assign2({
|
|
4250
|
+
top: "0",
|
|
4251
|
+
"--sign": "-1",
|
|
4252
|
+
"--y": "-100%",
|
|
4253
|
+
"--lift": "1"
|
|
4254
|
+
});
|
|
4255
|
+
} else if (side === "bottom") {
|
|
4256
|
+
assign2({
|
|
4257
|
+
bottom: "0",
|
|
4258
|
+
"--sign": "1",
|
|
4259
|
+
"--y": "100%",
|
|
4260
|
+
"--lift": "-1"
|
|
4261
|
+
});
|
|
4262
|
+
}
|
|
4263
|
+
if (mounted) {
|
|
4264
|
+
assign2({
|
|
4265
|
+
"--y": "0",
|
|
4266
|
+
"--opacity": "1"
|
|
4267
|
+
});
|
|
4268
|
+
if (stacked) {
|
|
4269
|
+
assign2({
|
|
4270
|
+
"--y": "calc(var(--lift) * var(--offset))",
|
|
4271
|
+
"--height": "var(--initial-height)"
|
|
4272
|
+
});
|
|
4115
4273
|
}
|
|
4116
4274
|
}
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4275
|
+
if (!visible) {
|
|
4276
|
+
assign2({
|
|
4277
|
+
"--opacity": "0",
|
|
4278
|
+
pointerEvents: "none"
|
|
4279
|
+
});
|
|
4280
|
+
}
|
|
4281
|
+
if (sibling && overlap) {
|
|
4282
|
+
assign2({
|
|
4283
|
+
"--base-scale": "var(--index) * 0.05 + 1",
|
|
4284
|
+
"--y": "calc(var(--lift-amount) * var(--index))",
|
|
4285
|
+
"--scale": "calc(-1 * var(--base-scale))",
|
|
4286
|
+
"--height": "var(--first-height)"
|
|
4287
|
+
});
|
|
4288
|
+
if (!visible) {
|
|
4289
|
+
assign2({
|
|
4290
|
+
"--y": "calc(var(--sign) * 40%)"
|
|
4291
|
+
});
|
|
4131
4292
|
}
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4293
|
+
}
|
|
4294
|
+
if (sibling && stacked && !visible) {
|
|
4295
|
+
assign2({
|
|
4296
|
+
"--y": "calc(var(--lift) * var(--offset) + var(--lift) * -100%)"
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4299
|
+
if (frontmost && !visible) {
|
|
4300
|
+
assign2({
|
|
4301
|
+
"--y": "calc(var(--lift) * -100%)"
|
|
4302
|
+
});
|
|
4303
|
+
}
|
|
4304
|
+
return styles;
|
|
4305
|
+
}
|
|
4306
|
+
function getGhostBeforeStyle(service, visible) {
|
|
4307
|
+
const { computed } = service;
|
|
4308
|
+
const styles = {
|
|
4309
|
+
position: "absolute",
|
|
4310
|
+
inset: "0",
|
|
4311
|
+
scale: "1 2",
|
|
4312
|
+
pointerEvents: visible ? "none" : "auto"
|
|
4313
|
+
};
|
|
4314
|
+
const assign2 = (overrides) => Object.assign(styles, overrides);
|
|
4315
|
+
if (computed("frontmost") && !visible) {
|
|
4316
|
+
assign2({
|
|
4317
|
+
height: "calc(var(--initial-height) + 80%)"
|
|
4318
|
+
});
|
|
4319
|
+
}
|
|
4320
|
+
return styles;
|
|
4321
|
+
}
|
|
4322
|
+
function getGhostAfterStyle() {
|
|
4323
|
+
return {
|
|
4324
|
+
position: "absolute",
|
|
4325
|
+
left: "0",
|
|
4326
|
+
height: "calc(var(--gap) + 2px)",
|
|
4327
|
+
bottom: "100%",
|
|
4328
|
+
width: "100%"
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
function groupConnect(service, normalize) {
|
|
4332
|
+
const { context: context2, prop, send, refs, computed } = service;
|
|
4333
|
+
return {
|
|
4334
|
+
getCount() {
|
|
4335
|
+
return context2.get("toasts").length;
|
|
4336
|
+
},
|
|
4337
|
+
getToasts() {
|
|
4338
|
+
return context2.get("toasts");
|
|
4339
|
+
},
|
|
4340
|
+
getGroupProps(options = {}) {
|
|
4341
|
+
const { label = "Notifications" } = options;
|
|
4342
|
+
const { hotkey } = prop("store").attrs;
|
|
4343
|
+
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
4344
|
+
const placement = computed("placement");
|
|
4345
|
+
const [side, align = "center"] = placement.split("-");
|
|
4346
|
+
return normalize.element({
|
|
4347
|
+
...parts.group.attrs,
|
|
4348
|
+
dir: prop("dir"),
|
|
4349
|
+
tabIndex: -1,
|
|
4350
|
+
"aria-label": `${placement} ${label} ${hotkeyLabel}`,
|
|
4351
|
+
id: getRegionId(placement),
|
|
4352
|
+
"data-placement": placement,
|
|
4353
|
+
"data-side": side,
|
|
4354
|
+
"data-align": align,
|
|
4355
|
+
"aria-live": "polite",
|
|
4356
|
+
role: "region",
|
|
4357
|
+
style: getGroupPlacementStyle(service, placement),
|
|
4358
|
+
onMouseMove() {
|
|
4359
|
+
send({ type: "REGION.POINTER_ENTER", placement });
|
|
4360
|
+
},
|
|
4361
|
+
onMouseLeave() {
|
|
4362
|
+
send({ type: "REGION.POINTER_LEAVE", placement });
|
|
4363
|
+
},
|
|
4364
|
+
onFocus(event) {
|
|
4365
|
+
send({ type: "REGION.FOCUS", target: event.relatedTarget });
|
|
4366
|
+
},
|
|
4367
|
+
onBlur(event) {
|
|
4368
|
+
if (refs.get("isFocusWithin") && !contains(event.currentTarget, event.relatedTarget)) {
|
|
4369
|
+
queueMicrotask(() => send({ type: "REGION.BLUR" }));
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4372
|
+
});
|
|
4373
|
+
},
|
|
4374
|
+
subscribe(fn) {
|
|
4375
|
+
const store = prop("store");
|
|
4376
|
+
return store.subscribe(() => fn(context2.get("toasts")));
|
|
4155
4377
|
}
|
|
4378
|
+
};
|
|
4379
|
+
}
|
|
4380
|
+
var groupMachine = createMachine({
|
|
4381
|
+
props({ props }) {
|
|
4382
|
+
return {
|
|
4383
|
+
dir: "ltr",
|
|
4384
|
+
id: uuid(),
|
|
4385
|
+
...props,
|
|
4386
|
+
store: props.store
|
|
4387
|
+
};
|
|
4156
4388
|
},
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
size: "md",
|
|
4160
|
-
radius: "full",
|
|
4161
|
-
color: "neutral"
|
|
4389
|
+
initialState({ prop }) {
|
|
4390
|
+
return prop("store").attrs.overlap ? "overlap" : "stack";
|
|
4162
4391
|
},
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4392
|
+
refs() {
|
|
4393
|
+
return {
|
|
4394
|
+
lastFocusedEl: null,
|
|
4395
|
+
isFocusWithin: false,
|
|
4396
|
+
dismissableCleanup: void 0
|
|
4397
|
+
};
|
|
4398
|
+
},
|
|
4399
|
+
context({ bindable }) {
|
|
4400
|
+
return {
|
|
4401
|
+
toasts: bindable(() => ({
|
|
4402
|
+
defaultValue: [],
|
|
4403
|
+
sync: true,
|
|
4404
|
+
hash: (toasts) => toasts.map((t) => t.id).join(",")
|
|
4405
|
+
})),
|
|
4406
|
+
heights: bindable(() => ({
|
|
4407
|
+
defaultValue: [],
|
|
4408
|
+
sync: true
|
|
4409
|
+
}))
|
|
4410
|
+
};
|
|
4411
|
+
},
|
|
4412
|
+
computed: {
|
|
4413
|
+
count: ({ context: context2 }) => context2.get("toasts").length,
|
|
4414
|
+
overlap: ({ prop }) => prop("store").attrs.overlap,
|
|
4415
|
+
placement: ({ prop }) => prop("store").attrs.placement
|
|
4416
|
+
},
|
|
4417
|
+
effects: ["subscribeToStore", "trackDocumentVisibility", "trackHotKeyPress"],
|
|
4418
|
+
watch({ track, context: context2, action }) {
|
|
4419
|
+
track([() => context2.hash("toasts")], () => {
|
|
4420
|
+
queueMicrotask(() => {
|
|
4421
|
+
action(["collapsedIfEmpty", "setDismissableBranch"]);
|
|
4422
|
+
});
|
|
4423
|
+
});
|
|
4424
|
+
},
|
|
4425
|
+
exit: ["clearDismissableBranch", "clearLastFocusedEl"],
|
|
4426
|
+
on: {
|
|
4427
|
+
"DOC.HOTKEY": {
|
|
4428
|
+
actions: ["focusRegionEl"]
|
|
4429
|
+
},
|
|
4430
|
+
"REGION.BLUR": [
|
|
4431
|
+
{
|
|
4432
|
+
guard: "isOverlapping",
|
|
4433
|
+
target: "overlap",
|
|
4434
|
+
actions: ["collapseToasts", "resumeToasts", "restoreLastFocusedEl"]
|
|
4185
4435
|
},
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
background: "transparent",
|
|
4190
|
-
color: "content.neutral.disabled",
|
|
4191
|
-
cursor: "not-allowed",
|
|
4192
|
-
pointerEvents: "none"
|
|
4193
|
-
}
|
|
4436
|
+
{
|
|
4437
|
+
target: "stack",
|
|
4438
|
+
actions: ["resumeToasts", "restoreLastFocusedEl"]
|
|
4194
4439
|
}
|
|
4440
|
+
],
|
|
4441
|
+
"TOAST.REMOVE": {
|
|
4442
|
+
actions: ["removeToast", "removeHeight"]
|
|
4195
4443
|
},
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4444
|
+
"TOAST.PAUSE": {
|
|
4445
|
+
actions: ["pauseToasts"]
|
|
4446
|
+
}
|
|
4447
|
+
},
|
|
4448
|
+
states: {
|
|
4449
|
+
stack: {
|
|
4450
|
+
on: {
|
|
4451
|
+
"REGION.POINTER_LEAVE": [
|
|
4452
|
+
{
|
|
4453
|
+
guard: "isOverlapping",
|
|
4454
|
+
target: "overlap",
|
|
4455
|
+
actions: ["resumeToasts", "collapseToasts"]
|
|
4456
|
+
},
|
|
4457
|
+
{
|
|
4458
|
+
actions: ["resumeToasts"]
|
|
4459
|
+
}
|
|
4460
|
+
],
|
|
4461
|
+
"REGION.OVERLAP": {
|
|
4462
|
+
target: "overlap",
|
|
4463
|
+
actions: ["collapseToasts"]
|
|
4464
|
+
},
|
|
4465
|
+
"REGION.FOCUS": {
|
|
4466
|
+
actions: ["setLastFocusedEl", "pauseToasts"]
|
|
4467
|
+
},
|
|
4468
|
+
"REGION.POINTER_ENTER": {
|
|
4469
|
+
actions: ["pauseToasts"]
|
|
4470
|
+
}
|
|
4471
|
+
}
|
|
4209
4472
|
},
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
"
|
|
4217
|
-
|
|
4218
|
-
|
|
4473
|
+
overlap: {
|
|
4474
|
+
on: {
|
|
4475
|
+
"REGION.STACK": {
|
|
4476
|
+
target: "stack",
|
|
4477
|
+
actions: ["expandToasts"]
|
|
4478
|
+
},
|
|
4479
|
+
"REGION.POINTER_ENTER": {
|
|
4480
|
+
target: "stack",
|
|
4481
|
+
actions: ["pauseToasts", "expandToasts"]
|
|
4482
|
+
},
|
|
4483
|
+
"REGION.FOCUS": {
|
|
4484
|
+
target: "stack",
|
|
4485
|
+
actions: ["setLastFocusedEl", "pauseToasts", "expandToasts"]
|
|
4219
4486
|
}
|
|
4220
|
-
}
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
},
|
|
4490
|
+
implementations: {
|
|
4491
|
+
guards: {
|
|
4492
|
+
isOverlapping: ({ computed }) => computed("overlap")
|
|
4493
|
+
},
|
|
4494
|
+
effects: {
|
|
4495
|
+
subscribeToStore({ context: context2, prop }) {
|
|
4496
|
+
return prop("store").subscribe((toast2) => {
|
|
4497
|
+
if (toast2.dismiss) {
|
|
4498
|
+
context2.set("toasts", (prev) => prev.filter((t) => t.id !== toast2.id));
|
|
4499
|
+
return;
|
|
4500
|
+
}
|
|
4501
|
+
context2.set("toasts", (prev) => {
|
|
4502
|
+
const index2 = prev.findIndex((t) => t.id === toast2.id);
|
|
4503
|
+
if (index2 !== -1) {
|
|
4504
|
+
return [...prev.slice(0, index2), { ...prev[index2], ...toast2 }, ...prev.slice(index2 + 1)];
|
|
4505
|
+
}
|
|
4506
|
+
return [toast2, ...prev];
|
|
4507
|
+
});
|
|
4508
|
+
});
|
|
4509
|
+
},
|
|
4510
|
+
trackHotKeyPress({ prop, send }) {
|
|
4511
|
+
const handleKeyDown = (event) => {
|
|
4512
|
+
const { hotkey } = prop("store").attrs;
|
|
4513
|
+
const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
|
|
4514
|
+
if (!isHotkeyPressed) return;
|
|
4515
|
+
send({ type: "DOC.HOTKEY" });
|
|
4516
|
+
};
|
|
4517
|
+
return addDomEvent(document, "keydown", handleKeyDown, { capture: true });
|
|
4518
|
+
},
|
|
4519
|
+
trackDocumentVisibility({ prop, send, scope }) {
|
|
4520
|
+
const { pauseOnPageIdle } = prop("store").attrs;
|
|
4521
|
+
if (!pauseOnPageIdle) return;
|
|
4522
|
+
const doc = scope.getDoc();
|
|
4523
|
+
return addDomEvent(doc, "visibilitychange", () => {
|
|
4524
|
+
const isHidden = doc.visibilityState === "hidden";
|
|
4525
|
+
send({ type: isHidden ? "PAUSE_ALL" : "RESUME_ALL" });
|
|
4526
|
+
});
|
|
4527
|
+
}
|
|
4528
|
+
},
|
|
4529
|
+
actions: {
|
|
4530
|
+
setDismissableBranch({ refs, context: context2, computed, scope }) {
|
|
4531
|
+
var _a;
|
|
4532
|
+
const toasts = context2.get("toasts");
|
|
4533
|
+
const placement = computed("placement");
|
|
4534
|
+
const hasToasts = toasts.length > 0;
|
|
4535
|
+
if (!hasToasts) {
|
|
4536
|
+
(_a = refs.get("dismissableCleanup")) == null ? void 0 : _a();
|
|
4537
|
+
return;
|
|
4538
|
+
}
|
|
4539
|
+
if (hasToasts && refs.get("dismissableCleanup")) {
|
|
4540
|
+
return;
|
|
4541
|
+
}
|
|
4542
|
+
const groupEl = () => getRegionEl(scope, placement);
|
|
4543
|
+
const cleanup = trackDismissableBranch(groupEl, { defer: true });
|
|
4544
|
+
refs.set("dismissableCleanup", cleanup);
|
|
4545
|
+
},
|
|
4546
|
+
clearDismissableBranch({ refs }) {
|
|
4547
|
+
var _a;
|
|
4548
|
+
(_a = refs.get("dismissableCleanup")) == null ? void 0 : _a();
|
|
4549
|
+
},
|
|
4550
|
+
focusRegionEl({ scope, computed }) {
|
|
4551
|
+
queueMicrotask(() => {
|
|
4552
|
+
var _a;
|
|
4553
|
+
(_a = getRegionEl(scope, computed("placement"))) == null ? void 0 : _a.focus();
|
|
4554
|
+
});
|
|
4555
|
+
},
|
|
4556
|
+
pauseToasts({ prop }) {
|
|
4557
|
+
prop("store").pause();
|
|
4558
|
+
},
|
|
4559
|
+
resumeToasts({ prop }) {
|
|
4560
|
+
prop("store").resume();
|
|
4561
|
+
},
|
|
4562
|
+
expandToasts({ prop }) {
|
|
4563
|
+
prop("store").expand();
|
|
4564
|
+
},
|
|
4565
|
+
collapseToasts({ prop }) {
|
|
4566
|
+
prop("store").collapse();
|
|
4567
|
+
},
|
|
4568
|
+
removeToast({ prop, event }) {
|
|
4569
|
+
prop("store").remove(event.id);
|
|
4570
|
+
},
|
|
4571
|
+
removeHeight({ event, context: context2 }) {
|
|
4572
|
+
if ((event == null ? void 0 : event.id) == null) return;
|
|
4573
|
+
queueMicrotask(() => {
|
|
4574
|
+
context2.set("heights", (heights) => heights.filter((height) => height.id !== event.id));
|
|
4575
|
+
});
|
|
4576
|
+
},
|
|
4577
|
+
collapsedIfEmpty({ send, computed }) {
|
|
4578
|
+
if (!computed("overlap") || computed("count") > 1) return;
|
|
4579
|
+
send({ type: "REGION.OVERLAP" });
|
|
4580
|
+
},
|
|
4581
|
+
setLastFocusedEl({ refs, event }) {
|
|
4582
|
+
if (refs.get("isFocusWithin") || !event.target) return;
|
|
4583
|
+
refs.set("isFocusWithin", true);
|
|
4584
|
+
refs.set("lastFocusedEl", event.target);
|
|
4585
|
+
},
|
|
4586
|
+
restoreLastFocusedEl({ refs }) {
|
|
4587
|
+
var _a;
|
|
4588
|
+
if (!refs.get("lastFocusedEl")) return;
|
|
4589
|
+
(_a = refs.get("lastFocusedEl")) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
4590
|
+
refs.set("lastFocusedEl", null);
|
|
4591
|
+
refs.set("isFocusWithin", false);
|
|
4592
|
+
},
|
|
4593
|
+
clearLastFocusedEl({ refs }) {
|
|
4594
|
+
var _a;
|
|
4595
|
+
if (!refs.get("lastFocusedEl")) return;
|
|
4596
|
+
(_a = refs.get("lastFocusedEl")) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
4597
|
+
refs.set("lastFocusedEl", null);
|
|
4598
|
+
refs.set("isFocusWithin", false);
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
});
|
|
4603
|
+
function connect(service, normalize) {
|
|
4604
|
+
const { state, send, prop, scope, context: context2, computed } = service;
|
|
4605
|
+
const visible = state.hasTag("visible");
|
|
4606
|
+
const paused = state.hasTag("paused");
|
|
4607
|
+
const mounted = context2.get("mounted");
|
|
4608
|
+
const frontmost = computed("frontmost");
|
|
4609
|
+
const placement = prop("parent").computed("placement");
|
|
4610
|
+
const type = prop("type");
|
|
4611
|
+
const stacked = prop("stacked");
|
|
4612
|
+
const title = prop("title");
|
|
4613
|
+
const description = prop("description");
|
|
4614
|
+
const action = prop("action");
|
|
4615
|
+
const [side, align = "center"] = placement.split("-");
|
|
4616
|
+
return {
|
|
4617
|
+
type,
|
|
4618
|
+
title,
|
|
4619
|
+
description,
|
|
4620
|
+
placement,
|
|
4621
|
+
visible,
|
|
4622
|
+
paused,
|
|
4623
|
+
closable: !!prop("closable"),
|
|
4624
|
+
pause() {
|
|
4625
|
+
send({ type: "PAUSE" });
|
|
4626
|
+
},
|
|
4627
|
+
resume() {
|
|
4628
|
+
send({ type: "RESUME" });
|
|
4629
|
+
},
|
|
4630
|
+
dismiss() {
|
|
4631
|
+
send({ type: "DISMISS", src: "programmatic" });
|
|
4632
|
+
},
|
|
4633
|
+
getRootProps() {
|
|
4634
|
+
return normalize.element({
|
|
4635
|
+
...parts.root.attrs,
|
|
4636
|
+
dir: prop("dir"),
|
|
4637
|
+
id: getRootId(scope),
|
|
4638
|
+
"data-state": visible ? "open" : "closed",
|
|
4639
|
+
"data-type": type,
|
|
4640
|
+
"data-placement": placement,
|
|
4641
|
+
"data-align": align,
|
|
4642
|
+
"data-side": side,
|
|
4643
|
+
"data-mounted": dataAttr(mounted),
|
|
4644
|
+
"data-paused": dataAttr(paused),
|
|
4645
|
+
"data-first": dataAttr(frontmost),
|
|
4646
|
+
"data-sibling": dataAttr(!frontmost),
|
|
4647
|
+
"data-stack": dataAttr(stacked),
|
|
4648
|
+
"data-overlap": dataAttr(!stacked),
|
|
4649
|
+
role: "status",
|
|
4650
|
+
"aria-atomic": "true",
|
|
4651
|
+
"aria-describedby": description ? getDescriptionId(scope) : void 0,
|
|
4652
|
+
"aria-labelledby": title ? getTitleId(scope) : void 0,
|
|
4653
|
+
tabIndex: 0,
|
|
4654
|
+
style: getPlacementStyle(service, visible),
|
|
4655
|
+
onKeyDown(event) {
|
|
4656
|
+
if (event.defaultPrevented) return;
|
|
4657
|
+
if (event.key == "Escape") {
|
|
4658
|
+
send({ type: "DISMISS", src: "keyboard" });
|
|
4659
|
+
event.preventDefault();
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
});
|
|
4663
|
+
},
|
|
4664
|
+
/* Leave a ghost div to avoid setting hover to false when transitioning out */
|
|
4665
|
+
getGhostBeforeProps() {
|
|
4666
|
+
return normalize.element({
|
|
4667
|
+
"data-ghost": "before",
|
|
4668
|
+
style: getGhostBeforeStyle(service, visible)
|
|
4669
|
+
});
|
|
4670
|
+
},
|
|
4671
|
+
/* Needed to avoid setting hover to false when in between toasts */
|
|
4672
|
+
getGhostAfterProps() {
|
|
4673
|
+
return normalize.element({
|
|
4674
|
+
"data-ghost": "after",
|
|
4675
|
+
style: getGhostAfterStyle()
|
|
4676
|
+
});
|
|
4677
|
+
},
|
|
4678
|
+
getTitleProps() {
|
|
4679
|
+
return normalize.element({
|
|
4680
|
+
...parts.title.attrs,
|
|
4681
|
+
id: getTitleId(scope)
|
|
4682
|
+
});
|
|
4683
|
+
},
|
|
4684
|
+
getDescriptionProps() {
|
|
4685
|
+
return normalize.element({
|
|
4686
|
+
...parts.description.attrs,
|
|
4687
|
+
id: getDescriptionId(scope)
|
|
4688
|
+
});
|
|
4689
|
+
},
|
|
4690
|
+
getActionTriggerProps() {
|
|
4691
|
+
return normalize.button({
|
|
4692
|
+
...parts.actionTrigger.attrs,
|
|
4693
|
+
type: "button",
|
|
4694
|
+
onClick(event) {
|
|
4695
|
+
var _a;
|
|
4696
|
+
if (event.defaultPrevented) return;
|
|
4697
|
+
(_a = action == null ? void 0 : action.onClick) == null ? void 0 : _a.call(action);
|
|
4698
|
+
send({ type: "DISMISS", src: "user" });
|
|
4699
|
+
}
|
|
4700
|
+
});
|
|
4701
|
+
},
|
|
4702
|
+
getCloseTriggerProps() {
|
|
4703
|
+
return normalize.button({
|
|
4704
|
+
id: getCloseTriggerId(scope),
|
|
4705
|
+
...parts.closeTrigger.attrs,
|
|
4706
|
+
type: "button",
|
|
4707
|
+
"aria-label": "Dismiss notification",
|
|
4708
|
+
onClick(event) {
|
|
4709
|
+
if (event.defaultPrevented) return;
|
|
4710
|
+
send({ type: "DISMISS", src: "user" });
|
|
4711
|
+
}
|
|
4712
|
+
});
|
|
4713
|
+
}
|
|
4714
|
+
};
|
|
4715
|
+
}
|
|
4716
|
+
var { not } = createGuards();
|
|
4717
|
+
var machine = createMachine({
|
|
4718
|
+
props({ props }) {
|
|
4719
|
+
ensureProps(props, ["id", "type", "parent", "removeDelay"], "toast");
|
|
4720
|
+
return {
|
|
4721
|
+
closable: true,
|
|
4722
|
+
...props,
|
|
4723
|
+
duration: getToastDuration(props.duration, props.type)
|
|
4724
|
+
};
|
|
4725
|
+
},
|
|
4726
|
+
initialState({ prop }) {
|
|
4727
|
+
const persist = prop("type") === "loading" || prop("duration") === Infinity;
|
|
4728
|
+
return persist ? "visible:persist" : "visible";
|
|
4729
|
+
},
|
|
4730
|
+
context({ prop, bindable }) {
|
|
4731
|
+
return {
|
|
4732
|
+
remainingTime: bindable(() => ({
|
|
4733
|
+
defaultValue: getToastDuration(prop("duration"), prop("type"))
|
|
4734
|
+
})),
|
|
4735
|
+
createdAt: bindable(() => ({
|
|
4736
|
+
defaultValue: Date.now()
|
|
4737
|
+
})),
|
|
4738
|
+
mounted: bindable(() => ({
|
|
4739
|
+
defaultValue: false
|
|
4740
|
+
})),
|
|
4741
|
+
initialHeight: bindable(() => ({
|
|
4742
|
+
defaultValue: 0
|
|
4743
|
+
}))
|
|
4744
|
+
};
|
|
4745
|
+
},
|
|
4746
|
+
refs() {
|
|
4747
|
+
return {
|
|
4748
|
+
closeTimerStartTime: Date.now(),
|
|
4749
|
+
lastCloseStartTimerStartTime: 0
|
|
4750
|
+
};
|
|
4751
|
+
},
|
|
4752
|
+
computed: {
|
|
4753
|
+
zIndex: ({ prop }) => {
|
|
4754
|
+
const toasts = prop("parent").context.get("toasts");
|
|
4755
|
+
const index2 = toasts.findIndex((toast2) => toast2.id === prop("id"));
|
|
4756
|
+
return toasts.length - index2;
|
|
4757
|
+
},
|
|
4758
|
+
height: ({ prop }) => {
|
|
4759
|
+
const heights = prop("parent").context.get("heights");
|
|
4760
|
+
const height = heights.find((height2) => height2.id === prop("id"));
|
|
4761
|
+
return (height == null ? void 0 : height.height) ?? 0;
|
|
4762
|
+
},
|
|
4763
|
+
heightIndex: ({ prop }) => {
|
|
4764
|
+
const heights = prop("parent").context.get("heights");
|
|
4765
|
+
return heights.findIndex((height) => height.id === prop("id"));
|
|
4766
|
+
},
|
|
4767
|
+
frontmost: ({ prop }) => prop("index") === 0,
|
|
4768
|
+
heightBefore: ({ prop }) => {
|
|
4769
|
+
const heights = prop("parent").context.get("heights");
|
|
4770
|
+
const heightIndex = heights.findIndex((height) => height.id === prop("id"));
|
|
4771
|
+
return heights.reduce((prev, curr, reducerIndex) => {
|
|
4772
|
+
if (reducerIndex >= heightIndex) return prev;
|
|
4773
|
+
return prev + curr.height;
|
|
4774
|
+
}, 0);
|
|
4775
|
+
},
|
|
4776
|
+
shouldPersist: ({ prop }) => prop("type") === "loading" || prop("duration") === Infinity
|
|
4777
|
+
},
|
|
4778
|
+
watch({ track, prop, send }) {
|
|
4779
|
+
track([() => prop("message")], () => {
|
|
4780
|
+
const message = prop("message");
|
|
4781
|
+
if (message) send({ type: message, src: "programmatic" });
|
|
4782
|
+
});
|
|
4783
|
+
track([() => prop("type"), () => prop("duration")], () => {
|
|
4784
|
+
send({ type: "UPDATE" });
|
|
4785
|
+
});
|
|
4786
|
+
},
|
|
4787
|
+
on: {
|
|
4788
|
+
UPDATE: [
|
|
4789
|
+
{
|
|
4790
|
+
guard: "shouldPersist",
|
|
4791
|
+
target: "visible:persist",
|
|
4792
|
+
actions: ["resetCloseTimer"]
|
|
4793
|
+
},
|
|
4794
|
+
{
|
|
4795
|
+
target: "visible:updating",
|
|
4796
|
+
actions: ["resetCloseTimer"]
|
|
4797
|
+
}
|
|
4798
|
+
],
|
|
4799
|
+
MEASURE: {
|
|
4800
|
+
actions: ["measureHeight"]
|
|
4801
|
+
}
|
|
4802
|
+
},
|
|
4803
|
+
entry: ["setMounted", "measureHeight", "invokeOnVisible"],
|
|
4804
|
+
effects: ["trackHeight"],
|
|
4805
|
+
states: {
|
|
4806
|
+
"visible:updating": {
|
|
4807
|
+
tags: ["visible", "updating"],
|
|
4808
|
+
effects: ["waitForNextTick"],
|
|
4809
|
+
on: {
|
|
4810
|
+
SHOW: {
|
|
4811
|
+
target: "visible"
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
},
|
|
4815
|
+
"visible:persist": {
|
|
4816
|
+
tags: ["visible", "paused"],
|
|
4817
|
+
on: {
|
|
4818
|
+
RESUME: {
|
|
4819
|
+
guard: not("isLoadingType"),
|
|
4820
|
+
target: "visible",
|
|
4821
|
+
actions: ["setCloseTimer"]
|
|
4822
|
+
},
|
|
4823
|
+
DISMISS: {
|
|
4824
|
+
target: "dismissing"
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
},
|
|
4828
|
+
visible: {
|
|
4829
|
+
tags: ["visible"],
|
|
4830
|
+
effects: ["waitForDuration"],
|
|
4831
|
+
on: {
|
|
4832
|
+
DISMISS: {
|
|
4833
|
+
target: "dismissing"
|
|
4834
|
+
},
|
|
4835
|
+
PAUSE: {
|
|
4836
|
+
target: "visible:persist",
|
|
4837
|
+
actions: ["syncRemainingTime"]
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
},
|
|
4841
|
+
dismissing: {
|
|
4842
|
+
entry: ["invokeOnDismiss"],
|
|
4843
|
+
effects: ["waitForRemoveDelay"],
|
|
4844
|
+
on: {
|
|
4845
|
+
REMOVE: {
|
|
4846
|
+
target: "unmounted",
|
|
4847
|
+
actions: ["notifyParentToRemove"]
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
},
|
|
4851
|
+
unmounted: {
|
|
4852
|
+
entry: ["invokeOnUnmount"]
|
|
4853
|
+
}
|
|
4854
|
+
},
|
|
4855
|
+
implementations: {
|
|
4856
|
+
effects: {
|
|
4857
|
+
waitForRemoveDelay({ prop, send }) {
|
|
4858
|
+
return setRafTimeout(() => {
|
|
4859
|
+
send({ type: "REMOVE", src: "timer" });
|
|
4860
|
+
}, prop("removeDelay"));
|
|
4861
|
+
},
|
|
4862
|
+
waitForDuration({ send, context: context2, computed }) {
|
|
4863
|
+
if (computed("shouldPersist")) return;
|
|
4864
|
+
return setRafTimeout(() => {
|
|
4865
|
+
send({ type: "DISMISS", src: "timer" });
|
|
4866
|
+
}, context2.get("remainingTime"));
|
|
4867
|
+
},
|
|
4868
|
+
waitForNextTick({ send }) {
|
|
4869
|
+
return setRafTimeout(() => {
|
|
4870
|
+
send({ type: "SHOW", src: "timer" });
|
|
4871
|
+
}, 0);
|
|
4872
|
+
},
|
|
4873
|
+
trackHeight({ scope, prop }) {
|
|
4874
|
+
let cleanup;
|
|
4875
|
+
raf$2(() => {
|
|
4876
|
+
const rootEl = getRootEl(scope);
|
|
4877
|
+
if (!rootEl) return;
|
|
4878
|
+
const syncHeight = () => {
|
|
4879
|
+
const originalHeight = rootEl.style.height;
|
|
4880
|
+
rootEl.style.height = "auto";
|
|
4881
|
+
const height = rootEl.getBoundingClientRect().height;
|
|
4882
|
+
rootEl.style.height = originalHeight;
|
|
4883
|
+
const item = { id: prop("id"), height };
|
|
4884
|
+
setHeight(prop("parent"), item);
|
|
4885
|
+
};
|
|
4886
|
+
const win = scope.getWin();
|
|
4887
|
+
const observer = new win.MutationObserver(syncHeight);
|
|
4888
|
+
observer.observe(rootEl, {
|
|
4889
|
+
childList: true,
|
|
4890
|
+
subtree: true,
|
|
4891
|
+
characterData: true
|
|
4892
|
+
});
|
|
4893
|
+
cleanup = () => observer.disconnect();
|
|
4894
|
+
});
|
|
4895
|
+
return () => cleanup == null ? void 0 : cleanup();
|
|
4896
|
+
}
|
|
4897
|
+
},
|
|
4898
|
+
guards: {
|
|
4899
|
+
isLoadingType: ({ prop }) => prop("type") === "loading",
|
|
4900
|
+
shouldPersist: ({ computed }) => computed("shouldPersist")
|
|
4901
|
+
},
|
|
4902
|
+
actions: {
|
|
4903
|
+
setMounted({ context: context2 }) {
|
|
4904
|
+
raf$2(() => {
|
|
4905
|
+
context2.set("mounted", true);
|
|
4906
|
+
});
|
|
4907
|
+
},
|
|
4908
|
+
measureHeight({ scope, prop, context: context2 }) {
|
|
4909
|
+
queueMicrotask(() => {
|
|
4910
|
+
const rootEl = getRootEl(scope);
|
|
4911
|
+
if (!rootEl) return;
|
|
4912
|
+
const originalHeight = rootEl.style.height;
|
|
4913
|
+
rootEl.style.height = "auto";
|
|
4914
|
+
const height = rootEl.getBoundingClientRect().height;
|
|
4915
|
+
rootEl.style.height = originalHeight;
|
|
4916
|
+
context2.set("initialHeight", height);
|
|
4917
|
+
const item = { id: prop("id"), height };
|
|
4918
|
+
setHeight(prop("parent"), item);
|
|
4919
|
+
});
|
|
4920
|
+
},
|
|
4921
|
+
setCloseTimer({ refs }) {
|
|
4922
|
+
refs.set("closeTimerStartTime", Date.now());
|
|
4923
|
+
},
|
|
4924
|
+
resetCloseTimer({ context: context2, refs, prop }) {
|
|
4925
|
+
refs.set("closeTimerStartTime", Date.now());
|
|
4926
|
+
context2.set("remainingTime", getToastDuration(prop("duration"), prop("type")));
|
|
4927
|
+
},
|
|
4928
|
+
syncRemainingTime({ context: context2, refs }) {
|
|
4929
|
+
context2.set("remainingTime", (prev) => {
|
|
4930
|
+
const closeTimerStartTime = refs.get("closeTimerStartTime");
|
|
4931
|
+
const elapsedTime = Date.now() - closeTimerStartTime;
|
|
4932
|
+
refs.set("lastCloseStartTimerStartTime", Date.now());
|
|
4933
|
+
return prev - elapsedTime;
|
|
4934
|
+
});
|
|
4935
|
+
},
|
|
4936
|
+
notifyParentToRemove({ prop }) {
|
|
4937
|
+
const parent = prop("parent");
|
|
4938
|
+
parent.send({ type: "TOAST.REMOVE", id: prop("id") });
|
|
4939
|
+
},
|
|
4940
|
+
invokeOnDismiss({ prop, event }) {
|
|
4941
|
+
var _a;
|
|
4942
|
+
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "dismissing", src: event.src });
|
|
4943
|
+
},
|
|
4944
|
+
invokeOnUnmount({ prop }) {
|
|
4945
|
+
var _a;
|
|
4946
|
+
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "unmounted" });
|
|
4947
|
+
},
|
|
4948
|
+
invokeOnVisible({ prop }) {
|
|
4949
|
+
var _a;
|
|
4950
|
+
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "visible" });
|
|
4951
|
+
}
|
|
4952
|
+
}
|
|
4953
|
+
}
|
|
4954
|
+
});
|
|
4955
|
+
function setHeight(parent, item) {
|
|
4956
|
+
const { id, height } = item;
|
|
4957
|
+
parent.context.set("heights", (prev) => {
|
|
4958
|
+
const alreadyExists = prev.find((i) => i.id === id);
|
|
4959
|
+
if (!alreadyExists) {
|
|
4960
|
+
return [{ id, height }, ...prev];
|
|
4961
|
+
} else {
|
|
4962
|
+
return prev.map((i) => i.id === id ? { ...i, height } : i);
|
|
4963
|
+
}
|
|
4964
|
+
});
|
|
4965
|
+
}
|
|
4966
|
+
var withDefaults = (options, defaults2) => {
|
|
4967
|
+
return { ...defaults2, ...options };
|
|
4968
|
+
};
|
|
4969
|
+
function createToastStore(props) {
|
|
4970
|
+
const attrs = withDefaults(props, {
|
|
4971
|
+
placement: "bottom",
|
|
4972
|
+
overlap: false,
|
|
4973
|
+
max: 24,
|
|
4974
|
+
gap: 16,
|
|
4975
|
+
offsets: "1rem",
|
|
4976
|
+
hotkey: ["altKey", "KeyT"],
|
|
4977
|
+
removeDelay: 200,
|
|
4978
|
+
pauseOnPageIdle: true
|
|
4979
|
+
});
|
|
4980
|
+
let subscribers = [];
|
|
4981
|
+
let toasts = [];
|
|
4982
|
+
let dismissedToasts = /* @__PURE__ */ new Set();
|
|
4983
|
+
const subscribe2 = (subscriber) => {
|
|
4984
|
+
subscribers.push(subscriber);
|
|
4985
|
+
return () => {
|
|
4986
|
+
const index2 = subscribers.indexOf(subscriber);
|
|
4987
|
+
subscribers.splice(index2, 1);
|
|
4988
|
+
};
|
|
4989
|
+
};
|
|
4990
|
+
const publish = (data) => {
|
|
4991
|
+
subscribers.forEach((subscriber) => subscriber(data));
|
|
4992
|
+
return data;
|
|
4993
|
+
};
|
|
4994
|
+
const addToast = (data) => {
|
|
4995
|
+
if (toasts.length >= attrs.max) return;
|
|
4996
|
+
publish(data);
|
|
4997
|
+
toasts.unshift(data);
|
|
4998
|
+
};
|
|
4999
|
+
const create = (data) => {
|
|
5000
|
+
const id = data.id ?? `toast:${uuid()}`;
|
|
5001
|
+
const exists = toasts.find((toast2) => toast2.id === id);
|
|
5002
|
+
if (dismissedToasts.has(id)) dismissedToasts.delete(id);
|
|
5003
|
+
if (exists) {
|
|
5004
|
+
toasts = toasts.map((toast2) => {
|
|
5005
|
+
if (toast2.id === id) {
|
|
5006
|
+
return publish({ ...toast2, ...data, id });
|
|
5007
|
+
}
|
|
5008
|
+
return toast2;
|
|
5009
|
+
});
|
|
5010
|
+
} else {
|
|
5011
|
+
addToast({
|
|
5012
|
+
id,
|
|
5013
|
+
duration: attrs.duration,
|
|
5014
|
+
removeDelay: attrs.removeDelay,
|
|
5015
|
+
type: "info",
|
|
5016
|
+
...data,
|
|
5017
|
+
stacked: !attrs.overlap,
|
|
5018
|
+
gap: attrs.gap
|
|
5019
|
+
});
|
|
5020
|
+
}
|
|
5021
|
+
return id;
|
|
5022
|
+
};
|
|
5023
|
+
const remove = (id) => {
|
|
5024
|
+
dismissedToasts.add(id);
|
|
5025
|
+
if (!id) {
|
|
5026
|
+
toasts.forEach((toast2) => {
|
|
5027
|
+
subscribers.forEach((subscriber) => subscriber({ id: toast2.id, dismiss: true }));
|
|
5028
|
+
});
|
|
5029
|
+
toasts = [];
|
|
5030
|
+
} else {
|
|
5031
|
+
subscribers.forEach((subscriber) => subscriber({ id, dismiss: true }));
|
|
5032
|
+
toasts = toasts.filter((toast2) => toast2.id !== id);
|
|
5033
|
+
}
|
|
5034
|
+
return id;
|
|
5035
|
+
};
|
|
5036
|
+
const error = (data) => {
|
|
5037
|
+
return create({ ...data, type: "error" });
|
|
5038
|
+
};
|
|
5039
|
+
const success = (data) => {
|
|
5040
|
+
return create({ ...data, type: "success" });
|
|
5041
|
+
};
|
|
5042
|
+
const info = (data) => {
|
|
5043
|
+
return create({ ...data, type: "info" });
|
|
5044
|
+
};
|
|
5045
|
+
const warning = (data) => {
|
|
5046
|
+
return create({ ...data, type: "warning" });
|
|
5047
|
+
};
|
|
5048
|
+
const loading = (data) => {
|
|
5049
|
+
return create({ ...data, type: "loading" });
|
|
5050
|
+
};
|
|
5051
|
+
const getVisibleToasts = () => {
|
|
5052
|
+
return toasts.filter((toast2) => !dismissedToasts.has(toast2.id));
|
|
5053
|
+
};
|
|
5054
|
+
const getCount = () => {
|
|
5055
|
+
return toasts.length;
|
|
5056
|
+
};
|
|
5057
|
+
const promise = (promise2, options, shared = {}) => {
|
|
5058
|
+
if (!options) return;
|
|
5059
|
+
let id = void 0;
|
|
5060
|
+
if (options.loading !== void 0) {
|
|
5061
|
+
id = create({
|
|
5062
|
+
...shared,
|
|
5063
|
+
...options.loading,
|
|
5064
|
+
promise: promise2,
|
|
5065
|
+
type: "loading"
|
|
5066
|
+
});
|
|
5067
|
+
}
|
|
5068
|
+
let removable = id !== void 0;
|
|
5069
|
+
let result;
|
|
5070
|
+
const prom = runIfFn(promise2).then(async (response) => {
|
|
5071
|
+
result = ["resolve", response];
|
|
5072
|
+
if (isHttpResponse(response) && !response.ok) {
|
|
5073
|
+
removable = false;
|
|
5074
|
+
const errorOptions = runIfFn(options.error, `HTTP Error! status: ${response.status}`);
|
|
5075
|
+
create({ ...shared, ...errorOptions, id, type: "error" });
|
|
5076
|
+
} else if (options.success !== void 0) {
|
|
5077
|
+
removable = false;
|
|
5078
|
+
const successOptions = runIfFn(options.success, response);
|
|
5079
|
+
create({ ...shared, ...successOptions, id, type: "success" });
|
|
5080
|
+
}
|
|
5081
|
+
}).catch(async (error2) => {
|
|
5082
|
+
result = ["reject", error2];
|
|
5083
|
+
if (options.error !== void 0) {
|
|
5084
|
+
removable = false;
|
|
5085
|
+
const errorOptions = runIfFn(options.error, error2);
|
|
5086
|
+
create({ ...shared, ...errorOptions, id, type: "error" });
|
|
5087
|
+
}
|
|
5088
|
+
}).finally(() => {
|
|
5089
|
+
var _a;
|
|
5090
|
+
if (removable) {
|
|
5091
|
+
remove(id);
|
|
5092
|
+
id = void 0;
|
|
5093
|
+
}
|
|
5094
|
+
(_a = options.finally) == null ? void 0 : _a.call(options);
|
|
5095
|
+
});
|
|
5096
|
+
const unwrap = () => new Promise(
|
|
5097
|
+
(resolve, reject) => prom.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject)
|
|
5098
|
+
);
|
|
5099
|
+
return { id, unwrap };
|
|
5100
|
+
};
|
|
5101
|
+
const update2 = (id, data) => {
|
|
5102
|
+
return create({ id, ...data });
|
|
5103
|
+
};
|
|
5104
|
+
const pause = (id) => {
|
|
5105
|
+
if (id != null) {
|
|
5106
|
+
toasts = toasts.map((toast2) => {
|
|
5107
|
+
if (toast2.id === id) return publish({ ...toast2, message: "PAUSE" });
|
|
5108
|
+
return toast2;
|
|
5109
|
+
});
|
|
5110
|
+
} else {
|
|
5111
|
+
toasts = toasts.map((toast2) => publish({ ...toast2, message: "PAUSE" }));
|
|
5112
|
+
}
|
|
5113
|
+
};
|
|
5114
|
+
const resume = (id) => {
|
|
5115
|
+
if (id != null) {
|
|
5116
|
+
toasts = toasts.map((toast2) => {
|
|
5117
|
+
if (toast2.id === id) return publish({ ...toast2, message: "RESUME" });
|
|
5118
|
+
return toast2;
|
|
5119
|
+
});
|
|
5120
|
+
} else {
|
|
5121
|
+
toasts = toasts.map((toast2) => publish({ ...toast2, message: "RESUME" }));
|
|
5122
|
+
}
|
|
5123
|
+
};
|
|
5124
|
+
const dismiss = (id) => {
|
|
5125
|
+
if (id != null) {
|
|
5126
|
+
toasts = toasts.map((toast2) => {
|
|
5127
|
+
if (toast2.id === id) return publish({ ...toast2, message: "DISMISS" });
|
|
5128
|
+
return toast2;
|
|
5129
|
+
});
|
|
5130
|
+
} else {
|
|
5131
|
+
toasts = toasts.map((toast2) => publish({ ...toast2, message: "DISMISS" }));
|
|
5132
|
+
}
|
|
5133
|
+
};
|
|
5134
|
+
const isVisible = (id) => {
|
|
5135
|
+
return !dismissedToasts.has(id) && !!toasts.find((toast2) => toast2.id === id);
|
|
5136
|
+
};
|
|
5137
|
+
const isDismissed = (id) => {
|
|
5138
|
+
return dismissedToasts.has(id);
|
|
5139
|
+
};
|
|
5140
|
+
const expand = () => {
|
|
5141
|
+
toasts = toasts.map((toast2) => publish({ ...toast2, stacked: true }));
|
|
5142
|
+
};
|
|
5143
|
+
const collapse = () => {
|
|
5144
|
+
toasts = toasts.map((toast2) => publish({ ...toast2, stacked: false }));
|
|
5145
|
+
};
|
|
5146
|
+
return {
|
|
5147
|
+
attrs,
|
|
5148
|
+
subscribe: subscribe2,
|
|
5149
|
+
create,
|
|
5150
|
+
update: update2,
|
|
5151
|
+
remove,
|
|
5152
|
+
dismiss,
|
|
5153
|
+
error,
|
|
5154
|
+
success,
|
|
5155
|
+
info,
|
|
5156
|
+
warning,
|
|
5157
|
+
loading,
|
|
5158
|
+
getVisibleToasts,
|
|
5159
|
+
getCount,
|
|
5160
|
+
promise,
|
|
5161
|
+
pause,
|
|
5162
|
+
resume,
|
|
5163
|
+
isVisible,
|
|
5164
|
+
isDismissed,
|
|
5165
|
+
expand,
|
|
5166
|
+
collapse
|
|
5167
|
+
};
|
|
5168
|
+
}
|
|
5169
|
+
var isHttpResponse = (data) => {
|
|
5170
|
+
return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
|
|
5171
|
+
};
|
|
5172
|
+
var group = {
|
|
5173
|
+
connect: groupConnect,
|
|
5174
|
+
machine: groupMachine
|
|
5175
|
+
};
|
|
5176
|
+
const createToaster = (props) => {
|
|
5177
|
+
return createToastStore(props);
|
|
5178
|
+
};
|
|
5179
|
+
const [ToastProvider$1, useToastContext] = createContext({
|
|
5180
|
+
name: "ToastContext",
|
|
5181
|
+
hookName: "useToastContext",
|
|
5182
|
+
providerName: "<ToastProvider />"
|
|
5183
|
+
});
|
|
5184
|
+
const ToastActionTrigger = React.forwardRef((props, ref) => {
|
|
5185
|
+
const toast2 = useToastContext();
|
|
5186
|
+
const mergedProps = mergeProps(toast2.getActionTriggerProps(), props);
|
|
5187
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
|
|
5188
|
+
});
|
|
5189
|
+
ToastActionTrigger.displayName = "ToastActionTrigger";
|
|
5190
|
+
const ToastDescription = React.forwardRef((props, ref) => {
|
|
5191
|
+
const toast2 = useToastContext();
|
|
5192
|
+
const mergedProps = mergeProps(toast2.getDescriptionProps(), props);
|
|
5193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
|
|
5194
|
+
});
|
|
5195
|
+
ToastDescription.displayName = "ToastDescription";
|
|
5196
|
+
const ToastRoot = React.forwardRef((props, ref) => {
|
|
5197
|
+
const toast2 = useToastContext();
|
|
5198
|
+
const mergedProps = mergeProps(toast2.getRootProps(), props);
|
|
5199
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...mergedProps, ref, children: [
|
|
5200
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...toast2.getGhostBeforeProps() }),
|
|
5201
|
+
props.children,
|
|
5202
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...toast2.getGhostAfterProps() })
|
|
5203
|
+
] });
|
|
5204
|
+
});
|
|
5205
|
+
ToastRoot.displayName = "ToastRoot";
|
|
5206
|
+
const Toaster = React.forwardRef((props, ref) => {
|
|
5207
|
+
const { toaster, children, ...localProps } = props;
|
|
5208
|
+
const locale = useLocaleContext();
|
|
5209
|
+
const env = useEnvironmentContext();
|
|
5210
|
+
const service = useMachine(group.machine, {
|
|
5211
|
+
store: toaster,
|
|
5212
|
+
id: React.useId(),
|
|
5213
|
+
dir: locale == null ? void 0 : locale.dir,
|
|
5214
|
+
getRootNode: () => env == null ? void 0 : env.getDocument()
|
|
5215
|
+
});
|
|
5216
|
+
const api = group.connect(service, normalizeProps);
|
|
5217
|
+
const mergedProps = mergeProps(api.getGroupProps(), localProps);
|
|
5218
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref, children: api.getToasts().map((toast2, index2) => /* @__PURE__ */ jsxRuntime.jsx(ToastActor, { value: toast2, parent: service, index: index2, children: (ctx2) => children(ctx2) }, toast2.id)) });
|
|
5219
|
+
});
|
|
5220
|
+
Toaster.displayName = "Toaster";
|
|
5221
|
+
const ToastActor = (props) => {
|
|
5222
|
+
const localProps = {
|
|
5223
|
+
...props.value,
|
|
5224
|
+
parent: props.parent,
|
|
5225
|
+
index: props.index
|
|
5226
|
+
};
|
|
5227
|
+
const service = useMachine(machine, { ...localProps });
|
|
5228
|
+
const api = connect(service, normalizeProps);
|
|
5229
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToastProvider$1, { value: api, children: props.children(props.value) });
|
|
5230
|
+
};
|
|
5231
|
+
ToastActor.displayName = "ToastActor";
|
|
5232
|
+
const spinnerRecipe = cva({
|
|
5233
|
+
base: {
|
|
5234
|
+
display: "inline-block",
|
|
5235
|
+
borderWidth: "md",
|
|
5236
|
+
borderStyle: "solid",
|
|
5237
|
+
borderStartEndRadius: "full",
|
|
5238
|
+
borderEndStartRadius: "full",
|
|
5239
|
+
borderRadius: "full",
|
|
5240
|
+
animation: "spin",
|
|
5241
|
+
animationDuration: "slowest"
|
|
5242
|
+
},
|
|
5243
|
+
defaultVariants: {
|
|
5244
|
+
size: "md"
|
|
5245
|
+
},
|
|
5246
|
+
variants: {
|
|
5247
|
+
size: {
|
|
5248
|
+
sm: { width: 4, height: 4 },
|
|
5249
|
+
md: { width: 6, height: 6 },
|
|
5250
|
+
lg: { width: 12, height: 12 },
|
|
5251
|
+
xl: { width: 24, height: 24 }
|
|
5252
|
+
}
|
|
5253
|
+
}
|
|
5254
|
+
});
|
|
5255
|
+
const Spinner = React.forwardRef((props, ref) => {
|
|
5256
|
+
const StyledSpinner = styled(ark.div, spinnerRecipe);
|
|
5257
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5258
|
+
StyledSpinner,
|
|
5259
|
+
{
|
|
5260
|
+
ref,
|
|
5261
|
+
...props,
|
|
5262
|
+
css: {
|
|
5263
|
+
borderColor: "inherit",
|
|
5264
|
+
borderBottomColor: "transparent",
|
|
5265
|
+
borderLeftColor: "transparent",
|
|
5266
|
+
...props.css
|
|
5267
|
+
}
|
|
5268
|
+
}
|
|
5269
|
+
);
|
|
5270
|
+
});
|
|
5271
|
+
Spinner.displayName = "Spinner";
|
|
5272
|
+
const buttonRecipe = cva({
|
|
5273
|
+
base: {
|
|
5274
|
+
alignItems: "center",
|
|
5275
|
+
appearance: "none",
|
|
5276
|
+
cursor: "pointer",
|
|
5277
|
+
display: "inline-flex",
|
|
5278
|
+
fontWeight: "semibold",
|
|
5279
|
+
isolation: "isolate",
|
|
5280
|
+
minWidth: "0",
|
|
5281
|
+
justifyContent: "center",
|
|
5282
|
+
outline: "none",
|
|
5283
|
+
position: "relative",
|
|
5284
|
+
transitionDuration: "normal",
|
|
5285
|
+
transitionProperty: "background, border-color, color, box-shadow",
|
|
5286
|
+
transitionTimingFunction: "default",
|
|
5287
|
+
userSelect: "none",
|
|
5288
|
+
verticalAlign: "middle",
|
|
5289
|
+
whiteSpace: "nowrap",
|
|
5290
|
+
_hidden: {
|
|
5291
|
+
display: "none"
|
|
5292
|
+
}
|
|
5293
|
+
},
|
|
5294
|
+
defaultVariants: {
|
|
5295
|
+
variant: "solid",
|
|
5296
|
+
size: "md",
|
|
5297
|
+
radius: "full",
|
|
5298
|
+
color: "neutral"
|
|
5299
|
+
},
|
|
5300
|
+
variants: {
|
|
5301
|
+
variant: {
|
|
5302
|
+
solid: {
|
|
5303
|
+
_disabled: {
|
|
5304
|
+
background: "background.neutral.disabled",
|
|
5305
|
+
color: "content.neutral.disabled",
|
|
5306
|
+
cursor: "not-allowed",
|
|
5307
|
+
pointerEvents: "none"
|
|
5308
|
+
}
|
|
5309
|
+
},
|
|
5310
|
+
outline: {
|
|
5311
|
+
background: "transparent",
|
|
5312
|
+
borderWidth: "1px",
|
|
5313
|
+
borderStyle: "solid",
|
|
5314
|
+
borderColor: "border.neutral.default",
|
|
5315
|
+
_disabled: {
|
|
5316
|
+
background: "transparent",
|
|
5317
|
+
color: "content.neutral.disabled",
|
|
5318
|
+
borderColor: "border.neutral.disabled",
|
|
5319
|
+
cursor: "not-allowed",
|
|
5320
|
+
pointerEvents: "none"
|
|
5321
|
+
}
|
|
5322
|
+
},
|
|
5323
|
+
light: {
|
|
5324
|
+
background: "transparent",
|
|
5325
|
+
_disabled: {
|
|
5326
|
+
background: "transparent",
|
|
5327
|
+
color: "content.neutral.disabled",
|
|
5328
|
+
cursor: "not-allowed",
|
|
5329
|
+
pointerEvents: "none"
|
|
5330
|
+
}
|
|
5331
|
+
}
|
|
5332
|
+
},
|
|
5333
|
+
color: {
|
|
5334
|
+
neuroid_primary: {},
|
|
5335
|
+
neuroid_secondary: {},
|
|
5336
|
+
zoltarina_primary: {},
|
|
5337
|
+
zoltarina_secondary: {},
|
|
5338
|
+
heyd_primary: {},
|
|
5339
|
+
heyd_secondary: {},
|
|
5340
|
+
heybee_primary: {},
|
|
5341
|
+
neutral: {},
|
|
5342
|
+
danger: {},
|
|
5343
|
+
warning: {},
|
|
5344
|
+
success: {},
|
|
5345
|
+
informative: {}
|
|
5346
|
+
},
|
|
5347
|
+
size: {
|
|
5348
|
+
xs: {
|
|
5349
|
+
h: 7,
|
|
5350
|
+
textStyle: "label.sm",
|
|
5351
|
+
px: "8px",
|
|
5352
|
+
gap: 1,
|
|
5353
|
+
"& :where(svg)": {
|
|
5354
|
+
width: "20px",
|
|
5355
|
+
height: "20px"
|
|
5356
|
+
}
|
|
5357
|
+
},
|
|
5358
|
+
sm: {
|
|
5359
|
+
h: 8,
|
|
5360
|
+
textStyle: "label.sm",
|
|
4224
5361
|
px: "16px",
|
|
4225
5362
|
gap: 1,
|
|
4226
5363
|
"& :where(svg)": {
|
|
@@ -4708,7 +5845,7 @@ const createStyleContext = (recipe) => {
|
|
|
4708
5845
|
};
|
|
4709
5846
|
return StyledComponent;
|
|
4710
5847
|
};
|
|
4711
|
-
const
|
|
5848
|
+
const withProvider2 = (Component, slot, options) => {
|
|
4712
5849
|
const StyledComponent = styled(
|
|
4713
5850
|
Component,
|
|
4714
5851
|
{},
|
|
@@ -4735,24 +5872,21 @@ const createStyleContext = (recipe) => {
|
|
|
4735
5872
|
};
|
|
4736
5873
|
return {
|
|
4737
5874
|
withRootProvider: withRootProvider2,
|
|
4738
|
-
withProvider,
|
|
5875
|
+
withProvider: withProvider2,
|
|
4739
5876
|
withContext: withContext2
|
|
4740
5877
|
};
|
|
4741
5878
|
};
|
|
4742
5879
|
const dialogRecipe = sva({
|
|
4743
5880
|
className: "dialog",
|
|
4744
|
-
slots: [...anatomy$
|
|
5881
|
+
slots: [...anatomy$2.keys(), "header", "footer", "body"],
|
|
4745
5882
|
base: {
|
|
4746
5883
|
backdrop: {
|
|
4747
|
-
backdropFilter: "blur(
|
|
4748
|
-
background:
|
|
4749
|
-
_light: "white.100A",
|
|
4750
|
-
_dark: "black.100A"
|
|
4751
|
-
},
|
|
5884
|
+
backdropFilter: "blur(3px)",
|
|
5885
|
+
background: "shadow.overlay",
|
|
4752
5886
|
height: "100vh",
|
|
4753
|
-
left: "0",
|
|
4754
5887
|
position: "fixed",
|
|
4755
5888
|
top: "0",
|
|
5889
|
+
left: "0",
|
|
4756
5890
|
width: "100vw",
|
|
4757
5891
|
zIndex: "overlay",
|
|
4758
5892
|
_open: {
|
|
@@ -4826,16 +5960,16 @@ const dialogRecipe = sva({
|
|
|
4826
5960
|
}
|
|
4827
5961
|
}
|
|
4828
5962
|
});
|
|
4829
|
-
const { withRootProvider: withRootProvider$1, withContext: withContext$
|
|
4830
|
-
const Root$
|
|
4831
|
-
const Backdrop$1 = withContext$
|
|
4832
|
-
const Trigger$1 = withContext$
|
|
4833
|
-
const Content = withContext$
|
|
4834
|
-
const Title = withContext$
|
|
4835
|
-
const Description$1 = withContext$
|
|
4836
|
-
const Positioner = withContext$
|
|
4837
|
-
const Header = withContext$
|
|
4838
|
-
const Footer = withContext$
|
|
5963
|
+
const { withRootProvider: withRootProvider$1, withContext: withContext$2 } = createStyleContext(dialogRecipe);
|
|
5964
|
+
const Root$2 = withRootProvider$1(DialogRoot);
|
|
5965
|
+
const Backdrop$1 = withContext$2(DialogBackdrop, "backdrop");
|
|
5966
|
+
const Trigger$1 = withContext$2(DialogTrigger, "trigger");
|
|
5967
|
+
const Content$1 = withContext$2(DialogContent, "content");
|
|
5968
|
+
const Title = withContext$2(DialogTitle, "title");
|
|
5969
|
+
const Description$1 = withContext$2(DialogDescription, "description");
|
|
5970
|
+
const Positioner = withContext$2(DialogPositioner, "positioner");
|
|
5971
|
+
const Header = withContext$2(ark.header, "header");
|
|
5972
|
+
const Footer = withContext$2(
|
|
4839
5973
|
({ orientation = "horizontal", className, ...props }) => {
|
|
4840
5974
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4841
5975
|
ark.footer,
|
|
@@ -4853,13 +5987,13 @@ const Footer = withContext$1(
|
|
|
4853
5987
|
},
|
|
4854
5988
|
"footer"
|
|
4855
5989
|
);
|
|
4856
|
-
const Body = withContext$
|
|
4857
|
-
const CloseTrigger = withContext$
|
|
5990
|
+
const Body = withContext$2(ark.main, "body");
|
|
5991
|
+
const CloseTrigger = withContext$2(DialogCloseTrigger, "closeTrigger");
|
|
4858
5992
|
const Dialog = {
|
|
4859
|
-
Root: Root$
|
|
5993
|
+
Root: Root$2,
|
|
4860
5994
|
Backdrop: Backdrop$1,
|
|
4861
5995
|
Trigger: Trigger$1,
|
|
4862
|
-
Content,
|
|
5996
|
+
Content: Content$1,
|
|
4863
5997
|
Title,
|
|
4864
5998
|
Description: Description$1,
|
|
4865
5999
|
Positioner,
|
|
@@ -8705,7 +9839,7 @@ BottomSheetFrame.displayName = "BottomSheetFrame";
|
|
|
8705
9839
|
Backdrop.displayName = "Backdrop";
|
|
8706
9840
|
const navigationRecipe = sva({
|
|
8707
9841
|
className: "navigation",
|
|
8708
|
-
slots: anatomy.keys(),
|
|
9842
|
+
slots: anatomy$1.keys(),
|
|
8709
9843
|
base: {
|
|
8710
9844
|
root: {
|
|
8711
9845
|
bg: "surface.layer_1",
|
|
@@ -8746,18 +9880,18 @@ const navigationRecipe = sva({
|
|
|
8746
9880
|
}
|
|
8747
9881
|
}
|
|
8748
9882
|
});
|
|
8749
|
-
const { withRootProvider, withContext } = createStyleContext(navigationRecipe);
|
|
8750
|
-
const Root = withRootProvider(TabsRoot);
|
|
8751
|
-
const Trigger = withContext(
|
|
9883
|
+
const { withRootProvider, withContext: withContext$1 } = createStyleContext(navigationRecipe);
|
|
9884
|
+
const Root$1 = withRootProvider(TabsRoot);
|
|
9885
|
+
const Trigger = withContext$1(
|
|
8752
9886
|
({ icon, label, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(TabTrigger, { ...props, children: [
|
|
8753
9887
|
icon,
|
|
8754
9888
|
label
|
|
8755
9889
|
] }),
|
|
8756
9890
|
"trigger"
|
|
8757
9891
|
);
|
|
8758
|
-
const List = withContext(TabList, "list");
|
|
9892
|
+
const List = withContext$1(TabList, "list");
|
|
8759
9893
|
const Navigation = {
|
|
8760
|
-
Root,
|
|
9894
|
+
Root: Root$1,
|
|
8761
9895
|
Item: Trigger,
|
|
8762
9896
|
List
|
|
8763
9897
|
};
|
|
@@ -8916,21 +10050,43 @@ const Tag = React.forwardRef(({ imageSrc, text, onDeleteClick, ...rest }, ref) =
|
|
|
8916
10050
|
styled.img,
|
|
8917
10051
|
{
|
|
8918
10052
|
src: imageSrc,
|
|
8919
|
-
width: 8,
|
|
8920
|
-
height: 8,
|
|
8921
|
-
className: css$1({ borderRadius: "full", overflow: "hidden" }),
|
|
10053
|
+
className: css$1({ borderRadius: "full", overflow: "hidden", width: 8, height: 8 }),
|
|
8922
10054
|
alt: "avatar thumbnail"
|
|
8923
10055
|
}
|
|
8924
|
-
) : null,
|
|
8925
|
-
text,
|
|
8926
|
-
onDeleteClick ? /* @__PURE__ */ jsxRuntime.jsx(P, { size: 12, onClick: onDeleteClick, cursor: "pointer" }) : null
|
|
8927
|
-
] });
|
|
8928
|
-
});
|
|
8929
|
-
Tag.displayName = "Tag";
|
|
8930
|
-
const
|
|
8931
|
-
className: "input",
|
|
8932
|
-
slots: ["requiredStar", "description", "textLengthIndicator"],
|
|
8933
|
-
base: {
|
|
10056
|
+
) : null,
|
|
10057
|
+
text,
|
|
10058
|
+
onDeleteClick ? /* @__PURE__ */ jsxRuntime.jsx(P, { size: 12, onClick: onDeleteClick, cursor: "pointer" }) : null
|
|
10059
|
+
] });
|
|
10060
|
+
});
|
|
10061
|
+
Tag.displayName = "Tag";
|
|
10062
|
+
const inputRecipe = sva({
|
|
10063
|
+
className: "input",
|
|
10064
|
+
slots: ["inputContainer", "requiredStar", "description", "label", "textLengthIndicator"],
|
|
10065
|
+
base: {
|
|
10066
|
+
inputContainer: {
|
|
10067
|
+
display: "flex",
|
|
10068
|
+
flexDirection: "column",
|
|
10069
|
+
alignItems: "center",
|
|
10070
|
+
justifyContent: "center",
|
|
10071
|
+
width: "100%",
|
|
10072
|
+
textStyle: "body.md",
|
|
10073
|
+
cursor: "text",
|
|
10074
|
+
color: "content.neutral.bold",
|
|
10075
|
+
gap: 1,
|
|
10076
|
+
borderStyle: "solid",
|
|
10077
|
+
border: 1,
|
|
10078
|
+
outline: "none",
|
|
10079
|
+
p: 2,
|
|
10080
|
+
"& input, & textarea": {
|
|
10081
|
+
outline: "none",
|
|
10082
|
+
width: "100%",
|
|
10083
|
+
height: "100%"
|
|
10084
|
+
},
|
|
10085
|
+
_groupDisabled: {
|
|
10086
|
+
cursor: "not-allowed",
|
|
10087
|
+
color: "content.neutral.disabled"
|
|
10088
|
+
}
|
|
10089
|
+
},
|
|
8934
10090
|
requiredStar: {
|
|
8935
10091
|
color: "content.danger.default",
|
|
8936
10092
|
paddingLeft: 1
|
|
@@ -8942,196 +10098,147 @@ const inputSlotRecipe = sva({
|
|
|
8942
10098
|
width: "100%",
|
|
8943
10099
|
textAlign: "start"
|
|
8944
10100
|
},
|
|
10101
|
+
label: {
|
|
10102
|
+
textStyle: "label.sm",
|
|
10103
|
+
textAlign: "start",
|
|
10104
|
+
width: "100%",
|
|
10105
|
+
display: "inline-block"
|
|
10106
|
+
},
|
|
8945
10107
|
textLengthIndicator: {
|
|
8946
10108
|
display: "inline-block",
|
|
8947
10109
|
width: "100%",
|
|
8948
10110
|
textAlign: "end",
|
|
8949
10111
|
paddingRight: 1,
|
|
8950
10112
|
marginTop: -0.5,
|
|
8951
|
-
textStyle: "label.sm"
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
});
|
|
8955
|
-
const inputRecipe = cva({
|
|
8956
|
-
base: {
|
|
8957
|
-
display: "flex",
|
|
8958
|
-
flexDirection: "column",
|
|
8959
|
-
alignItems: "center",
|
|
8960
|
-
justifyContent: "center",
|
|
8961
|
-
width: "100%",
|
|
8962
|
-
textStyle: "body.md",
|
|
8963
|
-
cursor: "text",
|
|
8964
|
-
color: "content.neutral.bold",
|
|
8965
|
-
gap: 1,
|
|
8966
|
-
borderStyle: "solid",
|
|
8967
|
-
border: 1,
|
|
8968
|
-
outline: "none",
|
|
8969
|
-
p: 2,
|
|
8970
|
-
"& textarea, & input": {
|
|
8971
|
-
outline: "none",
|
|
8972
|
-
width: "100%",
|
|
8973
|
-
height: "100%"
|
|
10113
|
+
textStyle: "label.sm",
|
|
10114
|
+
color: "content.neutral.subtlest",
|
|
10115
|
+
_groupDisabled: { color: "content.neutral.disabled" }
|
|
8974
10116
|
}
|
|
8975
10117
|
},
|
|
8976
10118
|
variants: {
|
|
8977
10119
|
isTextArea: {
|
|
8978
10120
|
true: {
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
10121
|
+
inputContainer: {
|
|
10122
|
+
minHeight: "56px",
|
|
10123
|
+
"& textarea": {
|
|
10124
|
+
background: "transparent",
|
|
10125
|
+
resize: "none",
|
|
10126
|
+
overflowY: "auto"
|
|
10127
|
+
}
|
|
8985
10128
|
}
|
|
8986
10129
|
},
|
|
8987
10130
|
false: {
|
|
8988
|
-
|
|
8989
|
-
|
|
10131
|
+
inputContainer: {
|
|
10132
|
+
minHeight: "48px",
|
|
10133
|
+
maxHeight: "60px"
|
|
10134
|
+
}
|
|
8990
10135
|
}
|
|
8991
10136
|
},
|
|
8992
10137
|
variant: {
|
|
8993
10138
|
solid: {
|
|
8994
|
-
|
|
10139
|
+
inputContainer: {
|
|
10140
|
+
borderColor: "transparent",
|
|
10141
|
+
_focusWithin: {
|
|
10142
|
+
borderColor: "border.neutral.default"
|
|
10143
|
+
}
|
|
10144
|
+
}
|
|
8995
10145
|
},
|
|
8996
10146
|
line: {
|
|
8997
|
-
|
|
10147
|
+
inputContainer: {
|
|
10148
|
+
background: "transparent",
|
|
10149
|
+
border: 1,
|
|
10150
|
+
borderColor: "border.neutral.subtle",
|
|
10151
|
+
_focusWithin: {
|
|
10152
|
+
borderColor: "border.neutral.default"
|
|
10153
|
+
},
|
|
10154
|
+
_groupDisabled: {
|
|
10155
|
+
borderColor: "border.neutral.disabled"
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
8998
10158
|
}
|
|
8999
10159
|
},
|
|
9000
10160
|
color: {
|
|
9001
10161
|
alpha: {
|
|
9002
|
-
|
|
9003
|
-
|
|
10162
|
+
inputContainer: {
|
|
10163
|
+
_placeholder: {
|
|
10164
|
+
color: "content.static.white.subtlest",
|
|
10165
|
+
_groupDisabled: {
|
|
10166
|
+
color: "content.static.white.disabled"
|
|
10167
|
+
}
|
|
10168
|
+
}
|
|
10169
|
+
},
|
|
10170
|
+
label: {
|
|
10171
|
+
color: "content.neutral.default",
|
|
10172
|
+
_groupDisabled: {
|
|
10173
|
+
color: "content.neutral.disabled"
|
|
10174
|
+
}
|
|
9004
10175
|
}
|
|
9005
10176
|
},
|
|
9006
10177
|
neutral: {
|
|
9007
|
-
|
|
9008
|
-
|
|
10178
|
+
inputContainer: {
|
|
10179
|
+
_placeholder: {
|
|
10180
|
+
color: "content.neutral.subtlest",
|
|
10181
|
+
_groupDisabled: {
|
|
10182
|
+
color: "content.neutral.disabled"
|
|
10183
|
+
}
|
|
10184
|
+
}
|
|
10185
|
+
},
|
|
10186
|
+
label: {
|
|
10187
|
+
color: "content.neutral.subtle",
|
|
10188
|
+
_groupDisabled: {
|
|
10189
|
+
color: "content.neutral.disabled"
|
|
10190
|
+
}
|
|
9009
10191
|
}
|
|
9010
10192
|
}
|
|
9011
10193
|
},
|
|
9012
10194
|
radius: {
|
|
9013
10195
|
md: {
|
|
9014
|
-
|
|
9015
|
-
|
|
10196
|
+
inputContainer: {
|
|
10197
|
+
borderRadius: 8,
|
|
10198
|
+
px: 2
|
|
10199
|
+
}
|
|
9016
10200
|
},
|
|
9017
10201
|
lg: {
|
|
9018
|
-
|
|
9019
|
-
|
|
10202
|
+
inputContainer: {
|
|
10203
|
+
borderRadius: 16,
|
|
10204
|
+
px: 2
|
|
10205
|
+
}
|
|
9020
10206
|
},
|
|
9021
10207
|
full: {
|
|
9022
|
-
|
|
9023
|
-
|
|
10208
|
+
inputContainer: {
|
|
10209
|
+
borderRadius: 9999,
|
|
10210
|
+
px: 4
|
|
10211
|
+
}
|
|
9024
10212
|
}
|
|
9025
10213
|
},
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
selected: {
|
|
9032
|
-
color: "content.neutral.bold"
|
|
9033
|
-
},
|
|
9034
|
-
disabled: {
|
|
9035
|
-
color: "content.neutral.disabled"
|
|
10214
|
+
disabled: {
|
|
10215
|
+
true: {
|
|
10216
|
+
inputContainer: {
|
|
10217
|
+
_groupDisabled: {}
|
|
10218
|
+
}
|
|
9036
10219
|
}
|
|
9037
10220
|
}
|
|
9038
10221
|
},
|
|
9039
10222
|
compoundVariants: [
|
|
9040
|
-
{
|
|
9041
|
-
color: "alpha",
|
|
9042
|
-
state: "disabled",
|
|
9043
|
-
css: {
|
|
9044
|
-
"&::placeholder": {
|
|
9045
|
-
color: "content.static.white.disabled"
|
|
9046
|
-
}
|
|
9047
|
-
}
|
|
9048
|
-
},
|
|
9049
|
-
{
|
|
9050
|
-
color: "neutral",
|
|
9051
|
-
state: "disabled",
|
|
9052
|
-
css: {
|
|
9053
|
-
"&::placeholder": {
|
|
9054
|
-
color: "content.neutral.disabled"
|
|
9055
|
-
}
|
|
9056
|
-
}
|
|
9057
|
-
},
|
|
9058
|
-
{
|
|
9059
|
-
variant: "solid",
|
|
9060
|
-
color: "alpha",
|
|
9061
|
-
state: "default",
|
|
9062
|
-
css: {
|
|
9063
|
-
background: "black.500A"
|
|
9064
|
-
}
|
|
9065
|
-
},
|
|
9066
|
-
{
|
|
9067
|
-
variant: "solid",
|
|
9068
|
-
color: "alpha",
|
|
9069
|
-
state: "selected",
|
|
9070
|
-
css: {
|
|
9071
|
-
background: "black.500A",
|
|
9072
|
-
border: 1,
|
|
9073
|
-
borderColor: "border.neutral.default"
|
|
9074
|
-
}
|
|
9075
|
-
},
|
|
9076
10223
|
{
|
|
9077
10224
|
variant: "solid",
|
|
9078
10225
|
color: "alpha",
|
|
9079
|
-
state: "disabled",
|
|
9080
|
-
css: {
|
|
9081
|
-
background: "black.500A"
|
|
9082
|
-
}
|
|
9083
|
-
},
|
|
9084
|
-
{
|
|
9085
|
-
variant: "solid",
|
|
9086
|
-
color: "neutral",
|
|
9087
|
-
state: "default",
|
|
9088
|
-
css: {
|
|
9089
|
-
background: "background.neutral.default"
|
|
9090
|
-
}
|
|
9091
|
-
},
|
|
9092
|
-
{
|
|
9093
|
-
variant: "solid",
|
|
9094
|
-
color: "neutral",
|
|
9095
|
-
state: "selected",
|
|
9096
10226
|
css: {
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
10227
|
+
inputContainer: {
|
|
10228
|
+
background: "black.500A"
|
|
10229
|
+
}
|
|
9100
10230
|
}
|
|
9101
10231
|
},
|
|
9102
10232
|
{
|
|
9103
10233
|
variant: "solid",
|
|
9104
10234
|
color: "neutral",
|
|
9105
|
-
state: "disabled",
|
|
9106
|
-
css: {
|
|
9107
|
-
background: "background.neutral.disabled"
|
|
9108
|
-
}
|
|
9109
|
-
},
|
|
9110
|
-
{
|
|
9111
|
-
variant: "line",
|
|
9112
|
-
state: "default",
|
|
9113
|
-
css: {
|
|
9114
|
-
background: "transparent",
|
|
9115
|
-
border: 1,
|
|
9116
|
-
borderColor: "border.neutral.subtle"
|
|
9117
|
-
}
|
|
9118
|
-
},
|
|
9119
|
-
{
|
|
9120
|
-
variant: "line",
|
|
9121
|
-
state: "selected",
|
|
9122
|
-
css: {
|
|
9123
|
-
background: "transparent",
|
|
9124
|
-
border: 1,
|
|
9125
|
-
borderColor: "border.neutral.default"
|
|
9126
|
-
}
|
|
9127
|
-
},
|
|
9128
|
-
{
|
|
9129
|
-
variant: "line",
|
|
9130
|
-
state: "disabled",
|
|
9131
10235
|
css: {
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
10236
|
+
inputContainer: {
|
|
10237
|
+
background: "background.neutral.default",
|
|
10238
|
+
_groupDisabled: {
|
|
10239
|
+
background: "background.neutral.disabled"
|
|
10240
|
+
}
|
|
10241
|
+
}
|
|
9135
10242
|
}
|
|
9136
10243
|
}
|
|
9137
10244
|
],
|
|
@@ -9139,58 +10246,11 @@ const inputRecipe = cva({
|
|
|
9139
10246
|
isTextArea: false,
|
|
9140
10247
|
variant: "solid",
|
|
9141
10248
|
color: "neutral",
|
|
9142
|
-
state: "default",
|
|
9143
|
-
radius: "md"
|
|
9144
|
-
}
|
|
9145
|
-
});
|
|
9146
|
-
const labelRecipe = cva({
|
|
9147
|
-
base: {
|
|
9148
|
-
textStyle: "label.sm",
|
|
9149
|
-
textAlign: "start",
|
|
9150
|
-
width: "100%",
|
|
9151
|
-
display: "inline-block"
|
|
9152
|
-
},
|
|
9153
|
-
variants: {
|
|
9154
|
-
state: {
|
|
9155
|
-
default: {},
|
|
9156
|
-
selected: {},
|
|
9157
|
-
disabled: {}
|
|
9158
|
-
},
|
|
9159
|
-
color: {
|
|
9160
|
-
alpha: {
|
|
9161
|
-
color: "content.static.white.bold"
|
|
9162
|
-
},
|
|
9163
|
-
neutral: {
|
|
9164
|
-
color: "content.neutral.subtle"
|
|
9165
|
-
}
|
|
9166
|
-
},
|
|
9167
|
-
radius: {
|
|
9168
|
-
md: {},
|
|
9169
|
-
lg: {},
|
|
9170
|
-
full: {}
|
|
9171
|
-
}
|
|
9172
|
-
},
|
|
9173
|
-
compoundVariants: [
|
|
9174
|
-
{
|
|
9175
|
-
state: "disabled",
|
|
9176
|
-
css: {
|
|
9177
|
-
color: "content.neutral.disabled"
|
|
9178
|
-
}
|
|
9179
|
-
}
|
|
9180
|
-
],
|
|
9181
|
-
defaultVariants: {
|
|
9182
|
-
color: "neutral",
|
|
9183
|
-
state: "default",
|
|
9184
10249
|
radius: "md"
|
|
9185
10250
|
}
|
|
9186
10251
|
});
|
|
9187
|
-
const StyledInputWrapper = styled(ark.div, inputRecipe);
|
|
9188
|
-
const StyledLabel$1 = styled(ark.label, labelRecipe);
|
|
9189
|
-
const RequiredStar = () => /* @__PURE__ */ jsxRuntime.jsx(ark.span, { className: inputSlotRecipe().requiredStar, "aria-hidden": "true", children: "*" });
|
|
9190
|
-
const Description = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(ark.span, { className: inputSlotRecipe().description, children });
|
|
9191
10252
|
const Input = React.forwardRef(
|
|
9192
10253
|
({
|
|
9193
|
-
value,
|
|
9194
10254
|
required,
|
|
9195
10255
|
disabled,
|
|
9196
10256
|
label,
|
|
@@ -9202,74 +10262,59 @@ const Input = React.forwardRef(
|
|
|
9202
10262
|
radius,
|
|
9203
10263
|
onChange,
|
|
9204
10264
|
className,
|
|
10265
|
+
css: css2,
|
|
9205
10266
|
...rest
|
|
9206
10267
|
}, ref) => {
|
|
9207
|
-
const
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
10268
|
+
const recipe = inputRecipe({
|
|
10269
|
+
variant,
|
|
10270
|
+
color,
|
|
10271
|
+
radius
|
|
10272
|
+
});
|
|
10273
|
+
const innerRef = React.useRef(null);
|
|
10274
|
+
const inputRef = ref || innerRef;
|
|
10275
|
+
const handleInputChange = React.useCallback(
|
|
10276
|
+
(e) => {
|
|
10277
|
+
if (disabled) return;
|
|
10278
|
+
const { value } = e.target;
|
|
10279
|
+
e.target.value = value.slice(0, textLimit);
|
|
10280
|
+
onChange == null ? void 0 : onChange(e);
|
|
10281
|
+
},
|
|
10282
|
+
[disabled, onChange, textLimit]
|
|
10283
|
+
);
|
|
10284
|
+
const handleContainerClick = React.useCallback(() => {
|
|
9212
10285
|
if (disabled) return;
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
]
|
|
9224
|
-
|
|
9225
|
-
|
|
10286
|
+
if (inputRef.current) {
|
|
10287
|
+
inputRef.current.focus();
|
|
10288
|
+
}
|
|
10289
|
+
}, [disabled, inputRef]);
|
|
10290
|
+
const RequiredStar = React.useCallback(
|
|
10291
|
+
() => /* @__PURE__ */ jsxRuntime.jsx("span", { className: recipe.requiredStar, "aria-hidden": "true", children: "*" }),
|
|
10292
|
+
[recipe.requiredStar]
|
|
10293
|
+
);
|
|
10294
|
+
const Description2 = React.useCallback(
|
|
10295
|
+
({ children }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: recipe.description, children }),
|
|
10296
|
+
[recipe.description]
|
|
10297
|
+
);
|
|
10298
|
+
const Label = React.useCallback(
|
|
10299
|
+
({ visible, children }) => {
|
|
10300
|
+
return visible ? /* @__PURE__ */ jsxRuntime.jsxs("label", { className: recipe.label, children: [
|
|
10301
|
+
children,
|
|
10302
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(RequiredStar, {})
|
|
10303
|
+
] }) : null;
|
|
10304
|
+
},
|
|
10305
|
+
[recipe.label, required, RequiredStar]
|
|
10306
|
+
);
|
|
10307
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(VStack2, { gap: 1, className: "group", "data-disabled": disabled || void 0, children: [
|
|
9226
10308
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "outside"), children: label }),
|
|
9227
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9228
|
-
|
|
9229
|
-
{
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
color,
|
|
9233
|
-
radius,
|
|
9234
|
-
className: cx(css$1({ display: "flex", flexDirection: "column", gap: 1 }), className),
|
|
9235
|
-
children: [
|
|
9236
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "inside"), children: label }),
|
|
9237
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9238
|
-
"input",
|
|
9239
|
-
{
|
|
9240
|
-
value,
|
|
9241
|
-
disabled,
|
|
9242
|
-
onFocus: () => !disabled && setState("selected"),
|
|
9243
|
-
onBlur: () => !disabled && setState("default"),
|
|
9244
|
-
onChange: handleInputChange,
|
|
9245
|
-
ref,
|
|
9246
|
-
...rest
|
|
9247
|
-
}
|
|
9248
|
-
)
|
|
9249
|
-
]
|
|
9250
|
-
}
|
|
9251
|
-
),
|
|
9252
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(Description, { children: description })
|
|
10309
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Stack2, { gap: 1, className: cx(recipe.inputContainer, className), onClick: handleContainerClick, css: css2, children: [
|
|
10310
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "inside"), children: label }),
|
|
10311
|
+
/* @__PURE__ */ jsxRuntime.jsx(styled.input, { ref: inputRef, disabled, onChange: handleInputChange, ...rest })
|
|
10312
|
+
] }),
|
|
10313
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Description2, { children: description })
|
|
9253
10314
|
] });
|
|
9254
10315
|
}
|
|
9255
10316
|
);
|
|
9256
10317
|
Input.displayName = "Input";
|
|
9257
|
-
const StyledTextAreaWrapper = styled(ark.div, inputRecipe);
|
|
9258
|
-
const StyledLabel = styled(ark.label, labelRecipe);
|
|
9259
|
-
const TextLengthIndicator = ({ count, limit, disabled }) => {
|
|
9260
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9261
|
-
ark.span,
|
|
9262
|
-
{
|
|
9263
|
-
className: cx(
|
|
9264
|
-
inputSlotRecipe().textLengthIndicator,
|
|
9265
|
-
css$1({
|
|
9266
|
-
color: disabled ? "content.neutral.disabled" : "content.neutral.subtlest"
|
|
9267
|
-
})
|
|
9268
|
-
),
|
|
9269
|
-
children: `${count}${limit ? ` / ${limit}` : ""}`
|
|
9270
|
-
}
|
|
9271
|
-
);
|
|
9272
|
-
};
|
|
9273
10318
|
const Textarea = React.forwardRef(
|
|
9274
10319
|
({
|
|
9275
10320
|
value,
|
|
@@ -9280,62 +10325,70 @@ const Textarea = React.forwardRef(
|
|
|
9280
10325
|
labelPosition = "outside",
|
|
9281
10326
|
textLimit,
|
|
9282
10327
|
showTextCount = false,
|
|
9283
|
-
isTextArea,
|
|
9284
10328
|
color,
|
|
9285
10329
|
radius,
|
|
9286
10330
|
variant,
|
|
9287
10331
|
onChange,
|
|
9288
10332
|
className,
|
|
10333
|
+
css: css2,
|
|
9289
10334
|
...rest
|
|
9290
10335
|
}, ref) => {
|
|
9291
|
-
const [
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
10336
|
+
const [count, setCount] = React.useState((value == null ? void 0 : value.toString().length) || 0);
|
|
10337
|
+
const recipe = inputRecipe({
|
|
10338
|
+
variant,
|
|
10339
|
+
color,
|
|
10340
|
+
radius,
|
|
10341
|
+
isTextArea: true
|
|
10342
|
+
});
|
|
10343
|
+
const innerRef = React.useRef(null);
|
|
10344
|
+
const inputRef = ref || innerRef;
|
|
10345
|
+
const handleTextareaChange = React.useCallback(
|
|
10346
|
+
(e) => {
|
|
10347
|
+
if (disabled) return;
|
|
10348
|
+
const { value: value2 } = e.target;
|
|
10349
|
+
e.target.value = value2.slice(0, textLimit);
|
|
10350
|
+
onChange == null ? void 0 : onChange(e);
|
|
10351
|
+
if (showTextCount) setCount(value2.length);
|
|
10352
|
+
},
|
|
10353
|
+
[disabled, onChange, textLimit, showTextCount]
|
|
10354
|
+
);
|
|
10355
|
+
const handleContainerClick = React.useCallback(() => {
|
|
9296
10356
|
if (disabled) return;
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
]
|
|
9308
|
-
|
|
9309
|
-
|
|
10357
|
+
if (inputRef.current) {
|
|
10358
|
+
inputRef.current.focus();
|
|
10359
|
+
}
|
|
10360
|
+
}, [disabled, inputRef]);
|
|
10361
|
+
const RequiredStar = React.useCallback(
|
|
10362
|
+
() => /* @__PURE__ */ jsxRuntime.jsx("span", { className: recipe.requiredStar, "aria-hidden": "true", children: "*" }),
|
|
10363
|
+
[recipe.requiredStar]
|
|
10364
|
+
);
|
|
10365
|
+
const Description2 = React.useCallback(
|
|
10366
|
+
({ children }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: recipe.description, children }),
|
|
10367
|
+
[recipe.description]
|
|
10368
|
+
);
|
|
10369
|
+
const Label = React.useCallback(
|
|
10370
|
+
({ visible, children }) => {
|
|
10371
|
+
return visible ? /* @__PURE__ */ jsxRuntime.jsxs("label", { className: recipe.label, children: [
|
|
10372
|
+
children,
|
|
10373
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(RequiredStar, {})
|
|
10374
|
+
] }) : null;
|
|
10375
|
+
},
|
|
10376
|
+
[recipe.label, required, RequiredStar]
|
|
10377
|
+
);
|
|
10378
|
+
const TextLengthIndicator = React.useCallback(
|
|
10379
|
+
({ count: count2, limit }) => {
|
|
10380
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: recipe.textLengthIndicator, children: `${count2}${limit ? ` / ${limit}` : ""}` });
|
|
10381
|
+
},
|
|
10382
|
+
[recipe.textLengthIndicator]
|
|
10383
|
+
);
|
|
10384
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(VStack2, { gap: 1, className: "group", "data-disabled": disabled || void 0, children: [
|
|
9310
10385
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "outside"), children: label }),
|
|
9311
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9312
|
-
|
|
9313
|
-
{
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
radius,
|
|
9318
|
-
variant,
|
|
9319
|
-
className: cx(css$1({ position: "relative", display: "flex", flexDirection: "column", gap: 1 }), className),
|
|
9320
|
-
children: [
|
|
9321
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "inside"), children: label }),
|
|
9322
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9323
|
-
"textarea",
|
|
9324
|
-
{
|
|
9325
|
-
value,
|
|
9326
|
-
disabled,
|
|
9327
|
-
onChange: handleTextareaChange,
|
|
9328
|
-
onFocus: () => !disabled && setState("selected"),
|
|
9329
|
-
onBlur: () => !disabled && setState("default"),
|
|
9330
|
-
ref,
|
|
9331
|
-
...rest
|
|
9332
|
-
}
|
|
9333
|
-
),
|
|
9334
|
-
showTextCount && /* @__PURE__ */ jsxRuntime.jsx(TextLengthIndicator, { count: value.length, limit: textLimit, disabled })
|
|
9335
|
-
]
|
|
9336
|
-
}
|
|
9337
|
-
),
|
|
9338
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(Description, { children: description })
|
|
10386
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Stack2, { gap: 1, className: cx(recipe.inputContainer, className), onClick: handleContainerClick, css: css2, children: [
|
|
10387
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { visible: !!(label && labelPosition === "inside"), children: label }),
|
|
10388
|
+
/* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: inputRef, value, disabled, onChange: handleTextareaChange, ...rest }),
|
|
10389
|
+
showTextCount && /* @__PURE__ */ jsxRuntime.jsx(TextLengthIndicator, { count, limit: textLimit })
|
|
10390
|
+
] }),
|
|
10391
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Description2, { children: description })
|
|
9339
10392
|
] });
|
|
9340
10393
|
}
|
|
9341
10394
|
);
|
|
@@ -9424,7 +10477,7 @@ const keyframes = defineKeyframes({
|
|
|
9424
10477
|
"100%": { transform: "rotate(360deg)" }
|
|
9425
10478
|
}
|
|
9426
10479
|
});
|
|
9427
|
-
var m = { colors: { content: { neutral: { bold: { value: { base: "{colors.neutral.0}", _dark: "{colors.neutral.1100}" } }, default: { value: { base: "{colors.neutral.300}", _dark: "{colors.neutral.1000}" } }, subtle: { value: { base: "{colors.neutral.600}", _dark: "{colors.neutral.900}" } }, subtlest: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.500}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.600}" } }, default_inverse: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.0}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.500}", _dark: "{colors.purple.400}" } }, default_inverse: { value: { base: "{colors.purple.800}", _dark: "{colors.purple.800}" } } }, danger: { default: { value: { base: "{colors.red.600}", _dark: "{colors.red.400}" } } }, warning: { default: { value: { base: "{colors.orange.600}", _dark: "{colors.orange.400}" } } }, success: { default: { value: { base: "{colors.green.600}", _dark: "{colors.green.400}" } } }, informative: { default: { value: { base: "{colors.blue.600}", _dark: "{colors.blue.400}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.800}", _dark: "{colors.ohre.400}" } }, defult_inverse: { value: { base: "{colors.ohre.1000}", _dark: "{colors.ohre.1000}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.800}", _dark: "{colors.cyan.400}" } }, defult_inverse: { value: { base: "{colors.cyan.1000}", _dark: "{colors.cyan.1000}" } } }, static: { white: { bold: { value: { base: "{colors.neutral.1200}", _dark: "{colors.neutral.1200}" } }, default: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.1050}" } }, subtle: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.1000}" } }, subtlest: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.900}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.800}" } } }, black: { bold: { value: { base: "{colors.neutral.0}", _dark: "{colors.neutral.0}" } }, default: { value: { base: "{colors.neutral.200}", _dark: "{colors.neutral.200}" } }, subtle: { value: { base: "{colors.neutral.400}", _dark: "{colors.neutral.400}" } }, subtlest: { value: { base: "{colors.neutral.600}", _dark: "{colors.neutral.600}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.800}" } } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.800}", _dark: "{colors.yellow.500}" } }, default_inverse: { value: { base: "{colors.yellow.1000}", _dark: "{colors.yellow.1000}" } } } }, background: { neutral: { default: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.200}" } }, selected: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.300}" } }, disabled: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.400}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.300}", _dark: "{colors.purple.600}" } }, selected: { value: { base: "{colors.purple.400}", _dark: "{colors.purple.700}" } } }, neuroidSecondary: { default: { value: { base: "{colors.purple.200}", _dark: "{colors.purple.300}" } }, selected: { value: { base: "{colors.purple.300}", _dark: "{colors.purple.400}" } } }, danger: { default: { value: { base: "{colors.red.300}", _dark: "{colors.red.700}" } }, selected: { value: { base: "{colors.red.400}", _dark: "{colors.red.800}" } } }, warning: { default: { value: { base: "{colors.orange.300}", _dark: "{colors.orange.700}" } }, selected: { value: { base: "{colors.orange.400}", _dark: "{colors.orange.800}" } } }, success: { default: { value: { base: "{colors.green.300}", _dark: "{colors.green.700}" } }, selected: { value: { base: "{colors.green.400}", _dark: "{colors.green.800}" } } }, informative: { default: { value: { base: "{colors.blue.300}", _dark: "{colors.blue.700}" } }, selected: { value: { base: "{colors.blue.400}", _dark: "{colors.blue.800}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.400}", _dark: "{colors.ohre.400}" } }, selected: { value: { base: "{colors.ohre.500}", _dark: "{colors.ohre.500}" } } }, zoltarinaSecondary: { default: { value: { base: "{colors.ohre.200}", _dark: "{colors.ohre.200}" } }, selected: { value: { base: "{colors.ohre.300}", _dark: "{colors.ohre.300}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.500}", _dark: "{colors.cyan.500}" } }, selected: { value: { base: "{colors.cyan.600}", _dark: "{colors.cyan.600}" } } }, heydSecondary: { default: { value: { base: "{colors.cyan.200}", _dark: "{colors.cyan.200}" } }, selected: { value: { base: "{colors.cyan.300}", _dark: "{colors.cyan.300}" } } }, static: { whiteAlpha: { bold: { value: { base: "{colors.white.700A}", _dark: "{colors.white.700A}" } }, default: { value: { base: "{colors.white.500A}", _dark: "{colors.white.500A}" } }, selected: { value: { base: "{colors.white.600A}", _dark: "{colors.white.600A}" } }, disabled: { value: { base: "{colors.white.500A}", _dark: "{colors.white.500A}" } } }, blackAlpha: { bold: { value: { base: "{colors.black.700A}", _dark: "{colors.black.700A}" } }, default: { value: { base: "{colors.black.500A}", _dark: "{colors.black.500A}" } }, selected: { value: { base: "{colors.black.600A}", _dark: "{colors.black.600A}" } }, disabled: { value: { base: "{colors.black.500A}", _dark: "{colors.black.500A}" } } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.500}", _dark: "{colors.yellow.500}" } }, selected: { value: { base: "{colors.yellow.600}", _dark: "{colors.yellow.600}" } } } }, surface: { base: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.0}" } }, layer_1: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.100}" } }, layer_2: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.200}" } } }, shadow: { overlay: { value: { base: "{colors.black.100A}", _dark: "{colors.black.400A}" } }, raised: { value: { base: "{colors.black.400A}", _dark: "{colors.black.600A}" } } }, scrim: { default: { value: { base: "{colors.black.600A}", _dark: "{colors.black.600A}" } } }, skeleton: { default: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.100}" } }, subtle: { value: { base: "{colors.neutral.700}", _dark: "{colors.neutral.200}" } } }, border: { neutral: { default: { value: { base: "{colors.neutral.700}", _dark: "{colors.neutral.400}" } }, subtle: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.300}" } }, disabled: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.200}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.500}", _dark: "{colors.purple.400}" } } }, danger: { default: { value: { base: "{colors.red.500}", _dark: "{colors.red.400}" } } }, warning: { default: { value: { base: "{colors.orange.500}", _dark: "{colors.orange.400}" } } }, success: { default: { value: { base: "{colors.green.500}", _dark: "{colors.green.400}" } } }, informative: { default: { value: { base: "{colors.blue.500}", _dark: "{colors.blue.400}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.800}", _dark: "{colors.ohre.400}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.800}", _dark: "{colors.cyan.400}" } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.800}", _dark: "{colors.yellow.500}" } } } } }, shadows: { raised: { value: "0px 1px 3px 0px {colors.shadow.raised}" }, overlay: { value: "0px 20px 25px -5px {colors.shadow.overlay}" } } }, v = { colors: { neutral: { 0: { value: "#080A0E" }, 100: { value: "#101216" }, 200: { value: "#181A1E" }, 300: { value: "#282A2E" }, 400: { value: "#383A3E" }, 500: { value: "#505256" }, 600: { value: "#64666A" }, 700: { value: "#787A7E" }, 800: { value: "#A0A2A6" }, 900: { value: "#B4B6BA" }, 1e3: { value: "#F2F4F8" }, 1050: { value: "#EDEEF1" }, 1100: { value: "#FAFCFF" }, 1200: { value: "#F8F9FF" } }, black: { "700A": { value: "rgba(0,0,0,0.8)" }, "600A": { value: "rgba(0,0,0,0.6)" }, "500A": { value: "rgba(0,0,0,0.4)" }, "400A": { value: "rgba(0,0,0,0.32)" }, "300A": { value: "rgba(0,0,0,0.2)" }, "200A": { value: "rgba(0,0,0,0.12)" }, "100A": { value: "rgba(0,0,0,0.08)" } }, white: { "700A": { value: "rgba(255,255,255,0.8)" }, "600A": { value: "rgba(255,255,255,0.6)" }, "500A": { value: "rgba(255,255,255,0.4)" }, "400A": { value: "rgba(255,255,255,0.32)" }, "300A": { value: "rgba(255,255,255,0.2)" }, "200A": { value: "rgba(255,255,255,0.12)" }, "100A": { value: "rgba(255,255,255,0.08)" } }, red: { 100: { value: "#ffeceb" }, 200: { value: "#ffd5d2" }, 300: { value: "#fd9891" }, 400: { value: "#f87168" }, 500: { value: "#f15b50" }, 600: { value: "#e2483d" }, 700: { value: "#c9372c" }, 800: { value: "#87241c" }, 900: { value: "#5d1f1a" }, 1e3: { value: "#42221f" } }, orange: { 100: { value: "#fff5eb" }, 200: { value: "#ffe9d2" }, 300: { value: "#fdc991" }, 400: { value: "#f8b268" }, 500: { value: "#f1a350" }, 600: { value: "#e2923d" }, 700: { value: "#c97d2c" }, 800: { value: "#87531c" }, 900: { value: "#5d3d1a" }, 1e3: { value: "#42311f" } }, blue: { 100: { value: "#ebf2ff" }, 200: { value: "#d2e1ff" }, 300: { value: "#91b5fd" }, 400: { value: "#6898f8" }, 500: { value: "#5086f1" }, 600: { value: "#3d74e2" }, 700: { value: "#2c60c9" }, 800: { value: "#1c4087" }, 900: { value: "#1a305d" }, 1e3: { value: "#1f2b42" } }, green: { 100: { value: "#ebfff5" }, 200: { value: "#9cfccc" }, 300: { value: "#47EB99" }, 400: { value: "#26d980" }, 500: { value: "#14b866" }, 600: { value: "#10934c" }, 700: { value: "#147042" }, 800: { value: "#125433" }, 900: { value: "#104129" }, 1e3: { value: "#0b2819" } }, purple: { 100: { value: "#f3ebff" }, 200: { value: "#e9ddfd" }, 300: { value: "#cbacfb" }, 400: { value: "#ac7cf8" }, 500: { value: "#8d4bf6" }, 600: { value: "#6d19f5" }, 700: { value: "#570ad1" }, 800: { value: "#4308a0" }, 900: { value: "#2f0670" }, 1e3: { value: "#1a033f" } }, ohre: { 100: { value: "#FFF8F1" }, 200: { value: "#FFE6C8" }, 300: { value: "#FFD3A0" }, 400: { value: "#FFC077" }, 500: { value: "#E2A763" }, 600: { value: "#C58F50" }, 700: { value: "#A8773F" }, 800: { value: "#8A6030" }, 900: { value: "#6D4B22" }, 1e3: { value: "#503617" } }, cyan: { 100: { value: "#ecffff" }, 200: { value: "#c1feff" }, 300: { value: "#96feff" }, 400: { value: "#6bfdff" }, 500: { value: "#3df1f3" }, 600: { value: "#2acfd1" }, 700: { value: "#1aadaf" }, 800: { value: "#0e8c8d" }, 900: { value: "#056a6b" }, 1e3: { value: "#004849" } }, yellow: { 100: { value: "#FFFBED" }, 200: { value: "#FFF3C5" }, 300: { value: "#FFEB9D" }, 400: { value: "#FFE375" }, 500: { value: "#FFDB4D" }, 600: { value: "#DDBC38" }, 700: { value: "#BB9D27" }, 800: { value: "#997F19" }, 900: { value: "#77620E" }, 1e3: { value: "#554506" } } }, borderWidths: { none: { value: "0px" }, sm: { value: "1px" }, md: { value: "2px" }, lg: { value: "4px" } }, spacing: { 0: { value: "0rem" }, 1: { value: "0.25rem" }, 2: { value: "0.5rem" }, 3: { value: "0.75rem" }, 4: { value: "1rem" }, 6: { value: "1.5rem" }, 8: { value: "2rem" }, 12: { value: "3rem" }, 20: { value: "5rem" }, 30: { value: "7.5rem" }, 56: { value: "14rem" }, 72: { value: "18rem" }, 98: { value: "24rem" }, 128: { value: "32rem" }, 160: { value: "40rem" } }, radii: { none: { value: "0px" }, xs: { value: "2px" }, sm: { value: "4px" }, md: { value: "8px" }, lg: { value: "16px" }, full: { value: "9999px" } }, fontSizes: { xs: { value: "0.75rem" }, sm: { value: "0.875rem" }, md: { value: "1rem" }, lg: { value: "1.25rem" }, xl: { value: "1.5rem" }, "2xl": { value: "2rem" }, "3xl": { value: "2.5rem" }, "4xl": { value: "3rem" } }, letterSpacings: { xs: { value: "-1.5px" }, sm: { value: "-1.2px" }, md: { value: "-1px" }, lg: { value: "-0.8px" }, xl: { value: "-0.6px" }, "2xl": { value: "-0.4px" }, "3xl": { value: "-0.2px" } }, lineHeights: { md: { value: "1rem" }, lg: { value: "1.25rem" }, xl: { value: "1.5rem" }, "2xl": { value: "1.75rem" }, "3xl": { value: "2.25rem" }, "4xl": { value: "2.75rem" }, "5xl": { value: "3rem" } }, fontWeights: { regular: { value: "400" }, medium: { value: "500" }, semibold: { value: "600" }, bold: { value: "700" }, regularItalic: { value: "Italic" }, mediumItalic: { value: "Medium Italic" } }, fonts: { inter: { value: "Inter" }, notoSans: { value: "Noto Sans" } } }, $ = { body: { md: { value: { fontFamily: "notoSans", fontWeight: "regular", fontSize: "sm", lineHeight: "lg", letterSpacing: "3xl" } }, lg: { value: { fontFamily: "notoSans", fontWeight: "regular", fontSize: "md", lineHeight: "xl", letterSpacing: "3xl" } }, sm: { value: { fontSize: "xs", fontWeight: "regular", fontFamily: "notoSans", lineHeight: "md", letterSpacing: "3xl" } } }, label: { sm: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "xs", lineHeight: "md", letterSpacing: "3xl" } }, md: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "sm", lineHeight: "lg", letterSpacing: "3xl" } } }, title: { sm: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "sm", lineHeight: "lg", letterSpacing: "2xl" } }, md: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "md", lineHeight: "xl", letterSpacing: "xl" } }, lg: { value: { fontFamily: "notoSans", fontWeight: "semibold", fontSize: "lg", lineHeight: "2xl", letterSpacing: "xl" } } }, headline: { sm: { value: { fontFamily: "inter", fontWeight: "semibold", fontSize: "xl", lineHeight: "2xl", letterSpacing: "lg" } }, md: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "2xl", lineHeight: "3xl", letterSpacing: "md" } } }, display: { md: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "3xl", lineHeight: "4xl", letterSpacing: "sm" } }, lg: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "4xl", lineHeight: "5xl", letterSpacing: "xs" } } } }, g = { semantic: m, primitive: v, textStyles: $ };
|
|
10480
|
+
var m = { colors: { content: { neutral: { bold: { value: { base: "{colors.neutral.0}", _dark: "{colors.neutral.1100}" } }, default: { value: { base: "{colors.neutral.300}", _dark: "{colors.neutral.1000}" } }, subtle: { value: { base: "{colors.neutral.600}", _dark: "{colors.neutral.900}" } }, subtlest: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.500}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.600}" } }, default_inverse: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.0}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.500}", _dark: "{colors.purple.400}" } }, default_inverse: { value: { base: "{colors.purple.800}", _dark: "{colors.purple.800}" } } }, danger: { default: { value: { base: "{colors.red.600}", _dark: "{colors.red.400}" } } }, warning: { default: { value: { base: "{colors.orange.600}", _dark: "{colors.orange.400}" } } }, success: { default: { value: { base: "{colors.green.600}", _dark: "{colors.green.400}" } } }, informative: { default: { value: { base: "{colors.blue.600}", _dark: "{colors.blue.400}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.800}", _dark: "{colors.ohre.400}" } }, default_inverse: { value: { base: "{colors.ohre.1000}", _dark: "{colors.ohre.1000}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.800}", _dark: "{colors.cyan.400}" } }, default_inverse: { value: { base: "{colors.cyan.1000}", _dark: "{colors.cyan.1000}" } } }, static: { white: { bold: { value: { base: "{colors.neutral.1200}", _dark: "{colors.neutral.1200}" } }, default: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.1050}" } }, subtle: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.1000}" } }, subtlest: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.900}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.800}" } } }, black: { bold: { value: { base: "{colors.neutral.0}", _dark: "{colors.neutral.0}" } }, default: { value: { base: "{colors.neutral.200}", _dark: "{colors.neutral.200}" } }, subtle: { value: { base: "{colors.neutral.400}", _dark: "{colors.neutral.400}" } }, subtlest: { value: { base: "{colors.neutral.600}", _dark: "{colors.neutral.600}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.800}" } } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.800}", _dark: "{colors.yellow.500}" } }, default_inverse: { value: { base: "{colors.yellow.1000}", _dark: "{colors.yellow.1000}" } } }, neutralInverse: { bold: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.0}" } }, default: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.300}" } }, subtle: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.600}" } }, subtlest: { value: { base: "{colors.neutral.500}", _dark: "{colors.neutral.900}" } }, disabled: { value: { base: "{colors.neutral.600}", _dark: "{colors.neutral.800}" } }, default_inverse: { value: { base: "{colors.neutral.0}", _dark: "{colors.neutral.1100}" } } } }, background: { neutral: { default: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.200}" } }, selected: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.300}" } }, disabled: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.400}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.300}", _dark: "{colors.purple.600}" } }, selected: { value: { base: "{colors.purple.400}", _dark: "{colors.purple.700}" } } }, neuroidSecondary: { default: { value: { base: "{colors.purple.200}", _dark: "{colors.purple.300}" } }, selected: { value: { base: "{colors.purple.300}", _dark: "{colors.purple.400}" } } }, danger: { default: { value: { base: "{colors.red.300}", _dark: "{colors.red.700}" } }, selected: { value: { base: "{colors.red.400}", _dark: "{colors.red.800}" } } }, warning: { default: { value: { base: "{colors.orange.300}", _dark: "{colors.orange.700}" } }, selected: { value: { base: "{colors.orange.400}", _dark: "{colors.orange.800}" } } }, success: { default: { value: { base: "{colors.green.300}", _dark: "{colors.green.700}" } }, selected: { value: { base: "{colors.green.400}", _dark: "{colors.green.800}" } } }, informative: { default: { value: { base: "{colors.blue.300}", _dark: "{colors.blue.700}" } }, selected: { value: { base: "{colors.blue.400}", _dark: "{colors.blue.800}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.400}", _dark: "{colors.ohre.400}" } }, selected: { value: { base: "{colors.ohre.500}", _dark: "{colors.ohre.500}" } } }, zoltarinaSecondary: { default: { value: { base: "{colors.ohre.200}", _dark: "{colors.ohre.200}" } }, selected: { value: { base: "{colors.ohre.300}", _dark: "{colors.ohre.300}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.500}", _dark: "{colors.cyan.500}" } }, selected: { value: { base: "{colors.cyan.600}", _dark: "{colors.cyan.600}" } } }, heydSecondary: { default: { value: { base: "{colors.cyan.200}", _dark: "{colors.cyan.200}" } }, selected: { value: { base: "{colors.cyan.300}", _dark: "{colors.cyan.300}" } } }, static: { whiteAlpha: { bold: { value: { base: "{colors.white.700A}", _dark: "{colors.white.700A}" } }, default: { value: { base: "{colors.white.500A}", _dark: "{colors.white.500A}" } }, selected: { value: { base: "{colors.white.600A}", _dark: "{colors.white.600A}" } }, disabled: { value: { base: "{colors.white.500A}", _dark: "{colors.white.500A}" } } }, blackAlpha: { bold: { value: { base: "{colors.black.700A}", _dark: "{colors.black.700A}" } }, default: { value: { base: "{colors.black.500A}", _dark: "{colors.black.500A}" } }, selected: { value: { base: "{colors.black.600A}", _dark: "{colors.black.600A}" } }, disabled: { value: { base: "{colors.black.500A}", _dark: "{colors.black.500A}" } } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.500}", _dark: "{colors.yellow.500}" } }, selected: { value: { base: "{colors.yellow.600}", _dark: "{colors.yellow.600}" } } }, neutralInverse: { default: { value: { base: "{colors.neutral.200}", _dark: "{colors.neutral.1050}" } }, selected: { value: { base: "{colors.neutral.300}", _dark: "{colors.neutral.1000}" } }, disabled: { value: { base: "{colors.neutral.400}", _dark: "{colors.neutral.1000}" } } } }, surface: { base: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.0}" } }, layer_1: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.100}" } }, layer_2: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.200}" } } }, shadow: { overlay: { value: { base: "{colors.black.100A}", _dark: "{colors.black.400A}" } }, raised: { value: { base: "{colors.black.400A}", _dark: "{colors.black.600A}" } } }, scrim: { default: { value: { base: "{colors.black.600A}", _dark: "{colors.black.600A}" } } }, skeleton: { default: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.100}" } }, subtle: { value: { base: "{colors.neutral.700}", _dark: "{colors.neutral.200}" } } }, border: { neutral: { default: { value: { base: "{colors.neutral.700}", _dark: "{colors.neutral.400}" } }, subtle: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.300}" } }, disabled: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.200}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.500}", _dark: "{colors.purple.400}" } } }, danger: { default: { value: { base: "{colors.red.500}", _dark: "{colors.red.400}" } } }, warning: { default: { value: { base: "{colors.orange.500}", _dark: "{colors.orange.400}" } } }, success: { default: { value: { base: "{colors.green.500}", _dark: "{colors.green.400}" } } }, informative: { default: { value: { base: "{colors.blue.500}", _dark: "{colors.blue.400}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.800}", _dark: "{colors.ohre.400}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.800}", _dark: "{colors.cyan.400}" } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.800}", _dark: "{colors.yellow.500}" } } } } }, shadows: { raised: { value: "0px 1px 3px 0px {colors.shadow.raised}" }, overlay: { value: "0px 20px 25px -5px {colors.shadow.overlay}" } } }, v = { colors: { neutral: { 0: { value: "#080A0E" }, 100: { value: "#101216" }, 200: { value: "#181A1E" }, 300: { value: "#282A2E" }, 400: { value: "#383A3E" }, 500: { value: "#505256" }, 600: { value: "#64666A" }, 700: { value: "#787A7E" }, 800: { value: "#A0A2A6" }, 900: { value: "#B4B6BA" }, 1e3: { value: "#F2F4F8" }, 1050: { value: "#EDEEF1" }, 1100: { value: "#FAFCFF" }, 1200: { value: "#F8F9FF" } }, black: { "700A": { value: "rgba(0,0,0,0.8)" }, "600A": { value: "rgba(0,0,0,0.6)" }, "500A": { value: "rgba(0,0,0,0.4)" }, "400A": { value: "rgba(0,0,0,0.32)" }, "300A": { value: "rgba(0,0,0,0.2)" }, "200A": { value: "rgba(0,0,0,0.12)" }, "100A": { value: "rgba(0,0,0,0.08)" } }, white: { "700A": { value: "rgba(255,255,255,0.8)" }, "600A": { value: "rgba(255,255,255,0.6)" }, "500A": { value: "rgba(255,255,255,0.4)" }, "400A": { value: "rgba(255,255,255,0.32)" }, "300A": { value: "rgba(255,255,255,0.2)" }, "200A": { value: "rgba(255,255,255,0.12)" }, "100A": { value: "rgba(255,255,255,0.08)" } }, red: { 100: { value: "#ffeceb" }, 200: { value: "#ffd5d2" }, 300: { value: "#fd9891" }, 400: { value: "#f87168" }, 500: { value: "#f15b50" }, 600: { value: "#e2483d" }, 700: { value: "#c9372c" }, 800: { value: "#87241c" }, 900: { value: "#5d1f1a" }, 1e3: { value: "#42221f" } }, orange: { 100: { value: "#fff5eb" }, 200: { value: "#ffe9d2" }, 300: { value: "#fdc991" }, 400: { value: "#f8b268" }, 500: { value: "#f1a350" }, 600: { value: "#e2923d" }, 700: { value: "#c97d2c" }, 800: { value: "#87531c" }, 900: { value: "#5d3d1a" }, 1e3: { value: "#42311f" } }, blue: { 100: { value: "#ebf2ff" }, 200: { value: "#d2e1ff" }, 300: { value: "#91b5fd" }, 400: { value: "#6898f8" }, 500: { value: "#5086f1" }, 600: { value: "#3d74e2" }, 700: { value: "#2c60c9" }, 800: { value: "#1c4087" }, 900: { value: "#1a305d" }, 1e3: { value: "#1f2b42" } }, green: { 100: { value: "#ebfff5" }, 200: { value: "#9cfccc" }, 300: { value: "#47EB99" }, 400: { value: "#26d980" }, 500: { value: "#14b866" }, 600: { value: "#10934c" }, 700: { value: "#147042" }, 800: { value: "#125433" }, 900: { value: "#104129" }, 1e3: { value: "#0b2819" } }, purple: { 100: { value: "#f3ebff" }, 200: { value: "#e9ddfd" }, 300: { value: "#cbacfb" }, 400: { value: "#ac7cf8" }, 500: { value: "#8d4bf6" }, 600: { value: "#6d19f5" }, 700: { value: "#570ad1" }, 800: { value: "#4308a0" }, 900: { value: "#2f0670" }, 1e3: { value: "#1a033f" } }, ohre: { 100: { value: "#FFF8F1" }, 200: { value: "#FFE6C8" }, 300: { value: "#FFD3A0" }, 400: { value: "#FFC077" }, 500: { value: "#E2A763" }, 600: { value: "#C58F50" }, 700: { value: "#A8773F" }, 800: { value: "#8A6030" }, 900: { value: "#6D4B22" }, 1e3: { value: "#503617" } }, cyan: { 100: { value: "#ecffff" }, 200: { value: "#c1feff" }, 300: { value: "#96feff" }, 400: { value: "#6bfdff" }, 500: { value: "#3df1f3" }, 600: { value: "#2acfd1" }, 700: { value: "#1aadaf" }, 800: { value: "#0e8c8d" }, 900: { value: "#056a6b" }, 1e3: { value: "#004849" } }, yellow: { 100: { value: "#FFFBED" }, 200: { value: "#FFF3C5" }, 300: { value: "#FFEB9D" }, 400: { value: "#FFE375" }, 500: { value: "#FFDB4D" }, 600: { value: "#DDBC38" }, 700: { value: "#BB9D27" }, 800: { value: "#997F19" }, 900: { value: "#77620E" }, 1e3: { value: "#554506" } } }, borderWidths: { none: { value: "0px" }, sm: { value: "1px" }, md: { value: "2px" }, lg: { value: "4px" } }, spacing: { 0: { value: "0rem" }, 1: { value: "0.25rem" }, 2: { value: "0.5rem" }, 3: { value: "0.75rem" }, 4: { value: "1rem" }, 6: { value: "1.5rem" }, 8: { value: "2rem" }, 12: { value: "3rem" }, 20: { value: "5rem" }, 30: { value: "7.5rem" }, 56: { value: "14rem" }, 72: { value: "18rem" }, 98: { value: "24rem" }, 128: { value: "32rem" }, 160: { value: "40rem" } }, radii: { none: { value: "0px" }, xs: { value: "2px" }, sm: { value: "4px" }, md: { value: "8px" }, lg: { value: "16px" }, full: { value: "9999px" } }, fontSizes: { xs: { value: "0.75rem" }, sm: { value: "0.875rem" }, md: { value: "1rem" }, lg: { value: "1.25rem" }, xl: { value: "1.5rem" }, "2xl": { value: "2rem" }, "3xl": { value: "2.5rem" }, "4xl": { value: "3rem" } }, letterSpacings: { xs: { value: "-1.5px" }, sm: { value: "-1.2px" }, md: { value: "-1px" }, lg: { value: "-0.8px" }, xl: { value: "-0.6px" }, "2xl": { value: "-0.4px" }, "3xl": { value: "-0.2px" } }, lineHeights: { md: { value: "1rem" }, lg: { value: "1.25rem" }, xl: { value: "1.5rem" }, "2xl": { value: "1.75rem" }, "3xl": { value: "2.25rem" }, "4xl": { value: "2.75rem" }, "5xl": { value: "3rem" } }, fontWeights: { regular: { value: "400" }, medium: { value: "500" }, semibold: { value: "600" }, bold: { value: "700" }, regularItalic: { value: "Italic" }, mediumItalic: { value: "Medium Italic" } }, fonts: { inter: { value: "Inter" }, notoSans: { value: "Noto Sans" } } }, $ = { body: { md: { value: { fontFamily: "notoSans", fontWeight: "regular", fontSize: "sm", lineHeight: "lg", letterSpacing: "3xl" } }, lg: { value: { fontFamily: "notoSans", fontWeight: "regular", fontSize: "md", lineHeight: "xl", letterSpacing: "3xl" } }, sm: { value: { fontSize: "xs", fontWeight: "regular", fontFamily: "notoSans", lineHeight: "md", letterSpacing: "3xl" } } }, label: { sm: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "xs", lineHeight: "md", letterSpacing: "3xl" } }, md: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "sm", lineHeight: "lg", letterSpacing: "3xl" } } }, title: { sm: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "sm", lineHeight: "lg", letterSpacing: "2xl" } }, md: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "md", lineHeight: "xl", letterSpacing: "xl" } }, lg: { value: { fontFamily: "notoSans", fontWeight: "semibold", fontSize: "lg", lineHeight: "2xl", letterSpacing: "xl" } } }, headline: { sm: { value: { fontFamily: "inter", fontWeight: "semibold", fontSize: "xl", lineHeight: "2xl", letterSpacing: "lg" } }, md: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "2xl", lineHeight: "3xl", letterSpacing: "md" } } }, display: { md: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "3xl", lineHeight: "4xl", letterSpacing: "sm" } }, lg: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "4xl", lineHeight: "5xl", letterSpacing: "xs" } } } }, g = { semantic: m, primitive: v, textStyles: $ };
|
|
9428
10481
|
const conditions = {
|
|
9429
10482
|
extend: {
|
|
9430
10483
|
collapsed: '&:is([aria-collapsed=true], [data-collapsed], [data-state="collapsed"])',
|
|
@@ -9649,6 +10702,261 @@ const preset = definePreset({
|
|
|
9649
10702
|
}
|
|
9650
10703
|
}
|
|
9651
10704
|
});
|
|
10705
|
+
const toastRecipe = sva({
|
|
10706
|
+
className: "toast",
|
|
10707
|
+
slots: [...anatomy.keys(), "content", "icon"],
|
|
10708
|
+
base: {
|
|
10709
|
+
root: {
|
|
10710
|
+
display: "flex",
|
|
10711
|
+
alignItems: "center",
|
|
10712
|
+
justifyContent: "center",
|
|
10713
|
+
backgroundColor: "background.neutralInverse.default",
|
|
10714
|
+
borderRadius: 16,
|
|
10715
|
+
height: "fit-content",
|
|
10716
|
+
minHeight: "48px",
|
|
10717
|
+
width: "fit-content",
|
|
10718
|
+
maxWidth: "328px",
|
|
10719
|
+
overflowWrap: "anywhere",
|
|
10720
|
+
zIndex: "overlay",
|
|
10721
|
+
fontStyle: "body.md",
|
|
10722
|
+
color: "content.neutralInverse.bold",
|
|
10723
|
+
pr: 4,
|
|
10724
|
+
pl: 3,
|
|
10725
|
+
py: 2,
|
|
10726
|
+
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
10727
|
+
animation: "fadeIn 0.25s ease-out",
|
|
10728
|
+
transform: "translateY(20px)",
|
|
10729
|
+
shadow: "overlay",
|
|
10730
|
+
transition: "transform 0.25s ease-out",
|
|
10731
|
+
'&[data-state="open"]': {
|
|
10732
|
+
animation: "slide-in 0.4s cubic-bezier(0.05, 0.7, 0.1, 1.0)",
|
|
10733
|
+
transform: "translateY(0px)"
|
|
10734
|
+
},
|
|
10735
|
+
'&[data-state="closed"]': {
|
|
10736
|
+
animation: "slide-out 0.2s cubic-bezier(0.3, 0.0, 0.8, 0.15)",
|
|
10737
|
+
transform: "translateY(64px)"
|
|
10738
|
+
}
|
|
10739
|
+
},
|
|
10740
|
+
content: {
|
|
10741
|
+
display: "inline-flex",
|
|
10742
|
+
alignItems: "center"
|
|
10743
|
+
},
|
|
10744
|
+
description: {
|
|
10745
|
+
textStyle: "body.md",
|
|
10746
|
+
marginLeft: 2
|
|
10747
|
+
},
|
|
10748
|
+
actionTrigger: {
|
|
10749
|
+
height: "100%",
|
|
10750
|
+
width: "fit-content",
|
|
10751
|
+
display: "flex",
|
|
10752
|
+
alignItems: "center",
|
|
10753
|
+
justifyContent: "center",
|
|
10754
|
+
textStyle: "title.sm",
|
|
10755
|
+
cursor: "pointer",
|
|
10756
|
+
px: 4,
|
|
10757
|
+
pr: 1,
|
|
10758
|
+
whiteSpace: "nowrap",
|
|
10759
|
+
transition: "opacity 0.2s ease",
|
|
10760
|
+
color: "content.neutralInverse.bold",
|
|
10761
|
+
"&:hover": {
|
|
10762
|
+
opacity: 0.8
|
|
10763
|
+
}
|
|
10764
|
+
},
|
|
10765
|
+
icon: {
|
|
10766
|
+
width: 6,
|
|
10767
|
+
height: 6,
|
|
10768
|
+
minWidth: 6,
|
|
10769
|
+
minHeight: 6,
|
|
10770
|
+
display: "flex",
|
|
10771
|
+
alignItems: "center",
|
|
10772
|
+
justifyContent: "center"
|
|
10773
|
+
}
|
|
10774
|
+
},
|
|
10775
|
+
variants: {
|
|
10776
|
+
width: {
|
|
10777
|
+
full: {
|
|
10778
|
+
root: {
|
|
10779
|
+
width: "100%",
|
|
10780
|
+
justifyContent: "space-between"
|
|
10781
|
+
}
|
|
10782
|
+
},
|
|
10783
|
+
fit: {
|
|
10784
|
+
root: {
|
|
10785
|
+
width: "fit-content"
|
|
10786
|
+
}
|
|
10787
|
+
}
|
|
10788
|
+
},
|
|
10789
|
+
asLink: {
|
|
10790
|
+
true: {
|
|
10791
|
+
actionTrigger: {
|
|
10792
|
+
textDecoration: "underline",
|
|
10793
|
+
cursor: "pointer"
|
|
10794
|
+
}
|
|
10795
|
+
}
|
|
10796
|
+
}
|
|
10797
|
+
}
|
|
10798
|
+
});
|
|
10799
|
+
const { withProvider, withContext } = createStyleContext(toastRecipe);
|
|
10800
|
+
const OriginalRoot = withProvider(ToastRoot, "root");
|
|
10801
|
+
const Root = React.forwardRef((props, ref) => {
|
|
10802
|
+
const { children, width, ...rest } = props;
|
|
10803
|
+
const hasActionTrigger = React.Children.toArray(children).some((child) => {
|
|
10804
|
+
if (React.isValidElement(child)) {
|
|
10805
|
+
if (child.type === ActionTrigger) {
|
|
10806
|
+
return true;
|
|
10807
|
+
}
|
|
10808
|
+
if (child.type === React.Fragment && child.props.children) {
|
|
10809
|
+
return React.Children.toArray(child.props.children).some(
|
|
10810
|
+
(fragmentChild) => React.isValidElement(fragmentChild) && fragmentChild.type === ActionTrigger
|
|
10811
|
+
);
|
|
10812
|
+
}
|
|
10813
|
+
}
|
|
10814
|
+
return false;
|
|
10815
|
+
});
|
|
10816
|
+
const widthValue = width !== void 0 ? width : hasActionTrigger ? "full" : "fit";
|
|
10817
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OriginalRoot, { ref, width: widthValue, ...rest, children });
|
|
10818
|
+
});
|
|
10819
|
+
Root.displayName = "Toast.Root";
|
|
10820
|
+
const OriginalActionTrigger = withContext(
|
|
10821
|
+
ToastActionTrigger,
|
|
10822
|
+
"actionTrigger"
|
|
10823
|
+
);
|
|
10824
|
+
const OriginalActionTriggerAsLink = withContext(ark.a, "actionTrigger");
|
|
10825
|
+
const ActionTrigger = React.forwardRef((props, ref) => {
|
|
10826
|
+
const { asLink, ...rest } = props;
|
|
10827
|
+
return asLink ? /* @__PURE__ */ jsxRuntime.jsx(OriginalActionTriggerAsLink, { ref, ...rest }) : /* @__PURE__ */ jsxRuntime.jsx(OriginalActionTrigger, { ref, ...rest });
|
|
10828
|
+
});
|
|
10829
|
+
ActionTrigger.displayName = "Toast.ActionTrigger";
|
|
10830
|
+
const Description = withContext(
|
|
10831
|
+
ToastDescription,
|
|
10832
|
+
"description"
|
|
10833
|
+
);
|
|
10834
|
+
const Content = withContext(ark.div, "content");
|
|
10835
|
+
const Icon = withContext(ark.div, "icon");
|
|
10836
|
+
const Toast = {
|
|
10837
|
+
Root,
|
|
10838
|
+
ActionTrigger,
|
|
10839
|
+
Content,
|
|
10840
|
+
Description,
|
|
10841
|
+
Icon
|
|
10842
|
+
};
|
|
10843
|
+
const toast = {
|
|
10844
|
+
queue: [],
|
|
10845
|
+
// ToastProvider에서 호출
|
|
10846
|
+
_getQueue: () => {
|
|
10847
|
+
const queue = [...toast.queue];
|
|
10848
|
+
toast.queue = [];
|
|
10849
|
+
return queue;
|
|
10850
|
+
},
|
|
10851
|
+
// render toast
|
|
10852
|
+
show: (message, options) => {
|
|
10853
|
+
const toastData = {
|
|
10854
|
+
description: message,
|
|
10855
|
+
action: (options == null ? void 0 : options.actionLabel) ? {
|
|
10856
|
+
label: options.actionLabel,
|
|
10857
|
+
onClick: options.onActionClick
|
|
10858
|
+
} : void 0,
|
|
10859
|
+
icon: options == null ? void 0 : options.icon,
|
|
10860
|
+
asLink: options == null ? void 0 : options.asLink,
|
|
10861
|
+
duration: options == null ? void 0 : options.duration
|
|
10862
|
+
};
|
|
10863
|
+
toast.queue.push(toastData);
|
|
10864
|
+
if (typeof window !== "undefined") {
|
|
10865
|
+
window.dispatchEvent(new CustomEvent("toast-queue-updated"));
|
|
10866
|
+
}
|
|
10867
|
+
},
|
|
10868
|
+
success: (message, options) => {
|
|
10869
|
+
toast.show(message, { ...options });
|
|
10870
|
+
},
|
|
10871
|
+
error: (message, options) => {
|
|
10872
|
+
toast.show(message, { ...options });
|
|
10873
|
+
},
|
|
10874
|
+
warning: (message, options) => {
|
|
10875
|
+
toast.show(message, { ...options });
|
|
10876
|
+
},
|
|
10877
|
+
info: (message, options) => {
|
|
10878
|
+
toast.show(message, { ...options });
|
|
10879
|
+
}
|
|
10880
|
+
};
|
|
10881
|
+
const DURATION = {
|
|
10882
|
+
DEFAULT: 2500,
|
|
10883
|
+
HAS_ACTION: 5500
|
|
10884
|
+
};
|
|
10885
|
+
const ToastProvider = ({ children }) => {
|
|
10886
|
+
const toaster = createToaster({
|
|
10887
|
+
placement: "bottom",
|
|
10888
|
+
duration: DURATION.DEFAULT,
|
|
10889
|
+
offsets: {
|
|
10890
|
+
bottom: "55px",
|
|
10891
|
+
top: "0px",
|
|
10892
|
+
left: "0px",
|
|
10893
|
+
right: "0px"
|
|
10894
|
+
},
|
|
10895
|
+
overlap: true
|
|
10896
|
+
});
|
|
10897
|
+
React.useEffect(() => {
|
|
10898
|
+
let currentZIndexCounter = 1300;
|
|
10899
|
+
const showToasts = () => {
|
|
10900
|
+
const queuedToasts = toast._getQueue();
|
|
10901
|
+
queuedToasts.forEach((toastData) => {
|
|
10902
|
+
try {
|
|
10903
|
+
const options = {
|
|
10904
|
+
description: toastData.description,
|
|
10905
|
+
zIndex: currentZIndexCounter++
|
|
10906
|
+
// 증가된 zIndex 값 사용
|
|
10907
|
+
};
|
|
10908
|
+
options.data = {
|
|
10909
|
+
icon: toastData.icon ? toastData.icon : null,
|
|
10910
|
+
asLink: toastData.asLink,
|
|
10911
|
+
zIndex: options.zIndex
|
|
10912
|
+
// zIndex를 data에도 저장
|
|
10913
|
+
};
|
|
10914
|
+
if (toastData.action) {
|
|
10915
|
+
options.action = {
|
|
10916
|
+
label: toastData.action.label,
|
|
10917
|
+
onClick: toastData.action.onClick ?? (() => {
|
|
10918
|
+
}),
|
|
10919
|
+
duration: DURATION.HAS_ACTION
|
|
10920
|
+
};
|
|
10921
|
+
}
|
|
10922
|
+
if (toastData.duration) {
|
|
10923
|
+
options.duration = toastData.duration;
|
|
10924
|
+
}
|
|
10925
|
+
toaster.create(options);
|
|
10926
|
+
} catch (error) {
|
|
10927
|
+
console.error("Error creating toast:", error);
|
|
10928
|
+
}
|
|
10929
|
+
});
|
|
10930
|
+
};
|
|
10931
|
+
showToasts();
|
|
10932
|
+
const handleToastQueue = () => showToasts();
|
|
10933
|
+
window.addEventListener("toast-queue-updated", handleToastQueue);
|
|
10934
|
+
return () => {
|
|
10935
|
+
window.removeEventListener("toast-queue-updated", handleToastQueue);
|
|
10936
|
+
};
|
|
10937
|
+
}, [toaster]);
|
|
10938
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10939
|
+
children,
|
|
10940
|
+
/* @__PURE__ */ jsxRuntime.jsx(Toaster, { toaster, children: (toast2) => {
|
|
10941
|
+
var _a, _b, _c, _d, _e;
|
|
10942
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10943
|
+
Toast.Root,
|
|
10944
|
+
{
|
|
10945
|
+
asLink: (_a = toast2.data) == null ? void 0 : _a.asLink,
|
|
10946
|
+
style: { zIndex: ((_b = toast2.data) == null ? void 0 : _b.zIndex) || 1e3 },
|
|
10947
|
+
children: [
|
|
10948
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Toast.Content, { children: [
|
|
10949
|
+
((_c = toast2.data) == null ? void 0 : _c.icon) && /* @__PURE__ */ jsxRuntime.jsx(Toast.Icon, { children: toast2.data.icon }),
|
|
10950
|
+
toast2.description && /* @__PURE__ */ jsxRuntime.jsx(Toast.Description, { children: toast2.description })
|
|
10951
|
+
] }),
|
|
10952
|
+
toast2.action && /* @__PURE__ */ jsxRuntime.jsx(Toast.ActionTrigger, { onClick: (_d = toast2.action) == null ? void 0 : _d.onClick, children: (_e = toast2.action) == null ? void 0 : _e.label })
|
|
10953
|
+
]
|
|
10954
|
+
},
|
|
10955
|
+
toast2.id
|
|
10956
|
+
);
|
|
10957
|
+
} })
|
|
10958
|
+
] });
|
|
10959
|
+
};
|
|
9652
10960
|
exports.BottomSheet = BottomSheet;
|
|
9653
10961
|
exports.Box = Box2;
|
|
9654
10962
|
exports.Button = index$1;
|
|
@@ -9667,6 +10975,8 @@ exports.Stack = Stack2;
|
|
|
9667
10975
|
exports.Tag = Tag;
|
|
9668
10976
|
exports.Text = Text;
|
|
9669
10977
|
exports.TextArea = Textarea;
|
|
10978
|
+
exports.ToastProvider = ToastProvider;
|
|
9670
10979
|
exports.VStack = VStack2;
|
|
9671
10980
|
exports.preset = preset;
|
|
10981
|
+
exports.toast = toast;
|
|
9672
10982
|
//# sourceMappingURL=index.cjs.map
|