@lo-ink/ui 0.4.3 → 0.4.5

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.
@@ -0,0 +1,9 @@
1
+ import { type DetailsHTMLAttributes, type ReactNode } from "react";
2
+ export interface DisclosureProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
3
+ /** The disclosure label. Keep interactive controls in the body. */
4
+ summary: ReactNode;
5
+ /** Noninteractive metadata included in the disclosure's accessible name. */
6
+ trailing?: ReactNode;
7
+ }
8
+ export declare const Disclosure: import("react").ForwardRefExoticComponent<DisclosureProps & import("react").RefAttributes<HTMLDetailsElement>>;
9
+ //# sourceMappingURL=Disclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Disclosure.d.ts","sourceRoot":"","sources":["../src/Disclosure.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/E,MAAM,WAAW,eAAgB,SAAQ,qBAAqB,CAAC,kBAAkB,CAAC;IAChF,mEAAmE;IACnE,OAAO,EAAE,SAAS,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,gHA6BtB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { classes } from "./utils.js";
4
+ export const Disclosure = forwardRef(function Disclosure({ summary, trailing, children, className, ...props }, ref) {
5
+ return (_jsxs("details", { ...props, ref: ref, className: classes("lo-ui-disclosure", className), children: [_jsxs("summary", { className: "lo-ui-disclosure__summary", children: [_jsx("span", { className: "lo-ui-disclosure__label", children: summary }), trailing != null && (_jsx("span", { className: "lo-ui-disclosure__trailing", children: trailing })), _jsx("svg", { className: "lo-ui-disclosure__chevron", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "m7.5 4 6 6-6 6" }) })] }), _jsx("div", { className: "lo-ui-disclosure__body", children: children })] }));
6
+ });
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { Heading, Text, type HeadingProps, type TextProps, } from "./Typography.
9
9
  export { TextArea, type TextAreaProps } from "./TextArea.js";
10
10
  export { Surface, type SurfaceProps } from "./Surface.js";
11
11
  export { Dialog } from "./Dialog.js";
12
+ export { Disclosure, type DisclosureProps } from "./Disclosure.js";
12
13
  export { Progress } from "./Progress.js";
13
14
  export { Tabs, type TabsProps, type TabOption } from "./Tabs.js";
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EACL,QAAQ,EACR,MAAM,EACN,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,OAAO,EACP,IAAI,EACJ,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAA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}
package/dist/index.js CHANGED
@@ -9,5 +9,6 @@ export { Heading, Text, } from "./Typography.js";
9
9
  export { TextArea } from "./TextArea.js";
10
10
  export { Surface } from "./Surface.js";
11
11
  export { Dialog } from "./Dialog.js";
12
+ export { Disclosure } from "./Disclosure.js";
12
13
  export { Progress } from "./Progress.js";
13
14
  export { Tabs } from "./Tabs.js";
package/dist/styles.css CHANGED
@@ -513,6 +513,75 @@
513
513
  stroke-linejoin: round;
514
514
  }
515
515
 
516
+ .lo-ui-disclosure__summary {
517
+ display: flex;
518
+ align-items: center;
519
+ gap: var(--lo-space-3);
520
+ min-height: var(--lo-size-cell);
521
+ padding: 10px var(--lo-space-4);
522
+ font: inherit;
523
+ color: var(--lo-color-text);
524
+ cursor: pointer;
525
+ list-style: none;
526
+ -webkit-tap-highlight-color: transparent;
527
+ }
528
+
529
+ .lo-ui-disclosure__summary::-webkit-details-marker {
530
+ display: none;
531
+ }
532
+
533
+ .lo-ui-disclosure__summary:focus-visible {
534
+ outline: 3px solid var(--lo-color-focus);
535
+ outline-offset: -3px;
536
+ }
537
+
538
+ .lo-ui-disclosure__label {
539
+ flex: 1 1 auto;
540
+ min-width: 0;
541
+ overflow-wrap: anywhere;
542
+ }
543
+
544
+ .lo-ui-disclosure__trailing {
545
+ flex: 0 1 auto;
546
+ min-width: 0;
547
+ max-width: 40%;
548
+ overflow-wrap: anywhere;
549
+ text-align: end;
550
+ color: var(--lo-color-text-secondary);
551
+ font-size: var(--lo-font-size-label);
552
+ }
553
+
554
+ .lo-ui-disclosure__chevron {
555
+ width: 18px;
556
+ height: 18px;
557
+ flex: 0 0 auto;
558
+ fill: none;
559
+ stroke: var(--lo-color-text-secondary);
560
+ stroke-width: 1.8;
561
+ stroke-linecap: round;
562
+ stroke-linejoin: round;
563
+ }
564
+
565
+ .lo-ui-disclosure[open]
566
+ > .lo-ui-disclosure__summary
567
+ > .lo-ui-disclosure__chevron {
568
+ transform: rotate(90deg);
569
+ }
570
+
571
+ .lo-ui-disclosure:dir(rtl):not([open])
572
+ > .lo-ui-disclosure__summary
573
+ > .lo-ui-disclosure__chevron {
574
+ transform: scaleX(-1);
575
+ }
576
+
577
+ .lo-ui-disclosure__body {
578
+ display: flex;
579
+ flex-direction: column;
580
+ gap: var(--lo-space-3);
581
+ padding: var(--lo-space-3) var(--lo-space-4) var(--lo-space-4);
582
+ overflow-wrap: anywhere;
583
+ }
584
+
516
585
  .lo-ui-app-icon {
517
586
  width: 44px;
518
587
  height: 44px;
@@ -520,7 +589,7 @@
520
589
  overflow: hidden;
521
590
  display: inline-grid;
522
591
  place-items: center;
523
- border-radius: 11px;
592
+ border-radius: 20%;
524
593
  color: var(--lo-color-accent-contrast);
525
594
  background: var(--lo-color-accent-fill);
526
595
  font-size: 18px;
@@ -531,14 +600,12 @@
531
600
  .lo-ui-app-icon--small {
532
601
  width: 32px;
533
602
  height: 32px;
534
- border-radius: 8px;
535
603
  font-size: 14px;
536
604
  }
537
605
 
538
606
  .lo-ui-app-icon--large {
539
607
  width: 64px;
540
608
  height: 64px;
541
- border-radius: 16px;
542
609
  font-size: 26px;
543
610
  }
544
611
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lo-ink/ui",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Accessible React components for LO miniapps",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,40 @@
1
+ import { forwardRef, type DetailsHTMLAttributes, type ReactNode } from "react";
2
+ import { classes } from "./utils.js";
3
+
4
+ export interface DisclosureProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
5
+ /** The disclosure label. Keep interactive controls in the body. */
6
+ summary: ReactNode;
7
+ /** Noninteractive metadata included in the disclosure's accessible name. */
8
+ trailing?: ReactNode;
9
+ }
10
+
11
+ export const Disclosure = forwardRef<HTMLDetailsElement, DisclosureProps>(
12
+ function Disclosure(
13
+ { summary, trailing, children, className, ...props },
14
+ ref,
15
+ ) {
16
+ return (
17
+ <details
18
+ {...props}
19
+ ref={ref}
20
+ className={classes("lo-ui-disclosure", className)}
21
+ >
22
+ <summary className="lo-ui-disclosure__summary">
23
+ <span className="lo-ui-disclosure__label">{summary}</span>
24
+ {trailing != null && (
25
+ <span className="lo-ui-disclosure__trailing">{trailing}</span>
26
+ )}
27
+ <svg
28
+ className="lo-ui-disclosure__chevron"
29
+ viewBox="0 0 20 20"
30
+ aria-hidden="true"
31
+ focusable="false"
32
+ >
33
+ <path d="m7.5 4 6 6-6 6" />
34
+ </svg>
35
+ </summary>
36
+ <div className="lo-ui-disclosure__body">{children}</div>
37
+ </details>
38
+ );
39
+ },
40
+ );
package/src/index.ts CHANGED
@@ -18,5 +18,6 @@ export {
18
18
  export { TextArea, type TextAreaProps } from "./TextArea.js";
19
19
  export { Surface, type SurfaceProps } from "./Surface.js";
20
20
  export { Dialog } from "./Dialog.js";
21
+ export { Disclosure, type DisclosureProps } from "./Disclosure.js";
21
22
  export { Progress } from "./Progress.js";
22
23
  export { Tabs, type TabsProps, type TabOption } from "./Tabs.js";
package/src/styles.css CHANGED
@@ -513,6 +513,75 @@
513
513
  stroke-linejoin: round;
514
514
  }
515
515
 
516
+ .lo-ui-disclosure__summary {
517
+ display: flex;
518
+ align-items: center;
519
+ gap: var(--lo-space-3);
520
+ min-height: var(--lo-size-cell);
521
+ padding: 10px var(--lo-space-4);
522
+ font: inherit;
523
+ color: var(--lo-color-text);
524
+ cursor: pointer;
525
+ list-style: none;
526
+ -webkit-tap-highlight-color: transparent;
527
+ }
528
+
529
+ .lo-ui-disclosure__summary::-webkit-details-marker {
530
+ display: none;
531
+ }
532
+
533
+ .lo-ui-disclosure__summary:focus-visible {
534
+ outline: 3px solid var(--lo-color-focus);
535
+ outline-offset: -3px;
536
+ }
537
+
538
+ .lo-ui-disclosure__label {
539
+ flex: 1 1 auto;
540
+ min-width: 0;
541
+ overflow-wrap: anywhere;
542
+ }
543
+
544
+ .lo-ui-disclosure__trailing {
545
+ flex: 0 1 auto;
546
+ min-width: 0;
547
+ max-width: 40%;
548
+ overflow-wrap: anywhere;
549
+ text-align: end;
550
+ color: var(--lo-color-text-secondary);
551
+ font-size: var(--lo-font-size-label);
552
+ }
553
+
554
+ .lo-ui-disclosure__chevron {
555
+ width: 18px;
556
+ height: 18px;
557
+ flex: 0 0 auto;
558
+ fill: none;
559
+ stroke: var(--lo-color-text-secondary);
560
+ stroke-width: 1.8;
561
+ stroke-linecap: round;
562
+ stroke-linejoin: round;
563
+ }
564
+
565
+ .lo-ui-disclosure[open]
566
+ > .lo-ui-disclosure__summary
567
+ > .lo-ui-disclosure__chevron {
568
+ transform: rotate(90deg);
569
+ }
570
+
571
+ .lo-ui-disclosure:dir(rtl):not([open])
572
+ > .lo-ui-disclosure__summary
573
+ > .lo-ui-disclosure__chevron {
574
+ transform: scaleX(-1);
575
+ }
576
+
577
+ .lo-ui-disclosure__body {
578
+ display: flex;
579
+ flex-direction: column;
580
+ gap: var(--lo-space-3);
581
+ padding: var(--lo-space-3) var(--lo-space-4) var(--lo-space-4);
582
+ overflow-wrap: anywhere;
583
+ }
584
+
516
585
  .lo-ui-app-icon {
517
586
  width: 44px;
518
587
  height: 44px;
@@ -520,7 +589,7 @@
520
589
  overflow: hidden;
521
590
  display: inline-grid;
522
591
  place-items: center;
523
- border-radius: 11px;
592
+ border-radius: 20%;
524
593
  color: var(--lo-color-accent-contrast);
525
594
  background: var(--lo-color-accent-fill);
526
595
  font-size: 18px;
@@ -531,14 +600,12 @@
531
600
  .lo-ui-app-icon--small {
532
601
  width: 32px;
533
602
  height: 32px;
534
- border-radius: 8px;
535
603
  font-size: 14px;
536
604
  }
537
605
 
538
606
  .lo-ui-app-icon--large {
539
607
  width: 64px;
540
608
  height: 64px;
541
- border-radius: 16px;
542
609
  font-size: 26px;
543
610
  }
544
611