@ssa-ui-kit/core 3.21.3 → 3.22.1
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/ai/source-map.md +2243 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +7 -3
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts +15 -5
- package/dist/components/ButtonGroup/ButtonGroupButtonBase.d.ts +17 -1
- package/dist/components/ButtonGroup/styles.d.ts +22 -0
- package/dist/components/ButtonGroup/types.d.ts +45 -7
- package/dist/components/Card/Card.d.ts +60 -0
- package/dist/components/Card/types.d.ts +13 -0
- package/dist/components/CardContent/CardContent.d.ts +46 -0
- package/dist/components/CardHeader/CardHeader.d.ts +42 -0
- package/dist/components/CollapsibleNavBar/CollapsibleNavBar.d.ts +35 -2
- package/dist/components/CollapsibleNavBar/components/NavHeader.d.ts +18 -0
- package/dist/components/CollapsibleNavBar/components/NavPopoverContent.d.ts +12 -0
- package/dist/components/CollapsibleNavBar/components/NavTree.d.ts +22 -0
- package/dist/components/CollapsibleNavBar/components/index.d.ts +3 -3
- package/dist/components/CollapsibleNavBar/navItems.d.ts +57 -0
- package/dist/components/CollapsibleNavBar/styles.d.ts +34 -0
- package/dist/components/CollapsibleNavBar/types.d.ts +40 -3
- package/dist/components/DatePicker/DatePicker.d.ts +57 -0
- package/dist/components/Drawer/DrawerRoot.d.ts +70 -0
- package/dist/components/DropdownOption/DropdownOption.d.ts +43 -0
- package/dist/components/Form/Form.d.ts +40 -0
- package/dist/components/Icon/Icon.d.ts +47 -0
- package/dist/components/Icon/icons/Columns.d.ts +3 -0
- package/dist/components/Icon/icons/List.d.ts +3 -0
- package/dist/components/Icon/icons/all.d.ts +2 -0
- package/dist/components/Icon/icons/iconsList.d.ts +1 -1
- package/dist/components/Icon/types.d.ts +13 -0
- package/dist/components/Input/Input.d.ts +94 -0
- package/dist/components/MultipleDropdown/MultipleDropdown.d.ts +73 -0
- package/dist/components/NestedTable/WithNestedTableRow.d.ts +39 -0
- package/dist/components/NestedTable/components/NestedTable.d.ts +57 -0
- package/dist/components/NestedTable/components/NestedTableCell.d.ts +33 -0
- package/dist/components/NestedTable/components/NestedTableRow.d.ts +44 -0
- package/dist/components/NestedTable/types.d.ts +17 -0
- package/dist/components/TableRow/TableRow.d.ts +51 -0
- package/dist/components/Tooltip/Tooltip.d.ts +10 -6
- package/dist/components/Tooltip/types.d.ts +20 -7
- package/dist/components/TooltipContent/TooltipContent.d.ts +7 -3
- package/dist/components/TreeView/TreeView.d.ts +62 -0
- package/dist/components/TreeView/TreeViewItem.d.ts +32 -0
- package/dist/components/TreeView/index.d.ts +2 -0
- package/dist/components/TreeView/styles.d.ts +18 -0
- package/dist/components/TreeView/types.d.ts +162 -0
- package/dist/components/TreeView/useTreeViewState.d.ts +21 -0
- package/dist/components/TreeView/utils.d.ts +42 -0
- package/dist/components/Wrapper/Wrapper.d.ts +6 -6
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +2336 -679
- package/dist/index.mjs +2337 -681
- package/dist/tsbuildcache +1 -1
- package/package.json +4 -4
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/AccordionContent.d.ts +0 -11
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/AccordionContentItem.d.ts +0 -8
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/CollapsibleNavBarItem.d.ts +0 -6
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/ItemAccordionTitle.d.ts +0 -9
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/ItemWithSubMenu.d.ts +0 -7
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/index.d.ts +0 -5
- package/dist/components/CollapsibleNavBar/components/ItemWithSubmenu/styles.d.ts +0 -6
- package/dist/components/CollapsibleNavBar/components/ItemWithoutSubmenu/ItemWithoutSubMenu.d.ts +0 -5
- package/dist/components/CollapsibleNavBar/components/ItemWithoutSubmenu/index.d.ts +0 -1
- package/dist/components/CollapsibleNavBar/components/NavBarItem.d.ts +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { PathPattern } from 'react-router-dom';
|
|
3
3
|
import { CSSObject } from '@emotion/react';
|
|
4
|
-
import { NavBarExtendedGroup, NavBarExtendedItem, NavBarExtendedSubItem } from '
|
|
4
|
+
import { NavBarExtendedGroup, NavBarExtendedItem, NavBarExtendedSubItem } from '../NavBar/types';
|
|
5
5
|
export interface CollapsibleNavBarItem extends NavBarExtendedItem {
|
|
6
6
|
iconSize: number;
|
|
7
7
|
css?: CSSObject;
|
|
@@ -11,20 +11,57 @@ export interface CollapsibleNavBarGroup<T extends NavBarExtendedSubItem = NavBar
|
|
|
11
11
|
css?: CSSObject;
|
|
12
12
|
prefix: string;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* The panel header, above the menu.
|
|
16
|
+
*
|
|
17
|
+
* Every field is optional, which is what covers the design's three variants:
|
|
18
|
+
* headline alone, headline with a large picture above the name, and headline
|
|
19
|
+
* with a small avatar inline beside it. Pass elements rather than urls so the
|
|
20
|
+
* kit's `Avatar` — or anything else — can be dropped straight in.
|
|
21
|
+
*/
|
|
22
|
+
export interface CollapsibleNavBarHeader {
|
|
23
|
+
/** Headline, shown above everything else. */
|
|
24
|
+
title?: React.ReactNode;
|
|
25
|
+
/** Person's name, shown under the picture or beside the avatar. */
|
|
26
|
+
name?: React.ReactNode;
|
|
27
|
+
/** Small element rendered inline, before the name. Typically an `Avatar`. */
|
|
28
|
+
avatar?: React.ReactNode;
|
|
29
|
+
/** Large square picture above the name, e.g. an `img`. */
|
|
30
|
+
image?: React.ReactNode;
|
|
31
|
+
}
|
|
14
32
|
export interface CollapsibleNavBarExtendedProps<T extends NavBarExtendedSubItem = NavBarExtendedSubItem> {
|
|
15
33
|
/** Nav items: link items (path, iconName, iconSize, title) or groups with prefix, iconName, iconSize, title, items (sub-items: path, title). */
|
|
16
34
|
items: Array<CollapsibleNavBarItem | CollapsibleNavBarGroup<T>>;
|
|
17
35
|
/** Logo or branding element (e.g. image or div) shown above the nav. */
|
|
18
|
-
renderLogo
|
|
36
|
+
renderLogo?: React.ReactElement;
|
|
37
|
+
/**
|
|
38
|
+
* Header shown above the menu in the expanded panel — headline, picture,
|
|
39
|
+
* avatar, name. Hidden in the collapsed rail, which has no room for it.
|
|
40
|
+
*/
|
|
41
|
+
header?: CollapsibleNavBarHeader;
|
|
19
42
|
/** Visual theme: dark (default) or light sidebar. */
|
|
20
43
|
theme?: 'default' | 'light';
|
|
44
|
+
/**
|
|
45
|
+
* Colour of the active row and of the group that owns it. Defaults to the
|
|
46
|
+
* theme's own accent — `blueCool` on the dark sidebar, `primary.dark` on the
|
|
47
|
+
* light one — so an app with its own brand colour can override it without
|
|
48
|
+
* restyling the rows.
|
|
49
|
+
*/
|
|
50
|
+
activeColor?: string;
|
|
21
51
|
/** Optional CSS class for the root. */
|
|
22
52
|
className?: string;
|
|
23
53
|
/** Max width for submenu panels (e.g. 220). */
|
|
24
54
|
subMenuMaxWidth?: CSSProperties['maxWidth'];
|
|
25
55
|
/** When true, show tooltips on nav icons when sidebar is collapsed. */
|
|
26
56
|
showIconTooltip?: boolean;
|
|
27
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Custom route matching for active state (e.g. for React Router): given a
|
|
59
|
+
* group's `prefix`, return the pattern that marks the group active.
|
|
60
|
+
*
|
|
61
|
+
* Must be a plain function — it is called once per group from a loop, so a
|
|
62
|
+
* hook inside it would change its call order whenever the menu gains or
|
|
63
|
+
* loses a group.
|
|
64
|
+
*/
|
|
28
65
|
useMatchPattern?: (prefix: string) => string | PathPattern<string>;
|
|
29
66
|
/** Called when the sidebar expand/collapse state changes. */
|
|
30
67
|
onChange?: (isChecked: boolean) => void;
|
|
@@ -1,2 +1,59 @@
|
|
|
1
1
|
import { DatePickerProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* DatePicker — masked date input with a popover calendar. Use inside **`FormProvider`**
|
|
4
|
+
* (react-hook-form): the field value is the formatted string; **`onChange`** receives a
|
|
5
|
+
* JavaScript **`Date`** (or undefined when cleared). Supports **day**, **month**, or **year**
|
|
6
|
+
* granularity via **`pickerType`**, **`mm/dd/yyyy`** / **`dd/mm/yyyy`** / **`mm/yyyy`** / **`yyyy`**
|
|
7
|
+
* formats, optional **min/max** bounds, and **openCalendarMode** (icon, input, or both).
|
|
8
|
+
*
|
|
9
|
+
* ### Behavior notes
|
|
10
|
+
* - Parsing and display use **Luxon**; the form stores the string matching **`format`**.
|
|
11
|
+
* - Validation runs when the mask is complete or on **blur**; errors surface through
|
|
12
|
+
* react-hook-form and **`onError`**.
|
|
13
|
+
* - **`highlightDates`** helps range UIs by styling days between two dates.
|
|
14
|
+
*
|
|
15
|
+
* @category Components
|
|
16
|
+
* @subcategory Form Controls
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { FormProvider, useForm } from 'react-hook-form';
|
|
21
|
+
* import { DatePicker } from '@ssa-ui-kit/core';
|
|
22
|
+
*
|
|
23
|
+
* function Example() {
|
|
24
|
+
* const methods = useForm({ defaultValues: { startDate: '' } });
|
|
25
|
+
* return (
|
|
26
|
+
* <FormProvider {...methods}>
|
|
27
|
+
* <DatePicker
|
|
28
|
+
* name="startDate"
|
|
29
|
+
* label="Start date"
|
|
30
|
+
* format="mm/dd/yyyy"
|
|
31
|
+
* onChange={(date) => console.log(date)}
|
|
32
|
+
* />
|
|
33
|
+
* </FormProvider>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // Month picker (mm/yyyy) with bounds
|
|
41
|
+
* <DatePicker
|
|
42
|
+
* name="period"
|
|
43
|
+
* label="Period"
|
|
44
|
+
* pickerType="months"
|
|
45
|
+
* dateMin="01/2020"
|
|
46
|
+
* dateMax="12/2030"
|
|
47
|
+
* onChange={(d) => {}}
|
|
48
|
+
* />
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @see {@link Input} — Underlying text field
|
|
52
|
+
* @see {@link Popover} — Calendar overlay
|
|
53
|
+
*
|
|
54
|
+
* @accessibility
|
|
55
|
+
* - Label is associated with the input via **`htmlFor`** / **`id`**
|
|
56
|
+
* - Calendar days use **`aria-disabled`** and **`aria-label`** where applicable
|
|
57
|
+
* - Icon trigger exposes **`aria-label="Calendar"`**
|
|
58
|
+
*/
|
|
2
59
|
export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,4 +3,74 @@ export interface DrawerProps extends UseDrawerOptions {
|
|
|
3
3
|
children?: React.ReactElement;
|
|
4
4
|
store?: UseDrawerStore;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Drawer.Root - Slide-out panel anchored to an edge of the screen.
|
|
8
|
+
*
|
|
9
|
+
* Exported as a namespace, so the parts are reached through it:
|
|
10
|
+
* `import { Drawer } from '@ssa-ui-kit/core'` then `<Drawer.Root>`. There is no
|
|
11
|
+
* bare `<Drawer>` component.
|
|
12
|
+
*
|
|
13
|
+
* ### Nesting is required
|
|
14
|
+
* ```
|
|
15
|
+
* Drawer.Root — owns the state
|
|
16
|
+
* └── Drawer.Portal — renders outside the DOM subtree
|
|
17
|
+
* └── Drawer.Overlay — backdrop; click-outside to dismiss
|
|
18
|
+
* └── Drawer.Content — the panel itself
|
|
19
|
+
* ├── Drawer.Header
|
|
20
|
+
* │ ├── Drawer.Title
|
|
21
|
+
* │ └── Drawer.CloseButton
|
|
22
|
+
* └── …your content
|
|
23
|
+
* ```
|
|
24
|
+
* Each layer reads context from the one above, so skipping a level (Content
|
|
25
|
+
* without Overlay, say) leaves the drawer without its backdrop and dismiss
|
|
26
|
+
* behaviour.
|
|
27
|
+
*
|
|
28
|
+
* ### Controlled via the `useDrawer` store
|
|
29
|
+
* For a drawer opened from elsewhere — a toolbar button, a route — call
|
|
30
|
+
* `useDrawer()` in the parent and hand the result to `store`. That same object
|
|
31
|
+
* carries `interactions.getReferenceProps()` for wiring the trigger. Omit
|
|
32
|
+
* `store` and `Drawer.Root` keeps its own state from `defaultOpen`.
|
|
33
|
+
*
|
|
34
|
+
* ### It unmounts while closed
|
|
35
|
+
* `Drawer.Root` renders `null` until the open transition starts, so children do
|
|
36
|
+
* not exist in the DOM when the drawer is shut. Anything that must keep state
|
|
37
|
+
* across open/close belongs above the drawer, not inside it.
|
|
38
|
+
*
|
|
39
|
+
* Note `opened`/`defaultOpened` are the legacy spelling of `open`/`defaultOpen`;
|
|
40
|
+
* prefer the latter.
|
|
41
|
+
*
|
|
42
|
+
* @category Components
|
|
43
|
+
* @subcategory Overlay
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* // Controlled: the trigger lives outside the drawer
|
|
48
|
+
* const drawer = useDrawer({ title: 'Settings', withCloseButton: true });
|
|
49
|
+
*
|
|
50
|
+
* <>
|
|
51
|
+
* <Button {...drawer.interactions.getReferenceProps()} text="Settings" />
|
|
52
|
+
* <Drawer.Root store={drawer}>
|
|
53
|
+
* <Drawer.Portal>
|
|
54
|
+
* <Drawer.Overlay>
|
|
55
|
+
* <Drawer.Content css={{ maxWidth: 400, padding: 24 }}>
|
|
56
|
+
* {form}
|
|
57
|
+
* </Drawer.Content>
|
|
58
|
+
* </Drawer.Overlay>
|
|
59
|
+
* </Drawer.Portal>
|
|
60
|
+
* </Drawer.Root>
|
|
61
|
+
* </>
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx
|
|
66
|
+
* // Uncontrolled, anchored left, not dismissable by click-outside
|
|
67
|
+
* <Drawer.Root defaultOpen position="left" dismissable={false}>
|
|
68
|
+
* <Drawer.Portal>
|
|
69
|
+
* <Drawer.Overlay>
|
|
70
|
+
* <Drawer.Content>{content}</Drawer.Content>
|
|
71
|
+
* </Drawer.Overlay>
|
|
72
|
+
* </Drawer.Portal>
|
|
73
|
+
* </Drawer.Root>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
6
76
|
export declare const Drawer: ({ children, store: controlledStore, ...drawerProps }: DrawerProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
@@ -26,6 +26,49 @@ export interface DropdownItemProps extends CommonProps, Omit<React.LiHTMLAttribu
|
|
|
26
26
|
* Thin wrapper over a styled `<li>`. It exists so that `disabled` can be
|
|
27
27
|
* accepted as the supported prop name without emotion forwarding it to the
|
|
28
28
|
* DOM, where `disabled` is not valid on an `<li>`.
|
|
29
|
+
*
|
|
30
|
+
* ### The parent supplies the visible label
|
|
31
|
+
* Options are not rendered as written: the enclosing dropdown clones each one
|
|
32
|
+
* and injects the label, resolved as **`children` → `label` → `value`**. So
|
|
33
|
+
* `<DropdownOption value="Sales" />` displays "Sales" with no children needed,
|
|
34
|
+
* `label` overrides that for a different display string, and `children` wins
|
|
35
|
+
* over both when a row needs custom markup.
|
|
36
|
+
*
|
|
37
|
+
* The clone also wraps the label for truncation and attaches a tooltip, so put
|
|
38
|
+
* custom content in `children` rather than styling the `<li>` directly.
|
|
39
|
+
*
|
|
40
|
+
* ### Selection state comes from the parent
|
|
41
|
+
* `isActive`, `isMultiple` and the click wiring are set by `Dropdown` /
|
|
42
|
+
* `MultipleDropdown`; you supply `value` and let the parent report selection
|
|
43
|
+
* through its own `onChange`. Note `disabled` is only styled in `isMultiple`
|
|
44
|
+
* mode.
|
|
45
|
+
*
|
|
46
|
+
* @category Form Controls
|
|
47
|
+
* @subcategory Selection
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* // Label falls back to `value`
|
|
52
|
+
* <Dropdown onChange={handleChange}>
|
|
53
|
+
* {teams.map((team) => (
|
|
54
|
+
* <DropdownOption key={team.id} value={team.name} />
|
|
55
|
+
* ))}
|
|
56
|
+
* </Dropdown>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* // Report an id, display something else
|
|
62
|
+
* <DropdownOption value={user.id} label={user.fullName} />
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* // Custom row content; `avatar` fills the leading slot
|
|
68
|
+
* <DropdownOption value={user.id} avatar={<Avatar size={20} image={user.photo} />}>
|
|
69
|
+
* {user.fullName} — {user.role}
|
|
70
|
+
* </DropdownOption>
|
|
71
|
+
* ```
|
|
29
72
|
*/
|
|
30
73
|
declare const DropdownOption: React.ForwardRefExoticComponent<DropdownItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
31
74
|
export default DropdownOption;
|
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
import { CommonProps } from '../../types/emotion';
|
|
2
|
+
/**
|
|
3
|
+
* Form - Styled `<form>` element that lays its children out as a wrapping flex row.
|
|
4
|
+
*
|
|
5
|
+
* ### It does not manage form state
|
|
6
|
+
* Unlike the `Form` component in many other kits, this one adds **no** state,
|
|
7
|
+
* validation, context or submit handling — it is a layout primitive over a real
|
|
8
|
+
* `<form>`. There is no `onSubmit` wiring, no `values`/`errors`, and nothing is
|
|
9
|
+
* provided to descendants via context.
|
|
10
|
+
*
|
|
11
|
+
* State comes from `react-hook-form`: keep `useForm` in your component and hand
|
|
12
|
+
* `handleSubmit` to the native `onSubmit`. Because it renders a plain `<form>`,
|
|
13
|
+
* every native attribute (`onSubmit`, `noValidate`, `id`, `method`) works as-is.
|
|
14
|
+
*
|
|
15
|
+
* ### Layout
|
|
16
|
+
* Children flow in a wrapping row. For a stacked form, override the direction
|
|
17
|
+
* with `css` rather than reaching for a different component.
|
|
18
|
+
*
|
|
19
|
+
* @category Form Structure
|
|
20
|
+
* @subcategory Layout
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // State lives in react-hook-form; Form only lays the fields out
|
|
25
|
+
* const { register, handleSubmit, formState } = useForm<Values>();
|
|
26
|
+
*
|
|
27
|
+
* <Form onSubmit={handleSubmit(onSubmit)}>
|
|
28
|
+
* <TextField name="title" register={register} errors={formState.errors.title} />
|
|
29
|
+
* <Button type="submit" variant="primary" text="Save" />
|
|
30
|
+
* </Form>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Stack the fields instead of wrapping them in a row
|
|
36
|
+
* <Form onSubmit={handleSubmit(onSubmit)} css={{ flexFlow: 'column', gap: 16 }}>
|
|
37
|
+
* <TextField name="email" register={register} />
|
|
38
|
+
* <TextField name="password" type="password" register={register} />
|
|
39
|
+
* </Form>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
2
42
|
declare const Form: import("@emotion/styled").StyledComponent<{
|
|
3
43
|
theme?: import("@emotion/react").Theme;
|
|
4
44
|
as?: React.ElementType;
|
|
@@ -1,3 +1,50 @@
|
|
|
1
1
|
import { IconProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Icon - Renders one of the kit's built-in SVG icons by name.
|
|
4
|
+
*
|
|
5
|
+
* `name` is type-checked against the generated icon list, so a typo fails to
|
|
6
|
+
* compile instead of rendering nothing. Browse the full set under
|
|
7
|
+
* "Design System / Icons" in Storybook.
|
|
8
|
+
*
|
|
9
|
+
* ### Accessibility
|
|
10
|
+
* Icons are **decorative by default** — no `tooltip` means no accessible name,
|
|
11
|
+
* which is what you want when the icon sits next to a text label. When the icon
|
|
12
|
+
* is the only content of a control, give it a name: either pass `tooltip`, or
|
|
13
|
+
* put an `aria-label` on the surrounding button.
|
|
14
|
+
*
|
|
15
|
+
* ### Passing `tooltip` changes the markup
|
|
16
|
+
* With `tooltip` the icon is wrapped in a `Tooltip` plus an `inline-flex` span,
|
|
17
|
+
* so it is no longer a bare `<svg>` at that position. If the parent relies on
|
|
18
|
+
* the svg being a direct child (grid placement, `& > svg` selectors), style the
|
|
19
|
+
* wrapper instead — or leave `tooltip` off and use `aria-label`.
|
|
20
|
+
*
|
|
21
|
+
* ### Sizing and colour
|
|
22
|
+
* `size` sets both width and height. `color` paints the glyph and defaults to
|
|
23
|
+
* black; some icons paint with `stroke` rather than `fill`, so to dim an icon
|
|
24
|
+
* prefer `opacity` over recolouring.
|
|
25
|
+
*
|
|
26
|
+
* @category Components
|
|
27
|
+
* @subcategory Display
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* // Decorative — the adjacent text already names the action
|
|
32
|
+
* <Button startIcon={<Icon name="plus" size={16} />} text="Add member" />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Icon-only control: name it, or screen readers announce nothing
|
|
38
|
+
* <Icon name="information" size={16} tooltip="Salary is pre-tax" />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Same accessible name, without the extra wrapper element
|
|
44
|
+
* <button aria-label="Delete row">
|
|
45
|
+
* <Icon name="bin" size={20} />
|
|
46
|
+
* </button>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
2
49
|
declare const Icon: ({ name, color, size, tooltip, ...props }: IconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
50
|
export default Icon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const iconsList: ("visible" | "reset" | "warning" | "h1" | "h2" | "h3" | "bold" | "archive" | "document" | "link" | "menu" | "search" | "arrow-down" | "arrow-up" | "clipboard-assessment" | "attention" | "award" | "ban-user" | "bench" | "bin" | "calendar" | "calendar-schedule" | "carrot-down" | "carrot-left" | "carrot-right" | "carrot-up" | "card-text" | "case" | "certification" | "certification-expiring" | "camera" | "change" | "chart" | "check" | "check-circle" | "check-circle-inverted" | "children" | "circle" | "circular" | "clock" | "cogwheel" | "comments" | "briefcase" | "building" | "compensation" | "confirm-email" | "contacts" | "copy" | "copy-link" | "cross" | "delete" | "diamond-ring" | "diet" | "documents" | "edit" | "education" | "email" | "employee" | "employee-profile" | "employee-terminated" | "employee-blackboard" | "excel-download" | "export" | "file-mark" | "file-pdf" | "file-word" | "filter" | "filter-funnel" | "follow-link" | "fte" | "clipboard-form" | "geography" | "gender" | "gift" | "home" | "import" | "information" | "inventory" | "invisible" | "language" | "lock" | "log-in" | "log-out" | "maximize" | "measurements" | "message" | "minus" | "minus-circle" | "minus-circle-inverted" | "more" | "more-vertical" | "notification" | "office-chair" | "open-book" | "pages" | "party" | "plus" | "plus-circle" | "plus-circle-inverted" | "probation-period" | "profiles-changes" | "radio-on" | "clipboard-report" | "clipboard-result" | "robot" | "roles" | "seniority" | "settings" | "setting-clock" | "signature" | "sleep" | "staff-growth-coefficient" | "staff-turnover-coefficient" | "stats" | "clipboard-summary" | "team" | "clipboard-star" | "time-tracking" | "timeline" | "tennis-ball" | "trainings" | "unarchive" | "union" | "union-circle" | "unlock" | "url" | "user" | "panelLeft" | "panelRight" | "emailOutlined" | "lockOutlined" | "addFolder" | "moveFolder" | "attention-circle" | "zoom" | "zoom-in" | "zoom-out" | "pan" | "box-select" | "lasso-select" | "autoscale" | "reset-axes" | "star" | "preview" | "dashboard" | "phone" | "tablet" | "desktop" | "more-info" | "filter-list" | "history" | "overtime" | "save-2" | "folder" | "salary-reports" | "assessment-stages" | "comments-on-achievements" | "code-review-comments" | "support" | "leave" | "vacation" | "sick-leave" | "day-off" | "arrow-sort" | "dragndrop" | "send" | "save" | "today" | "busket" | "copy-link-2" | "upload" | "picture" | "warning-2" | "info" | "sort-up" | "sort-down" | "italic" | "strikethrough" | "underline" | "markup" | "numbered-list" | "bulleted-list" | "uppercase" | "dash" | "brackets" | "undo" | "redo" | "new-line" | "quotation" | "close-circle-outline" | "close-square-outline" | "close-circle-filled" | "close-square-filled" | "plus-square-outline" | "plus-square-filled" | "minus-square-outline" | "minus-square-filled" | "tick-square-outline" | "tick-square-filled" | "warning-circle-outline" | "warning-square-outline" | "warning-circle-filled" | "warning-square-filled" | "info-square-outline" | "info-square-filled" | "info-circle-filled" | "more-circle-outline" | "more-square-outline" | "more-circle-filled" | "more-square-filled" | "client-feedback" | "expertise" | "responsibilities" | "mobile" | "delivery-address" | "delivery-address-2" | "pdp" | "versions" | "experience" | "projects" | "cooperation-model" | "billable" | "non-billable" | "recruitment-team" | "clear")[];
|
|
1
|
+
export declare const iconsList: ("visible" | "reset" | "warning" | "h1" | "h2" | "h3" | "bold" | "archive" | "document" | "link" | "list" | "menu" | "search" | "arrow-down" | "arrow-up" | "clipboard-assessment" | "attention" | "award" | "ban-user" | "bench" | "bin" | "calendar" | "calendar-schedule" | "carrot-down" | "carrot-left" | "carrot-right" | "carrot-up" | "card-text" | "case" | "certification" | "certification-expiring" | "camera" | "change" | "chart" | "check" | "check-circle" | "check-circle-inverted" | "children" | "circle" | "circular" | "clock" | "cogwheel" | "comments" | "briefcase" | "building" | "compensation" | "confirm-email" | "contacts" | "copy" | "copy-link" | "cross" | "delete" | "diamond-ring" | "diet" | "documents" | "edit" | "education" | "email" | "employee" | "employee-profile" | "employee-terminated" | "employee-blackboard" | "excel-download" | "export" | "file-mark" | "file-pdf" | "file-word" | "filter" | "filter-funnel" | "follow-link" | "fte" | "clipboard-form" | "geography" | "gender" | "gift" | "home" | "import" | "information" | "inventory" | "invisible" | "language" | "lock" | "log-in" | "log-out" | "maximize" | "measurements" | "message" | "minus" | "minus-circle" | "minus-circle-inverted" | "more" | "more-vertical" | "notification" | "office-chair" | "open-book" | "pages" | "party" | "plus" | "plus-circle" | "plus-circle-inverted" | "probation-period" | "profiles-changes" | "radio-on" | "clipboard-report" | "clipboard-result" | "robot" | "roles" | "seniority" | "settings" | "setting-clock" | "signature" | "sleep" | "staff-growth-coefficient" | "staff-turnover-coefficient" | "stats" | "clipboard-summary" | "team" | "clipboard-star" | "time-tracking" | "timeline" | "tennis-ball" | "trainings" | "unarchive" | "union" | "union-circle" | "unlock" | "url" | "user" | "panelLeft" | "panelRight" | "emailOutlined" | "lockOutlined" | "addFolder" | "moveFolder" | "attention-circle" | "zoom" | "zoom-in" | "zoom-out" | "pan" | "box-select" | "lasso-select" | "autoscale" | "reset-axes" | "star" | "preview" | "dashboard" | "phone" | "tablet" | "desktop" | "more-info" | "filter-list" | "history" | "overtime" | "save-2" | "folder" | "salary-reports" | "assessment-stages" | "comments-on-achievements" | "code-review-comments" | "support" | "leave" | "vacation" | "sick-leave" | "day-off" | "arrow-sort" | "dragndrop" | "send" | "save" | "today" | "busket" | "copy-link-2" | "upload" | "picture" | "warning-2" | "info" | "sort-up" | "sort-down" | "italic" | "strikethrough" | "underline" | "markup" | "numbered-list" | "bulleted-list" | "uppercase" | "dash" | "brackets" | "undo" | "redo" | "new-line" | "quotation" | "close-circle-outline" | "close-square-outline" | "close-circle-filled" | "close-square-filled" | "plus-square-outline" | "plus-square-filled" | "minus-square-outline" | "minus-square-filled" | "tick-square-outline" | "tick-square-filled" | "warning-circle-outline" | "warning-square-outline" | "warning-circle-filled" | "warning-square-filled" | "info-square-outline" | "info-square-filled" | "info-circle-filled" | "more-circle-outline" | "more-square-outline" | "more-circle-filled" | "more-square-filled" | "client-feedback" | "expertise" | "responsibilities" | "mobile" | "delivery-address" | "delivery-address-2" | "pdp" | "versions" | "experience" | "projects" | "cooperation-model" | "billable" | "non-billable" | "recruitment-team" | "clear" | "columns")[];
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { iconsList } from './icons/iconsList';
|
|
3
3
|
export interface SVGProps extends React.SVGProps<SVGSVGElement> {
|
|
4
|
+
/** Width and height in px. Icons are square, so one value sets both. */
|
|
4
5
|
size?: number;
|
|
5
6
|
}
|
|
6
7
|
export interface IconProps extends Omit<SVGProps, 'fill'> {
|
|
8
|
+
/**
|
|
9
|
+
* Which icon to render. Type-checked against the generated icon list, so a
|
|
10
|
+
* name that does not exist is a compile error rather than a blank render.
|
|
11
|
+
* Browse the set under "Design System / Icons" in Storybook.
|
|
12
|
+
*/
|
|
7
13
|
name: keyof MapIconsType;
|
|
14
|
+
/**
|
|
15
|
+
* Tooltip text shown on hover. Also becomes the icon's `aria-label`.
|
|
16
|
+
*
|
|
17
|
+
* Opt-in: without it the icon renders as decorative, with no accessible name.
|
|
18
|
+
* Supplying it wraps the icon in an extra inline-flex `span` — see the note on
|
|
19
|
+
* the component about layout impact.
|
|
20
|
+
*/
|
|
8
21
|
tooltip?: string;
|
|
9
22
|
}
|
|
10
23
|
export type MapIconsType = {
|
|
@@ -1,4 +1,98 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Input - Text input component with validation and status indicators
|
|
5
|
+
*
|
|
6
|
+
* A comprehensive text input component with built-in React Hook Form integration,
|
|
7
|
+
* validation states, icon support, helper text, and character counting. Provides
|
|
8
|
+
* visual feedback through status colors and icons, and supports all standard HTML
|
|
9
|
+
* input types.
|
|
10
|
+
*
|
|
11
|
+
* @category Form Controls
|
|
12
|
+
* @subcategory Input
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic usage with React Hook Form
|
|
17
|
+
* const { register } = useForm();
|
|
18
|
+
* <Input
|
|
19
|
+
* name="email"
|
|
20
|
+
* type="email"
|
|
21
|
+
* placeholder="Enter your email"
|
|
22
|
+
* register={register}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Input with validation
|
|
29
|
+
* <Input
|
|
30
|
+
* name="password"
|
|
31
|
+
* type="password"
|
|
32
|
+
* register={register}
|
|
33
|
+
* validationSchema={{
|
|
34
|
+
* required: 'Password is required',
|
|
35
|
+
* minLength: { value: 8, message: 'Must be at least 8 characters' }
|
|
36
|
+
* }}
|
|
37
|
+
* status={errors.password ? 'error' : 'basic'}
|
|
38
|
+
* errors={errors.password}
|
|
39
|
+
* showHelperText
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* // Input with icons and helper text (without React Hook Form)
|
|
46
|
+
* <Input
|
|
47
|
+
* name="search"
|
|
48
|
+
* placeholder="Search products..."
|
|
49
|
+
* startElement={<Icon name="search" />}
|
|
50
|
+
* endElement={<Icon name="clear" onClick={handleClear} />}
|
|
51
|
+
* helperText="Type to search"
|
|
52
|
+
* showHelperText
|
|
53
|
+
* onChange={(e) => handleSearch(e.target.value)}
|
|
54
|
+
* />
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // Input with character count
|
|
60
|
+
* <Input
|
|
61
|
+
* name="bio"
|
|
62
|
+
* placeholder="Tell us about yourself"
|
|
63
|
+
* register={register}
|
|
64
|
+
* maxLength={200}
|
|
65
|
+
* showHelperText
|
|
66
|
+
* helperText="Maximum 200 characters"
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* // Using with Field component
|
|
73
|
+
* <Field.Root status={errors.email ? 'error' : 'basic'}>
|
|
74
|
+
* <Field.Label htmlFor="email">Email</Field.Label>
|
|
75
|
+
* <Field.Control>
|
|
76
|
+
* <Input
|
|
77
|
+
* id="email"
|
|
78
|
+
* name="email"
|
|
79
|
+
* register={register}
|
|
80
|
+
* css={{ width: '100%', border: '0 !important' }}
|
|
81
|
+
* />
|
|
82
|
+
* </Field.Control>
|
|
83
|
+
* <Field.Error>{errors.email?.message}</Field.Error>
|
|
84
|
+
* </Field.Root>
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @see {@link Field} - Use Field.Root to wrap Input for labels and validation
|
|
88
|
+
* @see {@link Textarea} - For multi-line text input
|
|
89
|
+
* @see {@link TextField} - Alternative text input component
|
|
90
|
+
*
|
|
91
|
+
* @accessibility
|
|
92
|
+
* - Full keyboard navigation support
|
|
93
|
+
* - Screen reader friendly with proper labels
|
|
94
|
+
* - ARIA attributes via React Hook Form
|
|
95
|
+
* - Error messages announced to screen readers
|
|
96
|
+
*/
|
|
3
97
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
98
|
export default Input;
|
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOptionProps } from '../DropdownOptions/types';
|
|
3
3
|
import { DropdownProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* MultipleDropdown - Dropdown component for multi-select and single-select
|
|
6
|
+
*
|
|
7
|
+
* A flexible dropdown that lets users select one or more options from a list.
|
|
8
|
+
* In multi-select mode (`isMultiple=true`, default) each option toggles independently;
|
|
9
|
+
* the toggle button shows the first selected value and a `+N` badge for overflow.
|
|
10
|
+
* In single-select mode (`isMultiple=false`) selecting an option closes the menu.
|
|
11
|
+
* Forwards its ref to the root container div.
|
|
12
|
+
*
|
|
13
|
+
* Component structure:
|
|
14
|
+
* - MultipleDropdown (root container with context)
|
|
15
|
+
* - DropdownToggle (button that opens/closes the menu)
|
|
16
|
+
* - MultipleDropdownOptions (menu container rendered when open)
|
|
17
|
+
* - DropdownOption (individual selectable items)
|
|
18
|
+
*
|
|
19
|
+
* @category Form Controls
|
|
20
|
+
* @subcategory Selection
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // Basic multi-select
|
|
25
|
+
* <MultipleDropdown
|
|
26
|
+
* label="Fruits"
|
|
27
|
+
* selectedItems={[{ value: 'apple' }]}
|
|
28
|
+
* onChange={(value, isSelected) => handleChange(value, isSelected)}
|
|
29
|
+
* >
|
|
30
|
+
* <DropdownOption value="apple">Apple</DropdownOption>
|
|
31
|
+
* <DropdownOption value="banana">Banana</DropdownOption>
|
|
32
|
+
* <DropdownOption value="cherry">Cherry</DropdownOption>
|
|
33
|
+
* </MultipleDropdown>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // Single-select mode (closes on pick)
|
|
39
|
+
* <MultipleDropdown
|
|
40
|
+
* label="Country"
|
|
41
|
+
* isMultiple={false}
|
|
42
|
+
* selectedItems={selected}
|
|
43
|
+
* onChange={handleChange}
|
|
44
|
+
* >
|
|
45
|
+
* <DropdownOption value="us">United States</DropdownOption>
|
|
46
|
+
* <DropdownOption value="uk">United Kingdom</DropdownOption>
|
|
47
|
+
* </MultipleDropdown>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Hide placeholder text, only show badge count
|
|
53
|
+
* <MultipleDropdown
|
|
54
|
+
* label="Tags"
|
|
55
|
+
* showPlaceholder={false}
|
|
56
|
+
* selectedItems={tags}
|
|
57
|
+
* onChange={handleChange}
|
|
58
|
+
* >
|
|
59
|
+
* {tags.map(tag => (
|
|
60
|
+
* <DropdownOption key={tag.value} value={tag.value}>{tag.label}</DropdownOption>
|
|
61
|
+
* ))}
|
|
62
|
+
* </MultipleDropdown>
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @see {@link DropdownOption} - Child component for individual options
|
|
66
|
+
* @see {@link DropdownToggle} - Toggle button component
|
|
67
|
+
* @see {@link MultipleDropdownOptions} - Options menu container
|
|
68
|
+
*
|
|
69
|
+
* @accessibility
|
|
70
|
+
* - ARIA attributes set according to WAI-ARIA combobox pattern
|
|
71
|
+
* - Keyboard navigation (Arrow keys, Enter, Escape)
|
|
72
|
+
* - Click outside to close
|
|
73
|
+
* - Screen reader friendly with aria-expanded and aria-controls
|
|
74
|
+
*
|
|
75
|
+
* @see https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html
|
|
76
|
+
*/
|
|
4
77
|
declare const MultipleDropdown: React.ForwardRefExoticComponent<DropdownProps<DropdownOptionProps> & React.RefAttributes<HTMLDivElement>>;
|
|
5
78
|
export default MultipleDropdown;
|
|
@@ -1,2 +1,41 @@
|
|
|
1
1
|
import { WithNestedTableRowProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* WithNestedTableRow - Groups rows into one collapsible unit.
|
|
4
|
+
*
|
|
5
|
+
* Wrap a run of `NestedTableRow` children in it. **Position decides role**: the
|
|
6
|
+
* first child becomes the sub-header that carries the toggle, and the rest are
|
|
7
|
+
* the rows it shows and hides. Renders no markup of its own — it only supplies
|
|
8
|
+
* each child with the group's context — so it is safe between `TableBody` and
|
|
9
|
+
* the rows.
|
|
10
|
+
*
|
|
11
|
+
* A group containing a single row has nothing to toggle, so it renders no icon
|
|
12
|
+
* and ignores `defaultCollapsed` — otherwise it could start collapsed with no
|
|
13
|
+
* way to reopen it.
|
|
14
|
+
*
|
|
15
|
+
* @category Components
|
|
16
|
+
* @subcategory Data Display
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // One group per team; each starts expanded
|
|
21
|
+
* {teams.map((team) => (
|
|
22
|
+
* <WithNestedTableRow key={team.id}>
|
|
23
|
+
* <NestedTableRow>
|
|
24
|
+
* <NestedTableCell>{team.name}</NestedTableCell>
|
|
25
|
+
* </NestedTableRow>
|
|
26
|
+
* {team.members.map((member) => (
|
|
27
|
+
* <NestedTableRow key={member.id}>
|
|
28
|
+
* <NestedTableCell>{member.name}</NestedTableCell>
|
|
29
|
+
* </NestedTableRow>
|
|
30
|
+
* ))}
|
|
31
|
+
* </WithNestedTableRow>
|
|
32
|
+
* ))}
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Collapse just this group, whatever the table default is
|
|
38
|
+
* <WithNestedTableRow defaultCollapsed>{rows}</WithNestedTableRow>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
2
41
|
export declare const WithNestedTableRow: ({ children, defaultCollapsed, }: WithNestedTableRowProps) => import("@emotion/react/jsx-runtime").JSX.Element[] | null | undefined;
|