@stll/ui 0.97.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/control-face.d.ts +15 -6
- package/dist/components/control-face.js +15 -6
- package/dist/components/input-control.d.ts +10 -6
- package/dist/components/input-control.js +10 -6
- package/dist/components/input.js +15 -2
- package/dist/components/matter-icon.d.ts +7 -3
- package/dist/components/matter-icon.js +56 -8
- package/dist/components/matter-icon.native.d.ts +3 -20
- package/dist/components/matter-icon.native.js +54 -14
- package/dist/components/matter-icon.shared.d.ts +25 -4
- package/dist/components/matter-icon.shared.js +31 -1
- package/dist/components/orientation-gate-face.d.ts +16 -0
- package/dist/components/orientation-gate-face.js +23 -0
- package/dist/components/orientation-gate-frame.d.ts +30 -0
- package/dist/components/orientation-gate-frame.js +63 -0
- package/dist/components/orientation-gate.d.ts +36 -0
- package/dist/components/orientation-gate.js +45 -0
- package/dist/components/scroll-area.d.ts +3 -0
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/search-field.d.ts +1 -7
- package/dist/components/search-field.js +20 -3
- package/dist/components/view-toolbar-chip-icon.d.ts +1 -0
- package/dist/components/view-toolbar-chip-icon.js +10 -0
- package/dist/components/view-toolbar-classes.d.ts +9 -4
- package/dist/components/view-toolbar-classes.js +10 -5
- package/dist/components/view-toolbar-shell.d.ts +16 -7
- package/dist/components/view-toolbar-shell.js +32 -16
- package/dist/components/view-toolbar.d.ts +5 -1
- package/dist/components/view-toolbar.js +18 -8
- package/dist/hooks/use-inline-overflow.d.ts +3 -1
- package/dist/hooks/use-inline-overflow.js +12 -6
- package/dist/kanban/subgroup-board.d.ts +3 -1
- package/dist/kanban/subgroup-board.js +22 -20
- package/dist/styles/matter-tile.css +6 -0
- package/dist/styles/theme.css +29 -0
- package/package.json +11 -2
|
@@ -148,15 +148,24 @@ export declare const TabsFace: ({ activeIndex, tabs }: {
|
|
|
148
148
|
export type SplitButtonSize = "sm" | "md";
|
|
149
149
|
/** The quiet chrome around both halves. */
|
|
150
150
|
export declare const SPLIT_BUTTON_ROOT_CLASS = "group/split hover:border-border focus-within:border-border has-[[data-popup-open]]:border-border inline-flex shrink-0 items-center rounded-lg border border-transparent p-0.5";
|
|
151
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* The primary half, over the `sm` ghost button it is built on. Grown to the
|
|
153
|
+
* 44px touch target on a coarse pointer, it keeps its content at the end, next
|
|
154
|
+
* to the chevron, so the two glyphs still read as one control.
|
|
155
|
+
*/
|
|
152
156
|
export declare const SPLIT_BUTTON_PRIMARY_CLASS: {
|
|
153
|
-
readonly md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11";
|
|
154
|
-
readonly sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11";
|
|
157
|
+
readonly md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end";
|
|
158
|
+
readonly sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end";
|
|
155
159
|
};
|
|
156
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* The chevron half, over the `sm` ghost button it is built on. On a coarse
|
|
162
|
+
* pointer it takes the full touch height but stays a slim column: the primary
|
|
163
|
+
* half already holds the 44px target, and a second 44px column beside it
|
|
164
|
+
* crowds compact bars such as the chat composer on a phone.
|
|
165
|
+
*/
|
|
157
166
|
export declare const SPLIT_BUTTON_TRIGGER_CLASS: {
|
|
158
|
-
readonly md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:
|
|
159
|
-
readonly sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:
|
|
167
|
+
readonly md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:w-6";
|
|
168
|
+
readonly sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:w-6";
|
|
160
169
|
};
|
|
161
170
|
/** The chevron that opens the secondary surface. */
|
|
162
171
|
export declare const SplitButtonChevron: () => import("react").JSX.Element;
|
|
@@ -168,15 +168,24 @@ const TabsFace = ({ activeIndex = 0, tabs }) => /* @__PURE__ */ jsx("span", {
|
|
|
168
168
|
});
|
|
169
169
|
/** The quiet chrome around both halves. */
|
|
170
170
|
const SPLIT_BUTTON_ROOT_CLASS = "group/split hover:border-border focus-within:border-border has-[[data-popup-open]]:border-border inline-flex shrink-0 items-center rounded-lg border border-transparent p-0.5";
|
|
171
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* The primary half, over the `sm` ghost button it is built on. Grown to the
|
|
173
|
+
* 44px touch target on a coarse pointer, it keeps its content at the end, next
|
|
174
|
+
* to the chevron, so the two glyphs still read as one control.
|
|
175
|
+
*/
|
|
172
176
|
const SPLIT_BUTTON_PRIMARY_CLASS = {
|
|
173
|
-
md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
174
|
-
sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11"
|
|
177
|
+
md: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-8 ps-2 pe-0.5 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end",
|
|
178
|
+
sm: "active:bg-accent/80 rounded-md [&_svg]:mx-0 [&_svg]:size-3.5 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3.5 h-7 ps-1.5 pe-0.5 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-end"
|
|
175
179
|
};
|
|
176
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* The chevron half, over the `sm` ghost button it is built on. On a coarse
|
|
182
|
+
* pointer it takes the full touch height but stays a slim column: the primary
|
|
183
|
+
* half already holds the 44px target, and a second 44px column beside it
|
|
184
|
+
* crowds compact bars such as the chat composer on a phone.
|
|
185
|
+
*/
|
|
177
186
|
const SPLIT_BUTTON_TRIGGER_CLASS = {
|
|
178
|
-
md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:
|
|
179
|
-
sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:
|
|
187
|
+
md: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-8 w-4 px-0 sm:h-8 pointer-coarse:min-h-11 pointer-coarse:w-6",
|
|
188
|
+
sm: "group-hover/split:bg-muted group-focus-within/split:bg-muted hover:bg-accent active:bg-accent/80 data-popup-open:bg-accent rounded-md [&_svg]:mx-0 h-7 w-3.5 px-0 sm:h-7 pointer-coarse:min-h-11 pointer-coarse:w-6"
|
|
180
189
|
};
|
|
181
190
|
/** The chevron that opens the secondary surface. */
|
|
182
191
|
const SplitButtonChevron = () => /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* A text control is two boxes: the bordered wrapper a caller styles and the
|
|
3
3
|
* element the text is typed into. The wrapper is what a height applies to and
|
|
4
4
|
* what the search icon centres on, so the element never states a height of its
|
|
5
|
-
* own — it
|
|
6
|
-
* floor (`min-h-*`, always the element's own
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* own — it stretches across the wrapper's flex line, whatever the wrapper turns
|
|
6
|
+
* out to be. A size only sets the floor (`min-h-*`, always the element's own
|
|
7
|
+
* line box), which is what gives an unsized control its height. Give the
|
|
8
|
+
* element a height again (`h-full` counts: against a wrapper that only has a
|
|
9
|
+
* floor, such as the coarse-pointer `min-h-11`, a percentage resolves to
|
|
10
|
+
* nothing and blocks the stretch) and the two boxes drift apart: the text sits
|
|
11
|
+
* at the top of the control while the icon stays centred. So every wrapper is
|
|
12
|
+
* a flex line, the `unstyled` one too, and a wrapper sized by its caller is
|
|
13
|
+
* filled by the stretch rather than by a percentage.
|
|
10
14
|
*/
|
|
11
15
|
export declare const INPUT_CONTROL_CLASS_NAME = "border-input bg-background text-foreground ring-ring/24 has-autofill:bg-foreground/4 has-focus-visible:border-ring has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 relative inline-flex w-full rounded-lg border text-base shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:ring-[3px] has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] pointer-coarse:min-h-11";
|
|
12
|
-
export declare const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder
|
|
16
|
+
export declare const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder min-h-8.5 w-full min-w-0 self-stretch rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:min-h-7.5 sm:leading-7.5";
|
|
13
17
|
export declare const INPUT_SIZE_CLASS_NAMES: {
|
|
14
18
|
readonly sm: "min-h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:min-h-6.5 sm:leading-6.5";
|
|
15
19
|
readonly default: undefined;
|
|
@@ -4,14 +4,18 @@ import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
|
4
4
|
* A text control is two boxes: the bordered wrapper a caller styles and the
|
|
5
5
|
* element the text is typed into. The wrapper is what a height applies to and
|
|
6
6
|
* what the search icon centres on, so the element never states a height of its
|
|
7
|
-
* own — it
|
|
8
|
-
* floor (`min-h-*`, always the element's own
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* own — it stretches across the wrapper's flex line, whatever the wrapper turns
|
|
8
|
+
* out to be. A size only sets the floor (`min-h-*`, always the element's own
|
|
9
|
+
* line box), which is what gives an unsized control its height. Give the
|
|
10
|
+
* element a height again (`h-full` counts: against a wrapper that only has a
|
|
11
|
+
* floor, such as the coarse-pointer `min-h-11`, a percentage resolves to
|
|
12
|
+
* nothing and blocks the stretch) and the two boxes drift apart: the text sits
|
|
13
|
+
* at the top of the control while the icon stays centred. So every wrapper is
|
|
14
|
+
* a flex line, the `unstyled` one too, and a wrapper sized by its caller is
|
|
15
|
+
* filled by the stretch rather than by a percentage.
|
|
12
16
|
*/
|
|
13
17
|
const INPUT_CONTROL_CLASS_NAME = "border-input bg-background text-foreground ring-ring/24 has-autofill:bg-foreground/4 has-focus-visible:border-ring has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 relative inline-flex w-full rounded-lg border text-base shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:ring-[3px] has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] pointer-coarse:min-h-11";
|
|
14
|
-
const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder
|
|
18
|
+
const INPUT_ELEMENT_CLASS_NAME = "placeholder:text-foreground-placeholder min-h-8.5 w-full min-w-0 self-stretch rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:min-h-7.5 sm:leading-7.5";
|
|
15
19
|
const INPUT_SIZE_CLASS_NAMES = {
|
|
16
20
|
[CONTROL_SIZE.sm]: "min-h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:min-h-6.5 sm:leading-6.5",
|
|
17
21
|
[CONTROL_SIZE.default]: void 0,
|
package/dist/components/input.js
CHANGED
|
@@ -3,10 +3,20 @@ import { isStructuredInputType, useContentDir } from "../hooks/use-content-dir.j
|
|
|
3
3
|
import { SearchIcon } from "../icons.js";
|
|
4
4
|
import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
|
-
import { INLINE_FIELD_CLASS_NAME, INPUT_ELEMENT_CLASS_NAME, INPUT_SIZE_CLASS_NAMES } from "./input-control.js";
|
|
6
|
+
import { INLINE_FIELD_CLASS_NAME, INPUT_CONTROL_CLASS_NAME, INPUT_ELEMENT_CLASS_NAME, INPUT_SIZE_CLASS_NAMES } from "./input-control.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
9
9
|
// src/components/input.tsx
|
|
10
|
+
/**
|
|
11
|
+
* The wrapper's own classes. An `unstyled` control draws no box but is still a
|
|
12
|
+
* flex line, as every control is: the text box stretches across whatever
|
|
13
|
+
* height a caller gives the wrapper (see `INPUT_CONTROL_CLASS_NAME`).
|
|
14
|
+
*/
|
|
15
|
+
const controlClassName = ({ inline, unstyled }) => {
|
|
16
|
+
if (inline) return "relative inline-flex w-full";
|
|
17
|
+
if (unstyled) return "inline-flex";
|
|
18
|
+
return INPUT_CONTROL_CLASS_NAME;
|
|
19
|
+
};
|
|
10
20
|
const Input = ({ className, size = CONTROL_SIZE.default, unstyled = false, inline = false, nativeInput = false, dir, onChange, ...props }) => {
|
|
11
21
|
const controlSize = typeof size === "number" ? CONTROL_SIZE.default : size;
|
|
12
22
|
const contentDir = useContentDir({
|
|
@@ -20,7 +30,10 @@ const Input = ({ className, size = CONTROL_SIZE.default, unstyled = false, inlin
|
|
|
20
30
|
};
|
|
21
31
|
const inputClassName = cn(inline ? INLINE_FIELD_CLASS_NAME : INPUT_ELEMENT_CLASS_NAME, !inline && INPUT_SIZE_CLASS_NAMES[controlSize], unstyled && !inline && "px-0", props.type === "search" && "ps-8 [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none");
|
|
22
32
|
return /* @__PURE__ */ jsxs("span", {
|
|
23
|
-
className: cn(
|
|
33
|
+
className: cn(controlClassName({
|
|
34
|
+
inline,
|
|
35
|
+
unstyled
|
|
36
|
+
}), className),
|
|
24
37
|
"data-size": size,
|
|
25
38
|
"data-slot": "input-control",
|
|
26
39
|
dir: contentDir.dir,
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { MatterIconContract } from "./matter-icon.shared.js";
|
|
1
|
+
import { MatterIconContract, MatterIdentity } from "./matter-icon.shared.js";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
export declare const MatterIconLocaleProvider: ({ children, locale }: PropsWithChildren<{
|
|
4
|
+
locale: string;
|
|
5
|
+
}>) => import("react").JSX.Element;
|
|
6
|
+
export declare const MatterIcon: (props: MatterIconProps) => import("react").JSX.Element;
|
|
2
7
|
type MatterIconProps = {
|
|
3
8
|
className?: string | undefined;
|
|
4
9
|
} & MatterIconContract;
|
|
5
|
-
export declare const MatterIcon: (props: MatterIconProps) => import("react").JSX.Element;
|
|
6
10
|
export declare const MattersNavIcon: ({ className }: {
|
|
7
11
|
className?: string | undefined;
|
|
8
12
|
}) => import("react").JSX.Element;
|
|
9
|
-
export {};
|
|
13
|
+
export type { MatterIdentity };
|
|
@@ -1,15 +1,63 @@
|
|
|
1
1
|
import { LayersIcon } from "../icons.js";
|
|
2
2
|
import { resolveMatterColor } from "../lib/matter-colors.js";
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
|
-
import { ALL_MATTERS_STACK } from "./matter-icon.shared.js";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { ALL_MATTERS_STACK, MATTER_TILE_DARK_GROUND, MATTER_TILE_LIGHT_GROUND, matterTileBackground, matterTileLetter } from "./matter-icon.shared.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
6
7
|
// src/components/matter-icon.tsx
|
|
8
|
+
const graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
9
|
+
const MatterIconLocaleContext = createContext(void 0);
|
|
10
|
+
const MatterIconLocaleProvider = ({ children, locale }) => /* @__PURE__ */ jsx(MatterIconLocaleContext, {
|
|
11
|
+
value: locale,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
7
14
|
const MatterIcon = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
const uiLocale = useContext(MatterIconLocaleContext);
|
|
16
|
+
if ("matter" in props) {
|
|
17
|
+
const { matter } = props;
|
|
18
|
+
const locale = props.locale ?? uiLocale;
|
|
19
|
+
const letter = matterTileLetter(graphemes.segment(matter.name), locale);
|
|
20
|
+
const swatch = resolveMatterColor(matter.id, matter.color);
|
|
21
|
+
const lightBackground = matterTileBackground({
|
|
22
|
+
swatch,
|
|
23
|
+
ground: MATTER_TILE_LIGHT_GROUND,
|
|
24
|
+
groundPercent: 55
|
|
25
|
+
});
|
|
26
|
+
const darkBackground = matterTileBackground({
|
|
27
|
+
swatch,
|
|
28
|
+
ground: MATTER_TILE_DARK_GROUND,
|
|
29
|
+
groundPercent: 65
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
className: cn("size-4", props.className),
|
|
34
|
+
"data-slot": "matter-tile",
|
|
35
|
+
lang: locale,
|
|
36
|
+
style: { color: `light-dark(var(${MATTER_TILE_DARK_GROUND}), var(${MATTER_TILE_LIGHT_GROUND}))` },
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
39
|
+
fill: `light-dark(${lightBackground}, ${darkBackground})`,
|
|
40
|
+
height: 24,
|
|
41
|
+
rx: 5,
|
|
42
|
+
width: 24
|
|
43
|
+
}), letter === null ? /* @__PURE__ */ jsx(LayersIcon, {
|
|
44
|
+
className: "size-[14px]",
|
|
45
|
+
height: 14,
|
|
46
|
+
width: 14,
|
|
47
|
+
x: 5,
|
|
48
|
+
y: 5
|
|
49
|
+
}) : /* @__PURE__ */ jsx("text", {
|
|
50
|
+
dominantBaseline: "central",
|
|
51
|
+
fill: "currentColor",
|
|
52
|
+
fontSize: 15,
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
textAnchor: "middle",
|
|
55
|
+
x: 12,
|
|
56
|
+
y: 12,
|
|
57
|
+
children: letter
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
13
61
|
if (props.variant === "all") return /* @__PURE__ */ jsx("svg", {
|
|
14
62
|
"aria-hidden": "true",
|
|
15
63
|
className: cn(props.className),
|
|
@@ -32,4 +80,4 @@ const MattersNavIcon = ({ className }) => /* @__PURE__ */ jsx(MatterIcon, {
|
|
|
32
80
|
className,
|
|
33
81
|
variant: "none"
|
|
34
82
|
});
|
|
35
|
-
export { MatterIcon, MattersNavIcon };
|
|
83
|
+
export { MatterIcon, MatterIconLocaleProvider, MattersNavIcon };
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import { MatterIconContract } from "./matter-icon.shared.js";
|
|
2
|
-
|
|
3
|
-
* The shared contract, with a matter's colour optional: the app's matter
|
|
4
|
-
* records leave it out when none is stored, which the web reads as null.
|
|
5
|
-
*/
|
|
6
|
-
type MatterIconProps = ({
|
|
7
|
-
matter: {
|
|
8
|
-
id: string;
|
|
9
|
-
color?: string | null | undefined;
|
|
10
|
-
};
|
|
11
|
-
} | Exclude<MatterIconContract, {
|
|
12
|
-
matter: unknown;
|
|
13
|
-
}>) & {
|
|
1
|
+
import { MatterIconContract, MatterIdentity } from "./matter-icon.shared.js";
|
|
2
|
+
type MatterIconProps = MatterIconContract & {
|
|
14
3
|
size?: number | undefined;
|
|
15
4
|
};
|
|
16
|
-
/**
|
|
17
|
-
* The web's `MatterIcon` (./matter-icon.tsx) on a phone: lucide's layers in
|
|
18
|
-
* the matter's own colour, resolved by the web's `resolveMatterColor` (the
|
|
19
|
-
* stored colour, else a swatch hashed from the id); the muted glyph for no
|
|
20
|
-
* matter; the tri-plane stack for all of them.
|
|
21
|
-
*/
|
|
22
5
|
export declare const MatterIcon: (props: MatterIconProps) => import("react").JSX.Element;
|
|
23
|
-
export {};
|
|
6
|
+
export type { MatterIdentity };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { resolveMatterColor } from "../lib/matter-colors.js";
|
|
2
|
-
import { ALL_MATTERS_STACK } from "./matter-icon.shared.js";
|
|
2
|
+
import { ALL_MATTERS_STACK, MATTER_TILE_DARK_GROUND, MATTER_TILE_LIGHT_GROUND, matterTileLetter, mixMatterTileBackground } from "./matter-icon.shared.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Text, View, useColorScheme } from "react-native";
|
|
4
5
|
import Svg, { Path } from "react-native-svg";
|
|
5
6
|
import { useCSSVariable } from "uniwind";
|
|
6
7
|
import { LayersIcon } from "lucide-react-native";
|
|
8
|
+
import { graphemeSegments } from "unicode-segmenter/grapheme";
|
|
7
9
|
// src/components/matter-icon.native.tsx
|
|
8
10
|
/**
|
|
9
11
|
* Every palette option a matter can be painted in, as a class. uniwind keeps
|
|
@@ -45,18 +47,55 @@ const themeVariable = (css) => {
|
|
|
45
47
|
* from happening.
|
|
46
48
|
*/
|
|
47
49
|
const asColour = (value) => typeof value === "string" ? value : "currentColor";
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
50
|
+
const MatterIcon = (props) => "matter" in props ? /* @__PURE__ */ jsx(MatterTile, { ...props }) : /* @__PURE__ */ jsx(MatterLayers, { ...props });
|
|
51
|
+
const MatterTile = ({ matter, locale, size = 16 }) => {
|
|
52
|
+
const isDark = useColorScheme() === "dark";
|
|
53
|
+
const swatch = resolveMatterColor(matter.id, matter.color);
|
|
54
|
+
const variable = themeVariable(swatch);
|
|
55
|
+
const [resolved, lightGround, darkGround] = useCSSVariable([
|
|
56
|
+
variable ?? MUTED,
|
|
57
|
+
MATTER_TILE_LIGHT_GROUND,
|
|
58
|
+
MATTER_TILE_DARK_GROUND
|
|
59
|
+
]);
|
|
60
|
+
const backgroundColor = mixMatterTileBackground({
|
|
61
|
+
swatch: variable === null ? swatch : resolved,
|
|
62
|
+
ground: isDark ? darkGround : lightGround,
|
|
63
|
+
groundPercent: isDark ? 65 : 55
|
|
64
|
+
});
|
|
65
|
+
const foreground = isDark ? lightGround : darkGround;
|
|
66
|
+
const segments = typeof Intl.Segmenter === "function" ? new Intl.Segmenter(locale, { granularity: "grapheme" }).segment(matter.name) : graphemeSegments(matter.name);
|
|
67
|
+
const letter = matterTileLetter(segments, locale);
|
|
68
|
+
return /* @__PURE__ */ jsx(View, {
|
|
69
|
+
accessibilityElementsHidden: true,
|
|
70
|
+
className: "bg-matter-tile-light dark:bg-matter-tile-dark",
|
|
71
|
+
importantForAccessibility: "no-hide-descendants",
|
|
72
|
+
style: {
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
backgroundColor,
|
|
75
|
+
borderRadius: size * (5 / 24),
|
|
76
|
+
height: size,
|
|
77
|
+
justifyContent: "center",
|
|
78
|
+
width: size
|
|
79
|
+
},
|
|
80
|
+
children: letter === null ? /* @__PURE__ */ jsx(LayersIcon, {
|
|
81
|
+
color: asColour(foreground),
|
|
82
|
+
size: size * (14 / 24)
|
|
83
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
84
|
+
allowFontScaling: false,
|
|
85
|
+
className: "text-matter-tile-dark dark:text-matter-tile-light",
|
|
86
|
+
style: {
|
|
87
|
+
color: typeof foreground === "string" ? foreground : void 0,
|
|
88
|
+
fontSize: size * (15 / 24),
|
|
89
|
+
fontWeight: "600"
|
|
90
|
+
},
|
|
91
|
+
children: letter
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const MatterLayers = ({ size = 16, variant }) => {
|
|
96
|
+
const [muted, ...stack] = useCSSVariable([MUTED, ...ALL_MATTERS_STACK.map(({ option }) => `--color-option-${option}`)]);
|
|
97
|
+
if (variant === "all") return /* @__PURE__ */ jsx(Svg, {
|
|
98
|
+
accessible: false,
|
|
60
99
|
fill: "none",
|
|
61
100
|
height: size,
|
|
62
101
|
viewBox: "0 0 24 24",
|
|
@@ -70,7 +109,8 @@ const MatterIcon = (props) => {
|
|
|
70
109
|
}, option))
|
|
71
110
|
});
|
|
72
111
|
return /* @__PURE__ */ jsx(LayersIcon, {
|
|
73
|
-
|
|
112
|
+
accessible: false,
|
|
113
|
+
color: asColour(muted),
|
|
74
114
|
size
|
|
75
115
|
});
|
|
76
116
|
};
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
+
export type MatterIdentity = {
|
|
2
|
+
id: string;
|
|
3
|
+
color: string | null;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
1
6
|
export type MatterIconContract = {
|
|
2
|
-
matter:
|
|
3
|
-
|
|
4
|
-
color: string | null;
|
|
5
|
-
};
|
|
7
|
+
matter: MatterIdentity;
|
|
8
|
+
locale?: string | undefined;
|
|
6
9
|
} | {
|
|
7
10
|
variant: "none" | "all";
|
|
8
11
|
};
|
|
12
|
+
export declare const MATTER_TILE_LIGHT_GROUND_PERCENT = 55;
|
|
13
|
+
export declare const MATTER_TILE_DARK_GROUND_PERCENT = 65;
|
|
14
|
+
export declare const MATTER_TILE_LIGHT_GROUND = "--color-matter-tile-light";
|
|
15
|
+
export declare const MATTER_TILE_DARK_GROUND = "--color-matter-tile-dark";
|
|
16
|
+
export declare const matterTileBackground: ({ swatch, ground, groundPercent }: {
|
|
17
|
+
swatch: string;
|
|
18
|
+
ground: string;
|
|
19
|
+
groundPercent: number;
|
|
20
|
+
}) => string;
|
|
21
|
+
/** Native theme variables are normalized to RGB hex when resolved. */
|
|
22
|
+
export declare const mixMatterTileBackground: ({ swatch, ground, groundPercent }: {
|
|
23
|
+
swatch: number | string | undefined;
|
|
24
|
+
ground: number | string | undefined;
|
|
25
|
+
groundPercent: number;
|
|
26
|
+
}) => string | undefined;
|
|
27
|
+
export declare const matterTileLetter: (segments: Iterable<{
|
|
28
|
+
segment: string;
|
|
29
|
+
}>, locale?: string) => string | null;
|
|
9
30
|
/** The three planes of the "all matters" glyph, top to bottom, in their tints. */
|
|
10
31
|
export declare const ALL_MATTERS_STACK: readonly [{
|
|
11
32
|
readonly d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z";
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
// src/components/matter-icon.shared.ts
|
|
2
|
+
const MATTER_TILE_LIGHT_GROUND_PERCENT = 55;
|
|
3
|
+
const MATTER_TILE_DARK_GROUND_PERCENT = 65;
|
|
4
|
+
const MATTER_TILE_LIGHT_GROUND = "--color-matter-tile-light";
|
|
5
|
+
const MATTER_TILE_DARK_GROUND = "--color-matter-tile-dark";
|
|
6
|
+
const matterTileBackground = ({ swatch, ground, groundPercent }) => `color-mix(in srgb, ${swatch}, var(${ground}) ${groundPercent}%)`;
|
|
7
|
+
const HEX_DIGITS = "0123456789abcdef";
|
|
8
|
+
const hexByte = (pair) => {
|
|
9
|
+
const lower = pair.toLowerCase();
|
|
10
|
+
return HEX_DIGITS.indexOf(lower.charAt(0)) * 16 + HEX_DIGITS.indexOf(lower.charAt(1));
|
|
11
|
+
};
|
|
12
|
+
/** Native theme variables are normalized to RGB hex when resolved. */
|
|
13
|
+
const mixMatterTileBackground = ({ swatch, ground, groundPercent }) => {
|
|
14
|
+
if (typeof ground !== "string" || !/^#[0-9a-f]{6}$/iu.test(ground)) return;
|
|
15
|
+
if (typeof swatch !== "string" || !/^#[0-9a-f]{6}$/iu.test(swatch)) return ground;
|
|
16
|
+
const groundWeight = groundPercent / 100;
|
|
17
|
+
return `#${[
|
|
18
|
+
1,
|
|
19
|
+
3,
|
|
20
|
+
5
|
|
21
|
+
].map((offset) => {
|
|
22
|
+
const source = hexByte(swatch.slice(offset, offset + 2));
|
|
23
|
+
const neutral = hexByte(ground.slice(offset, offset + 2));
|
|
24
|
+
return Math.round(source * (1 - groundWeight) + neutral * groundWeight).toString(16).padStart(2, "0");
|
|
25
|
+
}).join("")}`;
|
|
26
|
+
};
|
|
27
|
+
const LETTER_OR_DIGIT = /[\p{L}\p{Nd}]/u;
|
|
28
|
+
const matterTileLetter = (segments, locale) => {
|
|
29
|
+
for (const { segment } of segments) if (LETTER_OR_DIGIT.test(segment)) return segment.toLocaleUpperCase(locale);
|
|
30
|
+
return null;
|
|
31
|
+
};
|
|
2
32
|
/** The three planes of the "all matters" glyph, top to bottom, in their tints. */
|
|
3
33
|
const ALL_MATTERS_STACK = [
|
|
4
34
|
{
|
|
@@ -14,4 +44,4 @@ const ALL_MATTERS_STACK = [
|
|
|
14
44
|
option: "green"
|
|
15
45
|
}
|
|
16
46
|
];
|
|
17
|
-
export { ALL_MATTERS_STACK };
|
|
47
|
+
export { ALL_MATTERS_STACK, MATTER_TILE_DARK_GROUND, MATTER_TILE_DARK_GROUND_PERCENT, MATTER_TILE_LIGHT_GROUND, MATTER_TILE_LIGHT_GROUND_PERCENT, matterTileBackground, matterTileLetter, mixMatterTileBackground };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OrientationGateFit } from "./orientation-gate-frame.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* `OrientationGate` (./orientation-gate.tsx) for a loading view: the same
|
|
5
|
+
* prompt in the same box, its "show anyway" button a face nothing can press.
|
|
6
|
+
* A loading view cannot know the reader's choice, so its content stays behind
|
|
7
|
+
* the prompt until the loaded view, which does, replaces it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const OrientationGateFace: ({ title, description, revealLabel, fit, children }: {
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
description: ReactNode;
|
|
12
|
+
revealLabel: ReactNode;
|
|
13
|
+
fit?: OrientationGateFit | undefined;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}) => import("react").JSX.Element;
|
|
16
|
+
export type { OrientationGateFit };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ButtonFace } from "./control-face.js";
|
|
2
|
+
import { ORIENTATION_GATE_ACTION, OrientationGateFrame } from "./orientation-gate-frame.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/orientation-gate-face.tsx
|
|
5
|
+
/**
|
|
6
|
+
* `OrientationGate` (./orientation-gate.tsx) for a loading view: the same
|
|
7
|
+
* prompt in the same box, its "show anyway" button a face nothing can press.
|
|
8
|
+
* A loading view cannot know the reader's choice, so its content stays behind
|
|
9
|
+
* the prompt until the loaded view, which does, replaces it.
|
|
10
|
+
*/
|
|
11
|
+
const OrientationGateFace = ({ title, description, revealLabel, fit, children }) => /* @__PURE__ */ jsx(OrientationGateFrame, {
|
|
12
|
+
action: /* @__PURE__ */ jsx(ButtonFace, {
|
|
13
|
+
size: ORIENTATION_GATE_ACTION.size,
|
|
14
|
+
variant: ORIENTATION_GATE_ACTION.variant,
|
|
15
|
+
children: revealLabel
|
|
16
|
+
}),
|
|
17
|
+
description,
|
|
18
|
+
fit,
|
|
19
|
+
revealed: false,
|
|
20
|
+
title,
|
|
21
|
+
children
|
|
22
|
+
});
|
|
23
|
+
export { OrientationGateFace };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The area the prompt fills and centres itself in. `free-space` takes a flex
|
|
4
|
+
* column's free space beside the content's siblings; `container` fills its
|
|
5
|
+
* parent's whole height, for a gate that is all a scroll area holds.
|
|
6
|
+
*/
|
|
7
|
+
export type OrientationGateFit = "free-space" | "container";
|
|
8
|
+
/** The "show anyway" button's size and variant, and its face's. */
|
|
9
|
+
export declare const ORIENTATION_GATE_ACTION: {
|
|
10
|
+
readonly size: "sm";
|
|
11
|
+
readonly variant: "outline";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The prompt is for a phone, not for a narrow window: it needs the coarse
|
|
15
|
+
* pointer as well as the portrait viewport below `md`, so a desktop browser
|
|
16
|
+
* docked to the side of a screen keeps its content. Turning the phone hands
|
|
17
|
+
* over to the content with no script, so the prompt also draws in a
|
|
18
|
+
* server-rendered or loading view.
|
|
19
|
+
*/
|
|
20
|
+
export declare const OrientationGateFrame: ({ title, description, action, revealed, contentStart, fit, children }: {
|
|
21
|
+
title: ReactNode;
|
|
22
|
+
description: ReactNode;
|
|
23
|
+
/** The "show anyway" button, or its face. */
|
|
24
|
+
action: ReactNode;
|
|
25
|
+
revealed: boolean;
|
|
26
|
+
/** Drawn first in the content once it is revealed (a focus target). */
|
|
27
|
+
contentStart?: ReactNode;
|
|
28
|
+
fit?: OrientationGateFit | undefined;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { RotateCwIcon, SmartphoneIcon } from "../icons.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/orientation-gate-frame.tsx
|
|
5
|
+
const ORIENTATION_GATE_FIT_CLASS = {
|
|
6
|
+
"free-space": "min-h-64 flex-1",
|
|
7
|
+
container: "min-h-[max(--spacing(64),100%)]"
|
|
8
|
+
};
|
|
9
|
+
/** The "show anyway" button's size and variant, and its face's. */
|
|
10
|
+
const ORIENTATION_GATE_ACTION = {
|
|
11
|
+
size: "sm",
|
|
12
|
+
variant: "outline"
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The prompt is for a phone, not for a narrow window: it needs the coarse
|
|
16
|
+
* pointer as well as the portrait viewport below `md`, so a desktop browser
|
|
17
|
+
* docked to the side of a screen keeps its content. Turning the phone hands
|
|
18
|
+
* over to the content with no script, so the prompt also draws in a
|
|
19
|
+
* server-rendered or loading view.
|
|
20
|
+
*/
|
|
21
|
+
const OrientationGateFrame = ({ title, description, action, revealed, contentStart, fit = "free-space", children }) => /* @__PURE__ */ jsxs(Fragment, { children: [revealed ? null : /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: cn("bg-background hidden flex-col items-center justify-center gap-4 px-6 py-8 text-center max-md:portrait:pointer-coarse:flex", ORIENTATION_GATE_FIT_CLASS[fit]),
|
|
23
|
+
"data-slot": "orientation-gate",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx(RotateToLandscapeGlyph, {}),
|
|
26
|
+
/* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "max-w-72 space-y-1",
|
|
28
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
29
|
+
className: "text-sm font-medium text-balance",
|
|
30
|
+
children: title
|
|
31
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
32
|
+
className: "text-muted-foreground text-sm text-pretty",
|
|
33
|
+
children: description
|
|
34
|
+
})]
|
|
35
|
+
}),
|
|
36
|
+
action
|
|
37
|
+
]
|
|
38
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: cn("contents", revealed ? void 0 : "max-md:portrait:pointer-coarse:hidden"),
|
|
40
|
+
"data-slot": "orientation-gate-content",
|
|
41
|
+
children: [revealed ? contentStart : null, children]
|
|
42
|
+
})] });
|
|
43
|
+
/**
|
|
44
|
+
* A phone turning from portrait to landscape inside the arrow that says which
|
|
45
|
+
* way: the two turn a quarter together, rest, fade and start again. Transform
|
|
46
|
+
* and opacity only. Under reduced motion it is a still picture of the upright
|
|
47
|
+
* phone in its arrow, which says the same thing.
|
|
48
|
+
*/
|
|
49
|
+
const RotateToLandscapeGlyph = () => /* @__PURE__ */ jsxs("span", {
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
className: "text-muted-foreground relative flex size-14 shrink-0 items-center justify-center",
|
|
52
|
+
"data-slot": "rotate-to-landscape-glyph",
|
|
53
|
+
children: [/* @__PURE__ */ jsx(RotateCwIcon, {
|
|
54
|
+
className: "animate-rotate-hint absolute inset-0 size-full motion-reduce:animate-none",
|
|
55
|
+
"data-slot": "rotate-to-landscape-arrow",
|
|
56
|
+
strokeWidth: 1.25
|
|
57
|
+
}), /* @__PURE__ */ jsx(SmartphoneIcon, {
|
|
58
|
+
className: "animate-rotate-hint size-6 motion-reduce:animate-none",
|
|
59
|
+
"data-slot": "rotate-to-landscape-device",
|
|
60
|
+
strokeWidth: 1.5
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
export { ORIENTATION_GATE_ACTION, OrientationGateFrame };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OrientationGateFit } from "./orientation-gate-frame.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export type OrientationGateProps = {
|
|
4
|
+
/** The gate's heading: what to do ("Rotate to landscape"). */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** One line on what the reader can do: turn the phone, or show it anyway. */
|
|
7
|
+
description: ReactNode;
|
|
8
|
+
/** The button that shows the content upright all the same. */
|
|
9
|
+
revealLabel: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* The content's name ("Table"). Once the reader has asked to see it, their
|
|
12
|
+
* focus lands on it, at the start of the content, where the button they
|
|
13
|
+
* pressed was.
|
|
14
|
+
*/
|
|
15
|
+
contentLabel: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the reader chose to see the content upright. The gate then steps
|
|
18
|
+
* aside for good and the content renders at every orientation; the caller
|
|
19
|
+
* owns how long that choice lasts.
|
|
20
|
+
*/
|
|
21
|
+
revealed: boolean;
|
|
22
|
+
/** Shows the content upright: the caller records the choice. */
|
|
23
|
+
onReveal: () => void;
|
|
24
|
+
/** The area the prompt fills and centres itself in; `free-space` by default. */
|
|
25
|
+
fit?: OrientationGateFit | undefined;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Content too wide for a phone held upright (a table), behind a prompt to
|
|
30
|
+
* turn the phone sideways, and a button that shows it upright anyway. The
|
|
31
|
+
* prompt fills the area it is given (see `fit`) and centres itself in it, so
|
|
32
|
+
* it sits in the middle of whatever is left below the caller's toolbar. A
|
|
33
|
+
* loading view draws `OrientationGateFace` (@stll/ui/orientation-gate-face).
|
|
34
|
+
*/
|
|
35
|
+
export declare const OrientationGate: ({ title, description, revealLabel, contentLabel, revealed, onReveal, fit, children }: OrientationGateProps) => import("react").JSX.Element;
|
|
36
|
+
export type { OrientationGateFit };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
import { ORIENTATION_GATE_ACTION, OrientationGateFrame } from "./orientation-gate-frame.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useRef } from "react";
|
|
6
|
+
// src/components/orientation-gate.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Content too wide for a phone held upright (a table), behind a prompt to
|
|
9
|
+
* turn the phone sideways, and a button that shows it upright anyway. The
|
|
10
|
+
* prompt fills the area it is given (see `fit`) and centres itself in it, so
|
|
11
|
+
* it sits in the middle of whatever is left below the caller's toolbar. A
|
|
12
|
+
* loading view draws `OrientationGateFace` (@stll/ui/orientation-gate-face).
|
|
13
|
+
*/
|
|
14
|
+
const OrientationGate = ({ title, description, revealLabel, contentLabel, revealed, onReveal, fit, children }) => {
|
|
15
|
+
const revealPressedRef = useRef(false);
|
|
16
|
+
return /* @__PURE__ */ jsx(OrientationGateFrame, {
|
|
17
|
+
action: /* @__PURE__ */ jsx(Button, {
|
|
18
|
+
onClick: () => {
|
|
19
|
+
revealPressedRef.current = true;
|
|
20
|
+
onReveal();
|
|
21
|
+
},
|
|
22
|
+
size: ORIENTATION_GATE_ACTION.size,
|
|
23
|
+
variant: ORIENTATION_GATE_ACTION.variant,
|
|
24
|
+
children: revealLabel
|
|
25
|
+
}),
|
|
26
|
+
contentStart: /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: "sr-only",
|
|
28
|
+
"data-slot": "orientation-gate-content-start",
|
|
29
|
+
ref: (node) => {
|
|
30
|
+
if (node !== null && revealPressedRef.current) {
|
|
31
|
+
revealPressedRef.current = false;
|
|
32
|
+
node.focus({ preventScroll: true });
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
tabIndex: -1,
|
|
36
|
+
children: contentLabel
|
|
37
|
+
}),
|
|
38
|
+
description,
|
|
39
|
+
fit,
|
|
40
|
+
revealed,
|
|
41
|
+
title,
|
|
42
|
+
children
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export { OrientationGate };
|
|
@@ -9,6 +9,9 @@ import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
|
9
9
|
* honest answer is to make it wrap. An element that genuinely needs the axis
|
|
10
10
|
* (a wide table, a code block) carries its own `overflow-x-auto` and scrolls
|
|
11
11
|
* locally, inside the column.
|
|
12
|
+
*
|
|
13
|
+
* The primitive sets `overflow: scroll` inline on the viewport, which a plain
|
|
14
|
+
* class cannot override, so the vertical axis lock is `!important`.
|
|
12
15
|
*/
|
|
13
16
|
type ScrollAreaAxis = "both" | "vertical";
|
|
14
17
|
declare const ScrollArea: ({ axis, className, children, scrollFade, scrollbarClassName, scrollbarGutter, viewportRef, ...props }: ScrollArea$1.Root.Props & {
|
|
@@ -5,7 +5,7 @@ import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
|
5
5
|
// src/components/scroll-area.tsx
|
|
6
6
|
const AXIS_VIEWPORT_CLASS = {
|
|
7
7
|
both: "",
|
|
8
|
-
vertical: "overflow-x-hidden"
|
|
8
|
+
vertical: "overflow-x-hidden!"
|
|
9
9
|
};
|
|
10
10
|
const ScrollArea = ({ axis = "both", className, children, scrollFade = false, scrollbarClassName, scrollbarGutter = false, viewportRef, ...props }) => /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
|
|
11
11
|
className: cn("flex size-full min-h-0 flex-col", className),
|
|
@@ -9,11 +9,5 @@ type SearchFieldProps = Omit<React.ComponentProps<typeof InputGroupInput>, "onCh
|
|
|
9
9
|
/** Class for the outer group (width, margins). */
|
|
10
10
|
groupClassName?: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
* Filter-as-you-type search box: leading magnifier, clear button once there is
|
|
14
|
-
* a query, and Escape clears before it blurs. The caller owns the query state
|
|
15
|
-
* and the matching; keep matching local and instant for lists under a few
|
|
16
|
-
* hundred rows.
|
|
17
|
-
*/
|
|
18
|
-
declare const SearchField: ({ value, onValueChange, clearLabel, disabledReason, groupClassName, className, onKeyDown, ...props }: SearchFieldProps) => React.JSX.Element;
|
|
12
|
+
declare const SearchField: ({ value, onValueChange, clearLabel, disabledReason, groupClassName, className, onKeyDown, size, ...props }: SearchFieldProps) => React.JSX.Element;
|
|
19
13
|
export { SearchField, type SearchFieldProps };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { XIcon } from "../icons.js";
|
|
3
|
+
import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
3
4
|
import { cn } from "../lib/utils.js";
|
|
4
5
|
import { Button } from "./button.js";
|
|
5
6
|
import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
|
|
@@ -10,14 +11,30 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
11
|
* a query, and Escape clears before it blurs. The caller owns the query state
|
|
11
12
|
* and the matching; keep matching local and instant for lists under a few
|
|
12
13
|
* hundred rows.
|
|
14
|
+
*
|
|
15
|
+
* On a phone a field that stands on its own grows to a finger's 44px. A
|
|
16
|
+
* `size="sm"` field sits in a toolbar row beside `xs` buttons, so it keeps its
|
|
17
|
+
* compact height there: at 44px it would fill the row from border to border.
|
|
18
|
+
* Under a coarse pointer it reaches 44px all the same, through an invisible
|
|
19
|
+
* area above and below the drawn field (never to the sides, where the row's
|
|
20
|
+
* buttons sit) that focuses the input.
|
|
13
21
|
*/
|
|
14
|
-
const
|
|
15
|
-
|
|
22
|
+
const COMPACT_TOUCH_TARGET_CLASS = "isolate pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:top-1/2 pointer-coarse:after:-z-10 pointer-coarse:after:min-h-11 pointer-coarse:after:-translate-y-1/2";
|
|
23
|
+
/** A press on the group's own area, outside its input and buttons, types. */
|
|
24
|
+
const focusInputOnGroupPress = (event) => {
|
|
25
|
+
if (event.target !== event.currentTarget) return;
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
event.currentTarget.querySelector("input")?.focus();
|
|
28
|
+
};
|
|
29
|
+
const SearchField = ({ value, onValueChange, clearLabel, disabledReason, groupClassName, className, onKeyDown, size = CONTROL_SIZE.default, ...props }) => /* @__PURE__ */ jsxs(InputGroup, {
|
|
30
|
+
className: cn(size === CONTROL_SIZE.sm ? COMPACT_TOUCH_TARGET_CLASS : "min-h-11 sm:min-h-0", groupClassName),
|
|
31
|
+
onMouseDown: focusInputOnGroupPress,
|
|
16
32
|
children: [/* @__PURE__ */ jsx(InputGroupInput, {
|
|
17
33
|
autoComplete: "off",
|
|
18
34
|
spellCheck: false,
|
|
19
35
|
...props,
|
|
20
|
-
className: cn("max-sm:h-11 max-sm:leading-11", className),
|
|
36
|
+
className: cn(size !== CONTROL_SIZE.sm && "max-sm:h-11 max-sm:leading-11", className),
|
|
37
|
+
size,
|
|
21
38
|
onChange: (event) => {
|
|
22
39
|
onValueChange(event.target.value);
|
|
23
40
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ViewToolbarChipSelectIcon: () => import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChevronsUpDownIcon } from "../icons.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/view-toolbar-chip-icon.tsx
|
|
4
|
+
const ViewToolbarChipSelectIcon = () => /* @__PURE__ */ jsx("span", {
|
|
5
|
+
"aria-hidden": "true",
|
|
6
|
+
className: "text-muted-foreground flex",
|
|
7
|
+
"data-slot": "view-toolbar-chip-select-icon",
|
|
8
|
+
children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, {})
|
|
9
|
+
});
|
|
10
|
+
export { ViewToolbarChipSelectIcon };
|
|
@@ -5,9 +5,14 @@ export declare const VIEW_FILTER_BUTTON: {
|
|
|
5
5
|
};
|
|
6
6
|
/** The glyph on the "add a filter" button. */
|
|
7
7
|
export declare const VIEW_FILTER_ICON_CLASS_NAME = "size-3.5";
|
|
8
|
-
/**
|
|
9
|
-
export declare const
|
|
10
|
-
readonly className: "gap-1.5
|
|
8
|
+
/** The primary action inside any toolbar chip. */
|
|
9
|
+
export declare const VIEW_TOOLBAR_CHIP_ACTION: {
|
|
10
|
+
readonly className: "justify-start gap-1.5";
|
|
11
11
|
readonly size: "xs";
|
|
12
|
-
readonly variant: "
|
|
12
|
+
readonly variant: "ghost";
|
|
13
|
+
};
|
|
14
|
+
/** The secondary action on a split chip. */
|
|
15
|
+
export declare const VIEW_TOOLBAR_CHIP_ICON_ACTION: {
|
|
16
|
+
readonly size: "icon-xs";
|
|
17
|
+
readonly variant: "ghost";
|
|
13
18
|
};
|
|
@@ -6,10 +6,15 @@ const VIEW_FILTER_BUTTON = {
|
|
|
6
6
|
};
|
|
7
7
|
/** The glyph on the "add a filter" button. */
|
|
8
8
|
const VIEW_FILTER_ICON_CLASS_NAME = "size-3.5";
|
|
9
|
-
/**
|
|
10
|
-
const
|
|
11
|
-
className: "gap-1.5
|
|
9
|
+
/** The primary action inside any toolbar chip. */
|
|
10
|
+
const VIEW_TOOLBAR_CHIP_ACTION = {
|
|
11
|
+
className: "justify-start gap-1.5",
|
|
12
12
|
size: "xs",
|
|
13
|
-
variant: "
|
|
13
|
+
variant: "ghost"
|
|
14
|
+
};
|
|
15
|
+
/** The secondary action on a split chip. */
|
|
16
|
+
const VIEW_TOOLBAR_CHIP_ICON_ACTION = {
|
|
17
|
+
size: "icon-xs",
|
|
18
|
+
variant: "ghost"
|
|
14
19
|
};
|
|
15
|
-
export { VIEW_FILTER_BUTTON,
|
|
20
|
+
export { VIEW_FILTER_BUTTON, VIEW_FILTER_ICON_CLASS_NAME, VIEW_TOOLBAR_CHIP_ACTION, VIEW_TOOLBAR_CHIP_ICON_ACTION };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, ReactNode } from "react";
|
|
1
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* The one row that holds a view switcher and its toolbar. It never wraps: at
|
|
4
4
|
* any width the tabs and the controls share a single line, the tabs taking the
|
|
@@ -10,15 +10,24 @@ export declare const ViewChromeBar: ({ className, ...props }: ComponentProps<"di
|
|
|
10
10
|
* one line and scroll horizontally once they outgrow half the row on a phone,
|
|
11
11
|
* or two thirds of it from `md` up, so the tabs beside them always keep room
|
|
12
12
|
* for a whole tab and scroll, and a control past the edge is scrolled to rather
|
|
13
|
-
* than clipped.
|
|
13
|
+
* than clipped. The scrollbar stays hidden, so an edge with controls past it
|
|
14
|
+
* fades out rather than cutting a control off flush with the screen's edge.
|
|
14
15
|
*/
|
|
15
|
-
export declare const ViewToolbarChrome: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
16
|
+
export declare const ViewToolbarChrome: ({ className, ref, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
16
17
|
/** The face of `ViewFilterButton` (./view-toolbar.tsx), for a loading view. */
|
|
17
18
|
export declare const ViewFilterButtonFace: () => import("react").JSX.Element;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/** The shared border, surface and height around a toolbar chip's actions. */
|
|
20
|
+
export declare const ViewToolbarChip: ({ children }: {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}) => import("react").JSX.Element;
|
|
23
|
+
/** A chip's loaded dimensions before its actions and labels are ready. */
|
|
24
|
+
export declare const ViewToolbarChipFace: ({ children, className, endIcon, showSelectIcon }: {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
endIcon?: ReactElement;
|
|
28
|
+
showSelectIcon?: boolean;
|
|
29
|
+
}) => import("react").JSX.Element;
|
|
30
|
+
/** The loading face of a filter chip. */
|
|
22
31
|
export declare const ViewFilterChipFace: ({ children }: {
|
|
23
32
|
children: ReactNode;
|
|
24
33
|
}) => import("react").JSX.Element;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useComposedRefs } from "../effects/refs.js";
|
|
1
3
|
import { FilterIcon } from "../icons.js";
|
|
4
|
+
import { SCROLL_EDGE_FADE_CLASS, fadeScrollEdges } from "../lib/scroll-edge-fade.js";
|
|
2
5
|
import { cn } from "../lib/utils.js";
|
|
3
6
|
import { ButtonFace } from "./control-face.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
7
|
+
import { ViewToolbarChipSelectIcon } from "./view-toolbar-chip-icon.js";
|
|
8
|
+
import { VIEW_FILTER_BUTTON, VIEW_FILTER_ICON_CLASS_NAME, VIEW_TOOLBAR_CHIP_ACTION, VIEW_TOOLBAR_CHIP_ICON_ACTION } from "./view-toolbar-classes.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
10
|
// src/components/view-toolbar-shell.tsx
|
|
7
11
|
/**
|
|
8
12
|
* The one row that holds a view switcher and its toolbar. It never wraps: at
|
|
@@ -18,26 +22,38 @@ const ViewChromeBar = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
18
22
|
* one line and scroll horizontally once they outgrow half the row on a phone,
|
|
19
23
|
* or two thirds of it from `md` up, so the tabs beside them always keep room
|
|
20
24
|
* for a whole tab and scroll, and a control past the edge is scrolled to rather
|
|
21
|
-
* than clipped.
|
|
25
|
+
* than clipped. The scrollbar stays hidden, so an edge with controls past it
|
|
26
|
+
* fades out rather than cutting a control off flush with the screen's edge.
|
|
22
27
|
*/
|
|
23
|
-
const ViewToolbarChrome = ({ className, ...props }) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
const ViewToolbarChrome = ({ className, ref, ...props }) => {
|
|
29
|
+
const stripRef = useComposedRefs(fadeScrollEdges, ref);
|
|
30
|
+
return /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: cn("ms-auto flex max-w-1/2 min-w-0 shrink-0 [scrollbar-width:none] flex-nowrap items-center gap-1 overflow-x-auto px-2 py-1 [-ms-overflow-style:none] md:max-w-2/3 [&::-webkit-scrollbar]:hidden", SCROLL_EDGE_FADE_CLASS, className),
|
|
32
|
+
ref: stripRef,
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
};
|
|
27
36
|
/** The face of `ViewFilterButton` (./view-toolbar.tsx), for a loading view. */
|
|
28
37
|
const ViewFilterButtonFace = () => /* @__PURE__ */ jsx(ButtonFace, {
|
|
29
38
|
size: VIEW_FILTER_BUTTON.size,
|
|
30
39
|
variant: VIEW_FILTER_BUTTON.variant,
|
|
31
40
|
children: /* @__PURE__ */ jsx(FilterIcon, { className: VIEW_FILTER_ICON_CLASS_NAME })
|
|
32
41
|
});
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const ViewFilterChipFace = ({ children }) => /* @__PURE__ */ jsx(ButtonFace, {
|
|
38
|
-
className: VIEW_FILTER_CHIP.className,
|
|
39
|
-
size: VIEW_FILTER_CHIP.size,
|
|
40
|
-
variant: VIEW_FILTER_CHIP.variant,
|
|
42
|
+
/** The shared border, surface and height around a toolbar chip's actions. */
|
|
43
|
+
const ViewToolbarChip = ({ children }) => /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "bg-muted/50 inline-flex shrink-0 items-center rounded-md border",
|
|
45
|
+
"data-slot": "view-toolbar-chip",
|
|
41
46
|
children
|
|
42
47
|
});
|
|
43
|
-
|
|
48
|
+
/** A chip's loaded dimensions before its actions and labels are ready. */
|
|
49
|
+
const ViewToolbarChipFace = ({ children, className, endIcon, showSelectIcon = false }) => /* @__PURE__ */ jsxs(ViewToolbarChip, { children: [/* @__PURE__ */ jsxs(ButtonFace, {
|
|
50
|
+
...VIEW_TOOLBAR_CHIP_ACTION,
|
|
51
|
+
className: cn(VIEW_TOOLBAR_CHIP_ACTION.className, className),
|
|
52
|
+
children: [children, showSelectIcon && /* @__PURE__ */ jsx(ViewToolbarChipSelectIcon, {})]
|
|
53
|
+
}), endIcon !== void 0 && /* @__PURE__ */ jsx(ButtonFace, {
|
|
54
|
+
...VIEW_TOOLBAR_CHIP_ICON_ACTION,
|
|
55
|
+
children: endIcon
|
|
56
|
+
})] });
|
|
57
|
+
/** The loading face of a filter chip. */
|
|
58
|
+
const ViewFilterChipFace = ({ children }) => /* @__PURE__ */ jsx(ViewToolbarChipFace, { children });
|
|
59
|
+
export { ViewChromeBar, ViewFilterButtonFace, ViewFilterChipFace, ViewToolbarChip, ViewToolbarChipFace, ViewToolbarChrome };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Button } from "./button.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
+
import { Select } from "@base-ui/react/select";
|
|
3
4
|
import { ViewChromeBar, ViewToolbarChrome } from "./view-toolbar-shell.js";
|
|
4
5
|
type ViewFilterButtonProps = Omit<ComponentProps<typeof Button>, "children" | "size" | "variant" | "aria-label" | "title"> & {
|
|
5
6
|
label: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const ViewFilterButton: ({ label, ...props }: ViewFilterButtonProps) => import("react").JSX.Element;
|
|
8
|
-
|
|
9
|
+
type ViewToolbarChipButtonProps = Omit<ComponentProps<typeof Button>, "size" | "variant">;
|
|
10
|
+
export declare const ViewToolbarChipButton: (props: ViewToolbarChipButtonProps) => import("react").JSX.Element;
|
|
11
|
+
export declare const ViewFilterChip: (props: ViewToolbarChipButtonProps) => import("react").JSX.Element;
|
|
12
|
+
export declare const ViewToolbarSelectTrigger: ({ children, ...props }: Omit<Select.Trigger.Props, "render">) => import("react").JSX.Element;
|
|
9
13
|
export { ViewChromeBar, ViewToolbarChrome };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { FilterIcon } from "../icons.js";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ViewToolbarChipSelectIcon } from "./view-toolbar-chip-icon.js";
|
|
5
|
+
import { VIEW_FILTER_BUTTON, VIEW_FILTER_ICON_CLASS_NAME, VIEW_TOOLBAR_CHIP_ACTION } from "./view-toolbar-classes.js";
|
|
6
|
+
import { ViewChromeBar, ViewToolbarChip, ViewToolbarChrome } from "./view-toolbar-shell.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Select } from "@base-ui/react/select";
|
|
7
9
|
// src/components/view-toolbar.tsx
|
|
8
10
|
const ViewFilterButton = ({ label, ...props }) => /* @__PURE__ */ jsx(Button, {
|
|
9
11
|
...props,
|
|
@@ -13,10 +15,18 @@ const ViewFilterButton = ({ label, ...props }) => /* @__PURE__ */ jsx(Button, {
|
|
|
13
15
|
variant: VIEW_FILTER_BUTTON.variant,
|
|
14
16
|
children: /* @__PURE__ */ jsx(FilterIcon, { className: VIEW_FILTER_ICON_CLASS_NAME })
|
|
15
17
|
});
|
|
16
|
-
const
|
|
18
|
+
const renderChipButton = ({ className, ...props }) => /* @__PURE__ */ jsx(Button, {
|
|
17
19
|
...props,
|
|
18
|
-
className: cn(
|
|
19
|
-
size:
|
|
20
|
-
variant:
|
|
20
|
+
className: cn(VIEW_TOOLBAR_CHIP_ACTION.className, className),
|
|
21
|
+
size: VIEW_TOOLBAR_CHIP_ACTION.size,
|
|
22
|
+
variant: VIEW_TOOLBAR_CHIP_ACTION.variant
|
|
21
23
|
});
|
|
22
|
-
|
|
24
|
+
const ViewToolbarChipButton = (props) => renderChipButton(props);
|
|
25
|
+
const ViewFilterChip = (props) => /* @__PURE__ */ jsx(ViewToolbarChip, { children: renderChipButton(props) });
|
|
26
|
+
const ViewToolbarSelectTrigger = ({ children, ...props }) => /* @__PURE__ */ jsx(ViewToolbarChip, { children: /* @__PURE__ */ jsxs(Select.Trigger, {
|
|
27
|
+
...props,
|
|
28
|
+
"data-slot": "select-trigger",
|
|
29
|
+
render: /* @__PURE__ */ jsx(ViewToolbarChipButton, {}),
|
|
30
|
+
children: [children, /* @__PURE__ */ jsx(ViewToolbarChipSelectIcon, {})]
|
|
31
|
+
}) });
|
|
32
|
+
export { ViewChromeBar, ViewFilterButton, ViewFilterChip, ViewToolbarChipButton, ViewToolbarChrome, ViewToolbarSelectTrigger };
|
|
@@ -8,6 +8,8 @@ export declare const INLINE_OVERFLOW_TRIGGER_ATTRIBUTE = "data-inline-overflow-t
|
|
|
8
8
|
type UseInlineOverflowOptions = {
|
|
9
9
|
/** The active item's index; the policy keeps it on screen. */
|
|
10
10
|
activeIndex: number;
|
|
11
|
+
/** A control that keeps its width beside the visible items. */
|
|
12
|
+
reservedControl?: HTMLElement | null;
|
|
11
13
|
/**
|
|
12
14
|
* Each item's key, in display order; the measuring copy of an item carries
|
|
13
15
|
* its key in `INLINE_OVERFLOW_ITEM_ATTRIBUTE`.
|
|
@@ -40,7 +42,7 @@ type UseInlineOverflowOptions = {
|
|
|
40
42
|
* update, and until that count lands the row would hold every item, the last
|
|
41
43
|
* ones clipped, for a paint or any script that reads the layout to see.
|
|
42
44
|
*/
|
|
43
|
-
export declare const useInlineOverflow: ({ activeIndex, itemKeys }: UseInlineOverflowOptions) => {
|
|
45
|
+
export declare const useInlineOverflow: ({ activeIndex, itemKeys, reservedControl }: UseInlineOverflowOptions) => {
|
|
44
46
|
/** The measured row, once mounted. */
|
|
45
47
|
container: HTMLElement | null;
|
|
46
48
|
containerRef: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
|
|
@@ -46,7 +46,7 @@ const itemGap = (items) => {
|
|
|
46
46
|
* update, and until that count lands the row would hold every item, the last
|
|
47
47
|
* ones clipped, for a paint or any script that reads the layout to see.
|
|
48
48
|
*/
|
|
49
|
-
const useInlineOverflow = ({ activeIndex, itemKeys }) => {
|
|
49
|
+
const useInlineOverflow = ({ activeIndex, itemKeys, reservedControl }) => {
|
|
50
50
|
const itemCount = itemKeys.length;
|
|
51
51
|
const order = itemKeys.join(KEY_SEPARATOR);
|
|
52
52
|
const [container, setContainer] = useState(null);
|
|
@@ -60,24 +60,30 @@ const useInlineOverflow = ({ activeIndex, itemKeys }) => {
|
|
|
60
60
|
box: copy.getBoundingClientRect()
|
|
61
61
|
}));
|
|
62
62
|
const boxByKey = new Map(copies.map(({ key, box }) => [key, box]));
|
|
63
|
-
const
|
|
63
|
+
const triggerBox = measure.querySelector(`[${INLINE_OVERFLOW_TRIGGER_ATTRIBUTE}]`)?.getBoundingClientRect();
|
|
64
|
+
const itemBoxes = copies.map(({ box }) => box);
|
|
65
|
+
if (triggerBox !== void 0) itemBoxes.push(triggerBox);
|
|
66
|
+
const gap = itemGap(itemBoxes);
|
|
67
|
+
const reservedWidth = reservedControl ? reservedControl.getBoundingClientRect().width + gap : 0;
|
|
64
68
|
emit(resolveInlineOverflow({
|
|
65
69
|
activeIndex,
|
|
66
|
-
availableWidth: row.getBoundingClientRect().width,
|
|
67
|
-
gap
|
|
70
|
+
availableWidth: row.getBoundingClientRect().width - reservedWidth,
|
|
71
|
+
gap,
|
|
68
72
|
itemWidths: keys.map((key) => boxByKey.get(key)?.width ?? 0),
|
|
69
|
-
triggerWidth:
|
|
73
|
+
triggerWidth: triggerBox?.width ?? 0
|
|
70
74
|
}).visibleCount);
|
|
71
75
|
};
|
|
72
76
|
recompute();
|
|
73
77
|
const observer = new ResizeObserver(recompute);
|
|
74
78
|
observer.observe(row);
|
|
75
79
|
observer.observe(measure);
|
|
80
|
+
if (reservedControl) observer.observe(reservedControl);
|
|
76
81
|
return () => observer.disconnect();
|
|
77
82
|
}, [
|
|
78
83
|
activeIndex,
|
|
79
84
|
measure,
|
|
80
|
-
order
|
|
85
|
+
order,
|
|
86
|
+
reservedControl
|
|
81
87
|
], null);
|
|
82
88
|
return {
|
|
83
89
|
/** The measured row, once mounted. */
|
|
@@ -76,6 +76,8 @@ export type KanbanSubgroupBoardProps<TRow> = {
|
|
|
76
76
|
matrix: KanbanBoardMatrix<TRow>;
|
|
77
77
|
renderColumnHeader: (context: KanbanSubgroupColumnHeaderContext) => ReactNode;
|
|
78
78
|
renderLaneIdentity: (context: KanbanSubgroupLaneIdentityContext) => ReactNode;
|
|
79
|
+
/** An interactive lane name, rendered beside the collapse button. */
|
|
80
|
+
renderLaneReference?: ((context: KanbanSubgroupLaneIdentityContext) => ReactNode) | undefined;
|
|
79
81
|
renderCell: (context: KanbanSubgroupCellContext<TRow>) => ReactNode;
|
|
80
82
|
/**
|
|
81
83
|
* What a lane's own row says about one column: its count by default. The
|
|
@@ -150,5 +152,5 @@ export type KanbanSubgroupBoardProps<TRow> = {
|
|
|
150
152
|
* in every state; the caption line never grows past its own height, so a
|
|
151
153
|
* folded band costs no vertical space.
|
|
152
154
|
*/
|
|
153
|
-
export declare const KanbanSubgroupBoard: <TRow>({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }: KanbanSubgroupBoardProps<TRow>) => import("react").JSX.Element;
|
|
155
|
+
export declare const KanbanSubgroupBoard: <TRow>({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderLaneReference, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }: KanbanSubgroupBoardProps<TRow>) => import("react").JSX.Element;
|
|
154
156
|
export {};
|
|
@@ -32,7 +32,7 @@ const rowsIn = (cells) => cells.reduce((sum, cell) => sum + cell.rows.length, 0)
|
|
|
32
32
|
* in every state; the caption line never grows past its own height, so a
|
|
33
33
|
* folded band costs no vertical space.
|
|
34
34
|
*/
|
|
35
|
-
const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount = String, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }) => {
|
|
35
|
+
const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLaneIdentity, renderLaneReference, renderCell, renderLaneColumnSummary, renderLaneColumnAction, renderBandHeader, renderCollapsedBandCell, formatBandToggleLabel, formatCount = String, isLaneCollapsed, onLaneCollapsedChange, isBandCollapsed, onBandCollapsedChange, footer, className, dragOverBandId, isDragging }) => {
|
|
36
36
|
const [collapsedLaneValues, setCollapsedLaneValues] = useState(() => /* @__PURE__ */ new Set());
|
|
37
37
|
const [expandedEmptyLaneValues, setExpandedEmptyLaneValues] = useState(() => /* @__PURE__ */ new Set());
|
|
38
38
|
const [collapsedBandIds, setCollapsedBandIds] = useState(() => /* @__PURE__ */ new Set());
|
|
@@ -329,6 +329,14 @@ const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLane
|
|
|
329
329
|
const { group } = lane;
|
|
330
330
|
const cells = cellsByLaneValue.get(group.value) ?? [];
|
|
331
331
|
const count = rowsIn(cells);
|
|
332
|
+
const laneReference = renderLaneReference?.({
|
|
333
|
+
group,
|
|
334
|
+
count
|
|
335
|
+
}) ?? null;
|
|
336
|
+
const tally = /* @__PURE__ */ jsx("span", {
|
|
337
|
+
className: "text-muted-foreground text-xs tabular-nums",
|
|
338
|
+
children: formatCount(count)
|
|
339
|
+
});
|
|
332
340
|
const defaultCollapsed = count === 0 ? !expandedEmptyLaneValues.has(group.value) : collapsedLaneValues.has(group.value);
|
|
333
341
|
const collapsed = isLaneCollapsed ? isLaneCollapsed(group, count) : defaultCollapsed;
|
|
334
342
|
const showSummaries = collapsed && count > 0;
|
|
@@ -340,30 +348,24 @@ const KanbanSubgroupBoard = ({ scrollRef, matrix, renderColumnHeader, renderLane
|
|
|
340
348
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
341
349
|
className: cn("bg-background sticky z-10", KANBAN_STICKY_TOP_CLASS),
|
|
342
350
|
"data-kanban-lane-row": "",
|
|
343
|
-
children: [/* @__PURE__ */
|
|
344
|
-
className: cn("bg-background sticky start-0 z-10 flex w-fit items-center", "h-9"),
|
|
351
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
352
|
+
className: cn("bg-background sticky start-0 z-10 flex w-fit items-center", laneReference !== null && "max-w-full gap-2 pe-2 text-sm font-medium", "h-9"),
|
|
345
353
|
"data-kanban-lane-identity": "",
|
|
346
|
-
children: /* @__PURE__ */ jsxs("button", {
|
|
354
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
347
355
|
"aria-expanded": !collapsed,
|
|
356
|
+
"aria-label": laneReference !== null ? group.label : void 0,
|
|
348
357
|
className: cn("hover:bg-muted/60 flex items-center gap-2 rounded-lg px-2 text-start text-sm font-medium", "h-9", KANBAN_CHROME_TOGGLE_COARSE_TARGET_CLASS),
|
|
349
358
|
onClick: () => setLaneCollapsed(group, count, !collapsed),
|
|
350
359
|
type: "button",
|
|
351
|
-
children: [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}),
|
|
361
|
-
/* @__PURE__ */ jsx("span", {
|
|
362
|
-
className: "text-muted-foreground text-xs tabular-nums",
|
|
363
|
-
children: formatCount(count)
|
|
364
|
-
})
|
|
365
|
-
]
|
|
366
|
-
})
|
|
360
|
+
children: [/* @__PURE__ */ jsx(DirectionalIcon, {
|
|
361
|
+
className: cn("text-muted-foreground size-4 shrink-0 transition-transform", collapsed && "-rotate-90"),
|
|
362
|
+
flip: collapsed,
|
|
363
|
+
icon: ChevronDownIcon
|
|
364
|
+
}), laneReference === null && /* @__PURE__ */ jsxs(Fragment, { children: [renderLaneIdentity({
|
|
365
|
+
group,
|
|
366
|
+
count
|
|
367
|
+
}), tally] })]
|
|
368
|
+
}), laneReference !== null && /* @__PURE__ */ jsxs(Fragment, { children: [laneReference, tally] })]
|
|
367
369
|
}), showColumnRow && renderRow({
|
|
368
370
|
renderColumn: (column) => laneColumnCell({
|
|
369
371
|
group,
|
package/dist/styles/theme.css
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
@import "./inline-rename.css";
|
|
18
18
|
@import "./collapsible.css";
|
|
19
|
+
@import "./matter-tile.css";
|
|
19
20
|
@import "../components/animated-preview.css";
|
|
20
21
|
|
|
21
22
|
@custom-variant dark (&:is(.dark *));
|
|
@@ -186,6 +187,34 @@
|
|
|
186
187
|
transform: scale(1);
|
|
187
188
|
}
|
|
188
189
|
}
|
|
190
|
+
/* RotateToLandscapeGlyph: the phone and its arrow turn a quarter, rest
|
|
191
|
+
on their side, fade, and come back upright. Transform and opacity only;
|
|
192
|
+
the component stills it under reduced motion. */
|
|
193
|
+
--animate-rotate-hint: rotate-hint 3.2s var(--ease-in-out) infinite;
|
|
194
|
+
@keyframes rotate-hint {
|
|
195
|
+
0%,
|
|
196
|
+
15% {
|
|
197
|
+
opacity: 1;
|
|
198
|
+
transform: rotate(0deg);
|
|
199
|
+
}
|
|
200
|
+
45%,
|
|
201
|
+
75% {
|
|
202
|
+
opacity: 1;
|
|
203
|
+
transform: rotate(90deg);
|
|
204
|
+
}
|
|
205
|
+
88% {
|
|
206
|
+
opacity: 0;
|
|
207
|
+
transform: rotate(90deg);
|
|
208
|
+
}
|
|
209
|
+
89% {
|
|
210
|
+
opacity: 0;
|
|
211
|
+
transform: rotate(0deg);
|
|
212
|
+
}
|
|
213
|
+
100% {
|
|
214
|
+
opacity: 1;
|
|
215
|
+
transform: rotate(0deg);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
189
218
|
/* StatusMark: the running arc turns (paused, never reset, when it stops);
|
|
190
219
|
under reduced motion a running ring breathes instead. Its state
|
|
191
220
|
changes are transitions, owned by the component. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.99.0",
|
|
4
4
|
"description": "Stella's design system: bidi-aware React primitives built on Base UI, the dockable inspector pane, and the Tailwind v4 theme they are styled with.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"base-ui",
|
|
@@ -546,6 +546,14 @@
|
|
|
546
546
|
"types": "./dist/components/middle-truncate.d.ts",
|
|
547
547
|
"import": "./dist/components/middle-truncate.js"
|
|
548
548
|
},
|
|
549
|
+
"./orientation-gate": {
|
|
550
|
+
"types": "./dist/components/orientation-gate.d.ts",
|
|
551
|
+
"import": "./dist/components/orientation-gate.js"
|
|
552
|
+
},
|
|
553
|
+
"./orientation-gate-face": {
|
|
554
|
+
"types": "./dist/components/orientation-gate-face.d.ts",
|
|
555
|
+
"import": "./dist/components/orientation-gate-face.js"
|
|
556
|
+
},
|
|
549
557
|
"./outcome-screen": {
|
|
550
558
|
"types": "./dist/components/outcome-screen.d.ts",
|
|
551
559
|
"import": "./dist/components/outcome-screen.js"
|
|
@@ -1036,7 +1044,8 @@
|
|
|
1036
1044
|
"input-otp": "^1.5.0",
|
|
1037
1045
|
"lucide-react": "1.74.0",
|
|
1038
1046
|
"tailwind-merge": "^3.7.1",
|
|
1039
|
-
"temporal-polyfill": "1.0.8"
|
|
1047
|
+
"temporal-polyfill": "1.0.8",
|
|
1048
|
+
"unicode-segmenter": "0.14.4"
|
|
1040
1049
|
},
|
|
1041
1050
|
"devDependencies": {
|
|
1042
1051
|
"@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
|