@stamcat/craftsman 0.0.23-alpha.9 → 0.0.23
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/AGENTS.md +216 -6
- package/Components.d.ts +2 -0
- package/Components.esm.js +20 -5
- package/Styles.d.ts +2 -0
- package/Styles.esm.js +8 -0
- package/Utilities.d.ts +2 -0
- package/Utilities.esm.js +2 -0
- package/_virtual/_rolldown/runtime.esm.js +11 -0
- package/package.json +42 -15
- package/{components → src/components}/Button.d.ts +2 -2
- package/src/components/Button.esm.js +23 -16
- package/src/components/Button.module.css +1 -0
- package/src/components/Button.module.esm.js +9 -0
- package/src/components/Button.module.scss +5 -0
- package/src/components/Checkbox.d.ts +7 -0
- package/src/components/Checkbox.esm.js +10 -0
- package/src/components/Input.d.ts +11 -0
- package/src/components/Input.esm.js +38 -3
- package/src/components/Input.module.css +1 -0
- package/src/components/Input.module.esm.js +11 -0
- package/src/components/Input.module.scss +141 -0
- package/src/components/InputPassword.d.ts +6 -0
- package/src/components/InputPassword.esm.js +32 -0
- package/{components → src/components}/Loader.d.ts +1 -2
- package/src/components/Loader.esm.js +15 -14
- package/{components → src/components}/Modal.d.ts +2 -3
- package/src/components/Modal.esm.js +40 -135
- package/src/components/Modal.module.css +1 -0
- package/src/components/Modal.module.esm.js +13 -0
- package/src/components/Modal.module.scss +133 -0
- package/src/components/RadioButton.d.ts +7 -0
- package/src/components/RadioButton.esm.js +10 -0
- package/{components → src/components}/index.d.ts +3 -0
- package/src/styles/components/ThemeProvider.d.ts +7 -0
- package/src/styles/components/ThemeProvider.esm.js +8 -0
- package/src/styles/global/components/_button.scss +64 -0
- package/src/styles/global/components/_checkbox.scss +78 -0
- package/src/styles/global/components/_code.scss +19 -0
- package/src/styles/global/components/_input.scss +46 -0
- package/src/styles/global/components/_mixins.scss +2 -0
- package/src/styles/global/components/_modal.scss +9 -0
- package/src/styles/global/components/_radioButton.scss +33 -0
- package/src/styles/global/components/_typography.scss +7 -0
- package/{styles → src/styles}/global/components/button.d.ts +1 -2
- package/{styles → src/styles}/global/components/loaders.d.ts +3 -5
- package/src/styles/global/components/loaders.esm.js +44 -55
- package/src/styles/global/components/loaders.module.css +1 -1
- package/src/styles/global/components/loaders.module.esm.js +15 -19
- package/src/styles/global/components/loaders.module.scss +73 -67
- package/src/styles/global/globalStyles.d.ts +1 -0
- package/src/styles/global/globalStyles.esm.js +4 -0
- package/src/styles/global/globalStyles.module.scss +129 -0
- package/src/styles/global/variables.esm.js +11 -0
- package/src/styles/index.d.ts +7 -0
- package/src/styles/theme/components.esm.js +12 -0
- package/src/styles/theme/constants.esm.js +4 -0
- package/src/styles/theme/theme.d.ts +2 -0
- package/src/styles/theme/theme.esm.js +56 -0
- package/{styles → src/styles}/theme/types.d.ts +10 -3
- package/src/styles/theme/utilities.d.ts +3 -0
- package/src/styles/theme/utilities.esm.js +48 -0
- package/src/styles/utilities/color.d.ts +174 -0
- package/src/styles/utilities/color.esm.js +4 -8
- package/src/styles/utilities/constants.d.ts +172 -0
- package/src/styles/utilities/constants.esm.js +175 -71
- package/{styles → src/styles}/utilities/layout.d.ts +6 -4
- package/src/styles/utilities/layout.esm.js +28 -29
- package/src/styles/utilities/types.d.ts +85 -0
- package/src/styles/utilities/types.esm.js +54 -0
- package/src/utilities/index.d.ts +1 -0
- package/src/utilities/validations.esm.js +9 -0
- package/components/Input.d.ts +0 -2
- package/src/styles/utilities/config.esm.js +0 -25
- package/stories/Button.stories.d.ts +0 -15
- package/stories/Colors.stories.d.ts +0 -5
- package/stories/Icons.stories.d.ts +0 -36
- package/stories/Loaders.stories.d.ts +0 -6
- package/stories/Modal.stories.d.ts +0 -8
- package/stories/Toastify.stories.d.ts +0 -7
- package/stories/Typography.stories.d.ts +0 -6
- package/styles/global/components/code.d.ts +0 -1
- package/styles/global/components/typography.d.ts +0 -11
- package/styles/global/globalStyles.d.ts +0 -1
- package/styles/theme/theme.d.ts +0 -8
- package/styles/theme/utilities.d.ts +0 -2
- package/styles/utilities/color.d.ts +0 -5
- package/styles/utilities/config.d.ts +0 -7
- package/styles/utilities/constants.d.ts +0 -77
- package/styles/utilities/types.d.ts +0 -17
- /package/{components → src/components}/Progress.d.ts +0 -0
- /package/{main.d.ts → src/main.d.ts} +0 -0
- /package/{styles → src/styles}/global/variables.d.ts +0 -0
- /package/{styles → src/styles}/theme/components.d.ts +0 -0
- /package/{styles → src/styles}/theme/constants.d.ts +0 -0
- /package/{utilities → src/utilities}/validations.d.ts +0 -0
package/AGENTS.md
CHANGED
|
@@ -10,8 +10,12 @@ Use these imports:
|
|
|
10
10
|
|
|
11
11
|
```tsx
|
|
12
12
|
import { Button } from "@stamcat/craftsman/Button";
|
|
13
|
+
import { Checkbox } from "@stamcat/craftsman/Checkbox";
|
|
13
14
|
import { Input } from "@stamcat/craftsman/Input";
|
|
15
|
+
import { InputPassword } from "@stamcat/craftsman/InputPassword";
|
|
14
16
|
import { Loader } from "@stamcat/craftsman/Loader";
|
|
17
|
+
import { Modal } from "@stamcat/craftsman/Modal";
|
|
18
|
+
import { RadioButton } from "@stamcat/craftsman/RadioButton";
|
|
15
19
|
```
|
|
16
20
|
|
|
17
21
|
Do not assume a root export like `@stamcat/craftsman` unless that export is explicitly added to package `exports`.
|
|
@@ -37,12 +41,25 @@ Props:
|
|
|
37
41
|
|
|
38
42
|
- Inherits all native `<button>` props.
|
|
39
43
|
- `variant?: "primary" | "default" | "text"` (default: `"default"`)
|
|
40
|
-
- `
|
|
44
|
+
- `size?: number` (default visual scale is `1`)
|
|
45
|
+
- `styles?: React.CSSProperties` (inline style override)
|
|
41
46
|
|
|
42
47
|
Behavior notes:
|
|
43
48
|
|
|
44
49
|
- `type` defaults to `"button"`.
|
|
45
50
|
- For `variant !== "default"`, variant is appended to `className` (for example `"primary"`).
|
|
51
|
+
- Theme class merge: if `theme.components.button` is a string, it is appended to the class list.
|
|
52
|
+
- `className` is preserved and merged after variant/theme classes.
|
|
53
|
+
- If `children` is empty (per `isEmpty`), the component renders nothing.
|
|
54
|
+
- `size` is clamped to `[0.1, 10]` before styling is applied.
|
|
55
|
+
- When `size` is provided, Button scales:
|
|
56
|
+
- `border-radius: calc(var(--btn-border-radius) * size)`
|
|
57
|
+
- `padding: calc(var(--btn-pad-y) * size) calc(var(--btn-pad-x) * size)`
|
|
58
|
+
- `font-size: max(10px, calc(var(--w-text) * size))`
|
|
59
|
+
- There is no dedicated icon/loading prop. Icons, loaders, and mixed content are passed as `children`.
|
|
60
|
+
- Supports both real disable (`disabled={true}`) and style-only disable (`className="disabled"`).
|
|
61
|
+
- Native button modes are supported (`type="button" | "submit" | "reset"`).
|
|
62
|
+
- Accessibility props such as `aria-label` pass through unchanged.
|
|
46
63
|
|
|
47
64
|
Example:
|
|
48
65
|
|
|
@@ -50,6 +67,33 @@ Example:
|
|
|
50
67
|
<Button variant="primary" onClick={onSave}>Save</Button>
|
|
51
68
|
```
|
|
52
69
|
|
|
70
|
+
Story-aligned usage examples:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
// Scaled compact button (size is clamped to [0.1, 10])
|
|
74
|
+
<Button variant="primary" size={0.5}>Mini Action</Button>
|
|
75
|
+
|
|
76
|
+
// Icon content
|
|
77
|
+
<Button variant="primary">
|
|
78
|
+
<TruckIcon size={20} /> <span>Ship</span>
|
|
79
|
+
</Button>
|
|
80
|
+
|
|
81
|
+
// Loading content
|
|
82
|
+
<Button aria-label="Saving">
|
|
83
|
+
<Loader type="boxy" width={32} color="#de13ca" />
|
|
84
|
+
</Button>
|
|
85
|
+
|
|
86
|
+
// Style-only disabled appearance while still allowing click handlers
|
|
87
|
+
<Button className="disabled" onClick={onClick}>Disabled Look</Button>
|
|
88
|
+
|
|
89
|
+
// Native submit behavior
|
|
90
|
+
<Button type="submit" aria-label="Save form">Save</Button>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Implementation caution:
|
|
94
|
+
|
|
95
|
+
- Size scaling depends on CSS variables provided by the package global styles (`--btn-border-radius`, `--btn-pad-y`, `--btn-pad-x`, `--w-text`).
|
|
96
|
+
|
|
53
97
|
### Input
|
|
54
98
|
|
|
55
99
|
Import:
|
|
@@ -60,7 +104,19 @@ import { Input } from "@stamcat/craftsman/Input";
|
|
|
60
104
|
|
|
61
105
|
Props:
|
|
62
106
|
|
|
63
|
-
-
|
|
107
|
+
- Inherits native `<input>` props.
|
|
108
|
+
- `label?: string | ReactNode`
|
|
109
|
+
- `labelPosition?: "top" | "left" | "bottom" | "right" | "inside" | "hidden"` (default: `"top"`)
|
|
110
|
+
- `error?: string | boolean | ReactNode`
|
|
111
|
+
- `required?: boolean`
|
|
112
|
+
- `styles?: React.CSSProperties` (wrapper override)
|
|
113
|
+
- `type?: TextInputType` (checkbox/radio excluded)
|
|
114
|
+
|
|
115
|
+
Behavior notes:
|
|
116
|
+
|
|
117
|
+
- `id` is preserved; if omitted, a stable React `useId` value is used.
|
|
118
|
+
- Floating-label behavior is supported when `labelPosition="inside"`.
|
|
119
|
+
- `endAdornment` exists as an internal extension point used by `InputPassword`; consumer apps should prefer `InputPassword` rather than wiring password toggles on `Input`.
|
|
64
120
|
|
|
65
121
|
Example:
|
|
66
122
|
|
|
@@ -68,6 +124,160 @@ Example:
|
|
|
68
124
|
<Input type="email" placeholder="you@company.com" required />
|
|
69
125
|
```
|
|
70
126
|
|
|
127
|
+
### InputPassword
|
|
128
|
+
|
|
129
|
+
Import:
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { InputPassword } from "@stamcat/craftsman/InputPassword";
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Props:
|
|
136
|
+
|
|
137
|
+
- Extends `Input` props, with `type` constrained to password mode.
|
|
138
|
+
- Includes all label, error, required, and wrapper style props from `Input`.
|
|
139
|
+
|
|
140
|
+
Behavior notes:
|
|
141
|
+
|
|
142
|
+
- Built on top of `Input` and adds an internal password visibility state.
|
|
143
|
+
- Renders an in-field show/hide toggle button.
|
|
144
|
+
- Toggle is accessible: real button element, keyboard operable, and updates `aria-label` + `aria-pressed`.
|
|
145
|
+
- Use this component for password fields instead of `Input type="password"`.
|
|
146
|
+
|
|
147
|
+
Example:
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<InputPassword
|
|
151
|
+
label="Password"
|
|
152
|
+
placeholder="Enter your password"
|
|
153
|
+
autoComplete="current-password"
|
|
154
|
+
/>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Checkbox
|
|
158
|
+
|
|
159
|
+
Import:
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { Checkbox } from "@stamcat/craftsman/Checkbox";
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Props:
|
|
166
|
+
|
|
167
|
+
- Extends `Input` props.
|
|
168
|
+
- `type?: "checkbox"` (default: `"checkbox"`)
|
|
169
|
+
- `labelPosition?: "left" | "right" | "top" | "bottom"` (default: `"right"`)
|
|
170
|
+
|
|
171
|
+
Behavior notes:
|
|
172
|
+
|
|
173
|
+
- `Checkbox` is a thin wrapper around `Input` with checkbox-specific guardrails.
|
|
174
|
+
- The wrapper enforces checkbox type by default and narrows label position options to common checkbox layouts.
|
|
175
|
+
- Controlled and uncontrolled patterns are both supported (`checked` + `onChange`, or `defaultChecked`).
|
|
176
|
+
|
|
177
|
+
Example:
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
<Checkbox
|
|
181
|
+
id="accept-terms"
|
|
182
|
+
name="terms"
|
|
183
|
+
value="accepted"
|
|
184
|
+
label="Accept terms"
|
|
185
|
+
checked={accepted}
|
|
186
|
+
onChange={(event) => setAccepted(event.currentTarget.checked)}
|
|
187
|
+
/>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### RadioButton
|
|
191
|
+
|
|
192
|
+
Import:
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
import { RadioButton } from "@stamcat/craftsman/RadioButton";
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Props:
|
|
199
|
+
|
|
200
|
+
- Extends `Input` props.
|
|
201
|
+
- `type?: "radio"` (default: `"radio"`)
|
|
202
|
+
- `labelPosition?: "left" | "right"` (default: `"right"`)
|
|
203
|
+
|
|
204
|
+
Behavior notes:
|
|
205
|
+
|
|
206
|
+
- `RadioButton` is a thin wrapper around `Input` with radio-specific guardrails.
|
|
207
|
+
- Group behavior is native HTML radio behavior: use a shared `name` across options.
|
|
208
|
+
- Controlled and uncontrolled patterns are both supported (`checked` + `onChange`, or `defaultChecked`).
|
|
209
|
+
|
|
210
|
+
Example:
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
<>
|
|
214
|
+
<RadioButton
|
|
215
|
+
id="captain-kirk"
|
|
216
|
+
name="favorite-captain"
|
|
217
|
+
value="Kirk"
|
|
218
|
+
label="James T. Kirk"
|
|
219
|
+
checked={selected === "Kirk"}
|
|
220
|
+
onChange={(event) => setSelected(event.currentTarget.value)}
|
|
221
|
+
/>
|
|
222
|
+
<RadioButton
|
|
223
|
+
id="captain-picard"
|
|
224
|
+
name="favorite-captain"
|
|
225
|
+
value="Picard"
|
|
226
|
+
label="Jean-Luc Picard"
|
|
227
|
+
checked={selected === "Picard"}
|
|
228
|
+
onChange={(event) => setSelected(event.currentTarget.value)}
|
|
229
|
+
/>
|
|
230
|
+
</>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Modal
|
|
234
|
+
|
|
235
|
+
Import:
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
import { Modal } from "@stamcat/craftsman/Modal";
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Props:
|
|
242
|
+
|
|
243
|
+
- Inherits all native `<div>` props.
|
|
244
|
+
- `visible?: boolean` (when falsy, component renders nothing)
|
|
245
|
+
- `onDismiss?: () => void`
|
|
246
|
+
- `type?: "dialog" | "panel"` (default: `"dialog"`)
|
|
247
|
+
- `header?: string | React.ReactNode`
|
|
248
|
+
- `backgroundDismiss?: boolean` (default behavior: `true`)
|
|
249
|
+
- `hideDismissIcon?: boolean` (default behavior: close icon is shown)
|
|
250
|
+
- `footer?: React.ReactNode`
|
|
251
|
+
- `styles?: React.CSSProperties` (applies to outer modal wrapper)
|
|
252
|
+
|
|
253
|
+
Behavior notes:
|
|
254
|
+
|
|
255
|
+
- Modal is controlled; parent owns open/close state via `visible` and `onDismiss`.
|
|
256
|
+
- Close icon and background click both dismiss through `onDismiss`.
|
|
257
|
+
- Background dismiss only runs when `backgroundDismiss` is `true` or `undefined`.
|
|
258
|
+
- Dismiss uses a short close animation before calling `onDismiss` (~280ms timeout).
|
|
259
|
+
- `type="dialog"` renders centered responsive dialog sizing; `type="panel"` renders a right-side panel.
|
|
260
|
+
- `footer` is rendered in an action row container below modal content.
|
|
261
|
+
|
|
262
|
+
Example:
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
const [open, setOpen] = useState(false);
|
|
266
|
+
|
|
267
|
+
<>
|
|
268
|
+
<Button variant="primary" onClick={() => setOpen(true)}>Open</Button>
|
|
269
|
+
<Modal
|
|
270
|
+
visible={open}
|
|
271
|
+
onDismiss={() => setOpen(false)}
|
|
272
|
+
type="dialog"
|
|
273
|
+
header="Confirm Action"
|
|
274
|
+
footer={<><Button onClick={() => setOpen(false)}>Cancel</Button><Button variant="primary">Confirm</Button></>}
|
|
275
|
+
>
|
|
276
|
+
<p>Are you sure?</p>
|
|
277
|
+
</Modal>
|
|
278
|
+
</>
|
|
279
|
+
```
|
|
280
|
+
|
|
71
281
|
### Loader
|
|
72
282
|
|
|
73
283
|
Import:
|
|
@@ -92,7 +302,7 @@ Props:
|
|
|
92
302
|
- `"factory"`
|
|
93
303
|
- `color?: string` (default: `"black"`)
|
|
94
304
|
- `width?: number` (optional, variant-dependent default behavior)
|
|
95
|
-
- `styles?:
|
|
305
|
+
- `styles?: React.CSSProperties` (inline style override)
|
|
96
306
|
|
|
97
307
|
Example:
|
|
98
308
|
|
|
@@ -102,7 +312,7 @@ Example:
|
|
|
102
312
|
|
|
103
313
|
## Styling Expectations
|
|
104
314
|
|
|
105
|
-
- Components are built with
|
|
315
|
+
- Components are built with SCSS modules and class-based variant hooks.
|
|
106
316
|
- If your app does not include this package's global CSS variable setup, visual output may differ.
|
|
107
317
|
- Agents should avoid hard-coding assumptions about token names beyond what the consumer app already defines.
|
|
108
318
|
|
|
@@ -151,12 +361,12 @@ if (arr.length === 0) { ... }
|
|
|
151
361
|
|
|
152
362
|
1. README is minimal; treat this guide as the source of truth for agent usage.
|
|
153
363
|
2. Theme utilities exist in source but are not guaranteed public package exports.
|
|
154
|
-
3.
|
|
364
|
+
3. `Progress` exists in source but is incomplete and intentionally omitted from this guide for now.
|
|
155
365
|
|
|
156
366
|
## Safe Fallback Strategy for Agents
|
|
157
367
|
|
|
158
368
|
If uncertain about available exports:
|
|
159
369
|
|
|
160
|
-
1. Use only `Button`, `Input`,
|
|
370
|
+
1. Use only `Button`, `Checkbox`, `Input`, `InputPassword`, `Loader`, `Modal`, and `RadioButton` from their component entry points.
|
|
161
371
|
2. Do not invent package APIs.
|
|
162
372
|
3. Prefer native HTML elements for anything not explicitly exported.
|
package/Components.d.ts
ADDED
package/Components.esm.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { __exportAll as e } from "./_virtual/_rolldown/runtime.esm.js";
|
|
2
|
+
import { Button as t } from "./src/components/Button.esm.js";
|
|
3
|
+
import { Input as n } from "./src/components/Input.esm.js";
|
|
4
|
+
import { InputPassword as r } from "./src/components/InputPassword.esm.js";
|
|
5
|
+
import { Loader as i } from "./src/components/Loader.esm.js";
|
|
6
|
+
import { RadioButton as a } from "./src/components/RadioButton.esm.js";
|
|
7
|
+
import { Checkbox as o } from "./src/components/Checkbox.esm.js";
|
|
8
|
+
import { Modal as s } from "./src/components/Modal.esm.js";
|
|
9
|
+
//#region src/components/index.ts
|
|
10
|
+
var c = /* @__PURE__ */ e({
|
|
11
|
+
Button: () => t,
|
|
12
|
+
Checkbox: () => o,
|
|
13
|
+
Input: () => n,
|
|
14
|
+
InputPassword: () => r,
|
|
15
|
+
Loader: () => i,
|
|
16
|
+
Modal: () => s,
|
|
17
|
+
RadioButton: () => a
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { t as Button, o as Checkbox, n as Input, r as InputPassword, i as Loader, s as Modal, a as RadioButton, c as components_exports };
|
package/Styles.d.ts
ADDED
package/Styles.esm.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defaultColors as e, defaultWidths as t } from "./src/styles/utilities/constants.esm.js";
|
|
2
|
+
import { color as n, colors as r, hexToRgba as i } from "./src/styles/utilities/color.esm.js";
|
|
3
|
+
import { BaseWidthSchema as a, BreakpointSchema as o, LayoutWidthsSchema as s, MaxScreenWidthSchema as c, ScreenWidthSchema as l, zLabelPosition as u, zTextInputExclusions as d, zTextInputType as f, zTextInputTypes as p } from "./src/styles/utilities/types.esm.js";
|
|
4
|
+
import { breakpoint as m, media as h, width as g, widths as _ } from "./src/styles/utilities/layout.esm.js";
|
|
5
|
+
import { themeBuilder as v } from "./src/styles/theme/theme.esm.js";
|
|
6
|
+
import { globalStyles as y } from "./src/styles/global/globalStyles.esm.js";
|
|
7
|
+
import { ThemeProvider as b } from "./src/styles/components/ThemeProvider.esm.js";
|
|
8
|
+
export { a as BaseWidthSchema, o as BreakpointSchema, s as LayoutWidthsSchema, c as MaxScreenWidthSchema, l as ScreenWidthSchema, b as ThemeProvider, m as breakpoint, n as color, r as colors, e as defaultColors, t as defaultWidths, y as globalStyles, i as hexToRgba, h as media, v as themeBuilder, g as width, _ as widths, u as zLabelPosition, d as zTextInputExclusions, f as zTextInputType, p as zTextInputTypes };
|
package/Utilities.d.ts
ADDED
package/Utilities.esm.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as __exportAll };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stamcat/craftsman",
|
|
3
|
-
"version": "0.0.23
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A powerful, lightweight framework for design systems",
|
|
6
6
|
"repository": {
|
|
@@ -16,17 +16,15 @@
|
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/Stamcat/craftsman/issues"
|
|
18
18
|
},
|
|
19
|
-
"types": "index.d.ts",
|
|
20
|
-
"main": "
|
|
19
|
+
"types": "./src/components/index.d.ts",
|
|
20
|
+
"main": "./Components.esm.js",
|
|
21
21
|
"homepage": "https://github.com/Stamcat/craftsman#readme",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"prepublishOnly": "node ./scripts/prepublishCheck.js"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"dompurify": "3.4.11",
|
|
29
|
-
"emotion": "11.0.0",
|
|
26
|
+
"clsx": "2.1.1",
|
|
27
|
+
"dompurify": "3.4.12",
|
|
30
28
|
"react": "19.2.7",
|
|
31
29
|
"react-date-picker": "12.0.2",
|
|
32
30
|
"react-datetime-picker": "7.0.2",
|
|
@@ -35,25 +33,54 @@
|
|
|
35
33
|
"react-international-phone": "4.8.0",
|
|
36
34
|
"react-toastify": "11.1.0",
|
|
37
35
|
"sass-embedded": "1.100.0",
|
|
36
|
+
"typescript-plugin-css-modules": "5.2.0",
|
|
38
37
|
"zod": "4.4.3"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {},
|
|
40
|
+
"overrides": {
|
|
41
|
+
"postcss": "8.5.20",
|
|
42
|
+
"sharp": "0.35.3"
|
|
43
|
+
},
|
|
41
44
|
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./src/components/index.d.ts",
|
|
47
|
+
"default": "./Components.esm.js"
|
|
48
|
+
},
|
|
49
|
+
"./styles": {
|
|
50
|
+
"types": "./src/styles/index.d.ts",
|
|
51
|
+
"default": "./Styles.esm.js"
|
|
52
|
+
},
|
|
53
|
+
"./utilities": {
|
|
54
|
+
"types": "./src/utilities/index.d.ts",
|
|
55
|
+
"default": "./Utilities.esm.js"
|
|
56
|
+
},
|
|
42
57
|
"./Button": {
|
|
43
|
-
"types": "./Button.d.ts",
|
|
44
|
-
"default": "./Button.
|
|
58
|
+
"types": "./src/components/Button.d.ts",
|
|
59
|
+
"default": "./src/components/Button.esm.js"
|
|
45
60
|
},
|
|
46
61
|
"./Input": {
|
|
47
|
-
"types": "./Input.d.ts",
|
|
48
|
-
"default": "./Input.
|
|
62
|
+
"types": "./src/components/Input.d.ts",
|
|
63
|
+
"default": "./src/components/Input.esm.js"
|
|
64
|
+
},
|
|
65
|
+
"./InputPassword": {
|
|
66
|
+
"types": "./src/components/InputPassword.d.ts",
|
|
67
|
+
"default": "./src/components/InputPassword.esm.js"
|
|
49
68
|
},
|
|
50
69
|
"./Loader": {
|
|
51
|
-
"types": "./Loader.d.ts",
|
|
52
|
-
"default": "./Loader.
|
|
70
|
+
"types": "./src/components/Loader.d.ts",
|
|
71
|
+
"default": "./src/components/Loader.esm.js"
|
|
72
|
+
},
|
|
73
|
+
"./RadioButton": {
|
|
74
|
+
"types": "./src/components/RadioButton.d.ts",
|
|
75
|
+
"default": "./src/components/RadioButton.esm.js"
|
|
76
|
+
},
|
|
77
|
+
"./Checkbox": {
|
|
78
|
+
"types": "./src/components/Checkbox.d.ts",
|
|
79
|
+
"default": "./src/components/Checkbox.esm.js"
|
|
53
80
|
},
|
|
54
81
|
"./Modal": {
|
|
55
|
-
"types": "./Modal.d.ts",
|
|
56
|
-
"default": "./Modal.
|
|
82
|
+
"types": "./src/components/Modal.d.ts",
|
|
83
|
+
"default": "./src/components/Modal.esm.js"
|
|
57
84
|
}
|
|
58
85
|
}
|
|
59
86
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SerializedStyles } from '@emotion/react';
|
|
2
1
|
import { ButtonType } from '../styles/global/components/button';
|
|
3
2
|
export type ButtonProps = React.ComponentProps<"button"> & {
|
|
4
3
|
variant?: ButtonType;
|
|
5
|
-
|
|
4
|
+
size?: number;
|
|
5
|
+
styles?: React.CSSProperties;
|
|
6
6
|
};
|
|
7
7
|
export declare const Button: React.FC<ButtonProps>;
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "
|
|
3
|
-
import {
|
|
1
|
+
import { clsx as e } from "../../node_modules/clsx/dist/clsx.esm.js";
|
|
2
|
+
import { isEmpty as t } from "../utilities/validations.esm.js";
|
|
3
|
+
import { width as n } from "../styles/utilities/layout.esm.js";
|
|
4
|
+
import "../../Styles.esm.js";
|
|
5
|
+
import r from "./Button.module.esm.js";
|
|
6
|
+
import { Fragment as i, jsx as a } from "react/jsx-runtime";
|
|
4
7
|
//#region src/components/Button.tsx
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
var o = (o) => {
|
|
9
|
+
let { type: s = "button", variant: c = "default", size: l, styles: u, className: d, style: f, ...p } = o, m = typeof l == "number" ? Math.min(10, Math.max(.1, l)) : void 0, h = t(u) ? void 0 : u, g = m ? {
|
|
10
|
+
borderRadius: `calc(var(--btn-border-radius) * ${m})`,
|
|
11
|
+
padding: `calc(var(--btn-pad-y) * ${m}) calc(var(--btn-pad-x) * ${m})`,
|
|
12
|
+
fontSize: `max(10px, calc(${n("text")} * ${m}))`
|
|
13
|
+
} : {};
|
|
14
|
+
return t(o.children) ? /* @__PURE__ */ a(i, {}) : /* @__PURE__ */ a("button", {
|
|
15
|
+
type: s,
|
|
16
|
+
"data-variant": c,
|
|
17
|
+
className: e(r.button, "button", d),
|
|
18
|
+
style: {
|
|
19
|
+
...g,
|
|
20
|
+
...h,
|
|
21
|
+
...f
|
|
22
|
+
},
|
|
23
|
+
...p
|
|
17
24
|
});
|
|
18
25
|
};
|
|
19
26
|
//#endregion
|
|
20
|
-
export {
|
|
27
|
+
export { o as Button };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._text_1l9fp_1._button_1l9fp_1,[data-variant=text]._button_1l9fp_1{color:var(--blue500);background:0 0;border:none;padding:0}._text_1l9fp_1._button_1l9fp_1:not(:disabled):not(._disabled_1l9fp_7):hover,[data-variant=text]._button_1l9fp_1:not(:disabled):not(._disabled_1l9fp_7):hover{color:var(--teal700);cursor:pointer;background-color:#0000;text-decoration:underline}._button_1l9fp_1{--btn-pad-y:calc(var(--w-gutter,16px) * .5);--btn-pad-x:calc(var(--w-gutter,16px) * .75);--btn-border-radius:calc(var(--w-gutter,16px) * .75);color:var(--blue600);cursor:pointer;padding:var(--btn-pad-y) var(--btn-pad-x);border-radius:var(--btn-border-radius);border:none;border:1px solid var(--blue500);background-color:var(--white);flex-flow:wrap;align-items:center;font-weight:500;transition:all .125s;display:inline-flex}._button_1l9fp_1:not(:disabled):not(._disabled_1l9fp_7):hover{background-color:var(--teal200)}._button_1l9fp_1:disabled,._disabled_1l9fp_7._button_1l9fp_1{cursor:not-allowed;border-color:var(--gray200);color:var(--gray400)}._button_1l9fp_1:disabled._primary_1l9fp_39,._button_1l9fp_1:disabled[data-variant=primary],._disabled_1l9fp_7._primary_1l9fp_39._button_1l9fp_1,._disabled_1l9fp_7[data-variant=primary]._button_1l9fp_1{border-color:var(--gray200);background-color:var(--gray400);color:var(--gray200)}._primary_1l9fp_39._button_1l9fp_1,[data-variant=primary]._button_1l9fp_1{color:var(--white);background-color:var(--blue500)}._primary_1l9fp_39._button_1l9fp_1:not(:disabled):not(._disabled_1l9fp_7):hover,[data-variant=primary]._button_1l9fp_1:not(:disabled):not(._disabled_1l9fp_7):hover{background-color:var(--blue700)}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './Button.module.css';//#region src/components/Button.module.scss
|
|
2
|
+
var e = "_text_1l9fp_1", t = "_button_1l9fp_1", n = "_disabled_1l9fp_7", r = "_primary_1l9fp_39", i = {
|
|
3
|
+
text: e,
|
|
4
|
+
button: t,
|
|
5
|
+
disabled: n,
|
|
6
|
+
primary: r
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as button, i as default, n as disabled, r as primary, e as text };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Input as e } from "./Input.esm.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Checkbox.tsx
|
|
4
|
+
var n = ({ type: n = "checkbox", labelPosition: r = "right", ...i }) => /* @__PURE__ */ t(e, {
|
|
5
|
+
type: n,
|
|
6
|
+
labelPosition: r,
|
|
7
|
+
...i
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as Checkbox };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LabelPosition, TextInputType } from '../styles/utilities/types';
|
|
2
|
+
export type InputProps = React.ComponentProps<"input"> & {
|
|
3
|
+
label?: string | React.ReactNode;
|
|
4
|
+
labelPosition?: LabelPosition;
|
|
5
|
+
error?: string | boolean | React.ReactNode;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
styles?: React.CSSProperties;
|
|
8
|
+
endAdornment?: React.ReactNode;
|
|
9
|
+
type?: TextInputType;
|
|
10
|
+
};
|
|
11
|
+
export declare const Input: React.FC<InputProps>;
|
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { clsx as e } from "../../node_modules/clsx/dist/clsx.esm.js";
|
|
2
|
+
import { isEmpty as t } from "../utilities/validations.esm.js";
|
|
3
|
+
import n from "./Input.module.esm.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { useId as a } from "react";
|
|
2
6
|
//#region src/components/Input.tsx
|
|
3
|
-
var
|
|
7
|
+
var o = ({ label: o, id: s, labelPosition: c = "top", required: l = !1, type: u = "text", error: d, styles: f, className: p, style: m, endAdornment: h, ...g }) => {
|
|
8
|
+
let _ = a(), v = s || _, y = !t(g.value) || !t(g.defaultValue), b = t(f) ? void 0 : f, x = /* @__PURE__ */ i("span", {
|
|
9
|
+
className: n.inputField,
|
|
10
|
+
"data-has-end-adornment": !t(h),
|
|
11
|
+
children: [/* @__PURE__ */ r("input", {
|
|
12
|
+
id: v,
|
|
13
|
+
type: u,
|
|
14
|
+
className: n.input,
|
|
15
|
+
...g
|
|
16
|
+
}), !t(h) && /* @__PURE__ */ r("span", {
|
|
17
|
+
className: n.inputAdornment,
|
|
18
|
+
children: h
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ i("div", {
|
|
22
|
+
"data-label-position": c,
|
|
23
|
+
"data-required": l,
|
|
24
|
+
"data-has-input": y,
|
|
25
|
+
className: e(n.wrapper, p),
|
|
26
|
+
style: {
|
|
27
|
+
...b,
|
|
28
|
+
...m
|
|
29
|
+
},
|
|
30
|
+
children: [t(o) ? x : /* @__PURE__ */ i("label", { children: [c !== "hidden" && /* @__PURE__ */ r("div", {
|
|
31
|
+
className: n.inputLabel,
|
|
32
|
+
children: o
|
|
33
|
+
}), x] }), !t(d) && /* @__PURE__ */ r("div", {
|
|
34
|
+
className: n.error,
|
|
35
|
+
children: d
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
4
39
|
//#endregion
|
|
5
|
-
export {
|
|
40
|
+
export { o as Input };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._wrapper_h3ihm_1[data-label-position=inside]{--react-international-phone-height:50px;--react-international-phone-border-radius:8px;--react-international-phone-border-color:silver;position:relative}._wrapper_h3ihm_1[data-label-position=inside]:focus-within ._inputLabel_h3ihm_8,._wrapper_h3ihm_1[data-label-position=inside][data-has-input=true] ._inputLabel_h3ihm_8{top:-.5rem;left:calc(var(--w-gutter,16px) * .25);font-size:calc(var(--w-text,14px) * .75)}._wrapper_h3ihm_1[data-label-position=inside]:has(._input_h3ihm_8:not(:placeholder-shown)) ._inputLabel_h3ihm_8{top:-.5rem;left:calc(var(--w-gutter,16px) * .25);font-size:calc(var(--w-text,14px) * .75)}._wrapper_h3ihm_1[data-label-position=inside]:has(._input_h3ihm_8:-webkit-autofill) ._inputLabel_h3ihm_8{top:-.5rem;left:calc(var(--w-gutter,16px) * .25);font-size:calc(var(--w-text,14px) * .75)}._wrapper_h3ihm_1 label ._inputLabel_h3ihm_8{margin-bottom:calc(var(--w-gutter,16px) * .25)}._wrapper_h3ihm_1[data-required=true] label ._inputLabel_h3ihm_8:after{content:"*";color:var(--red700)}._wrapper_h3ihm_1[data-label-position=left] label{align-items:center;display:inline-flex}._wrapper_h3ihm_1[data-label-position=left] label ._inputLabel_h3ihm_8{width:fit-content;margin-right:calc(var(--w-gutter,16px) * .75)}._wrapper_h3ihm_1[data-label-position=bottom] label{flex-direction:column-reverse;align-items:flex-start;display:inline-flex}._wrapper_h3ihm_1[data-label-position=bottom] label ._inputLabel_h3ihm_8{margin-bottom:0;margin-top:calc(var(--w-gutter,16px) * .25)}._wrapper_h3ihm_1[data-label-position=right] label{flex-direction:row-reverse;align-items:baseline;display:inline-flex}._wrapper_h3ihm_1[data-label-position=right] label ._inputLabel_h3ihm_8{margin-left:calc(var(--w-gutter,16px) * .25);margin-bottom:0}._wrapper_h3ihm_1[data-label-position=inside] ._inputLabel_h3ihm_8{background-color:var(--white);z-index:1;width:fit-content;top:calc(var(--w-gutter,16px) * .25);left:calc(var(--w-gutter,16px) * .25);pointer-events:none;padding:0 5px;transition:top .15s,left .15s,font-size .15s,color .15s;position:absolute}._wrapper_h3ihm_1[data-label-position=inside]>label>._inputField_h3ihm_58>._input_h3ihm_8,._wrapper_h3ihm_1[data-label-position=inside]>._input_h3ihm_8{transition:border-color .2s}._wrapper_h3ihm_1[data-label-position=inside]:focus-within ._inputLabel_h3ihm_8{color:var(--blue500)}._wrapper_h3ihm_1[data-label-position=inside]:focus-within ._input_h3ihm_8{border-color:var(--blue500)}._wrapper_h3ihm_1[data-label-position=inside]:focus-within ._input_h3ihm_8::placeholder{opacity:1}._wrapper_h3ihm_1[data-label-position=inside] ._input_h3ihm_8[type=tel]{width:100%}._wrapper_h3ihm_1[data-label-position=inside] ._input_h3ihm_8::placeholder{opacity:0;transition:opacity .2s}._inputField_h3ihm_58{align-items:center;display:inline-flex;position:relative}._inputField_h3ihm_58[data-has-end-adornment=true]>._input_h3ihm_8{width:100%;padding-right:calc(var(--w-gutter,16px) * .5 + 24px + var(--w-gutter,16px) * .5)}._inputAdornment_h3ihm_89{right:calc(var(--w-gutter,16px) * .5);z-index:1;align-items:center;margin-top:0;display:inline-flex;position:absolute;top:50%;transform:translateY(-50%)}._error_h3ihm_100{margin-top:calc(var(--w-gutter,16px) * .25);font-size:calc(var(--w-text,14px) * .75);color:var(--red600)}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './Input.module.css';//#region src/components/Input.module.scss
|
|
2
|
+
var e = "_wrapper_h3ihm_1", t = "_inputLabel_h3ihm_8", n = "_input_h3ihm_8", r = "_inputField_h3ihm_58", i = "_inputAdornment_h3ihm_89", a = "_error_h3ihm_100", o = {
|
|
3
|
+
wrapper: e,
|
|
4
|
+
inputLabel: t,
|
|
5
|
+
input: n,
|
|
6
|
+
inputField: r,
|
|
7
|
+
inputAdornment: i,
|
|
8
|
+
error: a
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { o as default, a as error, n as input, i as inputAdornment, r as inputField, t as inputLabel, e as wrapper };
|