@dnax/ui 0.0.5 → 0.0.6

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.
@@ -3,6 +3,7 @@
3
3
  // Intégré dans QConfigProvider (rendu automatiquement par le plus externe),
4
4
  // mais utilisable aussi en autonome : <q-notify-provider />.
5
5
  import { Toaster } from "vue-sonner"
6
+ import "vue-sonner/style.css" // styles du Toaster (sinon les toasts sont rendus mais invisibles)
6
7
 
7
8
  interface Props {
8
9
  /** Position des toasts (défaut : bottom-right) */
package/lib/q.ts CHANGED
@@ -189,8 +189,9 @@ export interface NotifyOptions {
189
189
  icon?: string
190
190
  /** Couleur de fond : token (primary, negative…) ou hex */
191
191
  color?: string
192
- /** Type → couleur riche sonner (success, error, warning, info) */
193
- type?: "default" | "success" | "error" | "warning" | "info"
192
+ /** Type → couleur riche sonner. Tokens Quasar acceptés : positive = success,
193
+ * negative = error, warning, info (success/error aussi acceptés). */
194
+ type?: "default" | "success" | "error" | "warning" | "info" | "positive" | "negative"
194
195
  /** Position (défaut : bottom-right, celle du QNotifyProvider) */
195
196
  position?: ExternalToast["position"]
196
197
  /** Durée d'affichage en ms (défaut : 4000) */
@@ -214,9 +215,13 @@ function notify(opts: NotifyOptions): NotifyController {
214
215
  icon: icon ? h(icon) : undefined,
215
216
  }
216
217
 
218
+ // Tokens Quasar → types sonner : positive = success, negative = error
219
+ const sonnerType =
220
+ type === "positive" ? "success" : type === "negative" ? "error" : type
221
+
217
222
  let id: string | number | undefined
218
223
 
219
- if (color && type === "default") {
224
+ if (color && sonnerType === "default") {
220
225
  // Couleur Quasar custom → rendu custom (QNotifyToast)
221
226
  id = toast.custom(QNotifyToast, {
222
227
  ...data,
@@ -239,7 +244,7 @@ function notify(opts: NotifyOptions): NotifyController {
239
244
  info: toast.info,
240
245
  default: toast,
241
246
  } as const
242
- id = toasts[type](message, {
247
+ id = toasts[sonnerType](message, {
243
248
  ...data,
244
249
  action: action ? { label: action.label, onClick: () => action.handler() } : undefined,
245
250
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/ui",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "module": "index.ts",
5
5
  "description": "UI design System",
6
6
  "type": "module",