@stamcat/craftsman 0.0.31-beta.4 → 0.0.31

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 (39) hide show
  1. package/AGENTS.md +1 -0
  2. package/Components.esm.js +78 -76
  3. package/package.json +5 -1
  4. package/skills/craftsman-component-usage/SKILL.md +2 -0
  5. package/skills/craftsman-style-utilities/SKILL.md +52 -0
  6. package/src/components/Accordion/AGENTS.md +45 -0
  7. package/src/components/Accordion/Accordion.css +1 -0
  8. package/src/components/Accordion/Accordion.d.ts +14 -0
  9. package/src/components/Accordion/Accordion.scss +64 -0
  10. package/src/components/Accordion/Accordion2.esm.js +70 -0
  11. package/src/components/Carousel/Carousel2.esm.js +21 -21
  12. package/src/components/DatePicker/DatePicker.css +1 -1
  13. package/src/components/DatePicker/DatePicker2.esm.js +11 -11
  14. package/src/components/DateRangePicker/DateRangePicker.css +1 -1
  15. package/src/components/DateRangePicker/DateRangePicker2.esm.js +10 -10
  16. package/src/components/DateTimePicker/DateTimePicker.css +1 -1
  17. package/src/components/DateTimePicker/DateTimePicker2.esm.js +14 -14
  18. package/src/components/Input/Input.css +1 -1
  19. package/src/components/Input/Input.scss +7 -0
  20. package/src/components/Input/Input2.esm.js +10 -10
  21. package/src/components/InputNumber/InputNumber2.esm.js +10 -10
  22. package/src/components/InputPassword/InputPassword.esm.js +9 -9
  23. package/src/components/InputPhone/InputPhone2.esm.js +7 -7
  24. package/src/components/Modal/Modal2.esm.js +15 -15
  25. package/src/components/Pagination/Pagination2.esm.js +1 -1
  26. package/src/components/Select/Select.esm.js +18 -17
  27. package/src/components/SortableList/ListItem.esm.js +8 -8
  28. package/src/components/SortableList/SortableList2.esm.js +8 -8
  29. package/src/components/Text/AGENTS.md +4 -2
  30. package/src/components/Textarea/Textarea.esm.js +5 -5
  31. package/src/components/TimePicker/TimePicker.css +1 -1
  32. package/src/components/TimePicker/TimePicker2.esm.js +15 -15
  33. package/src/components/TimePicker/TimePickerDisplay.esm.js +1 -1
  34. package/src/components/TimePicker/TimePickerWheel.esm.js +15 -15
  35. package/src/components/Tooltip/Tooltip2.esm.js +12 -12
  36. package/src/components/index.d.ts +1 -0
  37. package/src/styles/global/components/_input.scss +8 -9
  38. package/src/styles/global/components/_select.scss +11 -16
  39. package/src/utilities/types.d.ts +14 -14
@@ -4,15 +4,15 @@ import { InputWrapper as t } from "../Input/InputWrapper.esm.js";
4
4
  import './TimePicker.css';/* empty css */
5
5
  import { resolveLocale as n } from "./utilities.esm.js";
6
6
  import { TimePickerDisplay as r } from "./TimePickerDisplay.esm.js";
7
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
8
- import { useEffect as o, useState as s } from "react";
9
- import { FaClock as c, FaRegClock as l, FaX as u } from "react-icons/fa6";
7
+ import { useEffect as i, useState as a } from "react";
8
+ import { FaClock as o, FaRegClock as s, FaX as c } from "react-icons/fa6";
9
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
10
  import { autoUpdate as d, flip as f, offset as p, shift as m, useFloating as h } from "@floating-ui/react-dom";
11
11
  import { TimePicker as g } from "react-time-picker";
12
12
  import { isMobile as _ } from "react-device-detect";
13
13
  //#region src/components/TimePicker/TimePicker.tsx
14
14
  var v = (v) => {
15
- let { labels: y, locale: b, format: x, value: S, onChange: C, label: w, labelPosition: T, error: E, required: D, name: O, ...k } = v, [A, j] = s(null), [M, N] = s(null), { floatingStyles: P } = h({
15
+ let { labels: y, locale: b, format: x, value: S, onChange: C, label: w, labelPosition: T, error: E, required: D, name: O, ...k } = v, [A, j] = a(null), [M, N] = a(null), { floatingStyles: P } = h({
16
16
  placement: "bottom-start",
17
17
  strategy: "absolute",
18
18
  whileElementsMounted: d,
@@ -25,8 +25,8 @@ var v = (v) => {
25
25
  reference: A,
26
26
  floating: M
27
27
  }
28
- }), [F, I] = s(!1), L = n(b);
29
- return o(() => {
28
+ }), [F, I] = a(!1), L = n(b);
29
+ return i(() => {
30
30
  if (!F) return;
31
31
  let e = (e) => {
32
32
  A?.contains(e.target) || M?.contains(e.target) || I(!1);
@@ -38,7 +38,7 @@ var v = (v) => {
38
38
  F,
39
39
  A,
40
40
  M
41
- ]), /* @__PURE__ */ a("div", {
41
+ ]), /* @__PURE__ */ u("div", {
42
42
  className: "timePicker",
43
43
  ref: j,
44
44
  onFocus: (e) => {
@@ -48,28 +48,28 @@ var v = (v) => {
48
48
  e.key === "Enter" && I(!1);
49
49
  },
50
50
  children: [
51
- O && /* @__PURE__ */ i("input", {
51
+ O && /* @__PURE__ */ l("input", {
52
52
  type: "hidden",
53
53
  name: O,
54
54
  value: typeof S == "string" ? S : "",
55
55
  readOnly: !0
56
56
  }),
57
- /* @__PURE__ */ i(t, {
57
+ /* @__PURE__ */ l(t, {
58
58
  label: w,
59
59
  labelPosition: T,
60
60
  error: E,
61
61
  required: D,
62
- children: /* @__PURE__ */ a("div", {
62
+ children: /* @__PURE__ */ u("div", {
63
63
  className: "timePicker__field",
64
- children: [/* @__PURE__ */ i(g, {
64
+ children: [/* @__PURE__ */ l(g, {
65
65
  ...k,
66
66
  value: S,
67
67
  onChange: C,
68
68
  locale: L,
69
69
  required: D,
70
70
  disableClock: !0,
71
- clearIcon: /* @__PURE__ */ i(u, { size: 14 })
72
- }), !_ && /* @__PURE__ */ i(e, {
71
+ clearIcon: /* @__PURE__ */ l(c, { size: 14 })
72
+ }), !_ && /* @__PURE__ */ l(e, {
73
73
  type: "button",
74
74
  variant: "text",
75
75
  onClick: () => I((e) => !e),
@@ -77,11 +77,11 @@ var v = (v) => {
77
77
  "aria-pressed": F,
78
78
  disabled: v.disabled,
79
79
  className: "input-view-toggle",
80
- children: i(F ? c : l, { size: 16 })
80
+ children: l(F ? o : s, { size: 16 })
81
81
  })]
82
82
  })
83
83
  }),
84
- !_ && /* @__PURE__ */ i(r, {
84
+ !_ && /* @__PURE__ */ l(r, {
85
85
  value: S,
86
86
  onChange: (e) => C?.(e),
87
87
  locale: L,
@@ -1,8 +1,8 @@
1
1
  import { getAmPmLabels as e, getUnitLabel as t, is24HourFormat as n, isEmpty as r } from "../../utilities/validations.esm.js";
2
2
  import { padTime as i, parseTimeString as a, resolveLocale as o, resolveTimeFormat as s, to24Hour as c } from "./utilities.esm.js";
3
3
  import { IosPickerItem as l } from "./TimePickerWheel.esm.js";
4
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
5
4
  import "react";
5
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
6
6
  //#region src/components/TimePicker/TimePickerDisplay.tsx
7
7
  var f = (e, t) => e ? t : void 0, p = (p) => {
8
8
  let { value: m, onChange: h, locale: g, format: _, labels: v, visible: y = !1, floatingRef: b, style: x } = p, S = o(g), [C, w] = a(m), T = !r(m), E = s(_, n(S)), D = +(E === 12), O = E === 12 ? e(S) : null, k = +(C >= 12), A = E === 12 ? (C % 12 + 11) % 12 : C;
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import "./constants.esm.js";
3
3
  import { inactivateEmblaTransform as e, setContainerStyles as t, setSlideStyles as n, snapOnPointerUp as r } from "./utilities.esm.js";
4
- import i from "clsx";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
- import { useCallback as s, useEffect as c, useLayoutEffect as l, useRef as u } from "react";
4
+ import { useCallback as i, useEffect as a, useLayoutEffect as o, useRef as s } from "react";
5
+ import c from "clsx";
6
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
7
  import d from "embla-carousel-react";
8
8
  //#region src/components/TimePicker/TimePickerWheel.tsx
9
9
  var f = (f) => {
@@ -12,11 +12,11 @@ var f = (f) => {
12
12
  axis: "y",
13
13
  dragFree: !0,
14
14
  containScroll: !1
15
- }), w = u(null), T = u(b);
16
- l(() => {
15
+ }), w = s(null), T = s(b);
16
+ o(() => {
17
17
  T.current = b;
18
18
  });
19
- let E = p * 20, D = g ? 0 : 20, O = s((e) => {
19
+ let E = p * 20, D = g ? 0 : 20, O = i((e) => {
20
20
  t(e, (p * 20 - D) * e.scrollProgress()), e.slideNodes().forEach((t, r) => {
21
21
  n(e, r, g, p, E);
22
22
  });
@@ -26,32 +26,32 @@ var f = (f) => {
26
26
  D,
27
27
  E
28
28
  ]);
29
- return c(() => {
29
+ return a(() => {
30
30
  if (!C) return () => {};
31
31
  let t = (e) => T.current?.(e.selectedScrollSnap());
32
32
  return C.on("pointerUp", r), C.on("scroll", O), C.on("reInit", e), C.on("reInit", O), C.on("select", t), e(C), O(C), () => {
33
33
  C.off("pointerUp", r), C.off("scroll", O), C.off("reInit", e), C.off("reInit", O), C.off("select", t);
34
34
  };
35
- }, [C, O]), c(() => {
35
+ }, [C, O]), a(() => {
36
36
  !C || y === void 0 || C.selectedScrollSnap() !== y && C.scrollTo(y);
37
- }, [C, y]), /* @__PURE__ */ o("div", {
38
- className: i("ios-picker", { "ios-picker--disabled": x }),
37
+ }, [C, y]), /* @__PURE__ */ u("div", {
38
+ className: c("ios-picker", { "ios-picker--disabled": x }),
39
39
  "aria-disabled": x,
40
- children: [/* @__PURE__ */ a("div", {
40
+ children: [/* @__PURE__ */ l("div", {
41
41
  className: "ios-picker__scene",
42
42
  ref: w,
43
- children: /* @__PURE__ */ a("div", {
43
+ children: /* @__PURE__ */ l("div", {
44
44
  className: `ios-picker__viewport ios-picker__viewport--perspective-${m}`,
45
45
  ref: S,
46
- children: /* @__PURE__ */ a("div", {
46
+ children: /* @__PURE__ */ l("div", {
47
47
  className: "ios-picker__container",
48
- children: Array.from({ length: p }, (e, t) => /* @__PURE__ */ a("div", {
48
+ children: Array.from({ length: p }, (e, t) => /* @__PURE__ */ l("div", {
49
49
  className: "ios-picker__slide",
50
50
  children: v ? v[t] : t + _
51
51
  }, t))
52
52
  })
53
53
  })
54
- }), /* @__PURE__ */ a("div", {
54
+ }), /* @__PURE__ */ l("div", {
55
55
  className: "ios-picker__label",
56
56
  children: h
57
57
  })]
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import './Tooltip.css';/* empty css */
3
- import e from "clsx";
4
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
5
- import { useEffect as r, useState as i } from "react";
3
+ import { useEffect as e, useState as t } from "react";
4
+ import n from "clsx";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
6
  import { autoUpdate as a, flip as o, offset as s, shift as c, useFloating as l } from "@floating-ui/react-dom";
7
7
  //#region src/components/Tooltip/Tooltip.tsx
8
8
  var u = (u) => {
9
- let { showContent: d = "hover" } = u, [f, p] = i(null), [m, h] = i(null), { floatingStyles: g, placement: _ } = l({
9
+ let { showContent: d = "hover" } = u, [f, p] = t(null), [m, h] = t(null), { floatingStyles: g, placement: _ } = l({
10
10
  placement: u.placement ?? "bottom-start",
11
11
  strategy: u.strategy ?? "absolute",
12
12
  whileElementsMounted: a,
@@ -19,8 +19,8 @@ var u = (u) => {
19
19
  reference: f,
20
20
  floating: m
21
21
  }
22
- }), [v, y] = i(!1);
23
- return r(() => {
22
+ }), [v, y] = t(!1);
23
+ return e(() => {
24
24
  if (!v || d !== "click") return;
25
25
  let e = (e) => {
26
26
  f?.contains(e.target) || m?.contains(e.target) || y(!1);
@@ -33,10 +33,10 @@ var u = (u) => {
33
33
  d,
34
34
  f,
35
35
  m
36
- ]), /* @__PURE__ */ n("div", {
37
- className: e("tooltip"),
38
- children: [/* @__PURE__ */ t("div", {
39
- className: e("tooltip__anchor"),
36
+ ]), /* @__PURE__ */ i("div", {
37
+ className: n("tooltip"),
38
+ children: [/* @__PURE__ */ r("div", {
39
+ className: n("tooltip__anchor"),
40
40
  ref: p,
41
41
  onMouseEnter: () => {
42
42
  d === "hover" && y(!0);
@@ -49,8 +49,8 @@ var u = (u) => {
49
49
  },
50
50
  style: u.anchorStyles,
51
51
  children: u.anchor
52
- }), v && /* @__PURE__ */ t("div", {
53
- className: e("tooltip__floating"),
52
+ }), v && /* @__PURE__ */ r("div", {
53
+ className: n("tooltip__floating"),
54
54
  ref: h,
55
55
  "data-placement": _,
56
56
  style: {
@@ -1,3 +1,4 @@
1
+ export { Accordion } from './Accordion/Accordion';
1
2
  export { Button } from './Button/Button';
2
3
  export { Input } from './Input/Input';
3
4
  export { InputPassword } from './InputPassword/InputPassword';
@@ -2,19 +2,19 @@
2
2
 
3
3
  @layer craftsman-base {
4
4
 
5
- %interactive-focus-reset {
6
- &:focus {
7
- outline: 0;
8
- box-shadow: none;
9
- }
10
- }
11
-
12
5
  %input-base {
13
6
  color: var(--text);
14
7
  border-radius: 6px;
15
8
  border: 1px solid var(--gray400);
16
9
  padding: #{u.width("gutter", 0.5)};
17
10
  background-color: var(--white);
11
+ &:focus {
12
+ outline: 0;
13
+ box-shadow: none;
14
+ }
15
+ &:hover {
16
+ border-color: #{u.color("gray500")};
17
+ }
18
18
 
19
19
  &[type="number"]::-webkit-outer-spin-button,
20
20
  &[type="number"]::-webkit-inner-spin-button {
@@ -29,10 +29,9 @@
29
29
 
30
30
  &:disabled,
31
31
  &.disabled {
32
- border-color: var(--gray200);
32
+ border-color: var(--gray400);
33
33
  background-color: var(--gray100);
34
34
  }
35
35
 
36
- @extend %interactive-focus-reset;
37
36
  }
38
37
  }
@@ -1,21 +1,16 @@
1
1
  @use "../../utilities/functions" as u;
2
+ @use "./input";
3
+
2
4
  @layer craftsman-base {
3
5
  select,
4
6
  ::picker(select) {
5
7
  appearance: base-select;
6
- background: #{u.color("white")};
7
- color: #{u.color("text")};
8
- border: 1px solid #{u.color("gray200")};
9
- border-radius: 6px;
8
+ @extend %input-base;
9
+
10
10
  }
11
11
  select {
12
- padding: 10px 40px 10px 14px;
12
+ padding-right: 40px;
13
13
  position: relative;
14
- &:hover,
15
- &:focus {
16
- outline: none;
17
- border-color: #{u.color("gray200")};
18
- }
19
14
  &:focus-visible {
20
15
  outline: none;
21
16
  }
@@ -28,25 +23,25 @@
28
23
  transition: 0.2s rotate;
29
24
  content: "";
30
25
  display: inline-block;
31
- width: 10px;
32
- height: 10px;
26
+ width: 7px;
27
+ height: 7px;
33
28
  border-style: solid;
34
29
  border-width: 0 2px 2px 0;
35
30
  transform: rotate(45deg);
36
31
  margin: 0px 2px 0 12px;
37
32
  position: absolute;
38
- right: 16px;
39
- top: 12px;
33
+ right: 14px;
34
+ top: 14px;
40
35
  }
41
36
  &:open::picker-icon {
42
- margin-top: 6px;
37
+ margin-top: 4px;
43
38
  rotate: 180deg;
44
39
  }
45
40
  option {
46
41
  padding: #{u.width("gutter", 0.5)};
47
42
  &:hover,
48
43
  &:focus {
49
- background: #{u.color("gray100")};
44
+ background: #{u.color("gray300")};
50
45
  }
51
46
  &::checkmark {
52
47
  content: "";
@@ -26,6 +26,7 @@ export declare const BreakpointSchema: z.ZodEnum<{
26
26
  desktopOnly: "desktopOnly";
27
27
  }>;
28
28
  export declare const LayoutWidthsSchema: z.ZodEnum<{
29
+ text: "text";
29
30
  gutter: "gutter";
30
31
  column: "column";
31
32
  tablet: "tablet";
@@ -34,7 +35,6 @@ export declare const LayoutWidthsSchema: z.ZodEnum<{
34
35
  mobileMax: "mobileMax";
35
36
  tabletMax: "tabletMax";
36
37
  desktopMax: "desktopMax";
37
- text: "text";
38
38
  }>;
39
39
  export type BaseWidth = z.infer<typeof BaseWidthSchema>;
40
40
  export type ScreenWidth = z.infer<typeof ScreenWidthSchema>;
@@ -54,23 +54,23 @@ export declare const zTextInputType: z.ZodEnum<{
54
54
  number: "number";
55
55
  search: "search";
56
56
  month: "month";
57
+ time: "time";
58
+ image: "image";
57
59
  text: "text";
60
+ hidden: "hidden";
61
+ color: "color";
58
62
  checkbox: "checkbox";
59
63
  radio: "radio";
60
- color: "color";
64
+ tel: "tel";
65
+ url: "url";
66
+ email: "email";
61
67
  date: "date";
68
+ submit: "submit";
69
+ reset: "reset";
62
70
  "datetime-local": "datetime-local";
63
- email: "email";
64
71
  file: "file";
65
- hidden: "hidden";
66
- image: "image";
67
72
  password: "password";
68
73
  range: "range";
69
- reset: "reset";
70
- submit: "submit";
71
- tel: "tel";
72
- time: "time";
73
- url: "url";
74
74
  week: "week";
75
75
  }>;
76
76
  export type TextInputType = z.infer<typeof zTextInputType>;
@@ -102,6 +102,7 @@ export declare const ButtonType: z.ZodEnum<{
102
102
  }>;
103
103
  export type ButtonType = z.infer<typeof ButtonType>;
104
104
  export declare const TextTags: z.ZodEnum<{
105
+ div: "div";
105
106
  h1: "h1";
106
107
  h2: "h2";
107
108
  h3: "h3";
@@ -109,14 +110,13 @@ export declare const TextTags: z.ZodEnum<{
109
110
  h5: "h5";
110
111
  p: "p";
111
112
  span: "span";
112
- div: "div";
113
113
  }>;
114
114
  export type TextTags = z.infer<typeof TextTags>;
115
115
  export declare const TextType: z.ZodEnum<{
116
- display: "display";
116
+ caption: "caption";
117
117
  heading: "heading";
118
+ display: "display";
118
119
  paragraph: "paragraph";
119
- caption: "caption";
120
120
  "small-title": "small-title";
121
121
  }>;
122
122
  export type TextType = z.infer<typeof TextType>;
@@ -134,10 +134,10 @@ export declare const CarouselPageType: z.ZodEnum<{
134
134
  }>;
135
135
  export type CarouselPageType = z.infer<typeof CarouselPageType>;
136
136
  export declare const NoticeType: z.ZodEnum<{
137
+ none: "none";
137
138
  help: "help";
138
139
  info: "info";
139
140
  success: "success";
140
141
  error: "error";
141
- none: "none";
142
142
  }>;
143
143
  export type NoticeType = z.infer<typeof NoticeType>;