@youcan/celeste 0.6.31 → 0.6.32

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.
@@ -248,7 +248,7 @@ const isHttpResponse = (data) => {
248
248
  const basicToast = toastFunction;
249
249
  const getHistory = () => ToastState.toasts;
250
250
  const getToasts = () => ToastState.getActiveToasts();
251
- Object.assign(basicToast, {
251
+ const toast = Object.assign(basicToast, {
252
252
  success: ToastState.success,
253
253
  info: ToastState.info,
254
254
  warning: ToastState.warning,
@@ -1151,3 +1151,4 @@ const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
1151
1151
  }
1152
1152
  });
1153
1153
  exports._sfc_main = _sfc_main;
1154
+ exports.toast = toast;
package/dist/cjs/index.js CHANGED
@@ -72,6 +72,9 @@ const textInputButton = require("./text-input-button.js");
72
72
  const textInput = require("./text-input.js");
73
73
  const textarea = require("./textarea.js");
74
74
  const tooltip = require("./tooltip.js");
75
+ const color = require("./color.js");
76
+ const crypto = require("./crypto.js");
77
+ const Mo = require("vue");
75
78
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76
79
  __proto__: null,
77
80
  Alert: alert,
@@ -147,6 +150,55 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
147
150
  Textarea: textarea,
148
151
  Tooltip: tooltip
149
152
  }, Symbol.toStringTag, { value: "Module" }));
153
+ function createToast(title, data) {
154
+ const {
155
+ state = "success",
156
+ variant = "stroke",
157
+ size = "lg",
158
+ dismissable = true,
159
+ ...externalToastProps
160
+ } = data || {};
161
+ let toastId;
162
+ const dismissToast = () => {
163
+ sonner_vue_vue_type_script_setup_true_lang.toast.dismiss(toastId);
164
+ };
165
+ toastId = sonner_vue_vue_type_script_setup_true_lang.toast.custom(Mo.markRaw(sonnerAlert), {
166
+ ...externalToastProps,
167
+ componentProps: {
168
+ title,
169
+ description: data == null ? void 0 : data.description,
170
+ state,
171
+ variant,
172
+ size,
173
+ dismissable,
174
+ onDismiss: dismissToast
175
+ }
176
+ });
177
+ return toastId;
178
+ }
179
+ const toast = Object.assign(createToast, {
180
+ success: (title, data) => {
181
+ return createToast(title, { ...data, state: "success" });
182
+ },
183
+ error: (title, data) => {
184
+ return createToast(title, { ...data, state: "error" });
185
+ },
186
+ warning: (title, data) => {
187
+ return createToast(title, { ...data, state: "warning" });
188
+ },
189
+ info: (title, data) => {
190
+ return createToast(title, { ...data, state: "information" });
191
+ },
192
+ feature: (title, data) => {
193
+ return createToast(title, { ...data, state: "feature" });
194
+ },
195
+ dismiss: (id) => {
196
+ sonner_vue_vue_type_script_setup_true_lang.toast.dismiss(id);
197
+ },
198
+ loading: (title, data) => {
199
+ return sonner_vue_vue_type_script_setup_true_lang.toast.loading(title, data);
200
+ }
201
+ });
150
202
  const Celeste = {
151
203
  install(vue) {
152
204
  Object.entries(components).forEach(([name, component]) => {
@@ -226,4 +278,18 @@ exports.TextInputButton = textInputButton;
226
278
  exports.TextInput = textInput;
227
279
  exports.Textarea = textarea;
228
280
  exports.Tooltip = tooltip;
281
+ exports.COLOR_NUMBER_VALIDATION_PATTERN = color.COLOR_NUMBER_VALIDATION_PATTERN;
282
+ exports.DEFAULT_SWATCH = color.DEFAULT_SWATCH;
283
+ exports.HEX_VALIDATION_PATTERN = color.HEX_VALIDATION_PATTERN;
284
+ exports.bumpColorValue = color.bumpColorValue;
285
+ exports.clamp = color.clamp;
286
+ exports.getAbsolutePosition = color.getAbsolutePosition;
287
+ exports.getColorConstraints = color.getColorConstraints;
288
+ exports.getFractionDigit = color.getFractionDigit;
289
+ exports.getPageXYFromEvent = color.getPageXYFromEvent;
290
+ exports.getScrollXY = color.getScrollXY;
291
+ exports.resolveArrowDirection = color.resolveArrowDirection;
292
+ exports.truncColorValue = color.truncColorValue;
293
+ exports.uid = crypto.uid;
229
294
  exports.Celeste = Celeste;
295
+ exports.toast = toast;
@@ -37,5 +37,5 @@ const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
37
37
  };
38
38
  }
39
39
  });
40
- const sonnerAlert = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-c8bb23e0"]]);
41
- module.exports = sonnerAlert;
40
+ const SonnerAlert = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-c8bb23e0"]]);
41
+ module.exports = SonnerAlert;
@@ -247,7 +247,7 @@ const isHttpResponse = (data) => {
247
247
  const basicToast = toastFunction;
248
248
  const getHistory = () => ToastState.toasts;
249
249
  const getToasts = () => ToastState.getActiveToasts();
250
- Object.assign(basicToast, {
250
+ const toast = Object.assign(basicToast, {
251
251
  success: ToastState.success,
252
252
  info: ToastState.info,
253
253
  warning: ToastState.warning,
@@ -1150,5 +1150,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1150
1150
  }
1151
1151
  });
1152
1152
  export {
1153
- _sfc_main as _
1153
+ _sfc_main as _,
1154
+ toast as t
1154
1155
  };
package/dist/es/index.js CHANGED
@@ -58,8 +58,8 @@ import SelectTrigger from "./select-trigger.js";
58
58
  import SelectValue from "./select-value.js";
59
59
  import { _ as _sfc_main$c } from "./chunks/select.js";
60
60
  import { _ as _sfc_main$e } from "./chunks/slider.vue_vue_type_style_index_0_lang.js";
61
- import sonnerAlert from "./sonner-alert.js";
62
- import { _ as _sfc_main$f } from "./chunks/sonner.js";
61
+ import SonnerAlert from "./sonner-alert.js";
62
+ import { _ as _sfc_main$f, t as toast$1 } from "./chunks/sonner.js";
63
63
  import { _ as _sfc_main$g } from "./chunks/switch.vue_vue_type_style_index_0_lang.js";
64
64
  import tabMenuContent from "./tab-menu-content.js";
65
65
  import tabMenuItem from "./tab-menu-item.js";
@@ -70,6 +70,9 @@ import TextInputButton from "./text-input-button.js";
70
70
  import TextInput from "./text-input.js";
71
71
  import textarea from "./textarea.js";
72
72
  import Tooltip from "./tooltip.js";
73
+ import { COLOR_NUMBER_VALIDATION_PATTERN, DEFAULT_SWATCH, HEX_VALIDATION_PATTERN, bumpColorValue, clamp, getAbsolutePosition, getColorConstraints, getFractionDigit, getPageXYFromEvent, getScrollXY, resolveArrowDirection, truncColorValue } from "./color.js";
74
+ import { uid } from "./crypto.js";
75
+ import { markRaw } from "vue";
73
76
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74
77
  __proto__: null,
75
78
  Alert,
@@ -132,7 +135,7 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
132
135
  Slider: _sfc_main$e,
133
136
  SocialButton: socialButton,
134
137
  Sonner: _sfc_main$f,
135
- SonnerAlert: sonnerAlert,
138
+ SonnerAlert,
136
139
  StatusBadge: statusBadge,
137
140
  Switch: _sfc_main$g,
138
141
  TabMenu: tabMenu,
@@ -145,6 +148,55 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
145
148
  Textarea: textarea,
146
149
  Tooltip
147
150
  }, Symbol.toStringTag, { value: "Module" }));
151
+ function createToast(title, data) {
152
+ const {
153
+ state = "success",
154
+ variant = "stroke",
155
+ size = "lg",
156
+ dismissable = true,
157
+ ...externalToastProps
158
+ } = data || {};
159
+ let toastId;
160
+ const dismissToast = () => {
161
+ toast$1.dismiss(toastId);
162
+ };
163
+ toastId = toast$1.custom(markRaw(SonnerAlert), {
164
+ ...externalToastProps,
165
+ componentProps: {
166
+ title,
167
+ description: data == null ? void 0 : data.description,
168
+ state,
169
+ variant,
170
+ size,
171
+ dismissable,
172
+ onDismiss: dismissToast
173
+ }
174
+ });
175
+ return toastId;
176
+ }
177
+ const toast = Object.assign(createToast, {
178
+ success: (title, data) => {
179
+ return createToast(title, { ...data, state: "success" });
180
+ },
181
+ error: (title, data) => {
182
+ return createToast(title, { ...data, state: "error" });
183
+ },
184
+ warning: (title, data) => {
185
+ return createToast(title, { ...data, state: "warning" });
186
+ },
187
+ info: (title, data) => {
188
+ return createToast(title, { ...data, state: "information" });
189
+ },
190
+ feature: (title, data) => {
191
+ return createToast(title, { ...data, state: "feature" });
192
+ },
193
+ dismiss: (id) => {
194
+ toast$1.dismiss(id);
195
+ },
196
+ loading: (title, data) => {
197
+ return toast$1.loading(title, data);
198
+ }
199
+ });
148
200
  const Celeste = {
149
201
  install(vue) {
150
202
  Object.entries(components).forEach(([name, component]) => {
@@ -156,6 +208,7 @@ export {
156
208
  Alert,
157
209
  Badge,
158
210
  Button,
211
+ COLOR_NUMBER_VALIDATION_PATTERN,
159
212
  Celeste,
160
213
  _sfc_main as Checkbox,
161
214
  checkboxLabel as CheckboxLabel,
@@ -172,6 +225,7 @@ export {
172
225
  CompactButton,
173
226
  _sfc_main$2 as ContentDivider,
174
227
  contextMenuItem as ContextMenuItem,
228
+ DEFAULT_SWATCH,
175
229
  dropdown as Dropdown,
176
230
  DropdownItem,
177
231
  dropdownMenu as DropdownMenu,
@@ -185,6 +239,7 @@ export {
185
239
  _sfc_main$6 as DropdownMenuSubTrigger,
186
240
  dropdownMenuTrigger as DropdownMenuTrigger,
187
241
  fancyButton as FancyButton,
242
+ HEX_VALIDATION_PATTERN,
188
243
  hintText as HintText,
189
244
  Label,
190
245
  LinkButton,
@@ -214,7 +269,7 @@ export {
214
269
  _sfc_main$e as Slider,
215
270
  socialButton as SocialButton,
216
271
  _sfc_main$f as Sonner,
217
- sonnerAlert as SonnerAlert,
272
+ SonnerAlert,
218
273
  statusBadge as StatusBadge,
219
274
  _sfc_main$g as Switch,
220
275
  tabMenu as TabMenu,
@@ -225,5 +280,16 @@ export {
225
280
  TextInputAffix,
226
281
  TextInputButton,
227
282
  textarea as Textarea,
228
- Tooltip
283
+ Tooltip,
284
+ bumpColorValue,
285
+ clamp,
286
+ getAbsolutePosition,
287
+ getColorConstraints,
288
+ getFractionDigit,
289
+ getPageXYFromEvent,
290
+ getScrollXY,
291
+ resolveArrowDirection,
292
+ toast,
293
+ truncColorValue,
294
+ uid
229
295
  };
@@ -36,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  };
37
37
  }
38
38
  });
39
- const sonnerAlert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c8bb23e0"]]);
39
+ const SonnerAlert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c8bb23e0"]]);
40
40
  export {
41
- sonnerAlert as default
41
+ SonnerAlert as default
42
42
  };
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export declare const Celeste: {
3
3
  install(vue: App): void;
4
4
  };
5
5
  export * from './components';
6
+ export * from './utils';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/celeste",
3
3
  "type": "module",
4
- "version": "0.6.31",
4
+ "version": "0.6.32",
5
5
  "author": "YouCan <tech@youcan.shop>",
6
6
  "keywords": [
7
7
  "youcan",
@@ -43,8 +43,8 @@
43
43
  "radix-vue": "^1.9.12",
44
44
  "tinycolor2": "^1.6.0",
45
45
  "vue-sonner": "^2.0.2",
46
- "@youcan/celeste-icons": "0.6.31",
47
- "@youcan/celeste-tokens": "0.6.31"
46
+ "@youcan/celeste-icons": "0.6.32",
47
+ "@youcan/celeste-tokens": "0.6.32"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@chromatic-com/storybook": "^4.0.0",
package/src/index.ts CHANGED
@@ -11,3 +11,4 @@ export const Celeste = {
11
11
  };
12
12
 
13
13
  export * from '@/components';
14
+ export * from '@/utils';