@stamcat/craftsman 0.0.27-alpha.7 → 0.0.27-alpha.8
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/Components.esm.js +5 -3
- package/package.json +5 -1
- package/src/components/{Button.d.ts → Button/Button.d.ts} +1 -1
- package/src/components/{Button.esm.js → Button/Button.esm.js} +4 -4
- package/src/components/Input/Input.esm.js +9 -8
- package/src/components/Input/InputPassword.esm.js +1 -1
- package/src/components/Input/InputWrapper.d.ts +1 -2
- package/src/components/Input/InputWrapper.esm.js +14 -20
- package/src/components/Input/Textarea.esm.js +2 -2
- package/src/components/Loader/Loader.d.ts +0 -1
- package/src/components/Loader/Loader.esm.js +12 -14
- package/src/components/Modal/Modal.d.ts +0 -1
- package/src/components/Modal/Modal.esm.js +25 -26
- package/src/components/Select/Select.d.ts +14 -0
- package/src/components/Select/Select.esm.js +26 -0
- package/src/components/index.d.ts +2 -1
- package/src/styles/global/components/_select.scss +56 -0
- package/src/styles/global/globalStyles.scss +2 -1
- package/src/styles/theme/components.esm.js +0 -1
package/Components.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exportAll as e } from "./_virtual/_rolldown/runtime.esm.js";
|
|
2
|
-
import { Button as t } from "./src/components/Button.esm.js";
|
|
2
|
+
import { Button as t } from "./src/components/Button/Button.esm.js";
|
|
3
3
|
import { Input as n } from "./src/components/Input/Input.esm.js";
|
|
4
4
|
import { InputPassword as r } from "./src/components/Input/InputPassword.esm.js";
|
|
5
5
|
import { Loader as i } from "./src/components/Loader/Loader.esm.js";
|
|
@@ -8,8 +8,9 @@ import { Checkbox as o } from "./src/components/Input/Checkbox.esm.js";
|
|
|
8
8
|
import { Textarea as s } from "./src/components/Input/Textarea.esm.js";
|
|
9
9
|
import { Text as c } from "./src/components/Text/Text2.esm.js";
|
|
10
10
|
import { Modal as l } from "./src/components/Modal/Modal.esm.js";
|
|
11
|
+
import { Select as u } from "./src/components/Select/Select.esm.js";
|
|
11
12
|
//#region src/components/index.ts
|
|
12
|
-
var
|
|
13
|
+
var d = /* @__PURE__ */ e({
|
|
13
14
|
Button: () => t,
|
|
14
15
|
Checkbox: () => o,
|
|
15
16
|
Input: () => n,
|
|
@@ -17,8 +18,9 @@ var u = /* @__PURE__ */ e({
|
|
|
17
18
|
Loader: () => i,
|
|
18
19
|
Modal: () => l,
|
|
19
20
|
RadioButton: () => a,
|
|
21
|
+
Select: () => u,
|
|
20
22
|
Text: () => c,
|
|
21
23
|
Textarea: () => s
|
|
22
24
|
});
|
|
23
25
|
//#endregion
|
|
24
|
-
export { t as Button, o as Checkbox, n as Input, r as InputPassword, i as Loader, l as Modal, a as RadioButton, c as Text, s as Textarea,
|
|
26
|
+
export { t as Button, o as Checkbox, n as Input, r as InputPassword, i as Loader, l as Modal, a as RadioButton, u as Select, c as Text, s as Textarea, d as components_exports };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stamcat/craftsman",
|
|
3
|
-
"version": "0.0.27-alpha.
|
|
3
|
+
"version": "0.0.27-alpha.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A powerful, lightweight framework for design systems",
|
|
6
6
|
"repository": {
|
|
@@ -95,6 +95,10 @@
|
|
|
95
95
|
"./Modal": {
|
|
96
96
|
"types": "./src/components/Modal.d.ts",
|
|
97
97
|
"default": "./src/components/Modal.esm.js"
|
|
98
|
+
},
|
|
99
|
+
"./Select": {
|
|
100
|
+
"types": "./src/components/Select.d.ts",
|
|
101
|
+
"default": "./src/components/Select.esm.js"
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { isEmpty as e } from "
|
|
3
|
-
import { width as t } from "
|
|
4
|
-
import "
|
|
2
|
+
import { isEmpty as e } from "../../utilities/validations.esm.js";
|
|
3
|
+
import { width as t } from "../../styles/utilities/layout.esm.js";
|
|
4
|
+
import "../../../Styles.esm.js";
|
|
5
5
|
import n from "clsx";
|
|
6
6
|
import { Fragment as r, jsx as i } from "react/jsx-runtime";
|
|
7
|
-
//#region src/components/Button.tsx
|
|
7
|
+
//#region src/components/Button/Button.tsx
|
|
8
8
|
var a = (a) => {
|
|
9
9
|
let { type: o = "button", variant: s = "default", size: c, styles: l, className: u, style: d, ...f } = a, p = typeof c == "number" ? Math.min(10, Math.max(.1, c)) : void 0, m = e(l) ? void 0 : l, h = p ? {
|
|
10
10
|
borderRadius: `calc(var(--btn-border-radius) * ${p})`,
|
|
@@ -6,25 +6,26 @@ import r from "clsx";
|
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
7
|
import { useId as o } from "react";
|
|
8
8
|
//#region src/components/Input/Input.tsx
|
|
9
|
-
var s = ({ label: s, id: c, labelPosition: l = "top", required: u = !1, type: d = "text", error: f,
|
|
10
|
-
let
|
|
9
|
+
var s = ({ label: s, id: c, labelPosition: l = "top", required: u = !1, type: d = "text", error: f, endAdornment: p, style: m, className: h, ...g }) => {
|
|
10
|
+
let _ = o(), v = c || _;
|
|
11
11
|
return /* @__PURE__ */ i(n, {
|
|
12
|
+
className: h,
|
|
12
13
|
label: s,
|
|
13
14
|
labelPosition: l,
|
|
14
15
|
error: f,
|
|
15
16
|
required: u,
|
|
16
|
-
|
|
17
|
+
style: m,
|
|
17
18
|
children: /* @__PURE__ */ a("span", {
|
|
18
19
|
className: t.inputField,
|
|
19
|
-
"data-has-end-adornment": !e(
|
|
20
|
+
"data-has-end-adornment": !e(p),
|
|
20
21
|
children: [/* @__PURE__ */ i("input", {
|
|
21
|
-
id:
|
|
22
|
+
id: v,
|
|
22
23
|
type: d,
|
|
23
24
|
className: r(t.input, d),
|
|
24
|
-
...
|
|
25
|
-
}), !e(
|
|
25
|
+
...g
|
|
26
|
+
}), !e(p) && /* @__PURE__ */ i("span", {
|
|
26
27
|
className: t.inputAdornment,
|
|
27
|
-
children:
|
|
28
|
+
children: p
|
|
28
29
|
})]
|
|
29
30
|
})
|
|
30
31
|
});
|
|
@@ -4,8 +4,7 @@ export type LabeledInput = {
|
|
|
4
4
|
labelPosition?: LabelPosition;
|
|
5
5
|
error?: string | boolean | React.ReactNode;
|
|
6
6
|
required?: boolean;
|
|
7
|
-
styles?: React.CSSProperties;
|
|
8
7
|
endAdornment?: React.ReactNode;
|
|
9
8
|
};
|
|
10
|
-
export type InputWrapperProps = React.ComponentProps<"input" | "textarea"> & LabeledInput;
|
|
9
|
+
export type InputWrapperProps = React.ComponentProps<"input" | "textarea" | "select"> & LabeledInput;
|
|
11
10
|
export declare const InputWrapper: React.FC<InputWrapperProps>;
|
|
@@ -4,25 +4,19 @@ import t from "./Input.module.esm.js";
|
|
|
4
4
|
import n from "clsx";
|
|
5
5
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Input/InputWrapper.tsx
|
|
7
|
-
var a = ({ label: a, labelPosition: o = "top", required: s = !1, error: c,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
children:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}), f] }), !e(c) && /* @__PURE__ */ r("div", {
|
|
22
|
-
className: t.error,
|
|
23
|
-
children: c
|
|
24
|
-
})]
|
|
25
|
-
});
|
|
26
|
-
};
|
|
7
|
+
var a = ({ label: a, labelPosition: o = "top", required: s = !1, error: c, className: l, style: u, children: d, value: f, defaultValue: p }) => /* @__PURE__ */ i("div", {
|
|
8
|
+
"data-label-position": o,
|
|
9
|
+
"data-required": s,
|
|
10
|
+
"data-has-input": !e(f) || !e(p),
|
|
11
|
+
className: n(t.wrapper, l),
|
|
12
|
+
style: u,
|
|
13
|
+
children: [e(a) ? d : /* @__PURE__ */ i("label", { children: [o !== "hidden" && /* @__PURE__ */ r("div", {
|
|
14
|
+
className: t.inputLabel,
|
|
15
|
+
children: a
|
|
16
|
+
}), d] }), !e(c) && /* @__PURE__ */ r("div", {
|
|
17
|
+
className: t.error,
|
|
18
|
+
children: c
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
27
21
|
//#endregion
|
|
28
22
|
export { a as InputWrapper };
|
|
@@ -5,7 +5,7 @@ import n from "clsx";
|
|
|
5
5
|
import { jsx as r } from "react/jsx-runtime";
|
|
6
6
|
import { useId as i } from "react";
|
|
7
7
|
//#region src/components/Input/Textarea.tsx
|
|
8
|
-
var a = ({ labelPosition: a = "top", id: o, label: s, error: c, required: l, className: u,
|
|
8
|
+
var a = ({ labelPosition: a = "top", id: o, label: s, error: c, required: l, className: u, style: d, ...f }) => {
|
|
9
9
|
let p = i(), m = o || p;
|
|
10
10
|
return /* @__PURE__ */ r(t, {
|
|
11
11
|
label: s,
|
|
@@ -13,7 +13,7 @@ var a = ({ labelPosition: a = "top", id: o, label: s, error: c, required: l, cla
|
|
|
13
13
|
labelPosition: a,
|
|
14
14
|
error: c,
|
|
15
15
|
required: l,
|
|
16
|
-
|
|
16
|
+
style: d,
|
|
17
17
|
children: /* @__PURE__ */ r("textarea", {
|
|
18
18
|
id: m,
|
|
19
19
|
className: n(e.input),
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import n from "
|
|
5
|
-
import r from "
|
|
6
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { loaders as e } from "./types.esm.js";
|
|
3
|
+
import t from "./loaders.module.esm.js";
|
|
4
|
+
import n from "clsx";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
6
|
//#region src/components/Loader/Loader.tsx
|
|
8
|
-
var
|
|
9
|
-
let { type:
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
className:
|
|
7
|
+
var i = (i) => {
|
|
8
|
+
let { type: a, color: o = "black", width: s, className: c, style: l, ...u } = i, d = e[a](o, s);
|
|
9
|
+
return /* @__PURE__ */ r("div", {
|
|
10
|
+
className: n(t[a], c),
|
|
12
11
|
style: {
|
|
13
|
-
...
|
|
14
|
-
...
|
|
15
|
-
...d
|
|
12
|
+
...d,
|
|
13
|
+
...l
|
|
16
14
|
},
|
|
17
|
-
...
|
|
15
|
+
...u
|
|
18
16
|
});
|
|
19
17
|
};
|
|
20
18
|
//#endregion
|
|
21
|
-
export {
|
|
19
|
+
export { i as Loader };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import r from "
|
|
6
|
-
import i from "
|
|
7
|
-
import
|
|
8
|
-
import c from "react";
|
|
9
|
-
import { LuX as l } from "react-icons/lu";
|
|
2
|
+
import { color as e } from "../../styles/utilities/color.esm.js";
|
|
3
|
+
import { Button as t } from "../Button/Button.esm.js";
|
|
4
|
+
import n from "./Modal.module.esm.js";
|
|
5
|
+
import r from "clsx";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import s from "react";
|
|
8
|
+
import { LuX as c } from "react-icons/lu";
|
|
10
9
|
//#region src/components/Modal/Modal.tsx
|
|
11
|
-
var
|
|
10
|
+
var l = class extends s.PureComponent {
|
|
12
11
|
state = { isClosing: !1 };
|
|
13
12
|
onDismiss = () => {
|
|
14
13
|
this.props.onDismiss && (this.setState({ isClosing: !0 }), setTimeout(() => {
|
|
@@ -19,36 +18,36 @@ var u = class extends c.PureComponent {
|
|
|
19
18
|
(this.props.backgroundDismiss ?? !0) === !0 && this.onDismiss();
|
|
20
19
|
};
|
|
21
20
|
render() {
|
|
22
|
-
let
|
|
23
|
-
return this.props.visible ? /* @__PURE__ */
|
|
24
|
-
className: r.wrapper,
|
|
25
|
-
style:
|
|
26
|
-
children: [/* @__PURE__ */
|
|
27
|
-
className:
|
|
21
|
+
let s = this.props.type || "dialog";
|
|
22
|
+
return this.props.visible ? /* @__PURE__ */ o("div", {
|
|
23
|
+
className: r([n.wrapper, this.props.className]),
|
|
24
|
+
style: this.props.style,
|
|
25
|
+
children: [/* @__PURE__ */ o("div", {
|
|
26
|
+
className: r(n.content, n[s]),
|
|
28
27
|
"data-is-closing": this.state.isClosing,
|
|
29
28
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ o("header", { children: [this.props.header && /* @__PURE__ */ a(i, { children: this.props.header }), !this.props.hideDismissIcon && /* @__PURE__ */ a(t, {
|
|
31
30
|
variant: "primary",
|
|
32
|
-
className:
|
|
31
|
+
className: n.closeModal,
|
|
33
32
|
onClick: this.onDismiss,
|
|
34
|
-
children: /* @__PURE__ */
|
|
35
|
-
fill:
|
|
33
|
+
children: /* @__PURE__ */ a(c, {
|
|
34
|
+
fill: e("white"),
|
|
36
35
|
size: 18
|
|
37
36
|
})
|
|
38
37
|
})] }),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
this.props.footer && /* @__PURE__ */
|
|
41
|
-
className:
|
|
38
|
+
/* @__PURE__ */ a("section", { children: this.props.children }),
|
|
39
|
+
this.props.footer && /* @__PURE__ */ a("footer", {
|
|
40
|
+
className: n.actionContainer,
|
|
42
41
|
children: this.props.footer
|
|
43
42
|
})
|
|
44
43
|
]
|
|
45
|
-
}), /* @__PURE__ */
|
|
46
|
-
className:
|
|
44
|
+
}), /* @__PURE__ */ a("div", {
|
|
45
|
+
className: n.background,
|
|
47
46
|
"data-is-closing": this.state.isClosing,
|
|
48
47
|
onClick: this.onClickBackground
|
|
49
48
|
})]
|
|
50
|
-
}) : /* @__PURE__ */
|
|
49
|
+
}) : /* @__PURE__ */ a(i, {});
|
|
51
50
|
}
|
|
52
51
|
};
|
|
53
52
|
//#endregion
|
|
54
|
-
export {
|
|
53
|
+
export { l as Modal };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LabeledInput } from '../Input/InputWrapper';
|
|
2
|
+
export type SelectOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
export type SelectProps = React.ComponentProps<"select"> & LabeledInput & {
|
|
9
|
+
options?: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
export declare const Select: React.FC<SelectProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { InputWrapper as e } from "../Input/InputWrapper.esm.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
import { useId as n } from "react";
|
|
5
|
+
//#region src/components/Select/Select.tsx
|
|
6
|
+
var r = ({ label: r, id: i, labelPosition: a = "top", required: o = !1, error: s, options: c = [], className: l, style: u, ...d }) => {
|
|
7
|
+
let f = n(), p = i || f;
|
|
8
|
+
return /* @__PURE__ */ t(e, {
|
|
9
|
+
label: r,
|
|
10
|
+
labelPosition: a,
|
|
11
|
+
error: s,
|
|
12
|
+
required: o,
|
|
13
|
+
className: l,
|
|
14
|
+
style: u,
|
|
15
|
+
children: /* @__PURE__ */ t("select", {
|
|
16
|
+
id: p,
|
|
17
|
+
...d,
|
|
18
|
+
children: c.map((e, n) => /* @__PURE__ */ t("option", {
|
|
19
|
+
value: e.value,
|
|
20
|
+
children: e.label
|
|
21
|
+
}, `${p}-opt-${n}`))
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { r as Select };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Button } from './Button';
|
|
1
|
+
export { Button } from './Button/Button';
|
|
2
2
|
export { Input } from './Input/Input';
|
|
3
3
|
export { InputPassword } from './Input/InputPassword';
|
|
4
4
|
export { Loader } from './Loader/Loader';
|
|
@@ -7,3 +7,4 @@ export { Checkbox } from './Input/Checkbox';
|
|
|
7
7
|
export { Textarea } from './Input/Textarea';
|
|
8
8
|
export { Text } from './Text/Text';
|
|
9
9
|
export { Modal } from './Modal/Modal';
|
|
10
|
+
export { Select } from './Select/Select';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@use "../../utilities/functions" as u;
|
|
2
|
+
@layer craftsman-base {
|
|
3
|
+
select,
|
|
4
|
+
::picker(select) {
|
|
5
|
+
appearance: base-select;
|
|
6
|
+
background: #{u.color("white")};
|
|
7
|
+
color: #{u.color("text")};
|
|
8
|
+
border: 1px solid #{u.color("gray200")};
|
|
9
|
+
border-radius: 6px;
|
|
10
|
+
}
|
|
11
|
+
select {
|
|
12
|
+
padding: 10px 40px 10px 14px;
|
|
13
|
+
position: relative;
|
|
14
|
+
&:hover,
|
|
15
|
+
&:focus {
|
|
16
|
+
outline: none;
|
|
17
|
+
border-color: #{u.color("gray200")};
|
|
18
|
+
}
|
|
19
|
+
&:focus-visible {
|
|
20
|
+
outline: none;
|
|
21
|
+
}
|
|
22
|
+
&:-moz-focusring {
|
|
23
|
+
color: transparent;
|
|
24
|
+
text-shadow: 0 0 0 #{u.color("text")};
|
|
25
|
+
}
|
|
26
|
+
&::picker-icon {
|
|
27
|
+
color: #999999;
|
|
28
|
+
transition: 0.2s rotate;
|
|
29
|
+
content: "";
|
|
30
|
+
display: inline-block;
|
|
31
|
+
width: 10px;
|
|
32
|
+
height: 10px;
|
|
33
|
+
border-style: solid;
|
|
34
|
+
border-width: 0 2px 2px 0;
|
|
35
|
+
transform: rotate(45deg);
|
|
36
|
+
margin: 0px 2px 0 12px;
|
|
37
|
+
position: absolute;
|
|
38
|
+
right: 16px;
|
|
39
|
+
top: 12px;
|
|
40
|
+
}
|
|
41
|
+
&:open::picker-icon {
|
|
42
|
+
margin-top: 6px;
|
|
43
|
+
rotate: 180deg;
|
|
44
|
+
}
|
|
45
|
+
option {
|
|
46
|
+
padding: #{u.width("gutter", 0.5)};
|
|
47
|
+
&:hover,
|
|
48
|
+
&:focus {
|
|
49
|
+
background: #{u.color("gray100")};
|
|
50
|
+
}
|
|
51
|
+
&::checkmark {
|
|
52
|
+
content: "";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@use "./components/radioButton";
|
|
6
6
|
@use "./components/button";
|
|
7
7
|
@use "./components/input";
|
|
8
|
-
|
|
8
|
+
@use "./components/select";
|
|
9
9
|
@layer craftsman-base, craftsman-theme;
|
|
10
10
|
|
|
11
11
|
@layer craftsman-base {
|
|
@@ -79,4 +79,5 @@
|
|
|
79
79
|
a {
|
|
80
80
|
@extend %text-link;
|
|
81
81
|
}
|
|
82
|
+
|
|
82
83
|
}
|
|
@@ -2,7 +2,6 @@ import { htmlTagNames as e } from "./constants.esm.js";
|
|
|
2
2
|
import { components_exports as t } from "../../../Components.esm.js";
|
|
3
3
|
//#region src/styles/theme/components.ts
|
|
4
4
|
var n = {
|
|
5
|
-
button: "button",
|
|
6
5
|
input: "input:not([type='radio']):not([type='checkbox'])",
|
|
7
6
|
checkbox: "input[type='checkbox']",
|
|
8
7
|
radioButton: "input[type='radio']"
|