@mindlogic-ai/logician-ui 5.0.0-alpha.11 → 5.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +4 -0
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.mjs +4 -0
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/NavList/NavList.d.ts +34 -0
- package/dist/components/NavList/NavList.d.ts.map +1 -0
- package/dist/components/NavList/NavList.js +113 -0
- package/dist/components/NavList/NavList.js.map +1 -0
- package/dist/components/NavList/NavList.mjs +111 -0
- package/dist/components/NavList/NavList.mjs.map +1 -0
- package/dist/components/NavList/NavList.styles.d.ts +90 -0
- package/dist/components/NavList/NavList.styles.d.ts.map +1 -0
- package/dist/components/NavList/NavList.styles.js +104 -0
- package/dist/components/NavList/NavList.styles.js.map +1 -0
- package/dist/components/NavList/NavList.styles.mjs +97 -0
- package/dist/components/NavList/NavList.styles.mjs.map +1 -0
- package/dist/components/NavList/NavList.translations.json.js +19 -0
- package/dist/components/NavList/NavList.translations.json.js.map +1 -0
- package/dist/components/NavList/NavList.translations.json.mjs +14 -0
- package/dist/components/NavList/NavList.translations.json.mjs.map +1 -0
- package/dist/components/NavList/NavList.types.d.ts +131 -0
- package/dist/components/NavList/NavList.types.d.ts.map +1 -0
- package/dist/components/NavList/NavListContext.d.ts +30 -0
- package/dist/components/NavList/NavListContext.d.ts.map +1 -0
- package/dist/components/NavList/NavListContext.js +16 -0
- package/dist/components/NavList/NavListContext.js.map +1 -0
- package/dist/components/NavList/NavListContext.mjs +13 -0
- package/dist/components/NavList/NavListContext.mjs.map +1 -0
- package/dist/components/NavList/NavListGroup.d.ts +31 -0
- package/dist/components/NavList/NavListGroup.d.ts.map +1 -0
- package/dist/components/NavList/NavListGroup.js +115 -0
- package/dist/components/NavList/NavListGroup.js.map +1 -0
- package/dist/components/NavList/NavListGroup.mjs +113 -0
- package/dist/components/NavList/NavListGroup.mjs.map +1 -0
- package/dist/components/NavList/NavListItem.d.ts +15 -0
- package/dist/components/NavList/NavListItem.d.ts.map +1 -0
- package/dist/components/NavList/NavListItem.js +269 -0
- package/dist/components/NavList/NavListItem.js.map +1 -0
- package/dist/components/NavList/NavListItem.mjs +267 -0
- package/dist/components/NavList/NavListItem.mjs.map +1 -0
- package/dist/components/NavList/NavListSkeleton.d.ts +17 -0
- package/dist/components/NavList/NavListSkeleton.d.ts.map +1 -0
- package/dist/components/NavList/NavListSkeleton.js +33 -0
- package/dist/components/NavList/NavListSkeleton.js.map +1 -0
- package/dist/components/NavList/NavListSkeleton.mjs +31 -0
- package/dist/components/NavList/NavListSkeleton.mjs.map +1 -0
- package/dist/components/NavList/index.d.ts +7 -0
- package/dist/components/NavList/index.d.ts.map +1 -0
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.js +4 -0
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textarea/Textarea.mjs +4 -0
- package/dist/components/Textarea/Textarea.mjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -1
- package/dist/index.mjs.map +1 -1
- package/dist/utils/focusRing.d.ts +22 -0
- package/dist/utils/focusRing.d.ts.map +1 -1
- package/dist/utils/focusRing.js +22 -0
- package/dist/utils/focusRing.js.map +1 -1
- package/dist/utils/focusRing.mjs +21 -1
- package/dist/utils/focusRing.mjs.map +1 -1
- package/package.json +2 -1
- package/src/components/Input/Input.tsx +4 -0
- package/src/components/Menu/Menu.usage.mdx +8 -0
- package/src/components/NavList/NavList.stories.tsx +895 -0
- package/src/components/NavList/NavList.styles.ts +114 -0
- package/src/components/NavList/NavList.test.tsx +1254 -0
- package/src/components/NavList/NavList.translations.json +9 -0
- package/src/components/NavList/NavList.tsx +160 -0
- package/src/components/NavList/NavList.types.ts +145 -0
- package/src/components/NavList/NavList.usage.mdx +540 -0
- package/src/components/NavList/NavListContext.ts +25 -0
- package/src/components/NavList/NavListGroup.tsx +243 -0
- package/src/components/NavList/NavListItem.tsx +525 -0
- package/src/components/NavList/NavListSkeleton.tsx +57 -0
- package/src/components/NavList/index.ts +14 -0
- package/src/components/Tabs/Tabs.usage.mdx +58 -14
- package/src/components/Textarea/Textarea.tsx +4 -0
- package/src/components/Tooltip/Tooltip.usage.mdx +8 -0
- package/src/components/a11y.kwcag.test.tsx +66 -0
- package/src/components/claude.md +1 -1
- package/src/index.ts +7 -1
- package/src/utils/focusRing.ts +23 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NavListOrientation,
|
|
3
|
+
NavListResponsiveOrientation,
|
|
4
|
+
} from './NavList.types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The tokens a row paints, exported so the usage page's token table reads what
|
|
8
|
+
* the component renders.
|
|
9
|
+
*
|
|
10
|
+
* **The current row is a PLACE, not a value** — the same rule as `TAB_RAMP`
|
|
11
|
+
* and the app's nav rail (`NavigationLinkButton.utils.tsx` in factchat-nextjs).
|
|
12
|
+
* It is carried by ink, weight and a neutral fill, never by the brand hue: a
|
|
13
|
+
* rail that spends colour on "you are here" is what stops a success or error
|
|
14
|
+
* colour from registering when it appears.
|
|
15
|
+
*
|
|
16
|
+
* `bg.emphasized` rather than `bg.muted` for the fill, because rails sit on the
|
|
17
|
+
* sidebar wash and the fill has to separate from THAT: in light `bg.muted` is
|
|
18
|
+
* only OKLab dE 0.027 from the wash, under the threshold where two flat areas
|
|
19
|
+
* read as different, and `bg.emphasized` is 0.052 (measured in that file).
|
|
20
|
+
* Hover uses the same fill, so the current row does not change under the
|
|
21
|
+
* pointer and a hovered row previews exactly what selecting it looks like.
|
|
22
|
+
*
|
|
23
|
+
* `currentLabel` is `fg.emphasized`, which the theme aliases to `fg.default`
|
|
24
|
+
* today — so on the stock theme the current row is told apart by WEIGHT and
|
|
25
|
+
* FILL, not by a second ink. The role is still named separately so a theme
|
|
26
|
+
* that splits the two (and the app's nav rail, which reads the same pair)
|
|
27
|
+
* moves the current label without touching the rest.
|
|
28
|
+
*
|
|
29
|
+
* **Pressed is one step past hover**, on every row, current ones included —
|
|
30
|
+
* otherwise a press on the row you are already on gives no sign it landed.
|
|
31
|
+
* No `bg.*` role is darker than `bg.emphasized` in light (it is the top of
|
|
32
|
+
* the `layer.1` ladder), so the step is `border.default`: the next neutral in
|
|
33
|
+
* both modes (light `#D8D2CA` after `#E5DFD9`, dark `#48443E` after
|
|
34
|
+
* `#3F3B34`), the same fill the BottomSheet handle uses. Under
|
|
35
|
+
* `prefers-contrast: more` that token turns into a 3:1 stroke grey and the
|
|
36
|
+
* label would drop to 2.8:1, so high contrast takes `border.strong`, which
|
|
37
|
+
* high contrast leaves alone. `NavList.test.tsx` checks every pair.
|
|
38
|
+
*/
|
|
39
|
+
export const NAV_LIST_RAMP = {
|
|
40
|
+
label: 'fg.default',
|
|
41
|
+
currentLabel: 'fg.emphasized',
|
|
42
|
+
currentFill: 'bg.emphasized',
|
|
43
|
+
hoverFill: 'bg.emphasized',
|
|
44
|
+
pressedFill: 'border.default',
|
|
45
|
+
pressedFillMoreContrast: 'border.strong',
|
|
46
|
+
trailing: 'fg.muted',
|
|
47
|
+
groupTitle: 'fg.muted',
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
50
|
+
/** The pressed fill, with its high-contrast swap. */
|
|
51
|
+
export const pressedFill = {
|
|
52
|
+
bg: NAV_LIST_RAMP.pressedFill,
|
|
53
|
+
_moreContrast: { bg: NAV_LIST_RAMP.pressedFillMoreContrast },
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Chakra's `_rtl`/`_ltr` and `:dir()` read `dir` ATTRIBUTES, and zag stamps
|
|
58
|
+
* `dir="ltr"` on every part it renders (tooltip triggers — the rows — and the
|
|
59
|
+
* collapsible group) from Ark's locale, before any effect can measure the
|
|
60
|
+
* page. An author `direction` beats the UA rule that maps the attribute, so
|
|
61
|
+
* every stamped element takes the direction it inherits instead: the server
|
|
62
|
+
* render lays an RTL rail out right to left on its first paint.
|
|
63
|
+
*/
|
|
64
|
+
export const inheritDirection = { direction: 'inherit' } as const;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A locale whose direction is `dir`: the inherited one when it already
|
|
68
|
+
* agrees, so a Korean app keeps formatting in Korean, otherwise a stand-in.
|
|
69
|
+
* Ark has no other way to set the `dir` zag stamps (its hooks omit the prop).
|
|
70
|
+
*/
|
|
71
|
+
export const localeFor = (
|
|
72
|
+
inherited: { locale: string; dir: 'ltr' | 'rtl' },
|
|
73
|
+
dir: 'ltr' | 'rtl'
|
|
74
|
+
) =>
|
|
75
|
+
inherited.dir === dir ? inherited.locale : dir === 'rtl' ? 'ar' : 'en-US';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Map an orientation (or a per-breakpoint object of them) to a style value per
|
|
79
|
+
* breakpoint, so the axis switch is CSS rather than a `useBreakpointValue`
|
|
80
|
+
* that renders the wrong axis on the server.
|
|
81
|
+
*/
|
|
82
|
+
export const byOrientation = <T>(
|
|
83
|
+
orientation: NavListResponsiveOrientation,
|
|
84
|
+
vertical: T,
|
|
85
|
+
horizontal: T
|
|
86
|
+
): T | Record<string, T> => {
|
|
87
|
+
const pick = (o: NavListOrientation) =>
|
|
88
|
+
o === 'horizontal' ? horizontal : vertical;
|
|
89
|
+
if (typeof orientation === 'string') return pick(orientation);
|
|
90
|
+
// A breakpoint object with no `base` still starts vertical — the default —
|
|
91
|
+
// instead of leaving the smallest screens with no axis at all.
|
|
92
|
+
return Object.fromEntries(
|
|
93
|
+
Object.entries({ base: 'vertical', ...orientation }).map(([bp, o]) => [
|
|
94
|
+
bp,
|
|
95
|
+
pick(o as NavListOrientation),
|
|
96
|
+
])
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** The list box shared by the root list and every group's list. */
|
|
101
|
+
export const listStyles = (orientation: NavListResponsiveOrientation) =>
|
|
102
|
+
({
|
|
103
|
+
listStyleType: 'none',
|
|
104
|
+
m: 0,
|
|
105
|
+
p: 0,
|
|
106
|
+
display: 'flex',
|
|
107
|
+
gap: 0.5,
|
|
108
|
+
minW: 0,
|
|
109
|
+
flexDirection: byOrientation(orientation, 'column', 'row'),
|
|
110
|
+
alignItems: byOrientation(orientation, 'stretch', 'center'),
|
|
111
|
+
// A row never wraps: a strip that grows to three lines as items are added
|
|
112
|
+
// eats the content it navigates. The root scrolls sideways instead.
|
|
113
|
+
flexWrap: 'nowrap',
|
|
114
|
+
}) as const;
|