ksm-ai-ui-lib 0.0.0-stage → 1.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/index.js ADDED
@@ -0,0 +1,256 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ Button: () => Button,
33
+ Card: () => Card
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/components/Button/Button.jsx
38
+ var import_react = __toESM(require("react"));
39
+ var SIZES = {
40
+ sm: { padding: "6px 12px", fontSize: 13 },
41
+ md: { padding: "10px 18px", fontSize: 15 },
42
+ lg: { padding: "14px 26px", fontSize: 17 }
43
+ };
44
+ var Button = ({
45
+ text = "Click me",
46
+ variant = "solid",
47
+ // "solid" | "outline" | "ghost"
48
+ size = "md",
49
+ color = "#2563eb",
50
+ hoverColor = "#1d4ed8",
51
+ textColor = "#ffffff",
52
+ borderRadius = 8,
53
+ fullWidth = false,
54
+ disabled = false,
55
+ loading = false,
56
+ loadingText = "Loading...",
57
+ leftIcon = null,
58
+ rightIcon = null,
59
+ type = "button",
60
+ onClick = () => {
61
+ }
62
+ }) => {
63
+ const [hovered, setHovered] = (0, import_react.useState)(false);
64
+ const [pressed, setPressed] = (0, import_react.useState)(false);
65
+ const [focused, setFocused] = (0, import_react.useState)(false);
66
+ const s = SIZES[size] || SIZES.md;
67
+ const isInactive = disabled || loading;
68
+ const activeColor = hovered && !isInactive ? hoverColor : color;
69
+ const variantStyles = {
70
+ solid: {
71
+ background: activeColor,
72
+ color: textColor,
73
+ border: `1px solid ${activeColor}`
74
+ },
75
+ outline: {
76
+ background: hovered && !isInactive ? `${color}14` : "transparent",
77
+ color: activeColor,
78
+ border: `1px solid ${activeColor}`
79
+ },
80
+ ghost: {
81
+ background: hovered && !isInactive ? `${color}14` : "transparent",
82
+ color: activeColor,
83
+ border: "1px solid transparent"
84
+ }
85
+ };
86
+ const styles = {
87
+ button: {
88
+ display: fullWidth ? "flex" : "inline-flex",
89
+ width: fullWidth ? "100%" : "auto",
90
+ alignItems: "center",
91
+ justifyContent: "center",
92
+ gap: 8,
93
+ boxSizing: "border-box",
94
+ padding: s.padding,
95
+ fontSize: s.fontSize,
96
+ fontWeight: 500,
97
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
98
+ lineHeight: 1.2,
99
+ borderRadius,
100
+ cursor: isInactive ? "not-allowed" : "pointer",
101
+ opacity: isInactive ? 0.6 : 1,
102
+ transform: pressed && !isInactive ? "scale(0.97)" : "scale(1)",
103
+ outline: focused ? `2px solid ${color}` : "none",
104
+ outlineOffset: 2,
105
+ transition: "background 0.15s ease, color 0.15s ease, transform 0.1s ease, opacity 0.15s ease",
106
+ ...variantStyles[variant]
107
+ }
108
+ };
109
+ return /* @__PURE__ */ import_react.default.createElement(
110
+ "button",
111
+ {
112
+ type,
113
+ style: styles.button,
114
+ disabled: isInactive,
115
+ "aria-busy": loading,
116
+ onClick,
117
+ onMouseEnter: () => setHovered(true),
118
+ onMouseLeave: () => {
119
+ setHovered(false);
120
+ setPressed(false);
121
+ },
122
+ onMouseDown: () => setPressed(true),
123
+ onMouseUp: () => setPressed(false),
124
+ onFocus: () => setFocused(true),
125
+ onBlur: () => setFocused(false)
126
+ },
127
+ !loading && leftIcon,
128
+ /* @__PURE__ */ import_react.default.createElement("span", null, loading ? loadingText : text),
129
+ !loading && rightIcon
130
+ );
131
+ };
132
+
133
+ // src/components/Card/Card.jsx
134
+ var import_react2 = __toESM(require("react"));
135
+ var SIZES2 = {
136
+ sm: { width: 260, padding: 14, title: 16, text: 13 },
137
+ md: { width: 340, padding: 20, title: 20, text: 14 },
138
+ lg: { width: 440, padding: 28, title: 24, text: 16 }
139
+ };
140
+ var Card = ({
141
+ title = "Card title",
142
+ description = "A short description that explains what this card is about.",
143
+ image = "",
144
+ imageAlt = "",
145
+ footer = "",
146
+ buttonText = "Learn more",
147
+ expandedText = "",
148
+ size = "md",
149
+ bgColor = "#ffffff",
150
+ textColor = "#1f2937",
151
+ mutedColor = "#6b7280",
152
+ accentColor = "#2563eb",
153
+ borderColor = "#e5e7eb",
154
+ borderRadius = 12,
155
+ hoverLift = true,
156
+ onClick = () => {
157
+ }
158
+ }) => {
159
+ const [hovered, setHovered] = (0, import_react2.useState)(false);
160
+ const [expanded, setExpanded] = (0, import_react2.useState)(false);
161
+ const s = SIZES2[size] || SIZES2.md;
162
+ const styles = {
163
+ card: {
164
+ width: "100%",
165
+ maxWidth: s.width,
166
+ boxSizing: "border-box",
167
+ background: bgColor,
168
+ color: textColor,
169
+ border: `1px solid ${borderColor}`,
170
+ borderRadius,
171
+ overflow: "hidden",
172
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
173
+ boxShadow: hovered ? "0 10px 24px rgba(0, 0, 0, 0.12)" : "0 1px 3px rgba(0, 0, 0, 0.08)",
174
+ transform: hovered && hoverLift ? "translateY(-4px)" : "translateY(0)",
175
+ transition: "transform 0.2s ease, box-shadow 0.2s ease",
176
+ cursor: "default"
177
+ },
178
+ image: {
179
+ display: "block",
180
+ width: "100%",
181
+ height: "auto",
182
+ maxHeight: 200,
183
+ objectFit: "cover"
184
+ },
185
+ body: { padding: s.padding },
186
+ title: { margin: 0, fontSize: s.title, fontWeight: 600, lineHeight: 1.3 },
187
+ description: {
188
+ margin: "8px 0 0",
189
+ fontSize: s.text,
190
+ lineHeight: 1.6,
191
+ color: mutedColor
192
+ },
193
+ expanded: {
194
+ margin: "10px 0 0",
195
+ fontSize: s.text,
196
+ lineHeight: 1.6,
197
+ color: textColor
198
+ },
199
+ actions: {
200
+ display: "flex",
201
+ alignItems: "center",
202
+ gap: 10,
203
+ marginTop: 16,
204
+ flexWrap: "wrap"
205
+ },
206
+ primaryBtn: {
207
+ padding: "8px 16px",
208
+ fontSize: s.text,
209
+ fontWeight: 500,
210
+ color: "#ffffff",
211
+ background: accentColor,
212
+ border: "none",
213
+ borderRadius: Math.max(borderRadius - 4, 4),
214
+ cursor: "pointer"
215
+ },
216
+ toggleBtn: {
217
+ padding: "8px 4px",
218
+ fontSize: s.text,
219
+ color: accentColor,
220
+ background: "transparent",
221
+ border: "none",
222
+ cursor: "pointer"
223
+ },
224
+ footer: {
225
+ padding: `${s.padding * 0.6}px ${s.padding}px`,
226
+ fontSize: s.text - 1,
227
+ color: mutedColor,
228
+ borderTop: `1px solid ${borderColor}`
229
+ }
230
+ };
231
+ return /* @__PURE__ */ import_react2.default.createElement(
232
+ "div",
233
+ {
234
+ style: styles.card,
235
+ onMouseEnter: () => setHovered(true),
236
+ onMouseLeave: () => setHovered(false)
237
+ },
238
+ image && /* @__PURE__ */ import_react2.default.createElement("img", { src: image, alt: imageAlt || title, style: styles.image }),
239
+ /* @__PURE__ */ import_react2.default.createElement("div", { style: styles.body }, /* @__PURE__ */ import_react2.default.createElement("h3", { style: styles.title }, title), /* @__PURE__ */ import_react2.default.createElement("p", { style: styles.description }, description), expandedText && expanded && /* @__PURE__ */ import_react2.default.createElement("p", { style: styles.expanded }, expandedText), /* @__PURE__ */ import_react2.default.createElement("div", { style: styles.actions }, buttonText && /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", style: styles.primaryBtn, onClick }, buttonText), expandedText && /* @__PURE__ */ import_react2.default.createElement(
240
+ "button",
241
+ {
242
+ type: "button",
243
+ style: styles.toggleBtn,
244
+ "aria-expanded": expanded,
245
+ onClick: () => setExpanded((prev) => !prev)
246
+ },
247
+ expanded ? "Show less" : "Show more"
248
+ ))),
249
+ footer && /* @__PURE__ */ import_react2.default.createElement("div", { style: styles.footer }, footer)
250
+ );
251
+ };
252
+ // Annotate the CommonJS export names for ESM import in node:
253
+ 0 && (module.exports = {
254
+ Button,
255
+ Card
256
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,219 @@
1
+ // src/components/Button/Button.jsx
2
+ import React, { useState } from "react";
3
+ var SIZES = {
4
+ sm: { padding: "6px 12px", fontSize: 13 },
5
+ md: { padding: "10px 18px", fontSize: 15 },
6
+ lg: { padding: "14px 26px", fontSize: 17 }
7
+ };
8
+ var Button = ({
9
+ text = "Click me",
10
+ variant = "solid",
11
+ // "solid" | "outline" | "ghost"
12
+ size = "md",
13
+ color = "#2563eb",
14
+ hoverColor = "#1d4ed8",
15
+ textColor = "#ffffff",
16
+ borderRadius = 8,
17
+ fullWidth = false,
18
+ disabled = false,
19
+ loading = false,
20
+ loadingText = "Loading...",
21
+ leftIcon = null,
22
+ rightIcon = null,
23
+ type = "button",
24
+ onClick = () => {
25
+ }
26
+ }) => {
27
+ const [hovered, setHovered] = useState(false);
28
+ const [pressed, setPressed] = useState(false);
29
+ const [focused, setFocused] = useState(false);
30
+ const s = SIZES[size] || SIZES.md;
31
+ const isInactive = disabled || loading;
32
+ const activeColor = hovered && !isInactive ? hoverColor : color;
33
+ const variantStyles = {
34
+ solid: {
35
+ background: activeColor,
36
+ color: textColor,
37
+ border: `1px solid ${activeColor}`
38
+ },
39
+ outline: {
40
+ background: hovered && !isInactive ? `${color}14` : "transparent",
41
+ color: activeColor,
42
+ border: `1px solid ${activeColor}`
43
+ },
44
+ ghost: {
45
+ background: hovered && !isInactive ? `${color}14` : "transparent",
46
+ color: activeColor,
47
+ border: "1px solid transparent"
48
+ }
49
+ };
50
+ const styles = {
51
+ button: {
52
+ display: fullWidth ? "flex" : "inline-flex",
53
+ width: fullWidth ? "100%" : "auto",
54
+ alignItems: "center",
55
+ justifyContent: "center",
56
+ gap: 8,
57
+ boxSizing: "border-box",
58
+ padding: s.padding,
59
+ fontSize: s.fontSize,
60
+ fontWeight: 500,
61
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
62
+ lineHeight: 1.2,
63
+ borderRadius,
64
+ cursor: isInactive ? "not-allowed" : "pointer",
65
+ opacity: isInactive ? 0.6 : 1,
66
+ transform: pressed && !isInactive ? "scale(0.97)" : "scale(1)",
67
+ outline: focused ? `2px solid ${color}` : "none",
68
+ outlineOffset: 2,
69
+ transition: "background 0.15s ease, color 0.15s ease, transform 0.1s ease, opacity 0.15s ease",
70
+ ...variantStyles[variant]
71
+ }
72
+ };
73
+ return /* @__PURE__ */ React.createElement(
74
+ "button",
75
+ {
76
+ type,
77
+ style: styles.button,
78
+ disabled: isInactive,
79
+ "aria-busy": loading,
80
+ onClick,
81
+ onMouseEnter: () => setHovered(true),
82
+ onMouseLeave: () => {
83
+ setHovered(false);
84
+ setPressed(false);
85
+ },
86
+ onMouseDown: () => setPressed(true),
87
+ onMouseUp: () => setPressed(false),
88
+ onFocus: () => setFocused(true),
89
+ onBlur: () => setFocused(false)
90
+ },
91
+ !loading && leftIcon,
92
+ /* @__PURE__ */ React.createElement("span", null, loading ? loadingText : text),
93
+ !loading && rightIcon
94
+ );
95
+ };
96
+
97
+ // src/components/Card/Card.jsx
98
+ import React2, { useState as useState2 } from "react";
99
+ var SIZES2 = {
100
+ sm: { width: 260, padding: 14, title: 16, text: 13 },
101
+ md: { width: 340, padding: 20, title: 20, text: 14 },
102
+ lg: { width: 440, padding: 28, title: 24, text: 16 }
103
+ };
104
+ var Card = ({
105
+ title = "Card title",
106
+ description = "A short description that explains what this card is about.",
107
+ image = "",
108
+ imageAlt = "",
109
+ footer = "",
110
+ buttonText = "Learn more",
111
+ expandedText = "",
112
+ size = "md",
113
+ bgColor = "#ffffff",
114
+ textColor = "#1f2937",
115
+ mutedColor = "#6b7280",
116
+ accentColor = "#2563eb",
117
+ borderColor = "#e5e7eb",
118
+ borderRadius = 12,
119
+ hoverLift = true,
120
+ onClick = () => {
121
+ }
122
+ }) => {
123
+ const [hovered, setHovered] = useState2(false);
124
+ const [expanded, setExpanded] = useState2(false);
125
+ const s = SIZES2[size] || SIZES2.md;
126
+ const styles = {
127
+ card: {
128
+ width: "100%",
129
+ maxWidth: s.width,
130
+ boxSizing: "border-box",
131
+ background: bgColor,
132
+ color: textColor,
133
+ border: `1px solid ${borderColor}`,
134
+ borderRadius,
135
+ overflow: "hidden",
136
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
137
+ boxShadow: hovered ? "0 10px 24px rgba(0, 0, 0, 0.12)" : "0 1px 3px rgba(0, 0, 0, 0.08)",
138
+ transform: hovered && hoverLift ? "translateY(-4px)" : "translateY(0)",
139
+ transition: "transform 0.2s ease, box-shadow 0.2s ease",
140
+ cursor: "default"
141
+ },
142
+ image: {
143
+ display: "block",
144
+ width: "100%",
145
+ height: "auto",
146
+ maxHeight: 200,
147
+ objectFit: "cover"
148
+ },
149
+ body: { padding: s.padding },
150
+ title: { margin: 0, fontSize: s.title, fontWeight: 600, lineHeight: 1.3 },
151
+ description: {
152
+ margin: "8px 0 0",
153
+ fontSize: s.text,
154
+ lineHeight: 1.6,
155
+ color: mutedColor
156
+ },
157
+ expanded: {
158
+ margin: "10px 0 0",
159
+ fontSize: s.text,
160
+ lineHeight: 1.6,
161
+ color: textColor
162
+ },
163
+ actions: {
164
+ display: "flex",
165
+ alignItems: "center",
166
+ gap: 10,
167
+ marginTop: 16,
168
+ flexWrap: "wrap"
169
+ },
170
+ primaryBtn: {
171
+ padding: "8px 16px",
172
+ fontSize: s.text,
173
+ fontWeight: 500,
174
+ color: "#ffffff",
175
+ background: accentColor,
176
+ border: "none",
177
+ borderRadius: Math.max(borderRadius - 4, 4),
178
+ cursor: "pointer"
179
+ },
180
+ toggleBtn: {
181
+ padding: "8px 4px",
182
+ fontSize: s.text,
183
+ color: accentColor,
184
+ background: "transparent",
185
+ border: "none",
186
+ cursor: "pointer"
187
+ },
188
+ footer: {
189
+ padding: `${s.padding * 0.6}px ${s.padding}px`,
190
+ fontSize: s.text - 1,
191
+ color: mutedColor,
192
+ borderTop: `1px solid ${borderColor}`
193
+ }
194
+ };
195
+ return /* @__PURE__ */ React2.createElement(
196
+ "div",
197
+ {
198
+ style: styles.card,
199
+ onMouseEnter: () => setHovered(true),
200
+ onMouseLeave: () => setHovered(false)
201
+ },
202
+ image && /* @__PURE__ */ React2.createElement("img", { src: image, alt: imageAlt || title, style: styles.image }),
203
+ /* @__PURE__ */ React2.createElement("div", { style: styles.body }, /* @__PURE__ */ React2.createElement("h3", { style: styles.title }, title), /* @__PURE__ */ React2.createElement("p", { style: styles.description }, description), expandedText && expanded && /* @__PURE__ */ React2.createElement("p", { style: styles.expanded }, expandedText), /* @__PURE__ */ React2.createElement("div", { style: styles.actions }, buttonText && /* @__PURE__ */ React2.createElement("button", { type: "button", style: styles.primaryBtn, onClick }, buttonText), expandedText && /* @__PURE__ */ React2.createElement(
204
+ "button",
205
+ {
206
+ type: "button",
207
+ style: styles.toggleBtn,
208
+ "aria-expanded": expanded,
209
+ onClick: () => setExpanded((prev) => !prev)
210
+ },
211
+ expanded ? "Show less" : "Show more"
212
+ ))),
213
+ footer && /* @__PURE__ */ React2.createElement("div", { style: styles.footer }, footer)
214
+ );
215
+ };
216
+ export {
217
+ Button,
218
+ Card
219
+ };
package/package.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "ksm-ai-ui-lib",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "KSM-AI UI React Component Library",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsup"
12
+ },
13
+ "keywords": [],
14
+ "author": "IT Develeper coder",
15
+ "license": "ISC",
16
+ "peerDependencies": {
17
+ "react": "^19.3.1"
18
+ },
19
+ "devDependencies": {
20
+ "tsup": "^9.0.0",
21
+ "typescript": "^7.0.2"
22
+ }
23
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.