@manakind/ui-core 0.19.0 → 0.21.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/README.md +34 -5
- package/dist/breadcrumb/breadcrumb.css +47 -0
- package/dist/breadcrumb/breadcrumb.css.d.ts +2 -0
- package/dist/breadcrumb/breadcrumb.d.ts +43 -0
- package/dist/breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb/breadcrumb.js +21 -0
- package/dist/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/breadcrumb/index.d.ts +3 -0
- package/dist/breadcrumb/index.d.ts.map +1 -0
- package/dist/breadcrumb/index.js +2 -0
- package/dist/breadcrumb/index.js.map +1 -0
- package/dist/centered-layout/centered-layout.css +36 -0
- package/dist/centered-layout/centered-layout.css.d.ts +2 -0
- package/dist/centered-layout/centered-layout.d.ts +18 -0
- package/dist/centered-layout/centered-layout.d.ts.map +1 -0
- package/dist/centered-layout/centered-layout.js +16 -0
- package/dist/centered-layout/centered-layout.js.map +1 -0
- package/dist/centered-layout/index.d.ts +3 -0
- package/dist/centered-layout/index.d.ts.map +1 -0
- package/dist/centered-layout/index.js +2 -0
- package/dist/centered-layout/index.js.map +1 -0
- package/dist/combobox/combobox.css +17 -0
- package/dist/combobox/combobox.d.ts +7 -0
- package/dist/combobox/combobox.d.ts.map +1 -1
- package/dist/combobox/combobox.js +25 -3
- package/dist/combobox/combobox.js.map +1 -1
- package/dist/date-input/date-input.d.ts +5 -3
- package/dist/date-input/date-input.d.ts.map +1 -1
- package/dist/date-input/date-input.js +13 -2
- package/dist/date-input/date-input.js.map +1 -1
- package/dist/divider/divider.css +18 -0
- package/dist/divider/divider.css.d.ts +2 -0
- package/dist/divider/divider.d.ts +26 -0
- package/dist/divider/divider.d.ts.map +1 -0
- package/dist/divider/divider.js +15 -0
- package/dist/divider/divider.js.map +1 -0
- package/dist/divider/index.d.ts +3 -0
- package/dist/divider/index.d.ts.map +1 -0
- package/dist/divider/index.js +2 -0
- package/dist/divider/index.js.map +1 -0
- package/dist/empty-state/empty-state.css +37 -0
- package/dist/empty-state/empty-state.css.d.ts +2 -0
- package/dist/empty-state/empty-state.d.ts +26 -0
- package/dist/empty-state/empty-state.d.ts.map +1 -0
- package/dist/empty-state/empty-state.js +16 -0
- package/dist/empty-state/empty-state.js.map +1 -0
- package/dist/empty-state/index.d.ts +3 -0
- package/dist/empty-state/index.d.ts.map +1 -0
- package/dist/empty-state/index.js +2 -0
- package/dist/empty-state/index.js.map +1 -0
- package/dist/form-layout/form-layout.css +18 -0
- package/dist/form-layout/form-layout.css.d.ts +2 -0
- package/dist/form-layout/form-layout.d.ts +21 -0
- package/dist/form-layout/form-layout.d.ts.map +1 -0
- package/dist/form-layout/form-layout.js +24 -0
- package/dist/form-layout/form-layout.js.map +1 -0
- package/dist/form-layout/index.d.ts +3 -0
- package/dist/form-layout/index.d.ts.map +1 -0
- package/dist/form-layout/index.js +2 -0
- package/dist/form-layout/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +2 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/layout.css +185 -0
- package/dist/layout/layout.css.d.ts +2 -0
- package/dist/layout/layout.d.ts +105 -0
- package/dist/layout/layout.d.ts.map +1 -0
- package/dist/layout/layout.js +77 -0
- package/dist/layout/layout.js.map +1 -0
- package/dist/link-component.d.ts +12 -0
- package/dist/link-component.d.ts.map +1 -0
- package/dist/link-component.js +2 -0
- package/dist/link-component.js.map +1 -0
- package/dist/menu/action-menu.d.ts +2 -4
- package/dist/menu/action-menu.d.ts.map +1 -1
- package/dist/menu/action-menu.js.map +1 -1
- package/dist/menu/menu.css +1 -1
- package/dist/menu/menu.d.ts +6 -0
- package/dist/menu/menu.d.ts.map +1 -1
- package/dist/menu/menu.js +1 -1
- package/dist/menu/menu.js.map +1 -1
- package/dist/page-layout/index.d.ts +3 -0
- package/dist/page-layout/index.d.ts.map +1 -0
- package/dist/page-layout/index.js +2 -0
- package/dist/page-layout/index.js.map +1 -0
- package/dist/page-layout/page-layout.css +81 -0
- package/dist/page-layout/page-layout.css.d.ts +2 -0
- package/dist/page-layout/page-layout.d.ts +43 -0
- package/dist/page-layout/page-layout.d.ts.map +1 -0
- package/dist/page-layout/page-layout.js +42 -0
- package/dist/page-layout/page-layout.js.map +1 -0
- package/dist/section/index.d.ts +3 -0
- package/dist/section/index.d.ts.map +1 -0
- package/dist/section/index.js +2 -0
- package/dist/section/index.js.map +1 -0
- package/dist/section/section.css +31 -0
- package/dist/section/section.css.d.ts +2 -0
- package/dist/section/section.d.ts +31 -0
- package/dist/section/section.d.ts.map +1 -0
- package/dist/section/section.js +19 -0
- package/dist/section/section.js.map +1 -0
- package/dist/segment-group/segment-group.css +31 -0
- package/dist/segment-group/segment-group.d.ts +14 -1
- package/dist/segment-group/segment-group.d.ts.map +1 -1
- package/dist/segment-group/segment-group.js +2 -2
- package/dist/segment-group/segment-group.js.map +1 -1
- package/dist/show/index.d.ts +3 -0
- package/dist/show/index.d.ts.map +1 -0
- package/dist/show/index.js +2 -0
- package/dist/show/index.js.map +1 -0
- package/dist/show/show.css +67 -0
- package/dist/show/show.css.d.ts +2 -0
- package/dist/show/show.d.ts +36 -0
- package/dist/show/show.d.ts.map +1 -0
- package/dist/show/show.js +23 -0
- package/dist/show/show.js.map +1 -0
- package/dist/skeleton/index.d.ts +3 -0
- package/dist/skeleton/index.d.ts.map +1 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/skeleton/skeleton.css +36 -0
- package/dist/skeleton/skeleton.css.d.ts +2 -0
- package/dist/skeleton/skeleton.d.ts +26 -0
- package/dist/skeleton/skeleton.d.ts.map +1 -0
- package/dist/skeleton/skeleton.js +21 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/split-layout/index.d.ts +3 -0
- package/dist/split-layout/index.d.ts.map +1 -0
- package/dist/split-layout/index.js +2 -0
- package/dist/split-layout/index.js.map +1 -0
- package/dist/split-layout/split-layout.css +71 -0
- package/dist/split-layout/split-layout.css.d.ts +2 -0
- package/dist/split-layout/split-layout.d.ts +32 -0
- package/dist/split-layout/split-layout.d.ts.map +1 -0
- package/dist/split-layout/split-layout.js +25 -0
- package/dist/split-layout/split-layout.js.map +1 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +2 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/text.css +128 -0
- package/dist/text/text.css.d.ts +2 -0
- package/dist/text/text.d.ts +78 -0
- package/dist/text/text.d.ts.map +1 -0
- package/dist/text/text.js +56 -0
- package/dist/text/text.js.map +1 -0
- package/dist/visually-hidden/index.d.ts +3 -0
- package/dist/visually-hidden/index.d.ts.map +1 -0
- package/dist/visually-hidden/index.js +2 -0
- package/dist/visually-hidden/index.js.map +1 -0
- package/dist/visually-hidden/visually-hidden.css +19 -0
- package/dist/visually-hidden/visually-hidden.css.d.ts +2 -0
- package/dist/visually-hidden/visually-hidden.d.ts +15 -0
- package/dist/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/visually-hidden/visually-hidden.js +17 -0
- package/dist/visually-hidden/visually-hidden.js.map +1 -0
- package/dist/wizard-layout/index.d.ts +3 -0
- package/dist/wizard-layout/index.d.ts.map +1 -0
- package/dist/wizard-layout/index.js +2 -0
- package/dist/wizard-layout/index.js.map +1 -0
- package/dist/wizard-layout/wizard-layout.css +52 -0
- package/dist/wizard-layout/wizard-layout.css.d.ts +2 -0
- package/dist/wizard-layout/wizard-layout.d.ts +50 -0
- package/dist/wizard-layout/wizard-layout.d.ts.map +1 -0
- package/dist/wizard-layout/wizard-layout.js +38 -0
- package/dist/wizard-layout/wizard-layout.js.map +1 -0
- package/package.json +114 -2
package/README.md
CHANGED
|
@@ -50,8 +50,9 @@ importing `ui-core` directly.
|
|
|
50
50
|
|
|
51
51
|
## Exports
|
|
52
52
|
|
|
53
|
-
Every component is available from the root
|
|
54
|
-
import just one.
|
|
53
|
+
Every component is available from the root and its own subpath when you
|
|
54
|
+
want to import just one.
|
|
55
|
+
The `./css/*` subpaths carry each component's structural CSS
|
|
55
56
|
separately, so an app can load only what it renders.
|
|
56
57
|
|
|
57
58
|
| Entry | Contents |
|
|
@@ -60,27 +61,42 @@ separately, so an app can load only what it renders.
|
|
|
60
61
|
| `@manakind/ui-core/alert` | `Alert` |
|
|
61
62
|
| `@manakind/ui-core/avatar` | `Avatar` + `initialsOf` |
|
|
62
63
|
| `@manakind/ui-core/badge` | `Badge` |
|
|
64
|
+
| `@manakind/ui-core/breadcrumb` | `Breadcrumb` |
|
|
63
65
|
| `@manakind/ui-core/button` | `Button` + `IconButton` |
|
|
64
66
|
| `@manakind/ui-core/calendar` | `Calendar` |
|
|
65
67
|
| `@manakind/ui-core/card` | `Card`, `CardHeader`, `CardTitle`, `CardLink`, `CardDescription`, `CardContent`, `CardFooter` |
|
|
66
68
|
| `@manakind/ui-core/dialog` | `Dialog` + `DialogClose` |
|
|
67
69
|
| `@manakind/ui-core/icon` | `Icon` |
|
|
68
70
|
| `@manakind/ui-core/illustration` | `Illustration` + `illustrationPaint` |
|
|
69
|
-
| `@manakind/ui-core/menu` | `Menu`, `MenuTrigger`, `ActionMenu` |
|
|
71
|
+
| `@manakind/ui-core/menu` | `Menu`, `MenuTrigger`, `ActionMenu`; `MenuItem.icon` adds a decorative glyph before its label |
|
|
70
72
|
| `@manakind/ui-core/popover` | `Popover` |
|
|
71
73
|
| `@manakind/ui-core/checkbox` | `Checkbox` |
|
|
72
|
-
| `@manakind/ui-core/combobox` | `Combobox` |
|
|
74
|
+
| `@manakind/ui-core/combobox` | `Combobox`; `ComboboxItem.group` collects options under named headings, with keyboard navigation in displayed order |
|
|
73
75
|
| `@manakind/ui-core/date-input` | `DateInput` |
|
|
74
76
|
| `@manakind/ui-core/progress` | `Progress` |
|
|
75
77
|
| `@manakind/ui-core/reorder-control` | `ReorderControl` |
|
|
76
|
-
| `@manakind/ui-core/segment-group` | `SegmentGroup` |
|
|
78
|
+
| `@manakind/ui-core/segment-group` | `SegmentGroup`; `fit="content"` sizes segments to their labels, `density="dense"` reduces inline padding |
|
|
77
79
|
| `@manakind/ui-core/select` | `Select` |
|
|
78
80
|
| `@manakind/ui-core/switch` | `Switch` |
|
|
79
81
|
| `@manakind/ui-core/field` | `Field`, `Input`, `Textarea`, `useFieldControl` |
|
|
80
82
|
| `@manakind/ui-core/tabs` | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` |
|
|
83
|
+
| `@manakind/ui-core/layout` | `Stack`, `Inline`, `Grid`, `Container` and the layout step types |
|
|
84
|
+
| `@manakind/ui-core/text` | `Text` + `Heading` |
|
|
85
|
+
| `@manakind/ui-core/divider` | `Divider` |
|
|
86
|
+
| `@manakind/ui-core/show` | `Show` |
|
|
87
|
+
| `@manakind/ui-core/visually-hidden` | `VisuallyHidden` |
|
|
88
|
+
| `@manakind/ui-core/skeleton` | `Skeleton` |
|
|
89
|
+
| `@manakind/ui-core/empty-state` | `EmptyState` |
|
|
90
|
+
| `@manakind/ui-core/page-layout` | `PageLayout`, `PageHeader`, `PageTitle`, `PageDescription`, `PageActions` |
|
|
91
|
+
| `@manakind/ui-core/section` | `Section` |
|
|
92
|
+
| `@manakind/ui-core/split-layout` | `SplitLayout`, `SplitMain`, `SplitAside` |
|
|
93
|
+
| `@manakind/ui-core/form-layout` | `FormLayout`, `FormActions` |
|
|
94
|
+
| `@manakind/ui-core/wizard-layout` | `WizardLayout`, `WizardHeader`, `WizardContent`, `WizardFooter` |
|
|
95
|
+
| `@manakind/ui-core/centered-layout` | `CenteredLayout` |
|
|
81
96
|
| `@manakind/ui-core/css/alert` | Alert structural CSS; its icon also needs `css/icon` |
|
|
82
97
|
| `@manakind/ui-core/css/avatar` | Avatar structural CSS; its fallback glyph also needs `css/icon` |
|
|
83
98
|
| `@manakind/ui-core/css/badge` | Badge structural CSS |
|
|
99
|
+
| `@manakind/ui-core/css/breadcrumb` | Breadcrumb structural CSS; a custom separator also needs `css/icon` |
|
|
84
100
|
| `@manakind/ui-core/css/button` | Button + IconButton structural CSS |
|
|
85
101
|
| `@manakind/ui-core/css/calendar` | Calendar structural CSS; its paging buttons also need `css/button` and `css/icon` |
|
|
86
102
|
| `@manakind/ui-core/css/card` | Card structural CSS |
|
|
@@ -99,6 +115,19 @@ separately, so an app can load only what it renders.
|
|
|
99
115
|
| `@manakind/ui-core/css/switch` | Switch structural CSS |
|
|
100
116
|
| `@manakind/ui-core/css/field` | Field, Input and Textarea structural CSS |
|
|
101
117
|
| `@manakind/ui-core/css/tabs` | Tabs structural CSS |
|
|
118
|
+
| `@manakind/ui-core/css/layout` | Stack, Inline, Grid and Container structural CSS |
|
|
119
|
+
| `@manakind/ui-core/css/text` | Text and Heading structural CSS |
|
|
120
|
+
| `@manakind/ui-core/css/divider` | Divider structural CSS |
|
|
121
|
+
| `@manakind/ui-core/css/show` | Show structural CSS |
|
|
122
|
+
| `@manakind/ui-core/css/visually-hidden` | VisuallyHidden structural CSS |
|
|
123
|
+
| `@manakind/ui-core/css/skeleton` | Skeleton structural CSS |
|
|
124
|
+
| `@manakind/ui-core/css/empty-state` | EmptyState structural CSS; its glyph also needs `css/icon` |
|
|
125
|
+
| `@manakind/ui-core/css/page-layout` | PageLayout structural CSS; its title and description also need `css/text` |
|
|
126
|
+
| `@manakind/ui-core/css/section` | Section structural CSS; its title and description also need `css/text` |
|
|
127
|
+
| `@manakind/ui-core/css/split-layout` | SplitLayout structural CSS |
|
|
128
|
+
| `@manakind/ui-core/css/form-layout` | FormLayout structural CSS |
|
|
129
|
+
| `@manakind/ui-core/css/wizard-layout` | WizardLayout structural CSS; its header also needs `css/progress` and `css/text` |
|
|
130
|
+
| `@manakind/ui-core/css/centered-layout` | CenteredLayout structural CSS |
|
|
102
131
|
|
|
103
132
|
Structural CSS is only half of what a component needs — it consumes `--ds-*` custom
|
|
104
133
|
properties that a product's theme supplies. See
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-breadcrumb {
|
|
3
|
+
min-width: 0;
|
|
4
|
+
color: var(--ds-breadcrumb-text);
|
|
5
|
+
font-size: var(--ds-breadcrumb-font-size);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ds-breadcrumb__list {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: var(--ds-breadcrumb-gap);
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
list-style: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-breadcrumb__item {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: var(--ds-breadcrumb-gap);
|
|
22
|
+
min-width: 0;
|
|
23
|
+
overflow-wrap: anywhere;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-breadcrumb__separator {
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
color: var(--ds-breadcrumb-separator);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ds-breadcrumb__link {
|
|
32
|
+
color: inherit;
|
|
33
|
+
text-decoration: none;
|
|
34
|
+
border-radius: var(--ds-breadcrumb-radius);
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
color: var(--ds-breadcrumb-text-hover);
|
|
38
|
+
text-decoration: underline;
|
|
39
|
+
text-underline-offset: 0.2em;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:focus-visible {
|
|
43
|
+
outline: 2px solid var(--ds-breadcrumb-focus-ring);
|
|
44
|
+
outline-offset: 3px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
2
|
+
import { type IconSource } from '../icon';
|
|
3
|
+
import type { LinkComponentProps } from '../link-component';
|
|
4
|
+
import './breadcrumb.css';
|
|
5
|
+
/** One ancestor in the trail. */
|
|
6
|
+
export interface BreadcrumbItem {
|
|
7
|
+
/** Stable key. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** What the ancestor is called. A node, so a product can pass a richer label (a category's colour mark, say). */
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
/** Makes the item a link to the ancestor. */
|
|
12
|
+
href?: string;
|
|
13
|
+
}
|
|
14
|
+
/** What the link component receives; the props every `linkComponent` takes. */
|
|
15
|
+
export type BreadcrumbLinkProps = LinkComponentProps;
|
|
16
|
+
export interface BreadcrumbProps {
|
|
17
|
+
/** The ancestors, outermost first. Renders nothing when empty. */
|
|
18
|
+
items: BreadcrumbItem[];
|
|
19
|
+
/**
|
|
20
|
+
* The trail's accessible name: its navigation landmark's. Required, since a
|
|
21
|
+
* list of rows each with a trail would otherwise repeat one landmark name;
|
|
22
|
+
* name it after what it locates ("Where Book the physio lives").
|
|
23
|
+
*/
|
|
24
|
+
label: string;
|
|
25
|
+
/** Glyph between items, supplied by the product. Must point RIGHT in a left-to-right layout. Falls back to "/". */
|
|
26
|
+
separator?: IconSource;
|
|
27
|
+
/** Renders each link, so a product passes its router's link. Defaults to `<a>`. */
|
|
28
|
+
linkComponent?: ElementType<BreadcrumbLinkProps>;
|
|
29
|
+
/** Extra class names on the `<nav>`. */
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Where something lives: its ancestors, outermost first, each a link when it
|
|
34
|
+
* has a place of its own. Above a page title, or above a list row's title
|
|
35
|
+
* when the row is filed in a hierarchy.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* The trail lists ancestors only — the thing itself is the heading beside it —
|
|
39
|
+
* so no item carries `aria-current`. The separators are decorative; a screen
|
|
40
|
+
* reader hears a list of links in a navigation landmark.
|
|
41
|
+
*/
|
|
42
|
+
export declare function Breadcrumb({ items, label, separator, linkComponent: Link, className, }: BreadcrumbProps): import("react/jsx-runtime").JSX.Element | null;
|
|
43
|
+
//# sourceMappingURL=breadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/breadcrumb/breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,kBAAkB,CAAC;AAE1B,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iHAAiH;IACjH,KAAK,EAAE,SAAS,CAAC;IACjB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+EAA+E;AAC/E,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,mHAAmH;IACnH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,mFAAmF;IACnF,aAAa,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;IACjD,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,SAAS,EACT,aAAa,EAAE,IAAU,EACzB,SAAS,GACV,EAAE,eAAe,kDA2BjB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from '../cx';
|
|
3
|
+
import { Icon } from '../icon';
|
|
4
|
+
import './breadcrumb.css';
|
|
5
|
+
/**
|
|
6
|
+
* Where something lives: its ancestors, outermost first, each a link when it
|
|
7
|
+
* has a place of its own. Above a page title, or above a list row's title
|
|
8
|
+
* when the row is filed in a hierarchy.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The trail lists ancestors only — the thing itself is the heading beside it —
|
|
12
|
+
* so no item carries `aria-current`. The separators are decorative; a screen
|
|
13
|
+
* reader hears a list of links in a navigation landmark.
|
|
14
|
+
*/
|
|
15
|
+
export function Breadcrumb({ items, label, separator, linkComponent: Link = 'a', className, }) {
|
|
16
|
+
if (items.length === 0)
|
|
17
|
+
return null;
|
|
18
|
+
const divider = separator ? (_jsx(Icon, { source: separator, size: "sm", decorative: true, className: "ds-breadcrumb__separator" })) : (_jsx("span", { className: "ds-breadcrumb__separator", "aria-hidden": "true", children: "/" }));
|
|
19
|
+
return (_jsx("nav", { "aria-label": label, className: cx('ds-breadcrumb', className), children: _jsx("ol", { className: "ds-breadcrumb__list", children: items.map((item, index) => (_jsxs("li", { className: "ds-breadcrumb__item", children: [index > 0 && divider, item.href ? (_jsx(Link, { href: item.href, className: "ds-breadcrumb__link", children: item.label })) : (_jsx("span", { className: "ds-breadcrumb__text", children: item.label }))] }, item.id))) }) }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","sourceRoot":"","sources":["../../src/breadcrumb/breadcrumb.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAmB,MAAM,SAAS,CAAC;AAEhD,OAAO,kBAAkB,CAAC;AAgC1B;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,KA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|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/breadcrumb/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/*
|
|
3
|
+
* Grid, not flex: `align-content` centres the children as a group in the
|
|
4
|
+
* viewport's height while `justify-items` centres each across, with no
|
|
5
|
+
* wrapper element between the layout and its children.
|
|
6
|
+
*/
|
|
7
|
+
.ds-centered-layout {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
display: grid;
|
|
10
|
+
align-content: center;
|
|
11
|
+
justify-items: center;
|
|
12
|
+
gap: var(--ds-centered-layout-gap);
|
|
13
|
+
min-height: 100dvh;
|
|
14
|
+
padding: var(--ds-centered-layout-padding);
|
|
15
|
+
background-color: var(--ds-centered-layout-bg);
|
|
16
|
+
overflow-wrap: anywhere;
|
|
17
|
+
|
|
18
|
+
& > * {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
width: 100%;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.ds-centered-layout--sm > * {
|
|
25
|
+
max-width: var(--ds-layout-content-sm);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.ds-centered-layout--md > * {
|
|
29
|
+
max-width: var(--ds-layout-content-md);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.ds-centered-layout--lg > * {
|
|
33
|
+
max-width: var(--ds-layout-content-lg);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ark } from '@ark-ui/react/factory';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import './centered-layout.css';
|
|
4
|
+
import type { ContentWidth } from '../layout/layout';
|
|
5
|
+
export interface CenteredLayoutProps extends ComponentProps<typeof ark.div> {
|
|
6
|
+
/** Where the centred column stops growing. Defaults to `md`, a card's width. */
|
|
7
|
+
size?: Exclude<ContentWidth, 'xl'>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* One column centred on the canvas, for the pages that stand outside the
|
|
11
|
+
* app's shell: sign-in, a consent prompt, an error, a loading screen.
|
|
12
|
+
*
|
|
13
|
+
* Fills the viewport's height, paints the canvas colour, and centres its
|
|
14
|
+
* children both ways, each no wider than `size`. There is no inner wrapper,
|
|
15
|
+
* so `asChild` can make the page's `main` the layout itself.
|
|
16
|
+
*/
|
|
17
|
+
export declare function CenteredLayout({ size, className, children, ...props }: CenteredLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=centered-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"centered-layout.d.ts","sourceRoot":"","sources":["../../src/centered-layout/centered-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC;IACzE,gFAAgF;IAChF,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,IAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,mBAAmB,2CASrB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ark } from '@ark-ui/react/factory';
|
|
3
|
+
import './centered-layout.css';
|
|
4
|
+
import { cx } from '../cx';
|
|
5
|
+
/**
|
|
6
|
+
* One column centred on the canvas, for the pages that stand outside the
|
|
7
|
+
* app's shell: sign-in, a consent prompt, an error, a loading screen.
|
|
8
|
+
*
|
|
9
|
+
* Fills the viewport's height, paints the canvas colour, and centres its
|
|
10
|
+
* children both ways, each no wider than `size`. There is no inner wrapper,
|
|
11
|
+
* so `asChild` can make the page's `main` the layout itself.
|
|
12
|
+
*/
|
|
13
|
+
export function CenteredLayout({ size = 'md', className, children, ...props }) {
|
|
14
|
+
return (_jsx(ark.div, { className: cx('ds-centered-layout', `ds-centered-layout--${size}`, className), ...props, children: children }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=centered-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"centered-layout.js","sourceRoot":"","sources":["../../src/centered-layout/centered-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQ3B;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,GAAG,IAAI,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACY;IACpB,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IACN,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,uBAAuB,IAAI,EAAE,EAAE,SAAS,CAAC,KACzE,KAAK,YAER,QAAQ,GACD,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/centered-layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/centered-layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -49,6 +49,23 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/*
|
|
53
|
+
* A group of options under its heading, set apart from the group above by
|
|
54
|
+
* more space than separates two options, so the groups read as groups.
|
|
55
|
+
*/
|
|
56
|
+
.ds-combobox__group + .ds-combobox__group,
|
|
57
|
+
.ds-combobox__item + .ds-combobox__group {
|
|
58
|
+
margin-block-start: var(--ds-combobox-group-gap);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ds-combobox__group-label {
|
|
62
|
+
display: block;
|
|
63
|
+
padding: var(--ds-select-item-padding-block) var(--ds-select-item-padding-inline);
|
|
64
|
+
color: var(--ds-combobox-group-label-text);
|
|
65
|
+
font-size: var(--ds-combobox-group-label-font-size);
|
|
66
|
+
font-weight: var(--ds-combobox-group-label-font-weight);
|
|
67
|
+
}
|
|
68
|
+
|
|
52
69
|
.ds-combobox__item-description {
|
|
53
70
|
color: var(--ds-field-hint-text);
|
|
54
71
|
font-size: var(--ds-field-hint-font-size);
|
|
@@ -10,6 +10,13 @@ export interface ComboboxItem {
|
|
|
10
10
|
description?: string;
|
|
11
11
|
/** Individually disable this option without removing it. */
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The group the option is listed under, by its heading. Options sharing a
|
|
15
|
+
* group are listed together under it, groups in the order they first
|
|
16
|
+
* appear; options without one (or with an empty name) are listed before
|
|
17
|
+
* any group.
|
|
18
|
+
*/
|
|
19
|
+
group?: string;
|
|
13
20
|
}
|
|
14
21
|
export interface ComboboxProps {
|
|
15
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/combobox/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAoC,MAAM,OAAO,CAA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B,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,qCAAqC;IACrC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAClC;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,WAAW,EACX,SAAS,EACT,IAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,QAAQ,GACT,EAAE,aAAa,2CAyGf"}
|
|
@@ -6,6 +6,26 @@ import { flushSync } from 'react-dom';
|
|
|
6
6
|
import { PortalContainerContext } from '../portal-container';
|
|
7
7
|
import './combobox.css';
|
|
8
8
|
import { cx } from '../cx';
|
|
9
|
+
// Ungrouped options first, then each group in order of first appearance, so
|
|
10
|
+
// the keyboard walks the list in the order it is drawn.
|
|
11
|
+
function groupItems(items) {
|
|
12
|
+
const ungrouped = [];
|
|
13
|
+
const groups = new Map();
|
|
14
|
+
for (const item of items) {
|
|
15
|
+
if (!item.group) {
|
|
16
|
+
ungrouped.push(item);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const members = groups.get(item.group) ?? [];
|
|
20
|
+
members.push(item);
|
|
21
|
+
groups.set(item.group, members);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return [
|
|
25
|
+
...(ungrouped.length > 0 ? [{ items: ungrouped }] : []),
|
|
26
|
+
...[...groups].map(([label, members]) => ({ label, items: members })),
|
|
27
|
+
];
|
|
28
|
+
}
|
|
9
29
|
const NO_VALUE = [];
|
|
10
30
|
/**
|
|
11
31
|
* A text input that suggests options as you type, built on Ark UI.
|
|
@@ -36,12 +56,13 @@ const NO_VALUE = [];
|
|
|
36
56
|
* ui-core `Dialog` it opens in, at `z-index: 60`.
|
|
37
57
|
*/
|
|
38
58
|
export function Combobox({ items, inputValue, onInputValueChange, onSelect, label, 'aria-label': ariaLabel, placeholder, emptyText, size = 'md', disabled, invalid, className, inputRef, }) {
|
|
59
|
+
const groups = useMemo(() => groupItems(items), [items]);
|
|
39
60
|
const collection = useMemo(() => createListCollection({
|
|
40
|
-
items,
|
|
61
|
+
items: groups.flatMap((group) => group.items),
|
|
41
62
|
itemToValue: (item) => item.value,
|
|
42
63
|
itemToString: (item) => item.label,
|
|
43
64
|
isItemDisabled: (item) => item.disabled ?? false,
|
|
44
|
-
}), [
|
|
65
|
+
}), [groups]);
|
|
45
66
|
const portalContainer = useContext(PortalContainerContext);
|
|
46
67
|
/*
|
|
47
68
|
* An option, not Ark's `Empty` (role="presentation"): a listbox with no
|
|
@@ -65,6 +86,7 @@ export function Combobox({ items, inputValue, onInputValueChange, onSelect, labe
|
|
|
65
86
|
* tasks.
|
|
66
87
|
*/
|
|
67
88
|
const handleInputValueChange = useCallback((details) => flushSync(() => onInputValueChange(details.inputValue)), [onInputValueChange]);
|
|
68
|
-
|
|
89
|
+
const renderItem = (item) => (_jsxs(ArkCombobox.Item, { item: item, className: "ds-combobox__item", children: [_jsx(ArkCombobox.ItemText, { className: "ds-combobox__item-label", children: item.label }), item.description && (_jsx("span", { className: "ds-combobox__item-description", children: item.description }))] }, item.value));
|
|
90
|
+
return (_jsxs(ArkCombobox.Root, { collection: collection, className: cx('ds-combobox', `ds-combobox--${size}`, className), value: NO_VALUE, onValueChange: handleValueChange, inputValue: inputValue, onInputValueChange: handleInputValueChange, selectionBehavior: "clear", inputBehavior: "autohighlight", openOnClick: true, disabled: disabled, invalid: invalid, positioning: { sameWidth: true }, children: [label && _jsx(ArkCombobox.Label, { className: "ds-combobox__label", children: label }), _jsx(ArkCombobox.Control, { children: _jsx(ArkCombobox.Input, { ref: inputRef, className: "ds-combobox__input", placeholder: placeholder, "aria-label": ariaLabel }) }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkCombobox.Positioner, { children: _jsxs(ArkCombobox.Content, { className: "ds-combobox__content", children: [groups.map((group) => group.label === undefined ? (group.items.map(renderItem)) : (_jsxs(ArkCombobox.ItemGroup, { className: "ds-combobox__group", children: [_jsx(ArkCombobox.ItemGroupLabel, { className: "ds-combobox__group-label", children: group.label }), group.items.map(renderItem)] }, group.label))), emptyOption] }) }) })] }));
|
|
69
91
|
}
|
|
70
92
|
//# sourceMappingURL=combobox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","sourceRoot":"","sources":["../../src/combobox/combobox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAA4B,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox.js","sourceRoot":"","sources":["../../src/combobox/combobox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAA4B,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAA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SAAS,EAAE,eAAe,YAChC,KAAC,WAAW,CAAC,UAAU,cACrB,MAAC,WAAW,CAAC,OAAO,IAAC,SAAS,EAAC,sBAAsB,aAClD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACpB,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAC1B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAC5B,CAAC,CAAC,CAAC,CACF,MAAC,WAAW,CAAC,SAAS,IAAmB,SAAS,EAAC,oBAAoB,aACrE,KAAC,WAAW,CAAC,cAAc,IAAC,SAAS,EAAC,0BAA0B,YAC7D,KAAK,CAAC,KAAK,GACe,EAC5B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,KAJF,KAAK,CAAC,KAAK,CAKf,CACzB,CACF,EACA,WAAW,IACQ,GACC,GAClB,IACQ,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -29,9 +29,11 @@ export type DateInputProps = {
|
|
|
29
29
|
*/
|
|
30
30
|
locale?: string;
|
|
31
31
|
/**
|
|
32
|
-
* Fired when the
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* Fired when the date becomes half-typed, and back: some parts filled
|
|
33
|
+
* while another is empty, or the parts showing something other than the
|
|
34
|
+
* committed date (a pending digit, a year cut short). A form that must
|
|
35
|
+
* refuse a half-typed date on submit listens here: `onValueChange` cannot
|
|
36
|
+
* tell a cleared part from an untouched one.
|
|
35
37
|
*/
|
|
36
38
|
onIncompleteChange?: (incomplete: boolean) => void;
|
|
37
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":"AAOA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EA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OAAO,CAAC;IAClB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA8EF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAa,EACb,kBAAkB,EAClB,SAA8B,EAC9B,IAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,SAAS,GACV,EAAE,cAAc,2CAkDhB"}
|
|
@@ -42,8 +42,19 @@ function renderSegments(api, names, required) {
|
|
|
42
42
|
function IncompleteWatcher({ onIncompleteChange, }) {
|
|
43
43
|
const api = useDateInputContext();
|
|
44
44
|
const segments = api.getSegments().filter((segment) => segment.isEditable);
|
|
45
|
-
const
|
|
46
|
-
|
|
45
|
+
const touched = segments.filter((segment) => !segment.isPlaceholder).length;
|
|
46
|
+
/*
|
|
47
|
+
* What the parts show can run ahead of what Zag has committed: a first
|
|
48
|
+
* digit typed into a day, or a year cut to "202", leaves the value at the
|
|
49
|
+
* last whole date. Read against the committed date, so the form is told
|
|
50
|
+
* the date is half-typed whenever what it would save differs from what the
|
|
51
|
+
* user sees.
|
|
52
|
+
*/
|
|
53
|
+
const committed = api.value[0];
|
|
54
|
+
const shownDiffers = segments.some((segment) => !segment.isPlaceholder &&
|
|
55
|
+
isDatePart(segment.type) &&
|
|
56
|
+
segment.value !== committed?.[segment.type]);
|
|
57
|
+
const incomplete = touched > 0 && (touched < segments.length || shownDiffers);
|
|
47
58
|
const previous = useRef(incomplete);
|
|
48
59
|
useEffect(() => {
|
|
49
60
|
if (previous.current === incomplete)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-input.js","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,IAAI,YAAY,EAGzB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAmB,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,MAAM,kBAAkB,GAAkB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"date-input.js","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,IAAI,YAAY,EAGzB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAmB,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,MAAM,kBAAkB,GAAkB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAgEvF;;;GAGG;AACH,MAAM,KAAK,GAAG,CAAC,IAAe,EAAU,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,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AAI,CAAC,EAC7E,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,OAAO,EAClC,QAAQ,EAAE,KAAK,EAAE,QAAQ,IAAI,QAAQ,EACrC,QAAQ,EAAE,KAAK,EAAE,QAAQ,IAAI,QAAQ,EACrC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,KAAK,aAEb,KAAC,YAAY,CAAC,OAAO,IACnB,SAAS,EAAC,wBAAwB,EAClC,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,iBAAiB,YAE1B,MAAC,YAAY,CAAC,YAAY,IACxB,SAAS,EAAC,yBAAyB,gBACvB,SAAS,sBACH,KAAK,EAAE,WAAW,aAEpC,KAAC,YAAY,CAAC,OAAO,cAClB,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,GAC/B,EACtB,kBAAkB,IAAI,KAAC,iBAAiB,IAAC,kBAAkB,EAAE,kBAAkB,GAAI,IAC1D,GACP,EACvB,KAAC,YAAY,CAAC,WAAW,KAAG,IACV,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-divider {
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
border: none;
|
|
5
|
+
background-color: var(--ds-divider-color);
|
|
6
|
+
|
|
7
|
+
&.ds-divider--horizontal {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 1px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&.ds-divider--vertical {
|
|
13
|
+
width: 1px;
|
|
14
|
+
align-self: stretch;
|
|
15
|
+
min-height: 1em;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ark } from '@ark-ui/react/factory';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import './divider.css';
|
|
4
|
+
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
5
|
+
export interface DividerProps extends ComponentProps<typeof ark.div> {
|
|
6
|
+
/**
|
|
7
|
+
* `horizontal` (the default) rules across its container; `vertical` rules
|
|
8
|
+
* between the children of a row and stretches to the row's height.
|
|
9
|
+
*/
|
|
10
|
+
orientation?: DividerOrientation;
|
|
11
|
+
/**
|
|
12
|
+
* Hide the rule from assistive technology. A divider that only tidies the
|
|
13
|
+
* eye, between two buttons say, is decorative; one that separates the
|
|
14
|
+
* sections of a document is not and announces as a separator.
|
|
15
|
+
*/
|
|
16
|
+
decorative?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A hairline between two things.
|
|
20
|
+
*
|
|
21
|
+
* Renders a `div` with `role="separator"`, since an `hr` cannot be vertical.
|
|
22
|
+
* The colour is `--ds-divider-color`; the thickness is one pixel in either
|
|
23
|
+
* orientation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function Divider({ orientation, decorative, className, ...props }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../src/divider/divider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,eAAe,CAAC;AAGvB,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC;IAClE;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EACtB,WAA0B,EAC1B,UAAkB,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,YAAY,2CAUd"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ark } from '@ark-ui/react/factory';
|
|
3
|
+
import './divider.css';
|
|
4
|
+
import { cx } from '../cx';
|
|
5
|
+
/**
|
|
6
|
+
* A hairline between two things.
|
|
7
|
+
*
|
|
8
|
+
* Renders a `div` with `role="separator"`, since an `hr` cannot be vertical.
|
|
9
|
+
* The colour is `--ds-divider-color`; the thickness is one pixel in either
|
|
10
|
+
* orientation.
|
|
11
|
+
*/
|
|
12
|
+
export function Divider({ orientation = 'horizontal', decorative = false, className, ...props }) {
|
|
13
|
+
return (_jsx(ark.div, { role: decorative ? 'none' : 'separator', "aria-orientation": decorative || orientation === 'horizontal' ? undefined : orientation, "aria-hidden": decorative || undefined, className: cx('ds-divider', `ds-divider--${orientation}`, className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider.js","sourceRoot":"","sources":["../../src/divider/divider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAkB3B;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,WAAW,GAAG,YAAY,EAC1B,UAAU,GAAG,KAAK,EAClB,SAAS,EACT,GAAG,KAAK,EACK;IACb,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IACN,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,sBACrB,UAAU,IAAI,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,iBACzE,UAAU,IAAI,SAAS,EACpC,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,eAAe,WAAW,EAAE,EAAE,SAAS,CAAC,KAChE,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/divider/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/divider/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|