@lo-ink/ui 0.4.4 → 0.4.6

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
@@ -444,7 +444,7 @@
444
444
  color: var(--lo-color-text);
445
445
  background: var(--lo-color-surface);
446
446
  border: 0;
447
- text-align: left;
447
+ text-align: start;
448
448
  }
449
449
 
450
450
  .lo-ui-cell__control:focus-visible {
@@ -513,6 +513,79 @@
513
513
  stroke-linejoin: round;
514
514
  }
515
515
 
516
+ .lo-ui-cell__chevron:dir(rtl) {
517
+ transform: scaleX(-1);
518
+ }
519
+
520
+ .lo-ui-disclosure__summary {
521
+ display: flex;
522
+ align-items: center;
523
+ gap: var(--lo-space-3);
524
+ min-height: var(--lo-size-cell);
525
+ padding: 10px var(--lo-space-4);
526
+ font: inherit;
527
+ color: var(--lo-color-text);
528
+ cursor: pointer;
529
+ list-style: none;
530
+ -webkit-tap-highlight-color: transparent;
531
+ }
532
+
533
+ .lo-ui-disclosure__summary::-webkit-details-marker {
534
+ display: none;
535
+ }
536
+
537
+ .lo-ui-disclosure__summary:focus-visible {
538
+ outline: 3px solid var(--lo-color-focus);
539
+ outline-offset: -3px;
540
+ }
541
+
542
+ .lo-ui-disclosure__label {
543
+ flex: 1 1 auto;
544
+ min-width: 0;
545
+ overflow-wrap: anywhere;
546
+ }
547
+
548
+ .lo-ui-disclosure__trailing {
549
+ flex: 0 1 auto;
550
+ min-width: 0;
551
+ max-width: 40%;
552
+ overflow-wrap: anywhere;
553
+ text-align: end;
554
+ color: var(--lo-color-text-secondary);
555
+ font-size: var(--lo-font-size-label);
556
+ }
557
+
558
+ .lo-ui-disclosure__chevron {
559
+ width: 18px;
560
+ height: 18px;
561
+ flex: 0 0 auto;
562
+ fill: none;
563
+ stroke: var(--lo-color-text-secondary);
564
+ stroke-width: 1.8;
565
+ stroke-linecap: round;
566
+ stroke-linejoin: round;
567
+ }
568
+
569
+ .lo-ui-disclosure[open]
570
+ > .lo-ui-disclosure__summary
571
+ > .lo-ui-disclosure__chevron {
572
+ transform: rotate(90deg);
573
+ }
574
+
575
+ .lo-ui-disclosure:dir(rtl):not([open])
576
+ > .lo-ui-disclosure__summary
577
+ > .lo-ui-disclosure__chevron {
578
+ transform: scaleX(-1);
579
+ }
580
+
581
+ .lo-ui-disclosure__body {
582
+ display: flex;
583
+ flex-direction: column;
584
+ gap: var(--lo-space-3);
585
+ padding: var(--lo-space-3) var(--lo-space-4) var(--lo-space-4);
586
+ overflow-wrap: anywhere;
587
+ }
588
+
516
589
  .lo-ui-app-icon {
517
590
  width: 44px;
518
591
  height: 44px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lo-ink/ui",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
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
@@ -444,7 +444,7 @@
444
444
  color: var(--lo-color-text);
445
445
  background: var(--lo-color-surface);
446
446
  border: 0;
447
- text-align: left;
447
+ text-align: start;
448
448
  }
449
449
 
450
450
  .lo-ui-cell__control:focus-visible {
@@ -513,6 +513,79 @@
513
513
  stroke-linejoin: round;
514
514
  }
515
515
 
516
+ .lo-ui-cell__chevron:dir(rtl) {
517
+ transform: scaleX(-1);
518
+ }
519
+
520
+ .lo-ui-disclosure__summary {
521
+ display: flex;
522
+ align-items: center;
523
+ gap: var(--lo-space-3);
524
+ min-height: var(--lo-size-cell);
525
+ padding: 10px var(--lo-space-4);
526
+ font: inherit;
527
+ color: var(--lo-color-text);
528
+ cursor: pointer;
529
+ list-style: none;
530
+ -webkit-tap-highlight-color: transparent;
531
+ }
532
+
533
+ .lo-ui-disclosure__summary::-webkit-details-marker {
534
+ display: none;
535
+ }
536
+
537
+ .lo-ui-disclosure__summary:focus-visible {
538
+ outline: 3px solid var(--lo-color-focus);
539
+ outline-offset: -3px;
540
+ }
541
+
542
+ .lo-ui-disclosure__label {
543
+ flex: 1 1 auto;
544
+ min-width: 0;
545
+ overflow-wrap: anywhere;
546
+ }
547
+
548
+ .lo-ui-disclosure__trailing {
549
+ flex: 0 1 auto;
550
+ min-width: 0;
551
+ max-width: 40%;
552
+ overflow-wrap: anywhere;
553
+ text-align: end;
554
+ color: var(--lo-color-text-secondary);
555
+ font-size: var(--lo-font-size-label);
556
+ }
557
+
558
+ .lo-ui-disclosure__chevron {
559
+ width: 18px;
560
+ height: 18px;
561
+ flex: 0 0 auto;
562
+ fill: none;
563
+ stroke: var(--lo-color-text-secondary);
564
+ stroke-width: 1.8;
565
+ stroke-linecap: round;
566
+ stroke-linejoin: round;
567
+ }
568
+
569
+ .lo-ui-disclosure[open]
570
+ > .lo-ui-disclosure__summary
571
+ > .lo-ui-disclosure__chevron {
572
+ transform: rotate(90deg);
573
+ }
574
+
575
+ .lo-ui-disclosure:dir(rtl):not([open])
576
+ > .lo-ui-disclosure__summary
577
+ > .lo-ui-disclosure__chevron {
578
+ transform: scaleX(-1);
579
+ }
580
+
581
+ .lo-ui-disclosure__body {
582
+ display: flex;
583
+ flex-direction: column;
584
+ gap: var(--lo-space-3);
585
+ padding: var(--lo-space-3) var(--lo-space-4) var(--lo-space-4);
586
+ overflow-wrap: anywhere;
587
+ }
588
+
516
589
  .lo-ui-app-icon {
517
590
  width: 44px;
518
591
  height: 44px;