@stamcat/craftsman 0.0.31-beta.4 → 0.0.32

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 (48) 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.esm.js +70 -0
  10. package/src/components/Accordion/Accordion.scss +64 -0
  11. package/src/components/Carousel/{Carousel2.esm.js → Carousel.esm.js} +23 -23
  12. package/src/components/Checkbox/Checkbox.esm.js +1 -1
  13. package/src/components/DatePicker/DatePicker.css +1 -1
  14. package/src/components/DatePicker/DatePicker.esm.js +29 -0
  15. package/src/components/DateRangePicker/DateRangePicker.css +1 -1
  16. package/src/components/DateRangePicker/{DateRangePicker2.esm.js → DateRangePicker.esm.js} +12 -12
  17. package/src/components/DateTimePicker/DateTimePicker.css +1 -1
  18. package/src/components/DateTimePicker/{DateTimePicker2.esm.js → DateTimePicker.esm.js} +16 -16
  19. package/src/components/Input/Input.css +1 -1
  20. package/src/components/Input/{Input2.esm.js → Input.esm.js} +10 -10
  21. package/src/components/Input/Input.scss +7 -0
  22. package/src/components/Input/InputWrapper.esm.js +1 -1
  23. package/src/components/InputNumber/{InputNumber2.esm.js → InputNumber.esm.js} +12 -12
  24. package/src/components/InputPassword/InputPassword.esm.js +10 -10
  25. package/src/components/InputPhone/{InputPhone2.esm.js → InputPhone.esm.js} +8 -8
  26. package/src/components/Loader/Loader.esm.js +1 -1
  27. package/src/components/Modal/{Modal2.esm.js → Modal.esm.js} +16 -16
  28. package/src/components/Notice/{Notice2.esm.js → Notice.esm.js} +2 -2
  29. package/src/components/Pagination/{Pagination2.esm.js → Pagination.esm.js} +2 -2
  30. package/src/components/RadioButton/RadioButton.esm.js +1 -1
  31. package/src/components/Select/Select.esm.js +18 -17
  32. package/src/components/SortableList/ListItem.esm.js +8 -8
  33. package/src/components/SortableList/{SortableList2.esm.js → SortableList.esm.js} +9 -9
  34. package/src/components/Text/AGENTS.md +4 -2
  35. package/src/components/Text/{Text2.esm.js → Text.esm.js} +1 -1
  36. package/src/components/Textarea/Textarea.esm.js +5 -5
  37. package/src/components/TimePicker/TimePicker.css +1 -1
  38. package/src/components/TimePicker/{TimePicker2.esm.js → TimePicker.esm.js} +16 -16
  39. package/src/components/TimePicker/TimePickerDisplay.esm.js +1 -1
  40. package/src/components/TimePicker/TimePickerWheel.esm.js +15 -15
  41. package/src/components/Toggle/{Toggle2.esm.js → Toggle.esm.js} +2 -2
  42. package/src/components/Tooltip/{Tooltip2.esm.js → Tooltip.esm.js} +13 -13
  43. package/src/components/index.d.ts +1 -0
  44. package/src/styles/global/components/_input.scss +8 -9
  45. package/src/styles/global/components/_select.scss +11 -16
  46. package/src/utilities/types.d.ts +14 -14
  47. package/src/components/DatePicker/DatePicker2.esm.js +0 -29
  48. /package/src/components/Loader/{loaders.module.esm.js → loaders.module.style.esm.js} +0 -0
package/AGENTS.md CHANGED
@@ -13,6 +13,7 @@ Full guidance has been split out for progressive loading:
13
13
  Use these imports:
14
14
 
15
15
  ```tsx
16
+ import { Accordion } from "@stamcat/craftsman/Accordion";
16
17
  import { Button } from "@stamcat/craftsman/Button";
17
18
  import { Carousel } from "@stamcat/craftsman/Carousel";
18
19
  import { Checkbox } from "@stamcat/craftsman/Checkbox";
package/Components.esm.js CHANGED
@@ -1,81 +1,83 @@
1
1
  import { __exportAll as e } from "./_virtual/_rolldown/runtime.esm.js";
2
- import { Button as t } from "./src/components/Button/Button.esm.js";
3
- import { Input as n } from "./src/components/Input/Input2.esm.js";
4
- import { InputPassword as r } from "./src/components/InputPassword/InputPassword.esm.js";
5
- import { Loader as i } from "./src/components/Loader/Loader.esm.js";
6
- import { RadioButton as a } from "./src/components/RadioButton/RadioButton.esm.js";
7
- import { Checkbox as o } from "./src/components/Checkbox/Checkbox.esm.js";
8
- import { Textarea as s } from "./src/components/Textarea/Textarea.esm.js";
9
- import { Text as c } from "./src/components/Text/Text2.esm.js";
10
- import { Modal as l } from "./src/components/Modal/Modal2.esm.js";
11
- import { Select as u } from "./src/components/Select/Select.esm.js";
12
- import { DatePicker as d } from "./src/components/DatePicker/DatePicker2.esm.js";
13
- import { DateRangePicker as f } from "./src/components/DateRangePicker/DateRangePicker2.esm.js";
14
- import { InputPhone as p } from "./src/components/InputPhone/InputPhone2.esm.js";
15
- import { InputNumber as m } from "./src/components/InputNumber/InputNumber2.esm.js";
16
- import { Toggle as h } from "./src/components/Toggle/Toggle2.esm.js";
17
- import { Pagination as g } from "./src/components/Pagination/Pagination2.esm.js";
18
- import { Carousel as _ } from "./src/components/Carousel/Carousel2.esm.js";
19
- import { TimePicker as v } from "./src/components/TimePicker/TimePicker2.esm.js";
20
- import { DateTimePicker as y } from "./src/components/DateTimePicker/DateTimePicker2.esm.js";
21
- import { Tooltip as b } from "./src/components/Tooltip/Tooltip2.esm.js";
22
- import { Notice as x } from "./src/components/Notice/Notice2.esm.js";
23
- import { SortableList as S } from "./src/components/SortableList/SortableList2.esm.js";
24
- import { IconAmazonPay as C } from "./src/components/Icons/IconAmazonPay.esm.js";
25
- import { IconAmex as w } from "./src/components/Icons/IconAmex.esm.js";
26
- import { IconApplePay as T } from "./src/components/Icons/IconApplePay.esm.js";
27
- import { IconDiscover as E } from "./src/components/Icons/IconDiscover.esm.js";
28
- import { IconGooglePay as D } from "./src/components/Icons/IconGooglePay.esm.js";
29
- import { IconMaestro as O } from "./src/components/Icons/IconMaestro.esm.js";
30
- import { IconMastercard as k } from "./src/components/Icons/IconMastercard.esm.js";
31
- import { IconPayPal as A } from "./src/components/Icons/IconPayPal.esm.js";
32
- import { IconSepa as j } from "./src/components/Icons/IconSepa.esm.js";
33
- import { IconShopPay as M } from "./src/components/Icons/IconShopPay.esm.js";
34
- import { IconSquare as N } from "./src/components/Icons/IconSquare.esm.js";
35
- import { IconStripe as P } from "./src/components/Icons/IconStripe.esm.js";
36
- import { IconUnionPay as F } from "./src/components/Icons/IconUnionPay.esm.js";
37
- import { IconVenmo as I } from "./src/components/Icons/IconVenmo.esm.js";
38
- import { IconVisa as L } from "./src/components/Icons/IconVisa.esm.js";
2
+ import { Accordion as t } from "./src/components/Accordion/Accordion.esm.js";
3
+ import { Button as n } from "./src/components/Button/Button.esm.js";
4
+ import { Input as r } from "./src/components/Input/Input.esm.js";
5
+ import { InputPassword as i } from "./src/components/InputPassword/InputPassword.esm.js";
6
+ import { Loader as a } from "./src/components/Loader/Loader.esm.js";
7
+ import { RadioButton as o } from "./src/components/RadioButton/RadioButton.esm.js";
8
+ import { Checkbox as s } from "./src/components/Checkbox/Checkbox.esm.js";
9
+ import { Textarea as c } from "./src/components/Textarea/Textarea.esm.js";
10
+ import { Text as l } from "./src/components/Text/Text.esm.js";
11
+ import { Modal as u } from "./src/components/Modal/Modal.esm.js";
12
+ import { Select as d } from "./src/components/Select/Select.esm.js";
13
+ import { DatePicker as f } from "./src/components/DatePicker/DatePicker.esm.js";
14
+ import { DateRangePicker as p } from "./src/components/DateRangePicker/DateRangePicker.esm.js";
15
+ import { InputPhone as m } from "./src/components/InputPhone/InputPhone.esm.js";
16
+ import { InputNumber as h } from "./src/components/InputNumber/InputNumber.esm.js";
17
+ import { Toggle as g } from "./src/components/Toggle/Toggle.esm.js";
18
+ import { Pagination as _ } from "./src/components/Pagination/Pagination.esm.js";
19
+ import { Carousel as v } from "./src/components/Carousel/Carousel.esm.js";
20
+ import { TimePicker as y } from "./src/components/TimePicker/TimePicker.esm.js";
21
+ import { DateTimePicker as b } from "./src/components/DateTimePicker/DateTimePicker.esm.js";
22
+ import { Tooltip as x } from "./src/components/Tooltip/Tooltip.esm.js";
23
+ import { Notice as S } from "./src/components/Notice/Notice.esm.js";
24
+ import { SortableList as C } from "./src/components/SortableList/SortableList.esm.js";
25
+ import { IconAmazonPay as w } from "./src/components/Icons/IconAmazonPay.esm.js";
26
+ import { IconAmex as T } from "./src/components/Icons/IconAmex.esm.js";
27
+ import { IconApplePay as E } from "./src/components/Icons/IconApplePay.esm.js";
28
+ import { IconDiscover as D } from "./src/components/Icons/IconDiscover.esm.js";
29
+ import { IconGooglePay as O } from "./src/components/Icons/IconGooglePay.esm.js";
30
+ import { IconMaestro as k } from "./src/components/Icons/IconMaestro.esm.js";
31
+ import { IconMastercard as A } from "./src/components/Icons/IconMastercard.esm.js";
32
+ import { IconPayPal as j } from "./src/components/Icons/IconPayPal.esm.js";
33
+ import { IconSepa as M } from "./src/components/Icons/IconSepa.esm.js";
34
+ import { IconShopPay as N } from "./src/components/Icons/IconShopPay.esm.js";
35
+ import { IconSquare as P } from "./src/components/Icons/IconSquare.esm.js";
36
+ import { IconStripe as F } from "./src/components/Icons/IconStripe.esm.js";
37
+ import { IconUnionPay as I } from "./src/components/Icons/IconUnionPay.esm.js";
38
+ import { IconVenmo as L } from "./src/components/Icons/IconVenmo.esm.js";
39
+ import { IconVisa as R } from "./src/components/Icons/IconVisa.esm.js";
39
40
  import "./src/components/Icons/index.esm.js";
40
41
  //#region src/components/index.ts
41
- var R = /* @__PURE__ */ e({
42
- Button: () => t,
43
- Carousel: () => _,
44
- Checkbox: () => o,
45
- DatePicker: () => d,
46
- DateRangePicker: () => f,
47
- DateTimePicker: () => y,
48
- IconAmazonPay: () => C,
49
- IconAmex: () => w,
50
- IconApplePay: () => T,
51
- IconDiscover: () => E,
52
- IconGooglePay: () => D,
53
- IconMaestro: () => O,
54
- IconMastercard: () => k,
55
- IconPayPal: () => A,
56
- IconSepa: () => j,
57
- IconShopPay: () => M,
58
- IconSquare: () => N,
59
- IconStripe: () => P,
60
- IconUnionPay: () => F,
61
- IconVenmo: () => I,
62
- IconVisa: () => L,
63
- Input: () => n,
64
- InputNumber: () => m,
65
- InputPassword: () => r,
66
- InputPhone: () => p,
67
- Loader: () => i,
68
- Modal: () => l,
69
- Notice: () => x,
70
- Pagination: () => g,
71
- RadioButton: () => a,
72
- Select: () => u,
73
- SortableList: () => S,
74
- Text: () => c,
75
- Textarea: () => s,
76
- TimePicker: () => v,
77
- Toggle: () => h,
78
- Tooltip: () => b
42
+ var z = /* @__PURE__ */ e({
43
+ Accordion: () => t,
44
+ Button: () => n,
45
+ Carousel: () => v,
46
+ Checkbox: () => s,
47
+ DatePicker: () => f,
48
+ DateRangePicker: () => p,
49
+ DateTimePicker: () => b,
50
+ IconAmazonPay: () => w,
51
+ IconAmex: () => T,
52
+ IconApplePay: () => E,
53
+ IconDiscover: () => D,
54
+ IconGooglePay: () => O,
55
+ IconMaestro: () => k,
56
+ IconMastercard: () => A,
57
+ IconPayPal: () => j,
58
+ IconSepa: () => M,
59
+ IconShopPay: () => N,
60
+ IconSquare: () => P,
61
+ IconStripe: () => F,
62
+ IconUnionPay: () => I,
63
+ IconVenmo: () => L,
64
+ IconVisa: () => R,
65
+ Input: () => r,
66
+ InputNumber: () => h,
67
+ InputPassword: () => i,
68
+ InputPhone: () => m,
69
+ Loader: () => a,
70
+ Modal: () => u,
71
+ Notice: () => S,
72
+ Pagination: () => _,
73
+ RadioButton: () => o,
74
+ Select: () => d,
75
+ SortableList: () => C,
76
+ Text: () => l,
77
+ Textarea: () => c,
78
+ TimePicker: () => y,
79
+ Toggle: () => g,
80
+ Tooltip: () => x
79
81
  });
80
82
  //#endregion
81
- export { t as Button, _ as Carousel, o as Checkbox, d as DatePicker, f as DateRangePicker, y as DateTimePicker, C as IconAmazonPay, w as IconAmex, T as IconApplePay, E as IconDiscover, D as IconGooglePay, O as IconMaestro, k as IconMastercard, A as IconPayPal, j as IconSepa, M as IconShopPay, N as IconSquare, P as IconStripe, F as IconUnionPay, I as IconVenmo, L as IconVisa, n as Input, m as InputNumber, r as InputPassword, p as InputPhone, i as Loader, l as Modal, x as Notice, g as Pagination, a as RadioButton, u as Select, S as SortableList, c as Text, s as Textarea, v as TimePicker, h as Toggle, b as Tooltip, R as components_exports };
83
+ export { t as Accordion, n as Button, v as Carousel, s as Checkbox, f as DatePicker, p as DateRangePicker, b as DateTimePicker, w as IconAmazonPay, T as IconAmex, E as IconApplePay, D as IconDiscover, O as IconGooglePay, k as IconMaestro, A as IconMastercard, j as IconPayPal, M as IconSepa, N as IconShopPay, P as IconSquare, F as IconStripe, I as IconUnionPay, L as IconVenmo, R as IconVisa, r as Input, h as InputNumber, i as InputPassword, m as InputPhone, a as Loader, u as Modal, S as Notice, _ as Pagination, o as RadioButton, d as Select, C as SortableList, l as Text, c as Textarea, y as TimePicker, g as Toggle, x as Tooltip, z as components_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamcat/craftsman",
3
- "version": "0.0.31-beta.4",
3
+ "version": "0.0.32",
4
4
  "type": "module",
5
5
  "description": "A powerful, lightweight framework for design systems",
6
6
  "repository": {
@@ -81,6 +81,10 @@
81
81
  "./styles/utilities/placeholders": {
82
82
  "default": "./src/styles/utilities/_placeholders.scss"
83
83
  },
84
+ "./Accordion": {
85
+ "types": "./src/components/Accordion/Accordion.d.ts",
86
+ "default": "./src/components/Accordion/Accordion.esm.js"
87
+ },
84
88
  "./Button": {
85
89
  "types": "./src/components/Button/Button.d.ts",
86
90
  "default": "./src/components/Button/Button.esm.js"
@@ -12,6 +12,7 @@ Global rules for AI agents generating code against `@stamcat/craftsman`. For a s
12
12
  The package is built with component-level entry points only.
13
13
 
14
14
  ```tsx
15
+ import { Accordion } from "@stamcat/craftsman/Accordion";
15
16
  import { Button } from "@stamcat/craftsman/Button";
16
17
  import { Carousel } from "@stamcat/craftsman/Carousel";
17
18
  import { Checkbox } from "@stamcat/craftsman/Checkbox";
@@ -51,6 +52,7 @@ Each entry links to the `AGENTS.md` co-located with that component's source for
51
52
 
52
53
  | Component | Docs |
53
54
  |---|---|
55
+ | Accordion | [../../src/components/Accordion/AGENTS.md](../../src/components/Accordion/AGENTS.md) |
54
56
  | Button | [../../src/components/Button/AGENTS.md](../../src/components/Button/AGENTS.md) |
55
57
  | Input | [../../src/components/Input/AGENTS.md](../../src/components/Input/AGENTS.md) |
56
58
  | InputPassword | [../../src/components/InputPassword/AGENTS.md](../../src/components/InputPassword/AGENTS.md) |
@@ -7,6 +7,48 @@ description: 'Styling conventions for @stamcat/craftsman — color()/width()/bre
7
7
 
8
8
  Styling rules for AI agents generating code against `@stamcat/craftsman`. For package exports, hard rules, and component contracts, see the [craftsman-component-usage skill](../craftsman-component-usage/SKILL.md). For non-styling utility functions (`isEmpty`), see the [craftsman-utility-functions skill](../craftsman-utility-functions/SKILL.md).
9
9
 
10
+ ## General Sass Guidance
11
+
12
+ When writing styles for more than 2 elements in an app that uses Sass, prefer a placeholder (`%placeholder` + `@extend`) over string concatenation to share the rule set.
13
+
14
+ Prefer one meaningful class name per component root and rely on HTML5 element semantics plus Sass nesting to style descendants — not every element needs its own `className`.
15
+
16
+ ```scss
17
+ // Preferred: one root class, nested element selectors
18
+ .card {
19
+ padding: #{u.width(gutter)};
20
+
21
+ h3 {
22
+ margin-bottom: #{u.width(gutter, 0.5)};
23
+ }
24
+
25
+ p {
26
+ color: #{u.color(gray500)};
27
+ }
28
+
29
+ button {
30
+ margin-top: #{u.width(gutter)};
31
+ }
32
+ }
33
+ ```
34
+
35
+ ```scss
36
+ // Avoid: a className on every descendant when nesting on semantic tags is sufficient
37
+ .card { }
38
+ .card-title { }
39
+ .card-body { }
40
+ .card-action { }
41
+ ```
42
+
43
+ Prefer resolving color and spacing through the `color()`/`width()` functions and mixins when the value is actually derived from a globally declared variable — for example, a width that is exactly half the declared gutter should use `width("gutter", 0.5)`. If a value isn't a derivation of a global variable (e.g. gutter is `16px` but a component needs `14px`), use the literal value directly rather than forcing it through a function.
44
+
45
+ Preferred page/layout pattern:
46
+
47
+ - Use one primary page/layout wrapper class and style semantic descendants via nesting (`> header`, `> main`, `> section`, etc.).
48
+ - Avoid adding class names to semantic sectioning elements only to mirror old style objects; prefer structural selectors first.
49
+ - Introduce small helper classes or placeholders only where they add clear value: repeated layout primitives (for example shared row/stack wrappers) or stateful/dynamic visual states.
50
+ - Keep the DOM semantic and minimal; avoid class-heavy markup when nested selectors can express the same styling.
51
+
10
52
  ## Sass Import Path (hard rule)
11
53
 
12
54
  Always `@use` the published subpath — never deep-import the source file directly.
@@ -119,6 +161,9 @@ Available breakpoint keys: `tablet` · `tabletMax` · `tabletOnly` · `desktop`
119
161
 
120
162
  - Breakpoint values come from `_config.scss` and stay in sync with any project overrides.
121
163
  - Never hard-code `@media (min-width: 1040px)` or similar — always use `breakpoint()` so values stay consistent with config.
164
+ - Prefer media query breakpoints over window resize event listeners for responsive design whenever possible.
165
+ - Responsive styling should be mobile-first (`min-width` breakpoints) whenever possible. Use `mobileOnly`/`mobileMax` only for outlier cases that require a mobile-specific exception.
166
+ - In apps using SCSS, use the `breakpoint` mixin (`@include u.breakpoint(key)`). In apps using JS styling, use the `breakpoint` function (`breakpoint(key, styles)` or `media.key` for raw queries).
122
167
 
123
168
  ## Styling Expectations
124
169
 
@@ -157,6 +202,13 @@ Do not compute `calc()` strings per-property in JS/TS (for example building a `p
157
202
 
158
203
  Valid `theme.widths` keys: `"text" | "gutter" | "column" | "tablet" | "desktop" | "extDesktop" | "mobileMax" | "tabletMax" | "desktopMax"`
159
204
 
205
+ ### Theme Authoring Usage Parameters
206
+
207
+ - Prefer authoring theme styles as SCSS over JS styling, except in apps that primarily use JS styling and do not use SCSS.
208
+ - Global component styles should use the `components` object.
209
+ - When declaring styles for multiple components globally for the app theme, use SCSS placeholders, mixins, or functions (in apps that use SCSS). For apps that use JS styling, use variables.
210
+ - Component styles should live in a `/components` subfolder within whatever folder contains the app theme declarations.
211
+
160
212
  Example:
161
213
 
162
214
  ```tsx
@@ -0,0 +1,45 @@
1
+ # Accordion — Agent Usage Notes
2
+
3
+ Import:
4
+
5
+ ```tsx
6
+ import { Accordion } from "@stamcat/craftsman/Accordion";
7
+ ```
8
+
9
+ Props:
10
+
11
+ - `items: { id?: string; header: ReactNode; content: ReactNode; disabled?: boolean }[]` — required, data-driven like `Select`'s `options`.
12
+ - `multiple?: boolean` (default: `false`) — when `false`, opening an item closes any other open item.
13
+ - `expanded?: string[]` — controlled set of open item ids. Omit to let Accordion manage its own open/closed state.
14
+ - `defaultExpanded?: string[]` (default: `[]`) — initial open item ids when uncontrolled.
15
+ - `onChange?: (expanded: string[]) => void`
16
+ - Inherits all native `<div>` props (except `onChange`, which is overridden above).
17
+
18
+ Behavior notes:
19
+
20
+ - Each item renders as an `<h3>` heading wrapping a `<button>` trigger (`aria-expanded`, `aria-controls`) and a `role="region"` panel (`aria-labelledby`) — the WAI-ARIA Accordion pattern.
21
+ - Collapsed panels are hidden via the native `hidden` attribute (not just visually), so screen readers skip their content.
22
+ - The chevron icon is `FaAngleUp` from `react-icons/fa6`; it rotates 180deg when collapsed and un-rotates to point up when expanded — the same rotate-on-open treatment used for `Select`'s native dropdown arrow.
23
+ - Keyboard support mirrors a native `<select>`: `Tab` moves focus in/out, `Enter`/`Space` toggle the focused header (free via native `<button>` semantics), and `ArrowUp`/`ArrowDown`/`Home`/`End` move focus between headers without opening them.
24
+ - `disabled` items render a disabled `<button>` (`aria-disabled` is implied by the native `disabled` attribute) and cannot be toggled.
25
+ - If `id` is omitted per item, one is derived from `useId()` plus the item's index.
26
+ - Renders nothing (per `isEmpty`) if `items` is empty.
27
+
28
+ Example:
29
+
30
+ ```tsx
31
+ <Accordion
32
+ items={[
33
+ { id: "shipping", header: "Shipping", content: <p>Ships in 3-5 business days.</p> },
34
+ { id: "returns", header: "Returns", content: <p>30-day return window.</p> },
35
+ ]}
36
+ />
37
+ ```
38
+
39
+ Controlled usage:
40
+
41
+ ```tsx
42
+ const [expanded, setExpanded] = useState<string[]>(["shipping"]);
43
+
44
+ <Accordion items={items} expanded={expanded} onChange={setExpanded} multiple />
45
+ ```
@@ -0,0 +1 @@
1
+ @layer craftsman-component{.accordion{border:1px solid var(--gray400);border-radius:calc(var(--w-gutter) * .5);flex-direction:column;display:flex;overflow:hidden}.accordion-item{border-bottom:1px solid var(--gray400)}.accordion-item:last-child{border-bottom:none}.accordion-item[data-disabled=true] .accordion-trigger{cursor:not-allowed;color:var(--gray400)}.accordion-item>.accordion-content{padding:calc(var(--w-gutter) * .75) var(--w-gutter)}.accordion-item>.accordion-content[hidden]{display:none}.accordion-trigger{justify-content:space-between;align-items:center;gap:calc(var(--w-gutter) * .5);width:100%;padding:calc(var(--w-gutter) * .75) var(--w-gutter);background-color:var(--white);text-align:left;color:inherit;border:none;display:flex}.accordion-trigger:focus-visible{outline:2px solid var(--blue500);outline-offset:-2px}.accordion-trigger span{flex-grow:1}.accordion-trigger svg{flex:none;transition:transform .2s;transform:rotate(180deg)}.accordion-item[data-expanded=true] .accordion-trigger svg{transform:rotate(0)}}
@@ -0,0 +1,14 @@
1
+ export type AccordionItemType = {
2
+ id?: string;
3
+ header: React.ReactNode;
4
+ content: React.ReactNode;
5
+ disabled?: boolean;
6
+ };
7
+ export type AccordionProps = Omit<React.ComponentPropsWithoutRef<"div">, "onChange"> & {
8
+ items: AccordionItemType[];
9
+ multiple?: boolean;
10
+ expanded?: string[];
11
+ defaultExpanded?: string[];
12
+ onChange?: (expanded: string[]) => void;
13
+ };
14
+ export declare const Accordion: React.FC<AccordionProps>;
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { isEmpty as e } from "../../utilities/validations.esm.js";
3
+ import './Accordion.css';/* empty css */
4
+ import { useId as t, useRef as n, useState as r } from "react";
5
+ import i from "clsx";
6
+ import { FaAngleUp as a } from "react-icons/fa6";
7
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
+ //#region src/components/Accordion/Accordion.tsx
9
+ var l = ({ items: l, multiple: u = !1, expanded: d, defaultExpanded: f = [], onChange: p, className: m, style: h, ...g }) => {
10
+ let _ = t(), v = n([]), [y, b] = r(f), x = d !== void 0, S = x ? d : y, C = (e, t) => e.id ?? `${_}-${t}`, w = (e) => {
11
+ x || b(e), p?.(e);
12
+ }, T = (e) => {
13
+ let t = l.length, n = (e % t + t) % t;
14
+ v.current[n]?.focus();
15
+ }, E = (e) => {
16
+ let t = S.includes(e);
17
+ w(u ? t ? S.filter((t) => t !== e) : [...S, e] : t ? [] : [e]);
18
+ }, D = (e, t) => {
19
+ switch (e.key) {
20
+ case "ArrowDown":
21
+ e.preventDefault(), T(t + 1);
22
+ break;
23
+ case "ArrowUp":
24
+ e.preventDefault(), T(t - 1);
25
+ break;
26
+ case "Home":
27
+ e.preventDefault(), T(0);
28
+ break;
29
+ case "End":
30
+ e.preventDefault(), T(l.length - 1);
31
+ break;
32
+ default: break;
33
+ }
34
+ };
35
+ return e(l) ? /* @__PURE__ */ s(o, {}) : /* @__PURE__ */ s("div", {
36
+ className: i("accordion", m),
37
+ style: h,
38
+ ...g,
39
+ children: l.map((e, t) => {
40
+ let n = C(e, t), r = `${n}-header`, i = `${n}-panel`, l = S.includes(n);
41
+ return /* @__PURE__ */ c("div", {
42
+ className: "accordion-item",
43
+ "data-expanded": l,
44
+ "data-disabled": e.disabled,
45
+ children: [/* @__PURE__ */ s("header", { children: /* @__PURE__ */ c("button", {
46
+ type: "button",
47
+ id: r,
48
+ ref: (e) => {
49
+ v.current[t] = e;
50
+ },
51
+ className: "accordion-trigger",
52
+ "aria-expanded": l,
53
+ "aria-controls": i,
54
+ disabled: e.disabled,
55
+ onClick: () => E(n),
56
+ onKeyDown: (e) => D(e, t),
57
+ children: [/* @__PURE__ */ s(o, { children: e.header }), /* @__PURE__ */ s(a, { "aria-hidden": "true" })]
58
+ }) }), /* @__PURE__ */ s("div", {
59
+ id: i,
60
+ className: "accordion-content",
61
+ "aria-labelledby": r,
62
+ hidden: !l,
63
+ children: e.content
64
+ })]
65
+ }, n);
66
+ })
67
+ });
68
+ };
69
+ //#endregion
70
+ export { l as Accordion };
@@ -0,0 +1,64 @@
1
+ @use "../../styles/utilities/_functions" as u;
2
+
3
+ @layer craftsman-component {
4
+ .accordion {
5
+ display: flex;
6
+ flex-direction: column;
7
+ border: 1px solid var(--gray400);
8
+ border-radius: #{u.width("gutter", 0.5)};
9
+ overflow: hidden;
10
+ }
11
+
12
+ .accordion-item {
13
+ border-bottom: 1px solid var(--gray400);
14
+
15
+ &:last-child {
16
+ border-bottom: none;
17
+ }
18
+
19
+ &[data-disabled="true"] .accordion-trigger {
20
+ cursor: not-allowed;
21
+ color: var(--gray400);
22
+ }
23
+
24
+ > .accordion-content {
25
+ padding: #{u.width("gutter", 0.75)} #{u.width("gutter")};
26
+
27
+ &[hidden] {
28
+ display: none;
29
+ }
30
+ }
31
+ }
32
+
33
+ .accordion-trigger {
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: space-between;
37
+ gap: #{u.width("gutter", 0.5)};
38
+ width: 100%;
39
+ padding: #{u.width("gutter", 0.75)} #{u.width("gutter")};
40
+ background-color: var(--white);
41
+ border: none;
42
+ text-align: left;
43
+ color: inherit;
44
+
45
+ &:focus-visible {
46
+ outline: 2px solid var(--blue500);
47
+ outline-offset: -2px;
48
+ }
49
+
50
+ span {
51
+ flex-grow: 1;
52
+ }
53
+
54
+ svg {
55
+ flex: 0 0 auto;
56
+ transition: transform 200ms ease;
57
+ transform: rotate(180deg);
58
+ }
59
+ }
60
+
61
+ .accordion-item[data-expanded="true"] .accordion-trigger svg {
62
+ transform: rotate(0deg);
63
+ }
64
+ }
@@ -1,68 +1,68 @@
1
1
  "use client";
2
2
  import { Button as e } from "../Button/Button.esm.js";
3
- import { Pagination as t } from "../Pagination/Pagination2.esm.js";
4
- import './Carousel.css';/* empty css */
5
- import n from "clsx";
6
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
7
- import { useCallback as a, useSyncExternalStore as o } from "react";
8
- import { FaAngleLeft as s, FaAngleRight as c, FaCircle as l, FaRegCircle as u } from "react-icons/fa6";
3
+ import { Pagination as t } from "../Pagination/Pagination.esm.js";
4
+ import './Carousel.css';/* empty css */
5
+ import { useCallback as n, useSyncExternalStore as r } from "react";
6
+ import i from "clsx";
7
+ import { FaAngleLeft as a, FaAngleRight as o, FaCircle as s, FaRegCircle as c } from "react-icons/fa6";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
9
  import d from "embla-carousel-react";
10
10
  //#region src/components/Carousel/Carousel.tsx
11
11
  var f = (f) => {
12
- let { slides: p = [], className: m, style: h, buttons: g = !0, pagination: _ = "dots", ...v } = f, [y, b] = d(v), x = a((e) => b ? (b.on("select", e).on("reInit", e), () => {
12
+ let { slides: p = [], className: m, style: h, buttons: g = !0, pagination: _ = "dots", ...v } = f, [y, b] = d(v), x = n((e) => b ? (b.on("select", e).on("reInit", e), () => {
13
13
  b.off("select", e), b.off("reInit", e);
14
- }) : () => {}, [b]), S = o(x, () => !!b?.canScrollPrev(), () => !1), C = o(x, () => !!b?.canScrollNext(), () => !1), w = o(x, () => b?.selectedScrollSnap() ?? 0, () => 0), T = () => b?.scrollPrev(), E = () => b?.scrollNext(), D = (e) => {
14
+ }) : () => {}, [b]), S = r(x, () => !!b?.canScrollPrev(), () => !1), C = r(x, () => !!b?.canScrollNext(), () => !1), w = r(x, () => b?.selectedScrollSnap() ?? 0, () => 0), T = () => b?.scrollPrev(), E = () => b?.scrollNext(), D = (e) => {
15
15
  let t = parseInt(e.currentTarget.value, 10) || 0;
16
16
  b?.scrollTo(t);
17
17
  };
18
- return /* @__PURE__ */ i("div", {
19
- className: n("carousel", m),
18
+ return /* @__PURE__ */ u("div", {
19
+ className: i("carousel", m),
20
20
  style: h,
21
- children: [/* @__PURE__ */ r("div", {
21
+ children: [/* @__PURE__ */ l("div", {
22
22
  className: "carousel__viewport",
23
23
  ref: y,
24
- children: /* @__PURE__ */ r("div", {
24
+ children: /* @__PURE__ */ l("div", {
25
25
  className: "carousel__container",
26
- children: p.map((e, t) => /* @__PURE__ */ r("div", {
26
+ children: p.map((e, t) => /* @__PURE__ */ l("div", {
27
27
  className: "carousel__slide",
28
28
  children: e
29
29
  }, `slide-${t}`))
30
30
  })
31
- }), /* @__PURE__ */ i("div", {
31
+ }), /* @__PURE__ */ u("div", {
32
32
  className: "carousel__controls",
33
33
  children: [
34
- g && /* @__PURE__ */ i("div", {
34
+ g && /* @__PURE__ */ u("div", {
35
35
  className: "carousel__buttons",
36
- children: [/* @__PURE__ */ r(e, {
36
+ children: [/* @__PURE__ */ l(e, {
37
37
  variant: "text",
38
38
  onClick: T,
39
39
  disabled: !S,
40
40
  name: "prev",
41
- children: /* @__PURE__ */ r(s, {
41
+ children: /* @__PURE__ */ l(a, {
42
42
  size: 24,
43
43
  "aria-label": "prev"
44
44
  })
45
- }), /* @__PURE__ */ r(e, {
45
+ }), /* @__PURE__ */ l(e, {
46
46
  variant: "text",
47
47
  onClick: E,
48
48
  disabled: !C,
49
49
  name: "next",
50
- children: /* @__PURE__ */ r(c, {
50
+ children: /* @__PURE__ */ l(o, {
51
51
  size: 24,
52
52
  "aria-label": "next"
53
53
  })
54
54
  })]
55
55
  }),
56
- _ === "dots" && /* @__PURE__ */ r("div", {
56
+ _ === "dots" && /* @__PURE__ */ l("div", {
57
57
  className: "carousel__dots",
58
- children: p.map((t, n) => /* @__PURE__ */ r(e, {
58
+ children: p.map((t, n) => /* @__PURE__ */ l(e, {
59
59
  variant: "text",
60
60
  value: n,
61
61
  onClick: D,
62
- children: r(w === n ? l : u, { size: 16 })
62
+ children: l(w === n ? s : c, { size: 16 })
63
63
  }, `dot-${n}`))
64
64
  }),
65
- _ === "numbers" && /* @__PURE__ */ r(t, {
65
+ _ === "numbers" && /* @__PURE__ */ l(t, {
66
66
  total: p.length,
67
67
  current: w,
68
68
  onChange: D
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Input as e } from "../Input/Input2.esm.js";
2
+ import { Input as e } from "../Input/Input.esm.js";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region src/components/Checkbox/Checkbox.tsx
5
5
  var n = ({ type: n = "checkbox", labelPosition: r = "right", size: i, style: a, ...o }) => {
@@ -1 +1 @@
1
- @layer craftsman-base{.react-date-picker__wrapper:focus{box-shadow:none;outline:0}.react-date-picker__wrapper{color:var(--text);border:1px solid var(--gray400);padding:calc(var(--w-gutter) * .5);background-color:var(--white);border-radius:6px}[type=number].react-date-picker__wrapper::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}[type=number].react-date-picker__wrapper::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}[type=number].react-date-picker__wrapper{appearance:textfield}.react-date-picker__wrapper:disabled,.disabled.react-date-picker__wrapper{border-color:var(--gray200);background-color:var(--gray100)}.react-date-picker__calendar{z-index:1;width:350px;max-width:100vw}.react-date-picker__calendar .react-calendar{border-width:thin}.react-date-picker__calendar--closed,.react-date-picker__clock--closed{display:none}.react-date-picker__calendar .react-date-picker__inputGroup__input:invalid{background:unset}}.react-date-picker,.react-date-picker *,.react-date-picker :before,.react-date-picker :after{box-sizing:border-box}@layer craftsman-component{.react-date-picker{display:inline-flex;position:relative}.react-date-picker--disabled{color:#6d6d6d;background-color:#f0f0f0}.react-date-picker__wrapper{flex-grow:1;flex-shrink:0;padding:6px 8px;display:flex}.react-date-picker__inputGroup{box-sizing:content-box;flex-grow:1;padding:0 2px}.react-date-picker__inputGroup__divider{white-space:pre;padding:1px 0}.react-date-picker__inputGroup__divider,.react-date-picker__inputGroup__leadingZero{font:inherit;display:inline-block}.react-date-picker__inputGroup__input{text-align:center;color:currentColor;min-width:calc(2ch + 1px);height:calc(100% - 2px);font:inherit;box-sizing:content-box;appearance:textfield;background:0 0;border:0;padding:1px;position:relative}[name=year].react-date-picker__inputGroup__input{min-width:calc(4ch + 2px)}.react-date-picker__inputGroup__input:disabled{background-color:unset}.react-date-picker__inputGroup__input::-webkit-outer-spin-button{appearance:none;margin:0}.react-date-picker__inputGroup__input::-webkit-inner-spin-button{appearance:none;margin:0}.react-date-picker__inputGroup__input--hasLeadingZero{margin-left:-.54em;padding-left:calc(1px + .54em)}.react-date-picker__button{border:0;padding:4px 4px 4px 7px}.react-date-picker__button:hover{background:0 0}}
1
+ @layer craftsman-base{.react-date-picker__wrapper{color:var(--text);border:1px solid var(--gray400);padding:calc(var(--w-gutter) * .5);background-color:var(--white);border-radius:6px}.react-date-picker__wrapper:focus{box-shadow:none;outline:0}.react-date-picker__wrapper:hover{border-color:var(--gray500)}[type=number].react-date-picker__wrapper::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}[type=number].react-date-picker__wrapper::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}[type=number].react-date-picker__wrapper{appearance:textfield}.react-date-picker__wrapper:disabled,.disabled.react-date-picker__wrapper{border-color:var(--gray400);background-color:var(--gray100)}.react-date-picker__calendar{z-index:1;width:350px;max-width:100vw}.react-date-picker__calendar .react-calendar{border-width:thin}.react-date-picker__calendar--closed,.react-date-picker__clock--closed{display:none}.react-date-picker__calendar .react-date-picker__inputGroup__input:invalid{background:unset}}.react-date-picker,.react-date-picker *,.react-date-picker :before,.react-date-picker :after{box-sizing:border-box}@layer craftsman-component{.react-date-picker{display:inline-flex;position:relative}.react-date-picker--disabled{color:#6d6d6d;background-color:#f0f0f0}.react-date-picker__wrapper{flex-grow:1;flex-shrink:0;padding:6px 8px;display:flex}.react-date-picker__inputGroup{box-sizing:content-box;flex-grow:1;padding:0 2px}.react-date-picker__inputGroup__divider{white-space:pre;padding:1px 0}.react-date-picker__inputGroup__divider,.react-date-picker__inputGroup__leadingZero{font:inherit;display:inline-block}.react-date-picker__inputGroup__input{text-align:center;color:currentColor;min-width:calc(2ch + 1px);height:calc(100% - 2px);font:inherit;box-sizing:content-box;appearance:textfield;background:0 0;border:0;padding:1px;position:relative}[name=year].react-date-picker__inputGroup__input{min-width:calc(4ch + 2px)}.react-date-picker__inputGroup__input:disabled{background-color:unset}.react-date-picker__inputGroup__input::-webkit-outer-spin-button{appearance:none;margin:0}.react-date-picker__inputGroup__input::-webkit-inner-spin-button{appearance:none;margin:0}.react-date-picker__inputGroup__input--hasLeadingZero{margin-left:-.54em;padding-left:calc(1px + .54em)}.react-date-picker__button{border:0;padding:4px 4px 4px 7px}.react-date-picker__button:hover{background:0 0}}
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { InputWrapper as e } from "../Input/InputWrapper.esm.js";
3
+ import './ReactCalendar.css';import './DatePicker.css';/* empty css */
4
+ /* empty css */
5
+ import { useId as t } from "react";
6
+ import n from "clsx";
7
+ import { FaRegCalendar as r, FaX as i } from "react-icons/fa6";
8
+ import { jsx as a } from "react/jsx-runtime";
9
+ import { DatePicker as o } from "react-date-picker";
10
+ //#region src/components/DatePicker/DatePicker.tsx
11
+ var s = ({ label: s, id: c, labelPosition: l = "top", required: u = !1, error: d, style: f, className: p, ...m }) => {
12
+ let h = t();
13
+ return /* @__PURE__ */ a(e, {
14
+ id: c || h,
15
+ className: n("datePicker", p),
16
+ label: s,
17
+ labelPosition: l,
18
+ error: d,
19
+ required: u,
20
+ style: f,
21
+ children: /* @__PURE__ */ a(o, {
22
+ calendarIcon: /* @__PURE__ */ a(r, { size: 16 }),
23
+ clearIcon: /* @__PURE__ */ a(i, { size: 14 }),
24
+ ...m
25
+ })
26
+ });
27
+ };
28
+ //#endregion
29
+ export { s as DatePicker };