@purpurds/cta-link 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 +45 -0
- package/dist/cta-link.cjs.js +10 -0
- package/dist/cta-link.cjs.js.map +1 -0
- package/dist/cta-link.d.ts +4 -0
- package/dist/cta-link.d.ts.map +1 -0
- package/dist/cta-link.es.js +177 -0
- package/dist/cta-link.es.js.map +1 -0
- package/dist/cta-link.system.js +10 -0
- package/dist/cta-link.system.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +61 -0
- package/readme.mdx +56 -0
- package/src/cta-link.module.scss +5 -0
- package/src/cta-link.stories.tsx +59 -0
- package/src/cta-link.test.tsx +63 -0
- package/src/cta-link.tsx +42 -0
- package/src/global.d.ts +4 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React, { AnchorHTMLAttributes } from "react";
|
|
2
|
+
import { ActionProps } from "@purpurds/action";
|
|
3
|
+
export declare const CtaLink: ({ children, className, ["data-testid"]: dataTestid, fullWidth, iconOnly, size, variant, ...props }: ActionProps & AnchorHTMLAttributes<HTMLAnchorElement>) => React.JSX.Element;
|
|
4
|
+
//# sourceMappingURL=cta-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cta-link.d.ts","sourceRoot":"","sources":["../src/cta-link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,WAAW,EAAQ,MAAM,kBAAkB,CAAC;AAQrD,eAAO,MAAM,OAAO,uGASjB,WAAW,GAAG,qBAAqB,iBAAiB,CAAC,sBAuBvD,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsx as _, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
const c = {
|
|
3
|
+
SM: "sm",
|
|
4
|
+
MD: "md",
|
|
5
|
+
LG: "lg"
|
|
6
|
+
};
|
|
7
|
+
function y(t) {
|
|
8
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
9
|
+
}
|
|
10
|
+
var f = { exports: {} };
|
|
11
|
+
/*!
|
|
12
|
+
Copyright (c) 2018 Jed Watson.
|
|
13
|
+
Licensed under the MIT License (MIT), see
|
|
14
|
+
http://jedwatson.github.io/classnames
|
|
15
|
+
*/
|
|
16
|
+
(function(t) {
|
|
17
|
+
(function() {
|
|
18
|
+
var a = {}.hasOwnProperty;
|
|
19
|
+
function u() {
|
|
20
|
+
for (var r = "", e = 0; e < arguments.length; e++) {
|
|
21
|
+
var n = arguments[e];
|
|
22
|
+
n && (r = i(r, p.call(this, n)));
|
|
23
|
+
}
|
|
24
|
+
return r;
|
|
25
|
+
}
|
|
26
|
+
function p(r) {
|
|
27
|
+
if (typeof r == "string" || typeof r == "number")
|
|
28
|
+
return this && this[r] || r;
|
|
29
|
+
if (typeof r != "object")
|
|
30
|
+
return "";
|
|
31
|
+
if (Array.isArray(r))
|
|
32
|
+
return u.apply(this, r);
|
|
33
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
34
|
+
return r.toString();
|
|
35
|
+
var e = "";
|
|
36
|
+
for (var n in r)
|
|
37
|
+
a.call(r, n) && r[n] && (e = i(e, this && this[n] || n));
|
|
38
|
+
return e;
|
|
39
|
+
}
|
|
40
|
+
function i(r, e) {
|
|
41
|
+
return e ? r ? r + " " + e : r + e : r;
|
|
42
|
+
}
|
|
43
|
+
t.exports ? (u.default = u, t.exports = u) : window.classNames = u;
|
|
44
|
+
})();
|
|
45
|
+
})(f);
|
|
46
|
+
var k = f.exports;
|
|
47
|
+
const h = /* @__PURE__ */ y(k), x = {
|
|
48
|
+
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
49
|
+
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
50
|
+
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
51
|
+
"purpur-icon--sm": "_purpur-icon--sm_8u1lq_12",
|
|
52
|
+
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
53
|
+
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
54
|
+
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
55
|
+
}, b = {
|
|
56
|
+
name: "arrow-right",
|
|
57
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M20.9 12a.9.9 0 0 1-.264.636l-5.5 5.5a.9.9 0 0 1-1.272-1.272l3.963-3.964H4a.9.9 0 0 1 0-1.8h13.827l-3.963-3.964a.9.9 0 1 1 1.272-1.272l5.5 5.5A.9.9 0 0 1 20.9 12Z" clip-rule="evenodd"/></svg>',
|
|
58
|
+
keywords: ["arrow-right"],
|
|
59
|
+
category: "utility"
|
|
60
|
+
}, w = h.bind(x), o = "purpur-icon", $ = "md", S = (t) => t.filter((a) => Object.keys(a).length >= 1).map((a) => `${a.name}="${a.value}"`).join(" "), j = ({ content: t = "", title: a } = {}) => {
|
|
61
|
+
const u = [
|
|
62
|
+
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
63
|
+
{ name: "fill", value: "currentColor" },
|
|
64
|
+
{ name: "viewBox", value: "0 0 24 24" },
|
|
65
|
+
a ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
66
|
+
], p = a ? `<title>${a}</title>` : "";
|
|
67
|
+
return `<svg ${S(u)}>${p}${t}</svg>`;
|
|
68
|
+
}, O = (t) => t.replace(/<(\/?)svg([^>]*)>/g, "").trim(), q = ({
|
|
69
|
+
["data-testid"]: t,
|
|
70
|
+
svg: a,
|
|
71
|
+
allyTitle: u,
|
|
72
|
+
className: p = "",
|
|
73
|
+
size: i = $,
|
|
74
|
+
...r
|
|
75
|
+
}) => {
|
|
76
|
+
const e = j({
|
|
77
|
+
content: O(a.svg),
|
|
78
|
+
title: u
|
|
79
|
+
}), n = w(p, o, `${o}--${i}`);
|
|
80
|
+
return /* @__PURE__ */ _(
|
|
81
|
+
"span",
|
|
82
|
+
{
|
|
83
|
+
"aria-label": u,
|
|
84
|
+
className: n,
|
|
85
|
+
"data-testid": t,
|
|
86
|
+
dangerouslySetInnerHTML: { __html: e },
|
|
87
|
+
...r
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
function M(t) {
|
|
92
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
93
|
+
}
|
|
94
|
+
var d = { exports: {} };
|
|
95
|
+
/*!
|
|
96
|
+
Copyright (c) 2018 Jed Watson.
|
|
97
|
+
Licensed under the MIT License (MIT), see
|
|
98
|
+
http://jedwatson.github.io/classnames
|
|
99
|
+
*/
|
|
100
|
+
(function(t) {
|
|
101
|
+
(function() {
|
|
102
|
+
var a = {}.hasOwnProperty;
|
|
103
|
+
function u() {
|
|
104
|
+
for (var r = "", e = 0; e < arguments.length; e++) {
|
|
105
|
+
var n = arguments[e];
|
|
106
|
+
n && (r = i(r, p(n)));
|
|
107
|
+
}
|
|
108
|
+
return r;
|
|
109
|
+
}
|
|
110
|
+
function p(r) {
|
|
111
|
+
if (typeof r == "string" || typeof r == "number")
|
|
112
|
+
return r;
|
|
113
|
+
if (typeof r != "object")
|
|
114
|
+
return "";
|
|
115
|
+
if (Array.isArray(r))
|
|
116
|
+
return u.apply(null, r);
|
|
117
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
118
|
+
return r.toString();
|
|
119
|
+
var e = "";
|
|
120
|
+
for (var n in r)
|
|
121
|
+
a.call(r, n) && r[n] && (e = i(e, n));
|
|
122
|
+
return e;
|
|
123
|
+
}
|
|
124
|
+
function i(r, e) {
|
|
125
|
+
return e ? r ? r + " " + e : r + e : r;
|
|
126
|
+
}
|
|
127
|
+
t.exports ? (u.default = u, t.exports = u) : window.classNames = u;
|
|
128
|
+
})();
|
|
129
|
+
})(d);
|
|
130
|
+
var N = d.exports;
|
|
131
|
+
const A = /* @__PURE__ */ M(N), l = {
|
|
132
|
+
"purpur-cta-link": "_purpur-cta-link_e7abc_1",
|
|
133
|
+
"purpur-cta-link--sm": "_purpur-cta-link--sm_e7abc_33",
|
|
134
|
+
"purpur-cta-link--icon-only": "_purpur-cta-link--icon-only_e7abc_36",
|
|
135
|
+
"purpur-cta-link--md": "_purpur-cta-link--md_e7abc_39",
|
|
136
|
+
"purpur-cta-link--lg": "_purpur-cta-link--lg_e7abc_45",
|
|
137
|
+
"purpur-cta-link--full-width": "_purpur-cta-link--full-width_e7abc_51",
|
|
138
|
+
"purpur-cta-link--primary": "_purpur-cta-link--primary_e7abc_54",
|
|
139
|
+
"purpur-cta-link--disabled": "_purpur-cta-link--disabled_e7abc_58",
|
|
140
|
+
"purpur-cta-link--primary-negative": "_purpur-cta-link--primary-negative_e7abc_64",
|
|
141
|
+
"purpur-cta-link--secondary": "_purpur-cta-link--secondary_e7abc_76",
|
|
142
|
+
"purpur-cta-link--secondary-negative": "_purpur-cta-link--secondary-negative_e7abc_87",
|
|
143
|
+
"purpur-cta-link--expressive": "_purpur-cta-link--expressive_e7abc_98",
|
|
144
|
+
"purpur-cta-link--expressive-negative": "_purpur-cta-link--expressive-negative_e7abc_108"
|
|
145
|
+
}, s = "purpur-cta-link", L = ({
|
|
146
|
+
children: t,
|
|
147
|
+
className: a,
|
|
148
|
+
["data-testid"]: u,
|
|
149
|
+
fullWidth: p = !1,
|
|
150
|
+
iconOnly: i,
|
|
151
|
+
size: r = c.MD,
|
|
152
|
+
variant: e,
|
|
153
|
+
...n
|
|
154
|
+
}) => {
|
|
155
|
+
const v = A(
|
|
156
|
+
[
|
|
157
|
+
a,
|
|
158
|
+
l[s],
|
|
159
|
+
l[`${s}--${e}`],
|
|
160
|
+
l[`${s}--${r}`]
|
|
161
|
+
],
|
|
162
|
+
{
|
|
163
|
+
[l[`${s}--icon-only`]]: i,
|
|
164
|
+
[l[`${s}--negative`]]: e.endsWith("negative"),
|
|
165
|
+
[l[`${s}--full-width`]]: p
|
|
166
|
+
}
|
|
167
|
+
), m = n.href ? "a" : "span";
|
|
168
|
+
return /* @__PURE__ */ g(m, { className: v, "data-testid": u, ...n, children: [
|
|
169
|
+
t && !i && t,
|
|
170
|
+
" ",
|
|
171
|
+
/* @__PURE__ */ _(q, { svg: b, size: r === c.LG ? "sm" : "xs" })
|
|
172
|
+
] });
|
|
173
|
+
};
|
|
174
|
+
export {
|
|
175
|
+
L as CtaLink
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=cta-link.es.js.map
|