@epam/ai-dial-ui-kit 0.13.0-dev.36 → 0.13.0-dev.38
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/README.md +37 -0
- package/dist/CHANGELOG.md +21 -1
- package/dist/{JsonEditor-uaD4I-X4.js → JsonEditor-C7Ju3tYQ.js} +1 -1
- package/dist/{JsonEditor-BRMa8EN8.cjs → JsonEditor-JuYiu0du.cjs} +1 -1
- package/dist/{MarkdownEditor-BJQO7jX1.js → MarkdownEditor-COfaQmul.js} +1 -1
- package/dist/{MarkdownEditor-qDpk4B9N.cjs → MarkdownEditor-VVlZWVT0.cjs} +1 -1
- package/dist/components-manifest.json +45 -37
- package/dist/dial-ui-kit.cjs.js +1 -1
- package/dist/dial-ui-kit.es.js +147 -141
- package/dist/{index-CXHuiXU5.js → index-BzcHqY_z.js} +9103 -8721
- package/dist/{index-DKlPLHlI.cjs → index-CaYk1EBk.cjs} +31 -31
- package/dist/index.css +2 -2
- package/dist/migration-guides/0.13.0/focus-border-token-rename.md +106 -0
- package/dist/migration-guides/0.13.0/spinner-dial-prefix-removal.md +69 -0
- package/dist/migration-guides/README.md +2 -0
- package/dist/src/components/FabButton/FabButton.d.ts +4 -0
- package/dist/src/components/IconButton/IconButton.d.ts +4 -0
- package/dist/src/components/New/Button/Button.d.ts +5 -0
- package/dist/src/components/New/ButtonDropdown/constants.d.ts +1 -2
- package/dist/src/components/New/Calendar/constants.d.ts +2 -2
- package/dist/src/components/New/Calendar/utils.d.ts +10 -0
- package/dist/src/components/New/Calendar/utils.spec.d.ts +1 -0
- package/dist/src/components/New/CaptionText/CaptionText.d.ts +20 -0
- package/dist/src/components/New/FolderPath/FolderPath.d.ts +4 -0
- package/dist/src/components/New/IconButton/IconButton.d.ts +4 -0
- package/dist/src/components/New/InfoButton/InfoButton.d.ts +25 -0
- package/dist/src/components/New/InfoButton/InfoButton.stories.d.ts +11 -0
- package/dist/src/components/New/InlineSelect/InlineSelect.d.ts +5 -0
- package/dist/src/components/New/Input/Button/InputButton.d.ts +25 -0
- package/dist/src/components/New/Input/Button/constants.d.ts +1 -0
- package/dist/src/components/New/Input/Input.d.ts +51 -0
- package/dist/src/components/New/Input/utils.d.ts +2 -0
- package/dist/src/components/New/Label/Label.d.ts +32 -0
- package/dist/src/components/New/Notification/Notification.d.ts +6 -0
- package/dist/src/components/New/Notification/constants.d.ts +11 -0
- package/dist/src/components/New/Textarea/Textarea.d.ts +38 -0
- package/dist/src/components/Spinner/Spinner.d.ts +2 -2
- package/dist/src/index.d.ts +12 -2
- package/dist/src/utils/__tests__/accessible-name.spec.d.ts +1 -0
- package/dist/src/utils/accessible-name.d.ts +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface InfoButtonProps {
|
|
3
|
+
caption?: string;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
'aria-label'?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* An Info button component with a customizable icon and accessible label.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <InfoButton
|
|
13
|
+
* caption="Info"
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* The button is icon-only, so it needs an accessible name. `caption` is used as
|
|
18
|
+
* the name because a tooltip alone never reaches assistive tech — pass a short
|
|
19
|
+
* `aria-label` when the caption is a long sentence.
|
|
20
|
+
*
|
|
21
|
+
* @param [caption] - Text shown in the tooltip, and the fallback accessible name
|
|
22
|
+
* @param [onClick] - Click handler for the info button
|
|
23
|
+
* @param [aria-label] - Accessible name; takes precedence over `caption`
|
|
24
|
+
*/
|
|
25
|
+
export declare const InfoButton: FC<InfoButtonProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { InfoButton } from './InfoButton';
|
|
3
|
+
declare const meta: Meta<typeof InfoButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
/**
|
|
8
|
+
* A long caption still works as a tooltip, but a short `aria-label` keeps the
|
|
9
|
+
* announced name scannable.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ExplicitAccessibleName: Story;
|
|
@@ -30,6 +30,11 @@ export interface InlineSelectProps {
|
|
|
30
30
|
matchReferenceWidth?: boolean;
|
|
31
31
|
/** Additional CSS classes applied to the dropdown overlay. */
|
|
32
32
|
listClassName?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Accessible name for the trigger. Without it the control announces only its
|
|
35
|
+
* current value ("Option A"), never what is being selected.
|
|
36
|
+
*/
|
|
37
|
+
ariaLabel?: string;
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* An inline select control combining `InlineSelectTrigger` with `DialDropdown`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { ElementSize } from '../../../../types/size';
|
|
3
|
+
export interface InputButtonProps {
|
|
4
|
+
icon: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
size?: ElementSize;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* An Input button component with a customizable icon and accessible label.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <InputButton
|
|
16
|
+
* icon={<IconInfoCircle size={16} />}
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param [icon] - Icon to display inside the input button
|
|
21
|
+
* @param [onClick] - Click handler for the info button
|
|
22
|
+
* @param [disabled] - Whether the button is disabled
|
|
23
|
+
* @param [size] - Size of the input button, which adjusts the icon size and padding. Uses the {@link ElementSize} enum.
|
|
24
|
+
*/
|
|
25
|
+
export declare const InputButton: FC<InputButtonProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const inputButtonClassName = "bg-layer-4 flex items-center justify-center enabled:text-secondary enabled:hover:text-accent-primary enabled:active:bg-controls-accent-primary-alpha-active enabled:hover:bg-accent-primary-alpha enabled:active:text-accent-primary";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { FC, InputHTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
import { DialLabelProps } from '../../Label/Label';
|
|
3
|
+
import { ElementSize } from '../../../types/size';
|
|
4
|
+
import { InputButtonProps } from './Button/InputButton';
|
|
5
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size'> {
|
|
6
|
+
labelProps?: DialLabelProps;
|
|
7
|
+
inputButtonProps?: InputButtonProps;
|
|
8
|
+
size?: ElementSize;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
caption?: string;
|
|
12
|
+
tooltipText?: string;
|
|
13
|
+
iconBefore?: ReactNode;
|
|
14
|
+
iconAfter?: ReactNode;
|
|
15
|
+
prefix?: string;
|
|
16
|
+
postfix?: string;
|
|
17
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
18
|
+
onChange?: (value?: string) => void;
|
|
19
|
+
containerClassName?: string;
|
|
20
|
+
wrapperClassName?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A flexible input component with icon support and various styling options
|
|
24
|
+
* aliases: TextField|FormInput
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Input
|
|
29
|
+
* id="search"
|
|
30
|
+
* placeholder="Search..."
|
|
31
|
+
* iconBefore={<SearchIcon />}
|
|
32
|
+
* iconAfter={<ClearIcon />}
|
|
33
|
+
* onChange={(value) => console.log(value)}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param [size=ElementSize.Standard] - The size of the input, which can be 'small', 'standard', or 'large'.
|
|
38
|
+
* @param [invalid] - Whether the input has validation errors (applies error styling)
|
|
39
|
+
* @param [iconAfter] - Icon or element to display after the input
|
|
40
|
+
* @param [iconBefore] - Icon or element to display before the input
|
|
41
|
+
* @param [textBeforeInput] - Text to display before the input
|
|
42
|
+
* @param [suffix] - Text to display inside the input on the right
|
|
43
|
+
* @param [containerClassName] - Additional CSS classes to apply to the container div
|
|
44
|
+
* @param [wrapperClassName] - Additional CSS classes to apply to the input wrapper div
|
|
45
|
+
* @param [className] - Additional CSS classes to apply to the input element
|
|
46
|
+
* @param [inputRef] - Ref to access the underlying input element
|
|
47
|
+
* @param [error] - Error message to display below the input (also adds error styling)
|
|
48
|
+
* @param [caption] - Helper text to display below the input
|
|
49
|
+
* @param [onChange] - Callback function called when the input value changes
|
|
50
|
+
*/
|
|
51
|
+
export declare const Input: FC<InputProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC, LabelHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ElementSize } from '../../../types/size';
|
|
3
|
+
type NativeLabelProps = Omit<LabelHTMLAttributes<HTMLLabelElement>, 'children' | 'defaultValue' | 'onChange'>;
|
|
4
|
+
export interface LabelProps extends NativeLabelProps {
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
caption?: string;
|
|
8
|
+
size?: ElementSize;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A label component
|
|
12
|
+
* aliases: FormLabel|RequiredIndicator
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic label
|
|
17
|
+
* <Label htmlFor="email-input" label="Email Address" />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Pass `htmlFor` with the id of the control this labels — without it the label
|
|
21
|
+
* names nothing. The `caption` info button renders as a sibling of the `<label>`
|
|
22
|
+
* rather than inside it: a button nested in a label forwards its clicks to the
|
|
23
|
+
* labelled control and leaks its own text into that control's accessible name.
|
|
24
|
+
*
|
|
25
|
+
* @param [label] - The label text to display for the label
|
|
26
|
+
* @param [required=false] - Whether the field is required. Renders a visual `*`
|
|
27
|
+
* plus visually hidden text so the requirement is announced too.
|
|
28
|
+
* @param [caption] - Explanatory text, exposed through an info button next to the label
|
|
29
|
+
* @param [size] - The size of the label, which can be 'small', 'medium', or 'large'.
|
|
30
|
+
*/
|
|
31
|
+
export declare const Label: FC<LabelProps>;
|
|
32
|
+
export {};
|
|
@@ -18,6 +18,12 @@ export interface NotificationProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
18
18
|
* Renders a colored container with an icon, message text, and an optional
|
|
19
19
|
* close button.
|
|
20
20
|
*
|
|
21
|
+
* The container is a live region whose politeness follows the variant: `error`
|
|
22
|
+
* and `warning` use `role="alert"` (assertive, interrupts the screen reader),
|
|
23
|
+
* every other variant uses `role="status"` (polite, queues). Pass an explicit
|
|
24
|
+
* `role` to override — including for a notification that is static page content
|
|
25
|
+
* rather than an update.
|
|
26
|
+
*
|
|
21
27
|
* @example
|
|
22
28
|
* ```tsx
|
|
23
29
|
* <Notification
|
|
@@ -5,4 +5,15 @@ export declare const variantIcons: (props: {
|
|
|
5
5
|
stroke: number;
|
|
6
6
|
}) => Record<NotificationVariant, ReactNode>;
|
|
7
7
|
export declare const notificationVariantClassNameMap: Record<NotificationVariant, string>;
|
|
8
|
+
/**
|
|
9
|
+
* Live-region role per variant.
|
|
10
|
+
*
|
|
11
|
+
* `role="alert"` is implicitly `aria-live="assertive"`: it interrupts whatever a
|
|
12
|
+
* screen reader is currently saying. That is right for a problem the user must
|
|
13
|
+
* deal with, and wrong for routine feedback — an assertive info or success
|
|
14
|
+
* message cuts the user off mid-sentence, and a section message rendered with
|
|
15
|
+
* the page announces itself on mount even though nothing changed.
|
|
16
|
+
* `role="status"` is polite and queues instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare const notificationVariantRoleMap: Record<NotificationVariant, 'alert' | 'status'>;
|
|
8
19
|
export declare const alertBaseClassName = "items-center justify-between rounded-xl relative gap-3 p-3 border flex border-transparent";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DetailedHTMLProps, FC, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { DialLabelProps } from '../../Label/Label';
|
|
3
|
+
export interface TextareaProps extends DetailedHTMLProps<Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'>, HTMLTextAreaElement> {
|
|
4
|
+
labelProps?: DialLabelProps;
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
containerClassName?: string;
|
|
7
|
+
resize?: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
caption?: string;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A flexible textarea component with validation support and consistent styling
|
|
14
|
+
* aliases: MultilineInput|TextBox
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <DialTextarea
|
|
19
|
+
* id="description"
|
|
20
|
+
* placeholder="Enter description..."
|
|
21
|
+
* value={value}
|
|
22
|
+
* onChange={(value) => setValue(value)}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
* @params Component properties extending:
|
|
26
|
+
* - {@link TextareaHTMLAttributes<HTMLTextAreaElement>} - Standard textarea attributes (id, value, placeholder, disabled, etc.)
|
|
27
|
+
* - {@link HTMLTextAreaElement} - The underlying HTML textarea element type
|
|
28
|
+
*
|
|
29
|
+
* @param [onChange] - Callback function called when the textarea value changes
|
|
30
|
+
* @param [labelProps] - Props for the field label, including `label` (label text) and `required` (whether to show required indicator)
|
|
31
|
+
* @param [className=""] - Additional CSS classes to apply to the textarea element
|
|
32
|
+
* @param [containerClassName=""] - Additional CSS classes to apply to the container div
|
|
33
|
+
* @param [invalid=false] - Whether the textarea has validation errors (applies error styling)
|
|
34
|
+
* @param [resize=false] - Whether the textarea has possibility to resize
|
|
35
|
+
* @param [error] - Error message to display below the textarea (also adds error styling)
|
|
36
|
+
* @param [caption] - Optional caption text to display below the textarea
|
|
37
|
+
*/
|
|
38
|
+
export declare const Textarea: FC<TextareaProps>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface SpinnerProps {
|
|
3
3
|
size?: number;
|
|
4
4
|
className?: string;
|
|
5
5
|
fullWidth?: boolean;
|
|
6
6
|
ariaLabel?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const Spinner: FC<SpinnerProps>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ export { DialIcon } from './components/Icon/Icon';
|
|
|
19
19
|
export { DialNotification } from './components/Notification/Notification.tsx';
|
|
20
20
|
export type { DialNotificationProps } from './components/Notification/Notification.tsx';
|
|
21
21
|
export { DialLoader } from './components/Loader/Loader';
|
|
22
|
-
export {
|
|
23
|
-
export type {
|
|
22
|
+
export { Spinner } from './components/Spinner/Spinner';
|
|
23
|
+
export type { SpinnerProps } from './components/Spinner/Spinner';
|
|
24
24
|
export { DialProgressBar, DialProgressBarSize, } from './components/ProgressBar/ProgressBar';
|
|
25
25
|
export type { DialProgressBarProps } from './components/ProgressBar/ProgressBar';
|
|
26
26
|
export { DialPagination } from './components/Pagination/Pagination';
|
|
@@ -167,3 +167,13 @@ export { ButtonDropdown } from './components/New/ButtonDropdown/ButtonDropdown';
|
|
|
167
167
|
export type { ButtonDropdownProps } from './components/New/ButtonDropdown/ButtonDropdown';
|
|
168
168
|
export { InlineSelect, InlineSelectTrigger, } from './components/New/InlineSelect/InlineSelect';
|
|
169
169
|
export type { InlineSelectProps, InlineSelectTriggerProps, } from './components/New/InlineSelect/InlineSelect';
|
|
170
|
+
export { InfoButton } from './components/New/InfoButton/InfoButton';
|
|
171
|
+
export type { InfoButtonProps } from './components/New/InfoButton/InfoButton';
|
|
172
|
+
export type { LabelProps } from './components/New/Label/Label';
|
|
173
|
+
export { Label } from './components/New/Label/Label';
|
|
174
|
+
export { Textarea } from './components/New/Textarea/Textarea';
|
|
175
|
+
export { Input } from './components/New/Input/Input';
|
|
176
|
+
export type { InputProps } from './components/New/Input/Input';
|
|
177
|
+
export type { TextareaProps } from './components/New/Textarea/Textarea';
|
|
178
|
+
export type { CaptionTextProps } from './components/New/CaptionText/CaptionText';
|
|
179
|
+
export { CaptionText, ErrorText, } from './components/New/CaptionText/CaptionText';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Picks the first usable accessible name from an ordered list of candidates.
|
|
4
|
+
*
|
|
5
|
+
* Only non-empty strings can serve as an `aria-label`, so any candidate that is
|
|
6
|
+
* a different kind of `ReactNode` (an element, `undefined`, a number) is
|
|
7
|
+
* skipped. Callers pass candidates in priority order, which lets each component
|
|
8
|
+
* declare its own naming precedence.
|
|
9
|
+
*
|
|
10
|
+
* A tooltip is a common last resort: a control whose only label is a tooltip
|
|
11
|
+
* would otherwise be unnamed, because `DialTooltip` puts its `aria-describedby`
|
|
12
|
+
* on a wrapper element rather than on the control itself, and is suppressed on
|
|
13
|
+
* mobile. Pass the tooltip only when nothing else names the control — as an
|
|
14
|
+
* `aria-label` it overrides the element's own content.
|
|
15
|
+
*
|
|
16
|
+
* @param candidates - Naming candidates, highest priority first
|
|
17
|
+
* @returns The first non-empty string candidate, or `undefined` if there is none
|
|
18
|
+
*/
|
|
19
|
+
export declare const resolveAccessibleName: (...candidates: ReactNode[]) => string | undefined;
|