@youcan/celeste 0.23.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/ai/README.md +1 -1
  2. package/ai/component-registry.json +32 -2
  3. package/ai/icons.json +2 -2
  4. package/ai/tokens.json +2 -2
  5. package/dist/celeste.css +320 -181
  6. package/dist/cjs/chunks/alpha-slider.cjs +2 -2
  7. package/dist/cjs/chunks/button.cjs +9 -3
  8. package/dist/cjs/chunks/color-picker.cjs +3 -3
  9. package/dist/cjs/chunks/compact-button.cjs +1 -1
  10. package/dist/cjs/chunks/fancy-button.cjs +9 -3
  11. package/dist/cjs/chunks/social-button.cjs +1 -1
  12. package/dist/cjs/chunks/text-input-button.cjs +2 -0
  13. package/dist/cjs/chunks/tooltip-content.cjs +1 -1
  14. package/dist/cjs/chunks/tooltip-root.cjs +3 -11
  15. package/dist/components/button/button.d.ts +5 -1
  16. package/dist/components/button/fancy-button.d.ts +5 -1
  17. package/dist/es/chunks/alpha-slider.js +2 -2
  18. package/dist/es/chunks/button.js +10 -4
  19. package/dist/es/chunks/color-picker.js +3 -3
  20. package/dist/es/chunks/compact-button.js +1 -1
  21. package/dist/es/chunks/fancy-button.js +10 -4
  22. package/dist/es/chunks/social-button.js +1 -1
  23. package/dist/es/chunks/text-input-button.js +2 -0
  24. package/dist/es/chunks/tooltip-content.js +1 -1
  25. package/dist/es/chunks/tooltip-root.js +4 -12
  26. package/package.json +3 -3
  27. package/src/components/button/button.vue +59 -5
  28. package/src/components/button/compact-button.vue +1 -0
  29. package/src/components/button/fancy-button.vue +62 -5
  30. package/src/components/button/social-button.vue +1 -0
  31. package/src/components/button/stories/button.stories.ts +28 -0
  32. package/src/components/button/stories/fancy-button.stories.ts +28 -0
  33. package/src/components/color-picker/alpha-slider.vue +2 -2
  34. package/src/components/color-picker/color-picker.vue +1 -1
  35. package/src/components/tooltip/tooltip-content.vue +1 -1
  36. package/src/components/tooltip/tooltip-root.vue +2 -7
@@ -49,7 +49,7 @@ var alpha_slider_default = /* @__PURE__ */ (0, vue.defineComponent)({
49
49
  if (left < 0) a = 0;
50
50
  else if (left > containerWidth) a = 1;
51
51
  else a = Math.round(left * 100 / containerWidth) / 100;
52
- if (alpha.value !== a) tinyColorRef.value = tinyColorRef.value.setAlpha(a).clone();
52
+ if (alpha.value !== a) tinyColorRef.value = tinyColorRef.value.clone().setAlpha(a);
53
53
  }
54
54
  function handleMouseDown(e) {
55
55
  handleChange(e, true);
@@ -77,7 +77,7 @@ var alpha_slider_default = /* @__PURE__ */ (0, vue.defineComponent)({
77
77
  break;
78
78
  case "right": newValue = currentValue + .1 > 1 ? 1 : currentValue + .1;
79
79
  }
80
- if (typeof newValue !== "undefined") tinyColorRef.value = tinyColorRef.value.setAlpha(newValue).clone();
80
+ if (typeof newValue !== "undefined") tinyColorRef.value = tinyColorRef.value.clone().setAlpha(newValue);
81
81
  }
82
82
  (0, vue.onUnmounted)(() => {
83
83
  unbindEventListeners();
@@ -18,6 +18,8 @@ var button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.d
18
18
  size: { default: "md" },
19
19
  intent: { default: "primary" },
20
20
  variant: { default: "fill" },
21
+ disabled: { type: Boolean },
22
+ loading: { type: Boolean },
21
23
  asChild: { type: Boolean },
22
24
  as: { default: "button" }
23
25
  },
@@ -27,13 +29,17 @@ var button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.d
27
29
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.Primitive), {
28
30
  as: __props.as,
29
31
  "as-child": __props.asChild,
30
- class: (0, vue.normalizeClass)((0, vue.unref)(clsx.default)("celeste-button", `celeste-button-intent-${__props.intent}`, `celeste-button-size-${__props.size}`, `celeste-button-variant-${__props.variant}`, props.class))
32
+ disabled: __props.disabled || __props.loading || void 0,
33
+ "aria-busy": __props.loading || void 0,
34
+ class: (0, vue.normalizeClass)((0, vue.unref)(clsx.default)("celeste-button", `celeste-button-intent-${__props.intent}`, `celeste-button-size-${__props.size}`, `celeste-button-variant-${__props.variant}`, __props.loading && !__props.asChild && "celeste-button-loading", props.class))
31
35
  }, {
32
- default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true)]),
36
+ default: (0, vue.withCtx)(() => [__props.asChild ? (0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true, 0) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true), _cache[0] || (_cache[0] = (0, vue.createElementVNode)("i", { class: "celeste-button-spinner i-celeste-loader-5-line" }, null, -1))], 64))]),
33
37
  _: 3
34
38
  }, 8, [
35
39
  "as",
36
40
  "as-child",
41
+ "disabled",
42
+ "aria-busy",
37
43
  "class"
38
44
  ]);
39
45
  };
@@ -41,7 +47,7 @@ var button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.d
41
47
  });
42
48
  //#endregion
43
49
  //#region src/components/button/button.vue
44
- var button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0aeead06"]]);
50
+ var button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-30b82d15"]]);
45
51
  //#endregion
46
52
  Object.defineProperty(exports, "button_default", {
47
53
  enumerable: true,
@@ -56,7 +56,7 @@ var color_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0,
56
56
  },
57
57
  emits: ["update:modelValue"],
58
58
  setup(__props, { emit: __emit }) {
59
- (0, vue.useCssVars)((_ctx) => ({ "v819487ba": _ctx.modelValue }));
59
+ (0, vue.useCssVars)((_ctx) => ({ "a8e11cca": _ctx.modelValue }));
60
60
  const props = __props;
61
61
  const emit = __emit;
62
62
  const delegatedProps = require_use_delegated_props.useDelegatedProps(props, "class");
@@ -166,7 +166,7 @@ var color_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0,
166
166
  const alphaInput = event.target?.value;
167
167
  const alphaValue = require_color.truncColorValue(alphaInput) / 100;
168
168
  if (Number.isNaN(alphaValue)) return;
169
- tinyColorRef.value = tinyColorRef.value.setAlpha(Math.max(0, Math.min(1, alphaValue)));
169
+ tinyColorRef.value = tinyColorRef.value.clone().setAlpha(Math.max(0, Math.min(1, alphaValue)));
170
170
  }
171
171
  function handleColorValueKeyDown(event, key) {
172
172
  const direction = require_color.resolveArrowDirection(event);
@@ -473,7 +473,7 @@ var color_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0,
473
473
  });
474
474
  //#endregion
475
475
  //#region src/components/color-picker/color-picker.vue
476
- var color_picker_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(color_picker_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-bf0ff694"]]);
476
+ var color_picker_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(color_picker_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-9aff48b3"]]);
477
477
  //#endregion
478
478
  Object.defineProperty(exports, "color_picker_default", {
479
479
  enumerable: true,
@@ -42,7 +42,7 @@ var compact_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (
42
42
  });
43
43
  //#endregion
44
44
  //#region src/components/button/compact-button.vue
45
- var compact_button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(compact_button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-bcc27daf"]]);
45
+ var compact_button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(compact_button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0727facf"]]);
46
46
  //#endregion
47
47
  Object.defineProperty(exports, "compact_button_default", {
48
48
  enumerable: true,
@@ -17,6 +17,8 @@ var fancy_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0,
17
17
  ] },
18
18
  size: { default: "md" },
19
19
  intent: { default: "primary" },
20
+ disabled: { type: Boolean },
21
+ loading: { type: Boolean },
20
22
  asChild: { type: Boolean },
21
23
  as: { default: "button" }
22
24
  },
@@ -26,13 +28,17 @@ var fancy_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0,
26
28
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.Primitive), {
27
29
  as: __props.as,
28
30
  "as-child": __props.asChild,
29
- class: (0, vue.normalizeClass)((0, vue.unref)(clsx.default)("celeste-fbutton", `celeste-fbutton-${__props.intent}`, `celeste-fbutton-${__props.size}`, props.class))
31
+ disabled: __props.disabled || __props.loading || void 0,
32
+ "aria-busy": __props.loading || void 0,
33
+ class: (0, vue.normalizeClass)((0, vue.unref)(clsx.default)("celeste-fbutton", `celeste-fbutton-${__props.intent}`, `celeste-fbutton-${__props.size}`, __props.loading && !__props.asChild && "celeste-fbutton-loading", props.class))
30
34
  }, {
31
- default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true)]),
35
+ default: (0, vue.withCtx)(() => [__props.asChild ? (0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true, 0) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, void 0, true), _cache[0] || (_cache[0] = (0, vue.createElementVNode)("i", { class: "celeste-fbutton-spinner i-celeste-loader-5-line" }, null, -1))], 64))]),
32
36
  _: 3
33
37
  }, 8, [
34
38
  "as",
35
39
  "as-child",
40
+ "disabled",
41
+ "aria-busy",
36
42
  "class"
37
43
  ]);
38
44
  };
@@ -40,7 +46,7 @@ var fancy_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0,
40
46
  });
41
47
  //#endregion
42
48
  //#region src/components/button/fancy-button.vue
43
- var fancy_button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(fancy_button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-d53adf47"]]);
49
+ var fancy_button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(fancy_button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-9098298e"]]);
44
50
  //#endregion
45
51
  Object.defineProperty(exports, "fancy_button_default", {
46
52
  enumerable: true,
@@ -34,7 +34,7 @@ var social_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0
34
34
  });
35
35
  //#endregion
36
36
  //#region src/components/button/social-button.vue
37
- var social_button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(social_button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-3652f72b"]]);
37
+ var social_button_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(social_button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-85544f28"]]);
38
38
  //#endregion
39
39
  Object.defineProperty(exports, "social_button_default", {
40
40
  enumerable: true,
@@ -17,6 +17,8 @@ var text_input_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
17
17
  Array
18
18
  ] },
19
19
  intent: {},
20
+ disabled: { type: Boolean },
21
+ loading: { type: Boolean },
20
22
  asChild: { type: Boolean },
21
23
  as: {},
22
24
  inline: {
@@ -109,7 +109,7 @@ var tooltip_content_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
109
109
  });
110
110
  //#endregion
111
111
  //#region src/components/tooltip/tooltip-content.vue
112
- var tooltip_content_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(tooltip_content_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-cf42d877"]]);
112
+ var tooltip_content_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(tooltip_content_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-5dc414bd"]]);
113
113
  //#endregion
114
114
  Object.defineProperty(exports, "tooltip_content_default", {
115
115
  enumerable: true,
@@ -1,4 +1,3 @@
1
- const require_use_delegated_props = require("../use-delegated-props.cjs");
2
1
  let vue = require("vue");
3
2
  let reka_ui = require("reka-ui");
4
3
  //#endregion
@@ -16,19 +15,12 @@ var tooltip_root_default = /* @__PURE__ */ (0, vue.defineComponent)({
16
15
  },
17
16
  emits: ["update:open"],
18
17
  setup(__props, { emit: __emit }) {
19
- const props = __props;
20
- const emits = __emit;
21
- const delegatedProps = require_use_delegated_props.useDelegatedProps(props, "open");
22
- const forwarded = (0, reka_ui.useForwardPropsEmits)(delegatedProps, emits);
23
- const open = (0, vue.ref)(false);
18
+ const forwarded = (0, reka_ui.useForwardPropsEmits)(__props, __emit);
24
19
  return (_ctx, _cache) => {
25
- return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.TooltipRoot), (0, vue.mergeProps)((0, vue.unref)(forwarded), {
26
- open: open.value,
27
- "onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event)
28
- }), {
20
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.TooltipRoot), (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(forwarded))), {
29
21
  default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
30
22
  _: 3
31
- }, 16, ["open"]);
23
+ }, 16);
32
24
  };
33
25
  }
34
26
  });
@@ -5,10 +5,14 @@ export interface ButtonProps extends PrimitiveProps {
5
5
  size?: 'xxs' | 'xs' | 'sm' | 'md';
6
6
  intent?: 'primary' | 'neutral' | 'error';
7
7
  variant?: 'fill' | 'stroke' | 'lighter' | 'ghost';
8
+ disabled?: boolean;
9
+ loading?: boolean;
8
10
  }
9
- declare var __VLS_8: {};
11
+ declare var __VLS_8: {}, __VLS_10: {};
10
12
  type __VLS_Slots = {} & {
11
13
  default?: (props: typeof __VLS_8) => any;
14
+ } & {
15
+ default?: (props: typeof __VLS_10) => any;
12
16
  };
13
17
  declare const __VLS_base: import('vue').DefineComponent<ButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ButtonProps> & Readonly<{}>, {
14
18
  size: "xxs" | "xs" | "sm" | "md";
@@ -4,10 +4,14 @@ export interface FancyButtonProps extends PrimitiveProps {
4
4
  class?: HTMLAttributes['class'];
5
5
  size?: 'xs' | 'sm' | 'md';
6
6
  intent?: 'primary' | 'neutral' | 'error' | 'basic';
7
+ disabled?: boolean;
8
+ loading?: boolean;
7
9
  }
8
- declare var __VLS_8: {};
10
+ declare var __VLS_8: {}, __VLS_10: {};
9
11
  type __VLS_Slots = {} & {
10
12
  default?: (props: typeof __VLS_8) => any;
13
+ } & {
14
+ default?: (props: typeof __VLS_10) => any;
11
15
  };
12
16
  declare const __VLS_base: import('vue').DefineComponent<FancyButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FancyButtonProps> & Readonly<{}>, {
13
17
  size: "xs" | "sm" | "md";
@@ -49,7 +49,7 @@ var alpha_slider_default = /* @__PURE__ */ defineComponent({
49
49
  if (left < 0) a = 0;
50
50
  else if (left > containerWidth) a = 1;
51
51
  else a = Math.round(left * 100 / containerWidth) / 100;
52
- if (alpha.value !== a) tinyColorRef.value = tinyColorRef.value.setAlpha(a).clone();
52
+ if (alpha.value !== a) tinyColorRef.value = tinyColorRef.value.clone().setAlpha(a);
53
53
  }
54
54
  function handleMouseDown(e) {
55
55
  handleChange(e, true);
@@ -77,7 +77,7 @@ var alpha_slider_default = /* @__PURE__ */ defineComponent({
77
77
  break;
78
78
  case "right": newValue = currentValue + .1 > 1 ? 1 : currentValue + .1;
79
79
  }
80
- if (typeof newValue !== "undefined") tinyColorRef.value = tinyColorRef.value.setAlpha(newValue).clone();
80
+ if (typeof newValue !== "undefined") tinyColorRef.value = tinyColorRef.value.clone().setAlpha(newValue);
81
81
  }
82
82
  onUnmounted(() => {
83
83
  unbindEventListeners();
@@ -1,5 +1,5 @@
1
1
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
- import { createBlock, defineComponent, normalizeClass, openBlock, renderSlot, unref, withCtx } from "vue";
2
+ import { Fragment, createBlock, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, renderSlot, unref, withCtx } from "vue";
3
3
  import clsx$1 from "clsx";
4
4
  import { Primitive } from "reka-ui";
5
5
  //#endregion
@@ -17,6 +17,8 @@ var button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
17
17
  size: { default: "md" },
18
18
  intent: { default: "primary" },
19
19
  variant: { default: "fill" },
20
+ disabled: { type: Boolean },
21
+ loading: { type: Boolean },
20
22
  asChild: { type: Boolean },
21
23
  as: { default: "button" }
22
24
  },
@@ -26,17 +28,21 @@ var button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
26
28
  return openBlock(), createBlock(unref(Primitive), {
27
29
  as: __props.as,
28
30
  "as-child": __props.asChild,
29
- class: normalizeClass(unref(clsx$1)("celeste-button", `celeste-button-intent-${__props.intent}`, `celeste-button-size-${__props.size}`, `celeste-button-variant-${__props.variant}`, props.class))
31
+ disabled: __props.disabled || __props.loading || void 0,
32
+ "aria-busy": __props.loading || void 0,
33
+ class: normalizeClass(unref(clsx$1)("celeste-button", `celeste-button-intent-${__props.intent}`, `celeste-button-size-${__props.size}`, `celeste-button-variant-${__props.variant}`, __props.loading && !__props.asChild && "celeste-button-loading", props.class))
30
34
  }, {
31
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
35
+ default: withCtx(() => [__props.asChild ? renderSlot(_ctx.$slots, "default", {}, void 0, true, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [renderSlot(_ctx.$slots, "default", {}, void 0, true), _cache[0] || (_cache[0] = createElementVNode("i", { class: "celeste-button-spinner i-celeste-loader-5-line" }, null, -1))], 64))]),
32
36
  _: 3
33
37
  }, 8, [
34
38
  "as",
35
39
  "as-child",
40
+ "disabled",
41
+ "aria-busy",
36
42
  "class"
37
43
  ]);
38
44
  };
39
45
  }
40
- }), [["__scopeId", "data-v-0aeead06"]]);
46
+ }), [["__scopeId", "data-v-30b82d15"]]);
41
47
  //#endregion
42
48
  export { button_default as t };
@@ -56,7 +56,7 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
56
56
  },
57
57
  emits: ["update:modelValue"],
58
58
  setup(__props, { emit: __emit }) {
59
- useCssVars((_ctx) => ({ "v819487ba": _ctx.modelValue }));
59
+ useCssVars((_ctx) => ({ "a8e11cca": _ctx.modelValue }));
60
60
  const props = __props;
61
61
  const emit = __emit;
62
62
  const delegatedProps = useDelegatedProps(props, "class");
@@ -166,7 +166,7 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
166
166
  const alphaInput = event.target?.value;
167
167
  const alphaValue = truncColorValue(alphaInput) / 100;
168
168
  if (Number.isNaN(alphaValue)) return;
169
- tinyColorRef.value = tinyColorRef.value.setAlpha(Math.max(0, Math.min(1, alphaValue)));
169
+ tinyColorRef.value = tinyColorRef.value.clone().setAlpha(Math.max(0, Math.min(1, alphaValue)));
170
170
  }
171
171
  function handleColorValueKeyDown(event, key) {
172
172
  const direction = resolveArrowDirection(event);
@@ -470,6 +470,6 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
470
470
  });
471
471
  };
472
472
  }
473
- }), [["__scopeId", "data-v-bf0ff694"]]);
473
+ }), [["__scopeId", "data-v-9aff48b3"]]);
474
474
  //#endregion
475
475
  export { color_picker_default as t };
@@ -38,6 +38,6 @@ var compact_button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
38
38
  ]);
39
39
  };
40
40
  }
41
- }), [["__scopeId", "data-v-bcc27daf"]]);
41
+ }), [["__scopeId", "data-v-0727facf"]]);
42
42
  //#endregion
43
43
  export { compact_button_default as t };
@@ -1,5 +1,5 @@
1
1
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
- import { createBlock, defineComponent, normalizeClass, openBlock, renderSlot, unref, withCtx } from "vue";
2
+ import { Fragment, createBlock, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, renderSlot, unref, withCtx } from "vue";
3
3
  import clsx$1 from "clsx";
4
4
  import { Primitive } from "reka-ui";
5
5
  //#endregion
@@ -16,6 +16,8 @@ var fancy_button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
16
16
  ] },
17
17
  size: { default: "md" },
18
18
  intent: { default: "primary" },
19
+ disabled: { type: Boolean },
20
+ loading: { type: Boolean },
19
21
  asChild: { type: Boolean },
20
22
  as: { default: "button" }
21
23
  },
@@ -25,17 +27,21 @@ var fancy_button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
25
27
  return openBlock(), createBlock(unref(Primitive), {
26
28
  as: __props.as,
27
29
  "as-child": __props.asChild,
28
- class: normalizeClass(unref(clsx$1)("celeste-fbutton", `celeste-fbutton-${__props.intent}`, `celeste-fbutton-${__props.size}`, props.class))
30
+ disabled: __props.disabled || __props.loading || void 0,
31
+ "aria-busy": __props.loading || void 0,
32
+ class: normalizeClass(unref(clsx$1)("celeste-fbutton", `celeste-fbutton-${__props.intent}`, `celeste-fbutton-${__props.size}`, __props.loading && !__props.asChild && "celeste-fbutton-loading", props.class))
29
33
  }, {
30
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
34
+ default: withCtx(() => [__props.asChild ? renderSlot(_ctx.$slots, "default", {}, void 0, true, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [renderSlot(_ctx.$slots, "default", {}, void 0, true), _cache[0] || (_cache[0] = createElementVNode("i", { class: "celeste-fbutton-spinner i-celeste-loader-5-line" }, null, -1))], 64))]),
31
35
  _: 3
32
36
  }, 8, [
33
37
  "as",
34
38
  "as-child",
39
+ "disabled",
40
+ "aria-busy",
35
41
  "class"
36
42
  ]);
37
43
  };
38
44
  }
39
- }), [["__scopeId", "data-v-d53adf47"]]);
45
+ }), [["__scopeId", "data-v-9098298e"]]);
40
46
  //#endregion
41
47
  export { fancy_button_default as t };
@@ -31,6 +31,6 @@ var social_button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
31
31
  }, 8, ["aria-label", "class"]);
32
32
  };
33
33
  }
34
- }), [["__scopeId", "data-v-3652f72b"]]);
34
+ }), [["__scopeId", "data-v-85544f28"]]);
35
35
  //#endregion
36
36
  export { social_button_default as t };
@@ -16,6 +16,8 @@ var text_input_button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
16
16
  Array
17
17
  ] },
18
18
  intent: {},
19
+ disabled: { type: Boolean },
20
+ loading: { type: Boolean },
19
21
  asChild: { type: Boolean },
20
22
  as: {},
21
23
  inline: {
@@ -106,6 +106,6 @@ var tooltip_content_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
106
106
  });
107
107
  };
108
108
  }
109
- }), [["__scopeId", "data-v-cf42d877"]]);
109
+ }), [["__scopeId", "data-v-5dc414bd"]]);
110
110
  //#endregion
111
111
  export { tooltip_content_default as t };
@@ -1,5 +1,4 @@
1
- import { useDelegatedProps } from "../use-delegated-props.js";
2
- import { createBlock, defineComponent, mergeProps, openBlock, ref, renderSlot, unref, withCtx } from "vue";
1
+ import { createBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, unref, withCtx } from "vue";
3
2
  import { TooltipRoot, useForwardPropsEmits } from "reka-ui";
4
3
  //#endregion
5
4
  //#region src/components/tooltip/tooltip-root.vue
@@ -16,19 +15,12 @@ var tooltip_root_default = /* @__PURE__ */ defineComponent({
16
15
  },
17
16
  emits: ["update:open"],
18
17
  setup(__props, { emit: __emit }) {
19
- const props = __props;
20
- const emits = __emit;
21
- const delegatedProps = useDelegatedProps(props, "open");
22
- const forwarded = useForwardPropsEmits(delegatedProps, emits);
23
- const open = ref(false);
18
+ const forwarded = useForwardPropsEmits(__props, __emit);
24
19
  return (_ctx, _cache) => {
25
- return openBlock(), createBlock(unref(TooltipRoot), mergeProps(unref(forwarded), {
26
- open: open.value,
27
- "onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event)
28
- }), {
20
+ return openBlock(), createBlock(unref(TooltipRoot), normalizeProps(guardReactiveProps(unref(forwarded))), {
29
21
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
30
22
  _: 3
31
- }, 16, ["open"]);
23
+ }, 16);
32
24
  };
33
25
  }
34
26
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/celeste",
3
3
  "type": "module",
4
- "version": "0.23.0",
4
+ "version": "0.24.1",
5
5
  "author": "YouCan <tech@youcan.shop>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -52,8 +52,8 @@
52
52
  "reka-ui": "~2.10.5",
53
53
  "tinycolor2": "^1.6.0",
54
54
  "vue-sonner": "^2.0.9",
55
- "@youcan/celeste-tokens": "0.23.0",
56
- "@youcan/celeste-icons": "0.23.0"
55
+ "@youcan/celeste-icons": "0.24.1",
56
+ "@youcan/celeste-tokens": "0.24.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@chromatic-com/storybook": "^5.3.0",
@@ -9,6 +9,8 @@ export interface ButtonProps extends PrimitiveProps {
9
9
  size?: 'xxs' | 'xs' | 'sm' | 'md';
10
10
  intent?: 'primary' | 'neutral' | 'error';
11
11
  variant?: 'fill' | 'stroke' | 'lighter' | 'ghost';
12
+ disabled?: boolean;
13
+ loading?: boolean;
12
14
  }
13
15
 
14
16
  const props = withDefaults(defineProps<ButtonProps>(), {
@@ -23,15 +25,22 @@ const props = withDefaults(defineProps<ButtonProps>(), {
23
25
  <Primitive
24
26
  :as
25
27
  :as-child
28
+ :disabled="disabled || loading || undefined"
29
+ :aria-busy="loading || undefined"
26
30
  :class="clsx(
27
31
  'celeste-button',
28
32
  `celeste-button-intent-${intent}`,
29
33
  `celeste-button-size-${size}`,
30
34
  `celeste-button-variant-${variant}`,
35
+ loading && !asChild && 'celeste-button-loading',
31
36
  props.class,
32
37
  )"
33
38
  >
34
- <slot />
39
+ <slot v-if="asChild" />
40
+ <template v-else>
41
+ <slot />
42
+ <i class="celeste-button-spinner i-celeste-loader-5-line" />
43
+ </template>
35
44
  </Primitive>
36
45
  </template>
37
46
 
@@ -216,6 +225,7 @@ $hover-map: (
216
225
 
217
226
  .celeste-button {
218
227
  display: inline-flex;
228
+ position: relative;
219
229
  box-sizing: border-box;
220
230
  align-items: center;
221
231
  justify-content: center;
@@ -229,8 +239,9 @@ $hover-map: (
229
239
  text-decoration: none;
230
240
  white-space: nowrap;
231
241
  cursor: pointer;
242
+ user-select: none;
232
243
 
233
- &:disabled {
244
+ &:disabled:not(&-loading) {
234
245
  background-color: var(--color-bg-weak-50);
235
246
  color: var(--color-text-disabled-300);
236
247
  cursor: default;
@@ -249,7 +260,8 @@ $hover-map: (
249
260
  padding: map.get($v, padding);
250
261
  border-radius: map.get($v, border-radius);
251
262
 
252
- &:has(> :only-child:is(i)) {
263
+ &:has(> :only-child:is(i):not(.celeste-button-spinner)),
264
+ &:has(> i:first-child + .celeste-button-spinner:last-child) {
253
265
  padding: list.nth(map.get($v, padding), 1);
254
266
  }
255
267
  }
@@ -257,11 +269,17 @@ $hover-map: (
257
269
 
258
270
  @each $intent, $sub in $intent-map {
259
271
  @each $variant, $values in $sub {
260
- &-intent-#{$intent}:not(:disabled).celeste-button-variant-#{$variant}:not(:disabled) {
272
+ &-intent-#{$intent}.celeste-button-variant-#{$variant}:not(:disabled:not(.celeste-button-loading)) {
273
+ --celeste-button-fg: #{map.get($values, fg)};
274
+
261
275
  border-color: map.get($values, border);
262
276
  background-color: map.get($values, bg);
263
277
  box-shadow: map.get($values, shadow);
264
- color: map.get($values, fg);
278
+ color: var(--celeste-button-fg);
279
+
280
+ &.celeste-button-loading {
281
+ color: transparent;
282
+ }
265
283
 
266
284
  &:hover:not(:disabled) {
267
285
  $hover-values: map.get(map.get($hover-map, $intent), $variant);
@@ -283,4 +301,40 @@ $hover-map: (
283
301
  }
284
302
  }
285
303
  }
304
+
305
+ .celeste-button-loading {
306
+ pointer-events: none;
307
+ }
308
+
309
+ .celeste-button-spinner {
310
+ position: absolute;
311
+ margin: auto;
312
+ transition-property: opacity, scale;
313
+ transition-duration: var(--animation-fast);
314
+ transition-timing-function: ease-out;
315
+ animation: celeste-button-spin 600ms linear infinite paused;
316
+ opacity: 0;
317
+ color: var(--celeste-button-fg);
318
+ inset: 0;
319
+ scale: 0.9;
320
+ }
321
+
322
+ .celeste-button-loading > .celeste-button-spinner {
323
+ animation-play-state: running;
324
+ opacity: 1;
325
+ scale: 1;
326
+ }
327
+
328
+ @media (prefers-reduced-motion: reduce) {
329
+ .celeste-button-spinner {
330
+ animation-duration: 1200ms;
331
+ scale: 1;
332
+ }
333
+ }
334
+
335
+ @keyframes celeste-button-spin {
336
+ 100% {
337
+ rotate: 360deg;
338
+ }
339
+ }
286
340
  </style>
@@ -51,6 +51,7 @@ const props = withDefaults(defineProps<CompactButtonProps>(), {
51
51
  font: var(--label-sm);
52
52
  text-decoration: none;
53
53
  cursor: pointer;
54
+ user-select: none;
54
55
  gap: var(--spacing-2);
55
56
 
56
57
  &:disabled {