@lotics/ui 23.2.0 → 24.0.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/AGENTS.md +8 -1
- package/MIGRATION.md +37 -0
- package/docs/catalog.md +57 -12
- package/docs/composition.md +63 -3
- package/docs/data_entry.md +19 -1
- package/docs/templates.md +24 -28
- package/examples/tpl_item_list.tsx +19 -768
- package/examples/tpl_record.tsx +515 -415
- package/examples/tpl_task_board.tsx +2 -2
- package/package.json +5 -2
- package/src/deadline.ts +157 -0
- package/src/filter_chip.tsx +2 -2
- package/src/locale.tsx +16 -0
- package/src/option_list.tsx +3 -3
- package/src/reference_field.tsx +174 -0
- package/src/table.tsx +9 -0
- package/src/text_button.tsx +139 -0
- package/src/text_link.tsx +24 -14
package/src/text_link.tsx
CHANGED
|
@@ -1,39 +1,49 @@
|
|
|
1
1
|
import { Text, type TextProps } from "./text";
|
|
2
2
|
import { Icon, type IconName } from "./icon";
|
|
3
|
+
import { colors } from "./colors";
|
|
3
4
|
import { getTextColor } from "./text_utils";
|
|
4
5
|
|
|
5
6
|
export interface TextLinkProps extends TextProps {
|
|
6
7
|
/** Optional leading icon. */
|
|
7
8
|
icon?: IconName;
|
|
8
9
|
/** A URL — renders a real anchor (`<a href>` on web; middle-click / open-in-new-tab
|
|
9
|
-
* work). For in-app routing, wrap `TextLink`
|
|
10
|
+
* work). For in-app routing, wrap `TextLink` in your own pressable. */
|
|
10
11
|
href?: string;
|
|
11
|
-
/** An in-app action. With NEITHER `href` nor `onPress`, `TextLink` is just
|
|
12
|
-
* underlined text you wrap in your own pressable (e.g. a table cell). */
|
|
13
|
-
onPress?: () => void;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
|
-
* Underlined text that
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* inherits every `Text` prop) — the neutral,
|
|
21
|
-
* which is fixed blue + `role="link"` for the
|
|
15
|
+
* Underlined text that NAVIGATES — `href` renders a real anchor; with no `href`
|
|
16
|
+
* it is plain underlined text you drop inside your own pressable (a table cell, a
|
|
17
|
+
* custom row), or a MARKER that a value leads somewhere (a record reference).
|
|
18
|
+
* Colour comes from `color` (it inherits every `Text` prop) — the neutral,
|
|
19
|
+
* configurable counterpart to `Link`, which is fixed blue + `role="link"` for the
|
|
20
|
+
* "this opens somewhere else" signal.
|
|
21
|
+
*
|
|
22
|
+
* It does NOT act. An `onPress` here used to resolve to `role="button"`, so one
|
|
23
|
+
* export was three components — a link, a button, and a passive marker — behind
|
|
24
|
+
* one name, inside `OptionList`, `FilterChip` and others. That mode is
|
|
25
|
+
* `TextButton` now — also underlined, since that is what marks a surface-less
|
|
26
|
+
* control interactive, but in ZINC: blue is reserved for navigation, so the ink is
|
|
27
|
+
* what says whether a press moves you or acts. Pick by what the press DOES.
|
|
22
28
|
*/
|
|
23
29
|
export function TextLink(props: TextLinkProps) {
|
|
24
|
-
const { icon, href,
|
|
25
|
-
const interactive = href != null || onPress != null;
|
|
30
|
+
const { icon, href, children, color, style, ...textProps } = props;
|
|
26
31
|
return (
|
|
27
32
|
<Text
|
|
28
33
|
decoration="underline"
|
|
29
34
|
weight="medium"
|
|
30
35
|
color={color}
|
|
31
36
|
href={href}
|
|
32
|
-
|
|
33
|
-
accessibilityRole={href != null ? "link" : onPress != null ? "button" : undefined}
|
|
37
|
+
accessibilityRole={href != null ? "link" : undefined}
|
|
34
38
|
style={[
|
|
35
39
|
icon ? { display: "flex", flexDirection: "row", alignItems: "center", gap: 4 } : null,
|
|
36
|
-
|
|
40
|
+
// Blue only when it actually NAVIGATES. An `href` is a destination, so it
|
|
41
|
+
// takes the navigation ink (`color` still overrides). Without one this is
|
|
42
|
+
// underlined text you wrap yourself, or a MARKER on a value that leads
|
|
43
|
+
// somewhere — the record's customer field is one, and pressing it opens a
|
|
44
|
+
// PEEK, so blue there would promise a trip it never takes.
|
|
45
|
+
href != null && color == null ? { color: colors.blue[600] } : null,
|
|
46
|
+
href != null ? { cursor: "pointer" } : null,
|
|
37
47
|
style,
|
|
38
48
|
]}
|
|
39
49
|
{...textProps}
|