@marwes-ui/react 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,14 +18,14 @@ pnpm add @marwes-ui/core @marwes-ui/react @marwes-ui/presets
18
18
 
19
19
  ## Quick Start
20
20
  ```tsx
21
- import { MarwesProvider, Button, Input, Checkbox } from "@marwes-ui/react";
21
+ import { MarwesProvider, Button, ButtonVariant, Input, Checkbox } from "@marwes-ui/react";
22
22
  import { firstEdition } from "@marwes-ui/presets";
23
23
  import "@marwes-ui/presets/firstEdition/styles.css";
24
24
 
25
25
  export function App() {
26
26
  return (
27
27
  <MarwesProvider preset={firstEdition} theme={{ color: { primary: "#5B8CFF" } }}>
28
- <Button tone="primary">Save</Button>
28
+ <Button variant={ButtonVariant.primary}>Save</Button>
29
29
  <Input placeholder="Email" onValueChange={(v) => console.log(v)} />
30
30
  <Checkbox ariaLabel="Subscribe" />
31
31
  </MarwesProvider>
@@ -33,6 +33,37 @@ export function App() {
33
33
  }
34
34
  ```
35
35
 
36
+ ## Button Philosophy
37
+
38
+ Marwes buttons follow a **semantic-first** approach:
39
+
40
+ ### Recommended: Semantic Components
41
+ ```tsx
42
+ import { CancelButton, SubmitButton, CreateButton, DangerButton } from "@marwes-ui/react";
43
+
44
+ // These auto-set AI-friendly action metadata
45
+ <CancelButton onClick={handleCancel}>Cancel</CancelButton>
46
+ <SubmitButton>Save</SubmitButton>
47
+ <CreateButton onClick={handleCreate}>New Item</CreateButton>
48
+ <DangerButton onClick={handleDelete}>Delete</DangerButton>
49
+ ```
50
+
51
+ ### Advanced: Raw Props with Type-Safe Enums
52
+ ```tsx
53
+ import { Button, ButtonVariant, ButtonSize, ButtonAction } from "@marwes-ui/react";
54
+
55
+ // For dynamic or custom scenarios
56
+ <Button
57
+ variant={ButtonVariant.primary}
58
+ size={ButtonSize.md}
59
+ action={ButtonAction.submit}
60
+ >
61
+ Submit
62
+ </Button>
63
+ ```
64
+
65
+ Semantic components are preferred for guaranteed AI context and consistent UX.
66
+
36
67
  ## Current Exports
37
68
  Provider and hooks:
38
69
  - `MarwesProvider`
@@ -40,13 +71,19 @@ Provider and hooks:
40
71
  - `useSystem`
41
72
 
42
73
  Atoms:
43
- - `Button`
74
+ - `Button`, `PrimaryButton`, `SecondaryButton`, `TextButton`
75
+ - `CancelButton`, `SubmitButton`, `CreateButton`, `DangerButton`, `LinkButton`
44
76
  - `Input`
45
77
  - `Icon`
46
78
  - `Checkbox`
47
79
  - `H1`, `H2`, `H3`
48
80
  - `Paragraph`
49
81
 
82
+ Enums (const objects):
83
+ - `ButtonVariant` - `primary`, `secondary`, `text`
84
+ - `ButtonSize` - `xs`, `sm`, `md`, `lg`
85
+ - `ButtonAction` - `submit`, `cancel`, `create`, `delete`, `navigate`, `edit`, `reset`, `button`
86
+
50
87
  Molecules:
51
88
  - `CheckboxField`
52
89
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Preset, ThemeOverrides, ThemeMode, System, Theme, ButtonOptions, InputOptions, iconRegistry, IconSize, IconStrokeWidth, CheckboxProps as CheckboxProps$1, DividerOptions, DividerSize, DividerOrientation, HeadingOptions, HeadingSize, ParagraphOptions, ParagraphSize } from '@marwes-ui/core';
3
- export { Preset, System, Theme, ThemeOverrides } from '@marwes-ui/core';
3
+ export { ButtonAction, ButtonSize, ButtonVariant, IconName, Preset, System, Theme, ThemeOverrides } from '@marwes-ui/core';
4
4
  import * as React from 'react';
5
5
 
6
6
  type MarwesProviderProps = {
@@ -52,7 +52,7 @@ declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
52
52
  * metadata, making it easier for both developers and AI tools to understand
53
53
  * the purpose and behavior of each button.
54
54
  */
55
- type DangerButtonProps = Omit<ButtonProps, "tone" | "action"> & {
55
+ type DangerButtonProps = Omit<ButtonProps, "variant" | "action"> & {
56
56
  /**
57
57
  * Override automatic confirmation requirement.
58
58
  * Defaults to `true` for destructive actions.
@@ -63,7 +63,7 @@ type DangerButtonProps = Omit<ButtonProps, "tone" | "action"> & {
63
63
  * DangerButton - For destructive actions like delete, remove, or irreversible operations.
64
64
  *
65
65
  * **AI Context:**
66
- * - Sets `tone="danger"` for visual warning
66
+ * - Sets `variant="primary"` with error state for visual warning
67
67
  * - Sets `action="delete"` to indicate destructive behavior
68
68
  * - Enables confirmation by default
69
69
  * - Adds `data-destructive="true"` for AI parsing
@@ -110,13 +110,13 @@ type SubmitButtonProps = Omit<ButtonProps, "action" | "as">;
110
110
  * ```
111
111
  */
112
112
  declare function SubmitButton(props: SubmitButtonProps): react_jsx_runtime.JSX.Element;
113
- type CancelButtonProps = Omit<ButtonProps, "action" | "variant">;
113
+ type CancelButtonProps = Omit<ButtonProps, "action">;
114
114
  /**
115
115
  * CancelButton - For cancel or reset actions.
116
116
  *
117
117
  * **AI Context:**
118
118
  * - Sets `action="cancel"` to indicate cancellation
119
- * - Uses ghost variant and secondary tone by default
119
+ * - Uses secondary variant by default
120
120
  * - Adds `data-cancel="true"` for AI parsing
121
121
  *
122
122
  * @example
@@ -149,7 +149,7 @@ type LinkButtonProps = Omit<ButtonProps, "action" | "as"> & {
149
149
  * ```
150
150
  */
151
151
  declare function LinkButton(props: LinkButtonProps): react_jsx_runtime.JSX.Element;
152
- type PrimaryButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
152
+ type PrimaryButtonProps = Omit<ButtonProps, "variant" | "as"> & {};
153
153
  /**
154
154
  * PrimaryButton - For general use when no specific semantic variant fits.
155
155
  *
@@ -161,7 +161,7 @@ type PrimaryButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
161
161
  * ```
162
162
  */
163
163
  declare function PrimaryButton(props: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
164
- type SecondaryButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
164
+ type SecondaryButtonProps = Omit<ButtonProps, "variant" | "as"> & {};
165
165
  /**
166
166
  * SecondaryButton - For general use when no specific semantic variant fits.
167
167
  *
@@ -173,7 +173,7 @@ type SecondaryButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
173
173
  * ```
174
174
  */
175
175
  declare function SecondaryButton(props: SecondaryButtonProps): react_jsx_runtime.JSX.Element;
176
- type TextButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
176
+ type TextButtonProps = Omit<ButtonProps, "variant" | "as"> & {};
177
177
  /**
178
178
  * TextButton - For general use when no specific semantic variant fits.
179
179
  *
@@ -675,11 +675,11 @@ type InputFieldProps = {
675
675
  /** Optional: if omitted, we generate one via useId(). */
676
676
  id?: string;
677
677
  /** Field label (required for accessibility). */
678
- label: React.ReactNode;
678
+ label: string;
679
679
  /** Optional helper text shown below the input. */
680
- helperText?: React.ReactNode;
680
+ helperText?: string;
681
681
  /** Optional error message. When present, input is marked invalid. */
682
- error?: React.ReactNode;
682
+ error?: string;
683
683
  /** Props forwarded to the Input atom. */
684
684
  input: InputProps;
685
685
  /** Additional aria-describedby IDs to merge with internal helper/error IDs. */
@@ -776,4 +776,234 @@ type InputFieldProps = {
776
776
  */
777
777
  declare function InputField(props: InputFieldProps): React.ReactElement;
778
778
 
779
- export { Button, type ButtonProps, CancelButton, type CancelButtonProps, Checkbox, CheckboxField, type CheckboxFieldProps, type CheckboxProps, CreateButton, type CreateButtonProps, DangerButton, type DangerButtonProps, Divider, type DividerProps, H1, type H1Props, H2, type H2Props, H3, type H3Props, Icon, type IconProps, Input, InputField, type InputFieldProps, type InputProps, LinkButton, type LinkButtonProps, MarwesProvider, type MarwesProviderProps, Paragraph, type ParagraphProps, PrimaryButton, type PrimaryButtonProps, SecondaryButton, type SecondaryButtonProps, SubmitButton, type SubmitButtonProps, TextButton, type TextButtonProps, useRenderKitDebug, useSystem, useTheme };
779
+ /**
780
+ * Field Variants - AI-Friendly Components
781
+ *
782
+ * These variants encode best practices and automatically set AI-friendly
783
+ * metadata, making it easier for both developers and AI tools to understand
784
+ * the purpose and behavior of each field.
785
+ *
786
+ * Each variant manages its own purpose-specific logic (password toggle,
787
+ * search clear, etc.) and sets appropriate semantic attributes.
788
+ */
789
+ type SearchFieldProps = Omit<InputFieldProps, "input"> & {
790
+ /**
791
+ * Input-specific props (type is auto-set to "search")
792
+ */
793
+ input?: Omit<InputProps, "type">;
794
+ };
795
+ /**
796
+ * SearchField - For search inputs with automatic clear button functionality.
797
+ *
798
+ * **AI Context:**
799
+ * - Sets `type="search"` automatically
800
+ * - Sets `inputMode="search"` for mobile keyboards
801
+ * - Shows clear button (X icon) when field has content
802
+ * - Adds `data-purpose="search"` for AI parsing
803
+ *
804
+ * **Features:**
805
+ * - Automatic clear button that appears when typing
806
+ * - Native search input behavior
807
+ * - Optimized mobile keyboard
808
+ * - Controlled and uncontrolled modes supported
809
+ *
810
+ * @example Basic usage
811
+ * ```tsx
812
+ * import { SearchField } from "@marwes-ui/react";
813
+ *
814
+ * export function Example() {
815
+ * const [query, setQuery] = React.useState("");
816
+ * return (
817
+ * <SearchField
818
+ * label="Search products"
819
+ * input={{ value: query, onValueChange: setQuery }}
820
+ * />
821
+ * );
822
+ * }
823
+ * ```
824
+ */
825
+ declare function SearchField(props: SearchFieldProps): React.ReactElement;
826
+ type PasswordFieldProps = Omit<InputFieldProps, "input"> & {
827
+ /**
828
+ * Input-specific props (type is auto-set to "password")
829
+ */
830
+ input?: Omit<InputProps, "type">;
831
+ /**
832
+ * Autocomplete hint: "current-password" or "new-password"
833
+ * Defaults to "current-password"
834
+ */
835
+ autoComplete?: "current-password" | "new-password";
836
+ };
837
+ /**
838
+ * PasswordField - For password inputs with automatic show/hide toggle.
839
+ *
840
+ * **AI Context:**
841
+ * - Sets `type="password"` automatically (toggles to "text" when shown)
842
+ * - Shows eye/eyeOff icon toggle button
843
+ * - Sets appropriate `autoComplete` attribute
844
+ * - Adds `data-purpose="password"` for AI parsing
845
+ *
846
+ * **Features:**
847
+ * - Automatic show/hide toggle with eye icon
848
+ * - Proper autocomplete for password managers
849
+ * - Accessible toggle button with clear labels
850
+ * - Controlled and uncontrolled modes supported
851
+ *
852
+ * @example Basic usage
853
+ * ```tsx
854
+ * import { PasswordField } from "@marwes-ui/react";
855
+ *
856
+ * export function Example() {
857
+ * const [password, setPassword] = React.useState("");
858
+ * return (
859
+ * <PasswordField
860
+ * label="Password"
861
+ * input={{ value: password, onValueChange: setPassword }}
862
+ * />
863
+ * );
864
+ * }
865
+ * ```
866
+ *
867
+ * @example New password (signup/reset)
868
+ * ```tsx
869
+ * <PasswordField
870
+ * label="New Password"
871
+ * autoComplete="new-password"
872
+ * helperText="Must be at least 8 characters"
873
+ * />
874
+ * ```
875
+ */
876
+ declare function PasswordField(props: PasswordFieldProps): React.ReactElement;
877
+ type EmailFieldProps = Omit<InputFieldProps, "input"> & {
878
+ /**
879
+ * Input-specific props (type, inputMode, autoComplete auto-set)
880
+ */
881
+ input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
882
+ };
883
+ /**
884
+ * EmailField - For email address inputs with proper semantic attributes.
885
+ *
886
+ * **AI Context:**
887
+ * - Sets `type="email"` for validation
888
+ * - Sets `inputMode="email"` for optimized mobile keyboard
889
+ * - Sets `autoComplete="email"` for autofill
890
+ * - Adds `data-purpose="email"` for AI parsing
891
+ *
892
+ * **Features:**
893
+ * - Browser email validation
894
+ * - Email-optimized mobile keyboard
895
+ * - Autofill support for email addresses
896
+ *
897
+ * @example
898
+ * ```tsx
899
+ * import { EmailField } from "@marwes-ui/react";
900
+ *
901
+ * <EmailField
902
+ * label="Email address"
903
+ * input={{ placeholder: "you@example.com" }}
904
+ * />
905
+ * ```
906
+ */
907
+ declare function EmailField(props: EmailFieldProps): React.ReactElement;
908
+ type PhoneFieldProps = Omit<InputFieldProps, "input"> & {
909
+ /**
910
+ * Input-specific props (type, inputMode, autoComplete auto-set)
911
+ */
912
+ input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
913
+ };
914
+ /**
915
+ * PhoneField - For phone number inputs with proper semantic attributes.
916
+ *
917
+ * **AI Context:**
918
+ * - Sets `type="tel"` for telephone input
919
+ * - Sets `inputMode="tel"` for phone keyboard
920
+ * - Sets `autoComplete="tel"` for autofill
921
+ * - Adds `data-purpose="phone"` for AI parsing
922
+ *
923
+ * **Features:**
924
+ * - Phone-optimized mobile keyboard
925
+ * - Autofill support for phone numbers
926
+ * - Accepts any phone format (formatting should be done externally)
927
+ *
928
+ * @example
929
+ * ```tsx
930
+ * import { PhoneField } from "@marwes-ui/react";
931
+ *
932
+ * <PhoneField
933
+ * label="Phone number"
934
+ * input={{ placeholder: "+1 (555) 000-0000" }}
935
+ * />
936
+ * ```
937
+ */
938
+ declare function PhoneField(props: PhoneFieldProps): React.ReactElement;
939
+ type URLFieldProps = Omit<InputFieldProps, "input"> & {
940
+ /**
941
+ * Input-specific props (type, inputMode, autoComplete auto-set)
942
+ */
943
+ input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
944
+ };
945
+ /**
946
+ * URLField - For URL inputs with proper semantic attributes.
947
+ *
948
+ * **AI Context:**
949
+ * - Sets `type="url"` for URL validation
950
+ * - Sets `inputMode="url"` for URL keyboard
951
+ * - Sets `autoComplete="url"` for autofill
952
+ * - Adds `data-purpose="url"` for AI parsing
953
+ *
954
+ * **Features:**
955
+ * - Browser URL validation
956
+ * - URL-optimized mobile keyboard
957
+ * - Autofill support for URLs
958
+ *
959
+ * @example
960
+ * ```tsx
961
+ * import { URLField } from "@marwes-ui/react";
962
+ *
963
+ * <URLField
964
+ * label="Website"
965
+ * input={{ placeholder: "https://example.com" }}
966
+ * />
967
+ * ```
968
+ */
969
+ declare function URLField(props: URLFieldProps): React.ReactElement;
970
+ type CurrencyFieldProps = Omit<InputFieldProps, "input"> & {
971
+ /**
972
+ * Input-specific props (type, inputMode auto-set)
973
+ */
974
+ input?: Omit<InputProps, "type" | "inputMode">;
975
+ /**
976
+ * Currency code (e.g., "USD", "EUR", "GBP")
977
+ * Used for helper text and context
978
+ */
979
+ currency?: string;
980
+ };
981
+ /**
982
+ * CurrencyField - For monetary amount inputs with currency context.
983
+ *
984
+ * **AI Context:**
985
+ * - Sets `type="text"` (better browser support than "number")
986
+ * - Sets `inputMode="decimal"` for numeric keyboard with decimal
987
+ * - Adds currency code to helper text if provided
988
+ * - Adds `data-purpose="currency"` and `data-currency` for AI parsing
989
+ *
990
+ * **Features:**
991
+ * - Decimal keyboard on mobile
992
+ * - Currency code display in helper text
993
+ * - Better input control than type="number"
994
+ * - Note: Formatting should be handled by parent component
995
+ *
996
+ * @example
997
+ * ```tsx
998
+ * import { CurrencyField } from "@marwes-ui/react";
999
+ *
1000
+ * <CurrencyField
1001
+ * label="Amount"
1002
+ * currency="USD"
1003
+ * input={{ placeholder: "0.00" }}
1004
+ * />
1005
+ * ```
1006
+ */
1007
+ declare function CurrencyField(props: CurrencyFieldProps): React.ReactElement;
1008
+
1009
+ export { Button, type ButtonProps, CancelButton, type CancelButtonProps, Checkbox, CheckboxField, type CheckboxFieldProps, type CheckboxProps, CreateButton, type CreateButtonProps, CurrencyField, type CurrencyFieldProps, DangerButton, type DangerButtonProps, Divider, type DividerProps, EmailField, type EmailFieldProps, H1, type H1Props, H2, type H2Props, H3, type H3Props, Icon, type IconProps, Input, InputField, type InputFieldProps, type InputProps, LinkButton, type LinkButtonProps, MarwesProvider, type MarwesProviderProps, Paragraph, type ParagraphProps, PasswordField, type PasswordFieldProps, PhoneField, type PhoneFieldProps, PrimaryButton, type PrimaryButtonProps, SearchField, type SearchFieldProps, SecondaryButton, type SecondaryButtonProps, SubmitButton, type SubmitButtonProps, TextButton, type TextButtonProps, URLField, type URLFieldProps, useRenderKitDebug, useSystem, useTheme };
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
- import { createDividerRecipe, createSystem, switchMode, resolveIconSize, resolveIconStrokeWidth, iconRegistry, createButtonRecipe, createInputRecipe, checkboxRecipe, headingRecipe, paragraphRecipe } from '@marwes-ui/core';
1
+ import { createDividerRecipe, createSystem, switchMode, resolveIconSize, resolveIconStrokeWidth, iconRegistry, createButtonRecipe, IconName, ButtonAction, ButtonVariant, createInputRecipe, checkboxRecipe, headingRecipe, paragraphRecipe } from '@marwes-ui/core';
2
+ export { ButtonAction, ButtonSize, ButtonVariant, IconName } from '@marwes-ui/core';
2
3
  import { firstEdition } from '@marwes-ui/presets';
3
- import * as React2 from 'react';
4
+ import * as React7 from 'react';
4
5
  import { useEffect } from 'react';
5
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
7
 
7
8
  // src/provider/marwes-provider.tsx
8
- var MarwesContext = React2.createContext(null);
9
+ var MarwesContext = React7.createContext(null);
9
10
  function MarwesProvider({
10
11
  preset = firstEdition,
11
12
  theme,
@@ -13,13 +14,13 @@ function MarwesProvider({
13
14
  onModeChange,
14
15
  children
15
16
  }) {
16
- const initialSystem = React2.useMemo(() => {
17
+ const initialSystem = React7.useMemo(() => {
17
18
  return createSystem({
18
19
  preset,
19
20
  theme: theme ? { ...theme, mode } : { mode }
20
21
  });
21
22
  }, [preset, theme, mode]);
22
- const system = React2.useMemo(() => {
23
+ const system = React7.useMemo(() => {
23
24
  if (mode === initialSystem.theme.mode) {
24
25
  return initialSystem;
25
26
  }
@@ -29,7 +30,7 @@ function MarwesProvider({
29
30
  return /* @__PURE__ */ jsx(MarwesContext.Provider, { value: { system, onModeChange }, children: /* @__PURE__ */ jsx("div", { className: themeClass, children }) });
30
31
  }
31
32
  function useSystem() {
32
- const ctx = React2.useContext(MarwesContext);
33
+ const ctx = React7.useContext(MarwesContext);
33
34
  if (!ctx) {
34
35
  throw new Error("MarwesProvider is missing. Wrap your app in <MarwesProvider />.");
35
36
  }
@@ -40,21 +41,6 @@ function useSystem() {
40
41
  function useTheme() {
41
42
  return useSystem().theme;
42
43
  }
43
- var RENDERKIT_EVENT = "marwes/renderkit/renderkit-update";
44
- function useRenderKitDebug(renderKit, componentName) {
45
- useEffect(() => {
46
- if (typeof window !== "undefined") {
47
- console.log(`[RenderKit Debug] ${componentName}:`, renderKit);
48
- const event = new CustomEvent(RENDERKIT_EVENT, {
49
- detail: {
50
- ...renderKit,
51
- _meta: { component: componentName }
52
- }
53
- });
54
- window.dispatchEvent(event);
55
- }
56
- }, [renderKit, componentName]);
57
- }
58
44
  function Icon({
59
45
  name,
60
46
  size,
@@ -95,7 +81,6 @@ function Icon({
95
81
  function Button(props) {
96
82
  const theme = useTheme();
97
83
  const kit = createButtonRecipe(theme, props);
98
- useRenderKitDebug(kit, "Button");
99
84
  const style = kit.vars;
100
85
  const className = props.className ? `${kit.className} ${props.className}` : kit.className;
101
86
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -157,8 +142,9 @@ function DangerButton(props) {
157
142
  Button,
158
143
  {
159
144
  ...restProps,
160
- tone: "primary",
161
- action: "delete",
145
+ variant: ButtonVariant.primary,
146
+ action: ButtonAction.delete,
147
+ iconRight: IconName.Minus,
162
148
  confirmation,
163
149
  dataAttributes: {
164
150
  ...props.dataAttributes,
@@ -174,7 +160,7 @@ function CreateButton(props) {
174
160
  {
175
161
  ...props,
176
162
  action: "create",
177
- tone: props.tone ?? "primary",
163
+ variant: props.variant ?? "primary",
178
164
  dataAttributes: {
179
165
  ...props.dataAttributes,
180
166
  "data-creative": "true"
@@ -202,7 +188,7 @@ function CancelButton(props) {
202
188
  {
203
189
  ...props,
204
190
  action: "cancel",
205
- tone: props.tone ?? "secondary",
191
+ variant: props.variant ?? "secondary",
206
192
  dataAttributes: {
207
193
  ...props.dataAttributes,
208
194
  "data-cancel": "true"
@@ -225,13 +211,28 @@ function LinkButton(props) {
225
211
  );
226
212
  }
227
213
  function PrimaryButton(props) {
228
- return /* @__PURE__ */ jsx(Button, { ...props, tone: "primary", as: "button" });
214
+ return /* @__PURE__ */ jsx(Button, { ...props, variant: "primary", as: "button" });
229
215
  }
230
216
  function SecondaryButton(props) {
231
- return /* @__PURE__ */ jsx(Button, { ...props, tone: "secondary", as: "button" });
217
+ return /* @__PURE__ */ jsx(Button, { ...props, variant: "secondary", as: "button" });
232
218
  }
233
219
  function TextButton(props) {
234
- return /* @__PURE__ */ jsx(Button, { ...props, tone: "text", as: "button" });
220
+ return /* @__PURE__ */ jsx(Button, { ...props, variant: "text", as: "button" });
221
+ }
222
+ var RENDERKIT_EVENT = "marwes/renderkit/renderkit-update";
223
+ function useRenderKitDebug(renderKit, componentName) {
224
+ useEffect(() => {
225
+ if (typeof window !== "undefined") {
226
+ console.log(`[RenderKit Debug] ${componentName}:`, renderKit);
227
+ const event = new CustomEvent(RENDERKIT_EVENT, {
228
+ detail: {
229
+ ...renderKit,
230
+ _meta: { component: componentName }
231
+ }
232
+ });
233
+ window.dispatchEvent(event);
234
+ }
235
+ }, [renderKit, componentName]);
235
236
  }
236
237
  function Input(props) {
237
238
  const theme = useTheme();
@@ -269,8 +270,8 @@ function Checkbox(props) {
269
270
  const { onCheckedChange, onChange, ...coreProps } = props;
270
271
  const theme = useTheme();
271
272
  const kit = checkboxRecipe({ ...coreProps, theme });
272
- const inputRef = React2.useRef(null);
273
- React2.useLayoutEffect(() => {
273
+ const inputRef = React7.useRef(null);
274
+ React7.useLayoutEffect(() => {
274
275
  const el = inputRef.current;
275
276
  if (!el) return;
276
277
  el.indeterminate = kit.indeterminate;
@@ -303,7 +304,7 @@ function Checkbox(props) {
303
304
  }
304
305
  );
305
306
  }
306
- var Divider = React2.forwardRef((props, ref) => {
307
+ var Divider = React7.forwardRef((props, ref) => {
307
308
  const { className: customClassName, style: customStyle, ...opts } = props;
308
309
  const theme = useTheme();
309
310
  const kit = createDividerRecipe(theme, opts);
@@ -348,7 +349,7 @@ function cx(...parts) {
348
349
  return parts.filter(Boolean).join(" ");
349
350
  }
350
351
  function CheckboxField(props) {
351
- const reactId = React2.useId();
352
+ const reactId = React7.useId();
352
353
  const id = props.id ?? `mw-checkbox-${reactId}`;
353
354
  const hasDescription = props.description !== void 0;
354
355
  const hasError = props.error !== void 0;
@@ -384,8 +385,15 @@ function cx2(...parts) {
384
385
  return parts.filter(Boolean).join(" ");
385
386
  }
386
387
  function InputField(props) {
387
- const reactId = React2.useId();
388
+ const reactId = React7.useId();
388
389
  const id = props.id ?? `mw-input-${reactId}`;
390
+ const isPasswordField = props.input.type === "password";
391
+ const [showPassword, setShowPassword] = React7.useState(false);
392
+ const isSearchField = props.input.type === "search";
393
+ const [searchValue, setSearchValue] = React7.useState(
394
+ props.input.value || props.input.defaultValue || ""
395
+ );
396
+ const hasSearchValue = isSearchField && (props.input.value !== void 0 ? String(props.input.value).length > 0 : String(searchValue).length > 0);
389
397
  const hasHelperText = props.helperText !== void 0;
390
398
  const hasError = props.error !== void 0;
391
399
  const helperTextId = hasHelperText ? `${id}-helper` : void 0;
@@ -406,17 +414,115 @@ function InputField(props) {
406
414
  id,
407
415
  invalid
408
416
  };
417
+ if (isPasswordField && showPassword) {
418
+ inputProps.type = "text";
419
+ }
420
+ if (isSearchField) {
421
+ const originalOnValueChange = props.input.onValueChange;
422
+ if (props.input.value === void 0) {
423
+ inputProps.value = searchValue;
424
+ }
425
+ inputProps.onValueChange = (value) => {
426
+ setSearchValue(value);
427
+ originalOnValueChange?.(value);
428
+ };
429
+ }
409
430
  if (mergedDescribedBy) {
410
431
  inputProps.describedBy = mergedDescribedBy;
411
432
  }
433
+ const handleTogglePassword = () => {
434
+ setShowPassword((prev) => !prev);
435
+ };
436
+ const handleClearSearch = () => {
437
+ setSearchValue("");
438
+ props.input.onValueChange?.("");
439
+ };
412
440
  return /* @__PURE__ */ jsxs("div", { className: wrapperClass, children: [
413
441
  /* @__PURE__ */ jsx("label", { className: "mw-input-field__label", htmlFor: id, children: /* @__PURE__ */ jsx(Paragraph, { size: "md", children: props.label }) }),
414
- /* @__PURE__ */ jsx(Input, { ...inputProps }),
442
+ /* @__PURE__ */ jsxs("div", { className: "mw-input-field__input-wrapper", children: [
443
+ /* @__PURE__ */ jsx(Input, { ...inputProps }),
444
+ isPasswordField && /* @__PURE__ */ jsx(
445
+ "button",
446
+ {
447
+ type: "button",
448
+ className: "mw-input-field__toggle-password",
449
+ onClick: handleTogglePassword,
450
+ "aria-label": showPassword ? "Hide password" : "Show password",
451
+ tabIndex: 0,
452
+ children: /* @__PURE__ */ jsx(Icon, { name: showPassword ? "eyeOff" : "eye", size: "xs", decorative: true })
453
+ }
454
+ ),
455
+ hasSearchValue && /* @__PURE__ */ jsx(
456
+ "button",
457
+ {
458
+ type: "button",
459
+ className: "mw-input-field__clear-search",
460
+ onClick: handleClearSearch,
461
+ "aria-label": "Clear search",
462
+ tabIndex: 0,
463
+ children: /* @__PURE__ */ jsx(Icon, { name: "x", size: "xs", decorative: true })
464
+ }
465
+ )
466
+ ] }),
415
467
  hasHelperText && !hasError && /* @__PURE__ */ jsx("div", { className: "mw-input-field__helper", id: helperTextId, children: /* @__PURE__ */ jsx(Paragraph, { size: "sm", children: props.helperText }) }),
416
468
  hasError && /* @__PURE__ */ jsx("div", { className: "mw-input-field__error", id: errorId, "aria-live": "polite", children: /* @__PURE__ */ jsx(Paragraph, { size: "sm", children: props.error }) })
417
469
  ] });
418
470
  }
471
+ function SearchField(props) {
472
+ const enhancedInput = {
473
+ ...props.input,
474
+ type: "search",
475
+ inputMode: "search"
476
+ };
477
+ return /* @__PURE__ */ jsx("div", { "data-purpose": "search", children: /* @__PURE__ */ jsx(InputField, { ...props, input: enhancedInput }) });
478
+ }
479
+ function PasswordField(props) {
480
+ const { autoComplete = "current-password", ...restProps } = props;
481
+ const enhancedInput = {
482
+ ...props.input,
483
+ type: "password",
484
+ autoComplete
485
+ };
486
+ return /* @__PURE__ */ jsx("div", { "data-purpose": "password", children: /* @__PURE__ */ jsx(InputField, { ...restProps, input: enhancedInput }) });
487
+ }
488
+ function EmailField(props) {
489
+ const enhancedInput = {
490
+ ...props.input,
491
+ type: "email",
492
+ inputMode: "email",
493
+ autoComplete: "email"
494
+ };
495
+ return /* @__PURE__ */ jsx("div", { "data-purpose": "email", children: /* @__PURE__ */ jsx(InputField, { ...props, input: enhancedInput }) });
496
+ }
497
+ function PhoneField(props) {
498
+ const enhancedInput = {
499
+ ...props.input,
500
+ type: "tel",
501
+ inputMode: "tel",
502
+ autoComplete: "tel"
503
+ };
504
+ return /* @__PURE__ */ jsx("div", { "data-purpose": "phone", children: /* @__PURE__ */ jsx(InputField, { ...props, input: enhancedInput }) });
505
+ }
506
+ function URLField(props) {
507
+ const enhancedInput = {
508
+ ...props.input,
509
+ type: "url",
510
+ inputMode: "url",
511
+ autoComplete: "url"
512
+ };
513
+ return /* @__PURE__ */ jsx("div", { "data-purpose": "url", children: /* @__PURE__ */ jsx(InputField, { ...props, input: enhancedInput }) });
514
+ }
515
+ function CurrencyField(props) {
516
+ const { currency, ...restProps } = props;
517
+ const enhancedInput = {
518
+ ...props.input,
519
+ type: "text",
520
+ inputMode: "decimal"
521
+ };
522
+ const helperText = currency ? props.helperText ? `${props.helperText} (${currency})` : `Amount in ${currency}` : props.helperText;
523
+ return /* @__PURE__ */ jsx("div", { "data-purpose": "currency", "data-currency": currency, children: /* @__PURE__ */ jsx(InputField, { ...restProps, input: enhancedInput, helperText: helperText || "" }) });
524
+ }
419
525
 
420
- export { Button, CancelButton, Checkbox, CheckboxField, CreateButton, DangerButton, Divider, H1, H2, H3, Icon, Input, InputField, LinkButton, MarwesProvider, Paragraph, PrimaryButton, SecondaryButton, SubmitButton, TextButton, useRenderKitDebug, useSystem, useTheme };
526
+ export { Button, CancelButton, Checkbox, CheckboxField, CreateButton, CurrencyField, DangerButton, Divider, EmailField, H1, H2, H3, Icon, Input, InputField, LinkButton, MarwesProvider, Paragraph, PasswordField, PhoneField, PrimaryButton, SearchField, SecondaryButton, SubmitButton, TextButton, URLField, useRenderKitDebug, useSystem, useTheme };
421
527
  //# sourceMappingURL=index.js.map
422
528
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/provider/marwes-context.ts","../src/provider/marwes-provider.tsx","../src/provider/use-system.ts","../src/provider/use-theme.ts","../src/hooks/use-renderkit-debug.ts","../src/components/icon/icon.tsx","../src/components/button.tsx","../src/components/button-variants.tsx","../src/components/input.tsx","../src/components/checkbox/checkbox.tsx","../src/components/divider.tsx","../src/components/heading/h1.tsx","../src/components/heading/h2.tsx","../src/components/heading/h3.tsx","../src/components/paragraph/paragraph.tsx","../src/components/checkbox/checkbox-field.tsx","../src/components/input-field.tsx"],"names":["React","React3","jsx","React4","React5","headingRecipe","React6","jsxs","cx","React7"],"mappings":";;;;;;;AAQO,IAAM,aAAA,GAAsBA,qBAAyC,IAAI,CAAA;AC4BzE,SAAS,cAAA,CAAe;AAAA,EAC7B,MAAA,GAAS,YAAA;AAAA,EACT,KAAA;AAAA,EACA,IAAA,GAAO,OAAA;AAAA,EACP,YAAA;AAAA,EACA;AACF,CAAA,EAAwB;AAEtB,EAAA,MAAM,aAAA,GAAsB,eAAQ,MAAM;AACxC,IAAA,OAAO,YAAA,CAAa;AAAA,MAClB,MAAA;AAAA,MACA,KAAA,EAAO,QAAQ,EAAE,GAAG,OAAO,IAAA,EAAK,GAAI,EAAE,IAAA;AAAK,KAC5C,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,MAAA,EAAQ,KAAA,EAAO,IAAI,CAAC,CAAA;AAGxB,EAAA,MAAM,MAAA,GAAuB,eAAQ,MAAM;AACzC,IAAA,IAAI,IAAA,KAAS,aAAA,CAAc,KAAA,CAAM,IAAA,EAAM;AACrC,MAAA,OAAO,aAAA;AAAA,IACT;AACA,IAAA,OAAO,UAAA,CAAW,eAAe,IAAI,CAAA;AAAA,EACvC,CAAA,EAAG,CAAC,aAAA,EAAe,IAAI,CAAC,CAAA;AAGxB,EAAA,MAAM,UAAA,GAAa,CAAA,UAAA,EAAa,MAAA,CAAO,KAAA,CAAM,IAAI,CAAA,CAAA;AAEjD,EAAA,uBACE,GAAA,CAAC,aAAA,CAAc,QAAA,EAAd,EAAuB,OAAO,EAAE,MAAA,EAAQ,YAAA,EAAa,EACpD,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,S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,IAAI,iBAAA,EAAmB;AACrB,IAAA,UAAA,CAAW,WAAA,GAAc,iBAAA;AAAA,EAC3B;AAEA,EAAA,uBACED,IAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,YAAA,EACd,QAAA,EAAA;AAAA,oBAAAL,GAAAA,CAAC,OAAA,EAAA,EAAM,SAAA,EAAU,uBAAA,EAAwB,OAAA,EAAS,EAAA,EAChD,QAAA,kBAAAA,GAAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAK,IAAA,EAAM,QAAA,EAAA,KAAA,CAAM,OAAM,CAAA,EACpC,CAAA;AAAA,oBAEAA,GAAAA,CAAC,KAAA,EAAA,EAAO,GAAG,UAAA,EAAY,CAAA;AAAA,IAEtB,iBAAiB,CAAC,QAAA,oBACjBA,GAAAA,CAAC,SAAI,SAAA,EAAU,wBAAA,EAAyB,EAAA,EAAI,YAAA,EAC1C,0BAAAA,GAAAA,CAAC,SAAA,EAAA,EAAU,MAAK,IAAA,EAAM,QAAA,EAAA,KAAA,CAAM,YAAW,CAAA,EACzC,CAAA;AAAA,IAGD,4BACCA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,yBAAwB,EAAA,EAAI,OAAA,EAAS,WAAA,EAAU,QAAA,EAC5D,0BAAAA,GAAAA,CAAC,SAAA,EAAA,EAAU,MAAK,IAAA,EAAM,QAAA,EAAA,KAAA,CAAM,OAAM,CAAA,EACpC;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"index.js","sourcesContent":["import type { System, ThemeMode } from \"@marwes-ui/core\"\nimport * as React from \"react\"\n\nexport type MarwesContextValue = {\n system: System\n onModeChange: ((mode: ThemeMode) => void) | undefined\n}\n\nexport const MarwesContext = React.createContext<MarwesContextValue | null>(null)\n","import type { Preset, System, ThemeMode, ThemeOverrides } from \"@marwes-ui/core\"\nimport { createSystem, switchMode } from \"@marwes-ui/core\"\nimport { firstEdition } from \"@marwes-ui/presets\"\nimport * as React from \"react\"\nimport { MarwesContext } from \"./marwes-context\"\n\nexport type MarwesProviderProps = {\n preset?: Preset\n theme?: ThemeOverrides\n /**\n * Current theme mode. Determines light or dark color palette.\n * When changed, efficiently switches theme colors without recreating the entire system.\n */\n mode?: ThemeMode\n /**\n * Callback fired when mode should change.\n * Users are responsible for managing mode state and persistence (e.g., localStorage).\n *\n * Example with persistence:\n * ```tsx\n * const [mode, setMode] = useState<ThemeMode>(\n * () => (localStorage.getItem('theme-mode') as ThemeMode) ?? 'light'\n * );\n *\n * const handleModeChange = (newMode: ThemeMode) => {\n * setMode(newMode);\n * localStorage.setItem('theme-mode', newMode);\n * };\n *\n * <MarwesProvider mode={mode} onModeChange={handleModeChange}>\n * ```\n */\n onModeChange?: (mode: ThemeMode) => void\n children: React.ReactNode\n}\n\nexport function MarwesProvider({\n preset = firstEdition,\n theme,\n mode = \"light\",\n onModeChange,\n children,\n}: MarwesProviderProps) {\n // Create initial system\n const initialSystem = React.useMemo(() => {\n return createSystem({\n preset,\n theme: theme ? { ...theme, mode } : { mode },\n })\n }, [preset, theme, mode])\n\n // Optimize mode switching using switchMode() instead of recreating system\n const system: System = React.useMemo(() => {\n if (mode === initialSystem.theme.mode) {\n return initialSystem\n }\n return switchMode(initialSystem, mode)\n }, [initialSystem, mode])\n\n // Apply theme class to container for CSS-based dark mode overrides\n const themeClass = `mw-theme--${system.theme.mode}`\n\n return (\n <MarwesContext.Provider value={{ system, onModeChange }}>\n <div className={themeClass}>{children}</div>\n </MarwesContext.Provider>\n )\n}\n","import type { System } from \"@marwes-ui/core\"\nimport * as React from \"react\"\nimport { MarwesContext } from \"./marwes-context\"\n\nexport function useSystem(): System {\n const ctx = React.useContext(MarwesContext)\n if (!ctx) {\n throw new Error(\"MarwesProvider is missing. Wrap your app in <MarwesProvider />.\")\n }\n return ctx.system\n}\n","import type { Theme } from \"@marwes-ui/core\"\nimport { useSystem } from \"./use-system\"\n\nexport function useTheme(): Theme {\n return useSystem().theme\n}\n","import { useEffect } from \"react\"\n\nconst RENDERKIT_EVENT = \"marwes/renderkit/renderkit-update\"\n\nexport function useRenderKitDebug(renderKit: unknown, componentName: string) {\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n console.log(`[RenderKit Debug] ${componentName}:`, renderKit)\n const event = new CustomEvent(RENDERKIT_EVENT, {\n detail: {\n ...(renderKit as Record<string, unknown>),\n _meta: { component: componentName },\n },\n })\n window.dispatchEvent(event)\n }\n }, [renderKit, componentName])\n}\n","import {\n type IconSize,\n type IconStrokeWidth,\n iconRegistry,\n resolveIconSize,\n resolveIconStrokeWidth,\n} from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype IconName = keyof typeof iconRegistry\n\nexport type IconProps = {\n name: IconName\n\n /**\n * Token (\"xs\"|\"sm\"|\"md\"|\"lg\") or a raw px number.\n * Defaults to system.theme.icon.size\n */\n size?: IconSize | number\n\n /**\n * Token (\"xs\"|\"sm\"|\"md\"|\"lg\") or a raw number.\n * Defaults to system.theme.icon.strokeWidth\n */\n strokeWidth?: IconStrokeWidth | number\n\n /**\n * Common props\n */\n className?: string\n \"aria-label\"?: string\n decorative?: boolean\n}\n\nexport function Icon({\n name,\n size,\n strokeWidth,\n className,\n \"aria-label\": ariaLabel,\n decorative,\n}: IconProps) {\n const theme = useTheme()\n const themeIcon = theme.icon\n\n const px = resolveIconSize(size ?? themeIcon.size)\n const sw = resolveIconStrokeWidth(strokeWidth ?? themeIcon.strokeWidth)\n\n const def = iconRegistry[name]\n\n // If no aria-label => decorative\n const isDecorative = decorative || !ariaLabel\n\n return (\n <svg\n width={px}\n height={px}\n viewBox={def.viewBox}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={sw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden={isDecorative ? \"true\" : undefined}\n aria-label={ariaLabel}\n role={isDecorative ? undefined : \"img\"}\n focusable=\"false\"\n >\n {def.nodes.map((iconNode, nodeIndex) => {\n const TagName = iconNode.tag\n // biome-ignore lint/suspicious/noArrayIndexKey: Icon nodes are static and never reordered\n return <TagName key={nodeIndex} {...(iconNode.attrs as React.SVGAttributes<SVGElement>)} />\n })}\n </svg>\n )\n}\n","import type { ButtonOptions, CssVars } from \"@marwes-ui/core\"\nimport { createButtonRecipe } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useRenderKitDebug } from \"../hooks/use-renderkit-debug\"\nimport { useTheme } from \"../provider/use-theme\"\nimport { Icon } from \"./icon\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type ButtonProps = ButtonOptions & {\n children?: React.ReactNode\n onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void\n className?: string\n}\n\nexport function Button(props: ButtonProps) {\n const theme = useTheme()\n const kit = createButtonRecipe(theme, props)\n\n // Debug hook for Storybook RenderKit addon\n useRenderKitDebug(kit, \"Button\")\n\n const style = kit.vars as StyleWithVars\n const className = props.className ? `${kit.className} ${props.className}` : kit.className\n\n const content = (\n <>\n {props.iconLeft && <Icon name={props.iconLeft} size=\"xs\" decorative />}\n {props.children}\n {props.iconRight && <Icon name={props.iconRight} size=\"xs\" decorative />}\n </>\n )\n\n if (kit.tag === \"button\") {\n return (\n <button\n type={kit.a11y.type}\n disabled={kit.a11y.disabled}\n aria-label={kit.a11y.ariaLabel}\n aria-busy={kit.a11y.ariaBusy}\n aria-disabled={kit.a11y.ariaDisabled}\n aria-pressed={kit.a11y.ariaPressed}\n aria-expanded={kit.a11y.ariaExpanded}\n aria-controls={kit.a11y.ariaControls}\n title={kit.a11y.title}\n className={className}\n style={style}\n onClick={(e) => props.onClick?.(e)}\n {...kit.dataAttributes}\n >\n {content}\n </button>\n )\n }\n\n return (\n <a\n href={kit.a11y.href}\n role={kit.a11y.role}\n tabIndex={kit.a11y.tabIndex}\n aria-label={kit.a11y.ariaLabel}\n aria-busy={kit.a11y.ariaBusy}\n aria-disabled={kit.a11y.ariaDisabled}\n aria-pressed={kit.a11y.ariaPressed}\n aria-expanded={kit.a11y.ariaExpanded}\n aria-controls={kit.a11y.ariaControls}\n title={kit.a11y.title}\n className={className}\n style={style}\n onClick={(e) => {\n if (kit.blockClick) {\n e.preventDefault()\n return\n }\n props.onClick?.(e)\n }}\n {...kit.dataAttributes}\n >\n {content}\n </a>\n )\n}\n","import { Button, type ButtonProps } from \"./button\"\n\n/**\n * Semantic Button Variants - AI-Friendly Components\n *\n * These variants encode best practices and automatically set AI-friendly\n * metadata, making it easier for both developers and AI tools to understand\n * the purpose and behavior of each button.\n */\n\n// ============================================================================\n// DANGER BUTTON - Destructive Actions\n// ============================================================================\n\nexport type DangerButtonProps = Omit<ButtonProps, \"tone\" | \"action\"> & {\n /**\n * Override automatic confirmation requirement.\n * Defaults to `true` for destructive actions.\n */\n confirmation?: boolean\n}\n\n/**\n * DangerButton - For destructive actions like delete, remove, or irreversible operations.\n *\n * **AI Context:**\n * - Sets `tone=\"danger\"` for visual warning\n * - Sets `action=\"delete\"` to indicate destructive behavior\n * - Enables confirmation by default\n * - Adds `data-destructive=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * import { DangerButton } from \"@marwes-ui/react\";\n *\n * export function Example() {\n * return <DangerButton onClick={deleteProject}>Delete Project</DangerButton>;\n * }\n * ```\n */\nexport function DangerButton(props: DangerButtonProps) {\n const { confirmation = true, ...restProps } = props\n\n return (\n <Button\n {...restProps}\n tone=\"primary\"\n action=\"delete\"\n confirmation={confirmation}\n dataAttributes={{\n ...props.dataAttributes,\n \"data-destructive\": \"true\",\n \"data-confirmation-required\": confirmation ? \"true\" : \"false\",\n }}\n />\n )\n}\n\n// ============================================================================\n// CREATE BUTTON - Creation Actions\n// ============================================================================\n\nexport type CreateButtonProps = Omit<ButtonProps, \"action\">\n\n/**\n * CreateButton - For creation actions like adding new items or entities.\n *\n * **AI Context:**\n * - Sets `action=\"create\"` to indicate creation behavior\n * - Uses primary tone by default\n * - Adds `data-creative=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * <CreateButton onClick={createProject}>\n * New Project\n * </CreateButton>\n * ```\n */\nexport function CreateButton(props: CreateButtonProps) {\n return (\n <Button\n {...props}\n action=\"create\"\n tone={props.tone ?? \"primary\"}\n dataAttributes={{\n ...props.dataAttributes,\n \"data-creative\": \"true\",\n }}\n />\n )\n}\n\n// ============================================================================\n// SUBMIT BUTTON - Form Submissions\n// ============================================================================\n\nexport type SubmitButtonProps = Omit<ButtonProps, \"action\" | \"as\">\n\n/**\n * SubmitButton - For form submissions.\n *\n * **AI Context:**\n * - Sets `action=\"submit\"` and `type=\"submit\"`\n * - Adds `data-context=\"form-submit\"` for AI parsing\n * - Automatically uses button element (not anchor)\n *\n * @example\n * ```tsx\n * <SubmitButton>Submit</SubmitButton>\n * ```\n */\nexport function SubmitButton(props: SubmitButtonProps) {\n return (\n <Button\n {...props}\n as=\"button\"\n action=\"submit\"\n dataAttributes={{\n \"data-context\": \"form-submit\",\n ...props.dataAttributes,\n }}\n />\n )\n}\n\n// ============================================================================\n// CANCEL BUTTON - Cancel/Reset Actions\n// ============================================================================\n\nexport type CancelButtonProps = Omit<ButtonProps, \"action\" | \"variant\">\n\n/**\n * CancelButton - For cancel or reset actions.\n *\n * **AI Context:**\n * - Sets `action=\"cancel\"` to indicate cancellation\n * - Uses ghost variant and secondary tone by default\n * - Adds `data-cancel=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * <CancelButton onClick={handleCancel}>\n * Cancel\n * </CancelButton>\n * ```\n */\nexport function CancelButton(props: CancelButtonProps) {\n return (\n <Button\n {...props}\n action=\"cancel\"\n tone={props.tone ?? \"secondary\"}\n dataAttributes={{\n ...props.dataAttributes,\n \"data-cancel\": \"true\",\n }}\n />\n )\n}\n\n// ============================================================================\n// LINK BUTTON - Navigation Actions\n// ============================================================================\n\nexport type LinkButtonProps = Omit<ButtonProps, \"action\" | \"as\"> & {\n /**\n * The URL to navigate to. Required for LinkButton.\n */\n href: string\n}\n\n/**\n * LinkButton - For navigation actions that look like buttons.\n *\n * **AI Context:**\n * - Sets `action=\"navigate\"` to indicate navigation\n * - Uses anchor element with button styling\n * - Adds `data-navigation=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * <LinkButton href=\"/dashboard\">\n * Go to Dashboard\n * </LinkButton>\n * ```\n */\nexport function LinkButton(props: LinkButtonProps) {\n return (\n <Button\n {...props}\n as=\"a\"\n action=\"navigate\"\n dataAttributes={{\n ...props.dataAttributes,\n \"data-navigation\": \"true\",\n }}\n />\n )\n}\n\n// ============================================================================\n// PRIMARY BUTTON - General Actions\n// ============================================================================\n\nexport type PrimaryButtonProps = Omit<ButtonProps, \"tone\" | \"as\"> & {}\n\n/**\n * PrimaryButton - For general use when no specific semantic variant fits.\n *\n * @example\n * ```tsx\n * <PrimaryButton onClick={handlePrimaryAction}>\n * Do something important\n * </PrimaryButton>\n * ```\n */\nexport function PrimaryButton(props: PrimaryButtonProps) {\n return <Button {...props} tone=\"primary\" as=\"button\" />\n}\n\n// ============================================================================\n// SECONDARY BUTTON - General Actions\n// ============================================================================\n\nexport type SecondaryButtonProps = Omit<ButtonProps, \"tone\" | \"as\"> & {}\n\n/**\n * SecondaryButton - For general use when no specific semantic variant fits.\n *\n * @example\n * ```tsx\n * <SecondaryButton onClick={handleSecondaryAction}>\n * Do something important\n * </SecondaryButton>\n * ```\n */\nexport function SecondaryButton(props: SecondaryButtonProps) {\n return <Button {...props} tone=\"secondary\" as=\"button\" />\n}\n\n// ============================================================================\n// TEXT BUTTON - General Actions\n// ============================================================================\n\nexport type TextButtonProps = Omit<ButtonProps, \"tone\" | \"as\"> & {}\n\n/**\n * TextButton - For general use when no specific semantic variant fits.\n *\n * @example\n * ```tsx\n * <TextButton onClick={handleTextAction}>\n * Do something important\n * </TextButton>\n * ```\n */\nexport function TextButton(props: TextButtonProps) {\n return <Button {...props} tone=\"text\" as=\"button\" />\n}\n","import type { CssVars, InputOptions } from \"@marwes-ui/core\"\nimport { createInputRecipe } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useRenderKitDebug } from \"../hooks/use-renderkit-debug\"\nimport { useTheme } from \"../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type InputProps = InputOptions & {\n onValueChange?: (value: string) => void\n className?: string\n}\n\nexport function Input(props: InputProps) {\n const theme = useTheme()\n const kit = createInputRecipe(theme, props)\n\n // Debug hook for Storybook RenderKit addon\n useRenderKitDebug(kit, \"Input\")\n\n const style = kit.vars as StyleWithVars\n const className = props.className ? `${kit.className} ${props.className}` : kit.className\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n props.onValueChange?.(e.target.value)\n }\n\n return (\n <input\n className={className}\n style={style}\n id={kit.a11y.id}\n name={kit.a11y.name}\n type={kit.a11y.type}\n inputMode={kit.a11y.inputMode}\n autoComplete={kit.a11y.autoComplete}\n placeholder={kit.a11y.placeholder}\n disabled={kit.a11y.disabled}\n readOnly={kit.a11y.readOnly}\n required={kit.a11y.required}\n aria-label={kit.a11y.ariaLabel}\n aria-invalid={kit.a11y.ariaInvalid}\n aria-describedby={kit.a11y.ariaDescribedBy}\n value={props.value}\n defaultValue={props.defaultValue}\n onChange={handleChange}\n />\n )\n}\n","/**\n * React adapter for Marwes Checkbox.\n * - Renders a native <input type=\"checkbox\"> using the core render kit.\n * - Applies strict a11y fields and CSS vars.\n * - Sets `indeterminate` via DOM property (not an HTML attribute).\n */\n\nimport { checkboxRecipe } from \"@marwes-ui/core\"\nimport type { CheckboxProps as CoreCheckboxProps } from \"@marwes-ui/core\"\nimport * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\nexport type CheckboxProps = CoreCheckboxProps & {\n /**\n * Called with the next checked value when the user toggles the checkbox.\n * For indeterminate state: browser toggling typically results in `checked=true` and `indeterminate=false`\n * unless you keep controlling it.\n */\n onCheckedChange?: (checked: boolean) => void\n\n /**\n * Escape hatch for consumers that want raw event access.\n * (Optional – keep if you want parity with other components.)\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>\n}\n\n/**\n * Checkbox (Atom)\n *\n * Low-level checkbox control built on a native `<input type=\"checkbox\">`.\n * Use this when you need custom layout or when the label/description is handled\n * elsewhere (e.g. inside a list item, table row, or custom field wrapper).\n *\n * For most forms, prefer `CheckboxField`, which composes `Checkbox` with\n * label/description/error wiring and consistent spacing.\n *\n * Accessibility\n * - Provide **either** `ariaLabel` **or** `ariaLabelledBy` (or use `CheckboxField` which wires a `<label>`).\n * - Use `ariaDescribedBy` to connect supporting text (help/error).\n * - `indeterminate` is applied via a DOM property, not an HTML attribute.\n *\n * @example Basic (uncontrolled)\n * ```tsx\n * <Checkbox ariaLabel=\"Subscribe to updates\" defaultChecked />\n * ```\n *\n * @example Controlled\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n *\n * <Checkbox\n * ariaLabel=\"Accept terms\"\n * checked={checked}\n * onCheckedChange={setChecked}\n * />\n * ```\n *\n * @example Indeterminate (mixed)\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n * const [mixed, setMixed] = React.useState(true);\n *\n * <Checkbox\n * ariaLabel=\"Select all\"\n * checked={checked}\n * indeterminate={mixed}\n * onCheckedChange={(next) => {\n * setMixed(false); // first interaction clears mixed state\n * setChecked(next);\n * }}\n * />\n * ```\n *\n * @example With external label + description\n * ```tsx\n * const id = \"terms\";\n * const descId = \"terms-desc\";\n *\n * <>\n * <div style={{ display: \"flex\", alignItems: \"center\", gap: 10 }}>\n * <Checkbox id={id} ariaDescribedBy={descId} />\n * <label htmlFor={id}>I accept the terms</label>\n * </div>\n * <div id={descId}>Required to continue.</div>\n * </>\n * ```\n */\n\nexport function Checkbox(props: CheckboxProps): React.ReactElement {\n const { onCheckedChange, onChange, ...coreProps } = props\n\n const theme = useTheme()\n\n const kit = checkboxRecipe({ ...coreProps, theme })\n\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n\n // Keep DOM property in sync.\n React.useLayoutEffect(() => {\n const el = inputRef.current\n if (!el) return\n el.indeterminate = kit.indeterminate\n }, [kit.indeterminate])\n\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n onChange?.(e)\n onCheckedChange?.(e.currentTarget.checked)\n }\n\n const { a11y } = kit\n\n return (\n <input\n ref={inputRef}\n type=\"checkbox\"\n className={kit.className}\n style={kit.vars}\n id={a11y.id}\n name={a11y.name}\n value={a11y.value}\n disabled={a11y.disabled === true}\n required={a11y.required === true}\n aria-label={a11y.ariaLabel}\n aria-labelledby={a11y.ariaLabelledBy}\n aria-describedby={a11y.ariaDescribedBy}\n aria-checked={a11y.ariaChecked}\n aria-invalid={a11y.ariaInvalid === true ? true : undefined}\n checked={kit.checked}\n defaultChecked={kit.defaultChecked}\n onChange={handleChange}\n />\n )\n}\n","/**\n * React adapter for Marwes Divider component.\n * - Renders semantic <hr> using the core divider recipe.\n * - Supports 7 size variants: xxs/xs/sm/md/lg/xl/xxl.\n * - Supports horizontal and vertical orientation.\n * - Figma reference: node-id=1-932\n */\n\nimport { createDividerRecipe } from \"@marwes-ui/core\"\nimport type { DividerOptions, DividerOrientation, DividerSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport * as React from \"react\"\nimport { useTheme } from \"../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type DividerProps = DividerOptions &\n Omit<React.HTMLAttributes<HTMLHRElement>, \"children\"> & {\n /**\n * Size variant for the divider.\n * Maps to pixel values: xxs=1px, xs=8px, sm=16px, md=32px, lg=48px, xl=64px, xxl=80px\n * @default \"md\"\n */\n size?: DividerSize\n\n /**\n * Orientation of the divider.\n * @default \"horizontal\"\n */\n orientation?: DividerOrientation\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n }\n\n/**\n * Divider\n *\n * Semantic separator rendered as `<hr>`.\n * Supports size variants and both horizontal and vertical orientations.\n *\n * @example Basic usage (horizontal, medium size)\n * ```tsx\n * <Divider />\n * ```\n *\n * @example Different sizes\n * ```tsx\n * <Divider size=\"xxs\" /> // 1px hairline\n * <Divider size=\"sm\" /> // 16px\n * <Divider size=\"lg\" /> // 48px\n * ```\n *\n * @example Vertical divider\n * ```tsx\n * <div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>\n * <span>Left content</span>\n * <Divider orientation=\"vertical\" size=\"sm\" />\n * <span>Right content</span>\n * </div>\n * ```\n *\n * @example With custom ID\n * ```tsx\n * <Divider id=\"section-break\" />\n * ```\n */\n\nexport const Divider = React.forwardRef<HTMLHRElement, DividerProps>((props, ref) => {\n const { className: customClassName, style: customStyle, ...opts } = props\n\n const theme = useTheme()\n\n const kit = createDividerRecipe(theme, opts)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return <hr ref={ref} {...kit.a11y} {...kit.dataAttributes} className={className} style={style} />\n})\n\nDivider.displayName = \"Divider\"\n","/**\n * React adapter for Marwes H1 component.\n * - Renders semantic <h1> using the core heading recipe.\n * - Supports size override for visual/semantic mismatch.\n */\n\nimport { headingRecipe } from \"@marwes-ui/core\"\nimport type { HeadingOptions, HeadingSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type H1Props = Omit<HeadingOptions, \"level\"> & {\n /**\n * Visual size override.\n * Allows using h1 semantics with different visual styling.\n * @default \"h1\"\n */\n size?: HeadingSize\n\n /**\n * Content of the heading.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * H1 (Heading Level 1)\n *\n * Semantic top-level heading rendered as `<h1>`.\n * Supports visual size override for cases where semantic and visual hierarchy differ.\n *\n * @example Basic usage\n * ```tsx\n * <H1>Page Title</H1>\n * ```\n *\n * @example With size override\n * ```tsx\n * <H1 size=\"h2\">Visually smaller but semantically h1</H1>\n * ```\n *\n * @example With ID for anchor linking\n * ```tsx\n * <H1 id=\"introduction\">Introduction</H1>\n * ```\n */\nexport function H1(props: H1Props): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = headingRecipe({ ...opts, level: 1 }, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <h1 id={kit.a11y.id} aria-label={kit.a11y.ariaLabel} className={className} style={style}>\n {children}\n </h1>\n )\n}\n","/**\n * React adapter for Marwes H2 component.\n * - Renders semantic <h2> using the core heading recipe.\n * - Supports size override for visual/semantic mismatch.\n */\n\nimport { headingRecipe } from \"@marwes-ui/core\"\nimport type { HeadingOptions, HeadingSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type H2Props = Omit<HeadingOptions, \"level\"> & {\n /**\n * Visual size override.\n * Allows using h2 semantics with different visual styling.\n * @default \"h2\"\n */\n size?: HeadingSize\n\n /**\n * Content of the heading.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * H2 (Heading Level 2)\n *\n * Semantic section heading rendered as `<h2>`.\n * Supports visual size override for cases where semantic and visual hierarchy differ.\n *\n * @example Basic usage\n * ```tsx\n * <H2>Section Title</H2>\n * ```\n *\n * @example With size override\n * ```tsx\n * <H2 size=\"h1\">Visually larger but semantically h2</H2>\n * ```\n */\nexport function H2(props: H2Props): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = headingRecipe({ ...opts, level: 2 }, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <h2 id={kit.a11y.id} aria-label={kit.a11y.ariaLabel} className={className} style={style}>\n {children}\n </h2>\n )\n}\n","/**\n * React adapter for Marwes H3 component.\n * - Renders semantic <h3> using the core heading recipe.\n * - Supports size override for visual/semantic mismatch.\n */\n\nimport { headingRecipe } from \"@marwes-ui/core\"\nimport type { HeadingOptions, HeadingSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type H3Props = Omit<HeadingOptions, \"level\"> & {\n /**\n * Visual size override.\n * Allows using h3 semantics with different visual styling.\n * @default \"h3\"\n */\n size?: HeadingSize\n\n /**\n * Content of the heading.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * H3 (Heading Level 3)\n *\n * Semantic subsection heading rendered as `<h3>`.\n * Supports visual size override for cases where semantic and visual hierarchy differ.\n *\n * @example Basic usage\n * ```tsx\n * <H3>Subsection Title</H3>\n * ```\n *\n * @example With size override\n * ```tsx\n * <H3 size=\"h2\">Visually larger but semantically h3</H3>\n * ```\n */\nexport function H3(props: H3Props): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = headingRecipe({ ...opts, level: 3 }, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <h3 id={kit.a11y.id} aria-label={kit.a11y.ariaLabel} className={className} style={style}>\n {children}\n </h3>\n )\n}\n","/**\n * React adapter for Marwes Paragraph component.\n * - Renders semantic <p> using the core paragraph recipe.\n * - Supports size variants: sm/md/lg.\n */\n\nimport { paragraphRecipe } from \"@marwes-ui/core\"\nimport type { ParagraphOptions, ParagraphSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type ParagraphProps = ParagraphOptions & {\n /**\n * Size variant.\n * @default \"md\"\n */\n size?: ParagraphSize\n\n /**\n * Content of the paragraph.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * Paragraph\n *\n * Semantic text block rendered as `<p>`.\n * Supports size variants for different text contexts.\n *\n * @example Basic usage\n * ```tsx\n * <Paragraph>This is a standard paragraph.</Paragraph>\n * ```\n *\n * @example With size variant\n * ```tsx\n * <Paragraph size=\"sm\">Small text for disclaimers.</Paragraph>\n * <Paragraph size=\"lg\">Emphasized lead paragraph.</Paragraph>\n * ```\n *\n * @example With ID\n * ```tsx\n * <Paragraph id=\"intro\">Introduction text.</Paragraph>\n * ```\n */\nexport function Paragraph(props: ParagraphProps): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = paragraphRecipe(opts, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <p id={kit.a11y.id} className={className} style={style}>\n {children}\n </p>\n )\n}\n","import * as React from \"react\"\nimport { Checkbox } from \".\"\nimport type { CheckboxProps } from \".\"\nimport { Paragraph } from \"../paragraph\"\n\nexport type CheckboxFieldProps = {\n /** Optional: if omitted, we generate one via useId(). */\n id?: string\n\n /** Field content (rendered by adapter). */\n label: React.ReactNode\n description?: React.ReactNode\n error?: React.ReactNode\n\n /** Props forwarded to the Checkbox atom. */\n checkbox: CheckboxProps\n\n /** Additional aria-describedby IDs to merge with internal description/error IDs. */\n ariaDescribedBy?: string\n}\n\nfunction cx(...parts: Array<string | false>): string {\n return parts.filter(Boolean).join(\" \")\n}\n\n/**\n * CheckboxField (Molecule) — Recommended\n *\n * A convenient, accessible wrapper around `Checkbox` that provides:\n * - a clickable `<label>` wired via `htmlFor`/`id`\n * - optional `description` and `error` regions\n * - automatic `aria-describedby` wiring (description + error + any external ids)\n * - automatic invalid state when `error` is present\n *\n * Use `CheckboxField` for most forms. Use `Checkbox` directly only when you need\n * a highly custom layout (tables, list rows, compound list items, etc.).\n *\n * Accessibility\n * - Generates a stable `id` via `useId()` when `id` is not provided.\n * - Always renders a real `<label>` element connected to the checkbox control.\n * - When `description` and/or `error` are present, it sets `aria-describedby`\n * on the checkbox to reference their ids.\n * - When `error` is present, the checkbox is marked invalid (aria-invalid via core).\n *\n * @example Minimal (recommended)\n * ```tsx\n * <CheckboxField\n * label=\"Subscribe to updates\"\n * checkbox={{ defaultChecked: true }}\n * />\n * ```\n *\n * @example With description\n * ```tsx\n * <CheckboxField\n * label=\"Subscribe to updates\"\n * description=\"We'll only email you about important product changes.\"\n * checkbox={{}}\n * />\n * ```\n *\n * @example With error (invalid state)\n * ```tsx\n * <CheckboxField\n * label=\"Accept terms\"\n * error=\"You must accept the terms to continue.\"\n * checkbox={{ required: true }}\n * />\n * ```\n *\n * @example Controlled\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n *\n * <CheckboxField\n * label=\"Accept terms\"\n * checkbox={{\n * checked,\n * onCheckedChange: setChecked,\n * }}\n * />\n * ```\n *\n * @example Indeterminate (mixed)\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n * const [mixed, setMixed] = React.useState(true);\n *\n * <CheckboxField\n * label=\"Select all\"\n * description=\"Applies to all items in the current view.\"\n * checkbox={{\n * checked,\n * indeterminate: mixed,\n * onCheckedChange: (next) => {\n * setMixed(false);\n * setChecked(next);\n * },\n * }}\n * />\n * ```\n *\n * @example Custom describedBy (merge with internal description/error)\n * ```tsx\n * <CheckboxField\n * ariaDescribedBy=\"my-extra-help\"\n * label=\"Enable telemetry\"\n * description=\"Helps us improve the product.\"\n * checkbox={{}}\n * />\n *\n * <div id=\"my-extra-help\">This setting can be changed later.</div>\n * ```\n */\n\nexport function CheckboxField(props: CheckboxFieldProps): React.ReactElement {\n const reactId = React.useId()\n const id = props.id ?? `mw-checkbox-${reactId}`\n\n const hasDescription = props.description !== undefined\n const hasError = props.error !== undefined\n\n const descId = hasDescription ? `${id}-desc` : undefined\n const errorId = hasError ? `${id}-error` : undefined\n\n // Merge aria-describedby from multiple sources\n const describedByParts = [props.ariaDescribedBy, descId, errorId].filter(Boolean)\n const mergedDescribedBy = describedByParts.length > 0 ? describedByParts.join(\" \") : undefined\n\n const disabled = props.checkbox.disabled || false\n const invalid = hasError || props.checkbox.invalid || false\n\n const wrapperClass = cx(\n \"mw-checkbox-field\",\n disabled && \"mw-checkbox-field--disabled\",\n invalid && \"mw-checkbox-field--invalid\",\n )\n\n // Prepare checkbox props with proper ariaDescribedBy merging\n const checkboxProps: CheckboxProps = {\n ...props.checkbox,\n id,\n invalid,\n }\n\n if (mergedDescribedBy) {\n checkboxProps.ariaDescribedBy = mergedDescribedBy\n }\n\n return (\n <div className={wrapperClass}>\n <div className=\"mw-checkbox-field__row\">\n <Checkbox {...checkboxProps} />\n\n <label className=\"mw-checkbox-field__label\" htmlFor={id}>\n <Paragraph size=\"md\">{props.label}</Paragraph>\n </label>\n </div>\n\n {hasDescription && (\n <div className=\"mw-checkbox-field__description\" id={descId}>\n <Paragraph size=\"sm\">{props.description}</Paragraph>\n </div>\n )}\n\n {hasError && (\n <div className=\"mw-checkbox-field__error\" id={errorId} aria-live=\"polite\">\n <Paragraph size=\"sm\">{props.error}</Paragraph>\n </div>\n )}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Input } from \"./input\"\nimport type { InputProps } from \"./input\"\nimport { Paragraph } from \"./paragraph\"\n\nexport type InputFieldProps = {\n /** Optional: if omitted, we generate one via useId(). */\n id?: string\n\n /** Field label (required for accessibility). */\n label: React.ReactNode\n\n /** Optional helper text shown below the input. */\n helperText?: React.ReactNode\n\n /** Optional error message. When present, input is marked invalid. */\n error?: React.ReactNode\n\n /** Props forwarded to the Input atom. */\n input: InputProps\n\n /** Additional aria-describedby IDs to merge with internal helper/error IDs. */\n ariaDescribedBy?: string\n}\n\nfunction cx(...parts: Array<string | false>): string {\n return parts.filter(Boolean).join(\" \")\n}\n\n/**\n * InputField (Molecule) — Recommended\n *\n * A convenient, accessible wrapper around `Input` that provides:\n * - a visible `<label>` wired via `htmlFor`/`id`\n * - optional `helperText` and `error` regions\n * - automatic `aria-describedby` wiring (helperText + error + any external ids)\n * - automatic invalid state when `error` is present\n *\n * Use `InputField` for most forms. Use `Input` directly only when you need\n * a highly custom layout or composite inputs.\n *\n * Accessibility\n * - Generates a stable `id` via `useId()` when `id` is not provided.\n * - Always renders a visible `<label>` element connected to the input control.\n * - When `helperText` and/or `error` are present, it sets `aria-describedby`\n * on the input to reference their ids.\n * - When `error` is present, the input is marked invalid (aria-invalid).\n * - Error region has `aria-live=\"polite\"` for screen reader announcements.\n *\n * @example Minimal (recommended)\n * ```tsx\n * <InputField\n * label=\"Email address\"\n * input={{ type: \"email\", placeholder: \"you@example.com\" }}\n * />\n * ```\n *\n * @example With helper text\n * ```tsx\n * <InputField\n * label=\"Username\"\n * helperText=\"Choose a unique username between 3-20 characters.\"\n * input={{ type: \"text\", placeholder: \"johnsmith\" }}\n * />\n * ```\n *\n * @example With error (invalid state)\n * ```tsx\n * <InputField\n * label=\"Password\"\n * error=\"Password must be at least 8 characters.\"\n * input={{ type: \"password\", required: true }}\n * />\n * ```\n *\n * @example Controlled\n * ```tsx\n * const [email, setEmail] = React.useState(\"\");\n *\n * <InputField\n * label=\"Email\"\n * input={{\n * type: \"email\",\n * value: email,\n * onValueChange: setEmail,\n * }}\n * />\n * ```\n *\n * @example Disabled\n * ```tsx\n * <InputField\n * label=\"Account ID\"\n * helperText=\"This value cannot be changed.\"\n * input={{ value: \"ACC-12345\", disabled: true }}\n * />\n * ```\n *\n * @example Read-only\n * ```tsx\n * <InputField\n * label=\"Account created\"\n * input={{ value: \"January 15, 2026\", readOnly: true }}\n * />\n * ```\n *\n * @example Custom describedBy (merge with internal helper/error)\n * ```tsx\n * <InputField\n * ariaDescribedBy=\"my-extra-help\"\n * label=\"API Key\"\n * helperText=\"Your key is stored securely.\"\n * input={{ type: \"password\" }}\n * />\n *\n * <div id=\"my-extra-help\">This can be regenerated from your settings.</div>\n * ```\n */\nexport function InputField(props: InputFieldProps): React.ReactElement {\n const reactId = React.useId()\n const id = props.id ?? `mw-input-${reactId}`\n\n const hasHelperText = props.helperText !== undefined\n const hasError = props.error !== undefined\n\n const helperTextId = hasHelperText ? `${id}-helper` : undefined\n const errorId = hasError ? `${id}-error` : undefined\n\n // Merge aria-describedby from multiple sources\n const describedByParts = [props.ariaDescribedBy, helperTextId, errorId].filter(Boolean)\n const mergedDescribedBy = describedByParts.length > 0 ? describedByParts.join(\" \") : undefined\n\n const disabled = props.input.disabled || false\n const readOnly = props.input.readOnly || false\n const invalid = hasError || props.input.invalid || false\n\n const wrapperClass = cx(\n \"mw-input-field\",\n disabled && \"mw-input-field--disabled\",\n invalid && \"mw-input-field--invalid\",\n readOnly && \"mw-input-field--readonly\",\n )\n\n // Prepare input props with proper describedBy merging\n const inputProps: InputProps = {\n ...props.input,\n id,\n invalid,\n }\n\n if (mergedDescribedBy) {\n inputProps.describedBy = mergedDescribedBy\n }\n\n return (\n <div className={wrapperClass}>\n <label className=\"mw-input-field__label\" htmlFor={id}>\n <Paragraph size=\"md\">{props.label}</Paragraph>\n </label>\n\n <Input {...inputProps} />\n\n {hasHelperText && !hasError && (\n <div className=\"mw-input-field__helper\" id={helperTextId}>\n <Paragraph size=\"sm\">{props.helperText}</Paragraph>\n </div>\n )}\n\n {hasError && (\n <div className=\"mw-input-field__error\" id={errorId} aria-live=\"polite\">\n <Paragraph size=\"sm\">{props.error}</Paragraph>\n </div>\n )}\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/provider/marwes-context.ts","../src/provider/marwes-provider.tsx","../src/provider/use-system.ts","../src/provider/use-theme.ts","../src/components/icon/icon.tsx","../src/components/button.tsx","../src/components/button-variants.tsx","../src/hooks/use-renderkit-debug.ts","../src/components/input.tsx","../src/components/checkbox/checkbox.tsx","../src/components/divider.tsx","../src/components/heading/h1.tsx","../src/components/heading/h2.tsx","../src/components/heading/h3.tsx","../src/components/paragraph/paragraph.tsx","../src/components/checkbox/checkbox-field.tsx","../src/components/input-field.tsx","../src/components/field-variants.tsx"],"names":["React","React2","React3","jsx","React4","React5","headingRecipe","React6","jsxs","cx"],"mappings":";;;;;;;;AAQO,IAAM,aAAA,GAAsBA,qBAAyC,IAAI,CAAA;AC4BzE,SAAS,cAAA,CAAe;AAAA,EAC7B,MAAA,GAAS,YAAA;AAAA,EACT,KAAA;AAAA,EACA,IAAA,GAAO,OAAA;AAAA,EACP,YAAA;AAAA,EACA;AACF,CAAA,EAAwB;AAEtB,EAAA,MAAM,aAAA,GAAsBC,eAAQ,MAAM;AACxC,IAAA,OAAO,YAAA,CAAa;AAAA,MAClB,MAAA;AAAA,MACA,KAAA,EAAO,QAAQ,EAAE,GAAG,OAAO,IAAA,EAAK,GAAI,EAAE,IAAA;AAAK,KAC5C,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,MAAA,EAAQ,KAAA,EAAO,IAAI,CAAC,CAAA;AAGxB,EAAA,MAAM,MAAA,GAAuBA,eAAQ,MAAM;AACzC,IAAA,IAAI,IAAA,KAAS,aAAA,CAAc,KAAA,CAAM,IAAA,EAAM;AACrC,MAAA,OAAO,aAAA;AAAA,IACT;AACA,IAAA,OAAO,UAAA,CAAW,eAAe,IAAI,CAAA;AAAA,EACvC,CAAA,EAAG,CAAC,aAAA,EAAe,IAAI,CAAC,CAAA;AAGxB,EAAA,MAAM,UAAA,GAAa,CAAA,UAAA,EAAa,MAAA,CAAO,KAAA,CAAM,IAAI,CAAA,CAAA;AAEjD,EAAA,uBACE,GAAA,CAAC,aAAA,CAAc,QAAA,EAAd,EAAuB,OAAO,EAAE,MAAA,EAAQ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AAAA,GAAAA,CAAC,UAAA,EAAA,EAAY,GAAG,KAAA,EAAO,KAAA,EAAO,aAAA,EAAe,CAAA,EAC/C,CAAA;AAEJ;AA6CO,SAAS,cAAc,KAAA,EAA+C;AAC3E,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,SAAA,EAAU,GAAI,KAAA;AAEnC,EAAA,MAAM,aAAA,GAA4B;AAAA,IAChC,GAAG,KAAA,CAAM,KAAA;AAAA,IACT,IAAA,EAAM,MAAA;AAAA,IACN,SAAA,EAAW;AAAA,GACb;AAGA,EAAA,MAAM,UAAA,GAAa,QAAA,GACf,KAAA,CAAM,UAAA,GACJ,CAAA,EAAG,KAAA,CAAM,UAAU,CAAA,EAAA,EAAK,QAAQ,CAAA,CAAA,CAAA,GAChC,CAAA,UAAA,EAAa,QAAQ,KACvB,KAAA,CAAM,UAAA;AAEV,EAAA,uBACEA,GAAAA,CAAC,KAAA,EAAA,EAAI,cAAA,EAAa,UAAA,EAAW,iBAAe,QAAA,EAC1C,QAAA,kBAAAA,GAAAA,CAAC,UAAA,EAAA,EAAY,GAAG,SAAA,EAAW,KAAA,EAAO,eAAe,UAAA,EAAY,UAAA,IAAc,IAAI,CAAA,EACjF,CAAA;AAEJ","file":"index.js","sourcesContent":["import type { System, ThemeMode } from \"@marwes-ui/core\"\nimport * as React from \"react\"\n\nexport type MarwesContextValue = {\n system: System\n onModeChange: ((mode: ThemeMode) => void) | undefined\n}\n\nexport const MarwesContext = React.createContext<MarwesContextValue | null>(null)\n","import type { Preset, System, ThemeMode, ThemeOverrides } from \"@marwes-ui/core\"\nimport { createSystem, switchMode } from \"@marwes-ui/core\"\nimport { firstEdition } from \"@marwes-ui/presets\"\nimport * as React from \"react\"\nimport { MarwesContext } from \"./marwes-context\"\n\nexport type MarwesProviderProps = {\n preset?: Preset\n theme?: ThemeOverrides\n /**\n * Current theme mode. Determines light or dark color palette.\n * When changed, efficiently switches theme colors without recreating the entire system.\n */\n mode?: ThemeMode\n /**\n * Callback fired when mode should change.\n * Users are responsible for managing mode state and persistence (e.g., localStorage).\n *\n * Example with persistence:\n * ```tsx\n * const [mode, setMode] = useState<ThemeMode>(\n * () => (localStorage.getItem('theme-mode') as ThemeMode) ?? 'light'\n * );\n *\n * const handleModeChange = (newMode: ThemeMode) => {\n * setMode(newMode);\n * localStorage.setItem('theme-mode', newMode);\n * };\n *\n * <MarwesProvider mode={mode} onModeChange={handleModeChange}>\n * ```\n */\n onModeChange?: (mode: ThemeMode) => void\n children: React.ReactNode\n}\n\nexport function MarwesProvider({\n preset = firstEdition,\n theme,\n mode = \"light\",\n onModeChange,\n children,\n}: MarwesProviderProps) {\n // Create initial system\n const initialSystem = React.useMemo(() => {\n return createSystem({\n preset,\n theme: theme ? { ...theme, mode } : { mode },\n })\n }, [preset, theme, mode])\n\n // Optimize mode switching using switchMode() instead of recreating system\n const system: System = React.useMemo(() => {\n if (mode === initialSystem.theme.mode) {\n return initialSystem\n }\n return switchMode(initialSystem, mode)\n }, [initialSystem, mode])\n\n // Apply theme class to container for CSS-based dark mode overrides\n const themeClass = `mw-theme--${system.theme.mode}`\n\n return (\n <MarwesContext.Provider value={{ system, onModeChange }}>\n <div className={themeClass}>{children}</div>\n </MarwesContext.Provider>\n )\n}\n","import type { System } from \"@marwes-ui/core\"\nimport * as React from \"react\"\nimport { MarwesContext } from \"./marwes-context\"\n\nexport function useSystem(): System {\n const ctx = React.useContext(MarwesContext)\n if (!ctx) {\n throw new Error(\"MarwesProvider is missing. Wrap your app in <MarwesProvider />.\")\n }\n return ctx.system\n}\n","import type { Theme } from \"@marwes-ui/core\"\nimport { useSystem } from \"./use-system\"\n\nexport function useTheme(): Theme {\n return useSystem().theme\n}\n","import {\n type IconSize,\n type IconStrokeWidth,\n iconRegistry,\n resolveIconSize,\n resolveIconStrokeWidth,\n} from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype IconName = keyof typeof iconRegistry\n\nexport type IconProps = {\n name: IconName\n\n /**\n * Token (\"xs\"|\"sm\"|\"md\"|\"lg\") or a raw px number.\n * Defaults to system.theme.icon.size\n */\n size?: IconSize | number\n\n /**\n * Token (\"xs\"|\"sm\"|\"md\"|\"lg\") or a raw number.\n * Defaults to system.theme.icon.strokeWidth\n */\n strokeWidth?: IconStrokeWidth | number\n\n /**\n * Common props\n */\n className?: string\n \"aria-label\"?: string\n decorative?: boolean\n}\n\nexport function Icon({\n name,\n size,\n strokeWidth,\n className,\n \"aria-label\": ariaLabel,\n decorative,\n}: IconProps) {\n const theme = useTheme()\n const themeIcon = theme.icon\n\n const px = resolveIconSize(size ?? themeIcon.size)\n const sw = resolveIconStrokeWidth(strokeWidth ?? themeIcon.strokeWidth)\n\n const def = iconRegistry[name]\n\n // If no aria-label => decorative\n const isDecorative = decorative || !ariaLabel\n\n return (\n <svg\n width={px}\n height={px}\n viewBox={def.viewBox}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={sw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden={isDecorative ? \"true\" : undefined}\n aria-label={ariaLabel}\n role={isDecorative ? undefined : \"img\"}\n focusable=\"false\"\n >\n {def.nodes.map((iconNode, nodeIndex) => {\n const TagName = iconNode.tag\n // biome-ignore lint/suspicious/noArrayIndexKey: Icon nodes are static and never reordered\n return <TagName key={nodeIndex} {...(iconNode.attrs as React.SVGAttributes<SVGElement>)} />\n })}\n </svg>\n )\n}\n","import type { ButtonOptions, CssVars } from \"@marwes-ui/core\"\nimport { createButtonRecipe } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../provider/use-theme\"\nimport { Icon } from \"./icon\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type ButtonProps = ButtonOptions & {\n children?: React.ReactNode\n onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void\n className?: string\n}\n\nexport function Button(props: ButtonProps) {\n const theme = useTheme()\n const kit = createButtonRecipe(theme, props)\n\n const style = kit.vars as StyleWithVars\n const className = props.className ? `${kit.className} ${props.className}` : kit.className\n\n const content = (\n <>\n {props.iconLeft && <Icon name={props.iconLeft} size=\"xs\" decorative />}\n {props.children}\n {props.iconRight && <Icon name={props.iconRight} size=\"xs\" decorative />}\n </>\n )\n\n if (kit.tag === \"button\") {\n return (\n <button\n type={kit.a11y.type}\n disabled={kit.a11y.disabled}\n aria-label={kit.a11y.ariaLabel}\n aria-busy={kit.a11y.ariaBusy}\n aria-disabled={kit.a11y.ariaDisabled}\n aria-pressed={kit.a11y.ariaPressed}\n aria-expanded={kit.a11y.ariaExpanded}\n aria-controls={kit.a11y.ariaControls}\n title={kit.a11y.title}\n className={className}\n style={style}\n onClick={(e) => props.onClick?.(e)}\n {...kit.dataAttributes}\n >\n {content}\n </button>\n )\n }\n\n return (\n <a\n href={kit.a11y.href}\n role={kit.a11y.role}\n tabIndex={kit.a11y.tabIndex}\n aria-label={kit.a11y.ariaLabel}\n aria-busy={kit.a11y.ariaBusy}\n aria-disabled={kit.a11y.ariaDisabled}\n aria-pressed={kit.a11y.ariaPressed}\n aria-expanded={kit.a11y.ariaExpanded}\n aria-controls={kit.a11y.ariaControls}\n title={kit.a11y.title}\n className={className}\n style={style}\n onClick={(e) => {\n if (kit.blockClick) {\n e.preventDefault()\n return\n }\n props.onClick?.(e)\n }}\n {...kit.dataAttributes}\n >\n {content}\n </a>\n )\n}\n","import { ButtonAction, ButtonVariant, IconName } from \"@marwes-ui/core\"\nimport { Button, type ButtonProps } from \"./button\"\n\n/**\n * Semantic Button Variants - AI-Friendly Components\n *\n * These variants encode best practices and automatically set AI-friendly\n * metadata, making it easier for both developers and AI tools to understand\n * the purpose and behavior of each button.\n */\n\n// ============================================================================\n// DANGER BUTTON - Destructive Actions\n// ============================================================================\n\nexport type DangerButtonProps = Omit<ButtonProps, \"variant\" | \"action\"> & {\n /**\n * Override automatic confirmation requirement.\n * Defaults to `true` for destructive actions.\n */\n confirmation?: boolean\n}\n\n/**\n * DangerButton - For destructive actions like delete, remove, or irreversible operations.\n *\n * **AI Context:**\n * - Sets `variant=\"primary\"` with error state for visual warning\n * - Sets `action=\"delete\"` to indicate destructive behavior\n * - Enables confirmation by default\n * - Adds `data-destructive=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * import { DangerButton } from \"@marwes-ui/react\";\n *\n * export function Example() {\n * return <DangerButton onClick={deleteProject}>Delete Project</DangerButton>;\n * }\n * ```\n */\nexport function DangerButton(props: DangerButtonProps) {\n const { confirmation = true, ...restProps } = props\n\n return (\n <Button\n {...restProps}\n variant={ButtonVariant.primary}\n action={ButtonAction.delete}\n iconRight={IconName.Minus}\n confirmation={confirmation}\n dataAttributes={{\n ...props.dataAttributes,\n \"data-destructive\": \"true\",\n \"data-confirmation-required\": confirmation ? \"true\" : \"false\",\n }}\n />\n )\n}\n\n// ============================================================================\n// CREATE BUTTON - Creation Actions\n// ============================================================================\n\nexport type CreateButtonProps = Omit<ButtonProps, \"action\">\n\n/**\n * CreateButton - For creation actions like adding new items or entities.\n *\n * **AI Context:**\n * - Sets `action=\"create\"` to indicate creation behavior\n * - Uses primary tone by default\n * - Adds `data-creative=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * <CreateButton onClick={createProject}>\n * New Project\n * </CreateButton>\n * ```\n */\nexport function CreateButton(props: CreateButtonProps) {\n return (\n <Button\n {...props}\n action=\"create\"\n variant={props.variant ?? \"primary\"}\n dataAttributes={{\n ...props.dataAttributes,\n \"data-creative\": \"true\",\n }}\n />\n )\n}\n\n// ============================================================================\n// SUBMIT BUTTON - Form Submissions\n// ============================================================================\n\nexport type SubmitButtonProps = Omit<ButtonProps, \"action\" | \"as\">\n\n/**\n * SubmitButton - For form submissions.\n *\n * **AI Context:**\n * - Sets `action=\"submit\"` and `type=\"submit\"`\n * - Adds `data-context=\"form-submit\"` for AI parsing\n * - Automatically uses button element (not anchor)\n *\n * @example\n * ```tsx\n * <SubmitButton>Submit</SubmitButton>\n * ```\n */\nexport function SubmitButton(props: SubmitButtonProps) {\n return (\n <Button\n {...props}\n as=\"button\"\n action=\"submit\"\n dataAttributes={{\n \"data-context\": \"form-submit\",\n ...props.dataAttributes,\n }}\n />\n )\n}\n\n// ============================================================================\n// CANCEL BUTTON - Cancel/Reset Actions\n// ============================================================================\n\nexport type CancelButtonProps = Omit<ButtonProps, \"action\">\n\n/**\n * CancelButton - For cancel or reset actions.\n *\n * **AI Context:**\n * - Sets `action=\"cancel\"` to indicate cancellation\n * - Uses secondary variant by default\n * - Adds `data-cancel=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * <CancelButton onClick={handleCancel}>\n * Cancel\n * </CancelButton>\n * ```\n */\nexport function CancelButton(props: CancelButtonProps) {\n return (\n <Button\n {...props}\n action=\"cancel\"\n variant={props.variant ?? \"secondary\"}\n dataAttributes={{\n ...props.dataAttributes,\n \"data-cancel\": \"true\",\n }}\n />\n )\n}\n\n// ============================================================================\n// LINK BUTTON - Navigation Actions\n// ============================================================================\n\nexport type LinkButtonProps = Omit<ButtonProps, \"action\" | \"as\"> & {\n /**\n * The URL to navigate to. Required for LinkButton.\n */\n href: string\n}\n\n/**\n * LinkButton - For navigation actions that look like buttons.\n *\n * **AI Context:**\n * - Sets `action=\"navigate\"` to indicate navigation\n * - Uses anchor element with button styling\n * - Adds `data-navigation=\"true\"` for AI parsing\n *\n * @example\n * ```tsx\n * <LinkButton href=\"/dashboard\">\n * Go to Dashboard\n * </LinkButton>\n * ```\n */\nexport function LinkButton(props: LinkButtonProps) {\n return (\n <Button\n {...props}\n as=\"a\"\n action=\"navigate\"\n dataAttributes={{\n ...props.dataAttributes,\n \"data-navigation\": \"true\",\n }}\n />\n )\n}\n\n// ============================================================================\n// PRIMARY BUTTON - General Actions\n// ============================================================================\n\nexport type PrimaryButtonProps = Omit<ButtonProps, \"variant\" | \"as\"> & {}\n\n/**\n * PrimaryButton - For general use when no specific semantic variant fits.\n *\n * @example\n * ```tsx\n * <PrimaryButton onClick={handlePrimaryAction}>\n * Do something important\n * </PrimaryButton>\n * ```\n */\nexport function PrimaryButton(props: PrimaryButtonProps) {\n return <Button {...props} variant=\"primary\" as=\"button\" />\n}\n\n// ============================================================================\n// SECONDARY BUTTON - General Actions\n// ============================================================================\n\nexport type SecondaryButtonProps = Omit<ButtonProps, \"variant\" | \"as\"> & {}\n\n/**\n * SecondaryButton - For general use when no specific semantic variant fits.\n *\n * @example\n * ```tsx\n * <SecondaryButton onClick={handleSecondaryAction}>\n * Do something important\n * </SecondaryButton>\n * ```\n */\nexport function SecondaryButton(props: SecondaryButtonProps) {\n return <Button {...props} variant=\"secondary\" as=\"button\" />\n}\n\n// ============================================================================\n// TEXT BUTTON - General Actions\n// ============================================================================\n\nexport type TextButtonProps = Omit<ButtonProps, \"variant\" | \"as\"> & {}\n\n/**\n * TextButton - For general use when no specific semantic variant fits.\n *\n * @example\n * ```tsx\n * <TextButton onClick={handleTextAction}>\n * Do something important\n * </TextButton>\n * ```\n */\nexport function TextButton(props: TextButtonProps) {\n return <Button {...props} variant=\"text\" as=\"button\" />\n}\n","import { useEffect } from \"react\"\n\nconst RENDERKIT_EVENT = \"marwes/renderkit/renderkit-update\"\n\nexport function useRenderKitDebug(renderKit: unknown, componentName: string) {\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n console.log(`[RenderKit Debug] ${componentName}:`, renderKit)\n const event = new CustomEvent(RENDERKIT_EVENT, {\n detail: {\n ...(renderKit as Record<string, unknown>),\n _meta: { component: componentName },\n },\n })\n window.dispatchEvent(event)\n }\n }, [renderKit, componentName])\n}\n","import type { CssVars, InputOptions } from \"@marwes-ui/core\"\nimport { createInputRecipe } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useRenderKitDebug } from \"../hooks/use-renderkit-debug\"\nimport { useTheme } from \"../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type InputProps = InputOptions & {\n onValueChange?: (value: string) => void\n className?: string\n}\n\nexport function Input(props: InputProps) {\n const theme = useTheme()\n const kit = createInputRecipe(theme, props)\n\n // Debug hook for Storybook RenderKit addon\n useRenderKitDebug(kit, \"Input\")\n\n const style = kit.vars as StyleWithVars\n const className = props.className ? `${kit.className} ${props.className}` : kit.className\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n props.onValueChange?.(e.target.value)\n }\n\n return (\n <input\n className={className}\n style={style}\n id={kit.a11y.id}\n name={kit.a11y.name}\n type={kit.a11y.type}\n inputMode={kit.a11y.inputMode}\n autoComplete={kit.a11y.autoComplete}\n placeholder={kit.a11y.placeholder}\n disabled={kit.a11y.disabled}\n readOnly={kit.a11y.readOnly}\n required={kit.a11y.required}\n aria-label={kit.a11y.ariaLabel}\n aria-invalid={kit.a11y.ariaInvalid}\n aria-describedby={kit.a11y.ariaDescribedBy}\n value={props.value}\n defaultValue={props.defaultValue}\n onChange={handleChange}\n />\n )\n}\n","/**\n * React adapter for Marwes Checkbox.\n * - Renders a native <input type=\"checkbox\"> using the core render kit.\n * - Applies strict a11y fields and CSS vars.\n * - Sets `indeterminate` via DOM property (not an HTML attribute).\n */\n\nimport { checkboxRecipe } from \"@marwes-ui/core\"\nimport type { CheckboxProps as CoreCheckboxProps } from \"@marwes-ui/core\"\nimport * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\nexport type CheckboxProps = CoreCheckboxProps & {\n /**\n * Called with the next checked value when the user toggles the checkbox.\n * For indeterminate state: browser toggling typically results in `checked=true` and `indeterminate=false`\n * unless you keep controlling it.\n */\n onCheckedChange?: (checked: boolean) => void\n\n /**\n * Escape hatch for consumers that want raw event access.\n * (Optional – keep if you want parity with other components.)\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>\n}\n\n/**\n * Checkbox (Atom)\n *\n * Low-level checkbox control built on a native `<input type=\"checkbox\">`.\n * Use this when you need custom layout or when the label/description is handled\n * elsewhere (e.g. inside a list item, table row, or custom field wrapper).\n *\n * For most forms, prefer `CheckboxField`, which composes `Checkbox` with\n * label/description/error wiring and consistent spacing.\n *\n * Accessibility\n * - Provide **either** `ariaLabel` **or** `ariaLabelledBy` (or use `CheckboxField` which wires a `<label>`).\n * - Use `ariaDescribedBy` to connect supporting text (help/error).\n * - `indeterminate` is applied via a DOM property, not an HTML attribute.\n *\n * @example Basic (uncontrolled)\n * ```tsx\n * <Checkbox ariaLabel=\"Subscribe to updates\" defaultChecked />\n * ```\n *\n * @example Controlled\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n *\n * <Checkbox\n * ariaLabel=\"Accept terms\"\n * checked={checked}\n * onCheckedChange={setChecked}\n * />\n * ```\n *\n * @example Indeterminate (mixed)\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n * const [mixed, setMixed] = React.useState(true);\n *\n * <Checkbox\n * ariaLabel=\"Select all\"\n * checked={checked}\n * indeterminate={mixed}\n * onCheckedChange={(next) => {\n * setMixed(false); // first interaction clears mixed state\n * setChecked(next);\n * }}\n * />\n * ```\n *\n * @example With external label + description\n * ```tsx\n * const id = \"terms\";\n * const descId = \"terms-desc\";\n *\n * <>\n * <div style={{ display: \"flex\", alignItems: \"center\", gap: 10 }}>\n * <Checkbox id={id} ariaDescribedBy={descId} />\n * <label htmlFor={id}>I accept the terms</label>\n * </div>\n * <div id={descId}>Required to continue.</div>\n * </>\n * ```\n */\n\nexport function Checkbox(props: CheckboxProps): React.ReactElement {\n const { onCheckedChange, onChange, ...coreProps } = props\n\n const theme = useTheme()\n\n const kit = checkboxRecipe({ ...coreProps, theme })\n\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n\n // Keep DOM property in sync.\n React.useLayoutEffect(() => {\n const el = inputRef.current\n if (!el) return\n el.indeterminate = kit.indeterminate\n }, [kit.indeterminate])\n\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n onChange?.(e)\n onCheckedChange?.(e.currentTarget.checked)\n }\n\n const { a11y } = kit\n\n return (\n <input\n ref={inputRef}\n type=\"checkbox\"\n className={kit.className}\n style={kit.vars}\n id={a11y.id}\n name={a11y.name}\n value={a11y.value}\n disabled={a11y.disabled === true}\n required={a11y.required === true}\n aria-label={a11y.ariaLabel}\n aria-labelledby={a11y.ariaLabelledBy}\n aria-describedby={a11y.ariaDescribedBy}\n aria-checked={a11y.ariaChecked}\n aria-invalid={a11y.ariaInvalid === true ? true : undefined}\n checked={kit.checked}\n defaultChecked={kit.defaultChecked}\n onChange={handleChange}\n />\n )\n}\n","/**\n * React adapter for Marwes Divider component.\n * - Renders semantic <hr> using the core divider recipe.\n * - Supports 7 size variants: xxs/xs/sm/md/lg/xl/xxl.\n * - Supports horizontal and vertical orientation.\n * - Figma reference: node-id=1-932\n */\n\nimport { createDividerRecipe } from \"@marwes-ui/core\"\nimport type { DividerOptions, DividerOrientation, DividerSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport * as React from \"react\"\nimport { useTheme } from \"../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type DividerProps = DividerOptions &\n Omit<React.HTMLAttributes<HTMLHRElement>, \"children\"> & {\n /**\n * Size variant for the divider.\n * Maps to pixel values: xxs=1px, xs=8px, sm=16px, md=32px, lg=48px, xl=64px, xxl=80px\n * @default \"md\"\n */\n size?: DividerSize\n\n /**\n * Orientation of the divider.\n * @default \"horizontal\"\n */\n orientation?: DividerOrientation\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n }\n\n/**\n * Divider\n *\n * Semantic separator rendered as `<hr>`.\n * Supports size variants and both horizontal and vertical orientations.\n *\n * @example Basic usage (horizontal, medium size)\n * ```tsx\n * <Divider />\n * ```\n *\n * @example Different sizes\n * ```tsx\n * <Divider size=\"xxs\" /> // 1px hairline\n * <Divider size=\"sm\" /> // 16px\n * <Divider size=\"lg\" /> // 48px\n * ```\n *\n * @example Vertical divider\n * ```tsx\n * <div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>\n * <span>Left content</span>\n * <Divider orientation=\"vertical\" size=\"sm\" />\n * <span>Right content</span>\n * </div>\n * ```\n *\n * @example With custom ID\n * ```tsx\n * <Divider id=\"section-break\" />\n * ```\n */\n\nexport const Divider = React.forwardRef<HTMLHRElement, DividerProps>((props, ref) => {\n const { className: customClassName, style: customStyle, ...opts } = props\n\n const theme = useTheme()\n\n const kit = createDividerRecipe(theme, opts)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return <hr ref={ref} {...kit.a11y} {...kit.dataAttributes} className={className} style={style} />\n})\n\nDivider.displayName = \"Divider\"\n","/**\n * React adapter for Marwes H1 component.\n * - Renders semantic <h1> using the core heading recipe.\n * - Supports size override for visual/semantic mismatch.\n */\n\nimport { headingRecipe } from \"@marwes-ui/core\"\nimport type { HeadingOptions, HeadingSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type H1Props = Omit<HeadingOptions, \"level\"> & {\n /**\n * Visual size override.\n * Allows using h1 semantics with different visual styling.\n * @default \"h1\"\n */\n size?: HeadingSize\n\n /**\n * Content of the heading.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * H1 (Heading Level 1)\n *\n * Semantic top-level heading rendered as `<h1>`.\n * Supports visual size override for cases where semantic and visual hierarchy differ.\n *\n * @example Basic usage\n * ```tsx\n * <H1>Page Title</H1>\n * ```\n *\n * @example With size override\n * ```tsx\n * <H1 size=\"h2\">Visually smaller but semantically h1</H1>\n * ```\n *\n * @example With ID for anchor linking\n * ```tsx\n * <H1 id=\"introduction\">Introduction</H1>\n * ```\n */\nexport function H1(props: H1Props): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = headingRecipe({ ...opts, level: 1 }, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <h1 id={kit.a11y.id} aria-label={kit.a11y.ariaLabel} className={className} style={style}>\n {children}\n </h1>\n )\n}\n","/**\n * React adapter for Marwes H2 component.\n * - Renders semantic <h2> using the core heading recipe.\n * - Supports size override for visual/semantic mismatch.\n */\n\nimport { headingRecipe } from \"@marwes-ui/core\"\nimport type { HeadingOptions, HeadingSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type H2Props = Omit<HeadingOptions, \"level\"> & {\n /**\n * Visual size override.\n * Allows using h2 semantics with different visual styling.\n * @default \"h2\"\n */\n size?: HeadingSize\n\n /**\n * Content of the heading.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * H2 (Heading Level 2)\n *\n * Semantic section heading rendered as `<h2>`.\n * Supports visual size override for cases where semantic and visual hierarchy differ.\n *\n * @example Basic usage\n * ```tsx\n * <H2>Section Title</H2>\n * ```\n *\n * @example With size override\n * ```tsx\n * <H2 size=\"h1\">Visually larger but semantically h2</H2>\n * ```\n */\nexport function H2(props: H2Props): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = headingRecipe({ ...opts, level: 2 }, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <h2 id={kit.a11y.id} aria-label={kit.a11y.ariaLabel} className={className} style={style}>\n {children}\n </h2>\n )\n}\n","/**\n * React adapter for Marwes H3 component.\n * - Renders semantic <h3> using the core heading recipe.\n * - Supports size override for visual/semantic mismatch.\n */\n\nimport { headingRecipe } from \"@marwes-ui/core\"\nimport type { HeadingOptions, HeadingSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type H3Props = Omit<HeadingOptions, \"level\"> & {\n /**\n * Visual size override.\n * Allows using h3 semantics with different visual styling.\n * @default \"h3\"\n */\n size?: HeadingSize\n\n /**\n * Content of the heading.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * H3 (Heading Level 3)\n *\n * Semantic subsection heading rendered as `<h3>`.\n * Supports visual size override for cases where semantic and visual hierarchy differ.\n *\n * @example Basic usage\n * ```tsx\n * <H3>Subsection Title</H3>\n * ```\n *\n * @example With size override\n * ```tsx\n * <H3 size=\"h2\">Visually larger but semantically h3</H3>\n * ```\n */\nexport function H3(props: H3Props): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = headingRecipe({ ...opts, level: 3 }, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <h3 id={kit.a11y.id} aria-label={kit.a11y.ariaLabel} className={className} style={style}>\n {children}\n </h3>\n )\n}\n","/**\n * React adapter for Marwes Paragraph component.\n * - Renders semantic <p> using the core paragraph recipe.\n * - Supports size variants: sm/md/lg.\n */\n\nimport { paragraphRecipe } from \"@marwes-ui/core\"\nimport type { ParagraphOptions, ParagraphSize } from \"@marwes-ui/core\"\nimport type { CssVars } from \"@marwes-ui/core\"\nimport type * as React from \"react\"\nimport { useTheme } from \"../../provider/use-theme\"\n\ntype StyleWithVars = React.CSSProperties & CssVars\n\nexport type ParagraphProps = ParagraphOptions & {\n /**\n * Size variant.\n * @default \"md\"\n */\n size?: ParagraphSize\n\n /**\n * Content of the paragraph.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS class names.\n */\n className?: string\n\n /**\n * Inline styles.\n */\n style?: React.CSSProperties\n}\n\n/**\n * Paragraph\n *\n * Semantic text block rendered as `<p>`.\n * Supports size variants for different text contexts.\n *\n * @example Basic usage\n * ```tsx\n * <Paragraph>This is a standard paragraph.</Paragraph>\n * ```\n *\n * @example With size variant\n * ```tsx\n * <Paragraph size=\"sm\">Small text for disclaimers.</Paragraph>\n * <Paragraph size=\"lg\">Emphasized lead paragraph.</Paragraph>\n * ```\n *\n * @example With ID\n * ```tsx\n * <Paragraph id=\"intro\">Introduction text.</Paragraph>\n * ```\n */\nexport function Paragraph(props: ParagraphProps): React.ReactElement {\n const { children, className: customClassName, style: customStyle, ...opts } = props\n const theme = useTheme()\n\n const kit = paragraphRecipe(opts, theme)\n\n const style = { ...(kit.vars as StyleWithVars), ...customStyle }\n const className = customClassName ? `${kit.className} ${customClassName}` : kit.className\n\n return (\n <p id={kit.a11y.id} className={className} style={style}>\n {children}\n </p>\n )\n}\n","import * as React from \"react\"\nimport { Checkbox } from \".\"\nimport type { CheckboxProps } from \".\"\nimport { Paragraph } from \"../paragraph\"\n\nexport type CheckboxFieldProps = {\n /** Optional: if omitted, we generate one via useId(). */\n id?: string\n\n /** Field content (rendered by adapter). */\n label: React.ReactNode\n description?: React.ReactNode\n error?: React.ReactNode\n\n /** Props forwarded to the Checkbox atom. */\n checkbox: CheckboxProps\n\n /** Additional aria-describedby IDs to merge with internal description/error IDs. */\n ariaDescribedBy?: string\n}\n\nfunction cx(...parts: Array<string | false>): string {\n return parts.filter(Boolean).join(\" \")\n}\n\n/**\n * CheckboxField (Molecule) — Recommended\n *\n * A convenient, accessible wrapper around `Checkbox` that provides:\n * - a clickable `<label>` wired via `htmlFor`/`id`\n * - optional `description` and `error` regions\n * - automatic `aria-describedby` wiring (description + error + any external ids)\n * - automatic invalid state when `error` is present\n *\n * Use `CheckboxField` for most forms. Use `Checkbox` directly only when you need\n * a highly custom layout (tables, list rows, compound list items, etc.).\n *\n * Accessibility\n * - Generates a stable `id` via `useId()` when `id` is not provided.\n * - Always renders a real `<label>` element connected to the checkbox control.\n * - When `description` and/or `error` are present, it sets `aria-describedby`\n * on the checkbox to reference their ids.\n * - When `error` is present, the checkbox is marked invalid (aria-invalid via core).\n *\n * @example Minimal (recommended)\n * ```tsx\n * <CheckboxField\n * label=\"Subscribe to updates\"\n * checkbox={{ defaultChecked: true }}\n * />\n * ```\n *\n * @example With description\n * ```tsx\n * <CheckboxField\n * label=\"Subscribe to updates\"\n * description=\"We'll only email you about important product changes.\"\n * checkbox={{}}\n * />\n * ```\n *\n * @example With error (invalid state)\n * ```tsx\n * <CheckboxField\n * label=\"Accept terms\"\n * error=\"You must accept the terms to continue.\"\n * checkbox={{ required: true }}\n * />\n * ```\n *\n * @example Controlled\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n *\n * <CheckboxField\n * label=\"Accept terms\"\n * checkbox={{\n * checked,\n * onCheckedChange: setChecked,\n * }}\n * />\n * ```\n *\n * @example Indeterminate (mixed)\n * ```tsx\n * const [checked, setChecked] = React.useState(false);\n * const [mixed, setMixed] = React.useState(true);\n *\n * <CheckboxField\n * label=\"Select all\"\n * description=\"Applies to all items in the current view.\"\n * checkbox={{\n * checked,\n * indeterminate: mixed,\n * onCheckedChange: (next) => {\n * setMixed(false);\n * setChecked(next);\n * },\n * }}\n * />\n * ```\n *\n * @example Custom describedBy (merge with internal description/error)\n * ```tsx\n * <CheckboxField\n * ariaDescribedBy=\"my-extra-help\"\n * label=\"Enable telemetry\"\n * description=\"Helps us improve the product.\"\n * checkbox={{}}\n * />\n *\n * <div id=\"my-extra-help\">This setting can be changed later.</div>\n * ```\n */\n\nexport function CheckboxField(props: CheckboxFieldProps): React.ReactElement {\n const reactId = React.useId()\n const id = props.id ?? `mw-checkbox-${reactId}`\n\n const hasDescription = props.description !== undefined\n const hasError = props.error !== undefined\n\n const descId = hasDescription ? `${id}-desc` : undefined\n const errorId = hasError ? `${id}-error` : undefined\n\n // Merge aria-describedby from multiple sources\n const describedByParts = [props.ariaDescribedBy, descId, errorId].filter(Boolean)\n const mergedDescribedBy = describedByParts.length > 0 ? describedByParts.join(\" \") : undefined\n\n const disabled = props.checkbox.disabled || false\n const invalid = hasError || props.checkbox.invalid || false\n\n const wrapperClass = cx(\n \"mw-checkbox-field\",\n disabled && \"mw-checkbox-field--disabled\",\n invalid && \"mw-checkbox-field--invalid\",\n )\n\n // Prepare checkbox props with proper ariaDescribedBy merging\n const checkboxProps: CheckboxProps = {\n ...props.checkbox,\n id,\n invalid,\n }\n\n if (mergedDescribedBy) {\n checkboxProps.ariaDescribedBy = mergedDescribedBy\n }\n\n return (\n <div className={wrapperClass}>\n <div className=\"mw-checkbox-field__row\">\n <Checkbox {...checkboxProps} />\n\n <label className=\"mw-checkbox-field__label\" htmlFor={id}>\n <Paragraph size=\"md\">{props.label}</Paragraph>\n </label>\n </div>\n\n {hasDescription && (\n <div className=\"mw-checkbox-field__description\" id={descId}>\n <Paragraph size=\"sm\">{props.description}</Paragraph>\n </div>\n )}\n\n {hasError && (\n <div className=\"mw-checkbox-field__error\" id={errorId} aria-live=\"polite\">\n <Paragraph size=\"sm\">{props.error}</Paragraph>\n </div>\n )}\n </div>\n )\n}\n","import * as React from \"react\"\nimport { Icon } from \"./icon\"\nimport { Input } from \"./input\"\nimport type { InputProps } from \"./input\"\nimport { Paragraph } from \"./paragraph\"\n\nexport type InputFieldProps = {\n /** Optional: if omitted, we generate one via useId(). */\n id?: string\n\n /** Field label (required for accessibility). */\n label: string\n\n /** Optional helper text shown below the input. */\n helperText?: string\n\n /** Optional error message. When present, input is marked invalid. */\n error?: string\n\n /** Props forwarded to the Input atom. */\n input: InputProps\n\n /** Additional aria-describedby IDs to merge with internal helper/error IDs. */\n ariaDescribedBy?: string\n}\n\nfunction cx(...parts: Array<string | false>): string {\n return parts.filter(Boolean).join(\" \")\n}\n\n/**\n * InputField (Molecule) — Recommended\n *\n * A convenient, accessible wrapper around `Input` that provides:\n * - a visible `<label>` wired via `htmlFor`/`id`\n * - optional `helperText` and `error` regions\n * - automatic `aria-describedby` wiring (helperText + error + any external ids)\n * - automatic invalid state when `error` is present\n *\n * Use `InputField` for most forms. Use `Input` directly only when you need\n * a highly custom layout or composite inputs.\n *\n * Accessibility\n * - Generates a stable `id` via `useId()` when `id` is not provided.\n * - Always renders a visible `<label>` element connected to the input control.\n * - When `helperText` and/or `error` are present, it sets `aria-describedby`\n * on the input to reference their ids.\n * - When `error` is present, the input is marked invalid (aria-invalid).\n * - Error region has `aria-live=\"polite\"` for screen reader announcements.\n *\n * @example Minimal (recommended)\n * ```tsx\n * <InputField\n * label=\"Email address\"\n * input={{ type: \"email\", placeholder: \"you@example.com\" }}\n * />\n * ```\n *\n * @example With helper text\n * ```tsx\n * <InputField\n * label=\"Username\"\n * helperText=\"Choose a unique username between 3-20 characters.\"\n * input={{ type: \"text\", placeholder: \"johnsmith\" }}\n * />\n * ```\n *\n * @example With error (invalid state)\n * ```tsx\n * <InputField\n * label=\"Password\"\n * error=\"Password must be at least 8 characters.\"\n * input={{ type: \"password\", required: true }}\n * />\n * ```\n *\n * @example Controlled\n * ```tsx\n * const [email, setEmail] = React.useState(\"\");\n *\n * <InputField\n * label=\"Email\"\n * input={{\n * type: \"email\",\n * value: email,\n * onValueChange: setEmail,\n * }}\n * />\n * ```\n *\n * @example Disabled\n * ```tsx\n * <InputField\n * label=\"Account ID\"\n * helperText=\"This value cannot be changed.\"\n * input={{ value: \"ACC-12345\", disabled: true }}\n * />\n * ```\n *\n * @example Read-only\n * ```tsx\n * <InputField\n * label=\"Account created\"\n * input={{ value: \"January 15, 2026\", readOnly: true }}\n * />\n * ```\n *\n * @example Custom describedBy (merge with internal helper/error)\n * ```tsx\n * <InputField\n * ariaDescribedBy=\"my-extra-help\"\n * label=\"API Key\"\n * helperText=\"Your key is stored securely.\"\n * input={{ type: \"password\" }}\n * />\n *\n * <div id=\"my-extra-help\">This can be regenerated from your settings.</div>\n * ```\n */\nexport function InputField(props: InputFieldProps): React.ReactElement {\n const reactId = React.useId()\n const id = props.id ?? `mw-input-${reactId}`\n\n // Password visibility toggle\n const isPasswordField = props.input.type === \"password\"\n const [showPassword, setShowPassword] = React.useState(false)\n\n // Search clear button - track if search has value\n const isSearchField = props.input.type === \"search\"\n const [searchValue, setSearchValue] = React.useState(\n props.input.value || props.input.defaultValue || \"\",\n )\n\n // Determine if clear button should show based on controlled vs uncontrolled\n const hasSearchValue =\n isSearchField &&\n (props.input.value !== undefined\n ? String(props.input.value).length > 0\n : String(searchValue).length > 0)\n\n const hasHelperText = props.helperText !== undefined\n const hasError = props.error !== undefined\n\n const helperTextId = hasHelperText ? `${id}-helper` : undefined\n const errorId = hasError ? `${id}-error` : undefined\n\n // Merge aria-describedby from multiple sources\n const describedByParts = [props.ariaDescribedBy, helperTextId, errorId].filter(Boolean)\n const mergedDescribedBy = describedByParts.length > 0 ? describedByParts.join(\" \") : undefined\n\n const disabled = props.input.disabled || false\n const readOnly = props.input.readOnly || false\n const invalid = hasError || props.input.invalid || false\n\n const wrapperClass = cx(\n \"mw-input-field\",\n disabled && \"mw-input-field--disabled\",\n invalid && \"mw-input-field--invalid\",\n readOnly && \"mw-input-field--readonly\",\n )\n\n // Prepare input props with proper describedBy merging\n const inputProps: InputProps = {\n ...props.input,\n id,\n invalid,\n }\n\n // Override type when showing password\n if (isPasswordField && showPassword) {\n inputProps.type = \"text\"\n }\n\n // Track search value changes and make search inputs controlled\n if (isSearchField) {\n const originalOnValueChange = props.input.onValueChange\n\n // Use parent's value if controlled, otherwise use local state\n if (props.input.value === undefined) {\n inputProps.value = searchValue\n }\n\n inputProps.onValueChange = (value: string) => {\n setSearchValue(value)\n originalOnValueChange?.(value)\n }\n }\n\n if (mergedDescribedBy) {\n inputProps.describedBy = mergedDescribedBy\n }\n\n const handleTogglePassword = () => {\n setShowPassword((prev) => !prev)\n }\n\n const handleClearSearch = () => {\n // For controlled inputs: notify parent to update state\n // For uncontrolled: update local state\n setSearchValue(\"\")\n props.input.onValueChange?.(\"\")\n }\n\n return (\n <div className={wrapperClass}>\n <label className=\"mw-input-field__label\" htmlFor={id}>\n <Paragraph size=\"md\">{props.label}</Paragraph>\n </label>\n\n <div className=\"mw-input-field__input-wrapper\">\n <Input {...inputProps} />\n\n {isPasswordField && (\n <button\n type=\"button\"\n className=\"mw-input-field__toggle-password\"\n onClick={handleTogglePassword}\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\n tabIndex={0}\n >\n <Icon name={showPassword ? \"eyeOff\" : \"eye\"} size=\"xs\" decorative />\n </button>\n )}\n\n {hasSearchValue && (\n <button\n type=\"button\"\n className=\"mw-input-field__clear-search\"\n onClick={handleClearSearch}\n aria-label=\"Clear search\"\n tabIndex={0}\n >\n <Icon name=\"x\" size=\"xs\" decorative />\n </button>\n )}\n </div>\n\n {hasHelperText && !hasError && (\n <div className=\"mw-input-field__helper\" id={helperTextId}>\n <Paragraph size=\"sm\">{props.helperText}</Paragraph>\n </div>\n )}\n\n {hasError && (\n <div className=\"mw-input-field__error\" id={errorId} aria-live=\"polite\">\n <Paragraph size=\"sm\">{props.error}</Paragraph>\n </div>\n )}\n </div>\n )\n}\n","import type * as React from \"react\"\nimport type { InputProps } from \"./input\"\nimport { InputField, type InputFieldProps } from \"./input-field\"\n\n/**\n * Field Variants - AI-Friendly Components\n *\n * These variants encode best practices and automatically set AI-friendly\n * metadata, making it easier for both developers and AI tools to understand\n * the purpose and behavior of each field.\n *\n * Each variant manages its own purpose-specific logic (password toggle,\n * search clear, etc.) and sets appropriate semantic attributes.\n */\n\n// ============================================================================\n// SEARCH FIELD - Search inputs with clear button\n// ============================================================================\n\nexport type SearchFieldProps = Omit<InputFieldProps, \"input\"> & {\n /**\n * Input-specific props (type is auto-set to \"search\")\n */\n input?: Omit<InputProps, \"type\">\n}\n\n/**\n * SearchField - For search inputs with automatic clear button functionality.\n *\n * **AI Context:**\n * - Sets `type=\"search\"` automatically\n * - Sets `inputMode=\"search\"` for mobile keyboards\n * - Shows clear button (X icon) when field has content\n * - Adds `data-purpose=\"search\"` for AI parsing\n *\n * **Features:**\n * - Automatic clear button that appears when typing\n * - Native search input behavior\n * - Optimized mobile keyboard\n * - Controlled and uncontrolled modes supported\n *\n * @example Basic usage\n * ```tsx\n * import { SearchField } from \"@marwes-ui/react\";\n *\n * export function Example() {\n * const [query, setQuery] = React.useState(\"\");\n * return (\n * <SearchField\n * label=\"Search products\"\n * input={{ value: query, onValueChange: setQuery }}\n * />\n * );\n * }\n * ```\n */\nexport function SearchField(props: SearchFieldProps): React.ReactElement {\n // Enhanced input props with search-specific settings\n const enhancedInput: InputProps = {\n ...props.input,\n type: \"search\",\n inputMode: \"search\",\n }\n\n return (\n <div data-purpose=\"search\">\n <InputField {...props} input={enhancedInput} />\n </div>\n )\n}\n\n// ============================================================================\n// PASSWORD FIELD - Password inputs with show/hide toggle\n// ============================================================================\n\nexport type PasswordFieldProps = Omit<InputFieldProps, \"input\"> & {\n /**\n * Input-specific props (type is auto-set to \"password\")\n */\n input?: Omit<InputProps, \"type\">\n\n /**\n * Autocomplete hint: \"current-password\" or \"new-password\"\n * Defaults to \"current-password\"\n */\n autoComplete?: \"current-password\" | \"new-password\"\n}\n\n/**\n * PasswordField - For password inputs with automatic show/hide toggle.\n *\n * **AI Context:**\n * - Sets `type=\"password\"` automatically (toggles to \"text\" when shown)\n * - Shows eye/eyeOff icon toggle button\n * - Sets appropriate `autoComplete` attribute\n * - Adds `data-purpose=\"password\"` for AI parsing\n *\n * **Features:**\n * - Automatic show/hide toggle with eye icon\n * - Proper autocomplete for password managers\n * - Accessible toggle button with clear labels\n * - Controlled and uncontrolled modes supported\n *\n * @example Basic usage\n * ```tsx\n * import { PasswordField } from \"@marwes-ui/react\";\n *\n * export function Example() {\n * const [password, setPassword] = React.useState(\"\");\n * return (\n * <PasswordField\n * label=\"Password\"\n * input={{ value: password, onValueChange: setPassword }}\n * />\n * );\n * }\n * ```\n *\n * @example New password (signup/reset)\n * ```tsx\n * <PasswordField\n * label=\"New Password\"\n * autoComplete=\"new-password\"\n * helperText=\"Must be at least 8 characters\"\n * />\n * ```\n */\nexport function PasswordField(props: PasswordFieldProps): React.ReactElement {\n const { autoComplete = \"current-password\", ...restProps } = props\n\n // Enhanced input props with password-specific settings\n const enhancedInput: InputProps = {\n ...props.input,\n type: \"password\",\n autoComplete,\n }\n\n return (\n <div data-purpose=\"password\">\n <InputField {...restProps} input={enhancedInput} />\n </div>\n )\n}\n\n// ============================================================================\n// EMAIL FIELD - Email inputs with proper semantic attributes\n// ============================================================================\n\nexport type EmailFieldProps = Omit<InputFieldProps, \"input\"> & {\n /**\n * Input-specific props (type, inputMode, autoComplete auto-set)\n */\n input?: Omit<InputProps, \"type\" | \"inputMode\" | \"autoComplete\">\n}\n\n/**\n * EmailField - For email address inputs with proper semantic attributes.\n *\n * **AI Context:**\n * - Sets `type=\"email\"` for validation\n * - Sets `inputMode=\"email\"` for optimized mobile keyboard\n * - Sets `autoComplete=\"email\"` for autofill\n * - Adds `data-purpose=\"email\"` for AI parsing\n *\n * **Features:**\n * - Browser email validation\n * - Email-optimized mobile keyboard\n * - Autofill support for email addresses\n *\n * @example\n * ```tsx\n * import { EmailField } from \"@marwes-ui/react\";\n *\n * <EmailField\n * label=\"Email address\"\n * input={{ placeholder: \"you@example.com\" }}\n * />\n * ```\n */\nexport function EmailField(props: EmailFieldProps): React.ReactElement {\n const enhancedInput: InputProps = {\n ...props.input,\n type: \"email\",\n inputMode: \"email\",\n autoComplete: \"email\",\n }\n\n return (\n <div data-purpose=\"email\">\n <InputField {...props} input={enhancedInput} />\n </div>\n )\n}\n\n// ============================================================================\n// PHONE FIELD - Phone number inputs with proper semantic attributes\n// ============================================================================\n\nexport type PhoneFieldProps = Omit<InputFieldProps, \"input\"> & {\n /**\n * Input-specific props (type, inputMode, autoComplete auto-set)\n */\n input?: Omit<InputProps, \"type\" | \"inputMode\" | \"autoComplete\">\n}\n\n/**\n * PhoneField - For phone number inputs with proper semantic attributes.\n *\n * **AI Context:**\n * - Sets `type=\"tel\"` for telephone input\n * - Sets `inputMode=\"tel\"` for phone keyboard\n * - Sets `autoComplete=\"tel\"` for autofill\n * - Adds `data-purpose=\"phone\"` for AI parsing\n *\n * **Features:**\n * - Phone-optimized mobile keyboard\n * - Autofill support for phone numbers\n * - Accepts any phone format (formatting should be done externally)\n *\n * @example\n * ```tsx\n * import { PhoneField } from \"@marwes-ui/react\";\n *\n * <PhoneField\n * label=\"Phone number\"\n * input={{ placeholder: \"+1 (555) 000-0000\" }}\n * />\n * ```\n */\nexport function PhoneField(props: PhoneFieldProps): React.ReactElement {\n const enhancedInput: InputProps = {\n ...props.input,\n type: \"tel\",\n inputMode: \"tel\",\n autoComplete: \"tel\",\n }\n\n return (\n <div data-purpose=\"phone\">\n <InputField {...props} input={enhancedInput} />\n </div>\n )\n}\n\n// ============================================================================\n// URL FIELD - URL inputs with proper semantic attributes\n// ============================================================================\n\nexport type URLFieldProps = Omit<InputFieldProps, \"input\"> & {\n /**\n * Input-specific props (type, inputMode, autoComplete auto-set)\n */\n input?: Omit<InputProps, \"type\" | \"inputMode\" | \"autoComplete\">\n}\n\n/**\n * URLField - For URL inputs with proper semantic attributes.\n *\n * **AI Context:**\n * - Sets `type=\"url\"` for URL validation\n * - Sets `inputMode=\"url\"` for URL keyboard\n * - Sets `autoComplete=\"url\"` for autofill\n * - Adds `data-purpose=\"url\"` for AI parsing\n *\n * **Features:**\n * - Browser URL validation\n * - URL-optimized mobile keyboard\n * - Autofill support for URLs\n *\n * @example\n * ```tsx\n * import { URLField } from \"@marwes-ui/react\";\n *\n * <URLField\n * label=\"Website\"\n * input={{ placeholder: \"https://example.com\" }}\n * />\n * ```\n */\nexport function URLField(props: URLFieldProps): React.ReactElement {\n const enhancedInput: InputProps = {\n ...props.input,\n type: \"url\",\n inputMode: \"url\",\n autoComplete: \"url\",\n }\n\n return (\n <div data-purpose=\"url\">\n <InputField {...props} input={enhancedInput} />\n </div>\n )\n}\n\n// ============================================================================\n// CURRENCY FIELD - Currency/monetary inputs with formatting hints\n// ============================================================================\n\nexport type CurrencyFieldProps = Omit<InputFieldProps, \"input\"> & {\n /**\n * Input-specific props (type, inputMode auto-set)\n */\n input?: Omit<InputProps, \"type\" | \"inputMode\">\n\n /**\n * Currency code (e.g., \"USD\", \"EUR\", \"GBP\")\n * Used for helper text and context\n */\n currency?: string\n}\n\n/**\n * CurrencyField - For monetary amount inputs with currency context.\n *\n * **AI Context:**\n * - Sets `type=\"text\"` (better browser support than \"number\")\n * - Sets `inputMode=\"decimal\"` for numeric keyboard with decimal\n * - Adds currency code to helper text if provided\n * - Adds `data-purpose=\"currency\"` and `data-currency` for AI parsing\n *\n * **Features:**\n * - Decimal keyboard on mobile\n * - Currency code display in helper text\n * - Better input control than type=\"number\"\n * - Note: Formatting should be handled by parent component\n *\n * @example\n * ```tsx\n * import { CurrencyField } from \"@marwes-ui/react\";\n *\n * <CurrencyField\n * label=\"Amount\"\n * currency=\"USD\"\n * input={{ placeholder: \"0.00\" }}\n * />\n * ```\n */\nexport function CurrencyField(props: CurrencyFieldProps): React.ReactElement {\n const { currency, ...restProps } = props\n\n const enhancedInput: InputProps = {\n ...props.input,\n type: \"text\",\n inputMode: \"decimal\",\n }\n\n // Add currency to helper text if provided\n const helperText = currency\n ? props.helperText\n ? `${props.helperText} (${currency})`\n : `Amount in ${currency}`\n : props.helperText\n\n return (\n <div data-purpose=\"currency\" data-currency={currency}>\n <InputField {...restProps} input={enhancedInput} helperText={helperText || \"\"} />\n </div>\n )\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marwes-ui/react",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -19,8 +19,8 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@marwes-ui/core": "0.0.3",
23
- "@marwes-ui/presets": "0.0.3"
22
+ "@marwes-ui/presets": "0.0.4",
23
+ "@marwes-ui/core": "0.0.4"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": ">=18",