@agregio-solutions/design-system 1.90.1 → 1.92.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/design-system.cjs +9 -5
- package/dist/design-system.js +14 -6
- package/dist/packages/components/Accordion/doc.md +342 -0
- package/dist/packages/components/Badge/doc.md +192 -0
- package/dist/packages/components/Breadcrumbs/doc.md +332 -0
- package/dist/packages/components/Button/doc.md +425 -0
- package/dist/packages/components/Calendar/doc.md +465 -0
- package/dist/packages/components/ChartLegend/doc.md +151 -0
- package/dist/packages/components/ChartTooltip/doc.md +124 -0
- package/dist/packages/components/Checkbox/doc.md +329 -0
- package/dist/packages/components/CheckboxGroup/doc.md +242 -0
- package/dist/packages/components/Chip/doc.md +99 -0
- package/dist/packages/components/Combobox/Combobox.d.ts +8 -0
- package/dist/packages/components/Combobox/doc.md +680 -0
- package/dist/packages/components/DataTable/doc.md +1124 -0
- package/dist/packages/components/DatePicker/doc.md +579 -0
- package/dist/packages/components/DateRangePicker/doc.md +638 -0
- package/dist/packages/components/Drawer/doc.md +338 -0
- package/dist/packages/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/packages/components/Dropdown/doc.md +205 -0
- package/dist/packages/components/EmptyState/doc.md +101 -0
- package/dist/packages/components/FileUpload/doc.md +449 -0
- package/dist/packages/components/Filter/doc.md +196 -0
- package/dist/packages/components/Header/doc.md +373 -0
- package/dist/packages/components/I18nProvider/doc.md +187 -0
- package/dist/packages/components/Icon/doc.md +63 -0
- package/dist/packages/components/Label/doc.md +60 -0
- package/dist/packages/components/LinearProgressBar/doc.md +148 -0
- package/dist/packages/components/Link/doc.md +206 -0
- package/dist/packages/components/List/doc.md +481 -0
- package/dist/packages/components/Loader/doc.md +53 -0
- package/dist/packages/components/Menu/Menu.d.ts +5 -1
- package/dist/packages/components/Menu/doc.md +231 -0
- package/dist/packages/components/Message/doc.md +166 -0
- package/dist/packages/components/Modal/doc.md +289 -0
- package/dist/packages/components/Navigation/doc.md +992 -0
- package/dist/packages/components/NavigationItem/doc.md +167 -0
- package/dist/packages/components/NotificationCard/doc.md +206 -0
- package/dist/packages/components/Notifications/doc.md +240 -0
- package/dist/packages/components/NumberField/doc.md +582 -0
- package/dist/packages/components/PageLayout/doc.md +651 -0
- package/dist/packages/components/Pagination/doc.md +227 -0
- package/dist/packages/components/Popover/doc.md +245 -0
- package/dist/packages/components/Radio/doc.md +370 -0
- package/dist/packages/components/RouterProvider/doc.md +64 -0
- package/dist/packages/components/SearchBar/doc.md +504 -0
- package/dist/packages/components/SegmentedControl/doc.md +398 -0
- package/dist/packages/components/Select/Select.d.ts +4 -0
- package/dist/packages/components/Select/doc.md +1133 -0
- package/dist/packages/components/Skeleton/doc.md +129 -0
- package/dist/packages/components/Slider/doc.md +362 -0
- package/dist/packages/components/Stepper/doc.md +104 -0
- package/dist/packages/components/Switch/doc.md +296 -0
- package/dist/packages/components/Tabs/doc.md +295 -0
- package/dist/packages/components/Tag/doc.md +81 -0
- package/dist/packages/components/TextInput/doc.md +490 -0
- package/dist/packages/components/TimeField/doc.md +353 -0
- package/dist/packages/components/Timeline/doc.md +1046 -0
- package/dist/packages/components/Toaster/doc.md +263 -0
- package/dist/packages/components/ToggleButton/doc.md +108 -0
- package/dist/packages/components/ToggleButtonGroup/doc.md +307 -0
- package/dist/packages/components/Tooltip/doc.md +206 -0
- package/dist/packages/components/YearMonthPicker/YearMonthPicker.d.ts +8 -0
- package/dist/packages/components/YearMonthPicker/doc.md +638 -0
- package/dist/public_docs/components.md +68 -0
- package/dist/public_docs/index.md +30 -0
- package/dist/public_docs/tokens.md +121 -0
- package/package.json +3 -2
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
The complete Props documentation with JS doc for this component is available at this path:
|
|
6
|
+
|
|
7
|
+
node_modules/@agregio-solutions/design-system/dist/packages/components/Tooltip/Tooltip.d.ts
|
|
8
|
+
|
|
9
|
+
## Example usage
|
|
10
|
+
|
|
11
|
+
Here are the Storybook Stories.
|
|
12
|
+
|
|
13
|
+
Base stories:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
17
|
+
import Tooltip, { TooltipTrigger } from "./Tooltip";
|
|
18
|
+
import Button from "../Button/Button";
|
|
19
|
+
import { useState } from "react";
|
|
20
|
+
|
|
21
|
+
const meta: Meta<typeof Tooltip> = {
|
|
22
|
+
component: Tooltip,
|
|
23
|
+
parameters: {
|
|
24
|
+
layout: "centered",
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
children: {
|
|
28
|
+
control: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
export default meta;
|
|
33
|
+
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const Playground: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
label: "Create a new user",
|
|
39
|
+
children: <Button iconLeft="add" mode="secondary" />,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const WithTooltipTrigger: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
...Playground.args,
|
|
46
|
+
defaultOpen: true,
|
|
47
|
+
children: <TooltipTrigger>Hover me</TooltipTrigger>,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const FocusOnly: Story = {
|
|
52
|
+
parameters: {
|
|
53
|
+
chromatic: { disableSnapshot: true },
|
|
54
|
+
},
|
|
55
|
+
args: {
|
|
56
|
+
...Playground.args,
|
|
57
|
+
trigger: "focus",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Open: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
...Playground.args,
|
|
64
|
+
defaultOpen: true,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const MultiLine: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
...Playground.args,
|
|
71
|
+
label: "Line 1\nLine 2\nLine 3",
|
|
72
|
+
defaultOpen: true,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Fluid: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
...Playground.args,
|
|
79
|
+
label:
|
|
80
|
+
"This is a much longer tooltip label that would normally be truncated",
|
|
81
|
+
defaultOpen: true,
|
|
82
|
+
fluid: true,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const HideArrow: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
...Playground.args,
|
|
89
|
+
defaultOpen: true,
|
|
90
|
+
hideArrow: true,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const AllPlacements: Story = {
|
|
95
|
+
render: () => {
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
style={{ display: "flex", gap: 180, flexWrap: "wrap", padding: 100 }}
|
|
99
|
+
>
|
|
100
|
+
{["top", "right", "bottom", "left"].map((placement) => (
|
|
101
|
+
<Tooltip
|
|
102
|
+
key={placement}
|
|
103
|
+
label={placement}
|
|
104
|
+
isOpen
|
|
105
|
+
placement={placement as any}
|
|
106
|
+
>
|
|
107
|
+
<Button iconLeft="add" mode="secondary" />
|
|
108
|
+
</Tooltip>
|
|
109
|
+
))}
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const Disabled: Story = {
|
|
116
|
+
parameters: {
|
|
117
|
+
chromatic: { disableSnapshot: true },
|
|
118
|
+
},
|
|
119
|
+
args: {
|
|
120
|
+
...Playground.args,
|
|
121
|
+
isDisabled: true,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const Controlled: Story = {
|
|
126
|
+
parameters: {
|
|
127
|
+
chromatic: { disableSnapshot: true },
|
|
128
|
+
},
|
|
129
|
+
render: () => {
|
|
130
|
+
const ParentComponent = () => {
|
|
131
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
132
|
+
return (
|
|
133
|
+
<Tooltip
|
|
134
|
+
isOpen={isOpen}
|
|
135
|
+
onOpenChange={setIsOpen}
|
|
136
|
+
label="Create a new user"
|
|
137
|
+
>
|
|
138
|
+
<Button iconLeft="add" mode="secondary" />
|
|
139
|
+
</Tooltip>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
return <ParentComponent />;
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Developer notes
|
|
148
|
+
|
|
149
|
+
Here are the notes available for the developer on the built Storybook, you can read them to understand the component and how to use it.
|
|
150
|
+
|
|
151
|
+
```mdx
|
|
152
|
+
import {
|
|
153
|
+
Canvas,
|
|
154
|
+
Meta,
|
|
155
|
+
Stories,
|
|
156
|
+
Controls,
|
|
157
|
+
Source,
|
|
158
|
+
} from "@storybook/addon-docs/blocks";
|
|
159
|
+
|
|
160
|
+
import * as Tooltip from "./Tooltip.stories";
|
|
161
|
+
|
|
162
|
+
<Meta of={Tooltip} />
|
|
163
|
+
|
|
164
|
+
# Tooltip
|
|
165
|
+
|
|
166
|
+
<Canvas of={Tooltip.Playground} />
|
|
167
|
+
|
|
168
|
+
<Controls of={Tooltip.Playground} />
|
|
169
|
+
|
|
170
|
+
A tooltip displays a description of an element on hover or focus.
|
|
171
|
+
|
|
172
|
+
The HTML title attribute can be used to create a tooltip, but it cannot be styled.
|
|
173
|
+
Custom styled tooltips can be hard to build in an accessible way.
|
|
174
|
+
TooltipTrigger and Tooltip help build fully accessible tooltips that comes with the Design System styles.
|
|
175
|
+
|
|
176
|
+
- **Accessible** – The trigger element is automatically associated with the tooltip via aria-describedby. Tooltips are displayed when an element receives focus.
|
|
177
|
+
- **Hover behavior** – Tooltips display after a global delay on hover of the first tooltip, with no delay on subsequent tooltips to avoid unintended flickering. Emulated hover events on touch devices are ignored.
|
|
178
|
+
- **Positioning** – The tooltip is positioned relative to the trigger element, and automatically flips and adjusts to avoid overlapping with the edge of the browser window.
|
|
179
|
+
|
|
180
|
+
**Note:** Tooltips are not shown on touch screen interactions. Ensure that your UI is usable without tooltips, or use an alternative component to show information in an adjacent element.
|
|
181
|
+
|
|
182
|
+
Also, if you need to display more complex content (title, links, etc.), check out the Popover component that is responsible for exactly that!
|
|
183
|
+
|
|
184
|
+
## Usage with a Button
|
|
185
|
+
|
|
186
|
+
The most common use case is to use a Button as the trigger element.
|
|
187
|
+
|
|
188
|
+
<Canvas of={Tooltip.Playground} />
|
|
189
|
+
|
|
190
|
+
## Usage with `TooltipTrigger`
|
|
191
|
+
|
|
192
|
+
In the case where you don't want to use a Button as the trigger element, you can use `TooltipTrigger` to wrap your component.
|
|
193
|
+
|
|
194
|
+
Please not that you cannot pass a Button (or other interactive component) to the `children` prop of `TooltipTrigger`.
|
|
195
|
+
This is because the `TooltipTrigger` itself is an unstyled Button that serves as a trigger for the tooltip to show.
|
|
196
|
+
|
|
197
|
+
<Canvas of={Tooltip.WithTooltipTrigger} />
|
|
198
|
+
|
|
199
|
+
## Controlled / Uncontrolled mode
|
|
200
|
+
|
|
201
|
+
The open state of the tooltip can be controlled via the `defaultOpen` (uncontrolled mode) and `isOpen` (controlled mode) props.
|
|
202
|
+
|
|
203
|
+
Below is an example of how to use the "controlled" mode.
|
|
204
|
+
|
|
205
|
+
<Canvas of={Tooltip.Controlled} />
|
|
206
|
+
```
|
|
@@ -80,6 +80,10 @@ export type Props = Pick<LabelProps, "label" | "labelIconRight" | "labelIconRigh
|
|
|
80
80
|
* @default "ascending"
|
|
81
81
|
*/
|
|
82
82
|
sortYears?: "ascending" | "descending";
|
|
83
|
+
/**
|
|
84
|
+
* When true, increases the dropdown max-height from 200px to 400px.
|
|
85
|
+
*/
|
|
86
|
+
tallDropdown?: boolean;
|
|
83
87
|
};
|
|
84
88
|
declare const YearMonthPicker: React.ForwardRefExoticComponent<Pick<LabelProps, "label" | "required" | "labelIconRight" | "labelIconRightTooltip"> & Pick<FormGroupWrapperProps, "orientation" | "description" | "helperText" | "helperTextIcon" | "errorHelperText" | "errorHelperTextIcon" | "successHelperText" | "successHelperTextIcon" | "warningHelperText" | "warningHelperTextIcon"> & {
|
|
85
89
|
/**
|
|
@@ -148,5 +152,9 @@ declare const YearMonthPicker: React.ForwardRefExoticComponent<Pick<LabelProps,
|
|
|
148
152
|
* @default "ascending"
|
|
149
153
|
*/
|
|
150
154
|
sortYears?: "ascending" | "descending";
|
|
155
|
+
/**
|
|
156
|
+
* When true, increases the dropdown max-height from 200px to 400px.
|
|
157
|
+
*/
|
|
158
|
+
tallDropdown?: boolean;
|
|
151
159
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
152
160
|
export default YearMonthPicker;
|