@pglevy/sailwind 0.1.0 → 0.2.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/components/Button/ButtonWidget.d.ts +3 -3
- package/dist/components/Button/ButtonWidget.d.ts.map +1 -1
- package/dist/components/Button/ButtonWidget.js +81 -72
- package/dist/components/TableOfContents.d.ts.map +1 -1
- package/dist/components/TableOfContents.js +14 -9
- package/package.json +6 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { SAILSize } from '../../types/sail';
|
|
1
|
+
import { SAILSize, SAILSemanticColor } from '../../types/sail';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
type ButtonStyle = "SOLID" | "OUTLINE" | "GHOST" | "LINK";
|
|
4
|
-
type ButtonColor = "ACCENT" | "NEGATIVE" | "SECONDARY";
|
|
5
4
|
type ButtonWidth = "MINIMIZE" | "FILL";
|
|
6
5
|
type IconPosition = "START" | "END";
|
|
7
6
|
/**
|
|
@@ -14,7 +13,8 @@ export interface ButtonWidgetProps {
|
|
|
14
13
|
/** Determines the button's appearance */
|
|
15
14
|
style?: ButtonStyle;
|
|
16
15
|
/** Determines button color (hex or semantic) */
|
|
17
|
-
|
|
16
|
+
/** Enhancement to SAIL */
|
|
17
|
+
color?: SAILSemanticColor | string;
|
|
18
18
|
/** Determines size of the button */
|
|
19
19
|
size?: SAILSize;
|
|
20
20
|
/** Determines button width */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWidget.d.ts","sourceRoot":"","sources":["../../../src/components/Button/ButtonWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"ButtonWidget.d.ts","sourceRoot":"","sources":["../../../src/components/Button/ButtonWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK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OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,wCAAwC;IACxC,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAChC,qDAAqD;IACrD,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAC/B,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+LpD,CAAA"}
|
|
@@ -1,101 +1,110 @@
|
|
|
1
|
-
import { jsxs as R, jsx as
|
|
1
|
+
import { jsxs as R, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import * as w from "lucide-react";
|
|
4
4
|
import { mergeClasses as M } from "../../utils/classNames.js";
|
|
5
|
-
const
|
|
6
|
-
label:
|
|
7
|
-
style:
|
|
5
|
+
const j = ({
|
|
6
|
+
label: a,
|
|
7
|
+
style: e = "OUTLINE",
|
|
8
8
|
color: t = "ACCENT",
|
|
9
|
-
size:
|
|
10
|
-
width:
|
|
11
|
-
disabled:
|
|
12
|
-
submit:
|
|
13
|
-
showWhen:
|
|
14
|
-
icon:
|
|
15
|
-
iconPosition:
|
|
9
|
+
size: d = "STANDARD",
|
|
10
|
+
width: p,
|
|
11
|
+
disabled: b = !1,
|
|
12
|
+
submit: c = !1,
|
|
13
|
+
showWhen: f = !0,
|
|
14
|
+
icon: i,
|
|
15
|
+
iconPosition: g = "START",
|
|
16
16
|
accessibilityText: h,
|
|
17
|
-
tooltip:
|
|
17
|
+
tooltip: C,
|
|
18
18
|
loadingIndicator: o = !1,
|
|
19
19
|
saveInto: A,
|
|
20
|
-
onClick:
|
|
21
|
-
value:
|
|
22
|
-
className:
|
|
20
|
+
onClick: x,
|
|
21
|
+
value: E,
|
|
22
|
+
className: N
|
|
23
23
|
}) => {
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
26
|
-
SMALL: "px-3 py-
|
|
27
|
-
//
|
|
28
|
-
STANDARD: "px-4 py-2
|
|
29
|
-
//
|
|
24
|
+
if (!f) return null;
|
|
25
|
+
const T = {
|
|
26
|
+
SMALL: "px-3 py-2 text-sm",
|
|
27
|
+
// 12px horizontal, 8px vertical
|
|
28
|
+
STANDARD: "px-4 py-2 text-base",
|
|
29
|
+
// 16px horizontal, 8px vertical (matches input height)
|
|
30
30
|
MEDIUM: "px-6 py-3 text-lg",
|
|
31
|
-
//
|
|
32
|
-
LARGE: "px-
|
|
33
|
-
//
|
|
34
|
-
},
|
|
31
|
+
// 24px horizontal, 12px vertical
|
|
32
|
+
LARGE: "px-10 py-4 text-xl"
|
|
33
|
+
// 40px horizontal, 16px vertical
|
|
34
|
+
}, S = p === "FILL" ? "w-full" : "w-auto", m = () => {
|
|
35
35
|
if (!t.startsWith("#")) return;
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
},
|
|
36
|
+
const r = {};
|
|
37
|
+
return e === "SOLID" ? (r.backgroundColor = t, r.borderColor = "transparent", r.color = "#ffffff") : e === "OUTLINE" ? (r.borderColor = t, r.color = t, r.backgroundColor = "#ffffff") : (e === "GHOST" || e === "LINK") && (r.color = t, r.borderColor = "transparent"), Object.keys(r).length > 0 ? r : void 0;
|
|
38
|
+
}, I = () => {
|
|
39
39
|
if (t.startsWith("#"))
|
|
40
|
-
return
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
ACCENT: "bg-blue-500 text-white hover:bg-blue-700",
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}[
|
|
55
|
-
ACCENT: "text-blue-500 hover:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
return "border";
|
|
41
|
+
const r = t;
|
|
42
|
+
return e === "SOLID" ? {
|
|
43
|
+
ACCENT: "border border-transparent bg-blue-500 text-white hover:bg-blue-700",
|
|
44
|
+
POSITIVE: "border border-transparent bg-green-700 text-white hover:bg-green-900",
|
|
45
|
+
NEGATIVE: "border border-transparent bg-red-700 text-white hover:bg-red-900",
|
|
46
|
+
SECONDARY: "border border-transparent bg-gray-700 text-white hover:bg-gray-900",
|
|
47
|
+
STANDARD: "border border-transparent bg-gray-900 text-white hover:bg-gray-700"
|
|
48
|
+
}[r] : e === "OUTLINE" ? {
|
|
49
|
+
ACCENT: "border border-blue-500 text-blue-500 bg-white hover:bg-blue-100",
|
|
50
|
+
POSITIVE: "border border-green-700 text-green-700 bg-white hover:bg-green-100",
|
|
51
|
+
NEGATIVE: "border border-red-700 text-red-700 bg-white hover:bg-red-100",
|
|
52
|
+
SECONDARY: "border border-gray-700 text-gray-700 bg-white hover:bg-gray-100",
|
|
53
|
+
STANDARD: "border border-gray-900 text-gray-900 bg-white hover:bg-gray-100"
|
|
54
|
+
}[r] : e === "GHOST" ? {
|
|
55
|
+
ACCENT: "border border-transparent text-blue-500 hover:bg-blue-100",
|
|
56
|
+
POSITIVE: "border border-transparent text-green-700 hover:bg-green-100",
|
|
57
|
+
NEGATIVE: "border border-transparent text-red-700 hover:bg-red-100",
|
|
58
|
+
SECONDARY: "border border-transparent text-gray-700 hover:bg-gray-100",
|
|
59
|
+
STANDARD: "border border-transparent text-gray-900 hover:bg-gray-100"
|
|
60
|
+
}[r] : e === "LINK" ? {
|
|
61
|
+
ACCENT: "border border-transparent text-blue-500 hover:underline",
|
|
62
|
+
POSITIVE: "border border-transparent text-green-700 hover:underline",
|
|
63
|
+
NEGATIVE: "border border-transparent text-red-700 hover:underline",
|
|
64
|
+
SECONDARY: "border border-transparent text-gray-700 hover:underline",
|
|
65
|
+
STANDARD: "border border-transparent text-gray-900 hover:underline"
|
|
66
|
+
}[r] : "";
|
|
67
|
+
}, D = () => "", v = `
|
|
60
68
|
inline-flex items-center justify-center gap-1
|
|
61
69
|
font-medium transition-colors h-auto rounded-sm
|
|
62
|
-
|
|
63
|
-
${T}
|
|
70
|
+
focus:outline-none focus:ring-2 focus:ring-sky-500 focus:ring-offset-2
|
|
71
|
+
${T[d]}
|
|
72
|
+
${S}
|
|
73
|
+
${D()}
|
|
64
74
|
${I()}
|
|
65
|
-
${
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
e && !l && !o && e(x);
|
|
75
|
+
${b || o ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
76
|
+
`.replace(/\s+/g, " ").trim(), y = M(v, N), L = () => {
|
|
77
|
+
const r = x || A;
|
|
78
|
+
r && !b && !o && r(E);
|
|
70
79
|
}, s = (() => {
|
|
71
|
-
if (!
|
|
72
|
-
const
|
|
73
|
-
return n ? /* @__PURE__ */
|
|
80
|
+
if (!i) return null;
|
|
81
|
+
const r = i.split("-").map((u) => u.charAt(0).toUpperCase() + u.slice(1)).join(""), n = w[r];
|
|
82
|
+
return n ? /* @__PURE__ */ l(n, { size: {
|
|
74
83
|
SMALL: 14,
|
|
75
84
|
STANDARD: 16,
|
|
76
85
|
MEDIUM: 18,
|
|
77
86
|
LARGE: 20
|
|
78
|
-
}[
|
|
79
|
-
})(),
|
|
87
|
+
}[d], "aria-hidden": "true" }) : (console.warn(`Icon "${i}" not found in Lucide icons`), null);
|
|
88
|
+
})(), O = m();
|
|
80
89
|
return /* @__PURE__ */ R(
|
|
81
90
|
"button",
|
|
82
91
|
{
|
|
83
|
-
type:
|
|
84
|
-
onClick:
|
|
85
|
-
disabled:
|
|
86
|
-
className:
|
|
87
|
-
style:
|
|
88
|
-
"aria-label": h ||
|
|
89
|
-
title:
|
|
92
|
+
type: c ? "submit" : "button",
|
|
93
|
+
onClick: L,
|
|
94
|
+
disabled: b || o,
|
|
95
|
+
className: y,
|
|
96
|
+
style: O,
|
|
97
|
+
"aria-label": h || a,
|
|
98
|
+
title: C,
|
|
90
99
|
children: [
|
|
91
|
-
o && /* @__PURE__ */
|
|
92
|
-
!o && s &&
|
|
93
|
-
|
|
94
|
-
!o && s &&
|
|
100
|
+
o && /* @__PURE__ */ l("span", { className: "animate-spin", "aria-label": "loading", children: "⟳" }),
|
|
101
|
+
!o && s && g === "START" && s,
|
|
102
|
+
a && /* @__PURE__ */ l("span", { children: a }),
|
|
103
|
+
!o && s && g === "END" && s
|
|
95
104
|
]
|
|
96
105
|
}
|
|
97
106
|
);
|
|
98
107
|
};
|
|
99
108
|
export {
|
|
100
|
-
|
|
109
|
+
j as ButtonWidget
|
|
101
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableOfContents.d.ts","sourceRoot":"","sources":["../../src/components/TableOfContents.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableOfContents.d.ts","sourceRoot":"","sources":["../../src/components/TableOfContents.tsx"],"names":[],"mappings":"AAkIA,eAAO,MAAM,eAAe,+CA4B3B,CAAA"}
|
|
@@ -6,7 +6,7 @@ import { RichTextDisplayField as l } from "./RichText/RichTextDisplayField.js";
|
|
|
6
6
|
import { TextItem as r } from "./RichText/TextItem.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "lucide-react";
|
|
9
|
-
const
|
|
9
|
+
const a = [
|
|
10
10
|
{
|
|
11
11
|
title: "Component Library",
|
|
12
12
|
items: [
|
|
@@ -55,6 +55,11 @@ const n = [
|
|
|
55
55
|
{
|
|
56
56
|
title: "Pages",
|
|
57
57
|
items: [
|
|
58
|
+
{
|
|
59
|
+
title: "Button + TextField Alignment Test",
|
|
60
|
+
path: "/buttontextfieldtest",
|
|
61
|
+
description: "Test page for TextField and button vertical alignment"
|
|
62
|
+
},
|
|
58
63
|
{
|
|
59
64
|
title: "ESG Conference Registration",
|
|
60
65
|
path: "/esgconferenceregistration",
|
|
@@ -68,7 +73,7 @@ const n = [
|
|
|
68
73
|
]
|
|
69
74
|
}
|
|
70
75
|
], m = ({ item: e }) => {
|
|
71
|
-
const [,
|
|
76
|
+
const [, n] = c();
|
|
72
77
|
return /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t(
|
|
73
78
|
l,
|
|
74
79
|
{
|
|
@@ -79,7 +84,7 @@ const n = [
|
|
|
79
84
|
text: e.title,
|
|
80
85
|
color: "ACCENT",
|
|
81
86
|
size: "MEDIUM",
|
|
82
|
-
link: () =>
|
|
87
|
+
link: () => n(e.path),
|
|
83
88
|
linkStyle: "STANDALONE"
|
|
84
89
|
},
|
|
85
90
|
"title"
|
|
@@ -109,8 +114,8 @@ const n = [
|
|
|
109
114
|
marginBelow: "STANDARD"
|
|
110
115
|
}
|
|
111
116
|
),
|
|
112
|
-
/* @__PURE__ */ t("div", { className: "space-y-2", children: e.items.map((
|
|
113
|
-
] }),
|
|
117
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: e.items.map((n, p) => /* @__PURE__ */ t(m, { item: n }, p)) })
|
|
118
|
+
] }), x = () => /* @__PURE__ */ i("div", { className: "max-w-4xl mx-auto", children: [
|
|
114
119
|
/* @__PURE__ */ t(
|
|
115
120
|
s,
|
|
116
121
|
{
|
|
@@ -131,12 +136,12 @@ const n = [
|
|
|
131
136
|
),
|
|
132
137
|
/* @__PURE__ */ t(d, { padding: "MORE", marginBelow: "NONE", showBorder: !1, showShadow: !0, children: /* @__PURE__ */ i("div", { className: "grid gap-8 md:grid-cols-2", children: [
|
|
133
138
|
/* @__PURE__ */ i("div", { className: "space-y-8", children: [
|
|
134
|
-
/* @__PURE__ */ t(o, { group:
|
|
135
|
-
/* @__PURE__ */ t(o, { group:
|
|
139
|
+
/* @__PURE__ */ t(o, { group: a[0] }),
|
|
140
|
+
/* @__PURE__ */ t(o, { group: a[1] })
|
|
136
141
|
] }),
|
|
137
|
-
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(o, { group:
|
|
142
|
+
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(o, { group: a[2] }) })
|
|
138
143
|
] }) })
|
|
139
144
|
] });
|
|
140
145
|
export {
|
|
141
|
-
|
|
146
|
+
x as TableOfContents
|
|
142
147
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pglevy/sailwind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Appian SAIL components for React - Pre-release version under active development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,7 +44,11 @@
|
|
|
44
44
|
"preview": "vite preview",
|
|
45
45
|
"check-page": "node scripts/quick-check.cjs",
|
|
46
46
|
"check-page:full": "node scripts/full-check.cjs",
|
|
47
|
-
"prepublishOnly": "npm run build:lib"
|
|
47
|
+
"prepublishOnly": "npm run build:lib",
|
|
48
|
+
"version:patch": "npm version patch",
|
|
49
|
+
"version:minor": "npm version minor",
|
|
50
|
+
"version:major": "npm version major",
|
|
51
|
+
"release": "npm run build:lib && npm publish"
|
|
48
52
|
},
|
|
49
53
|
"peerDependencies": {
|
|
50
54
|
"react": "^18.0.0 || ^19.0.0",
|