@tonyarbor/components 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.
@@ -0,0 +1,48 @@
1
+ import * as React from 'react';
2
+
3
+ interface CheckboxProps {
4
+ /**
5
+ * The label for the checkbox
6
+ */
7
+ label?: string;
8
+ /**
9
+ * Whether the checkbox is checked
10
+ */
11
+ checked?: boolean;
12
+ /**
13
+ * Callback when checked state changes
14
+ */
15
+ onChange?: (checked: boolean) => void;
16
+ /**
17
+ * Whether the checkbox is disabled
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * Custom className
22
+ */
23
+ className?: string;
24
+ /**
25
+ * Custom style
26
+ */
27
+ style?: React.CSSProperties;
28
+ /**
29
+ * Test ID for testing
30
+ */
31
+ 'data-testid'?: string;
32
+ /**
33
+ * Name attribute for form submission
34
+ */
35
+ name?: string;
36
+ /**
37
+ * Value attribute for form submission
38
+ */
39
+ value?: string;
40
+ }
41
+ /**
42
+ * Checkbox component - Arbor Design System
43
+ *
44
+ * A checkbox input with label support.
45
+ */
46
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
47
+
48
+ export { Checkbox, type CheckboxProps };
@@ -0,0 +1,48 @@
1
+ import * as React from 'react';
2
+
3
+ interface CheckboxProps {
4
+ /**
5
+ * The label for the checkbox
6
+ */
7
+ label?: string;
8
+ /**
9
+ * Whether the checkbox is checked
10
+ */
11
+ checked?: boolean;
12
+ /**
13
+ * Callback when checked state changes
14
+ */
15
+ onChange?: (checked: boolean) => void;
16
+ /**
17
+ * Whether the checkbox is disabled
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * Custom className
22
+ */
23
+ className?: string;
24
+ /**
25
+ * Custom style
26
+ */
27
+ style?: React.CSSProperties;
28
+ /**
29
+ * Test ID for testing
30
+ */
31
+ 'data-testid'?: string;
32
+ /**
33
+ * Name attribute for form submission
34
+ */
35
+ name?: string;
36
+ /**
37
+ * Value attribute for form submission
38
+ */
39
+ value?: string;
40
+ }
41
+ /**
42
+ * Checkbox component - Arbor Design System
43
+ *
44
+ * A checkbox input with label support.
45
+ */
46
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
47
+
48
+ export { Checkbox, type CheckboxProps };
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/Checkbox/index.ts
31
+ var Checkbox_exports = {};
32
+ __export(Checkbox_exports, {
33
+ Checkbox: () => Checkbox
34
+ });
35
+ module.exports = __toCommonJS(Checkbox_exports);
36
+
37
+ // src/Checkbox/Checkbox.tsx
38
+ var React = __toESM(require("react"));
39
+ var import_clsx = require("clsx");
40
+ var import_lucide_react = require("lucide-react");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var checkboxStyles = {
43
+ width: "20px",
44
+ height: "20px",
45
+ border: "2px solid #d1d1d1",
46
+ // grey-300
47
+ borderRadius: "4px",
48
+ display: "flex",
49
+ alignItems: "center",
50
+ justifyContent: "center",
51
+ cursor: "pointer",
52
+ transition: "all 0.2s ease-in-out",
53
+ flexShrink: 0,
54
+ backgroundColor: "#ffffff"
55
+ };
56
+ var checkedStyles = {
57
+ backgroundColor: "#3cad51",
58
+ // brand-500
59
+ borderColor: "#3cad51"
60
+ };
61
+ var labelStyles = {
62
+ fontSize: "13px",
63
+ color: "#2f2f2f",
64
+ cursor: "pointer",
65
+ userSelect: "none",
66
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
67
+ };
68
+ var wrapperStyles = {
69
+ display: "flex",
70
+ alignItems: "center",
71
+ gap: "8px"
72
+ };
73
+ var Checkbox = React.forwardRef(
74
+ ({
75
+ label,
76
+ checked = false,
77
+ onChange,
78
+ disabled = false,
79
+ className,
80
+ style,
81
+ "data-testid": dataTestId,
82
+ name,
83
+ value
84
+ }, ref) => {
85
+ const [isFocused, setIsFocused] = React.useState(false);
86
+ const checkboxId = React.useId();
87
+ const handleChange = (e) => {
88
+ if (!disabled) {
89
+ onChange?.(e.target.checked);
90
+ }
91
+ };
92
+ const boxStyle = {
93
+ ...checkboxStyles,
94
+ ...checked && !disabled && checkedStyles,
95
+ ...disabled && !checked && { backgroundColor: "#f8f8f8", borderColor: "#efefef" },
96
+ ...disabled && checked && { backgroundColor: "#7e7e7e", borderColor: "#7e7e7e" },
97
+ ...isFocused && !disabled && { borderColor: "#3cad51", outline: "2px solid rgba(60, 173, 81, 0.2)" }
98
+ };
99
+ const checkmarkColor = disabled ? "#d1d1d1" : "#ffffff";
100
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
101
+ "div",
102
+ {
103
+ className: (0, import_clsx.clsx)("arbor-checkbox-wrapper", className),
104
+ style: { ...wrapperStyles, ...style },
105
+ "data-testid": dataTestId,
106
+ children: [
107
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
108
+ "input",
109
+ {
110
+ ref,
111
+ id: checkboxId,
112
+ type: "checkbox",
113
+ checked,
114
+ onChange: handleChange,
115
+ onFocus: () => setIsFocused(true),
116
+ onBlur: () => setIsFocused(false),
117
+ disabled,
118
+ name,
119
+ value,
120
+ style: {
121
+ position: "absolute",
122
+ opacity: 0,
123
+ width: 0,
124
+ height: 0
125
+ },
126
+ "aria-checked": checked
127
+ }
128
+ ),
129
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
130
+ "label",
131
+ {
132
+ htmlFor: checkboxId,
133
+ style: {
134
+ display: "flex",
135
+ alignItems: "center",
136
+ gap: "8px",
137
+ cursor: disabled ? "not-allowed" : "pointer"
138
+ },
139
+ children: [
140
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: boxStyle, children: checked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: 14, color: checkmarkColor, strokeWidth: 3 }) }),
141
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
+ "span",
143
+ {
144
+ style: {
145
+ ...labelStyles,
146
+ color: disabled ? "#7e7e7e" : "#2f2f2f",
147
+ cursor: disabled ? "not-allowed" : "pointer"
148
+ },
149
+ children: label
150
+ }
151
+ )
152
+ ]
153
+ }
154
+ )
155
+ ]
156
+ }
157
+ );
158
+ }
159
+ );
160
+ Checkbox.displayName = "Checkbox";
161
+ // Annotate the CommonJS export names for ESM import in node:
162
+ 0 && (module.exports = {
163
+ Checkbox
164
+ });
165
+ //# sourceMappingURL=Checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Checkbox/index.ts","../src/Checkbox/Checkbox.tsx"],"sourcesContent":["export { Checkbox } from './Checkbox';\nexport type { CheckboxProps } from './Checkbox';\n","import * as React from 'react';\nimport { clsx } from 'clsx';\nimport { Check } from 'lucide-react';\n\nexport interface CheckboxProps {\n /**\n * The label for the checkbox\n */\n label?: string;\n /**\n * Whether the checkbox is checked\n */\n checked?: boolean;\n /**\n * Callback when checked state changes\n */\n onChange?: (checked: boolean) => void;\n /**\n * Whether the checkbox is disabled\n */\n disabled?: boolean;\n /**\n * Custom className\n */\n className?: string;\n /**\n * Custom style\n */\n style?: React.CSSProperties;\n /**\n * Test ID for testing\n */\n 'data-testid'?: string;\n /**\n * Name attribute for form submission\n */\n name?: string;\n /**\n * Value attribute for form submission\n */\n value?: string;\n}\n\nconst checkboxStyles: React.CSSProperties = {\n width: '20px',\n height: '20px',\n border: '2px solid #d1d1d1', // grey-300\n borderRadius: '4px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n cursor: 'pointer',\n transition: 'all 0.2s ease-in-out',\n flexShrink: 0,\n backgroundColor: '#ffffff',\n};\n\nconst checkedStyles: React.CSSProperties = {\n backgroundColor: '#3cad51', // brand-500\n borderColor: '#3cad51',\n};\n\nconst labelStyles: React.CSSProperties = {\n fontSize: '13px',\n color: '#2f2f2f',\n cursor: 'pointer',\n userSelect: 'none' as const,\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n};\n\nconst wrapperStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n};\n\n/**\n * Checkbox component - Arbor Design System\n *\n * A checkbox input with label support.\n */\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n label,\n checked = false,\n onChange,\n disabled = false,\n className,\n style,\n 'data-testid': dataTestId,\n name,\n value,\n },\n ref\n ) => {\n const [isFocused, setIsFocused] = React.useState(false);\n const checkboxId = React.useId();\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!disabled) {\n onChange?.(e.target.checked);\n }\n };\n\n const boxStyle: React.CSSProperties = {\n ...checkboxStyles,\n ...(checked && !disabled && checkedStyles),\n ...(disabled && !checked && { backgroundColor: '#f8f8f8', borderColor: '#efefef' }),\n ...(disabled && checked && { backgroundColor: '#7e7e7e', borderColor: '#7e7e7e' }),\n ...(isFocused && !disabled && { borderColor: '#3cad51', outline: '2px solid rgba(60, 173, 81, 0.2)' }),\n };\n\n const checkmarkColor = disabled ? '#d1d1d1' : '#ffffff';\n\n return (\n <div\n className={clsx('arbor-checkbox-wrapper', className)}\n style={{ ...wrapperStyles, ...style }}\n data-testid={dataTestId}\n >\n <input\n ref={ref}\n id={checkboxId}\n type=\"checkbox\"\n checked={checked}\n onChange={handleChange}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n disabled={disabled}\n name={name}\n value={value}\n style={{\n position: 'absolute',\n opacity: 0,\n width: 0,\n height: 0,\n }}\n aria-checked={checked}\n />\n <label\n htmlFor={checkboxId}\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n cursor: disabled ? 'not-allowed' : 'pointer',\n }}\n >\n <div style={boxStyle}>\n {checked && (\n <Check size={14} color={checkmarkColor} strokeWidth={3} />\n )}\n </div>\n {label && (\n <span\n style={{\n ...labelStyles,\n color: disabled ? '#7e7e7e' : '#2f2f2f',\n cursor: disabled ? 'not-allowed' : 'pointer',\n }}\n >\n {label}\n </span>\n )}\n </label>\n </div>\n );\n }\n);\n\nCheckbox.displayName = 'Checkbox';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,kBAAqB;AACrB,0BAAsB;AAuHd;AA9ER,IAAM,iBAAsC;AAAA,EAC1C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA;AAAA,EACR,cAAc;AAAA,EACd,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,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M,aAAa,IAAI;AAAA,cAChC,QAAQ,MAAM,aAAa,KAAK;AAAA,cAChC;AAAA,cACA;AAAA,cACA;AAAA,cACA,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,SAAS;AAAA,gBACT,OAAO;AAAA,gBACP,QAAQ;AAAA,cACV;AAAA,cACA,gBAAc;AAAA;AAAA,UAChB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAS;AAAA,cACT,OAAO;AAAA,gBACL,SAAS;AAAA,gBACT,YAAY;AAAA,gBACZ,KAAK;AAAA,gBACL,QAAQ,WAAW,gBAAgB;AAAA,cACrC;AAAA,cAEA;AAAA,4DAAC,SAAI,OAAO,UACT,qBACC,4CAAC,6BAAM,MAAM,IAAI,OAAO,gBAAgB,aAAa,GAAG,GAE5D;AAAA,gBACC,SACC;AAAA,kBAAC;AAAA;AAAA,oBACC,OAAO;AAAA,sBACL,GAAG;AAAA,sBACH,OAAO,WAAW,YAAY;AAAA,sBAC9B,QAAQ,WAAW,gBAAgB;AAAA,oBACrC;AAAA,oBAEC;AAAA;AAAA,gBACH;AAAA;AAAA;AAAA,UAEJ;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ Checkbox
3
+ } from "./chunk-BCYJIUQX.mjs";
4
+ export {
5
+ Checkbox
6
+ };
7
+ //# sourceMappingURL=Checkbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,67 @@
1
+ import * as React from 'react';
2
+
3
+ type ComboboxOption = {
4
+ value: string;
5
+ label: string;
6
+ };
7
+ type ComboboxState = 'default' | 'error' | 'success';
8
+ interface ComboboxProps {
9
+ /**
10
+ * The label for the combobox
11
+ */
12
+ label?: string;
13
+ /**
14
+ * The placeholder text
15
+ */
16
+ placeholder?: string;
17
+ /**
18
+ * The available options
19
+ */
20
+ options: ComboboxOption[];
21
+ /**
22
+ * The selected value
23
+ */
24
+ value?: string;
25
+ /**
26
+ * Callback when value changes
27
+ */
28
+ onChange?: (value: string | undefined) => void;
29
+ /**
30
+ * The validation state
31
+ * @default 'default'
32
+ */
33
+ state?: ComboboxState;
34
+ /**
35
+ * Optional error message
36
+ */
37
+ error?: string;
38
+ /**
39
+ * Optional helper text
40
+ */
41
+ helperText?: string;
42
+ /**
43
+ * Whether the combobox is disabled
44
+ */
45
+ disabled?: boolean;
46
+ /**
47
+ * Custom className
48
+ */
49
+ className?: string;
50
+ /**
51
+ * Custom style
52
+ */
53
+ style?: React.CSSProperties;
54
+ /**
55
+ * Test ID for testing
56
+ */
57
+ 'data-testid'?: string;
58
+ }
59
+ /**
60
+ * Combobox component - Arbor Design System
61
+ *
62
+ * A searchable select/autocomplete component with filtering.
63
+ * Supports labels, validation states, and helper text.
64
+ */
65
+ declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLDivElement>>;
66
+
67
+ export { Combobox, type ComboboxOption, type ComboboxProps, type ComboboxState };
@@ -0,0 +1,67 @@
1
+ import * as React from 'react';
2
+
3
+ type ComboboxOption = {
4
+ value: string;
5
+ label: string;
6
+ };
7
+ type ComboboxState = 'default' | 'error' | 'success';
8
+ interface ComboboxProps {
9
+ /**
10
+ * The label for the combobox
11
+ */
12
+ label?: string;
13
+ /**
14
+ * The placeholder text
15
+ */
16
+ placeholder?: string;
17
+ /**
18
+ * The available options
19
+ */
20
+ options: ComboboxOption[];
21
+ /**
22
+ * The selected value
23
+ */
24
+ value?: string;
25
+ /**
26
+ * Callback when value changes
27
+ */
28
+ onChange?: (value: string | undefined) => void;
29
+ /**
30
+ * The validation state
31
+ * @default 'default'
32
+ */
33
+ state?: ComboboxState;
34
+ /**
35
+ * Optional error message
36
+ */
37
+ error?: string;
38
+ /**
39
+ * Optional helper text
40
+ */
41
+ helperText?: string;
42
+ /**
43
+ * Whether the combobox is disabled
44
+ */
45
+ disabled?: boolean;
46
+ /**
47
+ * Custom className
48
+ */
49
+ className?: string;
50
+ /**
51
+ * Custom style
52
+ */
53
+ style?: React.CSSProperties;
54
+ /**
55
+ * Test ID for testing
56
+ */
57
+ 'data-testid'?: string;
58
+ }
59
+ /**
60
+ * Combobox component - Arbor Design System
61
+ *
62
+ * A searchable select/autocomplete component with filtering.
63
+ * Supports labels, validation states, and helper text.
64
+ */
65
+ declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLDivElement>>;
66
+
67
+ export { Combobox, type ComboboxOption, type ComboboxProps, type ComboboxState };