@oddmash/ui 0.4.0 → 0.4.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.
- package/README.md +1 -1
- package/dist/{chunk-TBR4HCBJ.js → chunk-ITEJEMEF.js} +12 -3
- package/dist/index.js +1 -1
- package/dist/styles.css +14 -6
- package/dist/toast.d.ts +5 -3
- package/dist/toast.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,6 @@ Oddmash UI is for focused tools such as Interaction Inspector: products that nee
|
|
|
31
31
|
|
|
32
32
|
## Current scope
|
|
33
33
|
|
|
34
|
-
Oddmash UI is under active pre-1.0 development. Version 0.4.
|
|
34
|
+
Oddmash UI is under active pre-1.0 development. Version 0.4.1 includes 24 component families, including Toast.
|
|
35
35
|
|
|
36
36
|
[Docs](https://oddmash.github.io/oddmash-ui/) · [npm](https://www.npmjs.com/package/@oddmash/ui) · [GitHub](https://github.com/Oddmash/oddmash-ui) · [Contributor guide](CONTRIBUTING.md) · [MIT License](LICENSE)
|
|
@@ -129,15 +129,21 @@ var ToastViewport = /* @__PURE__ */ forwardRef(
|
|
|
129
129
|
}
|
|
130
130
|
);
|
|
131
131
|
ToastViewport.displayName = "ToastViewport";
|
|
132
|
-
var ToastIcon = ({ tone }) => /* @__PURE__ */ jsx("svg", {
|
|
132
|
+
var ToastIcon = ({ tone }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "data-icon": tone, children: tone === "neutral" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
133
|
+
/* @__PURE__ */ jsx("path", { d: "M18 8a6 6 0 0 0-12 0c0 6-2 7-2 9h16c0-2-2-3-2-9" }),
|
|
134
|
+
/* @__PURE__ */ jsx("path", { d: "M10 20h4" })
|
|
135
|
+
] }) : tone === "success" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
133
136
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
|
|
134
137
|
/* @__PURE__ */ jsx("path", { d: "m8 12 2.5 2.5L16 9" })
|
|
135
138
|
] }) : tone === "warning" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
136
139
|
/* @__PURE__ */ jsx("path", { d: "M10.3 4.7a2 2 0 0 1 3.4 0l7 12.1a2 2 0 0 1-1.7 3H5a2 2 0 0 1-1.7-3z" }),
|
|
137
140
|
/* @__PURE__ */ jsx("path", { d: "M12 9v4m0 3h.01" })
|
|
141
|
+
] }) : tone === "loading" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
142
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9", opacity: ".24" }),
|
|
143
|
+
/* @__PURE__ */ jsx("path", { d: "M12 3a9 9 0 0 1 9 9" })
|
|
138
144
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
145
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
|
|
140
|
-
/* @__PURE__ */ jsx("path", { d: tone === "info" ? "M12 11v5m0-8h.01" : "
|
|
146
|
+
/* @__PURE__ */ jsx("path", { d: tone === "info" ? "M12 11v5m0-8h.01" : "m9 9 6 6m0-6-6 6" })
|
|
141
147
|
] }) });
|
|
142
148
|
var Toast = /* @__PURE__ */ forwardRef(
|
|
143
149
|
({
|
|
@@ -146,6 +152,7 @@ var Toast = /* @__PURE__ */ forwardRef(
|
|
|
146
152
|
onDismiss,
|
|
147
153
|
dismissLabel = "Dismiss notification",
|
|
148
154
|
tone = "neutral",
|
|
155
|
+
icon,
|
|
149
156
|
children,
|
|
150
157
|
className,
|
|
151
158
|
...props
|
|
@@ -163,7 +170,9 @@ var Toast = /* @__PURE__ */ forwardRef(
|
|
|
163
170
|
const visible = open || present;
|
|
164
171
|
const urgent = tone === "danger" || tone === "error";
|
|
165
172
|
return /* @__PURE__ */ jsx("div", { ...props, ref, className: cx("om-toast-region", className), "data-state": open ? "open" : visible ? "closing" : "closed", children: /* @__PURE__ */ jsxs("div", { className: visible ? "om-toast" : void 0, "data-tone": visible ? tone : void 0, "data-state": open ? "open" : "closing", children: [
|
|
166
|
-
visible && /* @__PURE__ */ jsx(
|
|
173
|
+
visible && icon !== null && /* @__PURE__ */ jsx("span", { className: "om-toast-icon", "aria-hidden": "true", ref: (element) => {
|
|
174
|
+
element?.setAttribute("inert", "");
|
|
175
|
+
}, children: icon === void 0 ? /* @__PURE__ */ jsx(ToastIcon, { tone }) : icon }),
|
|
167
176
|
/* @__PURE__ */ jsx("div", { role: urgent ? "alert" : "status", "aria-atomic": "true", children: open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
168
177
|
/* @__PURE__ */ jsx("strong", { children: title }),
|
|
169
178
|
children && /* @__PURE__ */ jsx("div", { children })
|
package/dist/index.js
CHANGED
package/dist/styles.css
CHANGED
|
@@ -639,7 +639,7 @@ select.om-select optgroup {
|
|
|
639
639
|
position: fixed;
|
|
640
640
|
z-index: 900;
|
|
641
641
|
inset: auto var(--om-semantic-space-lg) var(--om-semantic-space-lg) auto;
|
|
642
|
-
inline-size: min(22rem,
|
|
642
|
+
inline-size: min(22rem, 100% - 2 * var(--om-semantic-space-lg));
|
|
643
643
|
pointer-events: none;
|
|
644
644
|
}
|
|
645
645
|
|
|
@@ -647,7 +647,7 @@ select.om-select optgroup {
|
|
|
647
647
|
position: fixed;
|
|
648
648
|
z-index: 900;
|
|
649
649
|
inset: auto var(--om-semantic-space-lg) var(--om-semantic-space-lg) auto;
|
|
650
|
-
inline-size: min(22rem,
|
|
650
|
+
inline-size: min(22rem, 100% - 2 * var(--om-semantic-space-lg));
|
|
651
651
|
max-block-size: calc(100dvh - 2 * var(--om-semantic-space-lg));
|
|
652
652
|
display: flex;
|
|
653
653
|
flex-direction: column;
|
|
@@ -697,7 +697,7 @@ select.om-select optgroup {
|
|
|
697
697
|
pointer-events: auto;
|
|
698
698
|
position: relative;
|
|
699
699
|
display: flex;
|
|
700
|
-
align-items:
|
|
700
|
+
align-items: center;
|
|
701
701
|
gap: var(--om-semantic-space-sm);
|
|
702
702
|
padding: var(--om-semantic-space-md) var(--om-semantic-space-lg);
|
|
703
703
|
border: 1px solid var(--om-semantic-color-border);
|
|
@@ -715,7 +715,12 @@ select.om-select optgroup {
|
|
|
715
715
|
flex: none;
|
|
716
716
|
inline-size: 20px;
|
|
717
717
|
block-size: 20px;
|
|
718
|
-
|
|
718
|
+
display: grid;
|
|
719
|
+
place-items: center;
|
|
720
|
+
}
|
|
721
|
+
.om-toast .om-toast-icon > svg {
|
|
722
|
+
inline-size: 100%;
|
|
723
|
+
block-size: 100%;
|
|
719
724
|
}
|
|
720
725
|
.om-toast > [role], .om-toast > .om-toast-exit-copy {
|
|
721
726
|
flex: 1;
|
|
@@ -738,7 +743,7 @@ select.om-select optgroup {
|
|
|
738
743
|
.om-toast > button {
|
|
739
744
|
display: grid;
|
|
740
745
|
place-items: center;
|
|
741
|
-
margin: -
|
|
746
|
+
margin-inline-end: -5px;
|
|
742
747
|
padding: 0;
|
|
743
748
|
border: 1px solid transparent;
|
|
744
749
|
border-radius: var(--om-semantic-radius-sm);
|
|
@@ -770,10 +775,13 @@ select.om-select optgroup {
|
|
|
770
775
|
clip-path: inset(50%);
|
|
771
776
|
}
|
|
772
777
|
.om-toast[data-state=closing] > .om-toast-close-placeholder {
|
|
773
|
-
margin: -
|
|
778
|
+
margin-inline-end: -5px;
|
|
774
779
|
}
|
|
775
780
|
|
|
776
781
|
@media (prefers-reduced-motion: no-preference) {
|
|
782
|
+
.om-toast[data-state=open] [data-icon=loading] {
|
|
783
|
+
animation: om-spinner-turn 0.9s linear infinite;
|
|
784
|
+
}
|
|
777
785
|
.om-toast[data-state=open] {
|
|
778
786
|
animation: om-toast-in 240ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
|
|
779
787
|
}
|
package/dist/toast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
3
3
|
|
|
4
4
|
declare const ToastViewport: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
type ToastProps = Omit<ComponentPropsWithoutRef<'div'>, 'title'> & {
|
|
@@ -7,14 +7,16 @@ type ToastProps = Omit<ComponentPropsWithoutRef<'div'>, 'title'> & {
|
|
|
7
7
|
title: string;
|
|
8
8
|
onDismiss: () => void;
|
|
9
9
|
dismissLabel?: string;
|
|
10
|
-
tone?: 'neutral' | 'success' | 'info' | 'warning' | 'danger' | 'error';
|
|
10
|
+
tone?: 'neutral' | 'success' | 'info' | 'warning' | 'danger' | 'error' | 'loading';
|
|
11
|
+
icon?: ReactNode;
|
|
11
12
|
};
|
|
12
13
|
declare const Toast: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "title"> & {
|
|
13
14
|
open: boolean;
|
|
14
15
|
title: string;
|
|
15
16
|
onDismiss: () => void;
|
|
16
17
|
dismissLabel?: string;
|
|
17
|
-
tone?: "neutral" | "success" | "info" | "warning" | "danger" | "error";
|
|
18
|
+
tone?: "neutral" | "success" | "info" | "warning" | "danger" | "error" | "loading";
|
|
19
|
+
icon?: ReactNode;
|
|
18
20
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
19
21
|
|
|
20
22
|
export { Toast, ToastViewport };
|
package/dist/toast.js
CHANGED