@manakind/ui-core 0.2.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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/badge/badge.css +147 -0
- package/dist/badge/badge.d.ts +90 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/badge.js +62 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/badge/index.js +2 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/button/button.css +155 -0
- package/dist/button/button.d.ts +41 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +20 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button/icon-button.d.ts +31 -0
- package/dist/button/icon-button.d.ts.map +1 -0
- package/dist/button/icon-button.js +18 -0
- package/dist/button/icon-button.js.map +1 -0
- package/dist/button/index.d.ts +5 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/button/index.js +3 -0
- package/dist/button/index.js.map +1 -0
- package/dist/card/card.css +79 -0
- package/dist/card/card.d.ts +72 -0
- package/dist/card/card.d.ts.map +1 -0
- package/dist/card/card.js +45 -0
- package/dist/card/card.js.map +1 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.d.ts.map +1 -0
- package/dist/card/index.js +2 -0
- package/dist/card/index.js.map +1 -0
- package/dist/cx.d.ts +17 -0
- package/dist/cx.d.ts.map +1 -0
- package/dist/cx.js +17 -0
- package/dist/cx.js.map +1 -0
- package/dist/icon/icon.css +52 -0
- package/dist/icon/icon.d.ts +51 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/icon.js +37 -0
- package/dist/icon/icon.js.map +1 -0
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.d.ts.map +1 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.d.ts.map +1 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/progress.css +95 -0
- package/dist/progress/progress.d.ts +55 -0
- package/dist/progress/progress.d.ts.map +1 -0
- package/dist/progress/progress.js +30 -0
- package/dist/progress/progress.js.map +1 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.d.ts.map +1 -0
- package/dist/select/index.js +2 -0
- package/dist/select/index.js.map +1 -0
- package/dist/select/select.css +223 -0
- package/dist/select/select.d.ts +135 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +89 -0
- package/dist/select/select.js.map +1 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/tabs/tabs.css +145 -0
- package/dist/tabs/tabs.d.ts +55 -0
- package/dist/tabs/tabs.d.ts.map +1 -0
- package/dist/tabs/tabs.js +54 -0
- package/dist/tabs/tabs.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-progress {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--ds-progress-gap);
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
& .ds-progress__header {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
gap: var(--ds-progress-gap);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
& .ds-progress__label,
|
|
16
|
+
& .ds-progress__value-text {
|
|
17
|
+
color: var(--ds-progress-label-text);
|
|
18
|
+
font-size: var(--ds-progress-label-font-size);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
& .ds-progress__track {
|
|
22
|
+
width: 100%;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
background-color: var(--ds-progress-track-bg);
|
|
25
|
+
border-radius: var(--ds-progress-track-radius);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& .ds-progress__range {
|
|
29
|
+
height: 100%;
|
|
30
|
+
background-color: var(--ds-progress-indicator-bg);
|
|
31
|
+
border-radius: var(--ds-progress-track-radius);
|
|
32
|
+
transition: width 300ms cubic-bezier(0, 0, 0.2, 1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Indeterminate: Ark sets data-state="indeterminate" on the root and
|
|
37
|
+
* leaves the range width unset, so drive a sweep instead of a fill.
|
|
38
|
+
*/
|
|
39
|
+
&[data-state="indeterminate"] .ds-progress__range {
|
|
40
|
+
width: 40%;
|
|
41
|
+
animation: ds-progress-sweep 1200ms ease-in-out infinite;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.ds-progress--sm .ds-progress__track {
|
|
45
|
+
height: var(--ds-progress-size-sm-height);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.ds-progress--md .ds-progress__track {
|
|
49
|
+
height: var(--ds-progress-size-md-height);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.ds-progress--lg .ds-progress__track {
|
|
53
|
+
height: var(--ds-progress-size-lg-height);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (prefers-reduced-motion: reduce) {
|
|
57
|
+
& .ds-progress__range {
|
|
58
|
+
transition: none;
|
|
59
|
+
animation: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* A frozen sweep would stop at whatever width it happened to occupy and
|
|
64
|
+
* read as a measured percentage — the opposite of "extent unknown". A
|
|
65
|
+
* full-width barber-pole pattern, built from the same two AA-checked
|
|
66
|
+
* colors the sweep already uses, reads as "active" without claiming a
|
|
67
|
+
* value and stays visually distinct from a genuine 100% (solid) bar.
|
|
68
|
+
* `animation` is repeated here because the rule above is less specific
|
|
69
|
+
* than the sweep rule it has to cancel.
|
|
70
|
+
*/
|
|
71
|
+
&[data-state="indeterminate"] .ds-progress__range {
|
|
72
|
+
width: 100%;
|
|
73
|
+
animation: none;
|
|
74
|
+
background-color: transparent;
|
|
75
|
+
background-image: repeating-linear-gradient(
|
|
76
|
+
45deg,
|
|
77
|
+
var(--ds-progress-indicator-bg) 0,
|
|
78
|
+
var(--ds-progress-indicator-bg) 1rem,
|
|
79
|
+
var(--ds-progress-track-bg) 1rem,
|
|
80
|
+
var(--ds-progress-track-bg) 2rem
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@keyframes ds-progress-sweep {
|
|
88
|
+
0% {
|
|
89
|
+
transform: translateX(-100%);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
100% {
|
|
93
|
+
transform: translateX(250%);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Progress as ArkProgress } from '@ark-ui/react/progress';
|
|
2
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
3
|
+
import './progress.css';
|
|
4
|
+
export type ProgressSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
/**
|
|
6
|
+
* Exactly one of `label` or `aria-label` is required — without either, the
|
|
7
|
+
* bar is announced as a bare percentage, which says nothing about what is
|
|
8
|
+
* progressing. Expressed as a discriminated union so the omission is a
|
|
9
|
+
* compile error rather than a convention, mirroring `IconProps`'
|
|
10
|
+
* label/decorative union. `label` excludes `null`, `undefined` and booleans,
|
|
11
|
+
* the values an optional one arrives as; an empty string still type-checks.
|
|
12
|
+
*/
|
|
13
|
+
type ProgressA11y = {
|
|
14
|
+
/**
|
|
15
|
+
* Visible label rendered above the track. Also becomes the bar's
|
|
16
|
+
* accessible name, so this is the preferred way to name a progress bar.
|
|
17
|
+
*/
|
|
18
|
+
label: Exclude<ReactNode, null | undefined | boolean>;
|
|
19
|
+
'aria-label'?: never;
|
|
20
|
+
} | {
|
|
21
|
+
label?: never;
|
|
22
|
+
/** Accessible name when there is no visible `label`. */
|
|
23
|
+
'aria-label': string;
|
|
24
|
+
};
|
|
25
|
+
export type ProgressProps = Omit<ComponentProps<typeof ArkProgress.Root>, 'children' | 'aria-label' | 'aria-labelledby'> & ProgressA11y & {
|
|
26
|
+
/** Track thickness. `sm` suits inline use inside a card; `lg` stands alone. */
|
|
27
|
+
size?: ProgressSize;
|
|
28
|
+
/**
|
|
29
|
+
* Text rendered opposite the label — typically a count like `2 of 5`.
|
|
30
|
+
* Presentational; the value itself is announced from `aria-valuenow`.
|
|
31
|
+
*/
|
|
32
|
+
valueText?: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Determinate (or indeterminate) progress bar, built on Ark UI.
|
|
36
|
+
*
|
|
37
|
+
* Ark owns the ARIA value semantics — `aria-valuenow`, `aria-valuemin`,
|
|
38
|
+
* `aria-valuemax`, and the indeterminate state when `value` is `null`.
|
|
39
|
+
*
|
|
40
|
+
* Naming needs care, because Ark places `role="progressbar"` on the **track**
|
|
41
|
+
* rather than the root and gives it a generated `aria-label` of the current
|
|
42
|
+
* percentage. Left alone that means the bar announces as "40%" with no hint of
|
|
43
|
+
* what is at 40%. This wrapper therefore points the track at the visible label
|
|
44
|
+
* via `aria-labelledby`, or forwards `aria-label` to the track when there is no
|
|
45
|
+
* visible label. `aria-labelledby` wins over Ark's generated `aria-label`, and
|
|
46
|
+
* the percentage is still conveyed by the value attributes.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Progress value={2} max={5} label="Milestones" valueText="2 of 5" />
|
|
50
|
+
* <Progress value={null} aria-label="Loading goals" />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function Progress({ size, label, valueText, className, 'aria-label': ariaLabel, ...props }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/progress/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AACnE,OAAO,gBAAgB,CAAC;AAGxB,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;;;;;;GAOG;AACH,KAAK,YAAY,GACb;IACE;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;IACtD,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEN,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,cAAc,CAAC,OAAO,WAAW,CAAC,IAAI,CAAC,EACvC,UAAU,GAAG,YAAY,GAAG,iBAAiB,CAC9C,GACC,YAAY,GAAG;IACb,+EAA+E;IAC/E,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEJ;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,IAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,aAAa,2CA0Bf"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Progress as ArkProgress } from '@ark-ui/react/progress';
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
import './progress.css';
|
|
5
|
+
import { cx } from '../cx';
|
|
6
|
+
/**
|
|
7
|
+
* Determinate (or indeterminate) progress bar, built on Ark UI.
|
|
8
|
+
*
|
|
9
|
+
* Ark owns the ARIA value semantics — `aria-valuenow`, `aria-valuemin`,
|
|
10
|
+
* `aria-valuemax`, and the indeterminate state when `value` is `null`.
|
|
11
|
+
*
|
|
12
|
+
* Naming needs care, because Ark places `role="progressbar"` on the **track**
|
|
13
|
+
* rather than the root and gives it a generated `aria-label` of the current
|
|
14
|
+
* percentage. Left alone that means the bar announces as "40%" with no hint of
|
|
15
|
+
* what is at 40%. This wrapper therefore points the track at the visible label
|
|
16
|
+
* via `aria-labelledby`, or forwards `aria-label` to the track when there is no
|
|
17
|
+
* visible label. `aria-labelledby` wins over Ark's generated `aria-label`, and
|
|
18
|
+
* the percentage is still conveyed by the value attributes.
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Progress value={2} max={5} label="Milestones" valueText="2 of 5" />
|
|
22
|
+
* <Progress value={null} aria-label="Loading goals" />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function Progress({ size = 'md', label, valueText, className, 'aria-label': ariaLabel, ...props }) {
|
|
26
|
+
const labelId = useId();
|
|
27
|
+
const hasHeader = Boolean(label || valueText);
|
|
28
|
+
return (_jsxs(ArkProgress.Root, { className: cx('ds-progress', `ds-progress--${size}`, className), ...props, children: [hasHeader && (_jsxs("div", { className: "ds-progress__header", children: [label ? (_jsx(ArkProgress.Label, { id: labelId, className: "ds-progress__label", children: label })) : (_jsx("span", {})), valueText && _jsx("span", { className: "ds-progress__value-text", children: valueText })] })), _jsx(ArkProgress.Track, { className: "ds-progress__track", ...(label ? { 'aria-labelledby': labelId } : { 'aria-label': ariaLabel }), children: _jsx(ArkProgress.Range, { className: "ds-progress__range" }) })] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=progress.js.map
|
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,GAClC,IACH,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/select/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/select/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/*
|
|
3
|
+
* The listbox renders in a portal, so it is not a descendant of
|
|
4
|
+
* `.ds-select` in the DOM and has to be styled at the top level.
|
|
5
|
+
*
|
|
6
|
+
* These rules come first so their `:focus-visible` (specificity 0,2,0)
|
|
7
|
+
* precedes the deeper one inside `.ds-select` (0,3,0). They target
|
|
8
|
+
* different elements, so order carries no cascade meaning — it only keeps
|
|
9
|
+
* noDescendingSpecificity quiet.
|
|
10
|
+
*/
|
|
11
|
+
/*
|
|
12
|
+
* Ark marks the closed listbox with the `hidden` attribute, which relies on
|
|
13
|
+
* the UA rule `[hidden] { display: none }`. Any author `display` beats that,
|
|
14
|
+
* so setting `display: flex` here left the popup on screen after it closed.
|
|
15
|
+
* Keep this pair together.
|
|
16
|
+
*/
|
|
17
|
+
.ds-select__content[hidden] {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ds-select__content {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
padding: var(--ds-select-content-padding);
|
|
25
|
+
border: 1px solid var(--ds-select-content-border);
|
|
26
|
+
border-radius: var(--ds-select-content-radius);
|
|
27
|
+
background-color: var(--ds-select-content-bg);
|
|
28
|
+
max-height: 20rem;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
|
|
31
|
+
&:focus-visible {
|
|
32
|
+
outline: 2px solid var(--ds-select-focus-ring);
|
|
33
|
+
/*
|
|
34
|
+
* Inset, unlike every control's ring: an outline sits outside layout
|
|
35
|
+
* bounds, so on this portalled popup an outer ring is cropped by
|
|
36
|
+
* anything that sizes to the element — screenshots showed it as
|
|
37
|
+
* corner fragments — and can clip against the viewport the popup
|
|
38
|
+
* positions to. Inside the 4px content padding it covers nothing.
|
|
39
|
+
*/
|
|
40
|
+
outline-offset: -2px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ds-select__item {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: space-between;
|
|
48
|
+
gap: var(--ds-select-item-gap);
|
|
49
|
+
padding: var(--ds-select-item-padding-block) var(--ds-select-item-padding-inline);
|
|
50
|
+
/*
|
|
51
|
+
* Nested radius, derived rather than tokenised: an inset child must curve
|
|
52
|
+
* less than its parent or the corner gap reads uneven. Parent is
|
|
53
|
+
* `--ds-select-content-radius`, inset by its padding plus its 1px border.
|
|
54
|
+
* Deriving keeps this correct when either token is retuned.
|
|
55
|
+
*/
|
|
56
|
+
border-radius: max(
|
|
57
|
+
0px,
|
|
58
|
+
calc(var(--ds-select-content-radius) - var(--ds-select-content-padding) - 1px)
|
|
59
|
+
);
|
|
60
|
+
color: var(--ds-select-item-text);
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
|
|
63
|
+
&[data-state="checked"] {
|
|
64
|
+
background-color: var(--ds-select-item-bg-selected);
|
|
65
|
+
color: var(--ds-select-item-text-selected);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* Declared after `checked` on purpose: an item that is both selected and
|
|
70
|
+
* highlighted reads as highlighted, matching the product. The check glyph
|
|
71
|
+
* inherits `currentColor`, so it flips with the row.
|
|
72
|
+
*/
|
|
73
|
+
&[data-highlighted] {
|
|
74
|
+
background-color: var(--ds-select-item-bg-highlighted);
|
|
75
|
+
color: var(--ds-select-item-text-highlighted);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&[data-disabled] {
|
|
79
|
+
opacity: var(--ds-opacity-disabled);
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* Ark renders an ItemIndicator inside every item and leaves visibility to
|
|
86
|
+
* CSS. Without this, every option shows a checkmark.
|
|
87
|
+
*/
|
|
88
|
+
.ds-select__item-indicator {
|
|
89
|
+
display: none;
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ds-select__item[data-state="checked"] .ds-select__item-indicator {
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ds-select {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
gap: var(--ds-select-content-padding);
|
|
101
|
+
|
|
102
|
+
& .ds-select__label {
|
|
103
|
+
color: var(--ds-select-trigger-text);
|
|
104
|
+
font-size: var(--ds-select-size-md-font-size);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
& .ds-select__trigger {
|
|
108
|
+
display: inline-flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: space-between;
|
|
111
|
+
gap: var(--ds-select-item-gap);
|
|
112
|
+
width: 100%;
|
|
113
|
+
border: 1px solid var(--ds-select-trigger-border);
|
|
114
|
+
border-radius: var(--ds-select-trigger-radius);
|
|
115
|
+
background-color: var(--ds-select-trigger-bg);
|
|
116
|
+
color: var(--ds-select-trigger-text);
|
|
117
|
+
font-family: inherit;
|
|
118
|
+
font-weight: inherit;
|
|
119
|
+
line-height: inherit;
|
|
120
|
+
text-align: start;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
transition:
|
|
123
|
+
background-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
124
|
+
border-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
125
|
+
box-shadow 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
* The border does the work here. The hovered fill steps only 1.10 from
|
|
129
|
+
* the resting one — measurably imperceptible — so a fill-only hover was
|
|
130
|
+
* no affordance at all.
|
|
131
|
+
*
|
|
132
|
+
* Colour AND thickness both change, because two weak signals combined
|
|
133
|
+
* read far better on an input than either alone — the fill barely
|
|
134
|
+
* moves, so the border carries the state.
|
|
135
|
+
*
|
|
136
|
+
* Safe to widen: the trigger is `border-box` with a fixed height, so
|
|
137
|
+
* the outer box is unchanged and nothing around it reflows. Measured:
|
|
138
|
+
* 280x36 before and after, with the label nudging 1px inward.
|
|
139
|
+
*/
|
|
140
|
+
/*
|
|
141
|
+
* Invalid was wired end to end — the prop reached Ark, which set
|
|
142
|
+
* `aria-invalid` and `data-invalid`, and a test asserted it — but
|
|
143
|
+
* nothing ever styled it, so the story rendered a normal control. A
|
|
144
|
+
* state that only assistive tech can perceive is half a state.
|
|
145
|
+
*
|
|
146
|
+
* Thicker as well as red, for the same reason hover is: colour alone is
|
|
147
|
+
* a weak signal on an input, and this one has to survive a red-green
|
|
148
|
+
* colour deficiency.
|
|
149
|
+
*/
|
|
150
|
+
&[data-invalid] {
|
|
151
|
+
border-color: var(--ds-select-trigger-border-invalid);
|
|
152
|
+
border-width: 2px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&:hover:not(:disabled) {
|
|
156
|
+
background-color: var(--ds-select-trigger-bg-hover);
|
|
157
|
+
|
|
158
|
+
/*
|
|
159
|
+
* Scoped away from the invalid state deliberately. This rule is both
|
|
160
|
+
* later in source AND more specific — (0,3,0) against (0,2,0) — so
|
|
161
|
+
* without the guard it repainted a danger border neutral at the exact
|
|
162
|
+
* moment a user pointed at the field. Hover still gives feedback via
|
|
163
|
+
* the fill; the border keeps saying "invalid", which is the more
|
|
164
|
+
* important message.
|
|
165
|
+
*/
|
|
166
|
+
&:not([data-invalid]) {
|
|
167
|
+
border-color: var(--ds-select-trigger-border-hover);
|
|
168
|
+
border-width: 2px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&:focus-visible {
|
|
173
|
+
outline: 2px solid var(--ds-select-focus-ring);
|
|
174
|
+
outline-offset: 3px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:disabled {
|
|
178
|
+
opacity: var(--ds-opacity-disabled);
|
|
179
|
+
cursor: not-allowed;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&[data-placeholder-shown] .ds-select__value-text {
|
|
183
|
+
color: var(--ds-select-trigger-placeholder);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
* The indicator glyph must point RIGHT; the component rotates it down when
|
|
189
|
+
* closed and up when open. That convention exists because Lineicons Pro
|
|
190
|
+
* ships no down/up chevron — only `ChevronRight` — so rotation is the only
|
|
191
|
+
* way to use a real icon here.
|
|
192
|
+
*/
|
|
193
|
+
& .ds-select__indicator {
|
|
194
|
+
display: inline-flex;
|
|
195
|
+
flex-shrink: 0;
|
|
196
|
+
color: var(--ds-select-indicator-color);
|
|
197
|
+
transform: rotate(90deg);
|
|
198
|
+
transition: transform 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
199
|
+
|
|
200
|
+
&[data-state="open"] {
|
|
201
|
+
transform: rotate(-90deg);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&.ds-select--sm .ds-select__trigger {
|
|
206
|
+
min-height: var(--ds-select-size-sm-height);
|
|
207
|
+
padding-inline: var(--ds-select-size-sm-padding-inline);
|
|
208
|
+
font-size: var(--ds-select-size-sm-font-size);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&.ds-select--md .ds-select__trigger {
|
|
212
|
+
min-height: var(--ds-select-size-md-height);
|
|
213
|
+
padding-inline: var(--ds-select-size-md-padding-inline);
|
|
214
|
+
font-size: var(--ds-select-size-md-font-size);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&.ds-select--lg .ds-select__trigger {
|
|
218
|
+
min-height: var(--ds-select-size-lg-height);
|
|
219
|
+
padding-inline: var(--ds-select-size-lg-padding-inline);
|
|
220
|
+
font-size: var(--ds-select-size-lg-font-size);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type IconSource } from '../icon/icon';
|
|
3
|
+
import './select.css';
|
|
4
|
+
export type SelectSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface SelectItem {
|
|
6
|
+
/** Stable value submitted and compared. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** Text shown in the list and in the trigger once chosen. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Individually disable this option without removing it. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface SelectProps {
|
|
14
|
+
/** Options to choose from. */
|
|
15
|
+
items: SelectItem[];
|
|
16
|
+
/**
|
|
17
|
+
* Visible label. Strongly preferred over `aria-label` — a visible label
|
|
18
|
+
* helps everyone, not only screen reader users, and gives the control a
|
|
19
|
+
* larger hit area.
|
|
20
|
+
*/
|
|
21
|
+
label?: ReactNode;
|
|
22
|
+
/** Text shown before anything is chosen. */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Controlled value.
|
|
26
|
+
*
|
|
27
|
+
* Three states, and the difference between the last two matters:
|
|
28
|
+
* - a string — that option is selected;
|
|
29
|
+
* - `null` — controlled, with nothing selected. The trigger shows the
|
|
30
|
+
* `placeholder`. Use this to reset the field programmatically;
|
|
31
|
+
* - `undefined` — **uncontrolled**. The component owns its own value, from
|
|
32
|
+
* `defaultValue` onward.
|
|
33
|
+
*
|
|
34
|
+
* Passing `undefined` to clear a controlled Select would silently hand
|
|
35
|
+
* ownership back to the component mid-life, which React warns about and
|
|
36
|
+
* which leaves the old selection on screen. Pass `null` instead.
|
|
37
|
+
*
|
|
38
|
+
* A value with no matching entry in `items` — a category deleted since it
|
|
39
|
+
* was stored — is treated as `null` rather than as a selection, so the
|
|
40
|
+
* trigger and the submitted form value agree that nothing is chosen.
|
|
41
|
+
*/
|
|
42
|
+
value?: string | null;
|
|
43
|
+
/** Initial value when uncontrolled. */
|
|
44
|
+
defaultValue?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Fired with the newly selected value, or `undefined` when the selection is
|
|
47
|
+
* emptied.
|
|
48
|
+
*
|
|
49
|
+
* `undefined` is reachable by exactly one route, and it is not the obvious
|
|
50
|
+
* one. Ark's `deselectable` behaviour — click the selected row to unselect
|
|
51
|
+
* it — is deliberately **not** enabled: a filter that needs an empty state
|
|
52
|
+
* should offer it as a real option ("All categories") rather than as a
|
|
53
|
+
* second, invisible way to reach the same place.
|
|
54
|
+
*
|
|
55
|
+
* What does empty the value is a native **form reset**. Ark tracks the
|
|
56
|
+
* enclosing form unconditionally and restores the initial value on reset,
|
|
57
|
+
* which for a Select mounted without a `defaultValue` is nothing selected.
|
|
58
|
+
* Handle `undefined` if this Select lives in a resettable form; a consumer
|
|
59
|
+
* that mirrors the value into its own state and ignores the empty payload
|
|
60
|
+
* will keep showing a selection the control no longer has.
|
|
61
|
+
*/
|
|
62
|
+
onValueChange?: (value: string | undefined) => void;
|
|
63
|
+
/** Control height and type scale. */
|
|
64
|
+
size?: SelectSize;
|
|
65
|
+
/** Disable the whole control. */
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Options are still being fetched.
|
|
69
|
+
*
|
|
70
|
+
* Renders the control inert with `aria-busy`, so it cannot be opened onto
|
|
71
|
+
* an empty list. Prefer this over passing `items={[]}` while a query is in
|
|
72
|
+
* flight — an empty dropdown reads as "no options exist", which is a
|
|
73
|
+
* different and wrong message.
|
|
74
|
+
*/
|
|
75
|
+
loading?: boolean;
|
|
76
|
+
/** Text shown in place of the placeholder while `loading`. */
|
|
77
|
+
loadingText?: string;
|
|
78
|
+
/** Marks the field invalid for assistive tech and styling. */
|
|
79
|
+
invalid?: boolean;
|
|
80
|
+
/** Name for native form participation. */
|
|
81
|
+
name?: string;
|
|
82
|
+
/** Extra class names appended after `ds-select` modifiers. */
|
|
83
|
+
className?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Render an option's content. Defaults to its `label`.
|
|
86
|
+
*
|
|
87
|
+
* The escape hatch for richer rows — a swatch, a secondary line. Whatever
|
|
88
|
+
* you return must still convey the option in text; do not return colour or
|
|
89
|
+
* an icon alone.
|
|
90
|
+
*/
|
|
91
|
+
renderItem?: (item: SelectItem) => ReactNode;
|
|
92
|
+
/**
|
|
93
|
+
* Glyph for the trigger's open/close affordance.
|
|
94
|
+
*
|
|
95
|
+
* Must point RIGHT — the component rotates it down when closed and up when
|
|
96
|
+
* open. That convention exists because Lineicons Pro ships no down or up
|
|
97
|
+
* chevron, only `ChevronRight`, so rotation is the only way to use a real
|
|
98
|
+
* icon in this slot.
|
|
99
|
+
*
|
|
100
|
+
* Defaults to a plain built-in chevron so `@manakind/ui-core` installs and
|
|
101
|
+
* renders on its own. Products override it with their own icon set.
|
|
102
|
+
*/
|
|
103
|
+
indicator?: IconSource;
|
|
104
|
+
/** Glyph marking the selected option. Same defaulting rule as {@link SelectProps.indicator}. */
|
|
105
|
+
itemIndicator?: IconSource;
|
|
106
|
+
/** Accessible name when no visible `label` is supplied. */
|
|
107
|
+
'aria-label'?: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Single-select dropdown, built on Ark UI.
|
|
111
|
+
*
|
|
112
|
+
* Ark owns the hard parts: listbox semantics, typeahead, keyboard
|
|
113
|
+
* navigation, focus return on close, and dismiss behaviour. This wrapper
|
|
114
|
+
* contributes `ds-` classes, the `--ds-select-*` bindings, and a flat
|
|
115
|
+
* `items` API in place of Ark's lower-level collection anatomy.
|
|
116
|
+
*
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <Select
|
|
119
|
+
* label="Category"
|
|
120
|
+
* placeholder="Filter by category"
|
|
121
|
+
* items={[{ value: 'all', label: 'All Categories' }]}
|
|
122
|
+
* value={selected}
|
|
123
|
+
* onValueChange={setSelected}
|
|
124
|
+
* />
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* Give it a `label` or an `aria-label` — a select with neither is announced
|
|
128
|
+
* as an unnamed combobox. For multi-select or grouped options, compose Ark's
|
|
129
|
+
* anatomy directly in a product package rather than widening this API.
|
|
130
|
+
*
|
|
131
|
+
* The listbox renders in a portal, so it escapes ancestor `overflow: hidden`
|
|
132
|
+
* rather than being clipped inside a card.
|
|
133
|
+
*/
|
|
134
|
+
export declare function Select({ items, label, placeholder, value, defaultValue, onValueChange, size, disabled, loading, loadingText, invalid, name, className, renderItem, indicator, itemIndicator, 'aria-label': ariaLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
135
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AAGtB,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB;;;;OAIG;IACH,KAA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
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
3
|
+
import { Select as ArkSelect, createListCollection } from '@ark-ui/react/select';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
|
+
import { Icon } from '../icon/icon';
|
|
6
|
+
import './select.css';
|
|
7
|
+
import { cx } from '../cx';
|
|
8
|
+
/**
|
|
9
|
+
* Single-select dropdown, built on Ark UI.
|
|
10
|
+
*
|
|
11
|
+
* Ark owns the hard parts: listbox semantics, typeahead, keyboard
|
|
12
|
+
* navigation, focus return on close, and dismiss behaviour. This wrapper
|
|
13
|
+
* contributes `ds-` classes, the `--ds-select-*` bindings, and a flat
|
|
14
|
+
* `items` API in place of Ark's lower-level collection anatomy.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Select
|
|
18
|
+
* label="Category"
|
|
19
|
+
* placeholder="Filter by category"
|
|
20
|
+
* items={[{ value: 'all', label: 'All Categories' }]}
|
|
21
|
+
* value={selected}
|
|
22
|
+
* onValueChange={setSelected}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Give it a `label` or an `aria-label` — a select with neither is announced
|
|
27
|
+
* as an unnamed combobox. For multi-select or grouped options, compose Ark's
|
|
28
|
+
* anatomy directly in a product package rather than widening this API.
|
|
29
|
+
*
|
|
30
|
+
* The listbox renders in a portal, so it escapes ancestor `overflow: hidden`
|
|
31
|
+
* rather than being clipped inside a card.
|
|
32
|
+
*/
|
|
33
|
+
export function Select({ items, label, placeholder, value, defaultValue, onValueChange, size = 'md', disabled, loading = false, loadingText = 'Loading…', invalid, name, className, renderItem, indicator = ChevronRight, itemIndicator = Check, 'aria-label': ariaLabel, }) {
|
|
34
|
+
const collection = useMemo(() => createListCollection({
|
|
35
|
+
items,
|
|
36
|
+
itemToValue: (item) => item.value,
|
|
37
|
+
itemToString: (item) => item.label,
|
|
38
|
+
isItemDisabled: (item) => item.disabled ?? false,
|
|
39
|
+
}), [items]);
|
|
40
|
+
/*
|
|
41
|
+
* A controlled value that no longer matches an option resolves to empty, so
|
|
42
|
+
* the trigger and the form agree about it.
|
|
43
|
+
*
|
|
44
|
+
* Left unresolved they disagree: the trigger already falls back to the
|
|
45
|
+
* placeholder (Ark drives that off whether a value is *set*, not whether it
|
|
46
|
+
* *resolves*), but the hidden native select ends up with no option marked
|
|
47
|
+
* selected — and a single `<select>` in that state reports its **first**
|
|
48
|
+
* option. Measured: with the value `deleted-category`, the field submits
|
|
49
|
+
* `all`. Reading the placeholder and posting a real, different value is the
|
|
50
|
+
* worse half of the mismatch, and it is silent.
|
|
51
|
+
*/
|
|
52
|
+
const controlledValue = useMemo(() => {
|
|
53
|
+
if (value === undefined)
|
|
54
|
+
return undefined;
|
|
55
|
+
if (value === null)
|
|
56
|
+
return [];
|
|
57
|
+
return items.some((item) => item.value === value) ? [value] : [];
|
|
58
|
+
}, [value, items]);
|
|
59
|
+
// Same resolution for the uncontrolled path: an unresolvable `defaultValue`
|
|
60
|
+
// produces the identical trigger-says-placeholder / form-submits-`all` split.
|
|
61
|
+
const initialValue = useMemo(() => {
|
|
62
|
+
if (defaultValue === undefined)
|
|
63
|
+
return undefined;
|
|
64
|
+
return items.some((item) => item.value === defaultValue) ? [defaultValue] : [];
|
|
65
|
+
}, [defaultValue, items]);
|
|
66
|
+
const handleValueChange = useCallback((details) => onValueChange?.(details.value[0]), [onValueChange]);
|
|
67
|
+
return (_jsxs(ArkSelect.Root, { collection: collection, className: cx('ds-select', `ds-select--${size}`, className), value: controlledValue, defaultValue: initialValue, onValueChange: handleValueChange, disabled: disabled || loading, invalid: invalid, name: name, positioning: { sameWidth: true }, children: [label && _jsx(ArkSelect.Label, { className: "ds-select__label", children: label }), _jsx(ArkSelect.Control, { children: _jsxs(ArkSelect.Trigger, { className: "ds-select__trigger", "aria-label": ariaLabel, "aria-busy": loading || undefined, children: [_jsx(ArkSelect.ValueText, { placeholder: loading ? loadingText : placeholder, className: "ds-select__value-text" }), _jsx(ArkSelect.Indicator, { className: "ds-select__indicator", children: _jsx(Icon, { source: indicator, size: "sm", decorative: true }) })] }) }), _jsx(Portal, { children: _jsx(ArkSelect.Positioner, { children: _jsx(ArkSelect.Content, { className: "ds-select__content", children: items.map((item) => (_jsxs(ArkSelect.Item, { item: item, className: "ds-select__item", children: [_jsx(ArkSelect.ItemText, { children: renderItem ? renderItem(item) : item.label }), _jsx(ArkSelect.ItemIndicator, { className: "ds-select__item-indicator", children: _jsx(Icon, { source: itemIndicator, size: "sm", decorative: true }) })] }, item.value))) }) }) }), _jsx(ArkSelect.HiddenSelect, {})] }));
|
|
68
|
+
}
|
|
69
|
+
/*
|
|
70
|
+
* Fallback glyphs, inlined on purpose.
|
|
71
|
+
*
|
|
72
|
+
* ui-core is public and MIT; the Lineicons Pro icon package is private and
|
|
73
|
+
* carries proprietary payloads, so a public package must not reference it —
|
|
74
|
+
* `check:tarballs` enforces that. A default that ships inside ui-core's own
|
|
75
|
+
* runtime therefore cannot be a licensed icon.
|
|
76
|
+
*
|
|
77
|
+
* These exist only so the package works standalone. Products override them
|
|
78
|
+
* via `indicator` / `itemIndicator`, which is how the Humanity Plus apps
|
|
79
|
+
* render Lineicons here.
|
|
80
|
+
*
|
|
81
|
+
* Note: that audit is a plain string scan over the built output, and tsc
|
|
82
|
+
* keeps comments, so naming the private package here — even in prose —
|
|
83
|
+
* would fail CI. Describe it, do not spell it.
|
|
84
|
+
*/
|
|
85
|
+
const ChevronRight = (props) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", ...props, children: _jsx("path", { d: "m6 4 4 4-4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
86
|
+
ChevronRight.displayName = 'SelectChevronRight';
|
|
87
|
+
const Check = (props) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", ...props, children: _jsx("path", { d: "m3.5 8.5 3 3 6-6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
88
|
+
Check.displayName = 'SelectCheck';
|
|
89
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAkB,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA8G3B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,YAAY,EACZ,aAAa,EACb,IAAI,GAAG,IAAI,EACX,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,UAAU,EACxB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,GAAG,YAAY,EACxB,aAAa,GAAG,KAAK,EACrB,YAAY,EAAE,SAAS,GACX;IACZ,MAAM,UAAU,GAAG,OAAO,CACxB,GAAG,EAAE,CACH,oBAAoB,CAAC;QACnB,KAAK;QACL,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK;QACjC,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK;QAClC,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,K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