@jiwambe/components 0.2.0
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/LICENSE +21 -0
- package/README.md +367 -0
- package/dist/client.d.ts +40 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +46 -0
- package/dist/client.js.map +1 -0
- package/dist/components/Accordion/Accordion.d.ts +74 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +297 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Box/Box.d.ts +56 -0
- package/dist/components/Box/Box.d.ts.map +1 -0
- package/dist/components/Box/Box.js +51 -0
- package/dist/components/Box/Box.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +66 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +54 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +92 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Card/Card.d.ts +54 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +98 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +61 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js +205 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/dist/components/Container/Container.d.ts +72 -0
- package/dist/components/Container/Container.d.ts.map +1 -0
- package/dist/components/Container/Container.js +69 -0
- package/dist/components/Container/Container.js.map +1 -0
- package/dist/components/DateInput/DateInput.d.ts +61 -0
- package/dist/components/DateInput/DateInput.d.ts.map +1 -0
- package/dist/components/DateInput/DateInput.js +234 -0
- package/dist/components/DateInput/DateInput.js.map +1 -0
- package/dist/components/Divider/Divider.d.ts +44 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.js +35 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +35 -0
- package/dist/components/Drawer/Drawer.d.ts.map +1 -0
- package/dist/components/Drawer/Drawer.js +37 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/FAQ/FAQ.d.ts +40 -0
- package/dist/components/FAQ/FAQ.d.ts.map +1 -0
- package/dist/components/FAQ/FAQ.js +161 -0
- package/dist/components/FAQ/FAQ.js.map +1 -0
- package/dist/components/Grid/Grid.d.ts +61 -0
- package/dist/components/Grid/Grid.d.ts.map +1 -0
- package/dist/components/Grid/Grid.js +95 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +21 -0
- package/dist/components/Icon/Icon.d.ts.map +1 -0
- package/dist/components/Icon/Icon.js +167 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Link/Link.d.ts +49 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.js +70 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/List/List.d.ts +36 -0
- package/dist/components/List/List.d.ts.map +1 -0
- package/dist/components/List/List.js +42 -0
- package/dist/components/List/List.js.map +1 -0
- package/dist/components/List/index.d.ts +3 -0
- package/dist/components/List/index.d.ts.map +1 -0
- package/dist/components/Overlay/Overlay.d.ts +35 -0
- package/dist/components/Overlay/Overlay.d.ts.map +1 -0
- package/dist/components/Overlay/Overlay.js +51 -0
- package/dist/components/Overlay/Overlay.js.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +55 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.js +255 -0
- package/dist/components/PhoneInput/PhoneInput.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +46 -0
- package/dist/components/Popover/Popover.d.ts.map +1 -0
- package/dist/components/Popover/Popover.js +57 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/ProductImage/ProductImage.d.ts +78 -0
- package/dist/components/ProductImage/ProductImage.d.ts.map +1 -0
- package/dist/components/ProductImage/ProductImage.js +220 -0
- package/dist/components/ProductImage/ProductImage.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +63 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +233 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/Section/Section.d.ts +44 -0
- package/dist/components/Section/Section.d.ts.map +1 -0
- package/dist/components/Section/Section.js +48 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/Select/Select.d.ts +47 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/Select.js +153 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/SelectTab/SelectTab.d.ts +62 -0
- package/dist/components/SelectTab/SelectTab.d.ts.map +1 -0
- package/dist/components/SelectTab/SelectTab.js +192 -0
- package/dist/components/SelectTab/SelectTab.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +87 -0
- package/dist/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +97 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/Skeleton/index.d.ts.map +1 -0
- package/dist/components/Slider/Slider.d.ts +47 -0
- package/dist/components/Slider/Slider.d.ts.map +1 -0
- package/dist/components/Slider/Slider.js +147 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Stack/Stack.d.ts +145 -0
- package/dist/components/Stack/Stack.d.ts.map +1 -0
- package/dist/components/Stack/Stack.js +80 -0
- package/dist/components/Stack/Stack.js.map +1 -0
- package/dist/components/Tab/Tab.d.ts +38 -0
- package/dist/components/Tab/Tab.d.ts.map +1 -0
- package/dist/components/Tab/Tab.js +146 -0
- package/dist/components/Tab/Tab.js.map +1 -0
- package/dist/components/TextArea/TextArea.d.ts +32 -0
- package/dist/components/TextArea/TextArea.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.js +118 -0
- package/dist/components/TextArea/TextArea.js.map +1 -0
- package/dist/components/TextInput/TextInput.d.ts +35 -0
- package/dist/components/TextInput/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput/TextInput.js +128 -0
- package/dist/components/TextInput/TextInput.js.map +1 -0
- package/dist/components/Toggle/Toggle.d.ts +83 -0
- package/dist/components/Toggle/Toggle.d.ts.map +1 -0
- package/dist/components/Toggle/Toggle.js +121 -0
- package/dist/components/Toggle/Toggle.js.map +1 -0
- package/dist/components/Typography/Typography.d.ts +321 -0
- package/dist/components/Typography/Typography.d.ts.map +1 -0
- package/dist/components/Typography/Typography.js +21 -0
- package/dist/components/Typography/Typography.js.map +1 -0
- package/dist/components/UploadInput/UploadInput.d.ts +39 -0
- package/dist/components/UploadInput/UploadInput.d.ts.map +1 -0
- package/dist/components/UploadInput/UploadInput.js +297 -0
- package/dist/components/UploadInput/UploadInput.js.map +1 -0
- package/dist/components/index.d.ts +65 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/jiwambe-plugin.d.ts +37 -0
- package/dist/plugin/jiwambe-plugin.d.ts.map +1 -0
- package/dist/plugin/jiwambe-plugin.js +640 -0
- package/dist/plugin/jiwambe-plugin.js.map +1 -0
- package/dist/server.d.ts +22 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +23 -0
- package/dist/server.js.map +1 -0
- package/dist/types/index.d.ts +103 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/layout.d.ts +138 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/list.d.ts +69 -0
- package/dist/types/list.d.ts.map +1 -0
- package/dist/types/list.js +9 -0
- package/dist/types/list.js.map +1 -0
- package/dist/types/skeleton.d.ts +38 -0
- package/dist/types/skeleton.d.ts.map +1 -0
- package/dist/types/skeleton.js +13 -0
- package/dist/types/skeleton.js.map +1 -0
- package/dist/types/spacing.d.ts +105 -0
- package/dist/types/spacing.d.ts.map +1 -0
- package/dist/utils/layoutClasses.d.ts +44 -0
- package/dist/utils/layoutClasses.d.ts.map +1 -0
- package/dist/utils/layoutClasses.js +88 -0
- package/dist/utils/layoutClasses.js.map +1 -0
- package/dist/utils/responsive-props.d.ts +60 -0
- package/dist/utils/responsive-props.d.ts.map +1 -0
- package/dist/utils/responsive-props.js +184 -0
- package/dist/utils/responsive-props.js.map +1 -0
- package/dist/utils/spacing.d.ts +52 -0
- package/dist/utils/spacing.d.ts.map +1 -0
- package/dist/utils/spacing.js +625 -0
- package/dist/utils/spacing.js.map +1 -0
- package/package.json +96 -0
- package/tailwind.preset.d.ts +3 -0
- package/tailwind.preset.ts +21 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Size of the toggle buttons. Affects padding and typography (btn-small vs btn-reg).
|
|
4
|
+
*/
|
|
5
|
+
export type ToggleSize = 'small' | 'large';
|
|
6
|
+
/**
|
|
7
|
+
* Shape of one option in a Toggle or ToggleButton context. value and label; optional disabled.
|
|
8
|
+
*/
|
|
9
|
+
export interface ToggleOption {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Props for the Toggle component. Exactly two options; one is selected at a time (radio-like).
|
|
16
|
+
* Use for binary choices (e.g. Monthly/Yearly, Yes/No). For a single on/off switch use ToggleButton.
|
|
17
|
+
*/
|
|
18
|
+
export interface ToggleProps {
|
|
19
|
+
/** Exactly two options. Each: value, label, disabled?. */
|
|
20
|
+
options: [ToggleOption, ToggleOption];
|
|
21
|
+
/** Button size. @default 'small' */
|
|
22
|
+
size?: ToggleSize;
|
|
23
|
+
/** Controlled selected value (one of the two option values). @default undefined */
|
|
24
|
+
value?: string;
|
|
25
|
+
/** Uncontrolled default value. @default options[0].value */
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
/** Called when the selected option changes. @default undefined */
|
|
28
|
+
onChange?: (value: string) => void;
|
|
29
|
+
/** Disables both options. @default false */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Additional class name on the wrapper. @default undefined */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Forwarded ref for the root div. @default undefined */
|
|
34
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Paired two-option toggle (e.g. Monthly | Yearly). Renders two adjacent buttons; one is
|
|
38
|
+
* selected. Use for binary choice where both options are always visible. For a single
|
|
39
|
+
* on/off control use ToggleButton instead.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <Toggle options={[{ value: 'm', label: 'Monthly' }, { value: 'y', label: 'Yearly' }]} value={plan} onChange={setPlan} />
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <Toggle options={[{ value: 'a', label: 'A' }, { value: 'b', label: 'B', disabled: true }]} size="large" defaultValue="a" />
|
|
46
|
+
*/
|
|
47
|
+
export declare function Toggle({ options, size, value: valueProp, defaultValue, onChange, disabled, className, ref }: ToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
/**
|
|
49
|
+
* Props for the ToggleButton component. Single button that toggles between pressed and
|
|
50
|
+
* unpressed. Use for on/off settings (e.g. "Enable notifications"). For two-option
|
|
51
|
+
* choice (A | B) use Toggle instead.
|
|
52
|
+
*/
|
|
53
|
+
export interface ToggleButtonProps {
|
|
54
|
+
/** Button label (e.g. "Notifications"). */
|
|
55
|
+
label: string;
|
|
56
|
+
/** Button size. @default 'small' */
|
|
57
|
+
size?: ToggleSize;
|
|
58
|
+
/** Controlled pressed state. Use with onChange. @default undefined */
|
|
59
|
+
pressed?: boolean;
|
|
60
|
+
/** Uncontrolled default pressed state. @default false */
|
|
61
|
+
defaultPressed?: boolean;
|
|
62
|
+
/** Called when the user toggles; receives the new pressed state. @default undefined */
|
|
63
|
+
onChange?: (pressed: boolean) => void;
|
|
64
|
+
/** Disables the button. @default false */
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
/** Additional class name. @default undefined */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Forwarded ref for the button. @default undefined */
|
|
69
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Standalone on/off toggle button (role="switch"). Renders a single button that toggles
|
|
73
|
+
* between pressed and unpressed. Use for settings like "Enable X". For a choice between
|
|
74
|
+
* two options (e.g. Monthly/Yearly) use Toggle instead.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* <ToggleButton label="Notifications" pressed={on} onChange={setOn} />
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* <ToggleButton label="Dark mode" defaultPressed={false} size="large" />
|
|
81
|
+
*/
|
|
82
|
+
export declare function ToggleButton({ label, size, pressed: pressedProp, defaultPressed, onChange, disabled, className, ref }: ToggleButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
//# sourceMappingURL=Toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/Toggle/Toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACtC,oCAAoC;IACpC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AAsBD;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,EAAE,OAAO,EAAE,IAAc,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAgB,EAAE,SAAc,EAAE,GAAG,EAAE,EAAE,WAAW,2CA0D/I;AAMD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;CACpC;AAwBD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,IAAc,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAgB,EAAE,SAAc,EAAE,GAAG,EAAE,EAAE,iBAAiB,2CAyB/J"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useId, useCallback } from "react";
|
|
4
|
+
function pairedBtnClasses(size, active, disabled, position) {
|
|
5
|
+
const radius = position === "left" ? "rounded-l-rad-sm" : "rounded-r-rad-sm";
|
|
6
|
+
const sizeClasses = size === "small" ? "px-space-4 py-space-2 text-btn-small" : "px-space-5 py-space-3 text-btn-reg";
|
|
7
|
+
const base = `inline-flex items-center justify-center ${radius} transition-all duration-150 outline-none select-none ${sizeClasses}`;
|
|
8
|
+
if (disabled) {
|
|
9
|
+
if (active) {
|
|
10
|
+
return `${base} bg-fill-action-primary/50 text-text-action-primary/50 cursor-not-allowed`;
|
|
11
|
+
}
|
|
12
|
+
return `${base} bg-fill-bg-primary text-text-disabled border border-border-form-primary-disabled cursor-not-allowed`;
|
|
13
|
+
}
|
|
14
|
+
if (active) {
|
|
15
|
+
return `${base} bg-fill-action-primary text-text-action-primary focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1`;
|
|
16
|
+
}
|
|
17
|
+
return `${base} bg-fill-bg-primary text-text-primary border border-border-light hover:bg-fill-action-secondary-hover hover:border-border-heavy active:bg-fill-action-secondary-active active:border-border-heavy focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 cursor-pointer`;
|
|
18
|
+
}
|
|
19
|
+
function Toggle({ options, size = "small", value: valueProp, defaultValue, onChange, disabled = false, className = "", ref }) {
|
|
20
|
+
const isControlled = valueProp !== void 0;
|
|
21
|
+
const [internal, setInternal] = useState(defaultValue ?? options[0].value);
|
|
22
|
+
const selected = isControlled ? valueProp : internal;
|
|
23
|
+
const baseId = useId();
|
|
24
|
+
const handleSelect = useCallback(
|
|
25
|
+
(val) => {
|
|
26
|
+
if (!isControlled) setInternal(val);
|
|
27
|
+
onChange == null ? void 0 : onChange(val);
|
|
28
|
+
},
|
|
29
|
+
[isControlled, onChange]
|
|
30
|
+
);
|
|
31
|
+
const handleKeyDown = (e, idx) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
const nextIdx = idx === 0 ? 1 : 0;
|
|
36
|
+
const nextOpt = options[nextIdx];
|
|
37
|
+
if (!nextOpt.disabled && !disabled) {
|
|
38
|
+
handleSelect(nextOpt.value);
|
|
39
|
+
(_b = (_a = e.currentTarget.parentElement) == null ? void 0 : _a.children[nextIdx]) == null ? void 0 : _b.focus();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
ref,
|
|
47
|
+
role: "radiogroup",
|
|
48
|
+
"aria-label": "Toggle",
|
|
49
|
+
className: `inline-flex ${className}`,
|
|
50
|
+
children: options.map((opt, idx) => {
|
|
51
|
+
const isActive = selected === opt.value;
|
|
52
|
+
const isDisabled = disabled || !!opt.disabled;
|
|
53
|
+
const position = idx === 0 ? "left" : "right";
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
id: `${baseId}-toggle-${idx}`,
|
|
58
|
+
type: "button",
|
|
59
|
+
role: "radio",
|
|
60
|
+
"aria-checked": isActive,
|
|
61
|
+
"aria-disabled": isDisabled || void 0,
|
|
62
|
+
tabIndex: isActive ? 0 : -1,
|
|
63
|
+
disabled: isDisabled,
|
|
64
|
+
className: pairedBtnClasses(size, isActive, isDisabled, position),
|
|
65
|
+
onClick: () => handleSelect(opt.value),
|
|
66
|
+
onKeyDown: (e) => handleKeyDown(e, idx),
|
|
67
|
+
children: opt.label
|
|
68
|
+
},
|
|
69
|
+
opt.value
|
|
70
|
+
);
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function toggleBtnClasses(size, pressed, disabled) {
|
|
76
|
+
const sizeClasses = size === "small" ? "px-space-4 py-space-2 text-btn-small" : "px-space-5 py-space-3 text-btn-reg";
|
|
77
|
+
const base = `inline-flex items-center justify-center rounded-rad-sm transition-all duration-150 outline-none select-none ${sizeClasses}`;
|
|
78
|
+
if (disabled) {
|
|
79
|
+
return `${base} bg-fill-bg-primary text-text-disabled border border-transparent cursor-not-allowed`;
|
|
80
|
+
}
|
|
81
|
+
if (pressed) {
|
|
82
|
+
return `${base} bg-fill-action-primary text-text-action-primary border border-transparent focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 cursor-pointer`;
|
|
83
|
+
}
|
|
84
|
+
return [
|
|
85
|
+
base,
|
|
86
|
+
"bg-fill-bg-primary text-text-primary border border-border-light",
|
|
87
|
+
"hover:bg-fill-action-secondary-hover hover:border-border-heavy",
|
|
88
|
+
"active:bg-fill-action-secondary-active active:border-border-heavy",
|
|
89
|
+
"focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1",
|
|
90
|
+
"cursor-pointer"
|
|
91
|
+
].join(" ");
|
|
92
|
+
}
|
|
93
|
+
function ToggleButton({ label, size = "small", pressed: pressedProp, defaultPressed, onChange, disabled = false, className = "", ref }) {
|
|
94
|
+
const isControlled = pressedProp !== void 0;
|
|
95
|
+
const [internal, setInternal] = useState(defaultPressed ?? false);
|
|
96
|
+
const pressed = isControlled ? pressedProp : internal;
|
|
97
|
+
const handleClick = useCallback(() => {
|
|
98
|
+
const next = !pressed;
|
|
99
|
+
if (!isControlled) setInternal(next);
|
|
100
|
+
onChange == null ? void 0 : onChange(next);
|
|
101
|
+
}, [pressed, isControlled, onChange]);
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
"button",
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
type: "button",
|
|
107
|
+
role: "switch",
|
|
108
|
+
"aria-pressed": pressed,
|
|
109
|
+
"aria-disabled": disabled || void 0,
|
|
110
|
+
disabled,
|
|
111
|
+
className: `${toggleBtnClasses(size, pressed, disabled)} ${className}`,
|
|
112
|
+
onClick: handleClick,
|
|
113
|
+
children: label
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
Toggle,
|
|
119
|
+
ToggleButton
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=Toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.js","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState, useCallback, useId } from 'react';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * Size of the toggle buttons. Affects padding and typography (btn-small vs btn-reg).\n */\nexport type ToggleSize = 'small' | 'large';\n\n/**\n * Shape of one option in a Toggle or ToggleButton context. value and label; optional disabled.\n */\nexport interface ToggleOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Toggle — paired two-option toggle (left / right)\n// ---------------------------------------------------------------------------\n\n/**\n * Props for the Toggle component. Exactly two options; one is selected at a time (radio-like).\n * Use for binary choices (e.g. Monthly/Yearly, Yes/No). For a single on/off switch use ToggleButton.\n */\nexport interface ToggleProps {\n /** Exactly two options. Each: value, label, disabled?. */\n options: [ToggleOption, ToggleOption];\n /** Button size. @default 'small' */\n size?: ToggleSize;\n /** Controlled selected value (one of the two option values). @default undefined */\n value?: string;\n /** Uncontrolled default value. @default options[0].value */\n defaultValue?: string;\n /** Called when the selected option changes. @default undefined */\n onChange?: (value: string) => void;\n /** Disables both options. @default false */\n disabled?: boolean;\n /** Additional class name on the wrapper. @default undefined */\n className?: string;\n /** Forwarded ref for the root div. @default undefined */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction pairedBtnClasses(size: ToggleSize, active: boolean, disabled: boolean, position: 'left' | 'right') {\n const radius = position === 'left' ? 'rounded-l-rad-sm' : 'rounded-r-rad-sm';\n const sizeClasses = size === 'small' ? 'px-space-4 py-space-2 text-btn-small' : 'px-space-5 py-space-3 text-btn-reg';\n\n const base = `inline-flex items-center justify-center ${radius} transition-all duration-150 outline-none select-none ${sizeClasses}`;\n\n if (disabled) {\n if (active) {\n return `${base} bg-fill-action-primary/50 text-text-action-primary/50 cursor-not-allowed`;\n }\n return `${base} bg-fill-bg-primary text-text-disabled border border-border-form-primary-disabled cursor-not-allowed`;\n }\n\n if (active) {\n return `${base} bg-fill-action-primary text-text-action-primary focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1`;\n }\n\n return `${base} bg-fill-bg-primary text-text-primary border border-border-light hover:bg-fill-action-secondary-hover hover:border-border-heavy active:bg-fill-action-secondary-active active:border-border-heavy focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 cursor-pointer`;\n}\n\n/**\n * Paired two-option toggle (e.g. Monthly | Yearly). Renders two adjacent buttons; one is\n * selected. Use for binary choice where both options are always visible. For a single\n * on/off control use ToggleButton instead.\n *\n * @example\n * <Toggle options={[{ value: 'm', label: 'Monthly' }, { value: 'y', label: 'Yearly' }]} value={plan} onChange={setPlan} />\n *\n * @example\n * <Toggle options={[{ value: 'a', label: 'A' }, { value: 'b', label: 'B', disabled: true }]} size=\"large\" defaultValue=\"a\" />\n */\nexport function Toggle({ options, size = 'small', value: valueProp, defaultValue, onChange, disabled = false, className = '', ref }: ToggleProps) {\n const isControlled = valueProp !== undefined;\n const [internal, setInternal] = useState(defaultValue ?? options[0].value);\n const selected = isControlled ? valueProp : internal;\n const baseId = useId();\n\n const handleSelect = useCallback(\n (val: string) => {\n if (!isControlled) setInternal(val);\n onChange?.(val);\n },\n [isControlled, onChange],\n );\n\n const handleKeyDown = (e: React.KeyboardEvent, idx: number) => {\n if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {\n e.preventDefault();\n const nextIdx = idx === 0 ? 1 : 0;\n const nextOpt = options[nextIdx];\n if (!nextOpt.disabled && !disabled) {\n handleSelect(nextOpt.value);\n (e.currentTarget.parentElement?.children[nextIdx] as HTMLElement)?.focus();\n }\n }\n };\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n aria-label=\"Toggle\"\n className={`inline-flex ${className}`}\n >\n {options.map((opt, idx) => {\n const isActive = selected === opt.value;\n const isDisabled = disabled || !!opt.disabled;\n const position = idx === 0 ? 'left' : 'right';\n\n return (\n <button\n key={opt.value}\n id={`${baseId}-toggle-${idx}`}\n type=\"button\"\n role=\"radio\"\n aria-checked={isActive}\n aria-disabled={isDisabled || undefined}\n tabIndex={isActive ? 0 : -1}\n disabled={isDisabled}\n className={pairedBtnClasses(size, isActive, isDisabled, position as 'left' | 'right')}\n onClick={() => handleSelect(opt.value)}\n onKeyDown={(e) => handleKeyDown(e, idx)}\n >\n {opt.label}\n </button>\n );\n })}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// ToggleButton — standalone on/off toggle button\n// ---------------------------------------------------------------------------\n\n/**\n * Props for the ToggleButton component. Single button that toggles between pressed and\n * unpressed. Use for on/off settings (e.g. \"Enable notifications\"). For two-option\n * choice (A | B) use Toggle instead.\n */\nexport interface ToggleButtonProps {\n /** Button label (e.g. \"Notifications\"). */\n label: string;\n /** Button size. @default 'small' */\n size?: ToggleSize;\n /** Controlled pressed state. Use with onChange. @default undefined */\n pressed?: boolean;\n /** Uncontrolled default pressed state. @default false */\n defaultPressed?: boolean;\n /** Called when the user toggles; receives the new pressed state. @default undefined */\n onChange?: (pressed: boolean) => void;\n /** Disables the button. @default false */\n disabled?: boolean;\n /** Additional class name. @default undefined */\n className?: string;\n /** Forwarded ref for the button. @default undefined */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\nfunction toggleBtnClasses(size: ToggleSize, pressed: boolean, disabled: boolean) {\n const sizeClasses = size === 'small' ? 'px-space-4 py-space-2 text-btn-small' : 'px-space-5 py-space-3 text-btn-reg';\n const base = `inline-flex items-center justify-center rounded-rad-sm transition-all duration-150 outline-none select-none ${sizeClasses}`;\n\n if (disabled) {\n return `${base} bg-fill-bg-primary text-text-disabled border border-transparent cursor-not-allowed`;\n }\n\n if (pressed) {\n return `${base} bg-fill-action-primary text-text-action-primary border border-transparent focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1 cursor-pointer`;\n }\n\n return [\n base,\n 'bg-fill-bg-primary text-text-primary border border-border-light',\n 'hover:bg-fill-action-secondary-hover hover:border-border-heavy',\n 'active:bg-fill-action-secondary-active active:border-border-heavy',\n 'focus-visible:ring-2 focus-visible:ring-border-focus focus-visible:ring-offset-1',\n 'cursor-pointer',\n ].join(' ');\n}\n\n/**\n * Standalone on/off toggle button (role=\"switch\"). Renders a single button that toggles\n * between pressed and unpressed. Use for settings like \"Enable X\". For a choice between\n * two options (e.g. Monthly/Yearly) use Toggle instead.\n *\n * @example\n * <ToggleButton label=\"Notifications\" pressed={on} onChange={setOn} />\n *\n * @example\n * <ToggleButton label=\"Dark mode\" defaultPressed={false} size=\"large\" />\n */\nexport function ToggleButton({ label, size = 'small', pressed: pressedProp, defaultPressed, onChange, disabled = false, className = '', ref }: ToggleButtonProps) {\n const isControlled = pressedProp !== undefined;\n const [internal, setInternal] = useState(defaultPressed ?? false);\n const pressed = isControlled ? pressedProp : internal;\n\n const handleClick = useCallback(() => {\n const next = !pressed;\n if (!isControlled) setInternal(next);\n onChange?.(next);\n }, [pressed, isControlled, onChange]);\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n aria-pressed={pressed}\n aria-disabled={disabled || undefined}\n disabled={disabled}\n className={`${toggleBtnClasses(size, pressed, disabled)} ${className}`}\n onClick={handleClick}\n >\n {label}\n </button>\n );\n}\n"],"names":[],"mappings":";;;AAiDA;AACE;AACA;AAEA;AAEA;AACE;AACE;AAAc;AAEhB;AAAc;AAGhB;AACE;AAAc;AAGhB;AACF;AAaO;AACH;AACA;AACA;AACA;AAEA;AAAqB;AAEjB;AACA;AAAW;AACb;AACuB;AAGzB;;AACE;AACE;AACA;AACA;AACA;AACE;AACC;AAAkE;AACrE;AACF;AAGF;AACE;AAAC;AAAA;AACC;AACK;AACM;AACwB;AAGjC;AACA;AACA;AAEA;AACE;AAAC;AAAA;AAE4B;AACtB;AACA;AACS;AACe;AACJ;AACf;AAC0E;AAC/C;AACC;AAEjC;AAAA;AAZI;AAAA;AAed;AAAA;AAGT;AA8BA;AACE;AACA;AAEA;AACE;AAAc;AAGhB;AACE;AAAc;AAGhB;AAAO;AACL;AACA;AACA;AACA;AACA;AACA;AAEJ;AAaO;AACH;AACA;AACA;AAEA;AACE;AACA;AACA;AAAW;AAGb;AACE;AAAC;AAAA;AACC;AACK;AACA;AACS;AACa;AAC3B;AACoE;AAC3D;AAER;AAAA;AAGT;;;;;"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TypographyVariant, TypographyElement } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Typography component. Extends HTML attributes for the chosen element.
|
|
5
|
+
*/
|
|
6
|
+
export interface TypographyProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
|
+
/**
|
|
8
|
+
* Design-system typographic style. Maps to a .text-{variant} class generated
|
|
9
|
+
* by jiwambe-plugin (e.g. title-sm, text-sm, form-label). Choose the variant
|
|
10
|
+
* that matches the semantic role of the text (heading, body, label, etc.).
|
|
11
|
+
*/
|
|
12
|
+
variant: TypographyVariant;
|
|
13
|
+
/**
|
|
14
|
+
* The HTML element to render. Use for semantic correctness (e.g. as="h1" for
|
|
15
|
+
* page title, as="p" for body, as="label" for form labels).
|
|
16
|
+
* @default 'p'
|
|
17
|
+
*/
|
|
18
|
+
as?: TypographyElement;
|
|
19
|
+
/** Text or inline content to render inside the element. */
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
/** Forwarded ref for the root element. @default undefined */
|
|
22
|
+
ref?: React.Ref<HTMLElement>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Renders text with a design-system typographic style. Applies font family,
|
|
26
|
+
* size, weight, line-height, and optional letter-spacing from the Jiwambe
|
|
27
|
+
* theme. Use Typography instead of raw elements when you want consistent
|
|
28
|
+
* type scale and token-based styling.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Page heading
|
|
32
|
+
* <Typography variant="title-lg" as="h1">Hello World</Typography>
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Body and label
|
|
36
|
+
* <Typography variant="text-sm" as="p">Body copy here.</Typography>
|
|
37
|
+
* <Typography variant="form-label" as="label">Field name</Typography>
|
|
38
|
+
*/
|
|
39
|
+
export declare function Typography({ variant, as: Tag, children, className, style, ref, ...rest }: TypographyProps): React.DetailedReactHTMLElement<{
|
|
40
|
+
defaultChecked?: boolean | undefined;
|
|
41
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
42
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
43
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
44
|
+
accessKey?: string | undefined;
|
|
45
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
|
46
|
+
autoFocus?: boolean | undefined;
|
|
47
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
48
|
+
contextMenu?: string | undefined;
|
|
49
|
+
dir?: string | undefined;
|
|
50
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
51
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
52
|
+
hidden?: boolean | undefined;
|
|
53
|
+
id?: string | undefined;
|
|
54
|
+
lang?: string | undefined;
|
|
55
|
+
nonce?: string | undefined;
|
|
56
|
+
slot?: string | undefined;
|
|
57
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
58
|
+
tabIndex?: number | undefined;
|
|
59
|
+
title?: string | undefined;
|
|
60
|
+
translate?: "yes" | "no" | undefined;
|
|
61
|
+
radioGroup?: string | undefined;
|
|
62
|
+
role?: React.AriaRole | undefined;
|
|
63
|
+
about?: string | undefined;
|
|
64
|
+
content?: string | undefined;
|
|
65
|
+
datatype?: string | undefined;
|
|
66
|
+
inlist?: any;
|
|
67
|
+
prefix?: string | undefined;
|
|
68
|
+
property?: string | undefined;
|
|
69
|
+
rel?: string | undefined;
|
|
70
|
+
resource?: string | undefined;
|
|
71
|
+
rev?: string | undefined;
|
|
72
|
+
typeof?: string | undefined;
|
|
73
|
+
vocab?: string | undefined;
|
|
74
|
+
autoCorrect?: string | undefined;
|
|
75
|
+
autoSave?: string | undefined;
|
|
76
|
+
color?: string | undefined;
|
|
77
|
+
itemProp?: string | undefined;
|
|
78
|
+
itemScope?: boolean | undefined;
|
|
79
|
+
itemType?: string | undefined;
|
|
80
|
+
itemID?: string | undefined;
|
|
81
|
+
itemRef?: string | undefined;
|
|
82
|
+
results?: number | undefined;
|
|
83
|
+
security?: string | undefined;
|
|
84
|
+
unselectable?: "on" | "off" | undefined;
|
|
85
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
86
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
87
|
+
popoverTarget?: string | undefined;
|
|
88
|
+
inert?: boolean | undefined;
|
|
89
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
90
|
+
is?: string | undefined;
|
|
91
|
+
exportparts?: string | undefined;
|
|
92
|
+
part?: string | undefined;
|
|
93
|
+
"aria-activedescendant"?: string | undefined;
|
|
94
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
95
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
96
|
+
"aria-braillelabel"?: string | undefined;
|
|
97
|
+
"aria-brailleroledescription"?: string | undefined;
|
|
98
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
99
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
100
|
+
"aria-colcount"?: number | undefined;
|
|
101
|
+
"aria-colindex"?: number | undefined;
|
|
102
|
+
"aria-colindextext"?: string | undefined;
|
|
103
|
+
"aria-colspan"?: number | undefined;
|
|
104
|
+
"aria-controls"?: string | undefined;
|
|
105
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
106
|
+
"aria-describedby"?: string | undefined;
|
|
107
|
+
"aria-description"?: string | undefined;
|
|
108
|
+
"aria-details"?: string | undefined;
|
|
109
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
110
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
|
111
|
+
"aria-errormessage"?: string | undefined;
|
|
112
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
113
|
+
"aria-flowto"?: string | undefined;
|
|
114
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
115
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
116
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
117
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
118
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
119
|
+
"aria-label"?: string | undefined;
|
|
120
|
+
"aria-labelledby"?: string | undefined;
|
|
121
|
+
"aria-level"?: number | undefined;
|
|
122
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
123
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
124
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
125
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
126
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
127
|
+
"aria-owns"?: string | undefined;
|
|
128
|
+
"aria-placeholder"?: string | undefined;
|
|
129
|
+
"aria-posinset"?: number | undefined;
|
|
130
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
131
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
132
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
133
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
134
|
+
"aria-roledescription"?: string | undefined;
|
|
135
|
+
"aria-rowcount"?: number | undefined;
|
|
136
|
+
"aria-rowindex"?: number | undefined;
|
|
137
|
+
"aria-rowindextext"?: string | undefined;
|
|
138
|
+
"aria-rowspan"?: number | undefined;
|
|
139
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
140
|
+
"aria-setsize"?: number | undefined;
|
|
141
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
142
|
+
"aria-valuemax"?: number | undefined;
|
|
143
|
+
"aria-valuemin"?: number | undefined;
|
|
144
|
+
"aria-valuenow"?: number | undefined;
|
|
145
|
+
"aria-valuetext"?: string | undefined;
|
|
146
|
+
dangerouslySetInnerHTML?: {
|
|
147
|
+
__html: string | TrustedHTML;
|
|
148
|
+
} | undefined;
|
|
149
|
+
onCopy?: React.ClipboardEventHandler<HTMLElement> | undefined;
|
|
150
|
+
onCopyCapture?: React.ClipboardEventHandler<HTMLElement> | undefined;
|
|
151
|
+
onCut?: React.ClipboardEventHandler<HTMLElement> | undefined;
|
|
152
|
+
onCutCapture?: React.ClipboardEventHandler<HTMLElement> | undefined;
|
|
153
|
+
onPaste?: React.ClipboardEventHandler<HTMLElement> | undefined;
|
|
154
|
+
onPasteCapture?: React.ClipboardEventHandler<HTMLElement> | undefined;
|
|
155
|
+
onCompositionEnd?: React.CompositionEventHandler<HTMLElement> | undefined;
|
|
156
|
+
onCompositionEndCapture?: React.CompositionEventHandler<HTMLElement> | undefined;
|
|
157
|
+
onCompositionStart?: React.CompositionEventHandler<HTMLElement> | undefined;
|
|
158
|
+
onCompositionStartCapture?: React.CompositionEventHandler<HTMLElement> | undefined;
|
|
159
|
+
onCompositionUpdate?: React.CompositionEventHandler<HTMLElement> | undefined;
|
|
160
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLElement> | undefined;
|
|
161
|
+
onFocus?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
162
|
+
onFocusCapture?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
163
|
+
onBlur?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
164
|
+
onBlurCapture?: React.FocusEventHandler<HTMLElement> | undefined;
|
|
165
|
+
onChange?: React.ChangeEventHandler<HTMLElement, Element> | undefined;
|
|
166
|
+
onChangeCapture?: React.ChangeEventHandler<HTMLElement, Element> | undefined;
|
|
167
|
+
onBeforeInput?: React.InputEventHandler<HTMLElement> | undefined;
|
|
168
|
+
onBeforeInputCapture?: React.InputEventHandler<HTMLElement> | undefined;
|
|
169
|
+
onInput?: React.InputEventHandler<HTMLElement> | undefined;
|
|
170
|
+
onInputCapture?: React.InputEventHandler<HTMLElement> | undefined;
|
|
171
|
+
onReset?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
172
|
+
onResetCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
173
|
+
onSubmit?: React.SubmitEventHandler<HTMLElement> | undefined;
|
|
174
|
+
onSubmitCapture?: React.SubmitEventHandler<HTMLElement> | undefined;
|
|
175
|
+
onInvalid?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
176
|
+
onInvalidCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
177
|
+
onLoad?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
178
|
+
onLoadCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
179
|
+
onError?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
180
|
+
onErrorCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
181
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLElement> | undefined;
|
|
182
|
+
onKeyDownCapture?: React.KeyboardEventHandler<HTMLElement> | undefined;
|
|
183
|
+
onKeyPress?: React.KeyboardEventHandler<HTMLElement> | undefined;
|
|
184
|
+
onKeyPressCapture?: React.KeyboardEventHandler<HTMLElement> | undefined;
|
|
185
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLElement> | undefined;
|
|
186
|
+
onKeyUpCapture?: React.KeyboardEventHandler<HTMLElement> | undefined;
|
|
187
|
+
onAbort?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
188
|
+
onAbortCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
189
|
+
onCanPlay?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
190
|
+
onCanPlayCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
191
|
+
onCanPlayThrough?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
192
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
193
|
+
onDurationChange?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
194
|
+
onDurationChangeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
195
|
+
onEmptied?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
196
|
+
onEmptiedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
197
|
+
onEncrypted?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
198
|
+
onEncryptedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
199
|
+
onEnded?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
200
|
+
onEndedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
201
|
+
onLoadedData?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
202
|
+
onLoadedDataCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
203
|
+
onLoadedMetadata?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
204
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
205
|
+
onLoadStart?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
206
|
+
onLoadStartCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
207
|
+
onPause?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
208
|
+
onPauseCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
209
|
+
onPlay?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
210
|
+
onPlayCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
211
|
+
onPlaying?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
212
|
+
onPlayingCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
213
|
+
onProgress?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
214
|
+
onProgressCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
215
|
+
onRateChange?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
216
|
+
onRateChangeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
217
|
+
onSeeked?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
218
|
+
onSeekedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
219
|
+
onSeeking?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
220
|
+
onSeekingCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
221
|
+
onStalled?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
222
|
+
onStalledCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
223
|
+
onSuspend?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
224
|
+
onSuspendCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
225
|
+
onTimeUpdate?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
226
|
+
onTimeUpdateCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
227
|
+
onVolumeChange?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
228
|
+
onVolumeChangeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
229
|
+
onWaiting?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
230
|
+
onWaitingCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
231
|
+
onAuxClick?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
232
|
+
onAuxClickCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
233
|
+
onClick?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
234
|
+
onClickCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
235
|
+
onContextMenu?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
236
|
+
onContextMenuCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
237
|
+
onDoubleClick?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
238
|
+
onDoubleClickCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
239
|
+
onDrag?: React.DragEventHandler<HTMLElement> | undefined;
|
|
240
|
+
onDragCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
241
|
+
onDragEnd?: React.DragEventHandler<HTMLElement> | undefined;
|
|
242
|
+
onDragEndCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
243
|
+
onDragEnter?: React.DragEventHandler<HTMLElement> | undefined;
|
|
244
|
+
onDragEnterCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
245
|
+
onDragExit?: React.DragEventHandler<HTMLElement> | undefined;
|
|
246
|
+
onDragExitCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
247
|
+
onDragLeave?: React.DragEventHandler<HTMLElement> | undefined;
|
|
248
|
+
onDragLeaveCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
249
|
+
onDragOver?: React.DragEventHandler<HTMLElement> | undefined;
|
|
250
|
+
onDragOverCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
251
|
+
onDragStart?: React.DragEventHandler<HTMLElement> | undefined;
|
|
252
|
+
onDragStartCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
253
|
+
onDrop?: React.DragEventHandler<HTMLElement> | undefined;
|
|
254
|
+
onDropCapture?: React.DragEventHandler<HTMLElement> | undefined;
|
|
255
|
+
onMouseDown?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
256
|
+
onMouseDownCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
257
|
+
onMouseEnter?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
258
|
+
onMouseLeave?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
259
|
+
onMouseMove?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
260
|
+
onMouseMoveCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
261
|
+
onMouseOut?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
262
|
+
onMouseOutCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
263
|
+
onMouseOver?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
264
|
+
onMouseOverCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
265
|
+
onMouseUp?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
266
|
+
onMouseUpCapture?: React.MouseEventHandler<HTMLElement> | undefined;
|
|
267
|
+
onSelect?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
268
|
+
onSelectCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
|
269
|
+
onTouchCancel?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
270
|
+
onTouchCancelCapture?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
271
|
+
onTouchEnd?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
272
|
+
onTouchEndCapture?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
273
|
+
onTouchMove?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
274
|
+
onTouchMoveCapture?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
275
|
+
onTouchStart?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
276
|
+
onTouchStartCapture?: React.TouchEventHandler<HTMLElement> | undefined;
|
|
277
|
+
onPointerDown?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
278
|
+
onPointerDownCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
279
|
+
onPointerMove?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
280
|
+
onPointerMoveCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
281
|
+
onPointerUp?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
282
|
+
onPointerUpCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
283
|
+
onPointerCancel?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
284
|
+
onPointerCancelCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
285
|
+
onPointerEnter?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
286
|
+
onPointerLeave?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
287
|
+
onPointerOver?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
288
|
+
onPointerOverCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
289
|
+
onPointerOut?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
290
|
+
onPointerOutCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
291
|
+
onGotPointerCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
292
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
293
|
+
onLostPointerCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
294
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLElement> | undefined;
|
|
295
|
+
onScroll?: React.UIEventHandler<HTMLElement> | undefined;
|
|
296
|
+
onScrollCapture?: React.UIEventHandler<HTMLElement> | undefined;
|
|
297
|
+
onScrollEnd?: React.UIEventHandler<HTMLElement> | undefined;
|
|
298
|
+
onScrollEndCapture?: React.UIEventHandler<HTMLElement> | undefined;
|
|
299
|
+
onWheel?: React.WheelEventHandler<HTMLElement> | undefined;
|
|
300
|
+
onWheelCapture?: React.WheelEventHandler<HTMLElement> | undefined;
|
|
301
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLElement> | undefined;
|
|
302
|
+
onAnimationStartCapture?: React.AnimationEventHandler<HTMLElement> | undefined;
|
|
303
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLElement> | undefined;
|
|
304
|
+
onAnimationEndCapture?: React.AnimationEventHandler<HTMLElement> | undefined;
|
|
305
|
+
onAnimationIteration?: React.AnimationEventHandler<HTMLElement> | undefined;
|
|
306
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLElement> | undefined;
|
|
307
|
+
onToggle?: React.ToggleEventHandler<HTMLElement> | undefined;
|
|
308
|
+
onBeforeToggle?: React.ToggleEventHandler<HTMLElement> | undefined;
|
|
309
|
+
onTransitionCancel?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
310
|
+
onTransitionCancelCapture?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
311
|
+
onTransitionEnd?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
312
|
+
onTransitionEndCapture?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
313
|
+
onTransitionRun?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
314
|
+
onTransitionRunCapture?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
315
|
+
onTransitionStart?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
316
|
+
onTransitionStartCapture?: React.TransitionEventHandler<HTMLElement> | undefined;
|
|
317
|
+
ref: React.Ref<HTMLElement> | undefined;
|
|
318
|
+
className: string;
|
|
319
|
+
style: React.CSSProperties | undefined;
|
|
320
|
+
}, HTMLElement>;
|
|
321
|
+
//# sourceMappingURL=Typography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Typography.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/Typography.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACxE;;;;OAIG;IACH,OAAO,EAAE,iBAAiB,CAAC;IAC3B;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,6DAA6D;IAC7D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,EAAE,EAAE,GAAS,EACb,QAAQ,EACR,SAAc,EACd,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAQjB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
function Typography({
|
|
3
|
+
variant,
|
|
4
|
+
as: Tag = "p",
|
|
5
|
+
children,
|
|
6
|
+
className = "",
|
|
7
|
+
style,
|
|
8
|
+
ref,
|
|
9
|
+
...rest
|
|
10
|
+
}) {
|
|
11
|
+
const classes = [`text-${variant}`, className].filter(Boolean).join(" ");
|
|
12
|
+
return React.createElement(
|
|
13
|
+
Tag,
|
|
14
|
+
{ ref, className: classes, style, ...rest },
|
|
15
|
+
children
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
Typography
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=Typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Typography.js","sources":["../../../src/components/Typography/Typography.tsx"],"sourcesContent":["import React from 'react';\nimport type { TypographyVariant, TypographyElement } from '../../types';\n\n/**\n * Props for the Typography component. Extends HTML attributes for the chosen element.\n */\nexport interface TypographyProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * Design-system typographic style. Maps to a .text-{variant} class generated\n * by jiwambe-plugin (e.g. title-sm, text-sm, form-label). Choose the variant\n * that matches the semantic role of the text (heading, body, label, etc.).\n */\n variant: TypographyVariant;\n /**\n * The HTML element to render. Use for semantic correctness (e.g. as=\"h1\" for\n * page title, as=\"p\" for body, as=\"label\" for form labels).\n * @default 'p'\n */\n as?: TypographyElement;\n /** Text or inline content to render inside the element. */\n children: React.ReactNode;\n /** Forwarded ref for the root element. @default undefined */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * Renders text with a design-system typographic style. Applies font family,\n * size, weight, line-height, and optional letter-spacing from the Jiwambe\n * theme. Use Typography instead of raw elements when you want consistent\n * type scale and token-based styling.\n *\n * @example\n * // Page heading\n * <Typography variant=\"title-lg\" as=\"h1\">Hello World</Typography>\n *\n * @example\n * // Body and label\n * <Typography variant=\"text-sm\" as=\"p\">Body copy here.</Typography>\n * <Typography variant=\"form-label\" as=\"label\">Field name</Typography>\n */\nexport function Typography({\n variant,\n as: Tag = 'p',\n children,\n className = '',\n style,\n ref,\n ...rest\n}: TypographyProps) {\n const classes = [`text-${variant}`, className].filter(Boolean).join(' ');\n\n return React.createElement(\n Tag,\n { ref, className: classes, style, ...rest },\n children,\n );\n}\n"],"names":[],"mappings":";AAwCO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,IAAI,MAAM;AAAA,EACV;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,UAAU,CAAC,QAAQ,OAAO,IAAI,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEvE,SAAO,MAAM;AAAA,IACX;AAAA,IACA,EAAE,KAAK,WAAW,SAAS,OAAO,GAAG,KAAA;AAAA,IACrC;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the UploadInput component. Renders a file input (hidden) plus a visible
|
|
4
|
+
* upload button and a list of selected files with remove. Use accept to limit file types
|
|
5
|
+
* (e.g. "image/*", ".pdf"); use multiple for multi-file selection. No drag-and-drop;
|
|
6
|
+
* user clicks the button to open the file picker. onFilesChange is called after add or remove.
|
|
7
|
+
*/
|
|
8
|
+
export interface UploadInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> {
|
|
9
|
+
/** Label text displayed above the upload button. @default undefined */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Secondary label shown lighter beside the main label. @default undefined */
|
|
12
|
+
secondaryLabel?: string;
|
|
13
|
+
/** Supportive text rendered below the label. @default undefined */
|
|
14
|
+
supportText?: string;
|
|
15
|
+
/** Label on the upload button. @default 'Upload' */
|
|
16
|
+
uploadLabel?: string;
|
|
17
|
+
/** Called when the file list changes (user adds or removes a file). Receives the new File[]. @default undefined */
|
|
18
|
+
onFilesChange?: (files: File[]) => void;
|
|
19
|
+
/** Places the component in an error state. @default false */
|
|
20
|
+
error?: boolean;
|
|
21
|
+
/** Error message shown in the alert below when error is true. @default undefined */
|
|
22
|
+
errorMessage?: string;
|
|
23
|
+
/** Forwarded ref for the native file input. @default undefined */
|
|
24
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* File upload control: a visible upload button (opens the file picker) and a list of
|
|
28
|
+
* selected files with remove buttons. Pass accept (e.g. "image/*") to limit types;
|
|
29
|
+
* pass multiple to allow multiple selection. onFilesChange is called when files are
|
|
30
|
+
* added or removed. No drag-and-drop; use the button to select files.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <UploadInput label="Document" uploadLabel="Choose file" onFilesChange={setFiles} accept=".pdf" />
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* <UploadInput label="Images" multiple accept="image/*" error={!!err} errorMessage={err} />
|
|
37
|
+
*/
|
|
38
|
+
export declare function UploadInput({ label, secondaryLabel, supportText, uploadLabel, onFilesChange, error, errorMessage, disabled, className, id: idProp, multiple, accept, ref, ...rest }: UploadInputProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=UploadInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadInput.d.ts","sourceRoot":"","sources":["../../../src/components/UploadInput/UploadInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAQvD;;;;;GAKG;AACH,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IACxF,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mHAAmH;IACnH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACxC,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC;AA4KD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,cAAc,EACd,WAAW,EACX,WAAsB,EACtB,aAAa,EACb,KAAa,EACb,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,EAAE,EAAE,MAAM,EACV,QAAQ,EACR,MAAM,EACN,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,2CA4JlB"}
|