@cwellt_software/cwellt-reactjs-lib 1.4.14 → 1.5.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/dist/content/icons/new-cw-icons/NewCwIcons.json +1 -1
- package/dist/content/icons/new-cw-icons/css/new-cw-icons.css +260 -824
- package/dist/content/icons/new-cw-icons/fonts/NewCwIcons.woff +0 -0
- package/dist/index.cjs.js +564 -217
- package/dist/index.css +2 -2
- package/dist/index.d.ts +358 -66
- package/dist/index.es.js +558 -217
- package/dist/src/common/hooks/useRovingSingleSelect.d.ts +28 -0
- package/dist/src/common/hooks/useRovingSingleSelect.d.ts.map +1 -0
- package/dist/src/components/control/action/button/CwButton.d.ts +14 -4
- package/dist/src/components/control/action/button/CwButton.d.ts.map +1 -1
- package/dist/src/components/control/action/button/CwButtonSplit.d.ts +52 -0
- package/dist/src/components/control/action/button/CwButtonSplit.d.ts.map +1 -0
- package/dist/src/components/control/action/button/CwButtonSwitch.d.ts +65 -0
- package/dist/src/components/control/action/button/CwButtonSwitch.d.ts.map +1 -0
- package/dist/src/components/control/action/search/CwSearch.d.ts +2 -0
- package/dist/src/components/control/action/search/CwSearch.d.ts.map +1 -1
- package/dist/src/components/control/action/search/searchKeyboardNavigation.d.ts +35 -0
- package/dist/src/components/control/action/search/searchKeyboardNavigation.d.ts.map +1 -0
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts +6 -5
- package/dist/src/components/control/choice/checkbox/CwCheck.d.ts.map +1 -1
- package/dist/src/components/control/choice/checkbox/CwCheckboxGroup.d.ts +30 -7
- package/dist/src/components/control/choice/checkbox/CwCheckboxGroup.d.ts.map +1 -1
- package/dist/src/components/control/choice/checkbox/CwRadio.d.ts +10 -0
- package/dist/src/components/control/choice/checkbox/CwRadio.d.ts.map +1 -0
- package/dist/src/components/control/choice/checkbox/CwRadioGroup.d.ts +58 -0
- package/dist/src/components/control/choice/checkbox/CwRadioGroup.d.ts.map +1 -0
- package/dist/src/components/control/choice/nav-menu/CwNavMenu.d.ts +78 -0
- package/dist/src/components/control/choice/nav-menu/CwNavMenu.d.ts.map +1 -0
- package/dist/src/components/control/choice/nav-menu/filterNavItems.d.ts +9 -0
- package/dist/src/components/control/choice/nav-menu/filterNavItems.d.ts.map +1 -0
- package/dist/src/components/control/choice/nav-menu/sortNavItems.d.ts +9 -0
- package/dist/src/components/control/choice/nav-menu/sortNavItems.d.ts.map +1 -0
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts +6 -5
- package/dist/src/components/control/choice/toggle/CwToggle.d.ts.map +1 -1
- package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts +12 -0
- package/dist/src/components/control/input/file/CwFileUploadMultiple.d.ts.map +1 -1
- package/dist/src/components/control/input/image/CwInputImage.d.ts +17 -2
- package/dist/src/components/control/input/image/CwInputImage.d.ts.map +1 -1
- package/dist/src/components/display/graphics/icon/CwIcon.d.ts +1 -1
- package/dist/src/components/display/graphics/icon/CwIcon.d.ts.map +1 -1
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts +3 -14
- package/dist/src/components/display/graphics/loading/CwLoading.d.ts.map +1 -1
- package/dist/src/components/display/graphics/loading/loadingConfig.d.ts +16 -0
- package/dist/src/components/display/graphics/loading/loadingConfig.d.ts.map +1 -0
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/playground/PlaygroundApp.d.ts.map +1 -1
- package/dist/src/playground/PlaygroundSection.d.ts +13 -0
- package/dist/src/playground/PlaygroundSection.d.ts.map +1 -0
- package/dist/src/playground/pages/CwButtonPage.d.ts +3 -0
- package/dist/src/playground/pages/CwButtonPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwButtonSplitPage.d.ts +3 -0
- package/dist/src/playground/pages/CwButtonSplitPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwButtonSwitchPage.d.ts +3 -0
- package/dist/src/playground/pages/CwButtonSwitchPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwCheckboxGroupPage.d.ts +3 -0
- package/dist/src/playground/pages/CwCheckboxGroupPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwFileUploadMultiplePage.d.ts +3 -0
- package/dist/src/playground/pages/CwFileUploadMultiplePage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwInputImagePage.d.ts.map +1 -1
- package/dist/src/playground/pages/CwNavMenuPage.d.ts +3 -0
- package/dist/src/playground/pages/CwNavMenuPage.d.ts.map +1 -0
- package/dist/src/playground/pages/CwRadioGroupPage.d.ts +3 -0
- package/dist/src/playground/pages/CwRadioGroupPage.d.ts.map +1 -0
- package/dist/src/playground/pages/IconLibraryPage.d.ts +3 -0
- package/dist/src/playground/pages/IconLibraryPage.d.ts.map +1 -0
- package/dist/src/playground/pages/LoadingPage.d.ts +3 -0
- package/dist/src/playground/pages/LoadingPage.d.ts.map +1 -0
- package/dist/src/playground/pages/SelectorsPage.d.ts.map +1 -1
- package/dist/test/common/hooks/useRovingSingleSelect.test.d.ts +2 -0
- package/dist/test/common/hooks/useRovingSingleSelect.test.d.ts.map +1 -0
- package/dist/test/components/control/action/search/searchKeyboardNavigation.test.d.ts +2 -0
- package/dist/test/components/control/action/search/searchKeyboardNavigation.test.d.ts.map +1 -0
- package/dist/test/components/control/choice/nav-menu/filterNavItems.test.d.ts +2 -0
- package/dist/test/components/control/choice/nav-menu/filterNavItems.test.d.ts.map +1 -0
- package/dist/test/components/control/choice/nav-menu/sortNavItems.test.d.ts +2 -0
- package/dist/test/components/control/choice/nav-menu/sortNavItems.test.d.ts.map +1 -0
- package/dist/test/components/control/input/file/fileMatchesAccept.test.d.ts +2 -0
- package/dist/test/components/control/input/file/fileMatchesAccept.test.d.ts.map +1 -0
- package/dist/test/components/control/input/image/readImageFileAsDataUrl.test.d.ts +2 -0
- package/dist/test/components/control/input/image/readImageFileAsDataUrl.test.d.ts.map +1 -0
- package/dist/test/components/display/graphics/loading/CwLoading.test.d.ts +2 -0
- package/dist/test/components/display/graphics/loading/CwLoading.test.d.ts.map +1 -0
- package/package.json +1 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface RovingOption {
|
|
3
|
+
value: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface RovingSegmentProps {
|
|
7
|
+
/** Roving tabindex: 0 for the active segment, -1 for the rest (one tab stop). */
|
|
8
|
+
tabIndex: number;
|
|
9
|
+
/** Element ref used for programmatic focus during arrow-key navigation. */
|
|
10
|
+
ref: (element: HTMLElement | null) => void;
|
|
11
|
+
/** Arrow-key handler: move + select, wrapping and skipping disabled options. */
|
|
12
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Roving-tabindex single-select behaviour for a custom radio group (e.g. a segmented
|
|
16
|
+
* button strip that has no native grouping). The active segment is the selected one,
|
|
17
|
+
* or the first enabled option when nothing is selected. Arrow keys (Right/Down = next,
|
|
18
|
+
* Left/Up = previous) move focus and select, wrapping around and skipping disabled
|
|
19
|
+
* options; Space/Enter selects the focused segment.
|
|
20
|
+
*
|
|
21
|
+
* Native form controls (e.g. `<input type="radio">` sharing a name) already get this
|
|
22
|
+
* behaviour from the browser — use this hook only for non-native custom groups.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useRovingSingleSelect<TOption extends RovingOption>(options: TOption[], value: string, onChange: (value: string) => void): {
|
|
25
|
+
activeIndex: number;
|
|
26
|
+
getSegmentProps: (index: number) => RovingSegmentProps;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=useRovingSingleSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRovingSingleSelect.d.ts","sourceRoot":"","sources":["../../../../src/common/hooks/useRovingSingleSelect.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IAClC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,GAAG,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3C,gFAAgF;IAChF,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,YAAY,EACjE,OAAO,EAAE,OAAO,EAAE,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAC/B;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,kBAAkB,CAAA;CAAE,CAkEjF"}
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* CwButton - Customizable button component with variant styles, color themes, and icon support
|
|
3
3
|
*
|
|
4
4
|
* @param text - Button text content (displayed in <strong> tag when no children)
|
|
5
|
-
* @param variant - Button style: 'solid' (default), 'outline', or '
|
|
5
|
+
* @param variant - Button style: 'solid' (default), 'outline', 'icon', or 'ghost' (low-emphasis text button: transparent, fills with the container color on hover/press)
|
|
6
6
|
* @param color - Color theme: 'primary' (default), 'danger', or 'neutral'
|
|
7
|
+
* @param size - Button size: 'small', 'medium' (default), or 'large'
|
|
7
8
|
* @param icon - Icon identifier for CSS classes (cwi-{icon})
|
|
9
|
+
* @param iconPosition - Icon placement relative to the text: 'left' (default, icon-then-text) or 'right' (text-then-icon). Only affects the auto icon+text rendering, not the icon variant or custom children.
|
|
10
|
+
* @param pressed - Toggle/"on" state for a toggle button. When defined, sets `aria-pressed` and a selected fill; leave undefined for a normal (non-toggle) button. The consumer owns the state (`pressed` + `onClick`).
|
|
8
11
|
* @param className - Additional CSS classes
|
|
9
12
|
* @param title - Built-in tooltip
|
|
10
13
|
* @param tooltipPosition - Tooltip position: 'top', 'bottom' (default), 'left', 'right'
|
|
@@ -12,18 +15,25 @@
|
|
|
12
15
|
*
|
|
13
16
|
* @example
|
|
14
17
|
* <CwButton text="Save" />
|
|
18
|
+
* <CwButton text="Save" size="small" />
|
|
15
19
|
* <CwButton text="Delete" variant="outline" color="danger" />
|
|
16
20
|
* <CwButton variant="icon" icon="edit" title="Edit item" />
|
|
17
21
|
* <CwButton icon="star" text="Favorite" color="primary" />
|
|
22
|
+
* <CwButton text="Next" icon="chevron-right" iconPosition="right" />
|
|
23
|
+
* <CwButton text="Export" icon="download" variant="ghost" />
|
|
24
|
+
* <CwButton variant="icon" icon="pin" pressed={isPinned} onClick={togglePinned} title="Pin" />
|
|
18
25
|
* <CwButton className="custom-class">Custom content</CwButton>
|
|
19
26
|
*/
|
|
27
|
+
import React from "react";
|
|
20
28
|
export interface CwButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
21
29
|
text?: string;
|
|
22
|
-
variant?: 'solid' | 'outline' | 'icon';
|
|
30
|
+
variant?: 'solid' | 'outline' | 'icon' | 'ghost';
|
|
23
31
|
color?: 'primary' | 'danger' | 'neutral';
|
|
32
|
+
size?: 'small' | 'medium' | 'large';
|
|
33
|
+
iconPosition?: 'left' | 'right';
|
|
34
|
+
pressed?: boolean;
|
|
24
35
|
icon?: string;
|
|
25
36
|
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';
|
|
26
|
-
ref?: React.LegacyRef<HTMLButtonElement>;
|
|
27
37
|
}
|
|
28
|
-
export declare
|
|
38
|
+
export declare const CwButton: React.ForwardRefExoticComponent<CwButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
29
39
|
//# sourceMappingURL=CwButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CwButton.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/action/button/CwButton.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CwButton.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/action/button/CwButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACjD,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;CACtD;AAED,eAAO,MAAM,QAAQ,yFAoEnB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface CwButtonSplitAction {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** cwi icon name (verified against NewCwIcons.json) */
|
|
6
|
+
icon?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CwButtonSplitProps {
|
|
10
|
+
/** Main action label */
|
|
11
|
+
text: string;
|
|
12
|
+
/** Optional main-action icon */
|
|
13
|
+
icon?: string;
|
|
14
|
+
/** Default/main action */
|
|
15
|
+
onClick: () => void;
|
|
16
|
+
/** Alternative actions shown in the dropdown menu */
|
|
17
|
+
actions: CwButtonSplitAction[];
|
|
18
|
+
/** Fired when a menu item is chosen */
|
|
19
|
+
onSelect: (key: string) => void;
|
|
20
|
+
/** Shared visual style for both parts. @default 'solid' */
|
|
21
|
+
variant?: "solid" | "outline";
|
|
22
|
+
/** Shared color theme for both parts. @default 'primary' */
|
|
23
|
+
color?: "primary" | "danger" | "neutral";
|
|
24
|
+
/** Shared size for both parts. @default 'medium' */
|
|
25
|
+
size?: "small" | "medium" | "large";
|
|
26
|
+
/** Disables both parts */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Menu alignment relative to the control. @default 'bottom-end' */
|
|
29
|
+
placement?: "bottom-start" | "bottom-end";
|
|
30
|
+
"data-testid"?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* CwButtonSplit - A primary action joined to a dropdown of alternative actions.
|
|
34
|
+
*
|
|
35
|
+
* Composes a main {@link CwButton} with a {@link CwPopoverButton} chevron whose
|
|
36
|
+
* panel holds a vertical menu of alternatives (rendered as `variant="ghost"` rows).
|
|
37
|
+
* Both parts share variant, color and size and read as one joined control.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <CwButtonSplit
|
|
41
|
+
* text="Save"
|
|
42
|
+
* icon="save"
|
|
43
|
+
* onClick={handleSave}
|
|
44
|
+
* actions={[
|
|
45
|
+
* { key: "saveAs", label: "Save as…", icon: "copy" },
|
|
46
|
+
* { key: "saveAndClose", label: "Save and close" },
|
|
47
|
+
* ]}
|
|
48
|
+
* onSelect={handleSelect}
|
|
49
|
+
* />
|
|
50
|
+
*/
|
|
51
|
+
export declare function CwButtonSplit({ text, icon, onClick, actions, onSelect, variant, color, size, disabled, placement, "data-testid": dataTestId, }: CwButtonSplitProps): React.JSX.Element;
|
|
52
|
+
//# sourceMappingURL=CwButtonSplit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwButtonSplit.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/action/button/CwButtonSplit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK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ayed on the segment */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Optional cwi icon name */
|
|
7
|
+
icon?: string;
|
|
8
|
+
/** Disables this specific segment */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface CwButtonSwitchProps {
|
|
12
|
+
/** Options rendered as joined segments */
|
|
13
|
+
options: CwButtonSwitchOption[];
|
|
14
|
+
/** Currently selected value */
|
|
15
|
+
value: string;
|
|
16
|
+
/** Callback when the selection changes */
|
|
17
|
+
onChange: (value: string) => void;
|
|
18
|
+
/** Segment size */
|
|
19
|
+
size?: "small" | "medium" | "large";
|
|
20
|
+
/** Shared color theme for every segment */
|
|
21
|
+
color?: "primary" | "danger" | "neutral";
|
|
22
|
+
/** Render only each option's icon (label becomes the tooltip + accessible name). Every option must have an `icon`. */
|
|
23
|
+
iconOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Orientation of the joined strip: "row" (default, horizontal) or "column" (vertical,
|
|
26
|
+
* stacked full-width segments). Only orientation is exposed because the segments are joined
|
|
27
|
+
* (no gap), so gap/align/justify are not meaningful.
|
|
28
|
+
*/
|
|
29
|
+
direction?: "row" | "column";
|
|
30
|
+
/** Disables every segment */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Accessible name for the radiogroup (there is no visible label on this inline control). */
|
|
33
|
+
"aria-label"?: string;
|
|
34
|
+
/** Accessible name for the radiogroup (there is no visible label on this inline control). */
|
|
35
|
+
"aria-labelledby"?: string;
|
|
36
|
+
"data-testid"?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* CwButtonSwitch - Segmented single-select control: a strip of joined CwButtons.
|
|
40
|
+
*
|
|
41
|
+
* The selected segment renders `solid`, the others `outline`, both sharing the `color`
|
|
42
|
+
* theme (`primary` default, `danger`, or `neutral`). It is a proper ARIA radiogroup with
|
|
43
|
+
* roving tabindex (one tab stop) and arrow-key navigation, provided by
|
|
44
|
+
* {@link useRovingSingleSelect}. Use for 2–3 mutually-exclusive options that benefit from
|
|
45
|
+
* being shown side by side; for a longer list use CwRadioGroup.
|
|
46
|
+
*
|
|
47
|
+
* `direction="column"` renders the strip vertically (stacked, full-width segments) instead of
|
|
48
|
+
* the default horizontal `row`; arrow-key navigation handles both orientations.
|
|
49
|
+
*
|
|
50
|
+
* Set `iconOnly` to render just each option's icon; the option's `label` is still required
|
|
51
|
+
* and is passed as the segment title, so it becomes the tooltip and the accessible name.
|
|
52
|
+
*
|
|
53
|
+
* It is an inline control with no form label — if a caption is needed, place it next to the
|
|
54
|
+
* control at the call site, and pass `aria-label` (or `aria-labelledby`) to name the radiogroup
|
|
55
|
+
* for screen readers.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* <CwButtonSwitch
|
|
59
|
+
* options={[{ value: "list", label: "List", icon: "list" }, { value: "grid", label: "Grid", icon: "grid" }]}
|
|
60
|
+
* value={view}
|
|
61
|
+
* onChange={setView}
|
|
62
|
+
* />
|
|
63
|
+
*/
|
|
64
|
+
export declare function CwButtonSwitch({ options, value, onChange, size, color, iconOnly, direction, disabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "data-testid": dataTestId, }: CwButtonSwitchProps): import("react").JSX.Element;
|
|
65
|
+
//# sourceMappingURL=CwButtonSwitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwButtonSwitch.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/action/button/CwButtonSwitch.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,oBAAoB;IACpC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IACnC,0CAA0C;IAC1C,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,mBAAmB;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,sHAAsH;IACtH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6FAA6F;IAC7F,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,EAC9B,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAe,EACf,KAAiB,EACjB,QAAgB,EAChB,SAAiB,EACjB,QAAgB,EAChB,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,aAAa,EAAE,UAAU,GACzB,EAAE,mBAAmB,+BAqCrB"}
|
|
@@ -25,6 +25,8 @@ export interface CwSearchInputProps extends HTMLProps<HTMLDivElement> {
|
|
|
25
25
|
error?: boolean;
|
|
26
26
|
/** Custom renderer for each suggestion item. Receives the matching `CwSelectList` entry. */
|
|
27
27
|
renderOption?: (option: CwSelectList) => React.ReactNode;
|
|
28
|
+
/** Focuses the internal `<input>` on mount when `true`. */
|
|
29
|
+
autoFocus?: boolean;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* Text input with a live-filtered suggestion dropdown backed by a local `CwSelectList` array.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CwSearch.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/action/search/CwSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CwSearch.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/action/search/CwSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAIvE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAW,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAW,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAGpF,uCAAuC;AACvC,MAAM,WAAW,kBAAmB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACpE,oFAAoF;IACpF,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,iDAAiD;IACjD,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,oDAAoD;IACpD,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,uDAAuD;IACvD,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACpC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC;IACzD,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,qBAuNtF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure keyboard-navigation resolver shared by the `CwSearchInput` combobox.
|
|
3
|
+
* Kept side-effect-free so the arrow/home/end/enter/escape behaviour can be unit
|
|
4
|
+
* tested without a DOM (the library's vitest runs with `environment: "node"`).
|
|
5
|
+
*/
|
|
6
|
+
/** Action the combobox should perform in response to a key press. */
|
|
7
|
+
export type SearchKeyAction =
|
|
8
|
+
/** Move the highlight to `index` (arrow / home / end). */
|
|
9
|
+
{
|
|
10
|
+
type: "move";
|
|
11
|
+
index: number;
|
|
12
|
+
}
|
|
13
|
+
/** Commit the option at `index` (Enter on a highlighted row). */
|
|
14
|
+
| {
|
|
15
|
+
type: "select";
|
|
16
|
+
index: number;
|
|
17
|
+
}
|
|
18
|
+
/** Close the dropdown and reset the highlight (Escape). */
|
|
19
|
+
| {
|
|
20
|
+
type: "close";
|
|
21
|
+
}
|
|
22
|
+
/** Key is not handled — let it propagate untouched. */
|
|
23
|
+
| {
|
|
24
|
+
type: "none";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Resolves a key press against the current highlight into a {@link SearchKeyAction}.
|
|
28
|
+
* Arrow navigation wraps around; `Enter` selects only when a valid row is highlighted.
|
|
29
|
+
*
|
|
30
|
+
* @param key `KeyboardEvent.key` value.
|
|
31
|
+
* @param currentIndex Currently highlighted option index (`-1` = none).
|
|
32
|
+
* @param optionsLength Number of options currently in the dropdown.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveSearchKeyAction(key: string, currentIndex: number, optionsLength: number): SearchKeyAction;
|
|
35
|
+
//# sourceMappingURL=searchKeyboardNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/action/search/searchKeyboardNavigation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qEAAqE;AACrE,MAAM,MAAM,eAAe;AAC1B,0DAA0D;AACxD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACjC,iEAAiE;GAC/D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACnC,2DAA2D;GACzD;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE;AACnB,uDAAuD;GACrD;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpB;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACnB,eAAe,CAqBjB"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { CwIconProps } from "../../../../components/display/graphics/icon/CwIcon";
|
|
3
2
|
import { CwLabelProps } from "../../../../components/display/text/label/CwLabel";
|
|
4
3
|
export interface CwCheckProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type"> {
|
|
5
4
|
/** Props for the label component */
|
|
6
5
|
labelProps?: CwLabelProps;
|
|
7
|
-
/** Text content for the checkbox label
|
|
6
|
+
/** Text content for the checkbox label
|
|
7
|
+
* @deprecated Use `labelProps.text` instead. */
|
|
8
8
|
labelText?: string;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
/** Layout alignment: "row" (side by side) | "column" (label
|
|
9
|
+
/** Layout of the input relative to its label: "row" (side by side, default) | "column" (label below) */
|
|
10
|
+
direction?: "row" | "column";
|
|
11
|
+
/** Layout alignment: "row" (side by side) | "column" (label below) @default "row"
|
|
12
|
+
* @deprecated Use `direction` instead. */
|
|
12
13
|
alignment?: "row" | "column";
|
|
13
14
|
}
|
|
14
15
|
export declare function CwCheck(props: CwCheckProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CwCheck.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/checkbox/CwCheck.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"CwCheck.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/checkbox/CwCheck.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAGjF,MAAM,WAAW,YAChB,SAAQ,IAAI,CACX,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EACtF,MAAM,CACN;IACD,oCAAoC;IACpC,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B;oDACgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B;8CAC0C;IAC1C,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC7B;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,qBA6B1C"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CwInputFeedback } from "../../../../common/interfaces/CwFormTypes";
|
|
2
|
+
import type { CwGroupLayoutProps } from "../../../../common/interfaces/CwLayoutProps";
|
|
2
3
|
import { CwLabelProps } from "../../../../components/display/text/label/CwLabel";
|
|
3
|
-
import { CwAlignProps } from "../../../../components/layout/align/CwAlign";
|
|
4
|
+
import type { CwAlignProps } from "../../../../components/layout/align/CwAlign";
|
|
4
5
|
export interface CheckboxOption {
|
|
5
6
|
/** Value sent to onChange */
|
|
6
7
|
value: string;
|
|
@@ -9,7 +10,17 @@ export interface CheckboxOption {
|
|
|
9
10
|
/** Disables this specific option */
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Extends the shared {@link CwGroupLayoutProps} (`groupLayout` + `itemLayout`), the same layout
|
|
15
|
+
* interface {@link CwRadioGroup} and {@link CwKeyValueList} use:
|
|
16
|
+
* - `groupLayout` — label vs group block. `direction: "row"` (default, kept for backward
|
|
17
|
+
* compatibility) = label beside the options; `"column"` = label above. Honors `align`/`gap`.
|
|
18
|
+
* - `itemLayout` — flow of the checkbox options. `direction: "column"` (default) = stacked;
|
|
19
|
+
* `"row"` = inline with wrap. Honors `gap`. It also drives each checkbox's own box-to-text
|
|
20
|
+
* layout to the OPPOSITE axis: stacked items get the box beside the text, side-by-side items
|
|
21
|
+
* get the box above the text.
|
|
22
|
+
*/
|
|
23
|
+
export interface CwCheckboxGroupProps extends CwGroupLayoutProps {
|
|
13
24
|
/** List of options to display */
|
|
14
25
|
options: CheckboxOption[];
|
|
15
26
|
/** Currently selected values */
|
|
@@ -18,18 +29,30 @@ export interface CwCheckboxGroupProps {
|
|
|
18
29
|
onChange: (selected: string[]) => void;
|
|
19
30
|
/** Props for the label component */
|
|
20
31
|
labelProps?: CwLabelProps;
|
|
21
|
-
/** Props for alignment */
|
|
22
|
-
alignProps?: CwAlignProps;
|
|
23
32
|
/** Marks the group as required */
|
|
24
33
|
required?: boolean;
|
|
25
34
|
/** Disables all options */
|
|
26
35
|
disabled?: boolean;
|
|
27
|
-
/** Layout alignment of each individual checkbox: "row" (default) | "column" */
|
|
28
|
-
optionsAlignment?: "row" | "column";
|
|
29
36
|
/** Additional CSS class for the container */
|
|
30
37
|
className?: string;
|
|
31
38
|
/** Error or info messages below the group */
|
|
32
39
|
feedback?: CwInputFeedback | CwInputFeedback[];
|
|
40
|
+
/** Props for alignment
|
|
41
|
+
* @deprecated Use `groupLayout` instead. */
|
|
42
|
+
alignProps?: CwAlignProps;
|
|
43
|
+
/** Layout alignment of each individual checkbox: "row" (default) | "column"
|
|
44
|
+
* @deprecated Use `itemLayout` instead. */
|
|
45
|
+
optionsAlignment?: "row" | "column";
|
|
46
|
+
"data-testid"?: string;
|
|
33
47
|
}
|
|
34
|
-
|
|
48
|
+
/**
|
|
49
|
+
* CwCheckboxGroup - Multi-select group of native checkbox inputs.
|
|
50
|
+
*
|
|
51
|
+
* Use for selecting any number of values from a list of options. Layout follows the
|
|
52
|
+
* CwKeyValueList / CwRadioGroup convention with two nested {@link CwLayoutProps} axes applied as
|
|
53
|
+
* `data-*` attributes: `groupLayout` positions the label relative to the group block (root grid),
|
|
54
|
+
* `itemLayout` controls how the checkboxes flow among themselves (options container) and, on the
|
|
55
|
+
* opposite axis, each checkbox's own box-to-text layout.
|
|
56
|
+
*/
|
|
57
|
+
export declare function CwCheckboxGroup({ options, value, onChange, labelProps, groupLayout, itemLayout, required, disabled, className, feedback, alignProps, optionsAlignment, "data-testid": dataTestId, }: CwCheckboxGroupProps): import("react").JSX.Element;
|
|
35
58
|
//# sourceMappingURL=CwCheckboxGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CwCheckboxGroup.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/checkbox/CwCheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAW,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,
|
|
1
|
+
{"version":3,"file":"CwCheckboxGroup.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/checkbox/CwCheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAW,YAAY,EAAE,MAAM,mDAA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|
+
export interface CwRadioProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type"> {
|
|
3
|
+
/** Text content for the radio label */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Layout of the input relative to its text: "row" (side by side, default) | "column" (text below) */
|
|
6
|
+
direction?: "row" | "column";
|
|
7
|
+
}
|
|
8
|
+
/** Single native radio input. Building block for CwRadioGroup. */
|
|
9
|
+
export declare function CwRadio({ label, direction, className, ...inputProps }: CwRadioProps): React.JSX.Element;
|
|
10
|
+
//# sourceMappingURL=CwRadio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwRadio.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/checkbox/CwRadio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,YAChB,SAAQ,IAAI,CACX,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EACtF,MAAM,CACN;IACD,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sGAAsG;IACtG,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC7B;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,SAAiB,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,EAAE,YAAY,qBAO3F"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CwInputFeedback } from "../../../../common/interfaces/CwFormTypes";
|
|
2
|
+
import type { CwGroupLayoutProps } from "../../../../common/interfaces/CwLayoutProps";
|
|
3
|
+
import { CwLabelProps } from "../../../../components/display/text/label/CwLabel";
|
|
4
|
+
export interface RadioOption {
|
|
5
|
+
/** Value sent to onChange */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Text displayed next to the radio */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Disables this specific option */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Extends the shared {@link CwGroupLayoutProps} (`groupLayout` + `itemLayout`), the same layout
|
|
14
|
+
* interface {@link CwKeyValueList} uses:
|
|
15
|
+
* - `groupLayout` — label vs radiogroup block. `direction: "column"` (default) = label above;
|
|
16
|
+
* `"row"` = label beside the options. Honors `align`/`gap`.
|
|
17
|
+
* - `itemLayout` — flow of the radio options. `direction: "column"` (default) = stacked;
|
|
18
|
+
* `"row"` = inline with wrap. Honors `gap`. It also drives each radio's own circle-to-text
|
|
19
|
+
* layout to the OPPOSITE axis: stacked items get the circle beside the text, side-by-side
|
|
20
|
+
* items get the circle above the text.
|
|
21
|
+
*/
|
|
22
|
+
export interface CwRadioGroupProps extends CwGroupLayoutProps {
|
|
23
|
+
/** List of options to display */
|
|
24
|
+
options: RadioOption[];
|
|
25
|
+
/** Currently selected value */
|
|
26
|
+
value?: string;
|
|
27
|
+
/** Callback when the selection changes - returns the selected value */
|
|
28
|
+
onChange: (value: string) => void;
|
|
29
|
+
/** Props for the label component */
|
|
30
|
+
labelProps?: CwLabelProps;
|
|
31
|
+
/** Marks the group as required */
|
|
32
|
+
required?: boolean;
|
|
33
|
+
/** Disables all options */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Additional CSS class for the container */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** Error or info messages below the group */
|
|
38
|
+
feedback?: CwInputFeedback | CwInputFeedback[];
|
|
39
|
+
/** Accessible name for the radiogroup when no visible `labelProps` label is rendered (a11y fallback). */
|
|
40
|
+
"aria-label"?: string;
|
|
41
|
+
/** Accessible name for the radiogroup when no visible `labelProps` label is rendered (a11y fallback). */
|
|
42
|
+
"aria-labelledby"?: string;
|
|
43
|
+
"data-testid"?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* CwRadioGroup - Single-select group of native radio inputs.
|
|
47
|
+
*
|
|
48
|
+
* Built on `<input type="radio">` sharing one `name`, so the browser provides radio-group
|
|
49
|
+
* semantics (roving tabindex, arrow-key navigation) natively. Use for a single choice from a
|
|
50
|
+
* list of options; for 2–3 options shown as a strip use CwButtonSwitch.
|
|
51
|
+
*
|
|
52
|
+
* Layout follows the CwKeyValueList convention with two nested {@link CwLayoutProps} axes
|
|
53
|
+
* applied as `data-*` attributes: `groupLayout` positions the label relative to the radiogroup
|
|
54
|
+
* block (root grid), `itemLayout` controls how the radios flow among themselves (options
|
|
55
|
+
* container) and, on the opposite axis, each radio's own circle-to-text layout.
|
|
56
|
+
*/
|
|
57
|
+
export declare function CwRadioGroup({ options, value, onChange, labelProps, groupLayout, itemLayout, required, disabled, className, feedback, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "data-testid": dataTestId, }: CwRadioGroupProps): import("react").JSX.Element;
|
|
58
|
+
//# sourceMappingURL=CwRadioGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwRadioGroup.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/checkbox/CwRadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAW,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAI1F,MAAM,WAAW,WAAW;IAC3B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC5D,iCAAiC;IACjC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,oCAAoC;IACpC,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,CAAC;IAC/C,yGAAyG;IACzG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yGAAyG;IACzG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,aAAa,EAAE,UAAU,GACzB,EAAE,iBAAiB,+BA2DnB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export interface CwNavItem {
|
|
3
|
+
/** Stable id, also the React key */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Resolved display text — the consumer owns i18n / tenant naming */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Link target for leaves; groups may omit it */
|
|
8
|
+
href?: string;
|
|
9
|
+
/** Resolved secondary text — not rendered by the menu, but searched alongside label and href */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** CW icon name */
|
|
12
|
+
icon?: string;
|
|
13
|
+
/** Non-empty children make this item a collapsible group */
|
|
14
|
+
children?: CwNavItem[];
|
|
15
|
+
}
|
|
16
|
+
/** Remaining props land on the <nav> — `data-*` (CBT walkthrough targets), `aria-*`, `data-testid`. */
|
|
17
|
+
export interface CwNavMenuProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
18
|
+
/** Already permission-filtered and ordered by the consumer */
|
|
19
|
+
items: CwNavItem[];
|
|
20
|
+
/** Renders placeholder rows instead of the tree */
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Router-agnostic active detection; nothing is highlighted when omitted. Injected because the
|
|
24
|
+
* library cannot depend on a router (WinOps: react-router-dom 6.28, Improve: a different one,
|
|
25
|
+
* playground: none) — the consumer answers "is this the current page?", the component owns the
|
|
26
|
+
* highlight. Revisitable: if the apps ever converge on one router, this could move inside.
|
|
27
|
+
*/
|
|
28
|
+
isActive?: (item: CwNavItem) => boolean;
|
|
29
|
+
/** Inject a router link component; defaults to a plain <a href> */
|
|
30
|
+
renderLink?: (item: CwNavItem, children: ReactNode) => ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Show a trailing chevron on **top-level** group rows. Nested groups (level 2+) always show it
|
|
33
|
+
* and ignore this flag — don't normalise the two cases: a level-1 group is already marked by
|
|
34
|
+
* its heavier type and [open] background, while a nested group is otherwise indistinguishable
|
|
35
|
+
* from its sibling leaf links.
|
|
36
|
+
*/
|
|
37
|
+
showExpandIndicator?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Filters the tree through `filterNavItems`: a group survives when it or any descendant matches.
|
|
40
|
+
* Quoted `"phrases"` match the label; loose words match label + description + href. Blank or
|
|
41
|
+
* omitted means no filtering.
|
|
42
|
+
*/
|
|
43
|
+
search?: string;
|
|
44
|
+
/** Shown only while a search is active and nothing matched — an empty `items` still renders nothing */
|
|
45
|
+
emptyMessage?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Sorts the **top level** alphabetically; nested lists keep the consumer's order. Off by default.
|
|
48
|
+
* Level-1-only is deliberate: a long list of modules is hard to scan, while the pages inside one
|
|
49
|
+
* are ordered on purpose.
|
|
50
|
+
*/
|
|
51
|
+
sortAlphabetically?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Rows for the sticky favourites section above the tree. Omit it and no section renders. The
|
|
54
|
+
* library owns the disclosure and its look; the rows are yours, so their markup, secondary text
|
|
55
|
+
* and any `data-*` stay under your control.
|
|
56
|
+
*/
|
|
57
|
+
favoritesSlot?: ReactNode;
|
|
58
|
+
/** Header for the favourites section. Pass your own translation. */
|
|
59
|
+
favoritesLabel?: string;
|
|
60
|
+
/** Attributes for the favourites `<details>` — `data-tour`, or `open` to override the default. */
|
|
61
|
+
favoritesProps?: HTMLAttributes<HTMLDetailsElement>;
|
|
62
|
+
/**
|
|
63
|
+
* Marks a leaf as favourited with a star. Indicator only — toggling stays with the consumer
|
|
64
|
+
* (a context menu on the link, for instance), so no row gains a control it didn't have.
|
|
65
|
+
*/
|
|
66
|
+
isFavorite?: (item: CwNavItem) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* An app-provided section between the favourites and the tree — WinOps's external "Places" links,
|
|
69
|
+
* for instance. Kept out of `items` on purpose: it is a parallel list, so it is not filtered by
|
|
70
|
+
* `search` or reordered by `sortAlphabetically`.
|
|
71
|
+
*
|
|
72
|
+
* A `<details>` placed here is styled as a top-level section automatically.
|
|
73
|
+
*/
|
|
74
|
+
beforeTreeSlot?: ReactNode;
|
|
75
|
+
}
|
|
76
|
+
/** Sizes only its own icons — content injected via `renderLink` is styled by the consumer. */
|
|
77
|
+
export declare function CwNavMenu({ items, loading, isActive, renderLink, showExpandIndicator, search, emptyMessage, sortAlphabetically, favoritesSlot, favoritesLabel, favoritesProps, isFavorite, beforeTreeSlot, className, ...navProps }: CwNavMenuProps): import("react").JSX.Element;
|
|
78
|
+
//# sourceMappingURL=CwNavMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwNavMenu.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/nav-menu/CwNavMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,E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;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;CAC3B;AAQD,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,EACzB,KAAK,EACL,OAAe,EACf,QAAQ,EACR,UAA8B,EAC9B,mBAA2B,EAC3B,MAAM,EACN,YAAY,EACZ,kBAA0B,EAC1B,aAAa,EACb,cAA4B,EAC5B,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACT,GAAG,QAAQ,EACX,EAAE,cAAc,+BAmEhB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CwNavItem } from "./CwNavMenu";
|
|
2
|
+
/**
|
|
3
|
+
* Filters a nav tree by a search string, keeping a group whose descendants match.
|
|
4
|
+
*
|
|
5
|
+
* Supports `"quoted phrases"` (must appear in the label) alongside loose words (any field) — this is
|
|
6
|
+
* behaviour users are told about, so don't simplify it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function filterNavItems(items: CwNavItem[], search?: string): CwNavItem[];
|
|
9
|
+
//# sourceMappingURL=filterNavItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterNavItems.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/nav-menu/filterNavItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoBxC;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAmC/E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CwNavItem } from "./CwNavMenu";
|
|
2
|
+
/**
|
|
3
|
+
* Sorts the top level alphabetically, leaving every nested list in the order the consumer gave.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately level 1 only: this exists because a long list of modules is hard to scan, while the
|
|
6
|
+
* pages inside a module are ordered on purpose. Returns the input untouched when not sorting.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sortNavItems(items: CwNavItem[], alphabetically?: boolean): CwNavItem[];
|
|
9
|
+
//# sourceMappingURL=sortNavItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortNavItems.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/nav-menu/sortNavItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,CAItF"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { CwIconProps } from "../../../../components/display/graphics/icon/CwIcon";
|
|
3
2
|
import { CwLabelProps } from "../../../../components/display/text/label/CwLabel";
|
|
4
3
|
export interface CwToggleProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type"> {
|
|
5
4
|
/** Props for the label component */
|
|
6
5
|
labelProps?: CwLabelProps;
|
|
7
|
-
/** Text content for the toggle label
|
|
6
|
+
/** Text content for the toggle label
|
|
7
|
+
* @deprecated Use `labelProps.text` instead. */
|
|
8
8
|
labelText?: string;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
/** Layout alignment: "row" (side by side) | "column" (label above) @default "row"
|
|
9
|
+
/** Layout of the input relative to its label: "row" (side by side, default) | "column" (label above) */
|
|
10
|
+
direction?: "row" | "column";
|
|
11
|
+
/** Layout alignment: "row" (side by side) | "column" (label above) @default "row"
|
|
12
|
+
* @deprecated Use `direction` instead. */
|
|
12
13
|
alignment?: "row" | "column";
|
|
13
14
|
}
|
|
14
15
|
export declare function CwToggle(props: CwToggleProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CwToggle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/toggle/CwToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"CwToggle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/control/choice/toggle/CwToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAEjF,MAAM,WAAW,aAChB,SAAQ,IAAI,CACX,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EACtF,MAAM,CACN;IAED,oCAAoC;IACpC,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B;oDACgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B;8CAC0C;IAC1C,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CAE7B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,qBA+B5C"}
|