@arkyn/components 3.0.1-beta.143 → 3.0.1-beta.145
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/dist/bundle.js +1 -1
- package/dist/components/alert/alertContainer/index.d.ts +27 -43
- package/dist/components/alert/alertContainer/index.d.ts.map +1 -1
- package/dist/components/alert/alertContainer/index.js +20 -40
- package/dist/components/alert/alertContent/index.d.ts +11 -36
- package/dist/components/alert/alertContent/index.d.ts.map +1 -1
- package/dist/components/alert/alertContent/index.js +11 -31
- package/dist/components/alert/alertDescription/index.d.ts +10 -38
- package/dist/components/alert/alertDescription/index.d.ts.map +1 -1
- package/dist/components/alert/alertDescription/index.js +10 -33
- package/dist/components/alert/alertIcon/index.d.ts +14 -38
- package/dist/components/alert/alertIcon/index.d.ts.map +1 -1
- package/dist/components/alert/alertIcon/index.js +14 -32
- package/dist/components/alert/alertTitle/index.d.ts +12 -35
- package/dist/components/alert/alertTitle/index.d.ts.map +1 -1
- package/dist/components/alert/alertTitle/index.js +12 -27
- package/dist/components/audioPlayer/index.d.ts +24 -32
- package/dist/components/audioPlayer/index.d.ts.map +1 -1
- package/dist/components/audioPlayer/index.js +15 -18
- package/dist/components/audioUpload/index.d.ts +37 -48
- package/dist/components/audioUpload/index.d.ts.map +1 -1
- package/dist/components/audioUpload/index.js +23 -48
- package/dist/components/badge/index.d.ts +31 -22
- package/dist/components/badge/index.d.ts.map +1 -1
- package/dist/components/badge/index.js +14 -22
- package/dist/components/button/index.d.ts +38 -28
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/button/index.js +18 -28
- package/dist/components/cardTab/cardTabButton/index.d.ts +14 -52
- package/dist/components/cardTab/cardTabButton/index.d.ts.map +1 -1
- package/dist/components/cardTab/cardTabButton/index.js +12 -52
- package/dist/components/cardTab/cardTabContainer/index.d.ts +16 -58
- package/dist/components/cardTab/cardTabContainer/index.d.ts.map +1 -1
- package/dist/components/cardTab/cardTabContainer/index.js +12 -58
- package/dist/components/checkbox/index.d.ts +38 -37
- package/dist/components/checkbox/index.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +21 -37
- package/dist/components/clientOnly.d.ts +13 -66
- package/dist/components/clientOnly.d.ts.map +1 -1
- package/dist/components/clientOnly.js +11 -66
- package/dist/components/currencyInput/index.d.ts +67 -50
- package/dist/components/currencyInput/index.d.ts.map +1 -1
- package/dist/components/currencyInput/index.js +28 -50
- package/dist/components/divider/index.d.ts +12 -25
- package/dist/components/divider/index.d.ts.map +1 -1
- package/dist/components/divider/index.js +8 -25
- package/dist/components/drawer/drawerContainer/index.d.ts +16 -50
- package/dist/components/drawer/drawerContainer/index.d.ts.map +1 -1
- package/dist/components/drawer/drawerContainer/index.js +13 -50
- package/dist/components/drawer/drawerHeader/index.d.ts +9 -33
- package/dist/components/drawer/drawerHeader/index.d.ts.map +1 -1
- package/dist/components/drawer/drawerHeader/index.js +8 -33
- package/dist/components/facebookPixel/index.d.ts +47 -0
- package/dist/components/facebookPixel/index.d.ts.map +1 -1
- package/dist/components/facebookPixel/index.js +35 -0
- package/dist/components/fieldError/index.d.ts +4 -11
- package/dist/components/fieldError/index.d.ts.map +1 -1
- package/dist/components/fieldError/index.js +4 -11
- package/dist/components/fieldLabel/index.d.ts +6 -21
- package/dist/components/fieldLabel/index.d.ts.map +1 -1
- package/dist/components/fieldLabel/index.js +5 -21
- package/dist/components/fieldWrapper/index.d.ts +12 -22
- package/dist/components/fieldWrapper/index.d.ts.map +1 -1
- package/dist/components/fieldWrapper/index.js +7 -22
- package/dist/components/fileUpload/index.d.ts +36 -61
- package/dist/components/fileUpload/index.d.ts.map +1 -1
- package/dist/components/fileUpload/index.js +23 -61
- package/dist/components/googleAnalytics/index.d.ts +11 -7
- package/dist/components/googleAnalytics/index.d.ts.map +1 -1
- package/dist/components/googleAnalytics/index.js +9 -7
- package/dist/components/googleTagManager/index.d.ts +27 -21
- package/dist/components/googleTagManager/index.d.ts.map +1 -1
- package/dist/components/googleTagManager/index.js +20 -21
- package/dist/components/iconButton/index.d.ts +31 -15
- package/dist/components/iconButton/index.d.ts.map +1 -1
- package/dist/components/iconButton/index.js +12 -15
- package/dist/components/imageUpload/index.d.ts +47 -75
- package/dist/components/imageUpload/index.d.ts.map +1 -1
- package/dist/components/imageUpload/index.js +27 -75
- package/dist/components/input/index.d.ts +51 -44
- package/dist/components/input/index.d.ts.map +1 -1
- package/dist/components/input/index.js +24 -44
- package/dist/components/mapView/index.d.ts +44 -0
- package/dist/components/mapView/index.d.ts.map +1 -1
- package/dist/components/mapView/index.js +35 -0
- package/dist/components/maskedInput/index.d.ts +66 -51
- package/dist/components/maskedInput/index.d.ts.map +1 -1
- package/dist/components/maskedInput/index.js +28 -51
- package/dist/components/modal/modalContainer/index.d.ts +17 -57
- package/dist/components/modal/modalContainer/index.d.ts.map +1 -1
- package/dist/components/modal/modalContainer/index.js +15 -57
- package/dist/components/modal/modalFooter/index.d.ts +17 -50
- package/dist/components/modal/modalFooter/index.d.ts.map +1 -1
- package/dist/components/modal/modalFooter/index.js +10 -50
- package/dist/components/modal/modalHeader/index.d.ts +13 -47
- package/dist/components/modal/modalHeader/index.d.ts.map +1 -1
- package/dist/components/modal/modalHeader/index.js +12 -47
- package/dist/components/multiSelect/index.d.ts +67 -62
- package/dist/components/multiSelect/index.d.ts.map +1 -1
- package/dist/components/multiSelect/index.js +28 -62
- package/dist/components/pagination/index.d.ts +18 -9
- package/dist/components/pagination/index.d.ts.map +1 -1
- package/dist/components/pagination/index.js +18 -9
- package/dist/components/phoneInput/index.d.ts +65 -30
- package/dist/components/phoneInput/index.d.ts.map +1 -1
- package/dist/components/phoneInput/index.js +36 -31
- package/dist/components/popover/index.d.ts +34 -114
- package/dist/components/popover/index.d.ts.map +1 -1
- package/dist/components/popover/index.js +25 -114
- package/dist/components/radio/radioBox/index.d.ts +17 -65
- package/dist/components/radio/radioBox/index.d.ts.map +1 -1
- package/dist/components/radio/radioBox/index.js +14 -65
- package/dist/components/radio/radioGroup/index.d.ts +36 -67
- package/dist/components/radio/radioGroup/index.d.ts.map +1 -1
- package/dist/components/radio/radioGroup/index.js +25 -67
- package/dist/components/richText/index.d.ts +33 -47
- package/dist/components/richText/index.d.ts.map +1 -1
- package/dist/components/richText/index.js +30 -44
- package/dist/components/searchPlaces.d.ts +52 -50
- package/dist/components/searchPlaces.d.ts.map +1 -1
- package/dist/components/searchPlaces.js +23 -30
- package/dist/components/select/index.d.ts +68 -63
- package/dist/components/select/index.d.ts.map +1 -1
- package/dist/components/select/index.js +29 -63
- package/dist/components/slider/index.d.ts +20 -34
- package/dist/components/slider/index.d.ts.map +1 -1
- package/dist/components/slider/index.js +15 -33
- package/dist/components/switch/index.d.ts +42 -58
- package/dist/components/switch/index.d.ts.map +1 -1
- package/dist/components/switch/index.js +24 -58
- package/dist/components/tab/tabButton/index.d.ts +14 -52
- package/dist/components/tab/tabButton/index.d.ts.map +1 -1
- package/dist/components/tab/tabButton/index.js +12 -52
- package/dist/components/tab/tabContainer/index.d.ts +16 -58
- package/dist/components/tab/tabContainer/index.d.ts.map +1 -1
- package/dist/components/tab/tabContainer/index.js +12 -58
- package/dist/components/table/tableBody/index.d.ts +13 -47
- package/dist/components/table/tableBody/index.d.ts.map +1 -1
- package/dist/components/table/tableBody/index.js +12 -47
- package/dist/components/table/tableCaption/index.d.ts +6 -46
- package/dist/components/table/tableCaption/index.d.ts.map +1 -1
- package/dist/components/table/tableCaption/index.js +6 -46
- package/dist/components/table/tableContainer/index.d.ts +12 -41
- package/dist/components/table/tableContainer/index.d.ts.map +1 -1
- package/dist/components/table/tableContainer/index.js +12 -41
- package/dist/components/table/tableFooter/index.d.ts +5 -29
- package/dist/components/table/tableFooter/index.d.ts.map +1 -1
- package/dist/components/table/tableFooter/index.js +5 -29
- package/dist/components/table/tableHeader/index.d.ts +4 -25
- package/dist/components/table/tableHeader/index.d.ts.map +1 -1
- package/dist/components/table/tableHeader/index.js +4 -25
- package/dist/components/textarea/index.d.ts +32 -64
- package/dist/components/textarea/index.d.ts.map +1 -1
- package/dist/components/textarea/index.js +16 -64
- package/dist/components/tooltip/index.d.ts +27 -55
- package/dist/components/tooltip/index.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +16 -55
- package/dist/hooks/useAutomation.d.ts +18 -26
- package/dist/hooks/useAutomation.d.ts.map +1 -1
- package/dist/hooks/useAutomation.js +18 -26
- package/dist/hooks/useDrawer.d.ts +19 -64
- package/dist/hooks/useDrawer.d.ts.map +1 -1
- package/dist/hooks/useForm.d.ts +12 -29
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/hooks/useForm.js +12 -29
- package/dist/hooks/useHydrated.d.ts +8 -63
- package/dist/hooks/useHydrated.d.ts.map +1 -1
- package/dist/hooks/useHydrated.js +8 -63
- package/dist/hooks/useModal.d.ts +19 -59
- package/dist/hooks/useModal.d.ts.map +1 -1
- package/dist/hooks/useScopedParams.d.ts +17 -69
- package/dist/hooks/useScopedParams.d.ts.map +1 -1
- package/dist/hooks/useScopedParams.js +17 -69
- package/dist/hooks/useScrollLock.d.ts +11 -27
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +11 -33
- package/dist/hooks/useSearchAutomation.d.ts +16 -34
- package/dist/hooks/useSearchAutomation.d.ts.map +1 -1
- package/dist/hooks/useSearchAutomation.js +16 -34
- package/dist/hooks/useSlider.d.ts +5 -19
- package/dist/hooks/useSlider.d.ts.map +1 -1
- package/dist/hooks/useSlider.js +5 -19
- package/dist/hooks/useToast.d.ts +8 -52
- package/dist/hooks/useToast.d.ts.map +1 -1
- package/dist/hooks/useToast.js +8 -52
- package/dist/providers/drawerProvider.d.ts +15 -81
- package/dist/providers/drawerProvider.d.ts.map +1 -1
- package/dist/providers/drawerProvider.js +15 -81
- package/dist/providers/formProvider.d.ts +17 -53
- package/dist/providers/formProvider.d.ts.map +1 -1
- package/dist/providers/formProvider.js +17 -53
- package/dist/providers/modalProvider.d.ts +16 -77
- package/dist/providers/modalProvider.d.ts.map +1 -1
- package/dist/providers/modalProvider.js +16 -77
- package/dist/providers/placesProvider.d.ts +16 -11
- package/dist/providers/placesProvider.d.ts.map +1 -1
- package/dist/providers/placesProvider.js +16 -11
- package/dist/providers/toastProvider.d.ts +10 -21
- package/dist/providers/toastProvider.d.ts.map +1 -1
- package/dist/providers/toastProvider.js +10 -21
- package/dist/services/toHtml.d.ts +11 -10
- package/dist/services/toHtml.d.ts.map +1 -1
- package/dist/services/toHtml.js +11 -10
- package/dist/services/toRichTextValue.d.ts +11 -17
- package/dist/services/toRichTextValue.d.ts.map +1 -1
- package/dist/services/toRichTextValue.js +11 -17
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,cAAc,CAAC;AAEtB,KAAK,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IACtD,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/D,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,cAAc,CAAC;AAEtB,KAAK,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC3D,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IACtD;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/D,qDAAqD;IACrD,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuCjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -3,47 +3,37 @@ import { Loader2 } from "lucide-react";
|
|
|
3
3
|
import { IconRenderer } from "../../services/iconRenderer";
|
|
4
4
|
import "./styles.css";
|
|
5
5
|
/**
|
|
6
|
-
* Button
|
|
6
|
+
* Button — used for user interactions and form submissions.
|
|
7
7
|
*
|
|
8
|
-
* @param props -
|
|
9
|
-
* @param props.
|
|
10
|
-
* @param props.
|
|
11
|
-
* @param props.
|
|
12
|
-
* @param props.
|
|
13
|
-
* @param props.
|
|
14
|
-
* @param props.
|
|
15
|
-
* @param props.rightIcon - Optional icon to display on the right
|
|
8
|
+
* @param props.isLoading - Shows a spinner and disables the button. Default: false
|
|
9
|
+
* @param props.loadingText - Text displayed beside the spinner when loading.
|
|
10
|
+
* @param props.size - Button size (`xs` | `sm` | `md` | `lg`). Default: "md"
|
|
11
|
+
* @param props.variant - Visual style variant. Default: "solid"
|
|
12
|
+
* @param props.scheme - Color scheme. Default: "primary"
|
|
13
|
+
* @param props.leftIcon - Lucide icon rendered to the left of the label.
|
|
14
|
+
* @param props.rightIcon - Lucide icon rendered to the right of the label.
|
|
16
15
|
*
|
|
17
|
-
* **...Other valid HTML properties for button
|
|
16
|
+
* **...Other valid HTML properties for `<button>`**
|
|
18
17
|
*
|
|
19
|
-
* @returns Button JSX element
|
|
18
|
+
* @returns Button JSX element.
|
|
20
19
|
*
|
|
21
20
|
* @example
|
|
22
21
|
* ```tsx
|
|
23
22
|
* // Basic button
|
|
24
23
|
* <Button>Click me</Button>
|
|
25
24
|
*
|
|
26
|
-
* //
|
|
25
|
+
* // With color scheme
|
|
27
26
|
* <Button scheme="success">Save</Button>
|
|
28
27
|
*
|
|
29
|
-
* //
|
|
30
|
-
* <Button isLoading loadingText="Saving...">
|
|
31
|
-
* Save
|
|
32
|
-
* </Button>
|
|
28
|
+
* // With loading state
|
|
29
|
+
* <Button isLoading loadingText="Saving...">Save</Button>
|
|
33
30
|
*
|
|
34
|
-
* //
|
|
35
|
-
* <Button leftIcon={SaveIcon} scheme="success">
|
|
36
|
-
* Save
|
|
37
|
-
* </Button>
|
|
31
|
+
* // With icons
|
|
32
|
+
* <Button leftIcon={SaveIcon} scheme="success">Save</Button>
|
|
38
33
|
*
|
|
39
|
-
* // Custom
|
|
40
|
-
* <Button
|
|
41
|
-
*
|
|
42
|
-
* variant="outline"
|
|
43
|
-
* scheme="danger"
|
|
44
|
-
* rightIcon={TrashIcon}
|
|
45
|
-
* >
|
|
46
|
-
* Delete
|
|
34
|
+
* // Custom size, variant and scheme
|
|
35
|
+
* <Button size="lg" variant="outline" scheme="danger" rightIcon={TrashIcon}>
|
|
36
|
+
* Delete
|
|
47
37
|
* </Button>
|
|
48
38
|
* ```
|
|
49
39
|
*/
|
|
@@ -1,69 +1,31 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import "./styles.css";
|
|
3
3
|
type CardTabButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "value" | "type"> & {
|
|
4
|
+
/** Content displayed inside the tab button. */
|
|
4
5
|
children: ReactNode;
|
|
6
|
+
/** Unique identifier for this tab; matched against the container's active value. */
|
|
5
7
|
value: string;
|
|
6
8
|
};
|
|
7
9
|
/**
|
|
8
|
-
* CardTabButton
|
|
10
|
+
* CardTabButton — individual tab button inside a `CardTabContainer`.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param props.value - Unique identifier for the tab button (required)
|
|
13
|
-
* @param props.disabled - Whether the button is disabled. Can be overridden by CardTabContainer's disabled state
|
|
12
|
+
* Reads active state and disabled state from `CardTabContainer` context.
|
|
13
|
+
* The button's own `disabled` prop is ORed with the container's `disabled`.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* @param props.children - Tab label content. Required.
|
|
16
|
+
* @param props.value - Tab identifier. Required.
|
|
17
|
+
* @param props.disabled - Disables this tab individually (container can also disable all tabs).
|
|
16
18
|
*
|
|
17
|
-
*
|
|
19
|
+
* **...Other valid HTML `<button>` properties except `type`**
|
|
18
20
|
*
|
|
19
|
-
* @
|
|
20
|
-
* ```tsx
|
|
21
|
-
* // Basic tab buttons within CardTabContainer
|
|
22
|
-
* <CardTabContainer>
|
|
23
|
-
* <CardTabButton value="home">Home</CardTabButton>
|
|
24
|
-
* <CardTabButton value="about">About</CardTabButton>
|
|
25
|
-
* <CardTabButton value="contact">Contact</CardTabButton>
|
|
26
|
-
* </CardTabContainer>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* // Tab button with click handler
|
|
32
|
-
* <CardTabContainer onChange={(value) => console.log('Tab changed:', value)}>
|
|
33
|
-
* <CardTabButton
|
|
34
|
-
* value="profile"
|
|
35
|
-
* onClick={() => console.log('Profile tab clicked')}
|
|
36
|
-
* >
|
|
37
|
-
* Profile
|
|
38
|
-
* </CardTabButton>
|
|
39
|
-
* <CardTabButton value="settings">Settings</CardTabButton>
|
|
40
|
-
* </CardTabContainer>
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* // Disabled tab button
|
|
46
|
-
* <CardTabContainer>
|
|
47
|
-
* <CardTabButton value="available">Available</CardTabButton>
|
|
48
|
-
* <CardTabButton value="coming-soon" disabled>
|
|
49
|
-
* Coming Soon
|
|
50
|
-
* </CardTabButton>
|
|
51
|
-
* </CardTabContainer>
|
|
52
|
-
* ```
|
|
21
|
+
* @returns CardTabButton JSX element.
|
|
53
22
|
*
|
|
54
23
|
* @example
|
|
55
24
|
* ```tsx
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* <CardTabButton
|
|
59
|
-
*
|
|
60
|
-
* className="custom-tab"
|
|
61
|
-
* aria-label="Dashboard tab"
|
|
62
|
-
* >
|
|
63
|
-
* Dashboard
|
|
64
|
-
* </CardTabButton>
|
|
65
|
-
* <CardTabButton value="analytics">Analytics</CardTabButton>
|
|
66
|
-
* <CardTabButton value="reports">Reports</CardTabButton>
|
|
25
|
+
* <CardTabContainer defaultValue="details" onChange={setTab}>
|
|
26
|
+
* <CardTabButton value="details">Details</CardTabButton>
|
|
27
|
+
* <CardTabButton value="history">History</CardTabButton>
|
|
28
|
+
* <CardTabButton value="settings" disabled>Settings</CardTabButton>
|
|
67
29
|
* </CardTabContainer>
|
|
68
30
|
* ```
|
|
69
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/cardTab/cardTabButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG,IAAI,CAC5B,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,MAAM,CAC9B,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/cardTab/cardTabButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,cAAc,CAAC;AAEtB,KAAK,kBAAkB,GAAG,IAAI,CAC5B,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,MAAM,CAC9B,GAAG;IACF,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;IACpB,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAkC/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -2,65 +2,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCardTab } from "../cardTabContext";
|
|
3
3
|
import "./styles.css";
|
|
4
4
|
/**
|
|
5
|
-
* CardTabButton
|
|
5
|
+
* CardTabButton — individual tab button inside a `CardTabContainer`.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @param props.value - Unique identifier for the tab button (required)
|
|
10
|
-
* @param props.disabled - Whether the button is disabled. Can be overridden by CardTabContainer's disabled state
|
|
7
|
+
* Reads active state and disabled state from `CardTabContainer` context.
|
|
8
|
+
* The button's own `disabled` prop is ORed with the container's `disabled`.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
10
|
+
* @param props.children - Tab label content. Required.
|
|
11
|
+
* @param props.value - Tab identifier. Required.
|
|
12
|
+
* @param props.disabled - Disables this tab individually (container can also disable all tabs).
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* **...Other valid HTML `<button>` properties except `type`**
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
17
|
-
* ```tsx
|
|
18
|
-
* // Basic tab buttons within CardTabContainer
|
|
19
|
-
* <CardTabContainer>
|
|
20
|
-
* <CardTabButton value="home">Home</CardTabButton>
|
|
21
|
-
* <CardTabButton value="about">About</CardTabButton>
|
|
22
|
-
* <CardTabButton value="contact">Contact</CardTabButton>
|
|
23
|
-
* </CardTabContainer>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* // Tab button with click handler
|
|
29
|
-
* <CardTabContainer onChange={(value) => console.log('Tab changed:', value)}>
|
|
30
|
-
* <CardTabButton
|
|
31
|
-
* value="profile"
|
|
32
|
-
* onClick={() => console.log('Profile tab clicked')}
|
|
33
|
-
* >
|
|
34
|
-
* Profile
|
|
35
|
-
* </CardTabButton>
|
|
36
|
-
* <CardTabButton value="settings">Settings</CardTabButton>
|
|
37
|
-
* </CardTabContainer>
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* // Disabled tab button
|
|
43
|
-
* <CardTabContainer>
|
|
44
|
-
* <CardTabButton value="available">Available</CardTabButton>
|
|
45
|
-
* <CardTabButton value="coming-soon" disabled>
|
|
46
|
-
* Coming Soon
|
|
47
|
-
* </CardTabButton>
|
|
48
|
-
* </CardTabContainer>
|
|
49
|
-
* ```
|
|
16
|
+
* @returns CardTabButton JSX element.
|
|
50
17
|
*
|
|
51
18
|
* @example
|
|
52
19
|
* ```tsx
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* <CardTabButton
|
|
56
|
-
*
|
|
57
|
-
* className="custom-tab"
|
|
58
|
-
* aria-label="Dashboard tab"
|
|
59
|
-
* >
|
|
60
|
-
* Dashboard
|
|
61
|
-
* </CardTabButton>
|
|
62
|
-
* <CardTabButton value="analytics">Analytics</CardTabButton>
|
|
63
|
-
* <CardTabButton value="reports">Reports</CardTabButton>
|
|
20
|
+
* <CardTabContainer defaultValue="details" onChange={setTab}>
|
|
21
|
+
* <CardTabButton value="details">Details</CardTabButton>
|
|
22
|
+
* <CardTabButton value="history">History</CardTabButton>
|
|
23
|
+
* <CardTabButton value="settings" disabled>Settings</CardTabButton>
|
|
64
24
|
* </CardTabContainer>
|
|
65
25
|
* ```
|
|
66
26
|
*/
|
|
@@ -1,81 +1,39 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import "./styles.css";
|
|
3
3
|
type CardTabContainerProps = Omit<HTMLAttributes<HTMLElement>, "onClick" | "children" | "ref" | "onChange"> & {
|
|
4
|
+
/** `CardTabButton` components to render as tabs. Required. */
|
|
4
5
|
children: ReactNode;
|
|
6
|
+
/** Disables all tab buttons at once. @default false */
|
|
5
7
|
disabled?: boolean;
|
|
8
|
+
/** Initially selected tab value. */
|
|
6
9
|
defaultValue?: string;
|
|
10
|
+
/** Callback fired when the active tab changes, receiving the new value. */
|
|
7
11
|
onChange?: (index: string) => void;
|
|
8
12
|
};
|
|
9
13
|
/**
|
|
10
|
-
* CardTabContainer
|
|
14
|
+
* CardTabContainer — wrapper that manages active state for a group of `CardTabButton` components.
|
|
11
15
|
*
|
|
12
|
-
*
|
|
13
|
-
* @param props.children - CardTabButton components and other content (required)
|
|
14
|
-
* @param props.disabled - Whether all tab buttons are disabled. Default: false
|
|
15
|
-
* @param props.defaultValue - Initial tab value to be selected
|
|
16
|
-
* @param props.onChange - Callback function called when tab changes, receives the tab value
|
|
16
|
+
* Renders as a `<nav>` element. Provides context consumed by each `CardTabButton`.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* @param props.children - `CardTabButton` elements. Required.
|
|
19
|
+
* @param props.defaultValue - Initially selected tab value.
|
|
20
|
+
* @param props.disabled - Disables all buttons. Default: false
|
|
21
|
+
* @param props.onChange - Called with the new value whenever the active tab changes.
|
|
19
22
|
*
|
|
20
|
-
*
|
|
23
|
+
* **...Other valid HTML `<nav>` properties**
|
|
21
24
|
*
|
|
22
|
-
* @
|
|
23
|
-
* ```tsx
|
|
24
|
-
* // Basic tab container
|
|
25
|
-
* <CardTabContainer>
|
|
26
|
-
* <CardTabButton value="home">Home</CardTabButton>
|
|
27
|
-
* <CardTabButton value="about">About</CardTabButton>
|
|
28
|
-
* <CardTabButton value="contact">Contact</CardTabButton>
|
|
29
|
-
* </CardTabContainer>
|
|
30
|
-
* ```
|
|
25
|
+
* @returns CardTabContainer JSX element.
|
|
31
26
|
*
|
|
32
27
|
* @example
|
|
33
28
|
* ```tsx
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* defaultValue="dashboard"
|
|
37
|
-
* onChange={(value) => console.log('Active tab:', value)}
|
|
38
|
-
* >
|
|
39
|
-
* <CardTabButton value="dashboard">Dashboard</CardTabButton>
|
|
29
|
+
* <CardTabContainer defaultValue="overview" onChange={setActiveTab}>
|
|
30
|
+
* <CardTabButton value="overview">Overview</CardTabButton>
|
|
40
31
|
* <CardTabButton value="analytics">Analytics</CardTabButton>
|
|
41
32
|
* <CardTabButton value="settings">Settings</CardTabButton>
|
|
42
33
|
* </CardTabContainer>
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```tsx
|
|
47
|
-
* // Disabled all tabs
|
|
48
|
-
* <CardTabContainer disabled>
|
|
49
|
-
* <CardTabButton value="tab1">Tab 1</CardTabButton>
|
|
50
|
-
* <CardTabButton value="tab2">Tab 2</CardTabButton>
|
|
51
|
-
* </CardTabContainer>
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```tsx
|
|
56
|
-
* // Tab container with custom styling and state management
|
|
57
|
-
* function MyTabs() {
|
|
58
|
-
* const [activeTab, setActiveTab] = useState('profile');
|
|
59
|
-
*
|
|
60
|
-
* return (
|
|
61
|
-
* <div>
|
|
62
|
-
* <CardTabContainer
|
|
63
|
-
* defaultValue={activeTab}
|
|
64
|
-
* onChange={setActiveTab}
|
|
65
|
-
* className="custom-tabs"
|
|
66
|
-
* role="tablist"
|
|
67
|
-
* >
|
|
68
|
-
* <CardTabButton value="profile">Profile</CardTabButton>
|
|
69
|
-
* <CardTabButton value="account">Account</CardTabButton>
|
|
70
|
-
* <CardTabButton value="notifications">Notifications</CardTabButton>
|
|
71
|
-
* </CardTabContainer>
|
|
72
34
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* {activeTab === 'notifications' && <NotificationsContent />}
|
|
76
|
-
* </div>
|
|
77
|
-
* );
|
|
78
|
-
* }
|
|
35
|
+
* {activeTab === 'overview' && <OverviewPanel />}
|
|
36
|
+
* {activeTab === 'analytics' && <AnalyticsPanel />}
|
|
79
37
|
* ```
|
|
80
38
|
*/
|
|
81
39
|
declare function CardTabContainer(props: CardTabContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/cardTab/cardTabContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAG5D,OAAO,cAAc,CAAC;AAEtB,KAAK,qBAAqB,GAAG,IAAI,CAC/B,cAAc,CAAC,WAAW,CAAC,EAC3B,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,CAC5C,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/cardTab/cardTabContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAG5D,OAAO,cAAc,CAAC;AAEtB,KAAK,qBAAqB,GAAG,IAAI,CAC/B,cAAc,CAAC,WAAW,CAAC,EAC3B,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,CAC5C,GAAG;IACF,8DAA8D;IAC9D,QAAQ,EAAE,SAAS,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iBAAS,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CA8BrD;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -3,75 +3,29 @@ import { useState } from "react";
|
|
|
3
3
|
import { CardTabProvider } from "../cardTabContext";
|
|
4
4
|
import "./styles.css";
|
|
5
5
|
/**
|
|
6
|
-
* CardTabContainer
|
|
6
|
+
* CardTabContainer — wrapper that manages active state for a group of `CardTabButton` components.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* @param props.children - CardTabButton components and other content (required)
|
|
10
|
-
* @param props.disabled - Whether all tab buttons are disabled. Default: false
|
|
11
|
-
* @param props.defaultValue - Initial tab value to be selected
|
|
12
|
-
* @param props.onChange - Callback function called when tab changes, receives the tab value
|
|
8
|
+
* Renders as a `<nav>` element. Provides context consumed by each `CardTabButton`.
|
|
13
9
|
*
|
|
14
|
-
*
|
|
10
|
+
* @param props.children - `CardTabButton` elements. Required.
|
|
11
|
+
* @param props.defaultValue - Initially selected tab value.
|
|
12
|
+
* @param props.disabled - Disables all buttons. Default: false
|
|
13
|
+
* @param props.onChange - Called with the new value whenever the active tab changes.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
15
|
+
* **...Other valid HTML `<nav>` properties**
|
|
17
16
|
*
|
|
18
|
-
* @
|
|
19
|
-
* ```tsx
|
|
20
|
-
* // Basic tab container
|
|
21
|
-
* <CardTabContainer>
|
|
22
|
-
* <CardTabButton value="home">Home</CardTabButton>
|
|
23
|
-
* <CardTabButton value="about">About</CardTabButton>
|
|
24
|
-
* <CardTabButton value="contact">Contact</CardTabButton>
|
|
25
|
-
* </CardTabContainer>
|
|
26
|
-
* ```
|
|
17
|
+
* @returns CardTabContainer JSX element.
|
|
27
18
|
*
|
|
28
19
|
* @example
|
|
29
20
|
* ```tsx
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* defaultValue="dashboard"
|
|
33
|
-
* onChange={(value) => console.log('Active tab:', value)}
|
|
34
|
-
* >
|
|
35
|
-
* <CardTabButton value="dashboard">Dashboard</CardTabButton>
|
|
21
|
+
* <CardTabContainer defaultValue="overview" onChange={setActiveTab}>
|
|
22
|
+
* <CardTabButton value="overview">Overview</CardTabButton>
|
|
36
23
|
* <CardTabButton value="analytics">Analytics</CardTabButton>
|
|
37
24
|
* <CardTabButton value="settings">Settings</CardTabButton>
|
|
38
25
|
* </CardTabContainer>
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```tsx
|
|
43
|
-
* // Disabled all tabs
|
|
44
|
-
* <CardTabContainer disabled>
|
|
45
|
-
* <CardTabButton value="tab1">Tab 1</CardTabButton>
|
|
46
|
-
* <CardTabButton value="tab2">Tab 2</CardTabButton>
|
|
47
|
-
* </CardTabContainer>
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```tsx
|
|
52
|
-
* // Tab container with custom styling and state management
|
|
53
|
-
* function MyTabs() {
|
|
54
|
-
* const [activeTab, setActiveTab] = useState('profile');
|
|
55
|
-
*
|
|
56
|
-
* return (
|
|
57
|
-
* <div>
|
|
58
|
-
* <CardTabContainer
|
|
59
|
-
* defaultValue={activeTab}
|
|
60
|
-
* onChange={setActiveTab}
|
|
61
|
-
* className="custom-tabs"
|
|
62
|
-
* role="tablist"
|
|
63
|
-
* >
|
|
64
|
-
* <CardTabButton value="profile">Profile</CardTabButton>
|
|
65
|
-
* <CardTabButton value="account">Account</CardTabButton>
|
|
66
|
-
* <CardTabButton value="notifications">Notifications</CardTabButton>
|
|
67
|
-
* </CardTabContainer>
|
|
68
26
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* {activeTab === 'notifications' && <NotificationsContent />}
|
|
72
|
-
* </div>
|
|
73
|
-
* );
|
|
74
|
-
* }
|
|
27
|
+
* {activeTab === 'overview' && <OverviewPanel />}
|
|
28
|
+
* {activeTab === 'analytics' && <AnalyticsPanel />}
|
|
75
29
|
* ```
|
|
76
30
|
*/
|
|
77
31
|
function CardTabContainer(props) {
|
|
@@ -1,44 +1,63 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes } from "react";
|
|
2
2
|
import "./styles.css";
|
|
3
3
|
type CheckboxProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "size" | "prefix" | "type" | "name" | "defaultValue" | "value" | "onChange" | "onSelect" | "onClick"> & {
|
|
4
|
+
/** Optional label text displayed beside the checkbox. */
|
|
4
5
|
label?: string;
|
|
6
|
+
/** Displays an asterisk on the label to signal a required field. */
|
|
5
7
|
showAsterisk?: boolean;
|
|
8
|
+
/** When true, skips `FieldTemplate` wrapper (label and error text). @default false */
|
|
6
9
|
unShowFieldTemplate?: boolean;
|
|
10
|
+
/** Validation error message displayed below the checkbox. */
|
|
7
11
|
errorMessage?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Checkbox size.
|
|
14
|
+
* @default "md"
|
|
15
|
+
*/
|
|
8
16
|
size?: "md" | "lg" | "sm";
|
|
17
|
+
/** Field name for form submission. Required. */
|
|
9
18
|
name: string;
|
|
19
|
+
/** Value stored in the hidden input when checked. @default "checked" */
|
|
10
20
|
value?: string;
|
|
21
|
+
/** Controlled checked state. */
|
|
11
22
|
checked?: boolean;
|
|
23
|
+
/** Uncontrolled initial checked state. @default false */
|
|
12
24
|
defaultChecked?: boolean;
|
|
25
|
+
/** Callback fired on toggle — receives the value string (or `""` when unchecked). */
|
|
13
26
|
onCheck?: (value: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Layout direction forwarded to `FieldTemplate`.
|
|
29
|
+
* @default "horizontalReverse"
|
|
30
|
+
*/
|
|
14
31
|
orientation?: "horizontal" | "vertical" | "horizontalReverse";
|
|
15
32
|
};
|
|
16
33
|
/**
|
|
17
|
-
* Checkbox
|
|
34
|
+
* Checkbox — interactive checkbox input with label, validation, and form integration.
|
|
18
35
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @param props.label - Optional label text to display next to the checkbox
|
|
22
|
-
* @param props.errorMessage - Error state indicator to display validation errors
|
|
23
|
-
* @param props.size - Size variant of the checkbox. Default: "md"
|
|
24
|
-
* @param props.value - Optional value to be used when checkbox is checked. Default: "checked"
|
|
25
|
-
* @param props.checked - Controlled checked state of the checkbox
|
|
26
|
-
* @param props.defaultChecked - Default checked state for uncontrolled usage. Default: false
|
|
27
|
-
* @param props.onCheck - Callback function called when checkbox state changes, receives the value or empty string
|
|
28
|
-
* @param props.showAsterisk - Whether to show asterisk on label for required fields
|
|
29
|
-
* @param props.unShowFieldTemplate - When true, skips `FieldTemplate` structure (wrapper, label and error text) and renders only the checkbox button content.
|
|
30
|
-
* @param props.orientation - Layout direction forwarded to `FieldTemplate`/`FieldWrapper` (`horizontal`, `vertical`, `horizontalReverse`). Default: "horizontalReverse"
|
|
36
|
+
* Stores value in a hidden `<input>` for native form submission.
|
|
37
|
+
* Integrates with `useForm` to display validation errors by field name.
|
|
31
38
|
*
|
|
32
|
-
*
|
|
39
|
+
* @param props.name - Field name for form submission. Required.
|
|
40
|
+
* @param props.label - Label text displayed beside the checkbox.
|
|
41
|
+
* @param props.size - Checkbox size (`sm` | `md` | `lg`). Default: "md"
|
|
42
|
+
* @param props.value - Value stored when checked. Default: "checked"
|
|
43
|
+
* @param props.checked - Controlled checked state.
|
|
44
|
+
* @param props.defaultChecked - Uncontrolled initial checked state. Default: false
|
|
45
|
+
* @param props.onCheck - Callback fired on toggle — receives value or `""` when unchecked.
|
|
46
|
+
* @param props.errorMessage - Validation error message.
|
|
47
|
+
* @param props.showAsterisk - Appends `*` to the label.
|
|
48
|
+
* @param props.orientation - Layout direction (`horizontal` | `vertical` | `horizontalReverse`). Default: "horizontalReverse"
|
|
49
|
+
* @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false
|
|
33
50
|
*
|
|
34
|
-
*
|
|
51
|
+
* **...Other valid HTML properties for `<button>` (except `type`, `name`, `defaultValue`, `value`, `onChange`, `onSelect`, `onClick`)**
|
|
52
|
+
*
|
|
53
|
+
* @returns Checkbox JSX element wrapped in `FieldTemplate`.
|
|
35
54
|
*
|
|
36
55
|
* @example
|
|
37
56
|
* ```tsx
|
|
38
|
-
* // Basic
|
|
57
|
+
* // Basic
|
|
39
58
|
* <Checkbox name="terms" label="I agree to the terms and conditions" />
|
|
40
59
|
*
|
|
41
|
-
* //
|
|
60
|
+
* // With custom value and error
|
|
42
61
|
* <Checkbox
|
|
43
62
|
* name="newsletter"
|
|
44
63
|
* label="Subscribe to newsletter"
|
|
@@ -46,31 +65,13 @@ type CheckboxProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "size" | "pre
|
|
|
46
65
|
* errorMessage={errors.newsletter}
|
|
47
66
|
* />
|
|
48
67
|
*
|
|
49
|
-
* //
|
|
68
|
+
* // Controlled
|
|
50
69
|
* <Checkbox
|
|
51
70
|
* name="premium"
|
|
52
71
|
* label="Enable premium features"
|
|
53
72
|
* size="lg"
|
|
54
73
|
* checked={isPremium}
|
|
55
|
-
* onCheck={(
|
|
56
|
-
* />
|
|
57
|
-
*
|
|
58
|
-
* // Small checkbox with default checked state
|
|
59
|
-
* <Checkbox
|
|
60
|
-
* name="remember"
|
|
61
|
-
* label="Remember me"
|
|
62
|
-
* size="sm"
|
|
63
|
-
* defaultChecked={true}
|
|
64
|
-
* value="remember_user"
|
|
65
|
-
* />
|
|
66
|
-
*
|
|
67
|
-
* // Checkbox with custom styling and callback
|
|
68
|
-
* <Checkbox
|
|
69
|
-
* name="notifications"
|
|
70
|
-
* label="Enable notifications"
|
|
71
|
-
* className="custom-checkbox"
|
|
72
|
-
* onCheck={(value) => console.log('Notification setting:', value)}
|
|
73
|
-
* disabled={isLoading}
|
|
74
|
+
* onCheck={(v) => setIsPremium(!!v)}
|
|
74
75
|
* />
|
|
75
76
|
* ```
|
|
76
77
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAA2B,MAAM,OAAO,CAAC;AAKtE,OAAO,cAAc,CAAC;AAEtB,KAAK,aAAa,GAAG,IAAI,CACvB,oBAAoB,CAAC,iBAAiB,CAAC,EACrC,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,cAAc,GACd,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,CACZ,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAA2B,MAAM,OAAO,CAAC;AAKtE,OAAO,cAAc,CAAC;AAEtB,KAAK,aAAa,GAAG,IAAI,CACvB,oBAAoB,CAAC,iBAAiB,CAAC,EACrC,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,cAAc,GACd,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,CACZ,GAAG;IACF,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sFAAsF;IACtF,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qFAAqF;IACrF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,mBAAmB,CAAC;CAC/D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAsErC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -5,31 +5,33 @@ import { useForm } from "../../hooks/useForm";
|
|
|
5
5
|
import { FieldTemplate } from "../../services/fieldTemplate";
|
|
6
6
|
import "./styles.css";
|
|
7
7
|
/**
|
|
8
|
-
* Checkbox
|
|
8
|
+
* Checkbox — interactive checkbox input with label, validation, and form integration.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param props.label - Optional label text to display next to the checkbox
|
|
13
|
-
* @param props.errorMessage - Error state indicator to display validation errors
|
|
14
|
-
* @param props.size - Size variant of the checkbox. Default: "md"
|
|
15
|
-
* @param props.value - Optional value to be used when checkbox is checked. Default: "checked"
|
|
16
|
-
* @param props.checked - Controlled checked state of the checkbox
|
|
17
|
-
* @param props.defaultChecked - Default checked state for uncontrolled usage. Default: false
|
|
18
|
-
* @param props.onCheck - Callback function called when checkbox state changes, receives the value or empty string
|
|
19
|
-
* @param props.showAsterisk - Whether to show asterisk on label for required fields
|
|
20
|
-
* @param props.unShowFieldTemplate - When true, skips `FieldTemplate` structure (wrapper, label and error text) and renders only the checkbox button content.
|
|
21
|
-
* @param props.orientation - Layout direction forwarded to `FieldTemplate`/`FieldWrapper` (`horizontal`, `vertical`, `horizontalReverse`). Default: "horizontalReverse"
|
|
10
|
+
* Stores value in a hidden `<input>` for native form submission.
|
|
11
|
+
* Integrates with `useForm` to display validation errors by field name.
|
|
22
12
|
*
|
|
23
|
-
*
|
|
13
|
+
* @param props.name - Field name for form submission. Required.
|
|
14
|
+
* @param props.label - Label text displayed beside the checkbox.
|
|
15
|
+
* @param props.size - Checkbox size (`sm` | `md` | `lg`). Default: "md"
|
|
16
|
+
* @param props.value - Value stored when checked. Default: "checked"
|
|
17
|
+
* @param props.checked - Controlled checked state.
|
|
18
|
+
* @param props.defaultChecked - Uncontrolled initial checked state. Default: false
|
|
19
|
+
* @param props.onCheck - Callback fired on toggle — receives value or `""` when unchecked.
|
|
20
|
+
* @param props.errorMessage - Validation error message.
|
|
21
|
+
* @param props.showAsterisk - Appends `*` to the label.
|
|
22
|
+
* @param props.orientation - Layout direction (`horizontal` | `vertical` | `horizontalReverse`). Default: "horizontalReverse"
|
|
23
|
+
* @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* **...Other valid HTML properties for `<button>` (except `type`, `name`, `defaultValue`, `value`, `onChange`, `onSelect`, `onClick`)**
|
|
26
|
+
*
|
|
27
|
+
* @returns Checkbox JSX element wrapped in `FieldTemplate`.
|
|
26
28
|
*
|
|
27
29
|
* @example
|
|
28
30
|
* ```tsx
|
|
29
|
-
* // Basic
|
|
31
|
+
* // Basic
|
|
30
32
|
* <Checkbox name="terms" label="I agree to the terms and conditions" />
|
|
31
33
|
*
|
|
32
|
-
* //
|
|
34
|
+
* // With custom value and error
|
|
33
35
|
* <Checkbox
|
|
34
36
|
* name="newsletter"
|
|
35
37
|
* label="Subscribe to newsletter"
|
|
@@ -37,31 +39,13 @@ import "./styles.css";
|
|
|
37
39
|
* errorMessage={errors.newsletter}
|
|
38
40
|
* />
|
|
39
41
|
*
|
|
40
|
-
* //
|
|
42
|
+
* // Controlled
|
|
41
43
|
* <Checkbox
|
|
42
44
|
* name="premium"
|
|
43
45
|
* label="Enable premium features"
|
|
44
46
|
* size="lg"
|
|
45
47
|
* checked={isPremium}
|
|
46
|
-
* onCheck={(
|
|
47
|
-
* />
|
|
48
|
-
*
|
|
49
|
-
* // Small checkbox with default checked state
|
|
50
|
-
* <Checkbox
|
|
51
|
-
* name="remember"
|
|
52
|
-
* label="Remember me"
|
|
53
|
-
* size="sm"
|
|
54
|
-
* defaultChecked={true}
|
|
55
|
-
* value="remember_user"
|
|
56
|
-
* />
|
|
57
|
-
*
|
|
58
|
-
* // Checkbox with custom styling and callback
|
|
59
|
-
* <Checkbox
|
|
60
|
-
* name="notifications"
|
|
61
|
-
* label="Enable notifications"
|
|
62
|
-
* className="custom-checkbox"
|
|
63
|
-
* onCheck={(value) => console.log('Notification setting:', value)}
|
|
64
|
-
* disabled={isLoading}
|
|
48
|
+
* onCheck={(v) => setIsPremium(!!v)}
|
|
65
49
|
* />
|
|
66
50
|
* ```
|
|
67
51
|
*/
|