@cognite/aura 1.47174.0 → 1.47181.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/DESIGN.md +6 -0
- package/dist/components/ui/core/count/count.gallery.d.ts +2 -0
- package/dist/components/ui/core/count/count.gallery.js +55 -0
- package/dist/components/ui/core/count/count.gallery.js.map +1 -0
- package/dist/components/ui/core/separator/separator.gallery.d.ts +2 -0
- package/dist/components/ui/core/separator/separator.gallery.js +63 -0
- package/dist/components/ui/core/separator/separator.gallery.js.map +1 -0
- package/dist/components/ui/core/skeleton/skeleton.gallery.d.ts +2 -0
- package/dist/components/ui/core/skeleton/skeleton.gallery.js +22 -0
- package/dist/components/ui/core/skeleton/skeleton.gallery.js.map +1 -0
- package/dist/components/ui/core/slider/slider.gallery.d.ts +2 -0
- package/dist/components/ui/core/slider/slider.gallery.js +62 -0
- package/dist/components/ui/core/slider/slider.gallery.js.map +1 -0
- package/dist/components/ui/core/toggle/toggle.gallery.d.ts +2 -0
- package/dist/components/ui/core/toggle/toggle.gallery.js +32 -0
- package/dist/components/ui/core/toggle/toggle.gallery.js.map +1 -0
- package/dist/components/ui/core/tooltip/tooltip.gallery.d.ts +2 -0
- package/dist/components/ui/core/tooltip/tooltip.gallery.js +52 -0
- package/dist/components/ui/core/tooltip/tooltip.gallery.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/ui/core/count/count.md +33 -0
- package/src/components/ui/core/separator/separator.md +32 -0
- package/src/components/ui/core/skeleton/skeleton.md +33 -0
- package/src/components/ui/core/slider/slider.md +41 -0
- package/src/components/ui/core/toggle/toggle.md +39 -0
- package/src/components/ui/core/tooltip/tooltip.md +41 -0
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Use a Count to surface a quantity inline, such as a reading, a total, or a number of selected items.
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
- Showing a quantity associated with a label, tab, list item, or [Card](?path=/docs/primitives-card--docs) header.
|
|
6
|
+
- Surfacing unread counts or selection totals without taking primary focus.
|
|
7
|
+
|
|
8
|
+
## When to use something else
|
|
9
|
+
|
|
10
|
+
- Use a [Badge](?path=/docs/primitives-badge--docs) when the value represents a status or category rather than a quantity.
|
|
11
|
+
- Use the `count` prop on a [Toggle](?path=/docs/primitives-toggle--docs) or a Badge in a [Tab](?path=/docs/primitives-tabs--docs) for small counts inside a control.
|
|
12
|
+
|
|
13
|
+
## Content
|
|
14
|
+
|
|
15
|
+
- Put the number in `CountValue`.
|
|
16
|
+
- Add a `CountUnit` below the value for units of measure such as °C or %.
|
|
17
|
+
- Keep values short; abbreviate large numbers, such as 1.2k.
|
|
18
|
+
|
|
19
|
+
## Variants
|
|
20
|
+
|
|
21
|
+
- `default` for neutral quantities.
|
|
22
|
+
- `success`, `warning`, and `critical` when the value is within, near, or outside an expected range.
|
|
23
|
+
- Pair a status variant with nearby text that explains it, so meaning does not rely on color alone.
|
|
24
|
+
|
|
25
|
+
## Dos and don'ts
|
|
26
|
+
|
|
27
|
+
- **Do** keep the same variant for the same meaning across a view.
|
|
28
|
+
- **Don't** use status variants for decoration.
|
|
29
|
+
- **Don't** put actions inside a Count.
|
|
30
|
+
|
|
31
|
+
## Often used with
|
|
32
|
+
|
|
33
|
+
[Card](?path=/docs/primitives-card--docs), [Tabs](?path=/docs/primitives-tabs--docs), [Badge](?path=/docs/primitives-badge--docs), [Label](?path=/docs/primitives-label--docs), and list items.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Use a Separator to draw a subtle 1px divider between distinct sections of content.
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
- Creating visual relief between related groups of content.
|
|
6
|
+
- Dividing sections within toolbars, menus, cards, or forms.
|
|
7
|
+
|
|
8
|
+
## When to use something else
|
|
9
|
+
|
|
10
|
+
- Use whitespace alone when the layout is sparse.
|
|
11
|
+
- Use headings, a [Card](?path=/docs/primitives-card--docs), or background regions when sections need semantic grouping.
|
|
12
|
+
|
|
13
|
+
## Orientation
|
|
14
|
+
|
|
15
|
+
- Separators are horizontal by default and fill the width of their container.
|
|
16
|
+
- Set `orientation="vertical"` to divide items in a row, such as [Buttons](?path=/docs/primitives-button--docs) in a [Toolbar](?path=/docs/primitives-toolbar--docs).
|
|
17
|
+
- A vertical Separator fills the height of its container, so give the row a height, such as 16px between buttons or form elements.
|
|
18
|
+
|
|
19
|
+
## Dos and don'ts
|
|
20
|
+
|
|
21
|
+
- **Do** use 16px vertical Separators between buttons or horizontal form elements.
|
|
22
|
+
- **Don't** place Separators between every element.
|
|
23
|
+
- **Don't** use bold or colorful Separators; keep them subtle.
|
|
24
|
+
- **Don't** replace semantic headings or landmarks with Separators.
|
|
25
|
+
|
|
26
|
+
## Behavior
|
|
27
|
+
|
|
28
|
+
- A Separator has the `separator` role and exposes its orientation to assistive technology.
|
|
29
|
+
|
|
30
|
+
## Often used with
|
|
31
|
+
|
|
32
|
+
[Toolbar](?path=/docs/primitives-toolbar--docs), [Card](?path=/docs/primitives-card--docs) headers and footers, [Accordion](?path=/docs/primitives-accordion--docs), menus, and dense form sections.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Use a Skeleton as a loading placeholder that mimics the shape of incoming content.
|
|
2
|
+
Skeletons reduce perceived wait time and prevent layout shift when the content arrives.
|
|
3
|
+
|
|
4
|
+
## When to use
|
|
5
|
+
|
|
6
|
+
- Content is loading and the shape of the result is predictable, such as cards, lists, or table rows.
|
|
7
|
+
- Reducing layout shift while data fetches in the background.
|
|
8
|
+
|
|
9
|
+
## When to use something else
|
|
10
|
+
|
|
11
|
+
- Show nothing when loading is very short, under about 300ms.
|
|
12
|
+
- Use a [Loader](?path=/docs/primitives-loader--docs) or [Progress](?path=/docs/primitives-progress--docs) when the shape of the content is unpredictable.
|
|
13
|
+
|
|
14
|
+
## Shapes
|
|
15
|
+
|
|
16
|
+
- Size and shape each Skeleton with `className` to match the content it stands in for.
|
|
17
|
+
- Use short, full-width bars for lines of text, `rounded-full` for avatars, and larger blocks for images or cards.
|
|
18
|
+
- Compose several Skeletons to outline a whole card, list item, or table row.
|
|
19
|
+
|
|
20
|
+
## Dos and don'ts
|
|
21
|
+
|
|
22
|
+
- **Do** match Skeleton shapes to the actual content layout.
|
|
23
|
+
- **Do** replace the whole placeholder at once when the content loads.
|
|
24
|
+
- **Don't** add extra animation; the built-in subtle pulse is sufficient.
|
|
25
|
+
|
|
26
|
+
## Accessibility
|
|
27
|
+
|
|
28
|
+
- Skeletons have no role by default, so they are not announced.
|
|
29
|
+
- Set `role="status"` and an `aria-label` such as "Loading" on the loading region so screen reader users know content is on its way.
|
|
30
|
+
|
|
31
|
+
## Often used with
|
|
32
|
+
|
|
33
|
+
[Card](?path=/docs/primitives-card--docs), [Data Grid](?path=/docs/primitives-datagrid--docs), [Item](?path=/docs/primitives-item--docs) lists, and pagination.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Use a Slider to select a single value or a range from a continuous scale.
|
|
2
|
+
Sliders give quick visual feedback and suit approximate rather than precise values.
|
|
3
|
+
|
|
4
|
+
## When to use
|
|
5
|
+
|
|
6
|
+
- Adjusting continuous values where precision is less important than visual feedback, such as volume, brightness, or a price filter.
|
|
7
|
+
- Providing immediate visual feedback, such as media scrubbing or live previews.
|
|
8
|
+
- Selecting a minimum and maximum range.
|
|
9
|
+
|
|
10
|
+
## When to use something else
|
|
11
|
+
|
|
12
|
+
- Use an [Input](?path=/docs/primitives-input--docs) or [Select](?path=/docs/primitives-select--docs) when precise numeric entry is required.
|
|
13
|
+
- Use a [Radio Group](?path=/docs/primitives-radio-group--docs) or [Select](?path=/docs/primitives-select--docs) when the choice is categorical rather than continuous.
|
|
14
|
+
|
|
15
|
+
## Values
|
|
16
|
+
|
|
17
|
+
- Pass one value, such as `defaultValue={[50]}`, for a single thumb.
|
|
18
|
+
- Pass two values, such as `defaultValue={[20, 80]}`, for a range with two thumbs.
|
|
19
|
+
- Set `min`, `max`, and `step` to match the scale; the defaults are 0, 100, and 1.
|
|
20
|
+
- Add an adjacent [Input](?path=/docs/primitives-input--docs) when users may also need to type an exact value.
|
|
21
|
+
|
|
22
|
+
## Feedback
|
|
23
|
+
|
|
24
|
+
- Apply changes as the user drags when the result is cheap to show, such as a live preview.
|
|
25
|
+
- Apply changes on submit when each change would reload the screen or cause visual disruption, and say so in [Helper Text](?path=/docs/primitives-helper-text--docs).
|
|
26
|
+
|
|
27
|
+
## Dos and don'ts
|
|
28
|
+
|
|
29
|
+
- **Do** give every Slider a visible [Label](?path=/docs/primitives-label--docs).
|
|
30
|
+
- **Do** show the current value next to the Slider when it matters.
|
|
31
|
+
- **Don't** use a Slider for small sets of discrete options.
|
|
32
|
+
|
|
33
|
+
## Behavior
|
|
34
|
+
|
|
35
|
+
- Arrow keys move the focused thumb by one `step`, and Page Up and Page Down move it in larger increments.
|
|
36
|
+
- Set `orientation="vertical"` for a vertical Slider.
|
|
37
|
+
- `disabled` blocks all interaction and dims the track and thumbs.
|
|
38
|
+
|
|
39
|
+
## Often used with
|
|
40
|
+
|
|
41
|
+
[Label](?path=/docs/primitives-label--docs), [Helper Text](?path=/docs/primitives-helper-text--docs), and an adjacent [Input](?path=/docs/primitives-input--docs) for precise numeric entry.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Use a Toggle for a single pressable button that turns one option or formatting command on or off.
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
- A single binary option needs a visible pressed or unpressed state, such as bold text or mute.
|
|
6
|
+
- A filter in a [Toolbar](?path=/docs/primitives-toolbar--docs) can be switched on or off and benefits from a count of matching items.
|
|
7
|
+
|
|
8
|
+
## When to use something else
|
|
9
|
+
|
|
10
|
+
- Use a Toggle Group when two to four related Toggles belong together.
|
|
11
|
+
- Use a [Switch](?path=/docs/primitives-switch--docs) when the change takes immediate app-level effect.
|
|
12
|
+
- Use a [Button](?path=/docs/primitives-button--docs) for a one-time command.
|
|
13
|
+
|
|
14
|
+
## Content
|
|
15
|
+
|
|
16
|
+
- Pass an icon as children for an icon-only Toggle, and give it an `aria-label`.
|
|
17
|
+
- Use the `icon`, `label`, and `count` props for a composed Toggle with text and an optional count.
|
|
18
|
+
- Keep labels to one or two words.
|
|
19
|
+
|
|
20
|
+
## Sizes
|
|
21
|
+
|
|
22
|
+
- `sm` is 28px tall, `lg` is 32px, and `default` is 36px.
|
|
23
|
+
- Match the size of neighbouring controls in the same toolbar.
|
|
24
|
+
|
|
25
|
+
## Dos and don'ts
|
|
26
|
+
|
|
27
|
+
- **Do** pair icon-only Toggles with a [Tooltip](?path=/docs/primitives-tooltip--docs).
|
|
28
|
+
- **Do** use `defaultPressed` for uncontrolled usage, or `pressed` with `onPressedChange` when the state lives elsewhere.
|
|
29
|
+
- **Don't** change a Toggle's label when it is pressed; the pressed style already shows the state.
|
|
30
|
+
|
|
31
|
+
## Behavior
|
|
32
|
+
|
|
33
|
+
- Clicking or pressing Space or Enter flips the pressed state.
|
|
34
|
+
- The pressed state is exposed to assistive technology through `aria-pressed`.
|
|
35
|
+
- `disabled` blocks all pointer and keyboard interaction.
|
|
36
|
+
|
|
37
|
+
## Often used with
|
|
38
|
+
|
|
39
|
+
[Toolbar](?path=/docs/primitives-toolbar--docs), [Tooltip](?path=/docs/primitives-tooltip--docs) for icon-only Toggles, and Toggle Group.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Use a Tooltip to show a short hint when a user hovers over or focuses an element.
|
|
2
|
+
Tooltips hold no interactive content.
|
|
3
|
+
|
|
4
|
+
## When to use
|
|
5
|
+
|
|
6
|
+
- Clarifying a control or icon in one line or sentence.
|
|
7
|
+
- Naming an icon-only [Button](?path=/docs/primitives-button--docs) or [Toggle](?path=/docs/primitives-toggle--docs).
|
|
8
|
+
- Showing the full text of a truncated label, for example in a [Breadcrumb](?path=/docs/primitives-breadcrumb--docs).
|
|
9
|
+
|
|
10
|
+
## When to use something else
|
|
11
|
+
|
|
12
|
+
- Show content that is essential to the task inline, or in a [Dialog](?path=/docs/primitives-dialog--docs).
|
|
13
|
+
- Use a [Popover](?path=/docs/primitives-popover--docs) when users need to interact with the content.
|
|
14
|
+
- Use a [Hover Card](?path=/docs/primitives-hover-card--docs) for a richer preview of a linked item.
|
|
15
|
+
- Use [Helper Text](?path=/docs/primitives-helper-text--docs) to explain a form field.
|
|
16
|
+
|
|
17
|
+
## Content
|
|
18
|
+
|
|
19
|
+
- Keep Tooltip text to a single short sentence.
|
|
20
|
+
- Don't repeat the trigger's visible label.
|
|
21
|
+
|
|
22
|
+
## Placement
|
|
23
|
+
|
|
24
|
+
- Tooltips appear above the trigger by default.
|
|
25
|
+
- Set `side` on `TooltipContent` to `right`, `bottom`, or `left` when the top would cover important content or the screen edge.
|
|
26
|
+
|
|
27
|
+
## Dos and don'ts
|
|
28
|
+
|
|
29
|
+
- **Do** wrap the app or view in a single `TooltipProvider` so Tooltips share an open delay.
|
|
30
|
+
- **Do** attach Tooltips to focusable triggers, so keyboard users can reach them.
|
|
31
|
+
- **Don't** put links, buttons, or form controls inside a Tooltip.
|
|
32
|
+
- **Don't** put a Tooltip on a disabled control; explain why it is disabled inline instead.
|
|
33
|
+
|
|
34
|
+
## Behavior
|
|
35
|
+
|
|
36
|
+
- Inside a `TooltipProvider`, a Tooltip opens after a 300ms hover delay, which `delayDuration` changes, or immediately on keyboard focus.
|
|
37
|
+
- It closes when the pointer leaves the trigger, the trigger loses focus, or the user presses Escape.
|
|
38
|
+
|
|
39
|
+
## Often used with
|
|
40
|
+
|
|
41
|
+
Icon-only [Buttons](?path=/docs/primitives-button--docs), [Toggle](?path=/docs/primitives-toggle--docs), [Breadcrumb](?path=/docs/primitives-breadcrumb--docs), and [Label](?path=/docs/primitives-label--docs).
|