@knkcs/anker 0.0.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/LICENSE +30 -0
- package/README.md +129 -0
- package/dist/atoms/index.d.ts +536 -0
- package/dist/atoms/index.js +845 -0
- package/dist/atoms/index.js.map +1 -0
- package/dist/avatar-DhqkKdqc.d.ts +29 -0
- package/dist/chunk-4D3EY2W2.js +1628 -0
- package/dist/chunk-4D3EY2W2.js.map +1 -0
- package/dist/chunk-4T32UC26.js +81 -0
- package/dist/chunk-4T32UC26.js.map +1 -0
- package/dist/chunk-FGKGX4UF.js +36 -0
- package/dist/chunk-FGKGX4UF.js.map +1 -0
- package/dist/chunk-PZCL4M6I.js +62 -0
- package/dist/chunk-PZCL4M6I.js.map +1 -0
- package/dist/chunk-QSCNXHMU.js +32 -0
- package/dist/chunk-QSCNXHMU.js.map +1 -0
- package/dist/chunk-RJPEVNMJ.js +23 -0
- package/dist/chunk-RJPEVNMJ.js.map +1 -0
- package/dist/chunk-YXTW5OAJ.js +303 -0
- package/dist/chunk-YXTW5OAJ.js.map +1 -0
- package/dist/components/index.d.ts +413 -0
- package/dist/components/index.js +982 -0
- package/dist/components/index.js.map +1 -0
- package/dist/feedback/index.d.ts +27 -0
- package/dist/feedback/index.js +100 -0
- package/dist/feedback/index.js.map +1 -0
- package/dist/forms/index.d.ts +272 -0
- package/dist/forms/index.js +947 -0
- package/dist/forms/index.js.map +1 -0
- package/dist/number-input-D2X0rWOg.d.ts +18 -0
- package/dist/primitives/index.d.ts +396 -0
- package/dist/primitives/index.js +478 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/search-input-C_Cl2OEx.d.ts +17 -0
- package/dist/switch-B0o6G2XE.d.ts +28 -0
- package/dist/theme/index.d.ts +496 -0
- package/dist/theme/index.js +3 -0
- package/dist/theme/index.js.map +1 -0
- package/package.json +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Copyright (c) 2026 knk Gruppe (https://knk.de/)
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
proprietary property of knk Gruppe and its subsidiaries.
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted to employees and contractors of knk Gruppe and
|
|
9
|
+
its subsidiary companies to use, copy, modify, and distribute the Software
|
|
10
|
+
solely for internal business purposes within the knk group of companies.
|
|
11
|
+
|
|
12
|
+
The following restrictions apply:
|
|
13
|
+
|
|
14
|
+
1. The Software may not be used, copied, modified, merged, published,
|
|
15
|
+
distributed, sublicensed, or sold by any person or entity outside of
|
|
16
|
+
the knk group of companies without prior written consent from knk Gruppe.
|
|
17
|
+
|
|
18
|
+
2. The Software may not be incorporated into products or services offered
|
|
19
|
+
to third parties outside of the knk group of companies.
|
|
20
|
+
|
|
21
|
+
3. This license notice shall be included in all copies or substantial
|
|
22
|
+
portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @knkcs/anker
|
|
2
|
+
|
|
3
|
+
The UI component library for the knk software group. Provides a shared design system, primitives, atoms, form controls, and feedback components across all knkCMS microservices.
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
|
|
7
|
+
- React 19 + TypeScript
|
|
8
|
+
- Chakra UI v3 (theme system, recipes, slot recipes)
|
|
9
|
+
- React Hook Form + Zod (form state + validation)
|
|
10
|
+
- Lucide React (icons)
|
|
11
|
+
- Storybook (documentation)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @knkcs/anker
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Provider } from "@knkcs/anker/primitives";
|
|
23
|
+
|
|
24
|
+
function App() {
|
|
25
|
+
return (
|
|
26
|
+
<Provider>
|
|
27
|
+
<YourApp />
|
|
28
|
+
</Provider>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The `Provider` defaults to anker's theme system. To override with a custom system, pass it via the `system` prop.
|
|
34
|
+
|
|
35
|
+
### Imports by layer
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
// Design tokens and Chakra system
|
|
39
|
+
import system from "@knkcs/anker/theme";
|
|
40
|
+
|
|
41
|
+
// Chakra UI wrappers with consistent defaults
|
|
42
|
+
import { Accordion, Alert, Avatar, Breadcrumb, Menu, Popover, Skeleton, Spinner, Tooltip } from "@knkcs/anker/primitives";
|
|
43
|
+
|
|
44
|
+
// Higher-level composites (card, drawer, modal, pagination, stepper, table, timeline)
|
|
45
|
+
import { Card, Drawer, Modal, Pagination, Stepper, Timeline } from "@knkcs/anker/components";
|
|
46
|
+
|
|
47
|
+
// Small reusable units (persona, badges, search, datetime, clipboard, data list)
|
|
48
|
+
import { StatusBadge, Persona, SearchInput, ClipboardButton, DataList } from "@knkcs/anker/atoms";
|
|
49
|
+
|
|
50
|
+
// Form controls (React Hook Form + Zod)
|
|
51
|
+
import { InputField, ArrayField, FormField } from "@knkcs/anker/forms";
|
|
52
|
+
|
|
53
|
+
// Feedback patterns (confirm modal)
|
|
54
|
+
import { ConfirmModalProvider, useConfirmModal } from "@knkcs/anker/feedback";
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Brand Colors
|
|
58
|
+
|
|
59
|
+
The theme includes both **UI-optimized color scales** (primary, secondary, gray) and **exact brand guideline colors** from the knk Brand Guidelines (October 2021).
|
|
60
|
+
|
|
61
|
+
| Token | HEX | Use |
|
|
62
|
+
|-------|-----|-----|
|
|
63
|
+
| `primary.500` | `#2087d7` | UI blue — buttons, links, focus rings |
|
|
64
|
+
| `secondary.500` | `#e9580c` | UI orange — matches brand orange |
|
|
65
|
+
| `brand.blue` | `#004576` | Exact brand blue — logos, headers, branding |
|
|
66
|
+
| `brand.navy` | `#0f395d` | Dark blue variant |
|
|
67
|
+
| `brand.light-blue` | `#6fa7d1` | Light blue variant |
|
|
68
|
+
| `brand.orange` | `#e9580c` | Brand orange (same as secondary.500) |
|
|
69
|
+
| `brand.gold` | `#f4b235` | Brand gold accent |
|
|
70
|
+
| `brand.light-gray` | `#f2f2f2` | Brand neutral background |
|
|
71
|
+
|
|
72
|
+
The UI primary blue intentionally differs from the brand guideline blue. The brand blue (`#004576`) is a deep navy designed for print materials; the UI blue (`#2087d7`) is brighter for web accessibility and matches the existing Core application.
|
|
73
|
+
|
|
74
|
+
## Notable Component Props
|
|
75
|
+
|
|
76
|
+
| Component | Prop | Description |
|
|
77
|
+
|-----------|------|-------------|
|
|
78
|
+
| `Modal`, `Drawer` | `loading` | Shows spinner on save button during async operations |
|
|
79
|
+
| `Table`, `ArrayField` | `emptyState` | Content to display when there are no items |
|
|
80
|
+
| `Card` | `title`, `header`, `footer` | Slot props for structured card layout |
|
|
81
|
+
| `Persona` | `interactive` | Adds hover state and pointer cursor |
|
|
82
|
+
| `TypeBadge` | `colorPalette` | Chakra color palette for visual differentiation |
|
|
83
|
+
| `FormField` | `description` | Persistent description that shows alongside errors |
|
|
84
|
+
|
|
85
|
+
## Font
|
|
86
|
+
|
|
87
|
+
The theme uses [Inter](https://rsms.me/inter/) as its primary typeface. Install the variable font in your app:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install @fontsource-variable/inter
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then import it in your app entry point:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import "@fontsource-variable/inter";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If Inter is not installed, the theme gracefully falls back to the system font stack (`-apple-system, system-ui, sans-serif`).
|
|
100
|
+
|
|
101
|
+
## Accessibility
|
|
102
|
+
|
|
103
|
+
- **Reduced motion** — The theme globally disables animations and transitions when the user prefers reduced motion (`prefers-reduced-motion: reduce`)
|
|
104
|
+
- **RTL-ready** — All components use logical CSS properties (`marginInlineStart`, `insetInlineEnd`) instead of physical direction properties
|
|
105
|
+
- **Form ARIA** — `FormField` automatically links inputs to helper text and errors via `aria-describedby`, errors are announced with `aria-live="polite"`
|
|
106
|
+
- **Touch targets** — All interactive elements meet the WCAG 44×44px minimum touch target size
|
|
107
|
+
- **Stepper** — Active step uses `aria-current="step"`
|
|
108
|
+
|
|
109
|
+
## Breaking Changes
|
|
110
|
+
|
|
111
|
+
- **FactBox**: The `childs` prop on `FactBoxAction` has been renamed to `items`
|
|
112
|
+
|
|
113
|
+
## Development
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install
|
|
117
|
+
npm run dev # Storybook dev server
|
|
118
|
+
npm run build # Build library with tsup
|
|
119
|
+
npm run lint # Biome
|
|
120
|
+
npm run typecheck # tsc --noEmit
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Documentation
|
|
124
|
+
|
|
125
|
+
Interactive component docs are available at [https://knkcs.github.io/anker/](https://knkcs.github.io/anker/)
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
Proprietary - knk Gruppe. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default, { ReactNode } from 'react';
|
|
4
|
+
import { IconButtonProps, BoxProps, useCheckboxGroup, StackProps, UseCheckboxGroupProps, Clipboard, InputProps, ButtonProps, DataList as DataList$1, HTMLChakraProps, TextProps, BadgeProps } from '@chakra-ui/react';
|
|
5
|
+
import { b as AvatarProps } from '../avatar-DhqkKdqc.js';
|
|
6
|
+
export { S as SearchInput, a as SearchInputProps } from '../search-input-C_Cl2OEx.js';
|
|
7
|
+
import { Props, GroupBase, MultiValue, SingleValue, ActionMeta, SelectInstance, MenuListProps, OptionProps } from 'chakra-react-select';
|
|
8
|
+
export { ActionMeta, Select as ChakraReactSelect, ChakraStylesConfig, CreatableSelect, GroupBase, MenuListProps, MultiValue, OptionProps, SelectInstance, SingleValue, SingleValueProps, StylesConfig, chakraComponents } from 'chakra-react-select';
|
|
9
|
+
|
|
10
|
+
interface ActionProps extends React__default.HTMLAttributes<HTMLButtonElement> {
|
|
11
|
+
cursor?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Action: {
|
|
14
|
+
({ ref, cursor, color, ...props }: ActionProps & {
|
|
15
|
+
ref?: React__default.Ref<HTMLButtonElement>;
|
|
16
|
+
}): react_jsx_runtime.JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
interface CollapseProps extends ActionProps {
|
|
21
|
+
collapsed: boolean;
|
|
22
|
+
/** Accessible label for the collapse button */
|
|
23
|
+
collapseLabel?: string;
|
|
24
|
+
}
|
|
25
|
+
declare const Collapse: {
|
|
26
|
+
({ ref, collapseLabel, ...props }: CollapseProps & {
|
|
27
|
+
ref?: React__default.Ref<HTMLButtonElement>;
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
interface EditProps extends ActionProps {
|
|
33
|
+
/** Accessible label for the edit button */
|
|
34
|
+
editLabel?: string;
|
|
35
|
+
}
|
|
36
|
+
declare const Edit: {
|
|
37
|
+
({ ref, editLabel, ...props }: EditProps & {
|
|
38
|
+
ref?: React__default.Ref<HTMLButtonElement>;
|
|
39
|
+
}): react_jsx_runtime.JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type FilterProps = Omit<IconButtonProps, "aria-label" | "cursor" | "icon"> & {
|
|
44
|
+
activeFilterCount?: number;
|
|
45
|
+
/** Accessible label for the filter button */
|
|
46
|
+
filterLabel?: string;
|
|
47
|
+
};
|
|
48
|
+
declare const Filter: {
|
|
49
|
+
({ ref, filterLabel, ...props }: FilterProps & {
|
|
50
|
+
ref?: React__default.Ref<HTMLButtonElement>;
|
|
51
|
+
}): react_jsx_runtime.JSX.Element;
|
|
52
|
+
displayName: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
interface HandleProps extends ActionProps {
|
|
56
|
+
/** Accessible label for the drag handle */
|
|
57
|
+
handleLabel?: string;
|
|
58
|
+
}
|
|
59
|
+
declare const Handle: {
|
|
60
|
+
({ ref, handleLabel, ...props }: HandleProps & {
|
|
61
|
+
ref?: React__default.Ref<HTMLButtonElement>;
|
|
62
|
+
}): react_jsx_runtime.JSX.Element;
|
|
63
|
+
displayName: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
interface RemoveProps extends ActionProps {
|
|
67
|
+
/** Accessible label for the remove button */
|
|
68
|
+
removeLabel?: string;
|
|
69
|
+
}
|
|
70
|
+
declare const Remove: {
|
|
71
|
+
({ ref, removeLabel, ...props }: RemoveProps & {
|
|
72
|
+
ref?: React__default.Ref<HTMLButtonElement>;
|
|
73
|
+
}): react_jsx_runtime.JSX.Element;
|
|
74
|
+
displayName: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type CheckboxCardGroupProps = StackProps & {
|
|
78
|
+
defaultValue?: UseCheckboxGroupProps["defaultValue"];
|
|
79
|
+
value?: UseCheckboxGroupProps["value"];
|
|
80
|
+
onValueChange?: (value: string[]) => void;
|
|
81
|
+
};
|
|
82
|
+
declare const CheckboxCardGroup: {
|
|
83
|
+
(props: CheckboxCardGroupProps): react_jsx_runtime.JSX.Element;
|
|
84
|
+
displayName: string;
|
|
85
|
+
};
|
|
86
|
+
type CheckboxItemProps = ReturnType<ReturnType<typeof useCheckboxGroup>["getItemProps"]>;
|
|
87
|
+
interface CheckboxCardProps extends BoxProps {
|
|
88
|
+
value: string;
|
|
89
|
+
checkboxProps?: CheckboxItemProps;
|
|
90
|
+
}
|
|
91
|
+
declare const CheckboxCard: {
|
|
92
|
+
(props: CheckboxCardProps): react_jsx_runtime.JSX.Element;
|
|
93
|
+
displayName: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
interface ClipboardButtonProps extends Clipboard.RootProps {
|
|
97
|
+
/** Label for the copy button. @default "Copy" */
|
|
98
|
+
label?: string;
|
|
99
|
+
}
|
|
100
|
+
declare const ClipboardButton: {
|
|
101
|
+
({ ref, ...props }: ClipboardButtonProps & {
|
|
102
|
+
ref?: React$1.Ref<HTMLDivElement>;
|
|
103
|
+
}): react_jsx_runtime.JSX.Element;
|
|
104
|
+
displayName: string;
|
|
105
|
+
};
|
|
106
|
+
interface ClipboardInputProps extends Clipboard.RootProps {
|
|
107
|
+
/** Props passed to the input element. */
|
|
108
|
+
inputProps?: InputProps;
|
|
109
|
+
/** Label for the copy button. @default "Copy" */
|
|
110
|
+
label?: string;
|
|
111
|
+
}
|
|
112
|
+
declare const ClipboardInput: {
|
|
113
|
+
({ ref, ...props }: ClipboardInputProps & {
|
|
114
|
+
ref?: React$1.Ref<HTMLDivElement>;
|
|
115
|
+
}): react_jsx_runtime.JSX.Element;
|
|
116
|
+
displayName: string;
|
|
117
|
+
};
|
|
118
|
+
interface ClipboardLinkProps extends Clipboard.RootProps {
|
|
119
|
+
/** Label for the copy link button. @default "Copy Link" */
|
|
120
|
+
label?: string;
|
|
121
|
+
}
|
|
122
|
+
declare const ClipboardLink: {
|
|
123
|
+
({ ref, ...props }: ClipboardLinkProps & {
|
|
124
|
+
ref?: React$1.Ref<HTMLDivElement>;
|
|
125
|
+
}): react_jsx_runtime.JSX.Element;
|
|
126
|
+
displayName: string;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
type DateType = Date | string | number;
|
|
130
|
+
type DateFormat = "fullWithSeconds" | "full" | "time" | "day" | "weekday";
|
|
131
|
+
|
|
132
|
+
interface CommentProps extends Pick<CommentHeaderProps, "author" | "commentedAt">, CommentFooterProps {
|
|
133
|
+
id?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The element to display as the avatar - generally an Avatar component.
|
|
136
|
+
*/
|
|
137
|
+
avatar: ReactNode;
|
|
138
|
+
/**
|
|
139
|
+
* The main content on the comment.
|
|
140
|
+
*/
|
|
141
|
+
content?: ReactNode;
|
|
142
|
+
/**
|
|
143
|
+
* Nested comments are to be provided as children.
|
|
144
|
+
*/
|
|
145
|
+
children?: ReactNode;
|
|
146
|
+
/**
|
|
147
|
+
* If `true`, the comment will be rendered with a strikethrough.
|
|
148
|
+
*/
|
|
149
|
+
isDeleted?: boolean;
|
|
150
|
+
/** Label shown when the comment has been deleted */
|
|
151
|
+
deletedLabel?: string;
|
|
152
|
+
}
|
|
153
|
+
interface CommentHeaderProps {
|
|
154
|
+
author?: {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
email: string;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The datetime the comment was created.
|
|
161
|
+
*/
|
|
162
|
+
commentedAt?: DateType;
|
|
163
|
+
}
|
|
164
|
+
interface CommentFooterProps {
|
|
165
|
+
/**
|
|
166
|
+
* A list of `CommentAction` items rendered as a row of buttons below the content.
|
|
167
|
+
*/
|
|
168
|
+
actions?: Array<ReactNode>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare const Comment: React__default.FC<CommentProps>;
|
|
172
|
+
interface CommentActionProps extends ButtonProps {
|
|
173
|
+
children: React__default.ReactNode;
|
|
174
|
+
}
|
|
175
|
+
declare const CommentAction: React__default.FC<CommentActionProps>;
|
|
176
|
+
|
|
177
|
+
interface CommentReplyBoxProps {
|
|
178
|
+
onReply: (value: string) => Promise<void>;
|
|
179
|
+
onCancel?: () => void;
|
|
180
|
+
/** Placeholder text for the reply textarea */
|
|
181
|
+
placeholder?: string;
|
|
182
|
+
/** Label for the cancel button */
|
|
183
|
+
cancelLabel?: string;
|
|
184
|
+
/** Label for the reply/submit button */
|
|
185
|
+
replyLabel?: string;
|
|
186
|
+
}
|
|
187
|
+
declare const CommentReplyBox: {
|
|
188
|
+
({ ref, ...props }: CommentReplyBoxProps & {
|
|
189
|
+
ref?: React__default.Ref<HTMLTextAreaElement>;
|
|
190
|
+
}): react_jsx_runtime.JSX.Element;
|
|
191
|
+
displayName: string;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
interface DataListItemType {
|
|
195
|
+
label: React$1.ReactNode;
|
|
196
|
+
value: React$1.ReactNode;
|
|
197
|
+
}
|
|
198
|
+
interface DataListProps extends DataList$1.RootProps {
|
|
199
|
+
/** Items to render as label-value pairs. If provided, renders automatically. */
|
|
200
|
+
items?: DataListItemType[];
|
|
201
|
+
}
|
|
202
|
+
declare const DataList: {
|
|
203
|
+
({ ref, ...props }: DataListProps & {
|
|
204
|
+
ref?: React$1.Ref<HTMLDListElement>;
|
|
205
|
+
}): react_jsx_runtime.JSX.Element;
|
|
206
|
+
displayName: string;
|
|
207
|
+
};
|
|
208
|
+
declare const DataListItem: React$1.ForwardRefExoticComponent<DataList$1.ItemProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
209
|
+
declare const DataListItemLabel: React$1.ForwardRefExoticComponent<DataList$1.ItemLabelProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
210
|
+
declare const DataListItemValue: React$1.ForwardRefExoticComponent<DataList$1.ItemValueProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
211
|
+
type DataListRootProps = DataList$1.RootProps;
|
|
212
|
+
|
|
213
|
+
interface DateInputProps extends Omit<InputProps, "type" | "value" | "onChange"> {
|
|
214
|
+
/** The date value as an ISO date string (YYYY-MM-DD) or ISO datetime string */
|
|
215
|
+
value?: string;
|
|
216
|
+
/** Called when the date value changes */
|
|
217
|
+
onChange?: (e: React__default.ChangeEvent<HTMLInputElement>) => void;
|
|
218
|
+
/** Minimum date in YYYY-MM-DD format */
|
|
219
|
+
minDate?: string;
|
|
220
|
+
/** Maximum date in YYYY-MM-DD format */
|
|
221
|
+
maxDate?: string;
|
|
222
|
+
}
|
|
223
|
+
declare const DateInput: {
|
|
224
|
+
({ ref, ...props }: DateInputProps & {
|
|
225
|
+
ref?: React__default.Ref<HTMLInputElement>;
|
|
226
|
+
}): react_jsx_runtime.JSX.Element;
|
|
227
|
+
displayName: string;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
interface RelativeDateTimeProps {
|
|
231
|
+
/**
|
|
232
|
+
* The date that will be displayed. It accepts a JS Date, an ISO8601 Timestamp string, or Unix Epoch Milliseconds number
|
|
233
|
+
*/
|
|
234
|
+
date: DateType;
|
|
235
|
+
/**
|
|
236
|
+
* If a value is passed to baseDate, then the component will compare both dates and return the time between them.
|
|
237
|
+
* If no value is passed then the date will be compared to "now"
|
|
238
|
+
*
|
|
239
|
+
* @default "Now"
|
|
240
|
+
*/
|
|
241
|
+
baseDate?: DateType;
|
|
242
|
+
/**
|
|
243
|
+
* Sets the date to be relative only if it is in the current week
|
|
244
|
+
* @default false
|
|
245
|
+
*/
|
|
246
|
+
isRelativeToCurrentWeek?: boolean;
|
|
247
|
+
}
|
|
248
|
+
declare const RelativeDateTime: React__default.FC<RelativeDateTimeProps>;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* A function that will return a formatted date string. The format will depend on the option
|
|
252
|
+
* passed in the second argument.
|
|
253
|
+
* By default, it will return a string with "full" format (e.g. Tue, 17 Aug 2021 at 3:45 PM)
|
|
254
|
+
*
|
|
255
|
+
* @param date - the date to be formatted
|
|
256
|
+
* @param format - the desired format ("full", "day", "weekday", or "time")
|
|
257
|
+
* @returns a formatted date
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* formatDateAndTime('2021-08-17T15:45:00') // returns "Tue, 17 Aug 2021 at 3:45 PM"
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* formatDateAndTime('2021-08-17T15:45:00', 'day') // returns "17 Aug 2021"
|
|
264
|
+
*/
|
|
265
|
+
declare function formatDateAndTime(date: DateType, format?: DateFormat): string;
|
|
266
|
+
/**
|
|
267
|
+
* A function that will return a machine-readable date string that should be passed to the `datetime` attribute of a `<time>` tag
|
|
268
|
+
* By default, it will return a string with "YYYY-MM-DDTHH:mm:ss.SSS[Z]" format
|
|
269
|
+
*
|
|
270
|
+
* @param date - the date to be formatted
|
|
271
|
+
* @param format - the desired format ("full", "day", "weekday", or "time")
|
|
272
|
+
* @returns a formatted date
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* formatMachineReadableDateTime(date) // returns 2019-08-13T10:00:00.000Z
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* formatMachineReadableDateTime(date, 'day') // returns 2019-08-13
|
|
279
|
+
*/
|
|
280
|
+
declare function formatMachineReadableDateTime(date: DateType, format?: DateFormat): string;
|
|
281
|
+
/**
|
|
282
|
+
* @example
|
|
283
|
+
* > formatDate(date)
|
|
284
|
+
* 13 Aug 2019
|
|
285
|
+
*/
|
|
286
|
+
declare const formatDate: (date: DateType) => string;
|
|
287
|
+
/**
|
|
288
|
+
* @example
|
|
289
|
+
* > formatTime(date)
|
|
290
|
+
* 8:00 AM
|
|
291
|
+
*/
|
|
292
|
+
declare const formatTime: (date: DateType) => string;
|
|
293
|
+
/**
|
|
294
|
+
* @example
|
|
295
|
+
* > formatWeekdayDate(date)
|
|
296
|
+
* Mon, 12 Aug
|
|
297
|
+
*/
|
|
298
|
+
declare const formatWeekdayDate: (date: DateType) => string;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* A function that will return a string with how far a given date is in the past or future,
|
|
302
|
+
* using a baseDate as reference. If the baseDate is not passed, the function will use today as reference.
|
|
303
|
+
*
|
|
304
|
+
* @param date - the date to be formatted
|
|
305
|
+
* @param baseDate - the date that should be used as a reference (default is "today")
|
|
306
|
+
* @returns a relative date
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* // Considering today as 18.08.2021
|
|
310
|
+
* formatRelativeDateTime('2021-08-17T15:45:00') // returns "a day ago"
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* formatRelativeDateTime('2021-08-17T15:45:00', '2021-08-16') // returns "in a day"
|
|
314
|
+
*/
|
|
315
|
+
declare function formatRelativeDateTime(date: DateType, baseDate?: DateType): string;
|
|
316
|
+
/**
|
|
317
|
+
* A function that formats a date relative to Today or to the `baseDate` if passed.
|
|
318
|
+
* If the date is not today, it will return a string with "Yesterday ...", "Tomorrow ...", etc
|
|
319
|
+
* If the date is not in the current week, it return a string with "DD MMM YYYY" format
|
|
320
|
+
* If the date is today, it will return a string with "... ago" or "in ..."
|
|
321
|
+
*
|
|
322
|
+
* @param date - the date to be formatted
|
|
323
|
+
* @param baseDate - the date that should be used as a reference (default is "today")
|
|
324
|
+
* @returns a relative date
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* // Considering today as 18.08.2021
|
|
328
|
+
* formatRelativeToCurrentWeekDateTime('2021-08-17T15:45:00') // returns "Yesterday at 3:45 PM"
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* formatRelativeToCurrentWeekDateTime('2021-08-17T15:45:00', '2021-08-16') // returns "Tomorrow at 3:45 PM"
|
|
332
|
+
*/
|
|
333
|
+
declare function formatRelativeToCurrentWeekDateTime(date: DateType, baseDate?: DateType): string;
|
|
334
|
+
|
|
335
|
+
interface EmptyStateProps {
|
|
336
|
+
/** Main heading text. */
|
|
337
|
+
header: string;
|
|
338
|
+
/** Description text or rich content. */
|
|
339
|
+
description?: React__default.ReactNode;
|
|
340
|
+
/** Optional icon displayed above the heading. */
|
|
341
|
+
icon?: React__default.ReactNode;
|
|
342
|
+
/** Optional action buttons below the description. */
|
|
343
|
+
actions?: React__default.ReactNode;
|
|
344
|
+
}
|
|
345
|
+
declare const EmptyState: React__default.FC<EmptyStateProps>;
|
|
346
|
+
|
|
347
|
+
interface PersonaProps {
|
|
348
|
+
/**
|
|
349
|
+
* The name of the person in the avatar.
|
|
350
|
+
*
|
|
351
|
+
* - if `src` has loaded, the name will be used as the `alt` attribute of the `img`
|
|
352
|
+
* - If `src` is not loaded, the name will be used to create the initials
|
|
353
|
+
*/
|
|
354
|
+
name?: string;
|
|
355
|
+
/**
|
|
356
|
+
* Primary label of the persona, defaults to the name
|
|
357
|
+
*/
|
|
358
|
+
label?: React__default.ReactNode;
|
|
359
|
+
/**
|
|
360
|
+
* Hide the persona details next to the avatar.
|
|
361
|
+
*/
|
|
362
|
+
hideDetails?: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* The size of the persona, from 2xs to 2xl.
|
|
365
|
+
*/
|
|
366
|
+
size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
367
|
+
/**
|
|
368
|
+
* When true, adds hover styling and pointer cursor for clickable personas.
|
|
369
|
+
*/
|
|
370
|
+
interactive?: boolean;
|
|
371
|
+
}
|
|
372
|
+
interface PersonaStyles {
|
|
373
|
+
container?: React__default.CSSProperties;
|
|
374
|
+
details?: React__default.CSSProperties;
|
|
375
|
+
label?: React__default.CSSProperties;
|
|
376
|
+
}
|
|
377
|
+
declare const Persona: React__default.FC<PersonaProps>;
|
|
378
|
+
interface PersonaContainerProps extends HTMLChakraProps<"div"> {
|
|
379
|
+
children: React__default.ReactNode;
|
|
380
|
+
/**
|
|
381
|
+
* Optional style overrides passed down to child components via context.
|
|
382
|
+
*/
|
|
383
|
+
styles?: PersonaStyles;
|
|
384
|
+
/**
|
|
385
|
+
* When true, adds hover styling and pointer cursor for clickable personas.
|
|
386
|
+
*/
|
|
387
|
+
interactive?: boolean;
|
|
388
|
+
}
|
|
389
|
+
declare const PersonaContainer: ({ ref, ...props }: PersonaContainerProps & {
|
|
390
|
+
ref?: React__default.Ref<HTMLDivElement>;
|
|
391
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
392
|
+
interface PersonaAvatarOptions extends Pick<PersonaProps, "name" | "size"> {
|
|
393
|
+
}
|
|
394
|
+
interface PersonaAvatarProps extends PersonaAvatarOptions, Omit<AvatarProps, "size"> {
|
|
395
|
+
}
|
|
396
|
+
declare const PersonaAvatar: ({ ref, ...props }: PersonaAvatarProps & {
|
|
397
|
+
ref?: React__default.Ref<HTMLDivElement>;
|
|
398
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
399
|
+
declare const PersonaDetails: ({ ref, ...props }: HTMLChakraProps<"div"> & {
|
|
400
|
+
ref?: React__default.Ref<HTMLDivElement>;
|
|
401
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
402
|
+
declare const PersonaLabel: ({ ref, ...props }: HTMLChakraProps<"span"> & {
|
|
403
|
+
ref?: React__default.Ref<HTMLSpanElement>;
|
|
404
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
405
|
+
|
|
406
|
+
interface BaseOption {
|
|
407
|
+
id: string;
|
|
408
|
+
label: string;
|
|
409
|
+
avatar?: string;
|
|
410
|
+
color?: string;
|
|
411
|
+
icon?: React.ReactNode;
|
|
412
|
+
data?: Record<string, unknown>;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
interface BaseSelectProps<T extends BaseOption> extends Omit<Props<T, boolean, GroupBase<T>>, "value" | "onChange" | "isLoading" | "isDisabled"> {
|
|
416
|
+
value: T | T[] | null;
|
|
417
|
+
onChange?: (newValue: MultiValue<T> | SingleValue<T>, actionMeta: ActionMeta<T>) => void;
|
|
418
|
+
loading?: boolean;
|
|
419
|
+
disabled?: boolean;
|
|
420
|
+
}
|
|
421
|
+
declare const BaseSelect: <T extends BaseOption>({ ref, value, onChange, options, isMulti, loading, disabled, isClearable, placeholder, menuPortalTarget, variant, styles, ...restSelectProps }: BaseSelectProps<T> & {
|
|
422
|
+
ref?: React__default.Ref<SelectInstance<T, boolean, GroupBase<T>>>;
|
|
423
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
424
|
+
|
|
425
|
+
interface TableMenuColumn {
|
|
426
|
+
key: string;
|
|
427
|
+
header: string;
|
|
428
|
+
width?: string;
|
|
429
|
+
}
|
|
430
|
+
interface TableMenuListProps<T extends BaseOption> extends MenuListProps<T, boolean, GroupBase<T>> {
|
|
431
|
+
columns?: TableMenuColumn[];
|
|
432
|
+
/** Minimum width of the table menu. Defaults to "400px" */
|
|
433
|
+
minWidth?: string;
|
|
434
|
+
/** Maximum width of the table menu. Defaults to "600px" */
|
|
435
|
+
maxWidth?: string;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* A custom MenuList component that renders options as table rows.
|
|
439
|
+
*
|
|
440
|
+
* Use with BaseSelect by passing it via the `components` prop:
|
|
441
|
+
* ```tsx
|
|
442
|
+
* <BaseSelect
|
|
443
|
+
* components={{
|
|
444
|
+
* MenuList: (props) => (
|
|
445
|
+
* <TableMenuList
|
|
446
|
+
* {...props}
|
|
447
|
+
* columns={[
|
|
448
|
+
* { key: "label", header: "Name" },
|
|
449
|
+
* { key: "valid_from", header: "Valid From" },
|
|
450
|
+
* ]}
|
|
451
|
+
* />
|
|
452
|
+
* ),
|
|
453
|
+
* Option: TableOption,
|
|
454
|
+
* }}
|
|
455
|
+
* />
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
declare const TableMenuList: <T extends BaseOption>({ children, columns, minWidth, maxWidth, ...props }: TableMenuListProps<T>) => react_jsx_runtime.JSX.Element;
|
|
459
|
+
/**
|
|
460
|
+
* A custom Option component that renders as a table row.
|
|
461
|
+
* Use together with TableMenuList.
|
|
462
|
+
*/
|
|
463
|
+
declare const TableOption: <T extends BaseOption>({ data, innerProps, isSelected, isFocused, columns, }: OptionProps<T, boolean, GroupBase<T>> & {
|
|
464
|
+
columns?: TableMenuColumn[];
|
|
465
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
466
|
+
interface CreateTableMenuComponentsOptions {
|
|
467
|
+
columns: TableMenuColumn[];
|
|
468
|
+
/** Minimum width of the table menu. Defaults to "400px" */
|
|
469
|
+
minWidth?: string;
|
|
470
|
+
/** Maximum width of the table menu. Defaults to "600px" */
|
|
471
|
+
maxWidth?: string;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Helper to create table menu components with predefined columns.
|
|
475
|
+
*
|
|
476
|
+
* Usage:
|
|
477
|
+
* ```tsx
|
|
478
|
+
* const { MenuList, Option } = createTableMenuComponents({
|
|
479
|
+
* columns: [
|
|
480
|
+
* { key: "label", header: "Release" },
|
|
481
|
+
* { key: "valid_from", header: "Valid From" },
|
|
482
|
+
* { key: "valid_until", header: "Valid Until" },
|
|
483
|
+
* ],
|
|
484
|
+
* minWidth: "500px",
|
|
485
|
+
* maxWidth: "800px",
|
|
486
|
+
* });
|
|
487
|
+
*
|
|
488
|
+
* <BaseSelect components={{ MenuList, Option }} />
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
declare const createTableMenuComponents: <T extends BaseOption>(options: CreateTableMenuComponentsOptions) => {
|
|
492
|
+
MenuList: (props: MenuListProps<T, boolean, GroupBase<T>>) => react_jsx_runtime.JSX.Element;
|
|
493
|
+
Option: (props: OptionProps<T, boolean, GroupBase<T>>) => react_jsx_runtime.JSX.Element;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
interface StatProps extends BoxProps {
|
|
497
|
+
/** An icon element rendered as React node (e.g., a lucide-react icon) */
|
|
498
|
+
icon?: React__default.ReactNode;
|
|
499
|
+
label: string;
|
|
500
|
+
value?: React__default.ReactNode;
|
|
501
|
+
loading?: boolean;
|
|
502
|
+
}
|
|
503
|
+
declare const Stat: React__default.FC<StatProps>;
|
|
504
|
+
|
|
505
|
+
interface StatusBadgeProps {
|
|
506
|
+
/** The display label for the badge */
|
|
507
|
+
label: string;
|
|
508
|
+
/** The background color for the badge (hex format, e.g. "#ff0000") */
|
|
509
|
+
color: string;
|
|
510
|
+
}
|
|
511
|
+
declare const StatusBadge: React__default.FC<StatusBadgeProps>;
|
|
512
|
+
|
|
513
|
+
interface TextInputProps extends InputProps {
|
|
514
|
+
append?: string | React__default.ReactElement;
|
|
515
|
+
prepend?: string | React__default.ReactElement;
|
|
516
|
+
}
|
|
517
|
+
declare const TextInput: {
|
|
518
|
+
({ ref, ...props }: TextInputProps & {
|
|
519
|
+
ref?: React__default.Ref<HTMLInputElement>;
|
|
520
|
+
}): react_jsx_runtime.JSX.Element;
|
|
521
|
+
displayName: string;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
interface TextOverflowProps extends TextProps {
|
|
525
|
+
}
|
|
526
|
+
declare const TextOverflow: React.FC<TextOverflowProps>;
|
|
527
|
+
|
|
528
|
+
interface TypeBadgeProps extends Omit<BadgeProps, "children"> {
|
|
529
|
+
/** Display name for the badge. */
|
|
530
|
+
name: string;
|
|
531
|
+
/** Chakra color palette for visual differentiation. @default "gray" */
|
|
532
|
+
colorPalette?: string;
|
|
533
|
+
}
|
|
534
|
+
declare const TypeBadge: React__default.FC<TypeBadgeProps>;
|
|
535
|
+
|
|
536
|
+
export { Action, type ActionProps, type BaseOption, BaseSelect, type BaseSelectProps, CheckboxCard, CheckboxCardGroup, type CheckboxCardGroupProps, type CheckboxCardProps, ClipboardButton, type ClipboardButtonProps, ClipboardInput, type ClipboardInputProps, ClipboardLink, type ClipboardLinkProps, Collapse, type CollapseProps, Comment, CommentAction, type CommentActionProps, type CommentFooterProps, type CommentHeaderProps, type CommentProps, CommentReplyBox, type CommentReplyBoxProps, type CreateTableMenuComponentsOptions, DataList, DataListItem, DataListItemLabel, type DataListItemType, DataListItemValue, type DataListProps, type DataListRootProps, type DateFormat, DateInput, type DateInputProps, type DateType, Edit, type EditProps, EmptyState, type EmptyStateProps, Filter, type FilterProps, Handle, type HandleProps, Persona, PersonaAvatar, PersonaContainer, type PersonaContainerProps, PersonaDetails, PersonaLabel, type PersonaProps, RelativeDateTime, type RelativeDateTimeProps, Remove, type RemoveProps, Stat, type StatProps, StatusBadge, type StatusBadgeProps, type TableMenuColumn, TableMenuList, type TableMenuListProps, TableOption, TextInput, type TextInputProps, TextOverflow, type TextOverflowProps, TypeBadge, type TypeBadgeProps, createTableMenuComponents, formatDate, formatDateAndTime, formatMachineReadableDateTime, formatRelativeDateTime, formatRelativeToCurrentWeekDateTime, formatTime, formatWeekdayDate };
|