@stamcat/craftsman 0.0.27-alpha.3 → 0.0.27-alpha.5

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 (64) hide show
  1. package/AGENTS.md +61 -2
  2. package/Components.esm.js +11 -9
  3. package/README.md +5 -0
  4. package/Styles.esm.js +5 -5
  5. package/package.json +8 -1
  6. package/src/components/Button.d.ts +1 -1
  7. package/src/components/Button.esm.js +14 -16
  8. package/src/components/{Checkbox.esm.js → Input/Checkbox.esm.js} +1 -1
  9. package/src/components/Input/Input.d.ts +6 -0
  10. package/src/components/Input/Input.esm.js +33 -0
  11. package/src/components/Input/Input.module.css +1 -0
  12. package/src/components/Input/Input.module.esm.js +13 -0
  13. package/src/components/Input/Input.module.scss +165 -0
  14. package/src/components/{InputPassword.d.ts → Input/InputPassword.d.ts} +1 -1
  15. package/src/components/Input/InputPassword.esm.js +29 -0
  16. package/src/components/Input/InputWrapper.d.ts +11 -0
  17. package/src/components/Input/InputWrapper.esm.js +28 -0
  18. package/src/components/{RadioButton.esm.js → Input/RadioButton.esm.js} +1 -1
  19. package/src/components/Input/Textarea.d.ts +3 -0
  20. package/src/components/Input/Textarea.esm.js +25 -0
  21. package/src/components/Modal.esm.js +18 -26
  22. package/src/components/Modal.module.css +1 -1
  23. package/src/components/Modal.module.esm.js +6 -3
  24. package/src/components/Modal.module.scss +31 -17
  25. package/src/components/index.d.ts +5 -4
  26. package/src/styles/_config.scss +30 -0
  27. package/src/styles/components/ThemeProvider.esm.js +1 -1
  28. package/src/styles/global/components/_button.scss +52 -51
  29. package/src/styles/global/components/_checkbox.scss +63 -59
  30. package/src/styles/global/components/_code.scss +19 -15
  31. package/src/styles/global/components/_input.scss +35 -37
  32. package/src/styles/global/components/_radioButton.scss +29 -26
  33. package/src/styles/global/components/_typography.scss +61 -6
  34. package/src/styles/global/components/loaders.module.css +1 -1
  35. package/src/styles/global/components/loaders.module.esm.js +1 -1
  36. package/src/styles/global/components/loaders.module.scss +2 -1
  37. package/src/styles/global/globalStyles.d.ts +3 -0
  38. package/src/styles/global/globalStyles.module.scss +1 -0
  39. package/src/styles/global/globalStyles.scss +16 -61
  40. package/src/styles/index.d.ts +1 -1
  41. package/src/styles/theme/components.esm.js +11 -5
  42. package/src/styles/theme/theme.esm.js +31 -41
  43. package/src/styles/theme/types.d.ts +4 -1
  44. package/src/styles/utilities/_functions.scss +117 -0
  45. package/src/styles/utilities/_mixins.scss +0 -0
  46. package/src/styles/utilities/color.d.ts +1 -1
  47. package/src/styles/utilities/constants.d.ts +1 -1
  48. package/src/styles/utilities/layout.d.ts +1 -1
  49. package/src/styles/utilities/layout.esm.js +1 -1
  50. package/src/{styles/utilities → utilities}/types.d.ts +7 -1
  51. package/src/{styles/utilities → utilities}/types.esm.js +6 -2
  52. package/src/components/Button.module.css +0 -1
  53. package/src/components/Button.module.esm.js +0 -9
  54. package/src/components/Button.module.scss +0 -5
  55. package/src/components/Input.d.ts +0 -11
  56. package/src/components/Input.esm.js +0 -41
  57. package/src/components/Input.module.css +0 -1
  58. package/src/components/Input.module.esm.js +0 -11
  59. package/src/components/Input.module.scss +0 -141
  60. package/src/components/InputPassword.esm.js +0 -33
  61. package/src/styles/global/components/_mixins.scss +0 -2
  62. package/src/styles/global/components/button.d.ts +0 -7
  63. /package/src/components/{Checkbox.d.ts → Input/Checkbox.d.ts} +0 -0
  64. /package/src/components/{RadioButton.d.ts → Input/RadioButton.d.ts} +0 -0
@@ -1,7 +1,62 @@
1
- %body-typography {
2
- font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3
- color: var(--text);
4
- line-height: 1.5;
5
- font-weight: 400;
6
- font-size: var(--w-text, 14px);
1
+ @use "../../utilities/functions" as u;
2
+
3
+ @layer craftsman-base {
4
+ %body-typography {
5
+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
6
+ color: var(--text);
7
+ line-height: 1.5;
8
+ font-weight: 400;
9
+ font-size: var(--w-text, 14px);
10
+ }
11
+
12
+ // TODO: These h* declarations need to be moved somewhere not-terrible
13
+ :where(h1) {
14
+ font-size: calc(var(--w-text, 14px) * 3.125);
15
+ line-height: 1.2;
16
+ }
17
+
18
+ :where(h2) {
19
+ font-size: calc(var(--w-text, 14px) * 2.625);
20
+ font-weight: 625;
21
+ line-height: 1.1;
22
+ }
23
+
24
+ :where(h3) {
25
+ font-size: calc(var(--w-text, 14px) * 1.625);
26
+ line-height: 1.1;
27
+ }
28
+
29
+ :where(h4) {
30
+ font-size: calc(var(--w-text, 14px) * 1.25);
31
+ line-height: 1.1;
32
+ margin: calc(var(--w-gutter, 16px) * 0.5) 0;
33
+ }
34
+
35
+ :where(h5) {
36
+ font-size: var(--w-text, 14px);
37
+ line-height: 1.2;
38
+ }
39
+
40
+ :where(h6) {
41
+ font-size: calc(var(--w-text, 14px) * 0.875);
42
+ line-height: 1.2;
43
+ font-weight: 600;
44
+ }
45
+
46
+ :where(p) {
47
+ font-style: normal;
48
+ font-size: var(--w-text, 14px);
49
+ line-height: 1.5;
50
+ margin: 0;
51
+ }
52
+
53
+ @include u.breakpoint(mobileMax) {
54
+ :where(h4) {
55
+ font-size: var(--w-text, 14px);
56
+ }
57
+
58
+ :where(p) {
59
+ font-size: calc(var(--w-text, 14px) * 0.875);
60
+ }
61
+ }
7
62
  }
@@ -1 +1 @@
1
- ._dots_1w7tl_1{aspect-ratio:1;width:var(--_l5w);margin:0 var(--_l5w2);border-radius:50%;animation:1s linear infinite alternate _l5_1w7tl_1}@keyframes _l5_1w7tl_1{0%{box-shadow:var(--_l5w2) 0 var(--_l5c), var(--_l5w3) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%);background:var(--_l5c)}33%{box-shadow:var(--_l5w2) 0 var(--_l5c), var(--_l5w3) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%);background:color-mix(in srgb, var(--_l5c) 80%, white 75%)}66%{box-shadow:var(--_l5w2) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%), var(--_l5w3) 0 var(--_l5c);background:color-mix(in srgb, var(--_l5c) 80%, white 75%)}to{box-shadow:var(--_l5w2) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%), var(--_l5w3) 0 var(--_l5c);background:var(--_l5c)}}@keyframes _l3_1w7tl_1{to{transform:rotate(1turn)}}._dots-trace_1w7tl_41{width:var(--_dtw);aspect-ratio:4;background:radial-gradient(circle closest-side, var(--_dtc) 90%, #0000) 0/33.3333% 100% space;clip-path:inset(0 100% 0 0);animation:1s steps(4,end) infinite _l1_1w7tl_1}@keyframes _l1_1w7tl_1{to{clip-path:inset(0 -34% 0 0)}}._dots-orbit_1w7tl_54{width:var(--_dow);aspect-ratio:1;background:var(--_doc);border-radius:50%;animation:2s linear infinite _l22-0_1w7tl_1;display:grid}._dots-orbit_1w7tl_54:before,._dots-orbit_1w7tl_54:after{content:"";background:inherit;border-radius:50%;grid-area:1/1;margin:15%;animation:1s infinite _l22_1w7tl_1;transform:rotate(0)translate(150%)}._dots-orbit_1w7tl_54:after{animation-delay:-.5s}@keyframes _l22-0_1w7tl_1{to{transform:rotate(1turn)}}@keyframes _l22_1w7tl_1{to{transform:rotate(1turn)translate(150%)}}._dashes_1w7tl_85{width:var(--_dshw);height:calc(var(--_dshw) * .3);background:linear-gradient(var(--_dshc) 0 0) left/var(--_dshw2) 4px, linear-gradient(var(--_dshc) 0 0) center/var(--_dshw2) 4px, linear-gradient(var(--_dshc) 0 0) right/var(--_dshw2) 4px;background-repeat:no-repeat;animation:1s linear infinite _dashes_1w7tl_85}@keyframes _dashes_1w7tl_85{0%{background-size:var(--_dshw2) 4px, var(--_dshw2) 4px, var(--_dshw2) 4px;opacity:1}33%{background-size:var(--_dshw2) var(--_dshw2), var(--_dshw2) 4px, var(--_dshw2) 4px;opacity:.7}66%{background-size:var(--_dshw2) 4px, var(--_dshw2) var(--_dshw2), var(--_dshw2) 4px;opacity:.7}to{background-size:var(--_dshw2) 4px, var(--_dshw2) 4px, var(--_dshw2) var(--_dshw2);opacity:1}}._spinner_1w7tl_111{width:var(--_spnw);aspect-ratio:1;border:var(--_spnw2) solid color-mix(in srgb, var(--_spnc) 20%, transparent);border-right-color:var(--_spnc);border-radius:50%;animation:1s linear infinite _l2_1w7tl_1}@keyframes _l2_1w7tl_1{to{transform:rotate(1turn)}}._swirl_1w7tl_125{width:var(--_swrlw);padding:var(--_swrlw2);aspect-ratio:1;background:var(--_swrlc);--_m:conic-gradient(#0000 10%,#000), linear-gradient(#000 0 0) content-box;-webkit-mask:var(--_m);-webkit-mask:var(--_m);mask:var(--_m);-webkit-mask-composite:source-out;border-radius:50%;animation:1s linear infinite _l3_1w7tl_1;-webkit-mask-composite:source-out;mask-composite:subtract}._ball_1w7tl_146{width:var(--_ballw);aspect-ratio:1;background:radial-gradient(farthest-side, var(--_ballc) 95%, #0000) 50% 1px/var(--_ballw2) var(--_ballw2) no-repeat, radial-gradient(farthest-side, #0000 calc(100% - var(--_ballw2)), #ccc 0);border-radius:50%;animation:2s linear infinite _l9_1w7tl_1}@keyframes _l9_1w7tl_1{to{transform:rotate(1turn)}}._boxy_1w7tl_159{width:var(--_boxw);height:var(--_boxw2);background:linear-gradient(var(--_boxc) 0 0) left -25% top 0/20% 100% no-repeat #ddd;animation:1s steps(6,end) infinite _l7_1w7tl_1;-webkit-mask:linear-gradient(90deg,#000 70%,#0000 0) 0/20% 100%}@keyframes _l7_1w7tl_1{to{background-position:right -25% top 0}}
1
+ @layer craftsman-base{._dots_mugu5_2{aspect-ratio:1;width:var(--_l5w);margin:0 var(--_l5w2);border-radius:50%;animation:1s linear infinite alternate _l5_mugu5_1}@keyframes _l5_mugu5_1{0%{box-shadow:var(--_l5w2) 0 var(--_l5c), var(--_l5w3) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%);background:var(--_l5c)}33%{box-shadow:var(--_l5w2) 0 var(--_l5c), var(--_l5w3) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%);background:color-mix(in srgb, var(--_l5c) 80%, white 75%)}66%{box-shadow:var(--_l5w2) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%), var(--_l5w3) 0 var(--_l5c);background:color-mix(in srgb, var(--_l5c) 80%, white 75%)}to{box-shadow:var(--_l5w2) 0 color-mix(in srgb, var(--_l5c) 80%, white 75%), var(--_l5w3) 0 var(--_l5c);background:var(--_l5c)}}@keyframes _l3_mugu5_1{to{transform:rotate(1turn)}}._dots-trace_mugu5_41{width:var(--_dtw);aspect-ratio:4;background:radial-gradient(circle closest-side, var(--_dtc) 90%, #0000) 0/33.3333% 100% space;clip-path:inset(0 100% 0 0);animation:1s steps(4,end) infinite _l1_mugu5_1}@keyframes _l1_mugu5_1{to{clip-path:inset(0 -34% 0 0)}}._dots-orbit_mugu5_53{width:var(--_dow);aspect-ratio:1;background:var(--_doc);border-radius:50%;animation:2s linear infinite _l22-0_mugu5_1;display:grid}._dots-orbit_mugu5_53:before,._dots-orbit_mugu5_53:after{content:"";background:inherit;border-radius:50%;grid-area:1/1;margin:15%;animation:1s infinite _l22_mugu5_1;transform:rotate(0)translate(150%)}._dots-orbit_mugu5_53:after{animation-delay:-.5s}@keyframes _l22-0_mugu5_1{to{transform:rotate(1turn)}}@keyframes _l22_mugu5_1{to{transform:rotate(1turn)translate(150%)}}._dashes_mugu5_83{width:var(--_dshw);height:calc(var(--_dshw) * .3);background:linear-gradient(var(--_dshc) 0 0) left/var(--_dshw2) 4px, linear-gradient(var(--_dshc) 0 0) center/var(--_dshw2) 4px, linear-gradient(var(--_dshc) 0 0) right/var(--_dshw2) 4px;background-repeat:no-repeat;animation:1s linear infinite _dashes_mugu5_83}@keyframes _dashes_mugu5_83{0%{background-size:var(--_dshw2) 4px, var(--_dshw2) 4px, var(--_dshw2) 4px;opacity:1}33%{background-size:var(--_dshw2) var(--_dshw2), var(--_dshw2) 4px, var(--_dshw2) 4px;opacity:.7}66%{background-size:var(--_dshw2) 4px, var(--_dshw2) var(--_dshw2), var(--_dshw2) 4px;opacity:.7}to{background-size:var(--_dshw2) 4px, var(--_dshw2) 4px, var(--_dshw2) var(--_dshw2);opacity:1}}._spinner_mugu5_108{width:var(--_spnw);aspect-ratio:1;border:var(--_spnw2) solid color-mix(in srgb, var(--_spnc) 20%, transparent);border-right-color:var(--_spnc);border-radius:50%;animation:1s linear infinite _l2_mugu5_1}@keyframes _l2_mugu5_1{to{transform:rotate(1turn)}}._swirl_mugu5_121{width:var(--_swrlw);padding:var(--_swrlw2);aspect-ratio:1;background:var(--_swrlc);--_m:conic-gradient(#0000 10%,#000), linear-gradient(#000 0 0) content-box;-webkit-mask:var(--_m);-webkit-mask:var(--_m);mask:var(--_m);-webkit-mask-composite:source-out;border-radius:50%;animation:1s linear infinite _l3_mugu5_1;-webkit-mask-composite:source-out;mask-composite:subtract}._ball_mugu5_141{width:var(--_ballw);aspect-ratio:1;background:radial-gradient(farthest-side, var(--_ballc) 95%, #0000) 50% 1px/var(--_ballw2) var(--_ballw2) no-repeat, radial-gradient(farthest-side, #0000 calc(100% - var(--_ballw2)), #ccc 0);border-radius:50%;animation:2s linear infinite _l9_mugu5_1}@keyframes _l9_mugu5_1{to{transform:rotate(1turn)}}._boxy_mugu5_153{width:var(--_boxw);height:var(--_boxw2);background:linear-gradient(var(--_boxc) 0 0) left -25% top 0/20% 100% no-repeat #ddd;animation:1s steps(6,end) infinite _l7_mugu5_1;-webkit-mask:linear-gradient(90deg,#000 70%,#0000 0) 0/20% 100%}@keyframes _l7_mugu5_1{to{background-position:right -25% top 0}}}
@@ -1,5 +1,5 @@
1
1
  import './loaders.module.css';//#region src/styles/global/components/loaders.module.scss
2
- var e = "_dots_1w7tl_1", t = "_l5_1w7tl_1", n = "_dots-trace_1w7tl_41", r = "_l1_1w7tl_1", i = "_dots-orbit_1w7tl_54", a = "_l22-0_1w7tl_1", o = "_l22_1w7tl_1", s = "_dashes_1w7tl_85", c = "_spinner_1w7tl_111", l = "_l2_1w7tl_1", u = "_swirl_1w7tl_125", d = "_l3_1w7tl_1", f = "_ball_1w7tl_146", p = "_l9_1w7tl_1", m = "_boxy_1w7tl_159", h = "_l7_1w7tl_1", g = {
2
+ var e = "_dots_mugu5_2", t = "_l5_mugu5_1", n = "_dots-trace_mugu5_41", r = "_l1_mugu5_1", i = "_dots-orbit_mugu5_53", a = "_l22-0_mugu5_1", o = "_l22_mugu5_1", s = "_dashes_mugu5_83", c = "_spinner_mugu5_108", l = "_l2_mugu5_1", u = "_swirl_mugu5_121", d = "_l3_mugu5_1", f = "_ball_mugu5_141", p = "_l9_mugu5_1", m = "_boxy_mugu5_153", h = "_l7_mugu5_1", g = {
3
3
  dots: e,
4
4
  l5: t,
5
5
  dotsTrace: n,
@@ -1,3 +1,4 @@
1
+ @layer craftsman-base {
1
2
  .dots {
2
3
  aspect-ratio: 1;
3
4
  border-radius: 50%;
@@ -243,4 +244,4 @@
243
244
  // 0%,70% {transform:translate(0)}
244
245
  // 100% {transform:translate(200%)}
245
246
  // }
246
-
247
+ }
@@ -0,0 +1,3 @@
1
+ import { default as styles } from './globalStyles.module.scss';
2
+ export declare const globalStyles: CSSModuleClasses;
3
+ export default styles;
@@ -0,0 +1 @@
1
+ @use "./globalStyles.scss";
@@ -1,11 +1,14 @@
1
+ @use "../config";
1
2
  @use "./components/typography";
2
3
  @use "./components/code";
3
- @use "./components/mixins" as mixins;
4
4
  @use "./components/checkbox";
5
5
  @use "./components/radioButton";
6
6
  @use "./components/button";
7
7
  @use "./components/input";
8
8
 
9
+ @layer craftsman-base, craftsman-theme;
10
+
11
+ @layer craftsman-base {
9
12
  :root {
10
13
  color-scheme: light dark;
11
14
  font-synthesis: none;
@@ -31,17 +34,13 @@
31
34
  ::-webkit-scrollbar-thumb:hover {
32
35
  background: #555;
33
36
  }
34
-
35
- body {
36
- @extend %body-typography;
37
- }
38
- body,
39
- ul {
37
+ body, ul {
40
38
  margin: 0;
41
39
  padding: 0;
42
40
  }
43
41
 
44
42
  body {
43
+ @extend %body-typography;
45
44
  background-color: #fff;
46
45
  -webkit-overflow-scrolling: touch;
47
46
  overscroll-behavior: contain;
@@ -61,67 +60,23 @@ button {
61
60
  }
62
61
 
63
62
  input {
64
- @extend %input-base;
65
-
66
- &[type="radio"] {
67
- @extend %radio;
63
+ &:not([type="radio"]):not([type="checkbox"]) {
64
+ @extend %input-base;
68
65
  }
69
-
70
66
  &[type="checkbox"] {
71
- @extend %checkbox;
67
+ @extend %checkbox;
72
68
  }
73
- }
74
-
75
- a {
76
- @extend %text-link;
77
- }
78
-
79
- h1 {
80
- font-size: calc(var(--w-text, 14px) * 3.125);
81
- line-height: 1.2;
82
- }
83
69
 
84
- h2 {
85
- font-size: calc(var(--w-text, 14px) * 2.625);
86
- font-weight: 625;
87
- line-height: 1.1;
88
- }
89
-
90
- h3 {
91
- font-size: calc(var(--w-text, 14px) * 1.625);
92
- line-height: 1.1;
93
- }
94
-
95
- h4 {
96
- font-size: calc(var(--w-text, 14px) * 1.25);
97
- line-height: 1.1;
98
- margin: calc(var(--w-gutter, 16px) * 0.5) 0;
99
- }
100
-
101
- h5 {
102
- font-size: var(--w-text, 14px);
103
- line-height: 1.2;
70
+ &[type="radio"] {
71
+ @extend %radio;
72
+ }
104
73
  }
105
-
106
- h6 {
107
- font-size: calc(var(--w-text, 14px) * 0.875);
108
- line-height: 1.2;
109
- font-weight: 600;
74
+ textarea {
75
+ @extend %input-base;
110
76
  }
111
77
 
112
- p {
113
- font-style: normal;
114
- font-size: var(--w-text, 14px);
115
- line-height: 1.5;
116
- margin: 0;
78
+ a {
79
+ @extend %text-link;
117
80
  }
118
81
 
119
- @media (max-width: 659.99999px) {
120
- h4 {
121
- font-size: var(--w-text, 14px);
122
- }
123
-
124
- p {
125
- font-size: calc(var(--w-text, 14px) * 0.875);
126
- }
127
82
  }
@@ -1,6 +1,6 @@
1
1
  export * from './utilities/color';
2
2
  export * from './utilities/constants';
3
3
  export * from './utilities/layout';
4
- export * from './utilities/types';
4
+ export * from '../utilities/types';
5
5
  export * from './theme/theme';
6
6
  export { ThemeProvider } from './components/ThemeProvider';
@@ -1,12 +1,18 @@
1
1
  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
- function n(e) {
4
+ var n = {
5
+ button: "button",
6
+ input: "input:not([type='radio']):not([type='checkbox'])",
7
+ checkbox: "input[type='checkbox']",
8
+ radioButton: "input[type='radio']"
9
+ };
10
+ function r(e) {
5
11
  return e.charAt(0).toLowerCase() + e.slice(1);
6
12
  }
7
- function r(t) {
8
- return e.has(t) ? `${t}, .${t}` : `.${t}`;
13
+ function i(t) {
14
+ return n[t] || (e.has(t) ? `${t}, .${t}` : `.${t}`);
9
15
  }
10
- var i = Object.keys(t).map(n), a = Object.fromEntries(i.map((e) => [e, r(e)]));
16
+ var a = Object.keys(t).map(r), o = Object.fromEntries(a.map((e) => [e, i(e)]));
11
17
  //#endregion
12
- export { a as componentSelectors };
18
+ export { o as componentSelectors };
@@ -2,54 +2,44 @@ import { componentSelectors as e } from "./components.esm.js";
2
2
  import { cssObjectToCssText as t, toCSSObject as n } from "./utilities.esm.js";
3
3
  import { colors as r, widths as i } from "../global/variables.esm.js";
4
4
  //#region src/styles/theme/theme.ts
5
- var a = /* @__PURE__ */ new Map();
6
- function o(e) {
7
- if (typeof document > "u") return;
8
- let t = `.${e}`, n = {}, r = !1, i = (e) => {
9
- for (let a of Array.from(e)) {
10
- if (a instanceof CSSStyleRule) {
11
- if (!a.selectorText.split(",").map((e) => e.trim()).includes(t)) continue;
12
- r = !0;
13
- for (let e of Array.from(a.style)) n[e] = a.style.getPropertyValue(e);
14
- continue;
15
- }
16
- a instanceof CSSGroupingRule && i(a.cssRules);
5
+ function a(e) {
6
+ if (e) {
7
+ if (typeof e == "string") {
8
+ let t = e.trim();
9
+ return t.includes("{") ? t : `:root { ${t} }`;
17
10
  }
18
- };
19
- for (let e of Array.from(document.styleSheets)) try {
20
- e.cssRules && i(e.cssRules);
21
- } catch {}
22
- return r ? n : void 0;
11
+ return t(":root", n(e));
12
+ }
23
13
  }
24
- function s(e) {
25
- if (a.has(e)) return a.get(e) ?? void 0;
26
- let t = o(e);
27
- return a.set(e, t ?? null), t;
14
+ function o(e, r) {
15
+ if (typeof r == "string") {
16
+ let t = r.trim();
17
+ return t.includes("{") ? t : `${e} { ${t} }`;
18
+ }
19
+ return t(e, n(r));
28
20
  }
29
- function c(r) {
30
- let i = [];
31
- return Object.keys(e).forEach((a) => {
32
- let o = r?.[a];
33
- if (o) {
34
- if (typeof o == "string") {
35
- let n = s(o);
36
- if (!n) return;
37
- i.push(t(e[a], n));
38
- return;
39
- }
40
- i.push(t(e[a], n(o)));
41
- }
42
- }), i;
21
+ function s(t) {
22
+ return Object.keys(e).map((n) => {
23
+ let r = t?.[n];
24
+ return r ? o(e[n], r) : void 0;
25
+ }).filter((e) => !!e);
26
+ }
27
+ function c(e) {
28
+ if (!(!e || Object.keys(e).length === 0)) return `:root { ${Object.entries(e).map(([e, t]) => `--w-${e}: ${t}px;`).join(" ")} }`;
43
29
  }
44
30
  function l(e) {
45
- let a = t(":root", {
46
- ...e.colors || {},
47
- ...e.root ? n(e.root) : {}
48
- });
31
+ let n = [
32
+ t(":root", { ...e.colors || {} }),
33
+ c(e.widths),
34
+ a(e.root),
35
+ ...s(e.components)
36
+ ].filter(Boolean).join("\n");
49
37
  return [
50
38
  `:root { ${i} ${r} }`,
51
- a,
52
- ...c(e.components)
39
+ "@layer craftsman-base, craftsman-theme;",
40
+ "@layer craftsman-theme {",
41
+ n,
42
+ "}"
53
43
  ].filter(Boolean).join("\n");
54
44
  }
55
45
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { ColorKey } from '../utilities/color';
2
2
  import { componentSelectors } from './components';
3
+ import { LayoutWidthsType } from '../../utilities/types';
3
4
  export type ColorVariableName = `--${ColorKey}`;
4
5
  export type CSSObject = {
5
6
  [key: string]: string | number | CSSObject | undefined;
@@ -14,9 +15,11 @@ export type ComponentThemeOverrides = {
14
15
  [K in RegisteredComponent]?: CSSObject | LegacySerializedStyles | string;
15
16
  };
16
17
  export type Colors = Partial<Record<ColorVariableName, string>>;
18
+ export type WidthOverrides = Partial<Record<LayoutWidthsType, number>>;
17
19
  export type Theme = {
18
20
  colors?: Colors;
19
- root?: CSSObject | LegacySerializedStyles;
21
+ widths?: WidthOverrides;
22
+ root?: CSSObject | LegacySerializedStyles | string;
20
23
  components?: ComponentThemeOverrides;
21
24
  };
22
25
  export type ThemeProviderProps = {
@@ -0,0 +1,117 @@
1
+ @use "sass:map";
2
+ @use "sass:string";
3
+ @use "../config" as cfg;
4
+
5
+ $width-defaults: (
6
+ text: cfg.$w-text,
7
+ gutter: cfg.$w-gutter,
8
+ column: cfg.$w-column,
9
+ mobileMax: cfg.$bp-mobileMax,
10
+ tablet: cfg.$bp-tablet,
11
+ tabletMax: cfg.$bp-tabletMax,
12
+ desktop: cfg.$bp-desktop,
13
+ desktopMax: cfg.$bp-desktopMax,
14
+ extDesktop: cfg.$bp-extDesktop,
15
+ );
16
+
17
+ @function color($name, $type: hex, $alpha: 1) {
18
+ @if $type == rgba {
19
+ @return string.unquote("rgb(from var(--#{$name}) r g b / #{$alpha})");
20
+ }
21
+
22
+ @return string.unquote("var(--#{$name})");
23
+ }
24
+
25
+ @function width-var($name) {
26
+ @if not map.has-key($width-defaults, $name) {
27
+ @error "Unknown width key `#{$name}`.";
28
+ }
29
+
30
+ $fallback: map.get($width-defaults, $name);
31
+ @return string.unquote("var(--w-#{$name}, #{$fallback}px)");
32
+ }
33
+
34
+ @function width($name, $multiplier: 1, $px: true) {
35
+ $value: width-var($name);
36
+
37
+ @if $name == column {
38
+ $gutter-steps: $multiplier - 1;
39
+ $gutter: width-var(gutter);
40
+
41
+ @if $px {
42
+ @return string.unquote("calc((#{$value} * #{$multiplier}) + (#{$gutter} * #{$gutter-steps}))");
43
+ }
44
+
45
+ @return string.unquote("calc((#{$value} * #{$multiplier}) + (#{$gutter} * #{$gutter-steps}))");
46
+ }
47
+
48
+ @if $px {
49
+ @if $multiplier == 1 {
50
+ @return $value;
51
+ }
52
+
53
+ @return string.unquote("calc(#{$value} * #{$multiplier})");
54
+ }
55
+
56
+ @if $multiplier == 1 {
57
+ @return string.unquote("#{$value}");
58
+ }
59
+
60
+ @return string.unquote("calc(#{$value} * #{$multiplier})");
61
+ }
62
+
63
+ @function media($bp) {
64
+ @if $bp == mobile {
65
+ @return string.unquote("(min-width: 0px)");
66
+ }
67
+
68
+ @if $bp == mobileMax {
69
+ @return string.unquote("(max-width: #{cfg.$bp-mobileMax}px)");
70
+ }
71
+
72
+ @if $bp == tablet {
73
+ @return string.unquote("(min-width: #{cfg.$bp-tablet}px)");
74
+ }
75
+
76
+ @if $bp == tabletMax {
77
+ @return string.unquote("(max-width: #{cfg.$bp-tabletMax}px)");
78
+ }
79
+
80
+ @if $bp == desktop {
81
+ @return string.unquote("(min-width: #{cfg.$bp-desktop}px)");
82
+ }
83
+
84
+ @if $bp == desktopMax {
85
+ @return string.unquote("(max-width: #{cfg.$bp-desktopMax}px)");
86
+ }
87
+
88
+ @if $bp == extDesktop {
89
+ @return string.unquote("(min-width: #{cfg.$bp-extDesktop}px)");
90
+ }
91
+
92
+ @if $bp == mobileOnly {
93
+ @return string.unquote("(min-width: 0px) and (max-width: #{cfg.$bp-mobileMax}px)");
94
+ }
95
+
96
+ @if $bp == tabletOnly {
97
+ @return string.unquote("(min-width: #{cfg.$bp-tablet}px) and (max-width: #{cfg.$bp-tabletMax}px)");
98
+ }
99
+
100
+ @if $bp == mobileTablet {
101
+ @return string.unquote("(min-width: 0px) and (max-width: #{cfg.$bp-tabletMax}px)");
102
+ }
103
+
104
+ @if $bp == desktopOnly {
105
+ @return string.unquote("(min-width: #{cfg.$bp-desktop}px) and (max-width: #{cfg.$bp-desktopMax}px)");
106
+ }
107
+
108
+ @error "Unknown breakpoint `#{$bp}`.";
109
+ }
110
+
111
+ @mixin breakpoint($bp) {
112
+ @media #{media($bp)} {
113
+ @content;
114
+ }
115
+ }
116
+
117
+
File without changes
@@ -1,4 +1,4 @@
1
- import { ColorType } from './types';
1
+ import { ColorType } from '../../utilities/types';
2
2
  export declare const colors: {
3
3
  red990: string;
4
4
  red950: string;
@@ -1,4 +1,4 @@
1
- import { LayoutWidthsType } from './types';
1
+ import { LayoutWidthsType } from '../../utilities/types';
2
2
  export declare const defaultColors: {
3
3
  red990: string;
4
4
  red950: string;
@@ -1,4 +1,4 @@
1
- import { Breakpoint, LayoutWidthsType } from './types';
1
+ import { Breakpoint, LayoutWidthsType } from '../../utilities/types';
2
2
  export declare const widths: Record<LayoutWidthsType, string>;
3
3
  export declare const media: {
4
4
  readonly mobile: string;
@@ -1,5 +1,5 @@
1
1
  import { defaultWidths as e } from "./constants.esm.js";
2
- import { LayoutWidthsSchema as t } from "./types.esm.js";
2
+ import { LayoutWidthsSchema as t } from "../../utilities/types.esm.js";
3
3
  //#region src/styles/utilities/layout.ts
4
4
  var n = Object.fromEntries(t.options.map((t) => [t, `var(--w-${t}, ${e[t]}px)`])), r = {
5
5
  get mobile() {
@@ -26,7 +26,6 @@ export declare const BreakpointSchema: z.ZodEnum<{
26
26
  desktopOnly: "desktopOnly";
27
27
  }>;
28
28
  export declare const LayoutWidthsSchema: z.ZodEnum<{
29
- text: "text";
30
29
  gutter: "gutter";
31
30
  column: "column";
32
31
  tablet: "tablet";
@@ -35,6 +34,7 @@ export declare const LayoutWidthsSchema: z.ZodEnum<{
35
34
  mobileMax: "mobileMax";
36
35
  tabletMax: "tabletMax";
37
36
  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>;
@@ -83,3 +83,9 @@ export declare const zLabelPosition: z.ZodEnum<{
83
83
  inside: "inside";
84
84
  }>;
85
85
  export type LabelPosition = z.infer<typeof zLabelPosition>;
86
+ export declare const ButtonType: z.ZodEnum<{
87
+ text: "text";
88
+ primary: "primary";
89
+ default: "default";
90
+ }>;
91
+ export type ButtonType = z.infer<typeof ButtonType>;
@@ -1,5 +1,5 @@
1
1
  import e from "zod";
2
- //#region src/styles/utilities/types.ts
2
+ //#region src/utilities/types.ts
3
3
  var t = e.enum(["gutter", "column"]), n = e.enum([
4
4
  "tablet",
5
5
  "desktop",
@@ -49,6 +49,10 @@ var t = e.enum(["gutter", "column"]), n = e.enum([
49
49
  "right",
50
50
  "inside",
51
51
  "hidden"
52
+ ]), u = e.enum([
53
+ "primary",
54
+ "default",
55
+ "text"
52
56
  ]);
53
57
  //#endregion
54
- export { t as BaseWidthSchema, i as BreakpointSchema, a as LayoutWidthsSchema, r as MaxScreenWidthSchema, n as ScreenWidthSchema, l as zLabelPosition, o as zTextInputExclusions, c as zTextInputType, s as zTextInputTypes };
58
+ export { t as BaseWidthSchema, i as BreakpointSchema, u as ButtonType, a as LayoutWidthsSchema, r as MaxScreenWidthSchema, n as ScreenWidthSchema, l as zLabelPosition, o as zTextInputExclusions, c as zTextInputType, s as zTextInputTypes };
@@ -1 +0,0 @@
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)}
@@ -1,9 +0,0 @@
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 };
@@ -1,5 +0,0 @@
1
- @use "../styles/global/components/button";
2
-
3
- .button {
4
- @extend %button-styles;
5
- }
@@ -1,11 +0,0 @@
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,41 +0,0 @@
1
- "use client";
2
- import { isEmpty as e } from "../utilities/validations.esm.js";
3
- import t from "./Input.module.esm.js";
4
- import n from "clsx";
5
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
- import { useId as a } from "react";
7
- //#region src/components/Input.tsx
8
- 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 }) => {
9
- let _ = a(), v = s || _, y = !e(g.value) || !e(g.defaultValue), b = e(f) ? void 0 : f, x = /* @__PURE__ */ i("span", {
10
- className: t.inputField,
11
- "data-has-end-adornment": !e(h),
12
- children: [/* @__PURE__ */ r("input", {
13
- id: v,
14
- type: u,
15
- className: t.input,
16
- ...g
17
- }), !e(h) && /* @__PURE__ */ r("span", {
18
- className: t.inputAdornment,
19
- children: h
20
- })]
21
- });
22
- return /* @__PURE__ */ i("div", {
23
- "data-label-position": c,
24
- "data-required": l,
25
- "data-has-input": y,
26
- className: n(t.wrapper, p),
27
- style: {
28
- ...b,
29
- ...m
30
- },
31
- children: [e(o) ? x : /* @__PURE__ */ i("label", { children: [c !== "hidden" && /* @__PURE__ */ r("div", {
32
- className: t.inputLabel,
33
- children: o
34
- }), x] }), !e(d) && /* @__PURE__ */ r("div", {
35
- className: t.error,
36
- children: d
37
- })]
38
- });
39
- };
40
- //#endregion
41
- export { o as Input };
@@ -1 +0,0 @@
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)}