@apliteni/apliteni-ui 0.160.0 → 0.162.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.
@@ -597,7 +597,8 @@ leave it to the window.
597
597
 
598
598
  `tooltip()` is the readout that a surface shows while a pointer rests on one of its marks. It is an
599
599
  overlay. That is the guarantee: **showing, filling or moving a readout never changes the size or
600
- the place of anything else on the page.** There is one element per host. It is placed absolutely
600
+ the place of anything else on the page.** A closed readout has no box, so it cannot widen a
601
+ scroll region that holds it. There is one element per host. It is placed absolutely
601
602
  and takes no pointer events. `.ui-tip-host` marks the box it is placed against. The readout flips
602
603
  or slides only as far as needed to stay inside the viewport and every ancestor whose overflow
603
604
  clips. **What it says is text**, written with `textContent` and never parsed. Focus on a mark shows
@@ -612,7 +613,17 @@ what the bar says. No value may be reachable only by hovering. See
612
613
  React `Tooltip` shows a label, a value and an optional detail.
613
614
  `text` is still a shorthand for `label`. Empty parts are hidden.
614
615
  The focusable trigger provides the readout as its accessible description. Escape keeps focus on the trigger.
615
- The panel does not change the layout or intercept pointer events. Reduced motion removes the fade.
616
+ The panel does not change the layout or intercept pointer events.
617
+
618
+ **A pointer opens the readout after it rests for 300ms, and the readout closes at once when the
619
+ pointer leaves.** A pointer that leaves within 300ms opens nothing. **Within 300ms after a readout
620
+ closes, the next one opens at once**, so a pointer that moves along a row of icon buttons reads
621
+ each word without a new wait. **Keyboard focus opens the readout at once.** A mouse press that
622
+ focuses the trigger waits for the hover.
623
+
624
+ `control` is for a child that is one control and names itself, such as an icon button with an
625
+ `aria-label`. The readout shows its word on hover and focus. It adds no tab stop and no
626
+ description, and it is hidden from assistive technology, because the control's name already says it.
616
627
 
617
628
  `placement` selects the preferred top or bottom side. The readout stays within clipping ancestors
618
629
  and viewport bounds, and updates its position on scroll and resize.
@@ -665,21 +676,34 @@ larger.
665
676
  ### Dense financial tables
666
677
 
667
678
  The table is markup. A named scroll region contains a native `<table>`, and you apply the
668
- recipes as classes. Zebra adds no grey stripes. Hover gives a row a quiet neutral fill across the table width. Without zebra, the fill has round ends, and the first and last content sit 8px inside it. No row line crosses those ends.
669
- Keyboard focus keeps its ring, and a landed row keeps its own mark. `compact` sets a 33px minimum row, but larger or wrapped content makes the row
679
+ recipes as classes. Zebra adds no grey stripes. Hover gives a row a quiet neutral fill across the table width. On a dense hover table, the fill has round ends, and the first and last content sit 8px inside it. No row line crosses those ends.
680
+ Keyboard focus keeps its ring, and a landed row keeps its own mark. On a zebra or dense table, `compact` sets a 33px minimum row, but larger or wrapped content makes the row
670
681
  taller. **Columns scroll rather than disappear**, while sticky headers and pinned identity cells
671
682
  keep opaque backgrounds, the shared focus composition, and their full accessible names. **A
672
683
  pinned column draws its divider only where the region can actually scroll:** at a width where
673
- every column fits, the line divides nothing, so it is not drawn. **The region shows a soft shade
674
- on whichever edge still has columns behind it, and none on an edge that has been reached** —
675
- darker on a light ground, lighter on a dark one. Both are CSS alone, so vanilla and React tables
676
- carry them alike, and neither reaches the focus ring. An engine that cannot report a scroll state
677
- keeps the divider at every width. **A link
684
+ every column fits, the line divides nothing, so it is not drawn. **The region draws no shade at
685
+ its edges.** The divider is CSS alone, so vanilla and React tables carry it alike, and it does not
686
+ reach the focus ring. An engine that cannot report a scroll state keeps the divider at every
687
+ width. **A link
678
688
  inside a cell uses the row's ink, gets an underline on hover, and uses the shared ring on
679
689
  `:focus-visible`**. The ring surrounds the whole link, including a title-cell link that wraps.
680
690
  `numericValue` distinguishes missing from zero. `deltaValue` prints your sign and uses your
681
691
  explicit judgement. **Colour never supplies the sign.**
682
692
 
693
+ **A hover table that is neither zebra nor dense is a row table.** Its body rows have no lines
694
+ and no column lines, and the head keeps its rule. **A row is 48px tall, 36px with `compact` and
695
+ 56px with `comfortable`**, and larger or wrapped content makes it taller. Hover gives the row a
696
+ neutral fill, and a checked selection box gives it an accent wash. Both fills are square, and the
697
+ first and last content sit 12px inside them. The name
698
+ in the first column takes the strongest ink. **`.ui-table__sub` puts a second value under the
699
+ first**, such as an email under a name, in full ink at a smaller size. An act cell that holds icon
700
+ buttons is as wide as its buttons, and they are 32px, so the row keeps its height. In a card, the
701
+ table reaches the card's edges and its end cells keep the card's text edge. A scroll frame in a
702
+ card keeps a 4px band at each side and above the header for its focus ring, so a row fill stops
703
+ 4px inside the card's edges. The header gives that top band back, so the table keeps its place, and
704
+ the header follows the ring's rounded corners. The band shows no line at rest, and the frame adds no
705
+ room below the table.
706
+
683
707
  A cell can group its reference and status with `.ui-table__pair`. They stack when the cell cannot fit them side by side.
684
708
  A landed row's `.is-target` mark shows on pointer arrival as well as keyboard focus, and it outlives focus, so arrival and focus show together and stay distinguishable.
685
709
  The caller brings the target row into view and keeps its mark until the next arrival.
@@ -705,9 +729,10 @@ its right side.
705
729
 
706
730
  **On a phone, a table stays a table.** No kit table lays its rows out as blocks. A table wider
707
731
  than the screen scrolls sideways inside its frame, and the page does not scroll. A pinned identity
708
- column stays at the frame's left edge on the table's own surface, so it follows the theme. While
709
- columns sit under it, a soft shade from the edge token falls to its right. At the left edge there
710
- is no shade. This is a rule in [Dense tables](../guidelines/dense-tables.md).
732
+ column stays at the frame's left edge on the table's own surface, so it follows the theme.
733
+ **Below 560px the frame shows no scrollbar**, because a finger scrolls it. **A screen-reader label
734
+ in the table stays inside the frame**, so it cannot widen the page. This is a rule in
735
+ [Dense tables](../guidelines/dense-tables.md).
711
736
 
712
737
  `FilterBar` is controlled by you. Selections, removal, and clear-all request changes. They never
713
738
  change the filters you supplied. Given `add` and `onAdd` it also draws the way to add one; see
@@ -814,6 +839,38 @@ to fit its label at `--text-xs`. Other sizes keep their 16px glyph at stroke-wid
814
839
  dots fit inside the smaller target. The size does not change the variant's colour or its
815
840
  interaction states.
816
841
 
842
+ ### Hold to confirm
843
+
844
+ Use React `<Button hold>` for one primary or danger action that the user cannot undo, such as
845
+ a send to many people or the deletion of a workspace. Do not use it for an action that the user
846
+ can undo, for a routine save or for a form submit. Use a plain button for those. A link takes no
847
+ `hold`.
848
+
849
+ ```tsx
850
+ <Button hold variant="danger" onConfirm={deleteWorkspace}>Delete workspace</Button>
851
+ ```
852
+
853
+ Put the action in `onConfirm`. The button calls only `onConfirm`. A click does not call
854
+ `onClick`, and the button never submits its form.
855
+
856
+ **What the user sees.** The user presses the button and holds it for 1000 ms. A fill grows from
857
+ the start edge. A primary button fills with `--accent`. A danger button stays quiet at rest and
858
+ shows `--pink` only while it is hovered, focused or held. If the user releases before the end,
859
+ the fill goes back to empty and nothing happens. A press shorter than 300 ms shows "Hold to
860
+ confirm" above the button. A slide off the button does not stop the hold. Under reduced motion
861
+ the fill moves in four 250 ms steps, and the hold still takes 1000 ms. A busy or disabled button
862
+ does not hold.
863
+
864
+ **Keyboard and screen reader.** Enter or Space held for 1000 ms confirms, the same as a pointer.
865
+ Two presses within 3000 ms also confirm. This is the path for a screen reader user. The button
866
+ gives the description "Hold to confirm, or press twice." after any `aria-describedby` of your
867
+ own.
868
+
869
+ **Room on the screen.** The hint shows over the content above the button, so the button does
870
+ not move. Leave room for one line above the button. An ancestor with `overflow: hidden` clips
871
+ the hint. If a result replaces the button after the confirm, give the result the focus. Give
872
+ its row a minimum height of `--btn-height-md`, so the row keeps the height of an md button.
873
+
817
874
  ### Code highlighting
818
875
 
819
876
  `hlCode(raw, lang)` returns highlighted HTML. `codeTokens(raw, lang)` returns the same tokens as
@@ -908,7 +965,8 @@ vanilla sections above.
908
965
  Tables fill their container by default. Inside `.ui-card--fit`, tables size to their content.
909
966
  A `.ui-table__title` cell gives a text column the remaining width. A column takes `cell` for it:
910
967
  `title`, `code`, `long`, `strong` or `act`. `rowHeader` renders the column's body cells as `th scope="row"`.
911
- `DataTable` takes the vanilla hooks as props: `zebra`, `hover` (on unless `false`), `density`,
968
+ `DataTable` takes the vanilla hooks as props: `zebra`, `hover` (on unless `false`), `density`
969
+ (`dense`, `compact` or `comfortable`),
912
970
  `stickyHeader` and `pinnedIdentity`. `rowState` marks a row `target` or `dead`, `footer` takes totals rows
913
971
  and `caption` names the table for assistive technology. A `dead` row is muted and shows its state as a word,
914
972
  with no strike line. `stack` is deprecated and ignored: a phone table scrolls sideways like any other. A table that does not scroll is the card's own child, so a dense table reaches the card's text edge.
@@ -1308,7 +1366,8 @@ The button and tick follow `value` until the caller updates it. `AccountMenu` ma
1308
1366
  and follows the OS otherwise. It sets `data-theme-choice` and the resolved `data-theme` on
1309
1367
  `html` and exports `THEME_INIT_SCRIPT` for a head script.
1310
1368
  - **`Tooltip`** renders the vanilla host, panel and label classes. Escape keeps focus on the
1311
- trigger.
1369
+ trigger. A hover opens it after 300ms and keyboard focus at once; see
1370
+ [The React tooltip](#the-react-tooltip).
1312
1371
  - **`Pill`** and **`StatusDot`** add no interactive role and create no live region. Visible
1313
1372
  status text belongs beside the dot.
1314
1373
  - **`SuccessPanel`** is the inline confirmation. **`SuccessCheck`** is the bare shared mark.
@@ -1324,8 +1383,8 @@ This is stated so nobody has to discover it by trying:
1324
1383
 
1325
1384
  - **No build step**, whose consequence is
1326
1385
  [breakpoints as literals](foundations.md#breakpoints).
1327
- - **No density system.** `.ui-table--dense`, `.ui-table--compact` and `.ui-cmdk--roomy` are the
1328
- only density modifiers, and each is local to its component.
1386
+ - **No density system.** `.ui-table--dense`, `.ui-table--compact`, `.ui-table--comfortable` and
1387
+ `.ui-cmdk--roomy` are the only density modifiers, and each is local to its component.
1329
1388
  - **No container scale.** There is one `--container`, not a narrow/wide set.
1330
1389
  - **No second bar for a control's glyph.** 1.5 CSS px is the line for every stroked mark.
1331
1390
  - **No charts.** A stat band's trend is a slot for your `<svg>`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.160.0",
3
+ "version": "0.162.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
@@ -201,6 +201,14 @@
201
201
  opacity: 1;
202
202
  visibility: visible;
203
203
  }
204
+ .ui-tip:not(.is-open) {
205
+ display: none;
206
+ }
207
+ @starting-style {
208
+ .ui-tip.is-open {
209
+ opacity: 0;
210
+ }
211
+ }
204
212
  .ui-tip__label {
205
213
  color: var(--text);
206
214
  }
@@ -47,12 +47,19 @@ type ButtonOptions = {
47
47
  completionMessage?: string;
48
48
  children?: ReactNode;
49
49
  };
50
- type NativeButtonProps = ButtonOptions & ButtonHTMLAttributes<HTMLButtonElement> & {
50
+ type HoldOptions = {
51
+ /** Hold to confirm: a 1 s press, or two presses within 3 s, calls onConfirm. A click never calls onClick. */
52
+ hold?: boolean;
53
+ onConfirm?: () => void;
54
+ };
55
+ type NativeButtonProps = ButtonOptions & HoldOptions & ButtonHTMLAttributes<HTMLButtonElement> & {
51
56
  href?: never;
52
57
  };
53
58
  type ButtonLinkProps = ButtonOptions & AnchorHTMLAttributes<HTMLAnchorElement> & {
54
59
  href: string;
55
60
  disabled?: boolean;
61
+ hold?: never;
62
+ onConfirm?: never;
56
63
  };
57
64
  type ButtonProps = NativeButtonProps | ButtonLinkProps;
58
65
  type ButtonElement = HTMLButtonElement | HTMLAnchorElement;
@@ -367,7 +374,7 @@ type DataTableProps<T> = {
367
374
  /** A caption read by assistive technology only. */
368
375
  caption?: string;
369
376
  dense?: boolean;
370
- density?: 'default' | 'dense' | 'compact';
377
+ density?: 'default' | 'dense' | 'compact' | 'comfortable';
371
378
  stickyHeader?: boolean;
372
379
  pinnedIdentity?: boolean;
373
380
  scrollLabel?: string;
@@ -1059,10 +1066,12 @@ type TooltipProps = {
1059
1066
  value?: string;
1060
1067
  detail?: string;
1061
1068
  placement?: 'top' | 'bottom';
1069
+ /** The child is one control that names itself, such as an icon button: the readout repeats its name, so it adds no tab stop and no description. */
1070
+ control?: boolean;
1062
1071
  /** Inline content without nested controls. */
1063
1072
  children: ReactNode;
1064
1073
  };
1065
- declare function Tooltip({ text, label, value, detail, placement, children }: TooltipProps): react.JSX.Element;
1074
+ declare function Tooltip({ text, label, value, detail, placement, control, children }: TooltipProps): react.JSX.Element;
1066
1075
 
1067
1076
  type SuccessMark = 'line' | 'circled';
1068
1077
  type SuccessCheckProps = Omit<SVGAttributes<SVGSVGElement>, 'children'> & {