@brycks/core-front 0.2.8 → 0.2.10

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 (28) hide show
  1. package/dist/components/feedback/Drawer/Drawer.cjs +2 -2
  2. package/dist/components/feedback/Drawer/Drawer.cjs.map +1 -1
  3. package/dist/components/feedback/Drawer/Drawer.js +78 -74
  4. package/dist/components/feedback/Drawer/Drawer.js.map +1 -1
  5. package/dist/components/feedback/Modal/Modal.cjs +1 -1
  6. package/dist/components/feedback/Modal/Modal.cjs.map +1 -1
  7. package/dist/components/feedback/Modal/Modal.js +76 -70
  8. package/dist/components/feedback/Modal/Modal.js.map +1 -1
  9. package/dist/components/form/FormLabel/FormLabel.cjs +1 -1
  10. package/dist/components/form/FormLabel/FormLabel.cjs.map +1 -1
  11. package/dist/components/form/FormLabel/FormLabel.js +40 -40
  12. package/dist/components/form/FormLabel/FormLabel.js.map +1 -1
  13. package/dist/components/form/Input/Input.cjs +1 -1
  14. package/dist/components/form/Input/Input.js +13 -13
  15. package/dist/components/primitives/Button/Button.styles.cjs +1 -1
  16. package/dist/components/primitives/Button/Button.styles.cjs.map +1 -1
  17. package/dist/components/primitives/Button/Button.styles.js +24 -24
  18. package/dist/components/primitives/Button/Button.styles.js.map +1 -1
  19. package/dist/components/typography/Heading/Heading.cjs +1 -1
  20. package/dist/components/typography/Heading/Heading.cjs.map +1 -1
  21. package/dist/components/typography/Heading/Heading.js +42 -32
  22. package/dist/components/typography/Heading/Heading.js.map +1 -1
  23. package/dist/components/typography/Text/Text.cjs +1 -1
  24. package/dist/components/typography/Text/Text.cjs.map +1 -1
  25. package/dist/components/typography/Text/Text.js +59 -36
  26. package/dist/components/typography/Text/Text.js.map +1 -1
  27. package/dist/styles.css +1 -1
  28. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
- import { forwardRef as B, useRef as y, useEffect as w, useCallback as q, useMemo as E, memo as F } from "react";
3
- import { createPortal as P } from "react-dom";
4
- import { cx as $ } from "../../../utils/styles.js";
5
- const G = {
1
+ import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
+ import { forwardRef as q, useRef as s, useEffect as i, useCallback as F, useMemo as S, memo as P } from "react";
3
+ import { createPortal as $ } from "react-dom";
4
+ import { cx as G } from "../../../utils/styles.js";
5
+ const J = {
6
6
  sm: "400px",
7
7
  md: "500px",
8
8
  lg: "640px",
9
9
  xl: "800px",
10
10
  full: "calc(100vw - 48px)"
11
- }, J = F(function() {
12
- return /* @__PURE__ */ t("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t(
11
+ }, Q = P(function() {
12
+ return /* @__PURE__ */ r("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ r(
13
13
  "path",
14
14
  {
15
15
  d: "M4 4L12 12M12 4L4 12",
@@ -18,50 +18,56 @@ const G = {
18
18
  strokeLinecap: "round"
19
19
  }
20
20
  ) });
21
- }), Q = B(function({
22
- isOpen: r,
23
- onClose: n,
21
+ }), U = q(function({
22
+ isOpen: t,
23
+ onClose: o,
24
24
  size: a = "md",
25
25
  title: l,
26
- description: d,
27
- closeOnOverlayClick: f = !0,
28
- closeOnEscape: b = !0,
29
- showCloseButton: v = !0,
30
- className: C,
31
- style: k,
32
- testId: M,
33
- children: L,
34
- ...I
26
+ description: u,
27
+ closeOnOverlayClick: v = !0,
28
+ closeOnEscape: k = !0,
29
+ showCloseButton: g = !0,
30
+ className: M,
31
+ style: h,
32
+ testId: L,
33
+ children: I,
34
+ ...T
35
35
  }, c) {
36
- const g = y(null), i = y(null), s = y(!1);
37
- w(() => {
38
- r && !s.current ? (i.current = document.activeElement, s.current = !0) : !r && s.current && (document.activeElement instanceof HTMLElement && document.activeElement.blur(), i.current?.focus(), i.current = null, s.current = !1);
39
- }, [r]), w(() => {
40
- if (!r) return;
41
- const e = g.current;
36
+ const m = s(null), y = s(null), d = s(!1);
37
+ i(() => {
38
+ t && !d.current ? (y.current = document.activeElement, d.current = !0) : !t && d.current && (document.activeElement instanceof HTMLElement && document.activeElement.blur(), y.current?.focus(), y.current = null, d.current = !1);
39
+ }, [t]);
40
+ const x = s(o);
41
+ i(() => {
42
+ x.current = o;
43
+ }, [o]), i(() => {
44
+ if (!t) return;
45
+ const e = m.current;
42
46
  e && e.focus();
43
- const h = (o) => {
44
- if (o.key === "Escape" && b) {
45
- n();
47
+ }, [t]), i(() => {
48
+ if (!t) return;
49
+ const e = m.current, p = (n) => {
50
+ if (n.key === "Escape" && k) {
51
+ x.current();
46
52
  return;
47
53
  }
48
- if (o.key === "Tab" && e) {
49
- const u = e.querySelectorAll(
54
+ if (n.key === "Tab" && e) {
55
+ const f = e.querySelectorAll(
50
56
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
51
- ), p = u[0], x = u[u.length - 1];
52
- o.shiftKey && document.activeElement === p ? (o.preventDefault(), x?.focus()) : !o.shiftKey && document.activeElement === x && (o.preventDefault(), p?.focus());
57
+ ), w = f[0], E = f[f.length - 1];
58
+ n.shiftKey && document.activeElement === w ? (n.preventDefault(), E?.focus()) : !n.shiftKey && document.activeElement === E && (n.preventDefault(), w?.focus());
53
59
  }
54
60
  };
55
- return document.addEventListener("keydown", h), document.body.style.overflow = "hidden", () => {
56
- document.removeEventListener("keydown", h), document.body.style.overflow = "";
61
+ return document.addEventListener("keydown", p), document.body.style.overflow = "hidden", () => {
62
+ document.removeEventListener("keydown", p), document.body.style.overflow = "";
57
63
  };
58
- }, [r, b, n]);
59
- const T = q(
64
+ }, [t, k]);
65
+ const N = F(
60
66
  (e) => {
61
- e.target === e.currentTarget && f && n();
67
+ e.target === e.currentTarget && v && o();
62
68
  },
63
- [f, n]
64
- ), N = E(() => ({
69
+ [v, o]
70
+ ), R = S(() => ({
65
71
  position: "fixed",
66
72
  inset: 0,
67
73
  zIndex: "var(--brycks-z-modal)",
@@ -72,10 +78,10 @@ const G = {
72
78
  backgroundColor: "var(--brycks-background-overlay)",
73
79
  backdropFilter: "blur(4px)",
74
80
  animation: "brycks-fade-in var(--brycks-duration-normal) var(--brycks-ease-out)"
75
- }), []), j = E(() => ({
81
+ }), []), j = S(() => ({
76
82
  position: "relative",
77
83
  width: "100%",
78
- maxWidth: G[a],
84
+ maxWidth: J[a],
79
85
  maxHeight: a === "full" ? "calc(100vh - 48px)" : "85vh",
80
86
  backgroundColor: "var(--brycks-background-elevated)",
81
87
  borderRadius: "var(--brycks-radius-xl)",
@@ -85,30 +91,30 @@ const G = {
85
91
  overflow: "hidden",
86
92
  animation: "brycks-scale-in var(--brycks-duration-normal) var(--brycks-ease-spring)",
87
93
  outline: "none",
88
- ...k
89
- }), [a, k]);
90
- if (!r) return null;
94
+ ...h
95
+ }), [a, h]);
96
+ if (!t) return null;
91
97
  const D = {
92
98
  display: "flex",
93
99
  alignItems: "flex-start",
94
100
  justifyContent: "space-between",
95
101
  padding: "20px 24px",
96
102
  borderBottom: "1px solid var(--brycks-border-muted)"
97
- }, R = {
103
+ }, W = {
98
104
  display: "flex",
99
105
  flexDirection: "column",
100
106
  gap: 4
101
- }, W = {
107
+ }, H = {
102
108
  fontSize: 18,
103
109
  fontWeight: 600,
104
110
  color: "var(--brycks-foreground-default)",
105
111
  margin: 0,
106
112
  lineHeight: 1.3
107
- }, H = {
113
+ }, K = {
108
114
  fontSize: 14,
109
115
  color: "var(--brycks-foreground-muted)",
110
116
  margin: 0
111
- }, K = {
117
+ }, z = {
112
118
  display: "flex",
113
119
  alignItems: "center",
114
120
  justifyContent: "center",
@@ -119,44 +125,44 @@ const G = {
119
125
  transition: "all var(--brycks-duration-fast) var(--brycks-ease-out)",
120
126
  marginLeft: 12,
121
127
  flexShrink: 0
122
- }, z = {
128
+ }, A = {
123
129
  flex: 1,
124
130
  overflow: "auto",
125
131
  padding: 24
126
- }, A = /* @__PURE__ */ t(
132
+ }, B = /* @__PURE__ */ r(
127
133
  "div",
128
134
  {
129
135
  className: "brycks-modal-overlay",
130
- style: N,
131
- onClick: T,
132
- children: /* @__PURE__ */ m(
136
+ style: R,
137
+ onClick: N,
138
+ children: /* @__PURE__ */ b(
133
139
  "div",
134
140
  {
135
141
  ref: (e) => {
136
- g.current = e, typeof c == "function" ? c(e) : c && (c.current = e);
142
+ m.current = e, typeof c == "function" ? c(e) : c && (c.current = e);
137
143
  },
138
144
  role: "dialog",
139
145
  "aria-modal": "true",
140
146
  "aria-labelledby": l ? "brycks-modal-title" : void 0,
141
- "aria-describedby": d ? "brycks-modal-description" : void 0,
142
- className: $("brycks-modal", `brycks-modal--${a}`, C),
147
+ "aria-describedby": u ? "brycks-modal-description" : void 0,
148
+ className: G("brycks-modal", `brycks-modal--${a}`, M),
143
149
  style: j,
144
150
  tabIndex: -1,
145
- "data-testid": M,
146
- ...I,
151
+ "data-testid": L,
152
+ ...T,
147
153
  children: [
148
- (l || v) && /* @__PURE__ */ m("div", { className: "brycks-modal-header", style: D, children: [
149
- /* @__PURE__ */ m("div", { style: R, children: [
150
- l && /* @__PURE__ */ t("h2", { id: "brycks-modal-title", style: W, children: l }),
151
- d && /* @__PURE__ */ t("p", { id: "brycks-modal-description", style: H, children: d })
154
+ (l || g) && /* @__PURE__ */ b("div", { className: "brycks-modal-header", style: D, children: [
155
+ /* @__PURE__ */ b("div", { style: W, children: [
156
+ l && /* @__PURE__ */ r("h2", { id: "brycks-modal-title", style: H, children: l }),
157
+ u && /* @__PURE__ */ r("p", { id: "brycks-modal-description", style: K, children: u })
152
158
  ] }),
153
- v && /* @__PURE__ */ t(
159
+ g && /* @__PURE__ */ r(
154
160
  "button",
155
161
  {
156
162
  type: "button",
157
163
  className: "brycks-modal-close",
158
- style: K,
159
- onClick: n,
164
+ style: z,
165
+ onClick: o,
160
166
  "aria-label": "Close modal",
161
167
  onMouseEnter: (e) => {
162
168
  e.currentTarget.style.backgroundColor = "var(--brycks-background-muted)", e.currentTarget.style.color = "var(--brycks-foreground-default)";
@@ -164,20 +170,20 @@ const G = {
164
170
  onMouseLeave: (e) => {
165
171
  e.currentTarget.style.backgroundColor = "transparent", e.currentTarget.style.color = "var(--brycks-foreground-muted)";
166
172
  },
167
- children: /* @__PURE__ */ t(J, {})
173
+ children: /* @__PURE__ */ r(Q, {})
168
174
  }
169
175
  )
170
176
  ] }),
171
- /* @__PURE__ */ t("div", { className: "brycks-modal-content", style: z, children: L })
177
+ /* @__PURE__ */ r("div", { className: "brycks-modal-content", style: A, children: I })
172
178
  ]
173
179
  }
174
180
  )
175
181
  }
176
182
  );
177
- return P(A, document.body);
183
+ return $(B, document.body);
178
184
  });
179
- Q.displayName = "Modal";
185
+ U.displayName = "Modal";
180
186
  export {
181
- Q as Modal
187
+ U as Modal
182
188
  };
183
189
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../src/components/feedback/Modal/Modal.tsx"],"sourcesContent":["/**\r\n * Modal Component\r\n *\r\n * Accessible modal dialog with smooth Apple-inspired animations.\r\n * Supports focus trapping and keyboard navigation.\r\n */\r\n\r\nimport {\r\n forwardRef,\r\n useEffect,\r\n useRef,\r\n useCallback,\r\n useMemo,\r\n memo,\r\n type CSSProperties,\r\n type ReactNode,\r\n type HTMLAttributes,\r\n} from 'react'\r\nimport { createPortal } from 'react-dom'\r\nimport { cx } from '../../../utils/styles'\r\n\r\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'\r\n\r\nexport interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\r\n /** Whether the modal is open */\r\n isOpen: boolean\r\n /** Callback when modal should close */\r\n onClose: () => void\r\n /** Modal size */\r\n size?: ModalSize\r\n /** Modal title */\r\n title?: ReactNode\r\n /** Modal description */\r\n description?: ReactNode\r\n /** Whether to close on overlay click */\r\n closeOnOverlayClick?: boolean\r\n /** Whether to close on escape key */\r\n closeOnEscape?: boolean\r\n /** Whether to show close button */\r\n showCloseButton?: boolean\r\n /** Custom class name */\r\n className?: string\r\n /** Test ID */\r\n testId?: string\r\n /** Modal content */\r\n children?: ReactNode\r\n}\r\n\r\nconst sizeWidths: Record<ModalSize, string> = {\r\n sm: '400px',\r\n md: '500px',\r\n lg: '640px',\r\n xl: '800px',\r\n full: 'calc(100vw - 48px)',\r\n}\r\n\r\n/** Close icon - memoized to prevent re-renders */\r\nconst CloseIcon = memo(function CloseIcon() {\r\n return (\r\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\r\n <path\r\n d=\"M4 4L12 12M12 4L4 12\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n />\r\n </svg>\r\n )\r\n})\r\n\r\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\r\n {\r\n isOpen,\r\n onClose,\r\n size = 'md',\r\n title,\r\n description,\r\n closeOnOverlayClick = true,\r\n closeOnEscape = true,\r\n showCloseButton = true,\r\n className,\r\n style,\r\n testId,\r\n children,\r\n ...props\r\n },\r\n ref\r\n) {\r\n const modalRef = useRef<HTMLDivElement>(null)\r\n const previousActiveElement = useRef<HTMLElement | null>(null)\r\n const wasOpen = useRef(false)\r\n\r\n // Track previous open state to handle focus restoration before unmount\r\n useEffect(() => {\r\n // Modal just opened\r\n if (isOpen && !wasOpen.current) {\r\n previousActiveElement.current = document.activeElement as HTMLElement\r\n wasOpen.current = true\r\n }\r\n // Modal is about to close - restore focus BEFORE unmount\r\n else if (!isOpen && wasOpen.current) {\r\n // Blur any focused element inside modal to prevent aria-hidden warning\r\n if (document.activeElement instanceof HTMLElement) {\r\n document.activeElement.blur()\r\n }\r\n // Restore focus to previous element\r\n previousActiveElement.current?.focus()\r\n previousActiveElement.current = null\r\n wasOpen.current = false\r\n }\r\n }, [isOpen])\r\n\r\n // Focus trap and keyboard handling\r\n useEffect(() => {\r\n if (!isOpen) return\r\n\r\n const modal = modalRef.current\r\n if (modal) {\r\n modal.focus()\r\n }\r\n\r\n const handleKeyDown = (e: KeyboardEvent) => {\r\n if (e.key === 'Escape' && closeOnEscape) {\r\n onClose()\r\n return\r\n }\r\n\r\n if (e.key === 'Tab' && modal) {\r\n const focusableElements = modal.querySelectorAll<HTMLElement>(\r\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\r\n )\r\n const firstElement = focusableElements[0]\r\n const lastElement = focusableElements[focusableElements.length - 1]\r\n\r\n if (e.shiftKey && document.activeElement === firstElement) {\r\n e.preventDefault()\r\n lastElement?.focus()\r\n } else if (!e.shiftKey && document.activeElement === lastElement) {\r\n e.preventDefault()\r\n firstElement?.focus()\r\n }\r\n }\r\n }\r\n\r\n document.addEventListener('keydown', handleKeyDown)\r\n document.body.style.overflow = 'hidden'\r\n\r\n return () => {\r\n document.removeEventListener('keydown', handleKeyDown)\r\n document.body.style.overflow = ''\r\n }\r\n }, [isOpen, closeOnEscape, onClose])\r\n\r\n const handleOverlayClick = useCallback(\r\n (e: React.MouseEvent) => {\r\n if (e.target === e.currentTarget && closeOnOverlayClick) {\r\n onClose()\r\n }\r\n },\r\n [closeOnOverlayClick, onClose]\r\n )\r\n\r\n // Memoize styles to prevent object recreation on every render\r\n const overlayStyle = useMemo<CSSProperties>(() => ({\r\n position: 'fixed',\r\n inset: 0,\r\n zIndex: 'var(--brycks-z-modal)',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n padding: 24,\r\n backgroundColor: 'var(--brycks-background-overlay)',\r\n backdropFilter: 'blur(4px)',\r\n animation: 'brycks-fade-in var(--brycks-duration-normal) var(--brycks-ease-out)',\r\n }), [])\r\n\r\n const modalStyle = useMemo<CSSProperties>(() => ({\r\n position: 'relative',\r\n width: '100%',\r\n maxWidth: sizeWidths[size],\r\n maxHeight: size === 'full' ? 'calc(100vh - 48px)' : '85vh',\r\n backgroundColor: 'var(--brycks-background-elevated)',\r\n borderRadius: 'var(--brycks-radius-xl)',\r\n boxShadow: 'var(--brycks-shadow-2xl)',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n overflow: 'hidden',\r\n animation: 'brycks-scale-in var(--brycks-duration-normal) var(--brycks-ease-spring)',\r\n outline: 'none',\r\n ...style,\r\n }), [size, style])\r\n\r\n if (!isOpen) return null\r\n\r\n const headerStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n justifyContent: 'space-between',\r\n padding: '20px 24px',\r\n borderBottom: '1px solid var(--brycks-border-muted)',\r\n }\r\n\r\n const titleContainerStyle: CSSProperties = {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 4,\r\n }\r\n\r\n const titleStyle: CSSProperties = {\r\n fontSize: 18,\r\n fontWeight: 600,\r\n color: 'var(--brycks-foreground-default)',\r\n margin: 0,\r\n lineHeight: 1.3,\r\n }\r\n\r\n const descriptionStyle: CSSProperties = {\r\n fontSize: 14,\r\n color: 'var(--brycks-foreground-muted)',\r\n margin: 0,\r\n }\r\n\r\n const closeButtonStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n width: 32,\r\n height: 32,\r\n borderRadius: 'var(--brycks-radius-md)',\r\n color: 'var(--brycks-foreground-muted)',\r\n transition: 'all var(--brycks-duration-fast) var(--brycks-ease-out)',\r\n marginLeft: 12,\r\n flexShrink: 0,\r\n }\r\n\r\n const contentStyle: CSSProperties = {\r\n flex: 1,\r\n overflow: 'auto',\r\n padding: 24,\r\n }\r\n\r\n const modalContent = (\r\n <div\r\n className=\"brycks-modal-overlay\"\r\n style={overlayStyle}\r\n onClick={handleOverlayClick}\r\n >\r\n <div\r\n ref={(node) => {\r\n (modalRef as React.MutableRefObject<HTMLDivElement | null>).current = node\r\n if (typeof ref === 'function') ref(node)\r\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node\r\n }}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-labelledby={title ? 'brycks-modal-title' : undefined}\r\n aria-describedby={description ? 'brycks-modal-description' : undefined}\r\n className={cx('brycks-modal', `brycks-modal--${size}`, className)}\r\n style={modalStyle}\r\n tabIndex={-1}\r\n data-testid={testId}\r\n {...props}\r\n >\r\n {(title || showCloseButton) && (\r\n <div className=\"brycks-modal-header\" style={headerStyle}>\r\n <div style={titleContainerStyle}>\r\n {title && (\r\n <h2 id=\"brycks-modal-title\" style={titleStyle}>\r\n {title}\r\n </h2>\r\n )}\r\n {description && (\r\n <p id=\"brycks-modal-description\" style={descriptionStyle}>\r\n {description}\r\n </p>\r\n )}\r\n </div>\r\n {showCloseButton && (\r\n <button\r\n type=\"button\"\r\n className=\"brycks-modal-close\"\r\n style={closeButtonStyle}\r\n onClick={onClose}\r\n aria-label=\"Close modal\"\r\n onMouseEnter={(e) => {\r\n e.currentTarget.style.backgroundColor = 'var(--brycks-background-muted)'\r\n e.currentTarget.style.color = 'var(--brycks-foreground-default)'\r\n }}\r\n onMouseLeave={(e) => {\r\n e.currentTarget.style.backgroundColor = 'transparent'\r\n e.currentTarget.style.color = 'var(--brycks-foreground-muted)'\r\n }}\r\n >\r\n <CloseIcon />\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n\r\n <div className=\"brycks-modal-content\" style={contentStyle}>\r\n {children}\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n\r\n return createPortal(modalContent, document.body)\r\n})\r\n\r\nModal.displayName = 'Modal'\r\n"],"names":["sizeWidths","CloseIcon","memo","jsx","Modal","forwardRef","isOpen","onClose","size","title","description","closeOnOverlayClick","closeOnEscape","showCloseButton","className","style","testId","children","props","ref","modalRef","useRef","previousActiveElement","wasOpen","useEffect","modal","handleKeyDown","e","focusableElements","firstElement","lastElement","handleOverlayClick","useCallback","overlayStyle","useMemo","modalStyle","headerStyle","titleContainerStyle","titleStyle","descriptionStyle","closeButtonStyle","contentStyle","modalContent","jsxs","node","cx","createPortal"],"mappings":";;;;AAgDA,MAAMA,IAAwC;AAAA,EAC5C,IAAI;AAAA,EACJ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,CAAI,IAAIM,CAAS;AAAA,UAChE,OAAOqB;AAAA,UACP,UAAU;AAAA,UACV,eAAanB;AAAA,UACZ,GAAGE;AAAA,UAEF,UAAA;AAAA,aAAAT,KAASI,MACT,gBAAA8B,EAAC,OAAA,EAAI,WAAU,uBAAsB,OAAOP,GAC1C,UAAA;AAAA,cAAA,gBAAAO,EAAC,OAAA,EAAI,OAAON,GACT,UAAA;AAAA,gBAAA5B,uBACE,MAAA,EAAG,IAAG,sBAAqB,OAAO6B,GAChC,UAAA7B,GACH;AAAA,gBAEDC,KACC,gBAAAP,EAAC,KAAA,EAAE,IAAG,4BAA2B,OAAOoC,GACrC,UAAA7B,EAAA,CACH;AAAA,cAAA,GAEJ;AAAA,cACCG,KACC,gBAAAV;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,OAAOqC;AAAA,kBACP,SAASjC;AAAA,kBACT,cAAW;AAAA,kBACX,cAAc,CAAC,MAAM;AACnB,sBAAE,cAAc,MAAM,kBAAkB,kCACxC,EAAE,cAAc,MAAM,QAAQ;AAAA,kBAChC;AAAA,kBACA,cAAc,CAAC,MAAM;AACnB,sBAAE,cAAc,MAAM,kBAAkB,eACxC,EAAE,cAAc,MAAM,QAAQ;AAAA,kBAChC;AAAA,kBAEA,4BAACN,GAAA,CAAA,CAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACb,GAEJ;AAAA,8BAGD,OAAA,EAAI,WAAU,wBAAuB,OAAOwC,GAC1C,UAAAxB,EAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAIN,SAAO6B,EAAaJ,GAAc,SAAS,IAAI;AACjD,CAAC;AAEDtC,EAAM,cAAc;"}
1
+ {"version":3,"file":"Modal.js","sources":["../../../../src/components/feedback/Modal/Modal.tsx"],"sourcesContent":["/**\r\n * Modal Component\r\n *\r\n * Accessible modal dialog with smooth Apple-inspired animations.\r\n * Supports focus trapping and keyboard navigation.\r\n */\r\n\r\nimport {\r\n forwardRef,\r\n useEffect,\r\n useRef,\r\n useCallback,\r\n useMemo,\r\n memo,\r\n type CSSProperties,\r\n type ReactNode,\r\n type HTMLAttributes,\r\n} from 'react'\r\nimport { createPortal } from 'react-dom'\r\nimport { cx } from '../../../utils/styles'\r\n\r\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'\r\n\r\nexport interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\r\n /** Whether the modal is open */\r\n isOpen: boolean\r\n /** Callback when modal should close */\r\n onClose: () => void\r\n /** Modal size */\r\n size?: ModalSize\r\n /** Modal title */\r\n title?: ReactNode\r\n /** Modal description */\r\n description?: ReactNode\r\n /** Whether to close on overlay click */\r\n closeOnOverlayClick?: boolean\r\n /** Whether to close on escape key */\r\n closeOnEscape?: boolean\r\n /** Whether to show close button */\r\n showCloseButton?: boolean\r\n /** Custom class name */\r\n className?: string\r\n /** Test ID */\r\n testId?: string\r\n /** Modal content */\r\n children?: ReactNode\r\n}\r\n\r\nconst sizeWidths: Record<ModalSize, string> = {\r\n sm: '400px',\r\n md: '500px',\r\n lg: '640px',\r\n xl: '800px',\r\n full: 'calc(100vw - 48px)',\r\n}\r\n\r\n/** Close icon - memoized to prevent re-renders */\r\nconst CloseIcon = memo(function CloseIcon() {\r\n return (\r\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\r\n <path\r\n d=\"M4 4L12 12M12 4L4 12\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n />\r\n </svg>\r\n )\r\n})\r\n\r\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\r\n {\r\n isOpen,\r\n onClose,\r\n size = 'md',\r\n title,\r\n description,\r\n closeOnOverlayClick = true,\r\n closeOnEscape = true,\r\n showCloseButton = true,\r\n className,\r\n style,\r\n testId,\r\n children,\r\n ...props\r\n },\r\n ref\r\n) {\r\n const modalRef = useRef<HTMLDivElement>(null)\r\n const previousActiveElement = useRef<HTMLElement | null>(null)\r\n const wasOpen = useRef(false)\r\n\r\n // Track previous open state to handle focus restoration before unmount\r\n useEffect(() => {\r\n // Modal just opened\r\n if (isOpen && !wasOpen.current) {\r\n previousActiveElement.current = document.activeElement as HTMLElement\r\n wasOpen.current = true\r\n }\r\n // Modal is about to close - restore focus BEFORE unmount\r\n else if (!isOpen && wasOpen.current) {\r\n // Blur any focused element inside modal to prevent aria-hidden warning\r\n if (document.activeElement instanceof HTMLElement) {\r\n document.activeElement.blur()\r\n }\r\n // Restore focus to previous element\r\n previousActiveElement.current?.focus()\r\n previousActiveElement.current = null\r\n wasOpen.current = false\r\n }\r\n }, [isOpen])\r\n\r\n // Store onClose in a ref to avoid re-running effects when it changes\r\n const onCloseRef = useRef(onClose)\r\n useEffect(() => {\r\n onCloseRef.current = onClose\r\n }, [onClose])\r\n\r\n // Focus modal when it opens (only once)\r\n useEffect(() => {\r\n if (!isOpen) return\r\n\r\n const modal = modalRef.current\r\n if (modal) {\r\n modal.focus()\r\n }\r\n }, [isOpen])\r\n\r\n // Keyboard handling and body scroll lock\r\n useEffect(() => {\r\n if (!isOpen) return\r\n\r\n const modal = modalRef.current\r\n\r\n const handleKeyDown = (e: KeyboardEvent) => {\r\n if (e.key === 'Escape' && closeOnEscape) {\r\n onCloseRef.current()\r\n return\r\n }\r\n\r\n if (e.key === 'Tab' && modal) {\r\n const focusableElements = modal.querySelectorAll<HTMLElement>(\r\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\r\n )\r\n const firstElement = focusableElements[0]\r\n const lastElement = focusableElements[focusableElements.length - 1]\r\n\r\n if (e.shiftKey && document.activeElement === firstElement) {\r\n e.preventDefault()\r\n lastElement?.focus()\r\n } else if (!e.shiftKey && document.activeElement === lastElement) {\r\n e.preventDefault()\r\n firstElement?.focus()\r\n }\r\n }\r\n }\r\n\r\n document.addEventListener('keydown', handleKeyDown)\r\n document.body.style.overflow = 'hidden'\r\n\r\n return () => {\r\n document.removeEventListener('keydown', handleKeyDown)\r\n document.body.style.overflow = ''\r\n }\r\n }, [isOpen, closeOnEscape])\r\n\r\n const handleOverlayClick = useCallback(\r\n (e: React.MouseEvent) => {\r\n if (e.target === e.currentTarget && closeOnOverlayClick) {\r\n onClose()\r\n }\r\n },\r\n [closeOnOverlayClick, onClose]\r\n )\r\n\r\n // Memoize styles to prevent object recreation on every render\r\n const overlayStyle = useMemo<CSSProperties>(() => ({\r\n position: 'fixed',\r\n inset: 0,\r\n zIndex: 'var(--brycks-z-modal)',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n padding: 24,\r\n backgroundColor: 'var(--brycks-background-overlay)',\r\n backdropFilter: 'blur(4px)',\r\n animation: 'brycks-fade-in var(--brycks-duration-normal) var(--brycks-ease-out)',\r\n }), [])\r\n\r\n const modalStyle = useMemo<CSSProperties>(() => ({\r\n position: 'relative',\r\n width: '100%',\r\n maxWidth: sizeWidths[size],\r\n maxHeight: size === 'full' ? 'calc(100vh - 48px)' : '85vh',\r\n backgroundColor: 'var(--brycks-background-elevated)',\r\n borderRadius: 'var(--brycks-radius-xl)',\r\n boxShadow: 'var(--brycks-shadow-2xl)',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n overflow: 'hidden',\r\n animation: 'brycks-scale-in var(--brycks-duration-normal) var(--brycks-ease-spring)',\r\n outline: 'none',\r\n ...style,\r\n }), [size, style])\r\n\r\n if (!isOpen) return null\r\n\r\n const headerStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'flex-start',\r\n justifyContent: 'space-between',\r\n padding: '20px 24px',\r\n borderBottom: '1px solid var(--brycks-border-muted)',\r\n }\r\n\r\n const titleContainerStyle: CSSProperties = {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: 4,\r\n }\r\n\r\n const titleStyle: CSSProperties = {\r\n fontSize: 18,\r\n fontWeight: 600,\r\n color: 'var(--brycks-foreground-default)',\r\n margin: 0,\r\n lineHeight: 1.3,\r\n }\r\n\r\n const descriptionStyle: CSSProperties = {\r\n fontSize: 14,\r\n color: 'var(--brycks-foreground-muted)',\r\n margin: 0,\r\n }\r\n\r\n const closeButtonStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n width: 32,\r\n height: 32,\r\n borderRadius: 'var(--brycks-radius-md)',\r\n color: 'var(--brycks-foreground-muted)',\r\n transition: 'all var(--brycks-duration-fast) var(--brycks-ease-out)',\r\n marginLeft: 12,\r\n flexShrink: 0,\r\n }\r\n\r\n const contentStyle: CSSProperties = {\r\n flex: 1,\r\n overflow: 'auto',\r\n padding: 24,\r\n }\r\n\r\n const modalContent = (\r\n <div\r\n className=\"brycks-modal-overlay\"\r\n style={overlayStyle}\r\n onClick={handleOverlayClick}\r\n >\r\n <div\r\n ref={(node) => {\r\n (modalRef as React.MutableRefObject<HTMLDivElement | null>).current = node\r\n if (typeof ref === 'function') ref(node)\r\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node\r\n }}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-labelledby={title ? 'brycks-modal-title' : undefined}\r\n aria-describedby={description ? 'brycks-modal-description' : undefined}\r\n className={cx('brycks-modal', `brycks-modal--${size}`, className)}\r\n style={modalStyle}\r\n tabIndex={-1}\r\n data-testid={testId}\r\n {...props}\r\n >\r\n {(title || showCloseButton) && (\r\n <div className=\"brycks-modal-header\" style={headerStyle}>\r\n <div style={titleContainerStyle}>\r\n {title && (\r\n <h2 id=\"brycks-modal-title\" style={titleStyle}>\r\n {title}\r\n </h2>\r\n )}\r\n {description && (\r\n <p id=\"brycks-modal-description\" style={descriptionStyle}>\r\n {description}\r\n </p>\r\n )}\r\n </div>\r\n {showCloseButton && (\r\n <button\r\n type=\"button\"\r\n className=\"brycks-modal-close\"\r\n style={closeButtonStyle}\r\n onClick={onClose}\r\n aria-label=\"Close modal\"\r\n onMouseEnter={(e) => {\r\n e.currentTarget.style.backgroundColor = 'var(--brycks-background-muted)'\r\n e.currentTarget.style.color = 'var(--brycks-foreground-default)'\r\n }}\r\n onMouseLeave={(e) => {\r\n e.currentTarget.style.backgroundColor = 'transparent'\r\n e.currentTarget.style.color = 'var(--brycks-foreground-muted)'\r\n }}\r\n >\r\n <CloseIcon />\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n\r\n <div className=\"brycks-modal-content\" style={contentStyle}>\r\n {children}\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n\r\n return createPortal(modalContent, document.body)\r\n})\r\n\r\nModal.displayName = 'Modal'\r\n"],"names":["sizeWidths","CloseIcon","memo","jsx","Modal","forwardRef","isOpen","onClose","size","title","description","closeOnOverlayClick","closeOnEscape","showCloseButton","className","style","testId","children","props","ref","modalRef","useRef","previousActiveElement","wasOpen","useEffect","onCloseRef","modal","handleKeyDown","e","focusableElements","firstElement","lastElement","handleOverlayClick","useCallback","overlayStyle","useMemo","modalStyle","headerStyle","titleContainerStyle","titleStyle","descriptionStyle","closeButtonStyle","contentStyle","modalContent","jsxs","node","cx","createPortal"],"mappings":";;;;AAgDA,MAAMA,IAAwC;AAAA,EAC5C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR,GAGMC,IAAYC,EAAK,WAAqB;AAC1C,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACtE,UAAA,gBAAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,IAAA;AAAA,EAAA,GAElB;AAEJ,CAAC,GAEYC,IAAQC,EAAuC,SAC1D;AAAA,EACE,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,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AAO,EAAC,OAAA,EAAI,OAAON,GACT,UAAA;AAAA,gBAAA7B,uBACE,MAAA,EAAG,IAAG,sBAAqB,OAAO8B,GAChC,UAAA9B,GACH;AAAA,gBAEDC,KACC,gBAAAP,EAAC,KAAA,EAAE,IAAG,4BAA2B,OAAOqC,GACrC,UAAA9B,EAAA,CACH;AAAA,cAAA,GAEJ;AAAA,cACCG,KACC,gBAAAV;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,OAAOsC;AAAA,kBACP,SAASlC;AAAA,kBACT,cAAW;AAAA,kBACX,cAAc,CAAC,MAAM;AACnB,sBAAE,cAAc,MAAM,kBAAkB,kCACxC,EAAE,cAAc,MAAM,QAAQ;AAAA,kBAChC;AAAA,kBACA,cAAc,CAAC,MAAM;AACnB,sBAAE,cAAc,MAAM,kBAAkB,eACxC,EAAE,cAAc,MAAM,QAAQ;AAAA,kBAChC;AAAA,kBAEA,4BAACN,GAAA,CAAA,CAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACb,GAEJ;AAAA,8BAGD,OAAA,EAAI,WAAU,wBAAuB,OAAOyC,GAC1C,UAAAzB,EAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAIN,SAAO8B,EAAaJ,GAAc,SAAS,IAAI;AACjD,CAAC;AAEDvC,EAAM,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),p=require("react"),h=require("../../../utils/styles.cjs"),o=require("../../../design-system/tokens/spacing.cjs"),e=require("../../../design-system/tokens/typography.cjs"),k={sm:{fontSize:e.fontSizes.xs},md:{fontSize:e.fontSizes.sm},lg:{fontSize:e.fontSizes.md}},n=p.forwardRef(function({children:a,size:s="md",required:i,disabled:t,description:l,className:c,style:f,testId:m,...y},b){const d=k[s],u={display:"block",fontFamily:e.textStyles.label.fontFamily,fontSize:d.fontSize,fontWeight:e.fontWeights.medium,lineHeight:e.textStyles.label.lineHeight,color:t?"var(--brycks-foreground-muted)":"var(--brycks-foreground-default)",cursor:t?"not-allowed":"pointer",marginBottom:o.spacing[1],...f},g={color:"var(--brycks-error-default)",marginLeft:o.spacing[.5]},S={display:"block",fontSize:e.fontSizes.xs,fontWeight:e.fontWeights.regular,color:"var(--brycks-foreground-muted)",marginTop:o.spacing[.5]};return r.jsxs("label",{ref:b,className:h.cx("brycks-form-label",`brycks-form-label--${s}`,t&&"brycks-form-label--disabled",c),style:u,"data-testid":m,...y,children:[r.jsxs("span",{className:"brycks-form-label__text",children:[a,i&&r.jsx("span",{className:"brycks-form-label__required",style:g,"aria-hidden":"true",children:"*"})]}),l&&r.jsx("span",{className:"brycks-form-label__description",style:S,children:l})]})});n.displayName="FormLabel";exports.FormLabel=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),S=require("../../../utils/styles.cjs"),t=require("../../../design-system/tokens/spacing.cjs"),r=require("../../../design-system/tokens/typography.cjs"),h={sm:{fontSize:"var(--brycks-fs-ui-xs)"},md:{fontSize:"var(--brycks-fs-ui-sm)"},lg:{fontSize:"var(--brycks-fs-ui-md)"}},a=p.forwardRef(function({children:i,size:o="md",required:n,disabled:s,description:l,className:c,style:f,testId:y,...m},b){const u=h[o],d={display:"block",fontFamily:r.textStyles.label.fontFamily,fontSize:u.fontSize,fontWeight:r.fontWeights.medium,lineHeight:r.textStyles.label.lineHeight,color:s?"var(--brycks-foreground-muted)":"var(--brycks-foreground-default)",cursor:s?"not-allowed":"pointer",marginBottom:t.spacing[1],...f},g={color:"var(--brycks-error-default)",marginLeft:t.spacing[.5]},k={display:"block",fontSize:"var(--brycks-fs-ui-xs)",fontWeight:r.fontWeights.regular,color:"var(--brycks-foreground-muted)",marginTop:t.spacing[.5]};return e.jsxs("label",{ref:b,className:S.cx("brycks-form-label",`brycks-form-label--${o}`,s&&"brycks-form-label--disabled",c),style:d,"data-testid":y,...m,children:[e.jsxs("span",{className:"brycks-form-label__text",children:[i,n&&e.jsx("span",{className:"brycks-form-label__required",style:g,"aria-hidden":"true",children:"*"})]}),l&&e.jsx("span",{className:"brycks-form-label__description",style:k,children:l})]})});a.displayName="FormLabel";exports.FormLabel=a;
2
2
  //# sourceMappingURL=FormLabel.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormLabel.cjs","sources":["../../../../src/components/form/FormLabel/FormLabel.tsx"],"sourcesContent":["/**\n * FormLabel Component\n *\n * A semantic label component for form fields with consistent styling.\n * Supports required indicator and description text.\n *\n * @module components/form/FormLabel\n */\n\nimport { forwardRef, type LabelHTMLAttributes, type ReactNode } from 'react'\nimport { textStyles, spacing, fontSizes, fontWeights } from '../../../design-system'\nimport { cx } from '../../../utils/styles'\n\nexport type FormLabelSize = 'sm' | 'md' | 'lg'\n\nexport interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Label text */\n children: ReactNode\n /** Label size */\n size?: FormLabelSize\n /** Whether the field is required */\n required?: boolean\n /** Whether the field is disabled */\n disabled?: boolean\n /** Optional description text */\n description?: ReactNode\n /** Custom class name */\n className?: string\n /** Test ID */\n testId?: string\n}\n\nconst sizeStyles: Record<FormLabelSize, { fontSize: number }> = {\n sm: { fontSize: fontSizes.xs },\n md: { fontSize: fontSizes.sm },\n lg: { fontSize: fontSizes.md },\n}\n\nexport const FormLabel = forwardRef<HTMLLabelElement, FormLabelProps>(function FormLabel(\n {\n children,\n size = 'md',\n required,\n disabled,\n description,\n className,\n style,\n testId,\n ...props\n },\n ref\n) {\n const config = sizeStyles[size]\n\n const labelStyle = {\n display: 'block',\n fontFamily: textStyles.label.fontFamily,\n fontSize: config.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: textStyles.label.lineHeight,\n color: disabled ? 'var(--brycks-foreground-muted)' : 'var(--brycks-foreground-default)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n marginBottom: spacing[1],\n ...style,\n }\n\n const requiredStyle = {\n color: 'var(--brycks-error-default)',\n marginLeft: spacing[0.5],\n }\n\n const descriptionStyle = {\n display: 'block',\n fontSize: fontSizes.xs,\n fontWeight: fontWeights.regular,\n color: 'var(--brycks-foreground-muted)',\n marginTop: spacing[0.5],\n }\n\n return (\n <label\n ref={ref}\n className={cx(\n 'brycks-form-label',\n `brycks-form-label--${size}`,\n disabled && 'brycks-form-label--disabled',\n className\n )}\n style={labelStyle}\n data-testid={testId}\n {...props}\n >\n <span className=\"brycks-form-label__text\">\n {children}\n {required && (\n <span className=\"brycks-form-label__required\" style={requiredStyle} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n {description && (\n <span className=\"brycks-form-label__description\" style={descriptionStyle}>\n {description}\n </span>\n )}\n </label>\n )\n})\n\nFormLabel.displayName = 'FormLabel'\n"],"names":["sizeStyles","fontSizes","FormLabel","forwardRef","children","size","required","disabled","description","className","style","testId","props","ref","config","labelStyle","textStyles","fontWeights","spacing","requiredStyle","descriptionStyle","jsxs","cx","jsx"],"mappings":"gSAgCMA,EAA0D,CAC9D,GAAI,CAAE,SAAUC,EAAAA,UAAU,EAAA,EAC1B,GAAI,CAAE,SAAUA,EAAAA,UAAU,EAAA,EAC1B,GAAI,CAAE,SAAUA,EAAAA,UAAU,EAAA,CAC5B,EAEaC,EAAYC,EAAAA,WAA6C,SACpE,CACE,SAAAC,EACA,KAAAC,EAAO,KACP,SAAAC,EACA,SAAAC,EACA,YAAAC,EACA,UAAAC,EACA,MAAAC,EACA,OAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAASd,EAAWK,CAAI,EAExBU,EAAa,CACjB,QAAS,QACT,WAAYC,EAAAA,WAAW,MAAM,WAC7B,SAAUF,EAAO,SACjB,WAAYG,EAAAA,YAAY,OACxB,WAAYD,EAAAA,WAAW,MAAM,WAC7B,MAAOT,EAAW,iCAAmC,mCACrD,OAAQA,EAAW,cAAgB,UACnC,aAAcW,EAAAA,QAAQ,CAAC,EACvB,GAAGR,CAAA,EAGCS,EAAgB,CACpB,MAAO,8BACP,WAAYD,EAAAA,QAAQ,EAAG,CAAA,EAGnBE,EAAmB,CACvB,QAAS,QACT,SAAUnB,EAAAA,UAAU,GACpB,WAAYgB,EAAAA,YAAY,QACxB,MAAO,iCACP,UAAWC,EAAAA,QAAQ,EAAG,CAAA,EAGxB,OACEG,EAAAA,KAAC,QAAA,CACC,IAAAR,EACA,UAAWS,EAAAA,GACT,oBACA,sBAAsBjB,CAAI,GAC1BE,GAAY,8BACZE,CAAA,EAEF,MAAOM,EACP,cAAaJ,EACZ,GAAGC,EAEJ,SAAA,CAAAS,EAAAA,KAAC,OAAA,CAAK,UAAU,0BACb,SAAA,CAAAjB,EACAE,SACE,OAAA,CAAK,UAAU,8BAA8B,MAAOa,EAAe,cAAY,OAAO,SAAA,GAAA,CAEvF,CAAA,EAEJ,EACCX,GACCe,EAAAA,IAAC,OAAA,CAAK,UAAU,iCAAiC,MAAOH,EACrD,SAAAZ,CAAA,CACH,CAAA,CAAA,CAAA,CAIR,CAAC,EAEDN,EAAU,YAAc"}
1
+ {"version":3,"file":"FormLabel.cjs","sources":["../../../../src/components/form/FormLabel/FormLabel.tsx"],"sourcesContent":["/**\n * FormLabel Component\n *\n * A semantic label component for form fields with consistent styling.\n * Supports required indicator and description text.\n * Uses CSS variables for font sizes to enable dynamic scaling.\n *\n * @module components/form/FormLabel\n */\n\nimport { forwardRef, type LabelHTMLAttributes, type ReactNode } from 'react'\nimport { textStyles, spacing, fontWeights } from '../../../design-system'\nimport { cx } from '../../../utils/styles'\n\nexport type FormLabelSize = 'sm' | 'md' | 'lg'\n\nexport interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Label text */\n children: ReactNode\n /** Label size */\n size?: FormLabelSize\n /** Whether the field is required */\n required?: boolean\n /** Whether the field is disabled */\n disabled?: boolean\n /** Optional description text */\n description?: ReactNode\n /** Custom class name */\n className?: string\n /** Test ID */\n testId?: string\n}\n\n/**\n * Maps FormLabel sizes to CSS variables\n * Uses --brycks-fs-ui-* for UI elements\n */\nconst sizeStyles: Record<FormLabelSize, { fontSize: string }> = {\n sm: { fontSize: 'var(--brycks-fs-ui-xs)' },\n md: { fontSize: 'var(--brycks-fs-ui-sm)' },\n lg: { fontSize: 'var(--brycks-fs-ui-md)' },\n}\n\nexport const FormLabel = forwardRef<HTMLLabelElement, FormLabelProps>(function FormLabel(\n {\n children,\n size = 'md',\n required,\n disabled,\n description,\n className,\n style,\n testId,\n ...props\n },\n ref\n) {\n const config = sizeStyles[size]\n\n const labelStyle = {\n display: 'block',\n fontFamily: textStyles.label.fontFamily,\n fontSize: config.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: textStyles.label.lineHeight,\n color: disabled ? 'var(--brycks-foreground-muted)' : 'var(--brycks-foreground-default)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n marginBottom: spacing[1],\n ...style,\n }\n\n const requiredStyle = {\n color: 'var(--brycks-error-default)',\n marginLeft: spacing[0.5],\n }\n\n const descriptionStyle = {\n display: 'block',\n fontSize: 'var(--brycks-fs-ui-xs)',\n fontWeight: fontWeights.regular,\n color: 'var(--brycks-foreground-muted)',\n marginTop: spacing[0.5],\n }\n\n return (\n <label\n ref={ref}\n className={cx(\n 'brycks-form-label',\n `brycks-form-label--${size}`,\n disabled && 'brycks-form-label--disabled',\n className\n )}\n style={labelStyle}\n data-testid={testId}\n {...props}\n >\n <span className=\"brycks-form-label__text\">\n {children}\n {required && (\n <span className=\"brycks-form-label__required\" style={requiredStyle} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n {description && (\n <span className=\"brycks-form-label__description\" style={descriptionStyle}>\n {description}\n </span>\n )}\n </label>\n )\n})\n\nFormLabel.displayName = 'FormLabel'\n"],"names":["sizeStyles","FormLabel","forwardRef","children","size","required","disabled","description","className","style","testId","props","ref","config","labelStyle","textStyles","fontWeights","spacing","requiredStyle","descriptionStyle","jsxs","c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,68 @@
1
- import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as h } from "react";
3
- import { cx as x } from "../../../utils/styles.js";
4
- import { spacing as o } from "../../../design-system/tokens/spacing.js";
5
- import { textStyles as i, fontWeights as n, fontSizes as e } from "../../../design-system/tokens/typography.js";
6
- const z = {
7
- sm: { fontSize: e.xs },
8
- md: { fontSize: e.sm },
9
- lg: { fontSize: e.md }
10
- }, _ = h(function({
11
- children: m,
12
- size: t = "md",
1
+ import { jsxs as t, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as S } from "react";
3
+ import { cx as h } from "../../../utils/styles.js";
4
+ import { spacing as e } from "../../../design-system/tokens/spacing.js";
5
+ import { textStyles as a, fontWeights as i } from "../../../design-system/tokens/typography.js";
6
+ const v = {
7
+ sm: { fontSize: "var(--brycks-fs-ui-xs)" },
8
+ md: { fontSize: "var(--brycks-fs-ui-sm)" },
9
+ lg: { fontSize: "var(--brycks-fs-ui-md)" }
10
+ }, x = S(function({
11
+ children: n,
12
+ size: o = "md",
13
13
  required: c,
14
14
  disabled: r,
15
15
  description: l,
16
- className: f,
17
- style: d,
16
+ className: m,
17
+ style: f,
18
18
  testId: b,
19
19
  ...y
20
- }, p) {
21
- const g = z[t], u = {
20
+ }, d) {
21
+ const u = v[o], k = {
22
22
  display: "block",
23
- fontFamily: i.label.fontFamily,
24
- fontSize: g.fontSize,
25
- fontWeight: n.medium,
26
- lineHeight: i.label.lineHeight,
23
+ fontFamily: a.label.fontFamily,
24
+ fontSize: u.fontSize,
25
+ fontWeight: i.medium,
26
+ lineHeight: a.label.lineHeight,
27
27
  color: r ? "var(--brycks-foreground-muted)" : "var(--brycks-foreground-default)",
28
28
  cursor: r ? "not-allowed" : "pointer",
29
- marginBottom: o[1],
30
- ...d
31
- }, k = {
29
+ marginBottom: e[1],
30
+ ...f
31
+ }, p = {
32
32
  color: "var(--brycks-error-default)",
33
- marginLeft: o[0.5]
34
- }, S = {
33
+ marginLeft: e[0.5]
34
+ }, g = {
35
35
  display: "block",
36
- fontSize: e.xs,
37
- fontWeight: n.regular,
36
+ fontSize: "var(--brycks-fs-ui-xs)",
37
+ fontWeight: i.regular,
38
38
  color: "var(--brycks-foreground-muted)",
39
- marginTop: o[0.5]
39
+ marginTop: e[0.5]
40
40
  };
41
- return /* @__PURE__ */ s(
41
+ return /* @__PURE__ */ t(
42
42
  "label",
43
43
  {
44
- ref: p,
45
- className: x(
44
+ ref: d,
45
+ className: h(
46
46
  "brycks-form-label",
47
- `brycks-form-label--${t}`,
47
+ `brycks-form-label--${o}`,
48
48
  r && "brycks-form-label--disabled",
49
- f
49
+ m
50
50
  ),
51
- style: u,
51
+ style: k,
52
52
  "data-testid": b,
53
53
  ...y,
54
54
  children: [
55
- /* @__PURE__ */ s("span", { className: "brycks-form-label__text", children: [
56
- m,
57
- c && /* @__PURE__ */ a("span", { className: "brycks-form-label__required", style: k, "aria-hidden": "true", children: "*" })
55
+ /* @__PURE__ */ t("span", { className: "brycks-form-label__text", children: [
56
+ n,
57
+ c && /* @__PURE__ */ s("span", { className: "brycks-form-label__required", style: p, "aria-hidden": "true", children: "*" })
58
58
  ] }),
59
- l && /* @__PURE__ */ a("span", { className: "brycks-form-label__description", style: S, children: l })
59
+ l && /* @__PURE__ */ s("span", { className: "brycks-form-label__description", style: g, children: l })
60
60
  ]
61
61
  }
62
62
  );
63
63
  });
64
- _.displayName = "FormLabel";
64
+ x.displayName = "FormLabel";
65
65
  export {
66
- _ as FormLabel
66
+ x as FormLabel
67
67
  };
68
68
  //# sourceMappingURL=FormLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormLabel.js","sources":["../../../../src/components/form/FormLabel/FormLabel.tsx"],"sourcesContent":["/**\n * FormLabel Component\n *\n * A semantic label component for form fields with consistent styling.\n * Supports required indicator and description text.\n *\n * @module components/form/FormLabel\n */\n\nimport { forwardRef, type LabelHTMLAttributes, type ReactNode } from 'react'\nimport { textStyles, spacing, fontSizes, fontWeights } from '../../../design-system'\nimport { cx } from '../../../utils/styles'\n\nexport type FormLabelSize = 'sm' | 'md' | 'lg'\n\nexport interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Label text */\n children: ReactNode\n /** Label size */\n size?: FormLabelSize\n /** Whether the field is required */\n required?: boolean\n /** Whether the field is disabled */\n disabled?: boolean\n /** Optional description text */\n description?: ReactNode\n /** Custom class name */\n className?: string\n /** Test ID */\n testId?: string\n}\n\nconst sizeStyles: Record<FormLabelSize, { fontSize: number }> = {\n sm: { fontSize: fontSizes.xs },\n md: { fontSize: fontSizes.sm },\n lg: { fontSize: fontSizes.md },\n}\n\nexport const FormLabel = forwardRef<HTMLLabelElement, FormLabelProps>(function FormLabel(\n {\n children,\n size = 'md',\n required,\n disabled,\n description,\n className,\n style,\n testId,\n ...props\n },\n ref\n) {\n const config = sizeStyles[size]\n\n const labelStyle = {\n display: 'block',\n fontFamily: textStyles.label.fontFamily,\n fontSize: config.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: textStyles.label.lineHeight,\n color: disabled ? 'var(--brycks-foreground-muted)' : 'var(--brycks-foreground-default)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n marginBottom: spacing[1],\n ...style,\n }\n\n const requiredStyle = {\n color: 'var(--brycks-error-default)',\n marginLeft: spacing[0.5],\n }\n\n const descriptionStyle = {\n display: 'block',\n fontSize: fontSizes.xs,\n fontWeight: fontWeights.regular,\n color: 'var(--brycks-foreground-muted)',\n marginTop: spacing[0.5],\n }\n\n return (\n <label\n ref={ref}\n className={cx(\n 'brycks-form-label',\n `brycks-form-label--${size}`,\n disabled && 'brycks-form-label--disabled',\n className\n )}\n style={labelStyle}\n data-testid={testId}\n {...props}\n >\n <span className=\"brycks-form-label__text\">\n {children}\n {required && (\n <span className=\"brycks-form-label__required\" style={requiredStyle} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n {description && (\n <span className=\"brycks-form-label__description\" style={descriptionStyle}>\n {description}\n </span>\n )}\n </label>\n )\n})\n\nFormLabel.displayName = 'FormLabel'\n"],"names":["sizeStyles","fontSizes","FormLabel","forwardRef","children","size","required","disabled","description","className","style","testId","props","ref","config","labelStyle","textStyles","fontWeights","spacing","requiredStyle","descriptionStyle","jsxs","cx","jsx"],"mappings":";;;;;AAgCA,MAAMA,IAA0D;AAAA,EAC9D,IAAI,EAAE,UAAUC,EAAU,GAAA;AAAA,EAC1B,IAAI,EAAE,UAAUA,EAAU,GAAA;AAAA,EAC1B,IAAI,EAAE,UAAUA,EAAU,GAAA;AAC5B,GAEaC,IAAYC,EAA6C,SACpE;AAAA,EACE,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAASd,EAAWK,CAAI,GAExBU,IAAa;AAAA,IACjB,SAAS;AAAA,IACT,YAAYC,EAAW,MAAM;AAAA,IAC7B,UAAUF,EAAO;AAAA,IACjB,YAAYG,EAAY;AAAA,IACxB,YAAYD,EAAW,MAAM;AAAA,IAC7B,OAAOT,IAAW,mCAAmC;AAAA,IACrD,QAAQA,IAAW,gBAAgB;AAAA,IACnC,cAAcW,EAAQ,CAAC;AAAA,IACvB,GAAGR;AAAA,EAAA,GAGCS,IAAgB;AAAA,IACpB,OAAO;AAAA,IACP,YAAYD,EAAQ,GAAG;AAAA,EAAA,GAGnBE,IAAmB;AAAA,IACvB,SAAS;AAAA,IACT,UAAUnB,EAAU;AAAA,IACpB,YAAYgB,EAAY;AAAA,IACxB,OAAO;AAAA,IACP,WAAWC,EAAQ,GAAG;AAAA,EAAA;AAGxB,SACE,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAR;AAAA,MACA,WAAWS;AAAA,QACT;AAAA,QACA,sBAAsBjB,CAAI;AAAA,QAC1BE,KAAY;AAAA,QACZE;AAAA,MAAA;AAAA,MAEF,OAAOM;AAAA,MACP,eAAaJ;AAAA,MACZ,GAAGC;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAS,EAAC,QAAA,EAAK,WAAU,2BACb,UAAA;AAAA,UAAAjB;AAAA,UACAE,uBACE,QAAA,EAAK,WAAU,+BAA8B,OAAOa,GAAe,eAAY,QAAO,UAAA,IAAA,CAEvF;AAAA,QAAA,GAEJ;AAAA,QACCX,KACC,gBAAAe,EAAC,QAAA,EAAK,WAAU,kCAAiC,OAAOH,GACrD,UAAAZ,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;AAEDN,EAAU,cAAc;"}
1
+ {"version":3,"file":"FormLabel.js","sources":["../../../../src/components/form/FormLabel/FormLabel.tsx"],"sourcesContent":["/**\n * FormLabel Component\n *\n * A semantic label component for form fields with consistent styling.\n * Supports required indicator and description text.\n * Uses CSS variables for font sizes to enable dynamic scaling.\n *\n * @module components/form/FormLabel\n */\n\nimport { forwardRef, type LabelHTMLAttributes, type ReactNode } from 'react'\nimport { textStyles, spacing, fontWeights } from '../../../design-system'\nimport { cx } from '../../../utils/styles'\n\nexport type FormLabelSize = 'sm' | 'md' | 'lg'\n\nexport interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Label text */\n children: ReactNode\n /** Label size */\n size?: FormLabelSize\n /** Whether the field is required */\n required?: boolean\n /** Whether the field is disabled */\n disabled?: boolean\n /** Optional description text */\n description?: ReactNode\n /** Custom class name */\n className?: string\n /** Test ID */\n testId?: string\n}\n\n/**\n * Maps FormLabel sizes to CSS variables\n * Uses --brycks-fs-ui-* for UI elements\n */\nconst sizeStyles: Record<FormLabelSize, { fontSize: string }> = {\n sm: { fontSize: 'var(--brycks-fs-ui-xs)' },\n md: { fontSize: 'var(--brycks-fs-ui-sm)' },\n lg: { fontSize: 'var(--brycks-fs-ui-md)' },\n}\n\nexport const FormLabel = forwardRef<HTMLLabelElement, FormLabelProps>(function FormLabel(\n {\n children,\n size = 'md',\n required,\n disabled,\n description,\n className,\n style,\n testId,\n ...props\n },\n ref\n) {\n const config = sizeStyles[size]\n\n const labelStyle = {\n display: 'block',\n fontFamily: textStyles.label.fontFamily,\n fontSize: config.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: textStyles.label.lineHeight,\n color: disabled ? 'var(--brycks-foreground-muted)' : 'var(--brycks-foreground-default)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n marginBottom: spacing[1],\n ...style,\n }\n\n const requiredStyle = {\n color: 'var(--brycks-error-default)',\n marginLeft: spacing[0.5],\n }\n\n const descriptionStyle = {\n display: 'block',\n fontSize: 'var(--brycks-fs-ui-xs)',\n fontWeight: fontWeights.regular,\n color: 'var(--brycks-foreground-muted)',\n marginTop: spacing[0.5],\n }\n\n return (\n <label\n ref={ref}\n className={cx(\n 'brycks-form-label',\n `brycks-form-label--${size}`,\n disabled && 'brycks-form-label--disabled',\n className\n )}\n style={labelStyle}\n data-testid={testId}\n {...props}\n >\n <span className=\"brycks-form-label__text\">\n {children}\n {required && (\n <span className=\"brycks-form-label__required\" style={requiredStyle} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n {description && (\n <span className=\"brycks-form-label__description\" style={descriptionStyle}>\n {description}\n </span>\n )}\n </label>\n )\n})\n\nFormLabel.displayName = 'FormLabel'\n"],"names":["sizeStyles","FormLabel","forwardRef","children","size","required","disabled","description","className","style","testId","props","ref","config","labelStyle","textStyles","fontWeights","spacing","requiredStyle","descriptionStyle","jsxs","cx","jsx"],"mappings":";;;;;AAqCA,MAAMA,IAA0D;AAAA,EAC9D,IAAI,EAAE,UAAU,yBAAA;AAAA,EAChB,IAAI,EAAE,UAAU,yBAAA;AAAA,EAChB,IAAI,EAAE,UAAU,yBAAA;AAClB,GAEaC,IAAYC,EAA6C,SACpE;AAAA,EACE,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAA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exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),y=require("react"),F=require("../../../utils/styles.cjs"),d=require("../../../design-system/primitives/focus.cjs"),t=require("../../../design-system/primitives/sizing.cjs"),u=require("../../../design-system/primitives/typography.cjs"),f=require("../../../design-system/primitives/transitions.cjs"),C=require("../../../design-system/primitives/opacity.cjs"),O={sm:{height:t.componentHeights.sm,fontSize:u.componentFontSize.sm,paddingX:t.componentPaddingX.sm,radius:"var(--brycks-radius-md)"},md:{height:t.componentHeights.md,fontSize:u.componentFontSize.md,paddingX:t.componentPaddingX.md,radius:"var(--brycks-radius-default)"},lg:{height:t.componentHeights.lg,fontSize:u.componentFontSize.lg,paddingX:t.componentPaddingX.lg,radius:"var(--brycks-radius-lg)"}},m=y.forwardRef(function({size:p="md",variant:l="outline",isInvalid:n,leftElement:i,rightElement:c,className:k,style:h,testId:S,disabled:o,onFocus:v,onBlur:x,...w},j){const[s,g]=y.useState(!1),r=O[p],R=()=>{const e={display:"flex",alignItems:"center",width:"100%",position:"relative",height:r.height,borderRadius:r.radius,transition:f.transition.default};switch(l){case"outline":Object.assign(e,{backgroundColor:"var(--brycks-background-app)",border:`1px solid ${n?"var(--brycks-error-default)":s?"var(--brycks-border-focus)":"var(--brycks-border-default)"}`,boxShadow:s?n?d.focusRing.error:d.focusRing.default:d.focusRing.none});break;case"filled":Object.assign(e,{backgroundColor:"var(--brycks-background-muted)",border:"1px solid transparent",borderColor:n?"var(--brycks-error-default)":s?"var(--brycks-border-focus)":"transparent"});break;case"flushed":Object.assign(e,{backgroundColor:"transparent",borderRadius:0,borderBottom:`2px solid ${n?"var(--brycks-error-default)":s?"var(--brycks-border-focus)":"var(--brycks-border-default)"}`});break}return o&&Object.assign(e,{opacity:C.stateOpacity.disabled,cursor:"not-allowed"}),e},X={width:"100%",height:r.height,fontFamily:"var(--brycks-font-sans)",fontSize:r.fontSize,color:"var(--brycks-foreground-default)",backgroundColor:"transparent",border:"none",outline:"none",borderRadius:r.radius,paddingLeft:i?t.componentGap.md:r.paddingX,paddingRight:c?t.componentGap.md:r.paddingX,cursor:o?"not-allowed":"text",transition:f.transition.default},z=e=>{g(!0),v?.(e)},q=e=>{g(!1),x?.(e)},b={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--brycks-foreground-muted)",flexShrink:0};return a.jsxs("div",{className:F.cx("brycks-input-wrapper",`brycks-input-wrapper--${l}`,`brycks-input-wrapper--${p}`,n&&"brycks-input-wrapper--invalid",o&&"brycks-input-wrapper--disabled",k),style:{...R(),...h},children:[i&&a.jsx("span",{className:"brycks-input-left-element",style:{...b,paddingLeft:r.paddingX},children:i}),a.jsx("input",{ref:j,className:"brycks-input",style:X,disabled:o,"aria-invalid":n,"data-testid":S,onFocus:z,onBlur:q,...w}),c&&a.jsx("span",{className:"brycks-input-right-element",style:{...b,paddingRight:r.paddingX},children:c})]})});m.displayName="Input";exports.Input=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),y=require("react"),F=require("../../../utils/styles.cjs"),d=require("../../../design-system/primitives/typography.cjs"),u=require("../../../design-system/primitives/focus.cjs"),t=require("../../../design-system/primitives/sizing.cjs"),f=require("../../../design-system/primitives/transitions.cjs"),C=require("../../../design-system/primitives/opacity.cjs"),O={sm:{height:t.componentHeights.sm,fontSize:d.componentFontSize.sm,paddingX:t.componentPaddingX.sm,radius:"var(--brycks-radius-md)"},md:{height:t.componentHeights.md,fontSize:d.componentFontSize.md,paddingX:t.componentPaddingX.md,radius:"var(--brycks-radius-default)"},lg:{height:t.componentHeights.lg,fontSize:d.componentFontSize.lg,paddingX:t.componentPaddingX.lg,radius:"var(--brycks-radius-lg)"}},m=y.forwardRef(function({size:p="md",variant:l="outline",isInvalid:n,leftElement:i,rightElement:c,className:k,style:h,testId:S,disabled:o,onFocus:v,onBlur:x,...w},j){const[s,g]=y.useState(!1),r=O[p],R=()=>{const e={display:"flex",alignItems:"center",width:"100%",position:"relative",height:r.height,borderRadius:r.radius,transition:f.transition.default};switch(l){case"outline":Object.assign(e,{backgroundColor:"var(--brycks-background-app)",border:`1px solid ${n?"var(--brycks-error-default)":s?"var(--brycks-border-focus)":"var(--brycks-border-default)"}`,boxShadow:s?n?u.focusRing.error:u.focusRing.default:u.focusRing.none});break;case"filled":Object.assign(e,{backgroundColor:"var(--brycks-background-muted)",border:"1px solid transparent",borderColor:n?"var(--brycks-error-default)":s?"var(--brycks-border-focus)":"transparent"});break;case"flushed":Object.assign(e,{backgroundColor:"transparent",borderRadius:0,borderBottom:`2px solid ${n?"var(--brycks-error-default)":s?"var(--brycks-border-focus)":"var(--brycks-border-default)"}`});break}return o&&Object.assign(e,{opacity:C.stateOpacity.disabled,cursor:"not-allowed"}),e},X={width:"100%",height:r.height,fontFamily:"var(--brycks-font-sans)",fontSize:r.fontSize,color:"var(--brycks-foreground-default)",backgroundColor:"transparent",border:"none",outline:"none",borderRadius:r.radius,paddingLeft:i?t.componentGap.md:r.paddingX,paddingRight:c?t.componentGap.md:r.paddingX,cursor:o?"not-allowed":"text",transition:f.transition.default},z=e=>{g(!0),v?.(e)},q=e=>{g(!1),x?.(e)},b={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--brycks-foreground-muted)",flexShrink:0};return a.jsxs("div",{className:F.cx("brycks-input-wrapper",`brycks-input-wrapper--${l}`,`brycks-input-wrapper--${p}`,n&&"brycks-input-wrapper--invalid",o&&"brycks-input-wrapper--disabled",k),style:{...R(),...h},children:[i&&a.jsx("span",{className:"brycks-input-left-element",style:{...b,paddingLeft:r.paddingX},children:i}),a.jsx("input",{ref:j,className:"brycks-input",style:X,disabled:o,"aria-invalid":n,"data-testid":S,onFocus:z,onBlur:q,...w}),c&&a.jsx("span",{className:"brycks-input-right-element",style:{...b,paddingRight:r.paddingX},children:c})]})});m.displayName="Input";exports.Input=m;
2
2
  //# sourceMappingURL=Input.cjs.map
@@ -1,28 +1,28 @@
1
1
  import { jsxs as F, jsx as d } from "react/jsx-runtime";
2
2
  import { forwardRef as N, useState as O } from "react";
3
3
  import { cx as $ } from "../../../utils/styles.js";
4
- import { focusRing as i } from "../../../design-system/primitives/focus.js";
5
- import { componentPaddingX as c, componentHeights as p, componentGap as m } from "../../../design-system/primitives/sizing.js";
6
- import { componentFontSize as u } from "../../../design-system/primitives/typography.js";
4
+ import { componentFontSize as i } from "../../../design-system/primitives/typography.js";
5
+ import { focusRing as c } from "../../../design-system/primitives/focus.js";
6
+ import { componentPaddingX as p, componentHeights as u, componentGap as m } from "../../../design-system/primitives/sizing.js";
7
7
  import { transition as y } from "../../../design-system/primitives/transitions.js";
8
8
  import { stateOpacity as B } from "../../../design-system/primitives/opacity.js";
9
9
  const L = {
10
10
  sm: {
11
- height: p.sm,
12
- fontSize: u.sm,
13
- paddingX: c.sm,
11
+ height: u.sm,
12
+ fontSize: i.sm,
13
+ paddingX: p.sm,
14
14
  radius: "var(--brycks-radius-md)"
15
15
  },
16
16
  md: {
17
- height: p.md,
18
- fontSize: u.md,
19
- paddingX: c.md,
17
+ height: u.md,
18
+ fontSize: i.md,
19
+ paddingX: p.md,
20
20
  radius: "var(--brycks-radius-default)"
21
21
  },
22
22
  lg: {
23
- height: p.lg,
24
- fontSize: u.lg,
25
- paddingX: c.lg,
23
+ height: u.lg,
24
+ fontSize: i.lg,
25
+ paddingX: p.lg,
26
26
  radius: "var(--brycks-radius-lg)"
27
27
  }
28
28
  }, G = N(function({
@@ -54,7 +54,7 @@ const L = {
54
54
  Object.assign(e, {
55
55
  backgroundColor: "var(--brycks-background-app)",
56
56
  border: `1px solid ${t ? "var(--brycks-error-default)" : a ? "var(--brycks-border-focus)" : "var(--brycks-border-default)"}`,
57
- boxShadow: a ? t ? i.error : i.default : i.none
57
+ boxShadow: a ? t ? c.error : c.default : c.none
58
58
  });
59
59
  break;
60
60
  case "filled":