@purpurds/field-error-text 3.0.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/dist/LICENSE.txt +38 -0
- package/dist/field-error-text.cjs.js +10 -0
- package/dist/field-error-text.cjs.js.map +1 -0
- package/dist/field-error-text.d.ts +9 -0
- package/dist/field-error-text.d.ts.map +1 -0
- package/dist/field-error-text.es.js +152 -0
- package/dist/field-error-text.es.js.map +1 -0
- package/dist/field-error-text.system.js +10 -0
- package/dist/field-error-text.system.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +61 -0
- package/readme.mdx +58 -0
- package/src/field-error-text.module.scss +15 -0
- package/src/field-error-text.stories.tsx +59 -0
- package/src/field-error-text.test.tsx +16 -0
- package/src/field-error-text.tsx +33 -0
- package/src/global.d.ts +4 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export type FieldErrorTextProps = {
|
|
3
|
+
["data-testid"]?: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
relevant?: "additions text" | "additions" | "removals" | "text" | "all";
|
|
7
|
+
};
|
|
8
|
+
export declare const FieldErrorText: ({ ["data-testid"]: dataTestId, children, className, relevant, ...props }: FieldErrorTextProps) => React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=field-error-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-error-text.d.ts","sourceRoot":"","sources":["../src/field-error-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;CACzE,CAAC;AAIF,eAAO,MAAM,cAAc,6EAMxB,mBAAmB,sBAWrB,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { jsx as c, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
function _(t) {
|
|
3
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
4
|
+
}
|
|
5
|
+
var f = { exports: {} };
|
|
6
|
+
/*!
|
|
7
|
+
Copyright (c) 2018 Jed Watson.
|
|
8
|
+
Licensed under the MIT License (MIT), see
|
|
9
|
+
http://jedwatson.github.io/classnames
|
|
10
|
+
*/
|
|
11
|
+
(function(t) {
|
|
12
|
+
(function() {
|
|
13
|
+
var i = {}.hasOwnProperty;
|
|
14
|
+
function n() {
|
|
15
|
+
for (var r = "", e = 0; e < arguments.length; e++) {
|
|
16
|
+
var s = arguments[e];
|
|
17
|
+
s && (r = o(r, u.call(this, s)));
|
|
18
|
+
}
|
|
19
|
+
return r;
|
|
20
|
+
}
|
|
21
|
+
function u(r) {
|
|
22
|
+
if (typeof r == "string" || typeof r == "number")
|
|
23
|
+
return this && this[r] || r;
|
|
24
|
+
if (typeof r != "object")
|
|
25
|
+
return "";
|
|
26
|
+
if (Array.isArray(r))
|
|
27
|
+
return n.apply(this, r);
|
|
28
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
29
|
+
return r.toString();
|
|
30
|
+
var e = "";
|
|
31
|
+
for (var s in r)
|
|
32
|
+
i.call(r, s) && r[s] && (e = o(e, this && this[s] || s));
|
|
33
|
+
return e;
|
|
34
|
+
}
|
|
35
|
+
function o(r, e) {
|
|
36
|
+
return e ? r ? r + " " + e : r + e : r;
|
|
37
|
+
}
|
|
38
|
+
t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
|
|
39
|
+
})();
|
|
40
|
+
})(f);
|
|
41
|
+
var m = f.exports;
|
|
42
|
+
const x = /* @__PURE__ */ _(m), g = {
|
|
43
|
+
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
44
|
+
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
45
|
+
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
46
|
+
"purpur-icon--sm": "_purpur-icon--sm_8u1lq_12",
|
|
47
|
+
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
48
|
+
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
49
|
+
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
50
|
+
}, y = {
|
|
51
|
+
name: "error-filled",
|
|
52
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="currentColor"><path fill-rule="evenodd" d="M14.268 3.5c-.77-1.333-2.694-1.333-3.464 0l-8.66 15c-.77 1.333.192 3 1.732 3h17.32c1.54 0 2.502-1.667 1.733-3l-8.66-15Zm-.694 5.067-.247 6.876h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.917c0 .649-.585 1.234-1.25 1.234-.648 0-1.25-.585-1.25-1.234 0-.633.602-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z" clip-rule="evenodd"/></svg>',
|
|
53
|
+
keywords: ["error-filled"],
|
|
54
|
+
category: "status"
|
|
55
|
+
}, h = x.bind(g), l = "purpur-icon", w = "md", b = (t) => t.filter((i) => Object.keys(i).length >= 1).map((i) => `${i.name}="${i.value}"`).join(" "), j = ({ content: t = "", title: i } = {}) => {
|
|
56
|
+
const n = [
|
|
57
|
+
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
58
|
+
{ name: "fill", value: "currentColor" },
|
|
59
|
+
{ name: "viewBox", value: "0 0 24 24" },
|
|
60
|
+
i ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
61
|
+
], u = i ? `<title>${i}</title>` : "";
|
|
62
|
+
return `<svg ${b(n)}>${u}${t}</svg>`;
|
|
63
|
+
}, S = (t) => t.replace(/<(\/?)svg([^>]*)>/g, "").trim(), O = ({
|
|
64
|
+
["data-testid"]: t,
|
|
65
|
+
svg: i,
|
|
66
|
+
allyTitle: n,
|
|
67
|
+
className: u = "",
|
|
68
|
+
size: o = w,
|
|
69
|
+
...r
|
|
70
|
+
}) => {
|
|
71
|
+
const e = j({
|
|
72
|
+
content: S(i.svg),
|
|
73
|
+
title: n
|
|
74
|
+
}), s = h(u, l, `${l}--${o}`);
|
|
75
|
+
return /* @__PURE__ */ c(
|
|
76
|
+
"span",
|
|
77
|
+
{
|
|
78
|
+
"aria-label": n,
|
|
79
|
+
className: s,
|
|
80
|
+
"data-testid": t,
|
|
81
|
+
dangerouslySetInnerHTML: { __html: e },
|
|
82
|
+
...r
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
function $(t) {
|
|
87
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
88
|
+
}
|
|
89
|
+
var d = { exports: {} };
|
|
90
|
+
/*!
|
|
91
|
+
Copyright (c) 2018 Jed Watson.
|
|
92
|
+
Licensed under the MIT License (MIT), see
|
|
93
|
+
http://jedwatson.github.io/classnames
|
|
94
|
+
*/
|
|
95
|
+
(function(t) {
|
|
96
|
+
(function() {
|
|
97
|
+
var i = {}.hasOwnProperty;
|
|
98
|
+
function n() {
|
|
99
|
+
for (var r = "", e = 0; e < arguments.length; e++) {
|
|
100
|
+
var s = arguments[e];
|
|
101
|
+
s && (r = o(r, u(s)));
|
|
102
|
+
}
|
|
103
|
+
return r;
|
|
104
|
+
}
|
|
105
|
+
function u(r) {
|
|
106
|
+
if (typeof r == "string" || typeof r == "number")
|
|
107
|
+
return r;
|
|
108
|
+
if (typeof r != "object")
|
|
109
|
+
return "";
|
|
110
|
+
if (Array.isArray(r))
|
|
111
|
+
return n.apply(null, r);
|
|
112
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
113
|
+
return r.toString();
|
|
114
|
+
var e = "";
|
|
115
|
+
for (var s in r)
|
|
116
|
+
i.call(r, s) && r[s] && (e = o(e, s));
|
|
117
|
+
return e;
|
|
118
|
+
}
|
|
119
|
+
function o(r, e) {
|
|
120
|
+
return e ? r ? r + " " + e : r + e : r;
|
|
121
|
+
}
|
|
122
|
+
t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
|
|
123
|
+
})();
|
|
124
|
+
})(d);
|
|
125
|
+
var N = d.exports;
|
|
126
|
+
const q = /* @__PURE__ */ $(N), a = {
|
|
127
|
+
"purpur-field-error-text": "_purpur-field-error-text_1h4gy_1",
|
|
128
|
+
"purpur-field-error-text__icon": "_purpur-field-error-text__icon_1h4gy_12"
|
|
129
|
+
}, p = "purpur-field-error-text", C = ({
|
|
130
|
+
["data-testid"]: t,
|
|
131
|
+
children: i,
|
|
132
|
+
className: n,
|
|
133
|
+
relevant: u = "additions text",
|
|
134
|
+
...o
|
|
135
|
+
}) => /* @__PURE__ */ v(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: q([n, a[p]]),
|
|
139
|
+
"data-testid": t,
|
|
140
|
+
"aria-live": "assertive",
|
|
141
|
+
"aria-relevant": u,
|
|
142
|
+
...o,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ c(O, { svg: y, size: "xs", className: a[`${p}__icon`] }),
|
|
145
|
+
i
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
export {
|
|
150
|
+
C as FieldErrorText
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=field-error-text.es.js.map
|