@medway-ui/core 1.25.0 → 1.26.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/README.md +42 -0
- package/dist/components/Toast.d.mts +3 -2
- package/dist/components/Toast.d.mts.map +1 -1
- package/dist/components/Toast.d.ts +3 -2
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +1 -1
- package/dist/components/Toast.mjs +1 -1
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -111,3 +111,45 @@ Para lintar possíveis erros da aplicação
|
|
|
111
111
|
```bash
|
|
112
112
|
yarn lint
|
|
113
113
|
```
|
|
114
|
+
|
|
115
|
+
## Releases (Changesets, 100% automático)
|
|
116
|
+
|
|
117
|
+
Este repositório usa [Changesets](https://github.com/changesets/changesets) para versionar e publicar
|
|
118
|
+
os 3 pacotes (`@medway-ui/core`, `@medway-ui/native`, `@medway-ui/notes-core`) de forma independente.
|
|
119
|
+
**Nenhum comando manual é necessário** — o changeset de cada PR é gerado automaticamente a partir dos
|
|
120
|
+
commits que ela traz, então basta seguir a convenção de commit que o Husky/commitlint já exige:
|
|
121
|
+
|
|
122
|
+
- `fix: ...` → patch
|
|
123
|
+
- `feat: ...` → minor
|
|
124
|
+
- `feat!: ...` ou um rodapé `BREAKING CHANGE: ...` no commit → major
|
|
125
|
+
|
|
126
|
+
O CI decide **qual pacote** foi afetado pelo caminho dos arquivos que cada commit tocou (`src/` →
|
|
127
|
+
core, `native/src/` → native, `notes-core/src/` → notes-core) — não é preciso declarar isso à mão.
|
|
128
|
+
PRs que não mudam nada publicável (docs, chore de CI, etc.) simplesmente não geram nenhum changeset.
|
|
129
|
+
|
|
130
|
+
### O que acontece depois do merge de uma PR de feature
|
|
131
|
+
|
|
132
|
+
Ao mergear na `main`, o workflow `.github/workflows/release.yml` roda para cada um dos 3 pacotes.
|
|
133
|
+
Ele olha os commits que esse push trouxe e, se algum deles tocou os arquivos daquele pacote, gera um
|
|
134
|
+
changeset automaticamente (arquivo em `.changeset/`, `native/.changeset/` ou `notes-core/.changeset/`)
|
|
135
|
+
com o tipo de bump inferido da mensagem de commit. A partir daí:
|
|
136
|
+
|
|
137
|
+
- **Se há changeset pendente**: aplica o bump de versão (`changeset version`), atualiza o
|
|
138
|
+
`CHANGELOG.md`, commita isso numa branch própria do pacote (`changeset-release/core`,
|
|
139
|
+
`changeset-release/native` ou `changeset-release/notes-core`) e abre (ou atualiza) uma PR
|
|
140
|
+
**"chore: version @medway-ui/<pacote>"** direto contra `main`.
|
|
141
|
+
- **Se não há** (a PR de versão já foi mergeada antes): builda e publica o pacote no npm.
|
|
142
|
+
|
|
143
|
+
Ou seja, cada release passa por 2 PRs: a da mudança em si, e depois a de versão — ambas contra
|
|
144
|
+
`main`, revisadas e aprovadas normalmente, sem nenhuma branch intermediária protegida e sem
|
|
145
|
+
nenhuma exceção de bypass. Só `main` tem proteção de branch (exige PR antes de merge).
|
|
146
|
+
|
|
147
|
+
`@medway-ui/notes-core` é sempre processado antes de `core` e `native` (ambos o declaram como
|
|
148
|
+
peerDependency).
|
|
149
|
+
|
|
150
|
+
### Quando um dev ainda quer escrever o changelog à mão
|
|
151
|
+
|
|
152
|
+
Rodar `yarn changeset` (ou `cd native && yarn changeset` / `cd notes-core && npm run changeset`)
|
|
153
|
+
continua funcionando — cria um arquivo de changeset manual que o CI simplesmente encontra pronto e
|
|
154
|
+
não regenera. Use isso quando quiser controlar o texto do changelog com mais cuidado do que o
|
|
155
|
+
resumo automático (que é só a lista de mensagens de commit).
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
3
|
-
import { type ComponentPropsWithoutRef, type ReactElement } from "react";
|
|
3
|
+
import { type ComponentPropsWithoutRef, type ReactElement, type ReactNode } from "react";
|
|
4
4
|
import { type ButtonProps } from "./Button.mjs";
|
|
5
5
|
type ToastActionVariant = "primary" | "secondary" | "success" | "warning" | "error" | "green-gradient" | "gold-gradient" | "silver-gradient" | "bronze-gradient";
|
|
6
6
|
interface ToastProps extends ComponentPropsWithoutRef<typeof ToastPrimitive.Root>, VariantProps<typeof toastVariants> {
|
|
7
7
|
showIcon?: boolean;
|
|
8
8
|
duration?: number;
|
|
9
|
+
icon?: ReactNode;
|
|
9
10
|
}
|
|
10
11
|
interface ToastActionProps extends Omit<ButtonProps, "variant">, ComponentPropsWithoutRef<typeof ToastPrimitive.Action> {
|
|
11
12
|
variant?: ToastActionVariant;
|
|
@@ -19,7 +20,7 @@ declare const toastVariants: (props?: ({
|
|
|
19
20
|
variant?: "success" | "warning" | "error" | "primary" | "secondary" | "green-gradient" | "gold-gradient" | "silver-gradient" | "bronze-gradient" | null | undefined;
|
|
20
21
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
22
|
declare function ToastViewport({ className, ...props }: ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
declare function Toast({ className, variant, showIcon, duration, children, ...props }: ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function Toast({ className, variant, showIcon, duration, icon, children, ...props }: ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
declare function ToastAction({ className, variant, size, iconLeft, iconRight, children, altText, ...props }: ToastActionProps): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
declare function ToastClose({ className, label, variant, ...props }: ToastCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
declare function ToastTitle({ className, ...props }: ComponentPropsWithoutRef<typeof ToastPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,KAAK,IAAI,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,EAAE,wBAAwB,CAAC,OAAO,cAAc,CAAC,QAAQ,CAAC,2CAW1D;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAmB,EACnB,QAAe,EACf,QAAe,EACf,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,2CAiBZ;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAmB,EACnB,IAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAwB,EACxB,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAmBlB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,KAAgB,EAChB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,2CAgBjB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,2CAOvD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,2CAO7D;AAED,iBAAS,aAAa,4CAwBrB;AAED,OAAO,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,GACd,CAAC;AACF,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,UAAU,GACX,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
3
|
-
import { type ComponentPropsWithoutRef, type ReactElement } from "react";
|
|
3
|
+
import { type ComponentPropsWithoutRef, type ReactElement, type ReactNode } from "react";
|
|
4
4
|
import { type ButtonProps } from "./Button.js";
|
|
5
5
|
type ToastActionVariant = "primary" | "secondary" | "success" | "warning" | "error" | "green-gradient" | "gold-gradient" | "silver-gradient" | "bronze-gradient";
|
|
6
6
|
interface ToastProps extends ComponentPropsWithoutRef<typeof ToastPrimitive.Root>, VariantProps<typeof toastVariants> {
|
|
7
7
|
showIcon?: boolean;
|
|
8
8
|
duration?: number;
|
|
9
|
+
icon?: ReactNode;
|
|
9
10
|
}
|
|
10
11
|
interface ToastActionProps extends Omit<ButtonProps, "variant">, ComponentPropsWithoutRef<typeof ToastPrimitive.Action> {
|
|
11
12
|
variant?: ToastActionVariant;
|
|
@@ -19,7 +20,7 @@ declare const toastVariants: (props?: ({
|
|
|
19
20
|
variant?: "success" | "warning" | "error" | "primary" | "secondary" | "green-gradient" | "gold-gradient" | "silver-gradient" | "bronze-gradient" | null | undefined;
|
|
20
21
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
22
|
declare function ToastViewport({ className, ...props }: ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
declare function Toast({ className, variant, showIcon, duration, children, ...props }: ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function Toast({ className, variant, showIcon, duration, icon, children, ...props }: ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
declare function ToastAction({ className, variant, size, iconLeft, iconRight, children, altText, ...props }: ToastActionProps): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
declare function ToastClose({ className, label, variant, ...props }: ToastCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
declare function ToastTitle({ className, ...props }: ComponentPropsWithoutRef<typeof ToastPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AACnD,OA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,QAAQ,CAAC,2CAW1D;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAmB,EACnB,QAAe,EACf,QAAe,EACf,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,2CAiBZ;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAmB,EACnB,IAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAwB,EACxB,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAmBlB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,KAAgB,EAChB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,2CAgBjB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,2CAOvD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,2CAO7D;AAED,iBAAS,aAAa,4CAwBrB;AAED,OAAO,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,GACd,CAAC;AACF,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,UAAU,GACX,CAAC"}
|
package/dist/components/Toast.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var n=require("react/jsx-runtime"),i=require("@medway-ui/icons"),
|
|
3
|
+
"use strict";var n=require("react/jsx-runtime"),i=require("@medway-ui/icons"),p=require("class-variance-authority"),d=require("radix-ui"),h=require("./Button.js"),C=require("../hooks/use-toast.js"),o=require("../lib/utils.js"),P=Object.defineProperty,V=Object.defineProperties,I=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,k=(r,e,a)=>e in r?P(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,l=(r,e)=>{for(var a in e||(e={}))w.call(e,a)&&k(r,a,e[a]);if(v)for(var a of v(e))y.call(e,a)&&k(r,a,e[a]);return r},x=(r,e)=>V(r,I(e)),g=(r,e)=>{var a={};for(var t in r)w.call(r,t)&&e.indexOf(t)<0&&(a[t]=r[t]);if(r!=null&&v)for(var t of v(r))e.indexOf(t)<0&&y.call(r,t)&&(a[t]=r[t]);return a};const j=p.cva("group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-md p-2 pl-4 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:slide-in-from-top-full data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-4 data-[state=open]:duration-300 data-[state=closed]:duration-400 data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=cancel]:transition-transform data-[swipe=end]:animate-out transition-[transform,opacity]",{variants:{variant:{primary:"bg-surface-elevated text-primary-foreground",secondary:"bg-surface-elevated text-secondary-foreground",success:"bg-surface-elevated text-feedback-success-foreground",warning:"bg-surface-elevated text-feedback-warning-foreground",error:"bg-surface-elevated text-feedback-error-foreground","green-gradient":"[background:linear-gradient(180deg,_var(--color-secondary-darken-2)_0%,_var(--color-secondary)_100%)] rounded-lg p-4 text-white","gold-gradient":"[background:linear-gradient(180deg,_#ebad10_0%,_#ffdd87_100%)] rounded-lg p-4 text-feedback-warning-foreground-onfill","silver-gradient":"[background:linear-gradient(180deg,_#9e9e9e_0%,_#e0e0e0_100%)] rounded-lg p-4 text-gray-600","bronze-gradient":"[background:linear-gradient(180deg,_#d0660f_0%,_#ffbd87_100%)] rounded-lg p-4 text-white"}},defaultVariants:{variant:"primary"}}),A=p.cva("size-6 shrink-0",{variants:{variant:{primary:"text-primary-foreground fill-primary-background-soft",secondary:"text-secondary-foreground fill-secondary-background-soft",success:"text-feedback-success-foreground fill-feedback-success-background-soft",warning:"text-feedback-warning-foreground fill-feedback-warning-background-soft",error:"text-feedback-error-foreground fill-feedback-error-background-soft","green-gradient":"text-white","gold-gradient":"text-feedback-warning-foreground-onfill","silver-gradient":"text-gray-600","bronze-gradient":"text-white"}},defaultVariants:{variant:"primary"}}),B={primary:"regular-soft",secondary:"emphasis-soft",success:"success-soft",warning:"warning-soft",error:"error-soft","green-gradient":"regular-basic","gold-gradient":"regular-basic","silver-gradient":"regular-basic","bronze-gradient":"regular-basic"},D={primary:i.Info,secondary:i.Info,success:i.CircleCheck,warning:i.TriangleWarning,error:i.OctagonWarning,"green-gradient":i.Rocket,"gold-gradient":i.Rocket,"silver-gradient":i.Rocket,"bronze-gradient":i.Rocket},N={"green-gradient":"text-white hover:bg-white/16 hover:text-white","gold-gradient":"text-feedback-warning-foreground-onfill hover:bg-black/8 hover:text-feedback-warning-foreground-onfill","silver-gradient":"text-gray-600 hover:bg-black/8 hover:text-gray-600","bronze-gradient":"text-white hover:bg-white/16 hover:text-white"},L=d.Toast.Provider;function T(r){var e=r,{className:a}=e,t=g(e,["className"]);return n.jsx(d.Toast.Viewport,l({"data-slot":"toast-viewport",className:o.cn("fixed right-0 top-0 z-[100] flex max-h-screen w-full min-w-0 max-w-[500px] flex-col gap-2 p-4 md:w-[500px]",a)},t))}function _(r){var e=r,{className:a,variant:t="primary",showIcon:s=!0,duration:c=5e3,icon:u,children:f}=e,m=g(e,["className","variant","showIcon","duration","icon","children"]);const b=D[t||"primary"],q=u!=null?u:n.jsx(b,{className:o.cn(A({variant:t}))});return n.jsxs(d.Toast.Root,x(l({duration:c,className:o.cn(j({variant:t}),a)},m),{children:[s&&q,n.jsx("div",{className:"flex flex-1 items-center justify-between gap-4",children:f})]}))}function W(r){var e=r,{className:a,variant:t="primary",size:s="sm",iconLeft:c,iconRight:u,children:f,altText:m="Toast action"}=e,b=g(e,["className","variant","size","iconLeft","iconRight","children","altText"]);return n.jsx(d.Toast.Action,x(l({asChild:!0,altText:m,className:o.cn("inline-flex items-center justify-center",a)},b),{children:n.jsx(h.Button,{iconLeft:c,iconRight:u,size:s,variant:B[t],className:o.cn(N[t]),children:f})}))}function z(r){var e=r,{className:a,label:t="Fechar",variant:s}=e,c=g(e,["className","label","variant"]);return n.jsx(d.Toast.Close,x(l({className:o.cn("shrink-0",a)},c),{asChild:!0,children:n.jsx(h.Button,{iconLeft:n.jsx(i.CloseMd,{className:"size-4"}),size:"sm","aria-label":t,variant:"regular-basic",className:o.cn(s&&N[s])})}))}function O(r){var e=r,{className:a}=e,t=g(e,["className"]);return n.jsx(d.Toast.Title,l({className:o.cn("flex-1 text-md font-medium",a)},t))}function R(r){var e=r,{className:a}=e,t=g(e,["className"]);return n.jsx(d.Toast.Description,l({className:o.cn("text-xs",a)},t))}function F(){const{toasts:r}=C.useToast();return n.jsxs(L,{children:[r.map(function(e){var a=e,{id:t,title:s,description:c,action:u}=a,f=g(a,["id","title","description","action"]);return n.jsxs(_,x(l({},f),{children:[n.jsxs("div",{className:"grid",children:[s&&n.jsx(O,{children:s}),c&&n.jsx(R,{children:c})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[u,n.jsx(z,{variant:f.variant})]})]}),t)}),n.jsx(T,{})]})}exports.Toast=_,exports.ToastAction=W,exports.ToastClose=z,exports.ToastDescription=R,exports.ToastProvider=F,exports.ToastTitle=O,exports.ToastViewport=T,exports.toastVariants=j;
|
|
4
4
|
//# sourceMappingURL=Toast.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{
|
|
3
|
+
import{jsx as n,jsxs as u}from"react/jsx-runtime";import{Rocket as m,OctagonWarning as I,TriangleWarning as D,CircleCheck as L,Info as h,CloseMd as A}from"@medway-ui/icons";import{cva as w}from"class-variance-authority";import{Toast as d}from"radix-ui";import{Button as y}from"./Button.mjs";import{useToast as W}from"../hooks/use-toast.mjs";import{cn as o}from"../lib/utils.mjs";var B=Object.defineProperty,F=Object.defineProperties,$=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,T=(r,e,a)=>e in r?B(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,c=(r,e)=>{for(var a in e||(e={}))k.call(e,a)&&T(r,a,e[a]);if(v)for(var a of v(e))N.call(e,a)&&T(r,a,e[a]);return r},p=(r,e)=>F(r,$(e)),l=(r,e)=>{var a={};for(var t in r)k.call(r,t)&&e.indexOf(t)<0&&(a[t]=r[t]);if(r!=null&&v)for(var t of v(r))e.indexOf(t)<0&&N.call(r,t)&&(a[t]=r[t]);return a};const _=w("group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-md p-2 pl-4 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:slide-in-from-top-full data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-4 data-[state=open]:duration-300 data-[state=closed]:duration-400 data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=cancel]:transition-transform data-[swipe=end]:animate-out transition-[transform,opacity]",{variants:{variant:{primary:"bg-surface-elevated text-primary-foreground",secondary:"bg-surface-elevated text-secondary-foreground",success:"bg-surface-elevated text-feedback-success-foreground",warning:"bg-surface-elevated text-feedback-warning-foreground",error:"bg-surface-elevated text-feedback-error-foreground","green-gradient":"[background:linear-gradient(180deg,_var(--color-secondary-darken-2)_0%,_var(--color-secondary)_100%)] rounded-lg p-4 text-white","gold-gradient":"[background:linear-gradient(180deg,_#ebad10_0%,_#ffdd87_100%)] rounded-lg p-4 text-feedback-warning-foreground-onfill","silver-gradient":"[background:linear-gradient(180deg,_#9e9e9e_0%,_#e0e0e0_100%)] rounded-lg p-4 text-gray-600","bronze-gradient":"[background:linear-gradient(180deg,_#d0660f_0%,_#ffbd87_100%)] rounded-lg p-4 text-white"}},defaultVariants:{variant:"primary"}}),q=w("size-6 shrink-0",{variants:{variant:{primary:"text-primary-foreground fill-primary-background-soft",secondary:"text-secondary-foreground fill-secondary-background-soft",success:"text-feedback-success-foreground fill-feedback-success-background-soft",warning:"text-feedback-warning-foreground fill-feedback-warning-background-soft",error:"text-feedback-error-foreground fill-feedback-error-background-soft","green-gradient":"text-white","gold-gradient":"text-feedback-warning-foreground-onfill","silver-gradient":"text-gray-600","bronze-gradient":"text-white"}},defaultVariants:{variant:"primary"}}),E={primary:"regular-soft",secondary:"emphasis-soft",success:"success-soft",warning:"warning-soft",error:"error-soft","green-gradient":"regular-basic","gold-gradient":"regular-basic","silver-gradient":"regular-basic","bronze-gradient":"regular-basic"},G={primary:h,secondary:h,success:L,warning:D,error:I,"green-gradient":m,"gold-gradient":m,"silver-gradient":m,"bronze-gradient":m},z={"green-gradient":"text-white hover:bg-white/16 hover:text-white","gold-gradient":"text-feedback-warning-foreground-onfill hover:bg-black/8 hover:text-feedback-warning-foreground-onfill","silver-gradient":"text-gray-600 hover:bg-black/8 hover:text-gray-600","bronze-gradient":"text-white hover:bg-white/16 hover:text-white"},H=d.Provider;function O(r){var e=r,{className:a}=e,t=l(e,["className"]);return n(d.Viewport,c({"data-slot":"toast-viewport",className:o("fixed right-0 top-0 z-[100] flex max-h-screen w-full min-w-0 max-w-[500px] flex-col gap-2 p-4 md:w-[500px]",a)},t))}function j(r){var e=r,{className:a,variant:t="primary",showIcon:i=!0,duration:s=5e3,icon:g,children:f}=e,b=l(e,["className","variant","showIcon","duration","icon","children"]);const x=G[t||"primary"],R=g!=null?g:n(x,{className:o(q({variant:t}))});return u(d.Root,p(c({duration:s,className:o(_({variant:t}),a)},b),{children:[i&&R,n("div",{className:"flex flex-1 items-center justify-between gap-4",children:f})]}))}function J(r){var e=r,{className:a,variant:t="primary",size:i="sm",iconLeft:s,iconRight:g,children:f,altText:b="Toast action"}=e,x=l(e,["className","variant","size","iconLeft","iconRight","children","altText"]);return n(d.Action,p(c({asChild:!0,altText:b,className:o("inline-flex items-center justify-center",a)},x),{children:n(y,{iconLeft:s,iconRight:g,size:i,variant:E[t],className:o(z[t]),children:f})}))}function C(r){var e=r,{className:a,label:t="Fechar",variant:i}=e,s=l(e,["className","label","variant"]);return n(d.Close,p(c({className:o("shrink-0",a)},s),{asChild:!0,children:n(y,{iconLeft:n(A,{className:"size-4"}),size:"sm","aria-label":t,variant:"regular-basic",className:o(i&&z[i])})}))}function P(r){var e=r,{className:a}=e,t=l(e,["className"]);return n(d.Title,c({className:o("flex-1 text-md font-medium",a)},t))}function V(r){var e=r,{className:a}=e,t=l(e,["className"]);return n(d.Description,c({className:o("text-xs",a)},t))}function K(){const{toasts:r}=W();return u(H,{children:[r.map(function(e){var a=e,{id:t,title:i,description:s,action:g}=a,f=l(a,["id","title","description","action"]);return u(j,p(c({},f),{children:[u("div",{className:"grid",children:[i&&n(P,{children:i}),s&&n(V,{children:s})]}),u("div",{className:"flex items-center gap-2",children:[g,n(C,{variant:f.variant})]})]}),t)}),n(O,{})]})}export{j as Toast,J as ToastAction,C as ToastClose,V as ToastDescription,K as ToastProvider,P as ToastTitle,O as ToastViewport,_ as toastVariants};
|
|
4
4
|
//# sourceMappingURL=Toast.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medway-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Biblioteca de componentes e assets para o sistema Medway",
|
|
6
6
|
"author": "Alekcarvalho",
|
|
@@ -32,12 +32,16 @@
|
|
|
32
32
|
"build:native": "cd native && bob build",
|
|
33
33
|
"build:notes-core": "node_modules/.bin/tsc -p notes-core/tsconfig.build.json",
|
|
34
34
|
"notes-core:typecheck": "node_modules/.bin/tsc -p notes-core/tsconfig.json --noEmit",
|
|
35
|
+
"pretypecheck": "npm run build:notes-core",
|
|
36
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
35
37
|
"build:editor-bundle": "npm --prefix editor-bundle ci && npm --prefix editor-bundle run build",
|
|
36
38
|
"typecheck:editor-bundle": "npm --prefix editor-bundle ci && npm --prefix editor-bundle run typecheck",
|
|
37
39
|
"typecheck:native": "cd native && tsc --noEmit",
|
|
38
40
|
"release:native": "cd native && npm run release",
|
|
39
41
|
"generate:docs": "tsx scripts/generate-component-docs.ts",
|
|
40
|
-
"
|
|
42
|
+
"changeset": "changeset",
|
|
43
|
+
"version": "changeset version",
|
|
44
|
+
"release": "yarn build:lib && changeset publish"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
47
|
"class-variance-authority": "^0.7.1",
|
|
@@ -62,6 +66,8 @@
|
|
|
62
66
|
}
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
69
|
+
"@changesets/changelog-github": "^0.7.0",
|
|
70
|
+
"@changesets/cli": "^2.31.1",
|
|
65
71
|
"@commitlint/cli": "^19.8.1",
|
|
66
72
|
"@commitlint/config-conventional": "^19.8.1",
|
|
67
73
|
"@eslint/eslintrc": "^3",
|