@youcan/celeste 0.6.38 → 0.6.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/celeste.css +70 -0
  2. package/dist/cjs/chunks/index.js +203 -1
  3. package/dist/cjs/chunks/index2.js +35 -1448
  4. package/dist/cjs/chunks/index3.js +1336 -16336
  5. package/dist/cjs/chunks/index4.js +16457 -0
  6. package/dist/cjs/digit-input-group.js +31 -0
  7. package/dist/cjs/digit-input-slot.js +28 -0
  8. package/dist/cjs/digit-input.js +46 -0
  9. package/dist/cjs/index.js +9 -0
  10. package/dist/cjs/link-bubble.js +1 -1
  11. package/dist/cjs/rich-editor.js +1 -1
  12. package/dist/components/digit-input/digit-input-group.d.ts +22 -0
  13. package/dist/components/digit-input/digit-input-slot.d.ts +7 -0
  14. package/dist/components/digit-input/digit-input.d.ts +32 -0
  15. package/dist/components/digit-input/index.d.ts +6 -0
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/es/chunks/index.js +241 -39
  18. package/dist/es/chunks/index2.js +36 -1448
  19. package/dist/es/chunks/index3.js +1335 -16336
  20. package/dist/es/chunks/index4.js +16458 -0
  21. package/dist/es/digit-input-group.js +32 -0
  22. package/dist/es/digit-input-slot.js +29 -0
  23. package/dist/es/digit-input.js +47 -0
  24. package/dist/es/dropdown-menu-content.js +1 -1
  25. package/dist/es/dropdown-menu-group.js +1 -1
  26. package/dist/es/dropdown-menu-item.js +1 -1
  27. package/dist/es/dropdown-menu-label.js +1 -1
  28. package/dist/es/dropdown-menu-separator.js +1 -1
  29. package/dist/es/dropdown-menu-sub-content.js +1 -1
  30. package/dist/es/dropdown-menu-sub-trigger.js +1 -1
  31. package/dist/es/dropdown-menu-trigger.js +1 -1
  32. package/dist/es/dropdown-menu.js +1 -1
  33. package/dist/es/index.js +9 -0
  34. package/dist/es/link-bubble.js +1 -1
  35. package/dist/es/modal-content.js +1 -1
  36. package/dist/es/modal-header.js +1 -1
  37. package/dist/es/popover-content.js +1 -1
  38. package/dist/es/popover-trigger.js +1 -1
  39. package/dist/es/progress-bar.js +1 -1
  40. package/dist/es/progress-circle.js +1 -1
  41. package/dist/es/rich-editor.js +1 -1
  42. package/dist/es/select-content.js +1 -1
  43. package/dist/es/select-item.js +1 -1
  44. package/dist/es/select-trigger.js +1 -1
  45. package/dist/es/select-value.js +1 -1
  46. package/dist/es/tooltip.js +1 -1
  47. package/package.json +4 -3
  48. package/src/components/digit-input/digit-input-group.vue +24 -0
  49. package/src/components/digit-input/digit-input-slot.vue +86 -0
  50. package/src/components/digit-input/digit-input.vue +37 -0
  51. package/src/components/digit-input/index.ts +8 -0
  52. package/src/components/digit-input/stories/digit-input.stories.ts +220 -0
  53. package/src/components/index.ts +1 -0
package/dist/celeste.css CHANGED
@@ -2382,6 +2382,76 @@ to {
2382
2382
  clip: rect(0, 0, 0, 0);
2383
2383
  border: 0;
2384
2384
  white-space: nowrap;
2385
+ }.celeste-digit-input-group[data-v-1a28428d] {
2386
+ display: flex;
2387
+ align-items: center;
2388
+ gap: var(--spacing-10);
2389
+ }.celeste-digit-input-slot[data-v-5b5299e2] {
2390
+ --celeste-digit-input-border-color: var(--color-stroke-soft-200);
2391
+ --celeste-digit-input-drop-shadow: var(--shadow-regular-xs);
2392
+ --celeste-digit-input-placeholder-color: var(--color-text-soft-400);
2393
+ display: flex;
2394
+ box-sizing: border-box;
2395
+ align-items: center;
2396
+ justify-content: center;
2397
+ width: 44px;
2398
+ height: 44px;
2399
+ padding: 0;
2400
+ transition: all var(--animation-fast) ease-out;
2401
+ border: 1px solid var(--celeste-digit-input-border-color);
2402
+ border-radius: var(--radius-10);
2403
+ outline: 2px solid transparent;
2404
+ outline-offset: 2px;
2405
+ background-color: var(--color-bg-white-0);
2406
+ box-shadow: var(--celeste-digit-input-drop-shadow);
2407
+ color: var(--color-text-strong-950);
2408
+ font: var(--paragraph-sm);
2409
+ text-align: center;
2410
+ }
2411
+ .celeste-digit-input-slot[data-v-5b5299e2]::-moz-placeholder {
2412
+ -moz-transition: color var(--animation-fast) ease-out;
2413
+ transition: color var(--animation-fast) ease-out;
2414
+ color: var(--celeste-digit-input-placeholder-color);
2415
+ }
2416
+ .celeste-digit-input-slot[data-v-5b5299e2]::placeholder {
2417
+ transition: color var(--animation-fast) ease-out;
2418
+ color: var(--celeste-digit-input-placeholder-color);
2419
+ }
2420
+ .celeste-digit-input-slot[data-v-5b5299e2]:focus {
2421
+ --celeste-digit-input-border-color: var(--color-stroke-strong-950);
2422
+ --celeste-digit-input-placeholder-color: var(--color-text-sub-600);
2423
+ outline-color: var(--color-stroke-soft-200);
2424
+ }
2425
+ .celeste-digit-input-slot[data-v-5b5299e2]:disabled {
2426
+ --celeste-digit-input-border-color: transparent;
2427
+ --celeste-digit-input-drop-shadow: none;
2428
+ --celeste-digit-input-placeholder-color: var(--color-text-disabled-300);
2429
+ background-color: var(--color-bg-weak-50);
2430
+ box-shadow: none;
2431
+ color: var(--color-text-disabled-300);
2432
+ pointer-events: none;
2433
+ }
2434
+ .celeste-digit-input-slot[data-v-5b5299e2]:disabled::-moz-placeholder {
2435
+ color: currentcolor;
2436
+ }
2437
+ .celeste-digit-input-slot[data-v-5b5299e2]:disabled::placeholder {
2438
+ color: currentcolor;
2439
+ }
2440
+ [data-error=true] .celeste-digit-input-slot[data-v-5b5299e2] {
2441
+ --celeste-digit-input-border-color: var(--color-state-error-base);
2442
+ }
2443
+ [data-error=true] .celeste-digit-input-slot[data-v-5b5299e2]:focus {
2444
+ --celeste-digit-input-border-color: var(--color-state-error-base);
2445
+ outline-color: var(--color-state-error-lighter);
2446
+ }
2447
+ .celeste-digit-input-slot[data-v-5b5299e2]:hover:not(:focus, :disabled) {
2448
+ --celeste-digit-input-border-color: transparent;
2449
+ --celeste-digit-input-placeholder-color: var(--color-text-sub-600);
2450
+ background-color: var(--color-bg-weak-50);
2451
+ }.celeste-digit-input[data-v-be93d7bf] {
2452
+ display: flex;
2453
+ align-items: center;
2454
+ gap: var(--spacing-10);
2385
2455
  }.celeste-context-menu-item[data-v-3d94f388] {
2386
2456
  display: flex;
2387
2457
  box-sizing: border-box;
@@ -6102,7 +6102,207 @@ const Oh = /* @__PURE__ */ Mo.defineComponent({
6102
6102
  }, 16));
6103
6103
  }
6104
6104
  });
6105
- const [Nt, Xc] = Q("PopoverRoot"), ys = /* @__PURE__ */ Mo.defineComponent({
6105
+ const Gc = ["id", "value", "name", "disabled", "required"], [qc, Yc] = Q("PinInputRoot"), Dy = /* @__PURE__ */ Mo.defineComponent({
6106
+ inheritAttrs: false,
6107
+ __name: "PinInputRoot",
6108
+ props: {
6109
+ modelValue: {},
6110
+ defaultValue: {},
6111
+ placeholder: { default: "" },
6112
+ mask: { type: Boolean },
6113
+ otp: { type: Boolean },
6114
+ type: { default: "text" },
6115
+ dir: {},
6116
+ name: {},
6117
+ disabled: { type: Boolean },
6118
+ required: { type: Boolean },
6119
+ id: {},
6120
+ asChild: { type: Boolean },
6121
+ as: {}
6122
+ },
6123
+ emits: ["update:modelValue", "complete"],
6124
+ setup(a2, { emit: t }) {
6125
+ const e = a2, n = t, { mask: l, otp: s, placeholder: r, type: i, disabled: u, dir: d } = Mo.toRefs(e), { forwardRef: c } = R(), f = be(d), v = ne(e, "modelValue", n, {
6126
+ defaultValue: e.defaultValue ?? [],
6127
+ passive: e.modelValue === void 0
6128
+ }), p = Mo.ref(/* @__PURE__ */ new Set());
6129
+ function g(_) {
6130
+ p.value.add(_);
6131
+ }
6132
+ const m = Mo.computed(() => v.value.filter((C) => !!C).length === p.value.size);
6133
+ return Mo.watch(v, () => {
6134
+ m.value && n("complete", v.value);
6135
+ }, { deep: true }), Yc({
6136
+ modelValue: v,
6137
+ mask: l,
6138
+ otp: s,
6139
+ placeholder: r,
6140
+ type: i,
6141
+ dir: f,
6142
+ disabled: u,
6143
+ isCompleted: m,
6144
+ inputElements: p,
6145
+ onInputElementChange: g
6146
+ }), (_, C) => (Mo.openBlock(), Mo.createElementBlock(Mo.Fragment, null, [
6147
+ Mo.createVNode(Mo.unref(O), Mo.mergeProps(_.$attrs, {
6148
+ ref: Mo.unref(c),
6149
+ dir: Mo.unref(f),
6150
+ "data-complete": m.value ? "" : void 0,
6151
+ "data-disabled": Mo.unref(u) ? "" : void 0
6152
+ }), {
6153
+ default: Mo.withCtx(() => [
6154
+ Mo.renderSlot(_.$slots, "default", { modelValue: Mo.unref(v) })
6155
+ ]),
6156
+ _: 3
6157
+ }, 16, ["dir", "data-complete", "data-disabled"]),
6158
+ Mo.createElementVNode("input", {
6159
+ id: _.id,
6160
+ type: "text",
6161
+ tabindex: "-1",
6162
+ "aria-hidden": "true",
6163
+ value: Mo.unref(v).join(""),
6164
+ name: _.name,
6165
+ disabled: Mo.unref(u),
6166
+ required: _.required,
6167
+ style: {
6168
+ transform: "translateX(-100%)",
6169
+ position: "absolute",
6170
+ pointerEvents: "none",
6171
+ opacity: 0,
6172
+ margin: 0
6173
+ },
6174
+ onFocus: C[0] || (C[0] = ($) => {
6175
+ var h, E;
6176
+ return (E = (h = Array.from(p.value)) == null ? void 0 : h[0]) == null ? void 0 : E.focus();
6177
+ })
6178
+ }, null, 40, Gc)
6179
+ ], 64));
6180
+ }
6181
+ }), $y = /* @__PURE__ */ Mo.defineComponent({
6182
+ __name: "PinInputInput",
6183
+ props: {
6184
+ index: {},
6185
+ disabled: { type: Boolean },
6186
+ asChild: { type: Boolean },
6187
+ as: { default: "input" }
6188
+ },
6189
+ setup(a2) {
6190
+ const t = a2, e = qc(), n = Mo.computed(() => Array.from(e.inputElements.value)), l = Mo.computed(() => e.modelValue.value[t.index]), s = Mo.computed(() => t.disabled || e.disabled.value), r = Mo.computed(() => e.otp.value), i = Mo.computed(() => e.type.value === "number"), u = Mo.computed(() => e.mask.value), { primitiveElement: d, currentElement: c } = Ie();
6191
+ function f(D) {
6192
+ var V;
6193
+ const I = D.target;
6194
+ if ((((V = D.data) == null ? void 0 : V.length) ?? 0) > 1) {
6195
+ h(I.value);
6196
+ return;
6197
+ }
6198
+ if (i.value && !/^\d*$/.test(I.value)) {
6199
+ I.value = I.value.replace(/\D/g, "");
6200
+ return;
6201
+ }
6202
+ I.value = I.value.slice(-1), P(t.index, I.value);
6203
+ const M = n.value[t.index + 1];
6204
+ M && M.focus();
6205
+ }
6206
+ function v() {
6207
+ const D = c.value;
6208
+ Mo.nextTick(() => {
6209
+ D.value || (D.placeholder = e.placeholder.value);
6210
+ });
6211
+ }
6212
+ function p(D) {
6213
+ Rt(D, document.activeElement, void 0, {
6214
+ itemsArray: n.value,
6215
+ focus: true,
6216
+ loop: false,
6217
+ arrowKeyOptions: "horizontal",
6218
+ dir: e.dir.value
6219
+ });
6220
+ }
6221
+ function g(D) {
6222
+ if (D.preventDefault(), D.target.value)
6223
+ P(t.index, "");
6224
+ else {
6225
+ const V = n.value[t.index - 1];
6226
+ V && (V.focus(), P(t.index - 1, ""));
6227
+ }
6228
+ }
6229
+ function m(D) {
6230
+ D.key === "Delete" && (D.preventDefault(), P(t.index, ""));
6231
+ }
6232
+ function _(D) {
6233
+ const I = D.target;
6234
+ I.setSelectionRange(1, 1), I.value || (I.placeholder = "");
6235
+ }
6236
+ function C(D) {
6237
+ v();
6238
+ }
6239
+ function $(D) {
6240
+ D.preventDefault();
6241
+ const I = D.clipboardData;
6242
+ if (!I)
6243
+ return;
6244
+ const M = I.getData("text");
6245
+ h(M);
6246
+ }
6247
+ function h(D) {
6248
+ var A;
6249
+ const I = [...e.modelValue.value], M = D.length >= n.value.length ? 0 : t.index, V = Math.min(M + D.length, n.value.length);
6250
+ for (let F = M; F < V; F++) {
6251
+ const j = n.value[F], W = D[F - M];
6252
+ i.value && !/^\d*$/.test(W) || (I[F] = W, j.focus());
6253
+ }
6254
+ e.modelValue.value = I, (A = n.value[V]) == null || A.focus();
6255
+ }
6256
+ function E(D) {
6257
+ let I = D.length - 1;
6258
+ for (; I >= 0 && D[I] === ""; )
6259
+ D.pop(), I--;
6260
+ return D;
6261
+ }
6262
+ function P(D, I) {
6263
+ const M = [...e.modelValue.value];
6264
+ M[D] = I, e.modelValue.value = E(M);
6265
+ }
6266
+ return Mo.watch(l, () => {
6267
+ l.value || v();
6268
+ }), Mo.onMounted(() => {
6269
+ e.onInputElementChange(c.value);
6270
+ }), Mo.onUnmounted(() => {
6271
+ var D;
6272
+ (D = e.inputElements) == null || D.value.delete(c.value);
6273
+ }), (D, I) => (Mo.openBlock(), Mo.createBlock(Mo.unref(O), {
6274
+ ref_key: "primitiveElement",
6275
+ ref: d,
6276
+ autocapitalize: "none",
6277
+ as: D.as,
6278
+ "as-child": D.asChild,
6279
+ autocomplete: r.value ? "one-time-code" : "false",
6280
+ type: u.value ? "password" : "text",
6281
+ inputmode: i.value ? "numeric" : "text",
6282
+ pattern: i.value ? "[0-9]*" : void 0,
6283
+ placeholder: Mo.unref(e).placeholder.value,
6284
+ value: l.value,
6285
+ disabled: s.value,
6286
+ "data-disabled": s.value ? "" : void 0,
6287
+ "data-complete": Mo.unref(e).isCompleted.value ? "" : void 0,
6288
+ "aria-label": `pin input ${D.index + 1} of ${n.value.length}`,
6289
+ onInput: I[0] || (I[0] = (M) => f(M)),
6290
+ onKeydown: [
6291
+ Mo.withKeys(p, ["left", "right", "up", "down", "home", "end"]),
6292
+ Mo.withKeys(g, ["backspace"]),
6293
+ Mo.withKeys(m, ["delete"])
6294
+ ],
6295
+ onFocus: _,
6296
+ onBlur: C,
6297
+ onPaste: $
6298
+ }, {
6299
+ default: Mo.withCtx(() => [
6300
+ Mo.renderSlot(D.$slots, "default")
6301
+ ]),
6302
+ _: 3
6303
+ }, 8, ["as", "as-child", "autocomplete", "type", "inputmode", "pattern", "placeholder", "value", "disabled", "data-disabled", "data-complete", "aria-label"]));
6304
+ }
6305
+ }), [Nt, Xc] = Q("PopoverRoot"), ys = /* @__PURE__ */ Mo.defineComponent({
6106
6306
  __name: "PopoverRoot",
6107
6307
  props: {
6108
6308
  defaultOpen: { type: Boolean, default: false },
@@ -9302,12 +9502,14 @@ const av = /* @__PURE__ */ Mo.defineComponent({
9302
9502
  }, 16));
9303
9503
  }
9304
9504
  });
9505
+ exports.$y = $y;
9305
9506
  exports.At = At;
9306
9507
  exports.By = By;
9307
9508
  exports.Cg = Cg;
9308
9509
  exports.Ch = Ch;
9309
9510
  exports.Du = Du;
9310
9511
  exports.Dv = Dv;
9512
+ exports.Dy = Dy;
9311
9513
  exports.Eu = Eu;
9312
9514
  exports.Fy = Fy;
9313
9515
  exports.Gl = Gl;