@lo-ink/ui 0.4.2 → 0.4.4

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/Button.js CHANGED
@@ -2,5 +2,5 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { forwardRef } from "react";
3
3
  import { classes } from "./utils.js";
4
4
  export const Button = forwardRef(function Button({ variant = "primary", size = "medium", loading = false, loadingLabel = "Loading", fullWidth = false, leading, trailing, className, disabled, children, type = "button", ...props }, ref) {
5
- return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled || loading, "aria-busy": loading || undefined, className: classes("lo-ui-button", `lo-ui-button--${variant}`, `lo-ui-button--${size}`, fullWidth && "lo-ui-button--full", className), children: loading ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "lo-ui-spinner", "aria-hidden": "true" }), _jsx("span", { children: loadingLabel })] })) : (_jsxs(_Fragment, { children: [leading && _jsx("span", { className: "lo-ui-button__icon", children: leading }), _jsx("span", { children: children }), trailing && _jsx("span", { className: "lo-ui-button__icon", children: trailing })] })) }));
5
+ return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled || loading, "aria-busy": loading || undefined, className: classes("lo-ui-button", `lo-ui-button--${variant}`, `lo-ui-button--${size}`, fullWidth && "lo-ui-button--full", className), children: loading ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "lo-ui-spinner", "aria-hidden": "true" }), _jsx("span", { className: "lo-ui-button__label", children: loadingLabel })] })) : (_jsxs(_Fragment, { children: [leading && _jsx("span", { className: "lo-ui-button__icon", children: leading }), _jsx("span", { className: "lo-ui-button__label", children: children }), trailing && _jsx("span", { className: "lo-ui-button__icon", children: trailing })] })) }));
6
6
  });
package/dist/styles.css CHANGED
@@ -112,7 +112,13 @@
112
112
  background: transparent;
113
113
  }
114
114
 
115
+ .lo-ui-button__label {
116
+ min-width: 0;
117
+ overflow-wrap: anywhere;
118
+ }
119
+
115
120
  .lo-ui-button__icon {
121
+ flex: 0 0 auto;
116
122
  width: 20px;
117
123
  height: 20px;
118
124
  display: inline-grid;
@@ -327,6 +333,10 @@
327
333
  transform: translateX(20px);
328
334
  }
329
335
 
336
+ .lo-ui-switch:dir(rtl):checked::after {
337
+ transform: translateX(-20px);
338
+ }
339
+
330
340
  .lo-ui-switch:disabled {
331
341
  cursor: default;
332
342
  opacity: 0.55;
@@ -356,7 +366,8 @@
356
366
  transition: transform var(--lo-motion-fast) var(--lo-ease-out);
357
367
  }
358
368
 
359
- .lo-ui-checkbox:checked {
369
+ .lo-ui-checkbox:checked,
370
+ .lo-ui-checkbox:indeterminate {
360
371
  background: var(--lo-color-accent-fill);
361
372
  border-color: var(--lo-color-accent-fill);
362
373
  }
@@ -370,6 +381,12 @@
370
381
  transform: translateY(-1px) rotate(-45deg) scale(1);
371
382
  }
372
383
 
384
+ .lo-ui-checkbox:indeterminate::after {
385
+ height: 0;
386
+ border-width: 0 0 2px;
387
+ transform: none;
388
+ }
389
+
373
390
  .lo-ui-list-section {
374
391
  display: flex;
375
392
  flex-direction: column;
@@ -503,7 +520,7 @@
503
520
  overflow: hidden;
504
521
  display: inline-grid;
505
522
  place-items: center;
506
- border-radius: 11px;
523
+ border-radius: 20%;
507
524
  color: var(--lo-color-accent-contrast);
508
525
  background: var(--lo-color-accent-fill);
509
526
  font-size: 18px;
@@ -514,14 +531,12 @@
514
531
  .lo-ui-app-icon--small {
515
532
  width: 32px;
516
533
  height: 32px;
517
- border-radius: 8px;
518
534
  font-size: 14px;
519
535
  }
520
536
 
521
537
  .lo-ui-app-icon--large {
522
538
  width: 64px;
523
539
  height: 64px;
524
- border-radius: 16px;
525
540
  font-size: 26px;
526
541
  }
527
542
 
@@ -710,6 +725,57 @@
710
725
  border-radius: var(--lo-radius-full);
711
726
  }
712
727
 
728
+ @media (forced-colors: active) {
729
+ .lo-ui-switch,
730
+ .lo-ui-checkbox {
731
+ forced-color-adjust: none;
732
+ background: Canvas;
733
+ border: 1px solid ButtonText;
734
+ --lo-color-focus: ButtonText;
735
+ }
736
+
737
+ .lo-ui-switch {
738
+ padding: 1px;
739
+ }
740
+
741
+ .lo-ui-switch::after {
742
+ background: ButtonText;
743
+ box-shadow: none;
744
+ }
745
+
746
+ .lo-ui-switch:checked,
747
+ .lo-ui-checkbox:checked,
748
+ .lo-ui-checkbox:indeterminate {
749
+ background: Highlight;
750
+ border-color: Highlight;
751
+ }
752
+
753
+ .lo-ui-switch:checked::after {
754
+ background: HighlightText;
755
+ }
756
+
757
+ .lo-ui-checkbox::after {
758
+ border-color: HighlightText;
759
+ }
760
+
761
+ .lo-ui-tab[aria-selected="true"] {
762
+ forced-color-adjust: none;
763
+ color: HighlightText;
764
+ --lo-color-focus: ButtonText;
765
+ }
766
+
767
+ .lo-ui-tab[aria-selected="true"]::before {
768
+ background: Highlight;
769
+ }
770
+
771
+ .lo-ui-progress {
772
+ forced-color-adjust: none;
773
+ border: 1px solid CanvasText;
774
+ --lo-color-border: Canvas;
775
+ --lo-color-accent: Highlight;
776
+ }
777
+ }
778
+
713
779
  :where(.lo-ui-root code, .lo-ui-root pre) {
714
780
  font-family: var(--lo-font-family-mono);
715
781
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lo-ink/ui",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Accessible React components for LO miniapps",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/Button.tsx CHANGED
@@ -47,12 +47,12 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
47
47
  {loading ? (
48
48
  <>
49
49
  <span className="lo-ui-spinner" aria-hidden="true" />
50
- <span>{loadingLabel}</span>
50
+ <span className="lo-ui-button__label">{loadingLabel}</span>
51
51
  </>
52
52
  ) : (
53
53
  <>
54
54
  {leading && <span className="lo-ui-button__icon">{leading}</span>}
55
- <span>{children}</span>
55
+ <span className="lo-ui-button__label">{children}</span>
56
56
  {trailing && <span className="lo-ui-button__icon">{trailing}</span>}
57
57
  </>
58
58
  )}
package/src/styles.css CHANGED
@@ -112,7 +112,13 @@
112
112
  background: transparent;
113
113
  }
114
114
 
115
+ .lo-ui-button__label {
116
+ min-width: 0;
117
+ overflow-wrap: anywhere;
118
+ }
119
+
115
120
  .lo-ui-button__icon {
121
+ flex: 0 0 auto;
116
122
  width: 20px;
117
123
  height: 20px;
118
124
  display: inline-grid;
@@ -327,6 +333,10 @@
327
333
  transform: translateX(20px);
328
334
  }
329
335
 
336
+ .lo-ui-switch:dir(rtl):checked::after {
337
+ transform: translateX(-20px);
338
+ }
339
+
330
340
  .lo-ui-switch:disabled {
331
341
  cursor: default;
332
342
  opacity: 0.55;
@@ -356,7 +366,8 @@
356
366
  transition: transform var(--lo-motion-fast) var(--lo-ease-out);
357
367
  }
358
368
 
359
- .lo-ui-checkbox:checked {
369
+ .lo-ui-checkbox:checked,
370
+ .lo-ui-checkbox:indeterminate {
360
371
  background: var(--lo-color-accent-fill);
361
372
  border-color: var(--lo-color-accent-fill);
362
373
  }
@@ -370,6 +381,12 @@
370
381
  transform: translateY(-1px) rotate(-45deg) scale(1);
371
382
  }
372
383
 
384
+ .lo-ui-checkbox:indeterminate::after {
385
+ height: 0;
386
+ border-width: 0 0 2px;
387
+ transform: none;
388
+ }
389
+
373
390
  .lo-ui-list-section {
374
391
  display: flex;
375
392
  flex-direction: column;
@@ -503,7 +520,7 @@
503
520
  overflow: hidden;
504
521
  display: inline-grid;
505
522
  place-items: center;
506
- border-radius: 11px;
523
+ border-radius: 20%;
507
524
  color: var(--lo-color-accent-contrast);
508
525
  background: var(--lo-color-accent-fill);
509
526
  font-size: 18px;
@@ -514,14 +531,12 @@
514
531
  .lo-ui-app-icon--small {
515
532
  width: 32px;
516
533
  height: 32px;
517
- border-radius: 8px;
518
534
  font-size: 14px;
519
535
  }
520
536
 
521
537
  .lo-ui-app-icon--large {
522
538
  width: 64px;
523
539
  height: 64px;
524
- border-radius: 16px;
525
540
  font-size: 26px;
526
541
  }
527
542
 
@@ -710,6 +725,57 @@
710
725
  border-radius: var(--lo-radius-full);
711
726
  }
712
727
 
728
+ @media (forced-colors: active) {
729
+ .lo-ui-switch,
730
+ .lo-ui-checkbox {
731
+ forced-color-adjust: none;
732
+ background: Canvas;
733
+ border: 1px solid ButtonText;
734
+ --lo-color-focus: ButtonText;
735
+ }
736
+
737
+ .lo-ui-switch {
738
+ padding: 1px;
739
+ }
740
+
741
+ .lo-ui-switch::after {
742
+ background: ButtonText;
743
+ box-shadow: none;
744
+ }
745
+
746
+ .lo-ui-switch:checked,
747
+ .lo-ui-checkbox:checked,
748
+ .lo-ui-checkbox:indeterminate {
749
+ background: Highlight;
750
+ border-color: Highlight;
751
+ }
752
+
753
+ .lo-ui-switch:checked::after {
754
+ background: HighlightText;
755
+ }
756
+
757
+ .lo-ui-checkbox::after {
758
+ border-color: HighlightText;
759
+ }
760
+
761
+ .lo-ui-tab[aria-selected="true"] {
762
+ forced-color-adjust: none;
763
+ color: HighlightText;
764
+ --lo-color-focus: ButtonText;
765
+ }
766
+
767
+ .lo-ui-tab[aria-selected="true"]::before {
768
+ background: Highlight;
769
+ }
770
+
771
+ .lo-ui-progress {
772
+ forced-color-adjust: none;
773
+ border: 1px solid CanvasText;
774
+ --lo-color-border: Canvas;
775
+ --lo-color-accent: Highlight;
776
+ }
777
+ }
778
+
713
779
  :where(.lo-ui-root code, .lo-ui-root pre) {
714
780
  font-family: var(--lo-font-family-mono);
715
781
  }