@pglevy/sailwind 0.1.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.
Files changed (146) hide show
  1. package/README.md +219 -0
  2. package/dist/components/Button/ButtonArrayLayout.d.ts +37 -0
  3. package/dist/components/Button/ButtonArrayLayout.d.ts.map +1 -0
  4. package/dist/components/Button/ButtonArrayLayout.js +42 -0
  5. package/dist/components/Button/ButtonWidget.d.ts +75 -0
  6. package/dist/components/Button/ButtonWidget.d.ts.map +1 -0
  7. package/dist/components/Button/ButtonWidget.js +101 -0
  8. package/dist/components/Button/index.d.ts +5 -0
  9. package/dist/components/Button/index.d.ts.map +1 -0
  10. package/dist/components/Card/CardLayout.d.ts +55 -0
  11. package/dist/components/Card/CardLayout.d.ts.map +1 -0
  12. package/dist/components/Card/CardLayout.js +139 -0
  13. package/dist/components/Card/index.d.ts +3 -0
  14. package/dist/components/Card/index.d.ts.map +1 -0
  15. package/dist/components/Checkbox/CheckboxField.d.ts +65 -0
  16. package/dist/components/Checkbox/CheckboxField.d.ts.map +1 -0
  17. package/dist/components/Checkbox/CheckboxField.js +136 -0
  18. package/dist/components/Checkbox/index.d.ts +3 -0
  19. package/dist/components/Checkbox/index.d.ts.map +1 -0
  20. package/dist/components/Dialog/DialogField.d.ts +51 -0
  21. package/dist/components/Dialog/DialogField.d.ts.map +1 -0
  22. package/dist/components/Dialog/DialogField.js +113 -0
  23. package/dist/components/Dialog/index.d.ts +3 -0
  24. package/dist/components/Dialog/index.d.ts.map +1 -0
  25. package/dist/components/Dropdown/DropdownField.d.ts +87 -0
  26. package/dist/components/Dropdown/DropdownField.d.ts.map +1 -0
  27. package/dist/components/Dropdown/DropdownField.js +7 -0
  28. package/dist/components/Dropdown/DropdownFieldBase.d.ts +54 -0
  29. package/dist/components/Dropdown/DropdownFieldBase.d.ts.map +1 -0
  30. package/dist/components/Dropdown/DropdownFieldBase.js +183 -0
  31. package/dist/components/Dropdown/MultipleDropdownField.d.ts +85 -0
  32. package/dist/components/Dropdown/MultipleDropdownField.d.ts.map +1 -0
  33. package/dist/components/Dropdown/MultipleDropdownField.js +7 -0
  34. package/dist/components/Dropdown/index.d.ts +5 -0
  35. package/dist/components/Dropdown/index.d.ts.map +1 -0
  36. package/dist/components/Heading/HeadingField.d.ts +48 -0
  37. package/dist/components/Heading/HeadingField.d.ts.map +1 -0
  38. package/dist/components/Heading/HeadingField.js +103 -0
  39. package/dist/components/Heading/index.d.ts +3 -0
  40. package/dist/components/Heading/index.d.ts.map +1 -0
  41. package/dist/components/Image/DocumentImage.d.ts +20 -0
  42. package/dist/components/Image/DocumentImage.d.ts.map +1 -0
  43. package/dist/components/Image/ImageField.d.ts +42 -0
  44. package/dist/components/Image/ImageField.d.ts.map +1 -0
  45. package/dist/components/Image/ImageField.js +159 -0
  46. package/dist/components/Image/UserImage.d.ts +49 -0
  47. package/dist/components/Image/UserImage.d.ts.map +1 -0
  48. package/dist/components/Image/index.d.ts +5 -0
  49. package/dist/components/Image/index.d.ts.map +1 -0
  50. package/dist/components/MessageBanner/MessageBanner.d.ts +33 -0
  51. package/dist/components/MessageBanner/MessageBanner.d.ts.map +1 -0
  52. package/dist/components/MessageBanner/MessageBanner.js +97 -0
  53. package/dist/components/MessageBanner/index.d.ts +2 -0
  54. package/dist/components/MessageBanner/index.d.ts.map +1 -0
  55. package/dist/components/Milestone/MilestoneField.d.ts +50 -0
  56. package/dist/components/Milestone/MilestoneField.d.ts.map +1 -0
  57. package/dist/components/Milestone/MilestoneField.js +206 -0
  58. package/dist/components/Milestone/index.d.ts +3 -0
  59. package/dist/components/Milestone/index.d.ts.map +1 -0
  60. package/dist/components/ProgressBar/ProgressBar.d.ts +32 -0
  61. package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -0
  62. package/dist/components/ProgressBar/ProgressBar.js +117 -0
  63. package/dist/components/ProgressBar/index.d.ts +2 -0
  64. package/dist/components/ProgressBar/index.d.ts.map +1 -0
  65. package/dist/components/RadioButton/RadioButtonField.d.ts +63 -0
  66. package/dist/components/RadioButton/RadioButtonField.d.ts.map +1 -0
  67. package/dist/components/RadioButton/RadioButtonField.js +128 -0
  68. package/dist/components/RadioButton/index.d.ts +3 -0
  69. package/dist/components/RadioButton/index.d.ts.map +1 -0
  70. package/dist/components/RichText/Icon.d.ts +28 -0
  71. package/dist/components/RichText/Icon.d.ts.map +1 -0
  72. package/dist/components/RichText/Icon.js +94 -0
  73. package/dist/components/RichText/RichTextDisplayField.d.ts +36 -0
  74. package/dist/components/RichText/RichTextDisplayField.d.ts.map +1 -0
  75. package/dist/components/RichText/RichTextDisplayField.js +79 -0
  76. package/dist/components/RichText/TextItem.d.ts +27 -0
  77. package/dist/components/RichText/TextItem.d.ts.map +1 -0
  78. package/dist/components/RichText/TextItem.js +58 -0
  79. package/dist/components/RichText/index.d.ts +7 -0
  80. package/dist/components/RichText/index.d.ts.map +1 -0
  81. package/dist/components/Slider/SliderField.d.ts +63 -0
  82. package/dist/components/Slider/SliderField.d.ts.map +1 -0
  83. package/dist/components/Slider/SliderField.js +164 -0
  84. package/dist/components/Slider/index.d.ts +3 -0
  85. package/dist/components/Slider/index.d.ts.map +1 -0
  86. package/dist/components/Stamp/StampField.d.ts +48 -0
  87. package/dist/components/Stamp/StampField.d.ts.map +1 -0
  88. package/dist/components/Stamp/StampField.js +173 -0
  89. package/dist/components/Stamp/index.d.ts +3 -0
  90. package/dist/components/Stamp/index.d.ts.map +1 -0
  91. package/dist/components/Switch/SwitchField.d.ts +49 -0
  92. package/dist/components/Switch/SwitchField.d.ts.map +1 -0
  93. package/dist/components/Switch/SwitchField.js +106 -0
  94. package/dist/components/Switch/index.d.ts +3 -0
  95. package/dist/components/Switch/index.d.ts.map +1 -0
  96. package/dist/components/TableOfContents.d.ts +2 -0
  97. package/dist/components/TableOfContents.d.ts.map +1 -0
  98. package/dist/components/TableOfContents.js +142 -0
  99. package/dist/components/Tabs/TabsField.d.ts +50 -0
  100. package/dist/components/Tabs/TabsField.d.ts.map +1 -0
  101. package/dist/components/Tabs/TabsField.js +96 -0
  102. package/dist/components/Tabs/index.d.ts +3 -0
  103. package/dist/components/Tabs/index.d.ts.map +1 -0
  104. package/dist/components/Tag/TagField.d.ts +52 -0
  105. package/dist/components/Tag/TagField.d.ts.map +1 -0
  106. package/dist/components/Tag/TagField.js +125 -0
  107. package/dist/components/Tag/TagItem.d.ts +26 -0
  108. package/dist/components/Tag/TagItem.d.ts.map +1 -0
  109. package/dist/components/Tag/TagItem.js +4 -0
  110. package/dist/components/Tag/index.d.ts +5 -0
  111. package/dist/components/Tag/index.d.ts.map +1 -0
  112. package/dist/components/TextField/TextField.d.ts +88 -0
  113. package/dist/components/TextField/TextField.d.ts.map +1 -0
  114. package/dist/components/TextField/TextField.js +113 -0
  115. package/dist/components/TextField/index.d.ts +3 -0
  116. package/dist/components/TextField/index.d.ts.map +1 -0
  117. package/dist/components/Toggle/ToggleField.d.ts +62 -0
  118. package/dist/components/Toggle/ToggleField.d.ts.map +1 -0
  119. package/dist/components/Toggle/ToggleField.js +126 -0
  120. package/dist/components/Toggle/index.d.ts +3 -0
  121. package/dist/components/Toggle/index.d.ts.map +1 -0
  122. package/dist/components/index.d.ts +22 -0
  123. package/dist/components/index.d.ts.map +1 -0
  124. package/dist/components/shared/CollapsibleSection.d.ts +9 -0
  125. package/dist/components/shared/CollapsibleSection.d.ts.map +1 -0
  126. package/dist/components/shared/CollapsibleSection.js +39 -0
  127. package/dist/components/shared/FieldLabel.d.ts +27 -0
  128. package/dist/components/shared/FieldLabel.d.ts.map +1 -0
  129. package/dist/components/shared/FieldLabel.js +40 -0
  130. package/dist/components/shared/FieldWrapper.d.ts +35 -0
  131. package/dist/components/shared/FieldWrapper.d.ts.map +1 -0
  132. package/dist/components/shared/FieldWrapper.js +71 -0
  133. package/dist/components/shared/index.d.ts +6 -0
  134. package/dist/components/shared/index.d.ts.map +1 -0
  135. package/dist/esg_world_logo_no_year.png +0 -0
  136. package/dist/index.d.ts +11 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +58 -0
  139. package/dist/types/sail.d.ts +37 -0
  140. package/dist/types/sail.d.ts.map +1 -0
  141. package/dist/uifaces-human-avatar.jpg +0 -0
  142. package/dist/utils/classNames.d.ts +21 -0
  143. package/dist/utils/classNames.d.ts.map +1 -0
  144. package/dist/utils/classNames.js +16 -0
  145. package/dist/vite.svg +1 -0
  146. package/package.json +85 -0
@@ -0,0 +1,113 @@
1
+ import { jsxs as d, jsx as o, Fragment as $ } from "react/jsx-runtime";
2
+ import * as j from "react";
3
+ import { FieldWrapper as U } from "../shared/FieldWrapper.js";
4
+ const G = ({
5
+ label: c,
6
+ instructions: i,
7
+ required: m = !1,
8
+ readOnly: e = !1,
9
+ disabled: p = !1,
10
+ value: n = "",
11
+ validations: t = [],
12
+ saveInto: E,
13
+ onChange: x,
14
+ // refreshAfter = "UNFOCUS", // Not used in React (controlled components update immediately)
15
+ validationGroup: N,
16
+ requiredMessage: g,
17
+ align: b = "LEFT",
18
+ labelPosition: h = "ABOVE",
19
+ placeholder: R,
20
+ helpTooltip: A,
21
+ masked: C = !1,
22
+ accessibilityText: u,
23
+ showWhen: T = !0,
24
+ inputPurpose: f,
25
+ characterLimit: a,
26
+ showCharacterCount: M = !0,
27
+ marginAbove: D = "NONE",
28
+ marginBelow: S = "STANDARD"
29
+ }) => {
30
+ if (!T) return null;
31
+ const r = j.useMemo(() => `textfield-${Math.random().toString(36).substr(2, 9)}`, []), F = {
32
+ LEFT: "text-left",
33
+ CENTER: "text-center",
34
+ RIGHT: "text-right"
35
+ }, B = {
36
+ NAME: "name",
37
+ EMAIL: "email",
38
+ PHONE_NUMBER: "tel",
39
+ STREET_ADDRESS: "street-address",
40
+ POSTAL_CODE: "postal-code",
41
+ COUNTRY: "country",
42
+ CREDIT_CARD_NUMBER: "cc-number",
43
+ FIRST_NAME: "given-name",
44
+ LAST_NAME: "family-name",
45
+ DOB: "bday",
46
+ OFF: "off"
47
+ }, _ = [
48
+ "w-full",
49
+ "text-base",
50
+ F[b],
51
+ // ReadOnly mode: no border, no background, no padding (inline display)
52
+ e && "border-none bg-transparent p-0",
53
+ // Normal mode: standard input styling
54
+ !e && "px-3 py-2 border border-gray-200 rounded-sm bg-white",
55
+ !e && "focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
56
+ // Disabled state
57
+ p && "bg-gray-100 text-gray-700 cursor-not-allowed",
58
+ // Error state
59
+ t.length > 0 && "border-red-700 focus:ring-red-700"
60
+ ].filter(Boolean).join(" "), w = (l) => {
61
+ const s = x || E;
62
+ s && s(l.target.value);
63
+ }, L = () => {
64
+ }, y = t.length > 0 && n !== "", I = m && !n && g && t.length === 0, v = /* @__PURE__ */ d("div", { className: "relative", children: [
65
+ /* @__PURE__ */ o(
66
+ "input",
67
+ {
68
+ id: r,
69
+ type: C ? "password" : "text",
70
+ value: n,
71
+ onChange: w,
72
+ onBlur: L,
73
+ placeholder: e ? void 0 : R,
74
+ disabled: p,
75
+ readOnly: e,
76
+ maxLength: a,
77
+ autoComplete: f ? B[f] : void 0,
78
+ className: _,
79
+ "aria-invalid": t.length > 0,
80
+ "aria-describedby": t.length > 0 ? `${r}-error` : i ? `${r}-instructions` : void 0,
81
+ "aria-label": u || (h === "COLLAPSED" ? c : void 0),
82
+ "data-validation-group": N
83
+ }
84
+ ),
85
+ a && M && !e && /* @__PURE__ */ d("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-700 pointer-events-none", children: [
86
+ n.length,
87
+ " / ",
88
+ a
89
+ ] })
90
+ ] }), O = /* @__PURE__ */ d($, { children: [
91
+ y && /* @__PURE__ */ o("div", { id: `${r}-error`, className: "mt-2", role: "alert", children: t.map((l, s) => /* @__PURE__ */ o("p", { className: "text-sm text-red-700", children: l }, s)) }),
92
+ I && /* @__PURE__ */ o("p", { className: "text-sm text-red-700 mt-2", role: "alert", children: g })
93
+ ] });
94
+ return /* @__PURE__ */ o(
95
+ U,
96
+ {
97
+ label: c,
98
+ labelPosition: h,
99
+ required: m,
100
+ instructions: i,
101
+ helpTooltip: A,
102
+ accessibilityText: u,
103
+ inputId: r,
104
+ marginAbove: D,
105
+ marginBelow: S,
106
+ footer: O,
107
+ children: v
108
+ }
109
+ );
110
+ };
111
+ export {
112
+ G as TextField
113
+ };
@@ -0,0 +1,3 @@
1
+ export { TextField } from './TextField';
2
+ export type { TextFieldProps } from './TextField';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,62 @@
1
+ import { SAILLabelPosition, SAILMarginSize, SAILSize } from '../../types/sail';
2
+ import * as React from 'react';
3
+ type ToggleStyle = "SOLID" | "OUTLINE" | "GHOST";
4
+ /**
5
+ * Displays a toggle button for boolean input (button-style on/off)
6
+ * Inspired by SAIL form field patterns (not an official SAIL component)
7
+ *
8
+ * This is a "new SAIL" component - not available in public SAIL but follows
9
+ * the same conventions and patterns for consistency with other Sailwind components.
10
+ *
11
+ * Use ToggleField for button-style toggles (e.g., toolbar buttons, filters)
12
+ * Use SwitchField for traditional on/off switches (e.g., settings)
13
+ */
14
+ export interface ToggleFieldProps {
15
+ /** Text to display as the field label */
16
+ label?: string;
17
+ /** Text to display on the toggle button */
18
+ text?: string;
19
+ /** Supplemental text about this field */
20
+ instructions?: string;
21
+ /** Determines if a value is required to submit the form */
22
+ required?: boolean;
23
+ /** Determines if the field should display as grayed out */
24
+ disabled?: boolean;
25
+ /** Current pressed state (true = pressed, false = unpressed) */
26
+ value?: boolean;
27
+ /** Validation errors to display below the field */
28
+ validations?: string[];
29
+ /** Callback when the user toggles the button */
30
+ saveInto?: (value: boolean) => void;
31
+ /** Callback when the user toggles the button (React-style alias for saveInto) */
32
+ onChange?: (value: boolean) => void;
33
+ /** Validation group name (no spaces) */
34
+ validationGroup?: string;
35
+ /** Custom message when field is required and not provided */
36
+ requiredMessage?: string;
37
+ /** Determines where the label appears */
38
+ labelPosition?: SAILLabelPosition;
39
+ /** Displays a help icon with tooltip text */
40
+ helpTooltip?: string;
41
+ /** Additional text for screen readers */
42
+ accessibilityText?: string;
43
+ /** Determines whether component is displayed */
44
+ showWhen?: boolean;
45
+ /** Space added above component */
46
+ marginAbove?: SAILMarginSize;
47
+ /** Space added below component */
48
+ marginBelow?: SAILMarginSize;
49
+ /** Size of the toggle button */
50
+ size?: SAILSize;
51
+ /** Color when toggle is pressed (hex or semantic) */
52
+ color?: "ACCENT" | "POSITIVE" | "NEGATIVE" | "SECONDARY" | string;
53
+ /** Determines the button's appearance */
54
+ style?: ToggleStyle;
55
+ /** Icon to display in the button */
56
+ icon?: string;
57
+ /** Position of icon relative to text */
58
+ iconPosition?: "START" | "END";
59
+ }
60
+ export declare const ToggleField: React.FC<ToggleFieldProps>;
61
+ export {};
62
+ //# sourceMappingURL=ToggleField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToggleField.d.ts","sourceRoot":"","sources":["../../../src/components/Toggle/ToggleField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEnF,KAAK,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAEhD;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,wCAAwC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yCAAyC;IACzC,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kCAAkC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,kCAAkC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,gCAAgC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAA;IACjE,yCAAyC;IACzC,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CAC/B;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwMlD,CAAA"}
@@ -0,0 +1,126 @@
1
+ import { jsxs as I, jsx as t, Fragment as H } from "react/jsx-runtime";
2
+ import * as N from "react";
3
+ import * as _ from "@radix-ui/react-toggle";
4
+ import * as a from "lucide-react";
5
+ import { FieldWrapper as $ } from "../shared/FieldWrapper.js";
6
+ const J = ({
7
+ label: l,
8
+ text: d,
9
+ instructions: h,
10
+ required: c = !1,
11
+ disabled: b = !1,
12
+ value: p = !1,
13
+ validations: u = [],
14
+ saveInto: S,
15
+ onChange: v,
16
+ validationGroup: z,
17
+ requiredMessage: m,
18
+ labelPosition: w = "ABOVE",
19
+ helpTooltip: O,
20
+ accessibilityText: A,
21
+ showWhen: y = !0,
22
+ marginAbove: D = "NONE",
23
+ marginBelow: L = "STANDARD",
24
+ size: G = "STANDARD",
25
+ color: E = "ACCENT",
26
+ style: n = "OUTLINE",
27
+ icon: s,
28
+ iconPosition: x = "START"
29
+ }) => {
30
+ if (!y) return null;
31
+ const o = `togglefield-${Math.random().toString(36).substr(2, 9)}`, U = {
32
+ SMALL: "px-3 py-1.5 text-sm",
33
+ STANDARD: "px-4 py-2.5 text-base",
34
+ MEDIUM: "px-6 py-3 text-lg",
35
+ LARGE: "px-8 py-4 text-xl"
36
+ }, M = () => {
37
+ if (E.startsWith("#"))
38
+ return "border-2";
39
+ const e = E;
40
+ return n === "SOLID" ? {
41
+ ACCENT: "border-2 border-blue-500 bg-white text-blue-500 data-[state=on]:bg-blue-500 data-[state=on]:text-white data-[state=on]:border-blue-500 hover:bg-blue-50 data-[state=on]:hover:bg-blue-700",
42
+ POSITIVE: "border-2 border-green-700 bg-white text-green-700 data-[state=on]:bg-green-700 data-[state=on]:text-white data-[state=on]:border-green-700 hover:bg-green-50 data-[state=on]:hover:bg-green-900",
43
+ NEGATIVE: "border-2 border-red-700 bg-white text-red-700 data-[state=on]:bg-red-700 data-[state=on]:text-white data-[state=on]:border-red-700 hover:bg-red-50 data-[state=on]:hover:bg-red-900",
44
+ SECONDARY: "border-2 border-gray-700 bg-white text-gray-700 data-[state=on]:bg-gray-700 data-[state=on]:text-white data-[state=on]:border-gray-700 hover:bg-gray-50 data-[state=on]:hover:bg-gray-900"
45
+ }[e] : n === "OUTLINE" ? {
46
+ ACCENT: "border-2 border-blue-500 text-blue-500 bg-white data-[state=on]:bg-blue-100 hover:bg-blue-50",
47
+ POSITIVE: "border-2 border-green-700 text-green-700 bg-white data-[state=on]:bg-green-100 hover:bg-green-50",
48
+ NEGATIVE: "border-2 border-red-700 text-red-700 bg-white data-[state=on]:bg-red-100 hover:bg-red-50",
49
+ SECONDARY: "border-2 border-gray-700 text-gray-700 bg-white data-[state=on]:bg-gray-100 hover:bg-gray-50"
50
+ }[e] : n === "GHOST" ? {
51
+ ACCENT: "border-2 border-transparent text-blue-500 bg-transparent data-[state=on]:bg-blue-100 hover:bg-blue-50",
52
+ POSITIVE: "border-2 border-transparent text-green-700 bg-transparent data-[state=on]:bg-green-100 hover:bg-green-50",
53
+ NEGATIVE: "border-2 border-transparent text-red-700 bg-transparent data-[state=on]:bg-red-100 hover:bg-red-50",
54
+ SECONDARY: "border-2 border-transparent text-gray-700 bg-transparent data-[state=on]:bg-gray-100 hover:bg-gray-50"
55
+ }[e] : "";
56
+ }, V = (e) => {
57
+ const r = v || S;
58
+ r && !b && r(e);
59
+ }, C = (e) => {
60
+ const T = ((j) => j.split("-").map((f) => f.charAt(0).toUpperCase() + f.slice(1)).join(""))(e);
61
+ if (T in a)
62
+ return a[T];
63
+ const R = e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
64
+ if (R in a)
65
+ return a[R];
66
+ const i = {
67
+ STAR: "Star",
68
+ HOME: "Home",
69
+ USER: "User",
70
+ SETTINGS: "Settings",
71
+ SEARCH: "Search",
72
+ FILTER: "Filter",
73
+ ARROW_RIGHT: "ArrowRight",
74
+ ARROW_LEFT: "ArrowLeft",
75
+ ARROW_UP: "ArrowUp",
76
+ ARROW_DOWN: "ArrowDown"
77
+ }[e];
78
+ return i && i in a ? a[i] : a.Circle;
79
+ }, g = u.length > 0, W = c && !p && m, F = /* @__PURE__ */ I(
80
+ _.Root,
81
+ {
82
+ id: o,
83
+ pressed: p,
84
+ onPressedChange: V,
85
+ disabled: b,
86
+ className: [
87
+ "inline-flex items-center justify-center gap-2",
88
+ "font-medium transition-colors rounded-sm",
89
+ U[G],
90
+ M(),
91
+ b ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
92
+ ].filter(Boolean).join(" "),
93
+ "aria-label": A || d || l,
94
+ "aria-describedby": h ? `${o}-instructions` : void 0,
95
+ "aria-invalid": g,
96
+ "aria-errormessage": g ? `${o}-error` : void 0,
97
+ children: [
98
+ s && x === "START" && /* @__PURE__ */ t("span", { "aria-hidden": "true", children: N.createElement(C(s), { size: 16 }) }),
99
+ d && /* @__PURE__ */ t("span", { children: d }),
100
+ s && x === "END" && /* @__PURE__ */ t("span", { "aria-hidden": "true", children: N.createElement(C(s), { size: 16 }) })
101
+ ]
102
+ }
103
+ ), P = /* @__PURE__ */ I(H, { children: [
104
+ g && /* @__PURE__ */ t("div", { id: `${o}-error`, className: "mt-2", role: "alert", children: u.map((e, r) => /* @__PURE__ */ t("p", { className: "text-sm text-red-700", children: e }, r)) }),
105
+ W && /* @__PURE__ */ t("p", { className: "text-sm text-red-700 mt-2", role: "alert", children: m })
106
+ ] });
107
+ return /* @__PURE__ */ t(
108
+ $,
109
+ {
110
+ label: l,
111
+ labelPosition: w,
112
+ required: c,
113
+ instructions: h,
114
+ helpTooltip: O,
115
+ accessibilityText: A,
116
+ inputId: o,
117
+ marginAbove: D,
118
+ marginBelow: L,
119
+ footer: P,
120
+ children: F
121
+ }
122
+ );
123
+ };
124
+ export {
125
+ J as ToggleField
126
+ };
@@ -0,0 +1,3 @@
1
+ export { ToggleField } from './ToggleField';
2
+ export type { ToggleFieldProps } from './ToggleField';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,22 @@
1
+ export * from './shared';
2
+ export * from './Tag';
3
+ export * from './Button';
4
+ export * from './Card';
5
+ export * from './Heading';
6
+ export * from './MessageBanner';
7
+ export * from './Milestone';
8
+ export * from './ProgressBar';
9
+ export * from './RichText';
10
+ export * from './Stamp';
11
+ export * from './TextField';
12
+ export * from './Checkbox';
13
+ export * from './RadioButton';
14
+ export * from './Dropdown';
15
+ export * from './Switch';
16
+ export * from './Toggle';
17
+ export * from './Slider';
18
+ export * from './Tabs';
19
+ export * from './Image';
20
+ export * from './Dialog';
21
+ export { TableOfContents } from './TableOfContents';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAA;AAGxB,cAAc,OAAO,CAAA;AAGrB,cAAc,UAAU,CAAA;AAGxB,cAAc,QAAQ,CAAA;AAGtB,cAAc,WAAW,CAAA;AAGzB,cAAc,iBAAiB,CAAA;AAG/B,cAAc,aAAa,CAAA;AAG3B,cAAc,eAAe,CAAA;AAG7B,cAAc,YAAY,CAAA;AAG1B,cAAc,SAAS,CAAA;AAGvB,cAAc,aAAa,CAAA;AAG3B,cAAc,YAAY,CAAA;AAG1B,cAAc,eAAe,CAAA;AAG7B,cAAc,YAAY,CAAA;AAG1B,cAAc,UAAU,CAAA;AAGxB,cAAc,UAAU,CAAA;AAGxB,cAAc,UAAU,CAAA;AAGxB,cAAc,QAAQ,CAAA;AAGtB,cAAc,SAAS,CAAA;AAGvB,cAAc,UAAU,CAAA;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ interface CollapsibleSectionProps {
3
+ title: string;
4
+ children: ReactNode;
5
+ defaultOpen?: boolean;
6
+ }
7
+ export declare const CollapsibleSection: React.FC<CollapsibleSectionProps>;
8
+ export {};
9
+ //# sourceMappingURL=CollapsibleSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollapsibleSection.d.ts","sourceRoot":"","sources":["../../../src/components/shared/CollapsibleSection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,UAAU,uBAAuB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAkChE,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
+ import { useState as a } from "react";
3
+ const c = ({
4
+ title: o,
5
+ children: s,
6
+ defaultOpen: n = !1
7
+ }) => {
8
+ const [e, i] = a(n);
9
+ return /* @__PURE__ */ t("div", { className: "mb-4 border-2 border-gray-200 rounded-sm overflow-hidden", children: [
10
+ /* @__PURE__ */ t(
11
+ "button",
12
+ {
13
+ onClick: () => i(!e),
14
+ className: "w-full flex items-center justify-between p-4 bg-white hover:bg-gray-50 transition-colors",
15
+ "aria-expanded": e,
16
+ children: [
17
+ /* @__PURE__ */ r("h2", { className: "text-xl font-semibold text-gray-900", children: o }),
18
+ /* @__PURE__ */ r(
19
+ "svg",
20
+ {
21
+ className: `w-6 h-6 text-gray-600 transition-transform ${e ? "rotate-180" : ""}`,
22
+ fill: "none",
23
+ strokeLinecap: "round",
24
+ strokeLinejoin: "round",
25
+ strokeWidth: "2",
26
+ viewBox: "0 0 24 24",
27
+ stroke: "currentColor",
28
+ children: /* @__PURE__ */ r("path", { d: "M19 9l-7 7-7-7" })
29
+ }
30
+ )
31
+ ]
32
+ }
33
+ ),
34
+ e && /* @__PURE__ */ r("div", { className: "p-6 bg-white border-t-2 border-gray-200", children: s })
35
+ ] });
36
+ };
37
+ export {
38
+ c as CollapsibleSection
39
+ };
@@ -0,0 +1,27 @@
1
+ import { SAILLabelPosition } from '../../types/sail';
2
+ import * as React from 'react';
3
+ export interface FieldLabelProps {
4
+ /** The label text to display */
5
+ label?: string;
6
+ /** Position of the label relative to the field */
7
+ labelPosition?: SAILLabelPosition;
8
+ /** Whether the field is required (shows asterisk) */
9
+ required?: boolean;
10
+ /** Helper text displayed below the input (not rendered by FieldLabel) */
11
+ instructions?: string;
12
+ /** Tooltip text for additional help */
13
+ helpTooltip?: string;
14
+ /** HTML for attribute to associate label with input */
15
+ htmlFor?: string;
16
+ /** Screen reader text when label is collapsed */
17
+ accessibilityText?: string;
18
+ }
19
+ /**
20
+ * Shared label component used across SAIL form fields
21
+ * Handles all label positioning modes: ABOVE, ADJACENT, COLLAPSED, JUSTIFIED
22
+ *
23
+ * Note: Instructions are NOT rendered by this component.
24
+ * They should be rendered by the parent component BELOW the input field.
25
+ */
26
+ export declare const FieldLabel: React.FC<FieldLabelProps>;
27
+ //# sourceMappingURL=FieldLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldLabel.d.ts","sourceRoot":"","sources":["../../../src/components/shared/FieldLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEzD,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwChD,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { jsx as a, jsxs as c } from "react/jsx-runtime";
2
+ import "react";
3
+ const f = ({
4
+ label: r,
5
+ labelPosition: e = "ABOVE",
6
+ required: m = !1,
7
+ helpTooltip: l,
8
+ htmlFor: n,
9
+ accessibilityText: s
10
+ }) => {
11
+ if (!r && !s) return null;
12
+ if (e === "COLLAPSED")
13
+ return /* @__PURE__ */ a("span", { className: "sr-only", children: r || s });
14
+ const t = [
15
+ "text-base",
16
+ "font-medium",
17
+ "text-gray-900",
18
+ e === "ABOVE" && "block mb-2",
19
+ e === "ADJACENT" && "mr-4",
20
+ // No inline-block needed, parent handles flex
21
+ e === "JUSTIFIED" && "block mb-2"
22
+ // Similar to ABOVE for now
23
+ ].filter(Boolean).join(" ");
24
+ return /* @__PURE__ */ c("label", { htmlFor: n, className: t, children: [
25
+ r,
26
+ m && /* @__PURE__ */ a("span", { className: "text-red-700 ml-1", "aria-label": "required", children: "*" }),
27
+ l && /* @__PURE__ */ a(
28
+ "span",
29
+ {
30
+ className: "ml-2 text-gray-700 cursor-help",
31
+ title: l,
32
+ "aria-label": "help",
33
+ children: "ℹ️"
34
+ }
35
+ )
36
+ ] });
37
+ };
38
+ export {
39
+ f as FieldLabel
40
+ };
@@ -0,0 +1,35 @@
1
+ import { SAILLabelPosition, SAILMarginSize } from '../../types/sail';
2
+ import * as React from 'react';
3
+ export interface FieldWrapperProps {
4
+ /** The label text to display */
5
+ label?: string;
6
+ /** Position of the label relative to the field */
7
+ labelPosition?: SAILLabelPosition;
8
+ /** Whether the field is required (shows asterisk) */
9
+ required?: boolean;
10
+ /** Helper text displayed below the input */
11
+ instructions?: string;
12
+ /** Tooltip text for additional help */
13
+ helpTooltip?: string;
14
+ /** Screen reader text when label is collapsed */
15
+ accessibilityText?: string;
16
+ /** HTML ID for the input element (for label association) */
17
+ inputId: string;
18
+ /** Determines how much space is added above the component */
19
+ marginAbove?: SAILMarginSize;
20
+ /** Determines how much space is added below the component */
21
+ marginBelow?: SAILMarginSize;
22
+ /** The input/control element to render */
23
+ children: React.ReactNode;
24
+ /** Optional additional content below instructions (validation errors, etc.) */
25
+ footer?: React.ReactNode;
26
+ }
27
+ /**
28
+ * Shared wrapper component for all SAIL form fields
29
+ * Handles consistent layout for: label + input + instructions + validation
30
+ *
31
+ * This component is used internally by TextField, CheckboxField, DropdownField, etc.
32
+ * End users never see this - they just use the individual field components.
33
+ */
34
+ export declare const FieldWrapper: React.FC<FieldWrapperProps>;
35
+ //# sourceMappingURL=FieldWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/shared/FieldWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEzE,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,6DAA6D;IAC7D,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,0CAA0C;IAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACzB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8FpD,CAAA"}
@@ -0,0 +1,71 @@
1
+ import { jsxs as t, jsx as m } from "react/jsx-runtime";
2
+ import "react";
3
+ import { FieldLabel as A } from "./FieldLabel.js";
4
+ const f = ({
5
+ label: E,
6
+ labelPosition: r = "ABOVE",
7
+ required: s = !1,
8
+ instructions: e,
9
+ helpTooltip: N,
10
+ accessibilityText: c,
11
+ inputId: a,
12
+ marginAbove: o = "NONE",
13
+ marginBelow: d = "STANDARD",
14
+ children: l,
15
+ footer: S
16
+ }) => {
17
+ const i = {
18
+ NONE: "mt-0",
19
+ EVEN_LESS: "mt-1",
20
+ LESS: "mt-2",
21
+ STANDARD: "mt-4",
22
+ MORE: "mt-6",
23
+ EVEN_MORE: "mt-8"
24
+ }, x = {
25
+ NONE: "mb-0",
26
+ EVEN_LESS: "mb-1",
27
+ LESS: "mb-2",
28
+ STANDARD: "mb-4",
29
+ MORE: "mb-6",
30
+ EVEN_MORE: "mb-8"
31
+ }, n = [
32
+ i[o],
33
+ x[d]
34
+ ].filter(Boolean).join(" ");
35
+ return r === "ADJACENT" ? /* @__PURE__ */ t("div", { className: n, children: [
36
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-4", children: [
37
+ /* @__PURE__ */ m(
38
+ A,
39
+ {
40
+ label: E,
41
+ labelPosition: r,
42
+ required: s,
43
+ helpTooltip: N,
44
+ htmlFor: a,
45
+ accessibilityText: c
46
+ }
47
+ ),
48
+ /* @__PURE__ */ m("div", { className: "flex-1", children: l })
49
+ ] }),
50
+ e && /* @__PURE__ */ m("p", { id: `${a}-instructions`, className: "text-gray-700 text-sm mt-1", children: e }),
51
+ S
52
+ ] }) : /* @__PURE__ */ t("div", { className: n, children: [
53
+ /* @__PURE__ */ m(
54
+ A,
55
+ {
56
+ label: E,
57
+ labelPosition: r,
58
+ required: s,
59
+ helpTooltip: N,
60
+ htmlFor: a,
61
+ accessibilityText: c
62
+ }
63
+ ),
64
+ l,
65
+ e && /* @__PURE__ */ m("p", { id: `${a}-instructions`, className: "text-gray-700 text-sm mt-1", children: e }),
66
+ S
67
+ ] });
68
+ };
69
+ export {
70
+ f as FieldWrapper
71
+ };
@@ -0,0 +1,6 @@
1
+ export { FieldLabel } from './FieldLabel';
2
+ export type { FieldLabelProps } from './FieldLabel';
3
+ export { FieldWrapper } from './FieldWrapper';
4
+ export type { FieldWrapperProps } from './FieldWrapper';
5
+ export { CollapsibleSection } from './CollapsibleSection';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA"}
Binary file
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Sailwind - Appian SAIL components for React
3
+ *
4
+ * A component library that brings Appian SAIL interface patterns to React,
5
+ * enabling rapid prototyping of Appian-style interfaces.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export * from './components';
10
+ export * from './types/sail';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,cAAc,CAAA;AAG5B,cAAc,cAAc,CAAA"}