@mistriwork/ui 1.0.0-rc.74 → 1.0.0-rc.75

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.d.ts CHANGED
@@ -29,8 +29,10 @@ export interface ButtonLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>
29
29
  ref?: Ref<HTMLAnchorElement>;
30
30
  }
31
31
  /** A link dressed as a button: it goes somewhere (a download, another page) rather than doing something here, so it
32
- is an anchor and nothing more, wearing the button's part for its look. */
33
- declare function DefaultButtonLink({ intent, size, block, ...rest }: ButtonLinkProps): import("react").JSX.Element;
32
+ is an anchor and nothing more, wearing the button's part for its look. A held one (`aria-disabled`) says so in
33
+ the part's own state attribute, so it is drawn as a held button (dimmed, still under the pointer), and it refuses
34
+ to go, as a held button refuses its press. */
35
+ declare function DefaultButtonLink({ intent, size, block, onClick, ...rest }: ButtonLinkProps): import("react").JSX.Element;
34
36
  export declare const Button: typeof DefaultButton;
35
37
  export declare const ButtonLink: typeof DefaultButtonLink;
36
38
  export {};
package/dist/Button.js CHANGED
@@ -34,9 +34,19 @@ function DefaultButton({ intent = 'secondary', size = 'default', busy = false, b
34
34
  return (_jsx(Behavior, { ...rest, type: type, "data-variant": VARIANT[intent], "data-size": SIZE[size], "data-block": block ? '' : undefined, "data-busy": busy ? '' : undefined, "aria-disabled": busy || rest['aria-disabled'] || undefined, onClick: press, children: busy && busyLabel !== undefined ? busyLabel : children }));
35
35
  }
36
36
  /** A link dressed as a button: it goes somewhere (a download, another page) rather than doing something here, so it
37
- is an anchor and nothing more, wearing the button's part for its look. */
38
- function DefaultButtonLink({ intent = 'secondary', size = 'default', block, ...rest }) {
39
- return _jsx("a", { ...rest, "data-slot": "button", "data-variant": VARIANT[intent], "data-size": SIZE[size], "data-block": block ? '' : undefined });
37
+ is an anchor and nothing more, wearing the button's part for its look. A held one (`aria-disabled`) says so in
38
+ the part's own state attribute, so it is drawn as a held button (dimmed, still under the pointer), and it refuses
39
+ to go, as a held button refuses its press. */
40
+ function DefaultButtonLink({ intent = 'secondary', size = 'default', block, onClick, ...rest }) {
41
+ const held = rest['aria-disabled'] === true || rest['aria-disabled'] === 'true';
42
+ const follow = (event) => {
43
+ if (held) {
44
+ event.preventDefault();
45
+ return;
46
+ }
47
+ onClick?.(event);
48
+ };
49
+ return (_jsx("a", { ...rest, onClick: follow, "data-slot": "button", "data-variant": VARIANT[intent], "data-size": SIZE[size], "data-block": block ? '' : undefined, "data-disabled": held ? '' : undefined }));
40
50
  }
41
51
  /* Slotted (UiKit.tsx): an App's control kit may draw its own in place of the default, with the same props. */
42
52
  export const Button = slotted('Button', DefaultButton);
@@ -31,7 +31,11 @@
31
31
 
32
32
  /* A filled primary is the ink, not the accent: UI SDK fills `solid` with its primary, which here is the accent
33
33
  that checked and selected states wear. */
34
- /* A link dressed as a button is read as a button: no underline, in the button's own ink. */
34
+ /* A link dressed as a button is read as a button: no underline, in the button's own ink, in every state a link
35
+ has. The variants below key on the part, never on the element or a link state, so a visited, hovered, focused
36
+ or pressed link wears what the same button wears; a held one says `data-disabled` as a held button does
37
+ (Button.tsx). A rule that dresses plain links leaves the part alone (`:where(:not([data-slot]))`), because one
38
+ written straight into base outranks this whole layer (kit style.css, `.free-page-body a`). */
35
39
  a[data-slot='button'] {
36
40
  text-decoration: none;
37
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/ui",
3
- "version": "1.0.0-rc.74",
3
+ "version": "1.0.0-rc.75",
4
4
  "description": "The standalone React primitives both shells are drawn with: Modal, DropMenu, Dropdown, Typeahead, Button, Field, Icon and DateField over UI SDK, Switch, Tabs, Drawer, Popover, Avatar, Pagination, Carousel, Resizable, ScrollArea and Tooltip, the form controls built on them (text, masked, money and sensitive boxes, listboxes, choices, slider, progress and action bar; Preview), the landing hero's blocks (badge, photo tiles, icon rows; Preview), their tokens and stylesheet, and the zoom-aware ruler their popups are placed by.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {