@jsenv/navi 0.9.2 → 0.9.3

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.
@@ -22668,7 +22668,6 @@ const SelectControlled = forwardRef((props, ref) => {
22668
22668
  const selectElement = jsx("select", {
22669
22669
  className: "navi_select",
22670
22670
  ref: innerRef,
22671
- "data-field": "",
22672
22671
  "data-readonly": readOnly && !disabled ? "" : undefined,
22673
22672
  onKeyDown: e => {
22674
22673
  if (readOnly) {
@@ -24295,49 +24294,124 @@ const createSelectionKeyboardShortcuts = (selectionController, {
24295
24294
  }];
24296
24295
  };
24297
24296
 
24297
+ installImportMetaCss(import.meta);import.meta.css = /* css */`
24298
+ :root {
24299
+ --navi-icon-align-y: center;
24300
+ }
24301
+
24302
+ .navi_text {
24303
+ display: inline-flex;
24304
+ align-items: baseline;
24305
+ gap: 0.1em;
24306
+ }
24307
+
24308
+ .navi_icon {
24309
+ --align-y: var(--navi-icon-align-y, center);
24310
+
24311
+ display: inline-flex;
24312
+ width: 1em;
24313
+ height: 1em;
24314
+ flex-shrink: 0;
24315
+ align-self: var(--align-y);
24316
+ line-height: 1em;
24317
+ }
24318
+ `;
24319
+ const useTypographyStyle = props => {
24320
+ const color = props.color;
24321
+ const bold = props.bold;
24322
+ const italic = props.italic;
24323
+ const underline = props.underline;
24324
+ const size = props.size;
24325
+ delete props.color;
24326
+ delete props.bold;
24327
+ delete props.italic;
24328
+ delete props.underline;
24329
+ delete props.size;
24330
+ return {
24331
+ color,
24332
+ fontWeight: bold ? "bold" : bold === undefined ? undefined : "normal",
24333
+ fontStyle: italic ? "italic" : italic === undefined ? undefined : "normal",
24334
+ fontSize: size,
24335
+ textDecoration: underline ? "underline" : underline === undefined ? undefined : "none"
24336
+ };
24337
+ };
24338
+ const Text = ({
24339
+ style,
24340
+ children,
24341
+ ...rest
24342
+ }) => {
24343
+ const {
24344
+ all
24345
+ } = useLayoutStyle(rest);
24346
+ const innerStyle = withPropsStyle({
24347
+ ...all,
24348
+ ...useTypographyStyle(rest)
24349
+ }, style);
24350
+ return jsx("span", {
24351
+ ...rest,
24352
+ className: "navi_text",
24353
+ style: innerStyle,
24354
+ children: children
24355
+ });
24356
+ };
24357
+ const Icon = ({
24358
+ style,
24359
+ children,
24360
+ ...rest
24361
+ }) => {
24362
+ const {
24363
+ all
24364
+ } = useLayoutStyle(rest);
24365
+ const innerStyle = withPropsStyle({
24366
+ ...all,
24367
+ ...useTypographyStyle(rest)
24368
+ }, style);
24369
+ return jsx("span", {
24370
+ ...rest,
24371
+ className: "navi_icon",
24372
+ style: innerStyle,
24373
+ children: children
24374
+ });
24375
+ };
24376
+
24298
24377
  installImportMetaCss(import.meta);import.meta.css = /* css */`
24299
24378
  .navi_link {
24300
24379
  border-radius: 2px;
24301
24380
  }
24302
-
24381
+ /* Focus */
24303
24382
  .navi_link:focus {
24304
24383
  position: relative;
24305
24384
  z-index: 1; /* Ensure focus outline is above other elements */
24306
24385
  }
24307
-
24308
- .navi_link[data-readonly] > *,
24309
- .navi_link[inert] > * {
24310
- opacity: 0.5;
24311
- }
24312
-
24313
- .navi_link[inert] {
24314
- pointer-events: none;
24386
+ /* Visited */
24387
+ .navi_link[data-visited] {
24388
+ color: light-dark(#6a1b9a, #ab47bc);
24315
24389
  }
24316
-
24390
+ /* Selected */
24317
24391
  .navi_link[aria-selected] {
24318
24392
  position: relative;
24319
24393
  }
24320
-
24394
+ .navi_link[aria-selected="true"] {
24395
+ background-color: light-dark(#bbdefb, #2563eb);
24396
+ }
24321
24397
  .navi_link[aria-selected] input[type="checkbox"] {
24322
24398
  position: absolute;
24323
24399
  opacity: 0;
24324
24400
  }
24325
-
24326
- /* Visual feedback for selected state */
24327
- .navi_link[aria-selected="true"] {
24328
- background-color: light-dark(#bbdefb, #2563eb);
24329
- }
24330
-
24401
+ /* Active */
24331
24402
  .navi_link[data-active] {
24332
24403
  font-weight: bold;
24333
24404
  }
24334
-
24335
- .navi_link[data-visited] {
24336
- color: light-dark(#6a1b9a, #ab47bc);
24405
+ /* Readonly */
24406
+ .navi_link[data-readonly] > * {
24407
+ opacity: 0.5;
24337
24408
  }
24338
-
24339
- .navi_link[data-no-text-decoration] {
24340
- text-decoration: none;
24409
+ /* Disabled */
24410
+ .navi_link[inert] {
24411
+ pointer-events: none;
24412
+ }
24413
+ .navi_link[inert] > * {
24414
+ opacity: 0.5;
24341
24415
  }
24342
24416
  `;
24343
24417
  const Link = forwardRef((props, ref) => {
@@ -24389,7 +24463,10 @@ const LinkPlain = forwardRef((props, ref) => {
24389
24463
  const {
24390
24464
  all
24391
24465
  } = useLayoutStyle(rest);
24392
- const innerStyle = withPropsStyle(all, style);
24466
+ const innerStyle = withPropsStyle({
24467
+ ...all,
24468
+ ...useTypographyStyle(rest)
24469
+ }, style);
24393
24470
  return jsx(LoadableInlineElement, {
24394
24471
  loading: loading,
24395
24472
  color: "light-dark(#355fcc, #3b82f6)",
@@ -24401,7 +24478,7 @@ const LinkPlain = forwardRef((props, ref) => {
24401
24478
  style: innerStyle,
24402
24479
  "aria-busy": loading,
24403
24480
  inert: disabled,
24404
- "data-field": "",
24481
+ "data-disabled": disabled ? "" : undefined,
24405
24482
  "data-readonly": readOnly ? "" : undefined,
24406
24483
  "data-active": active ? "" : undefined,
24407
24484
  "data-visited": visited || isVisited ? "" : undefined,
@@ -28213,79 +28290,6 @@ const Overflow = ({
28213
28290
  });
28214
28291
  };
28215
28292
 
28216
- installImportMetaCss(import.meta);import.meta.css = /* css */`
28217
- :root {
28218
- --navi-icon-align-y: center;
28219
- }
28220
-
28221
- .navi_text {
28222
- display: inline-flex;
28223
- align-items: baseline;
28224
- gap: 0.1em;
28225
- }
28226
-
28227
- .navi_icon {
28228
- --align-y: var(--navi-icon-align-y, center);
28229
-
28230
- display: inline-flex;
28231
- width: 1em;
28232
- height: 1em;
28233
- flex-shrink: 0;
28234
- align-self: var(--align-y);
28235
- line-height: 1em;
28236
- }
28237
- `;
28238
- const Text = ({
28239
- color,
28240
- bold,
28241
- italic,
28242
- underline,
28243
- size,
28244
- style,
28245
- children,
28246
- ...rest
28247
- }) => {
28248
- const {
28249
- all
28250
- } = useLayoutStyle(rest);
28251
- const innerStyle = withPropsStyle({
28252
- ...all,
28253
- color,
28254
- fontWeight: bold ? "bold" : undefined,
28255
- fontStyle: italic ? "italic" : undefined,
28256
- fontSize: size,
28257
- textDecoration: underline ? "underline" : undefined
28258
- }, style);
28259
- return jsx("span", {
28260
- ...rest,
28261
- className: "navi_text",
28262
- style: innerStyle,
28263
- children: children
28264
- });
28265
- };
28266
- const Icon = ({
28267
- color,
28268
- size,
28269
- style,
28270
- children,
28271
- ...rest
28272
- }) => {
28273
- const {
28274
- all
28275
- } = useLayoutStyle(rest);
28276
- const innerStyle = withPropsStyle({
28277
- ...all,
28278
- color,
28279
- fontSize: size
28280
- }, style);
28281
- return jsx("span", {
28282
- ...rest,
28283
- className: "navi_icon",
28284
- style: innerStyle,
28285
- children: children
28286
- });
28287
- };
28288
-
28289
28293
  installImportMetaCss(import.meta);import.meta.css = /* css */`
28290
28294
  .text_and_count {
28291
28295
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Library of components including navigation to create frontend applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,6 @@ const SelectControlled = forwardRef((props, ref) => {
37
37
  <select
38
38
  className="navi_select"
39
39
  ref={innerRef}
40
- data-field=""
41
40
  data-readonly={readOnly && !disabled ? "" : undefined}
42
41
  onKeyDown={(e) => {
43
42
  if (readOnly) {
@@ -20,6 +20,7 @@ import {
20
20
  SelectionContext,
21
21
  useSelectableElement,
22
22
  } from "../selection/selection.jsx";
23
+ import { useTypographyStyle } from "../text/text.jsx";
23
24
  import { useAutoFocus } from "../use_auto_focus.js";
24
25
 
25
26
  /*
@@ -35,45 +36,40 @@ import.meta.css = /* css */ `
35
36
  .navi_link {
36
37
  border-radius: 2px;
37
38
  }
38
-
39
+ /* Focus */
39
40
  .navi_link:focus {
40
41
  position: relative;
41
42
  z-index: 1; /* Ensure focus outline is above other elements */
42
43
  }
43
-
44
- .navi_link[data-readonly] > *,
45
- .navi_link[inert] > * {
46
- opacity: 0.5;
47
- }
48
-
49
- .navi_link[inert] {
50
- pointer-events: none;
44
+ /* Visited */
45
+ .navi_link[data-visited] {
46
+ color: light-dark(#6a1b9a, #ab47bc);
51
47
  }
52
-
48
+ /* Selected */
53
49
  .navi_link[aria-selected] {
54
50
  position: relative;
55
51
  }
56
-
52
+ .navi_link[aria-selected="true"] {
53
+ background-color: light-dark(#bbdefb, #2563eb);
54
+ }
57
55
  .navi_link[aria-selected] input[type="checkbox"] {
58
56
  position: absolute;
59
57
  opacity: 0;
60
58
  }
61
-
62
- /* Visual feedback for selected state */
63
- .navi_link[aria-selected="true"] {
64
- background-color: light-dark(#bbdefb, #2563eb);
65
- }
66
-
59
+ /* Active */
67
60
  .navi_link[data-active] {
68
61
  font-weight: bold;
69
62
  }
70
-
71
- .navi_link[data-visited] {
72
- color: light-dark(#6a1b9a, #ab47bc);
63
+ /* Readonly */
64
+ .navi_link[data-readonly] > * {
65
+ opacity: 0.5;
73
66
  }
74
-
75
- .navi_link[data-no-text-decoration] {
76
- text-decoration: none;
67
+ /* Disabled */
68
+ .navi_link[inert] {
69
+ pointer-events: none;
70
+ }
71
+ .navi_link[inert] > * {
72
+ opacity: 0.5;
77
73
  }
78
74
  `;
79
75
 
@@ -122,7 +118,13 @@ const LinkPlain = forwardRef((props, ref) => {
122
118
 
123
119
  const innerClassName = withPropsClassName("navi_link", className);
124
120
  const { all } = useLayoutStyle(rest);
125
- const innerStyle = withPropsStyle(all, style);
121
+ const innerStyle = withPropsStyle(
122
+ {
123
+ ...all,
124
+ ...useTypographyStyle(rest),
125
+ },
126
+ style,
127
+ );
126
128
 
127
129
  return (
128
130
  <LoadableInlineElement
@@ -137,7 +139,7 @@ const LinkPlain = forwardRef((props, ref) => {
137
139
  style={innerStyle}
138
140
  aria-busy={loading}
139
141
  inert={disabled}
140
- data-field=""
142
+ data-disabled={disabled ? "" : undefined}
141
143
  data-readonly={readOnly ? "" : undefined}
142
144
  data-active={active ? "" : undefined}
143
145
  data-visited={visited || isVisited ? "" : undefined}
@@ -24,25 +24,36 @@ import.meta.css = /* css */ `
24
24
  }
25
25
  `;
26
26
 
27
- export const Text = ({
28
- color,
29
- bold,
30
- italic,
31
- underline,
32
- size,
33
- style,
34
- children,
35
- ...rest
36
- }) => {
27
+ export const useTypographyStyle = (props) => {
28
+ const color = props.color;
29
+ const bold = props.bold;
30
+ const italic = props.italic;
31
+ const underline = props.underline;
32
+ const size = props.size;
33
+ delete props.color;
34
+ delete props.bold;
35
+ delete props.italic;
36
+ delete props.underline;
37
+ delete props.size;
38
+ return {
39
+ color,
40
+ fontWeight: bold ? "bold" : bold === undefined ? undefined : "normal",
41
+ fontStyle: italic ? "italic" : italic === undefined ? undefined : "normal",
42
+ fontSize: size,
43
+ textDecoration: underline
44
+ ? "underline"
45
+ : underline === undefined
46
+ ? undefined
47
+ : "none",
48
+ };
49
+ };
50
+
51
+ export const Text = ({ style, children, ...rest }) => {
37
52
  const { all } = useLayoutStyle(rest);
38
53
  const innerStyle = withPropsStyle(
39
54
  {
40
55
  ...all,
41
- color,
42
- fontWeight: bold ? "bold" : undefined,
43
- fontStyle: italic ? "italic" : undefined,
44
- fontSize: size,
45
- textDecoration: underline ? "underline" : undefined,
56
+ ...useTypographyStyle(rest),
46
57
  },
47
58
  style,
48
59
  );
@@ -54,13 +65,12 @@ export const Text = ({
54
65
  );
55
66
  };
56
67
 
57
- export const Icon = ({ color, size, style, children, ...rest }) => {
68
+ export const Icon = ({ style, children, ...rest }) => {
58
69
  const { all } = useLayoutStyle(rest);
59
70
  const innerStyle = withPropsStyle(
60
71
  {
61
72
  ...all,
62
- color,
63
- fontSize: size,
73
+ ...useTypographyStyle(rest),
64
74
  },
65
75
  style,
66
76
  );