@mcp-b/web-components 0.2.22 → 0.3.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.
- package/README.md +93 -30
- package/dist/{alert-dialog-D25Oi_TS.js → alert-dialog-CGUwj_0U.js} +1 -1
- package/dist/{button-gg3JJxQZ.js → button-BbabhtKj.js} +121 -77
- package/dist/{button-BQofnUt4.d.ts → button-c5YKsC69.d.ts} +6 -3
- package/dist/{checkbox-DoFcDEKB.d.ts → checkbox-BtoypUxD.d.ts} +0 -6
- package/dist/{checkbox-C96lUDIM.js → checkbox-C97tlcf2.js} +11 -43
- package/dist/{color-input-Gae_-9w-.js → color-input-Dtp1v7A-.js} +14 -54
- package/dist/{color-input-Bky89xg_.d.ts → color-input-S29ZHwHE.d.ts} +0 -5
- package/dist/{color-picker-BYyZavkT.js → color-picker-Mnpc5u6E.js} +8 -4
- package/dist/{combobox-iERnTD3A.js → combobox-D4ji7M2B.js} +12 -33
- package/dist/{combobox-item-D2H1CMxC.d.ts → combobox-item-BnBtZyhw.d.ts} +3 -6
- package/dist/{comparison-B1-nMwmp.d.ts → comparison-CRvbwS7X.d.ts} +1 -0
- package/dist/{comparison-HJ1Zedhs.js → comparison-DQUpvkmg.js} +11 -3
- package/dist/components/alert-dialog/alert-dialog.js +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/carousel/carousel.js +1 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-input/color-input.d.ts +1 -1
- package/dist/components/color-input/color-input.js +1 -1
- package/dist/components/color-picker/color-picker.js +1 -1
- package/dist/components/combobox/combobox.d.ts +1 -1
- package/dist/components/combobox/combobox.js +1 -1
- package/dist/components/combobox-item/combobox-item.d.ts +1 -1
- package/dist/components/comparison/comparison.d.ts +1 -1
- package/dist/components/comparison/comparison.js +1 -1
- package/dist/components/copy/copy.js +4 -20
- package/dist/components/date/date.d.ts +1 -1
- package/dist/components/date/date.js +1 -1
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/dropdown/dropdown.js +1 -1
- package/dist/components/expander/expander.js +1 -1
- package/dist/components/file-input/file-input.d.ts +1 -1
- package/dist/components/file-input/file-input.js +1 -1
- package/dist/components/filter-bar/filter-bar.js +1 -1
- package/dist/components/index.d.ts +24 -24
- package/dist/components/index.js +44 -44
- package/dist/components/infinite-scroller/infinite-scroller.js +1 -1
- package/dist/components/listbox/listbox.d.ts +1 -1
- package/dist/components/listbox/listbox.js +1 -1
- package/dist/components/navicon/navicon.js +1 -1
- package/dist/components/number/number.js +1 -1
- package/dist/components/number-field/number-field.d.ts +1 -1
- package/dist/components/number-field/number-field.js +1 -1
- package/dist/components/pagination/pagination.js +1 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/preview-card/preview-card.js +1 -1
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +1 -1
- package/dist/components/radio-item/radio-item.js +1 -1
- package/dist/components/rating/rating.d.ts +1 -1
- package/dist/components/rating/rating.js +1 -1
- package/dist/components/scroller/scroller.js +1 -1
- package/dist/components/search-list/search-list.d.ts +1 -1
- package/dist/components/search-list/search-list.js +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.js +1 -1
- package/dist/components/share/share.js +1 -1
- package/dist/components/slide-activator/slide-activator.d.ts +1 -1
- package/dist/components/slide-activator/slide-activator.js +1 -1
- package/dist/components/slider/slider.d.ts +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.d.ts +1 -1
- package/dist/components/splitter/splitter.js +1 -1
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/tab-list/tab-list.js +1 -1
- package/dist/components/text-area/text-area.d.ts +1 -1
- package/dist/components/text-area/text-area.js +1 -1
- package/dist/components/text-field/text-field.d.ts +1 -1
- package/dist/components/text-field/text-field.js +1 -1
- package/dist/components/toast/toast.d.ts +1 -1
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/toast-item/toast-item.js +1 -1
- package/dist/components/toggle-icon/toggle-icon.d.ts +1 -1
- package/dist/components/toggle-icon/toggle-icon.js +1 -1
- package/dist/components/toggle-tag/toggle-tag.d.ts +1 -1
- package/dist/components/toggle-tag/toggle-tag.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/components/transition-group/transition-group.d.ts +1 -1
- package/dist/components/transition-group/transition-group.js +1 -1
- package/dist/components/zoomable-frame/zoomable-frame.js +1 -1
- package/dist/{date-6M6wfa8L.d.ts → date-DtaTBM71.d.ts} +1 -1
- package/dist/docs/custom-elements.json +126 -171
- package/dist/{dropdown-DM4tlF_p.js → dropdown-BPOpCp59.js} +58 -34
- package/dist/{dropdown-Bo00Vlr5.d.ts → dropdown-C5ldJu4g.d.ts} +5 -1
- package/dist/{localize-322EtXNX.d.ts → en-ss05iPjS.d.ts} +4 -1
- package/dist/{file-input-vZFm22Lo.js → file-input-B4VfcfTD.js} +17 -33
- package/dist/{file-input-D2D6YC0B.d.ts → file-input-CgsTcC1R.d.ts} +0 -5
- package/dist/{filter-bar-DJuDlx5f.js → filter-bar-DhQSMr3S.js} +1 -1
- package/dist/index.d.ts +25 -27
- package/dist/index.js +45 -48
- package/dist/{infinite-scroller-BmmtnWNt.js → infinite-scroller-DjeMswwE.js} +2 -2
- package/dist/{listbox-B0geidHW.js → listbox-BGHw-rUd.js} +13 -28
- package/dist/{listbox-DD4ujIJe.d.ts → listbox-DKoMIQA6.d.ts} +3 -5
- package/dist/{number-field-odk4lKXM.d.ts → number-field-T0rzObq9.d.ts} +0 -5
- package/dist/{number-field-BGH7JtNf.js → number-field-yME3rRZT.js} +44 -55
- package/dist/{popover-DJBrJ0za.js → popover-lsI6gqNk.js} +9 -32
- package/dist/{preview-card-C7H1FPfd.js → preview-card-D1msvOWP.js} +1 -1
- package/dist/{radio-8UZAUYXt.js → radio-4Cok4gJI.js} +11 -28
- package/dist/{radio-CieMa4zU.d.ts → radio-B4fz924Q.d.ts} +1 -4
- package/dist/{radio-item-BlhFgXsU.js → radio-item-DpP3GBPV.js} +2 -3
- package/dist/{rating-4xNsWumY.d.ts → rating-8BLXhAVl.d.ts} +1 -3
- package/dist/{rating-C1BcJDIO.js → rating-CSn-nU2R.js} +24 -34
- package/dist/{search-list-Clmrg8EV.js → search-list-BffPIgnw.js} +19 -10
- package/dist/{search-list-n0GYO7rh.d.ts → search-list-Cd3--X7Q.d.ts} +11 -1
- package/dist/{select-CkZK2jJn.d.ts → select-6H_sN4A2.d.ts} +0 -5
- package/dist/{select-DLIaRnA4.js → select-B6nkY6E-.js} +7 -43
- package/dist/{share-bsgXZCl7.js → share-C7dB9NYf.js} +3 -19
- package/dist/{slide-activator-D7bBz69E.d.ts → slide-activator-CB0Ztk_u.d.ts} +1 -0
- package/dist/{slide-activator-Dm1EvZtL.js → slide-activator-Dkv5_KPl.js} +10 -3
- package/dist/{slider-B90Il7x3.js → slider-DY-GuC8T.js} +35 -46
- package/dist/{slider-B0FVsV1o.d.ts → slider-uQQ-T_kn.d.ts} +2 -3
- package/dist/{splitter-MnD4In9H.js → splitter-DzC0hXGN.js} +14 -3
- package/dist/{splitter-DBDJAzsp.d.ts → splitter-KQVgGdvP.d.ts} +1 -0
- package/dist/{switch-Cief9M59.d.ts → switch-BUfFo074.d.ts} +0 -6
- package/dist/{switch-D0hWr37A.js → switch-Chij-EaQ.js} +11 -43
- package/dist/{tab-list-B_Ye_Oj9.js → tab-list-CVOUSpAh.js} +2 -2
- package/dist/{text-area-B_mjCE9W.d.ts → text-area-DFMKyk8y.d.ts} +0 -3
- package/dist/{text-area-Czixaz-_.js → text-area-DZVghSkO.js} +14 -51
- package/dist/{text-field-BClWMp6q.d.ts → text-field-DepP1gei.d.ts} +0 -5
- package/dist/{text-field-Cznb4Afc.js → text-field-gX5RovkE.js} +11 -52
- package/dist/{toast-cEBVK9NQ.d.ts → toast-CpyA3GYM.d.ts} +1 -1
- package/dist/{toast-DgkBQzQC.js → toast-CxfaWFY_.js} +2 -2
- package/dist/{toggle-icon-4oLDeEt4.js → toggle-icon-B3fZuslO.js} +9 -31
- package/dist/{toggle-icon-DlwMMWZL.d.ts → toggle-icon-sTLCOruF.d.ts} +0 -5
- package/dist/{toggle-tag-1sfTFJtg.js → toggle-tag--Gkp-CJJ.js} +7 -35
- package/dist/{toggle-tag-IVvMGT4R.d.ts → toggle-tag-DDBa6hAg.d.ts} +0 -5
- package/dist/{tooltip-DbyoPFNe.js → tooltip-bSXNhG9l.js} +9 -32
- package/dist/{transition-group-3hnAnwSd.js → transition-group-8PmQx0A5.js} +23 -4
- package/dist/{transition-group-DD_CjSNC.d.ts → transition-group-D134iT1k.d.ts} +8 -0
- package/dist/translations/en.d.ts +1 -5
- package/dist/translations/en.js +3 -6
- package/dist/translations/es.d.ts +1 -1
- package/dist/translations/es.js +2 -5
- package/dist/types/custom-element-jsx.d.ts +26 -10
- package/dist/utilities/anchored-surface.d.ts +36 -0
- package/dist/utilities/anchored-surface.js +46 -0
- package/dist/utilities/copy-feedback.d.ts +16 -0
- package/dist/utilities/copy-feedback.js +33 -0
- package/dist/utilities/form-validity.d.ts +28 -0
- package/dist/utilities/form-validity.js +33 -0
- package/dist/utilities/localize.d.ts +1 -1
- package/dist/utilities/localize.js +1 -0
- package/package.json +3 -2
- package/dist/{carousel-XopKISBQ.js → carousel-DpIqPTuO.js} +1 -1
- package/dist/{date-CJPmOdi9.js → date-CFIR88pX.js} +1 -1
- package/dist/{dialog-Cx46HMaZ.js → dialog-Ddvyn2d_.js} +1 -1
- package/dist/{expander-Bwvxj6Oa.js → expander-CMV4QCha.js} +1 -1
- package/dist/{navicon-_yMHY27-.js → navicon-B-5pY9gq.js} +1 -1
- package/dist/{number-BNtNXNF3.js → number-BYBxfOGw.js} +1 -1
- package/dist/{pagination-CrTQnuNW.js → pagination-VOzVTV8p.js} +1 -1
- package/dist/{scroller-LYgBVyfY.js → scroller-DZATZlDa.js} +1 -1
- package/dist/{spinner-C04Dmc0H.js → spinner-C9lQARtQ.js} +1 -1
- package/dist/{toast-item-CGvz92Qk.js → toast-item-DzSPG25R.js} +1 -1
- package/dist/{zoomable-frame-DxcjLGcF.js → zoomable-frame-BrjVkNMX.js} +1 -1
package/README.md
CHANGED
|
@@ -1,49 +1,112 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MCP-B Web Components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@mcp-b/web-components` is the Lit renderer of the MCP-B design system. It shares
|
|
4
|
+
design tokens and deliberately shared control contracts with
|
|
5
|
+
`@mcp-b/react-components`, the default renderer for product UI. Lit also supports
|
|
6
|
+
framework-independent maps, editors, visualizations, and IFC surfaces through
|
|
7
|
+
the sibling domain packages.
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
## Use a component
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
Install with `vp add @mcp-b/web-components`, then import the theme and the elements
|
|
12
|
+
you use:
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
```ts
|
|
15
|
+
import "@mcp-b/web-components/themes/sigvelo.css";
|
|
16
|
+
import "@mcp-b/web-components/components/text-field/text-field.js";
|
|
17
|
+
import "@mcp-b/web-components/components/button/button.js";
|
|
18
|
+
```
|
|
11
19
|
|
|
12
|
-
|
|
20
|
+
```html
|
|
21
|
+
<form>
|
|
22
|
+
<sigvelo-text-field name="title" label="Title" required></sigvelo-text-field>
|
|
23
|
+
<sigvelo-button type="submit">Save</sigvelo-button>
|
|
24
|
+
</form>
|
|
25
|
+
```
|
|
13
26
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- 🐭 A built-in autoloader that detects components in your HTML — even ones you add dynamically — and loads them on the fly!
|
|
27
|
+
Individual entrypoints register their dependencies and default English copy.
|
|
28
|
+
The package root registers the entire core library; prefer individual imports
|
|
29
|
+
when you only need a few controls. Additional translations are opt-in:
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
```ts
|
|
32
|
+
import "@mcp-b/web-components/translations/es.js";
|
|
33
|
+
document.documentElement.lang = "es";
|
|
34
|
+
```
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
- [Get help and support](https://design-system.sigvelo.com/support)
|
|
23
|
-
- [Request a feature](https://github.com/omarkawach/sigvelo/discussions/categories/feature-requests)
|
|
24
|
-
- [Report a bug](https://github.com/omarkawach/sigvelo/issues/new/choose)
|
|
25
|
-
- [Ask for help](https://design-system.sigvelo.com/support)
|
|
26
|
-
- [Star the project on GitHub](https://github.com/omarkawach/sigvelo/stargazers)
|
|
36
|
+
## One token layer
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
The theme entrypoint loads `@mcp-b/design-tokens` through `@mcp-b/wc-support`.
|
|
39
|
+
It does not require React CSS or maintain a second palette.
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
- No `data-theme` attribute means follow the operating system. Use
|
|
42
|
+
`data-theme="light"` or `data-theme="dark"` for an explicit root or subtree override.
|
|
43
|
+
- Set `data-preset` on the document root for an accent palette and `data-style`
|
|
44
|
+
for a design-language preset. Removing the attribute restores the default.
|
|
45
|
+
- Shared controls consume `--sigvelo-control-*` for their size, padding, icons,
|
|
46
|
+
and line height, and `--sigvelo-focus-*` for keyboard focus.
|
|
47
|
+
- Add a shared semantic token in `packages/design-tokens` only when an existing
|
|
48
|
+
token cannot express the need. Component-specific hooks remain local.
|
|
31
49
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
React owns the contracts explicitly declared in
|
|
51
|
+
[`design-system.catalog.json`](./design-system.catalog.json). Other name
|
|
52
|
+
overlaps are review inventory, not a promise of API parity.
|
|
53
|
+
|
|
54
|
+
## Compose with native boundaries
|
|
55
|
+
|
|
56
|
+
Use named slots for caller-owned content and documented `::part()` hooks for
|
|
57
|
+
internal styling. Inherited custom properties carry the shared theme through
|
|
58
|
+
shadow roots; document selectors do not style arbitrary internals. See
|
|
59
|
+
[Lit shadow DOM composition](https://lit.dev/docs/components/shadow-dom/) and
|
|
60
|
+
[Lit styling](https://lit.dev/docs/components/styles/).
|
|
61
|
+
|
|
62
|
+
Keep native buttons, links, inputs, and form association in the owning control.
|
|
63
|
+
An ancestor fieldset's disabled state must not overwrite a control's own
|
|
64
|
+
`disabled` attribute. Components must remain usable after disconnecting and
|
|
65
|
+
reconnecting; initialize per-connection resources and release them on disconnect.
|
|
66
|
+
See [Lit lifecycle](https://lit.dev/docs/components/lifecycle/).
|
|
36
67
|
|
|
37
|
-
|
|
68
|
+
Custom tags and events use the `sigvelo-` prefix. Dispatch user-facing events
|
|
69
|
+
through the shared event classes so bubbling, composition, and typed payloads
|
|
70
|
+
remain consistent. Avoid copying the stateful localization or runtime registries
|
|
71
|
+
into domain packages.
|
|
72
|
+
|
|
73
|
+
## Package boundaries
|
|
74
|
+
|
|
75
|
+
| Package | Owns |
|
|
76
|
+
| -------------------------------------------------------------- | --------------------------------------------------------- |
|
|
77
|
+
| `design-tokens` | Shared tokens, themes, and presets |
|
|
78
|
+
| `wc-support` | Lit base classes, events, localization, and shared styles |
|
|
79
|
+
| `web-components` | Core elements and the shared Lit Storybook |
|
|
80
|
+
| `geo-support`, `geo-leaflet`, `geo-maplibre`, `geo-openlayers` | Shared map contracts and engine-specific renderers |
|
|
81
|
+
| `interactive-components`, `aec-components`, `viz-components` | Editors, IFC/3D, and charts |
|
|
82
|
+
|
|
83
|
+
Rendering engines stay peer dependencies of the packages that use them. Import
|
|
84
|
+
domain elements from their owning package; core controls do not require map or
|
|
85
|
+
3D engines. Editors additionally load
|
|
86
|
+
`@mcp-b/interactive-components/themes/interactive.css` for their syntax tokens.
|
|
87
|
+
|
|
88
|
+
## Develop and verify
|
|
89
|
+
|
|
90
|
+
From the repository root:
|
|
38
91
|
|
|
39
92
|
```sh
|
|
40
|
-
|
|
93
|
+
vp install
|
|
94
|
+
vp run @mcp-b/web-components#storybook
|
|
41
95
|
```
|
|
42
96
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
There are a number of commands you can use to lint and test the library. For a full list of them, run the following command.
|
|
97
|
+
This Storybook includes every Lit package and runs accessibility checks on its
|
|
98
|
+
stories. Root unit tests, React stories, and Lit stories are separate suites:
|
|
46
99
|
|
|
47
100
|
```sh
|
|
48
|
-
|
|
101
|
+
vp run test:browser:ci
|
|
102
|
+
vp check
|
|
103
|
+
vp run audit:tokens
|
|
104
|
+
vp run audit:css-recipes
|
|
105
|
+
vp run audit:modern-web-guidance
|
|
106
|
+
vp run catalog:check
|
|
107
|
+
vp run validate:packages
|
|
49
108
|
```
|
|
109
|
+
|
|
110
|
+
The browser runner executes all three suites. Domain package test scripts
|
|
111
|
+
delegate to the shared Lit Storybook; they do not own standalone unit suites.
|
|
112
|
+
`wc-support` also has unit and browser regression tests.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
-
import { t as SigveloDialog } from "./dialog-
|
|
2
|
+
import { t as SigveloDialog } from "./dialog-Ddvyn2d_.js";
|
|
3
3
|
import { css, html } from "lit";
|
|
4
4
|
import { property } from "lit/decorators.js";
|
|
5
5
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./icon-Df0H7LYB.js";
|
|
2
2
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
-
import "./spinner-
|
|
3
|
+
import "./spinner-C9lQARtQ.js";
|
|
4
4
|
import { css } from "lit";
|
|
5
5
|
import { property } from "lit/decorators.js";
|
|
6
6
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -26,22 +26,24 @@ var button_styles_default = css`
|
|
|
26
26
|
align-items: center;
|
|
27
27
|
justify-content: center;
|
|
28
28
|
width: 100%;
|
|
29
|
-
gap:
|
|
29
|
+
gap: var(--sigvelo-density-compact-control-gap);
|
|
30
|
+
padding-block: 0;
|
|
30
31
|
border: none;
|
|
31
32
|
border-radius: var(--sigvelo-radius-md);
|
|
32
33
|
background: none;
|
|
33
34
|
font: inherit;
|
|
34
35
|
font-weight: var(--sigvelo-font-weight-semibold);
|
|
36
|
+
line-height: var(--sigvelo-control-line-height-sm);
|
|
35
37
|
text-decoration: none;
|
|
36
38
|
vertical-align: middle;
|
|
37
39
|
white-space: nowrap;
|
|
38
40
|
cursor: inherit;
|
|
39
41
|
touch-action: manipulation;
|
|
40
42
|
transition:
|
|
41
|
-
var(--sigvelo-motion-duration-interaction) color ease,
|
|
42
|
-
var(--sigvelo-motion-duration-interaction) border-color ease,
|
|
43
|
-
var(--sigvelo-motion-duration-interaction) background-color ease,
|
|
44
|
-
var(--sigvelo-motion-duration-
|
|
43
|
+
var(--sigvelo-motion-duration-interaction) color var(--sigvelo-motion-ease-change),
|
|
44
|
+
var(--sigvelo-motion-duration-interaction) border-color var(--sigvelo-motion-ease-change),
|
|
45
|
+
var(--sigvelo-motion-duration-interaction) background-color var(--sigvelo-motion-ease-change),
|
|
46
|
+
var(--sigvelo-motion-duration-presence) translate var(--sigvelo-ease-press);
|
|
45
47
|
user-select: none;
|
|
46
48
|
-webkit-user-select: none;
|
|
47
49
|
|
|
@@ -60,33 +62,48 @@ var button_styles_default = css`
|
|
|
60
62
|
|
|
61
63
|
/* Sizes */
|
|
62
64
|
&.xs {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
--button-height: var(--sigvelo-control-height-xs);
|
|
66
|
+
--button-icon-size: var(--sigvelo-control-icon-size-xs);
|
|
67
|
+
min-height: var(--button-height);
|
|
68
|
+
padding-inline: var(--sigvelo-control-padding-inline-xs);
|
|
65
69
|
font-size: var(--sigvelo-control-text-xs);
|
|
70
|
+
line-height: var(--sigvelo-control-line-height-xs);
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
&.sm {
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
--button-height: var(--sigvelo-control-height-sm);
|
|
75
|
+
--button-icon-size: var(--sigvelo-control-icon-size-sm);
|
|
76
|
+
min-height: var(--button-height);
|
|
77
|
+
padding-inline: var(--sigvelo-control-padding-inline-sm);
|
|
71
78
|
font-size: var(--sigvelo-control-text-sm);
|
|
79
|
+
line-height: var(--sigvelo-control-line-height-sm);
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
&.md {
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
--button-height: var(--sigvelo-control-height-md);
|
|
84
|
+
--button-icon-size: var(--sigvelo-control-icon-size-md);
|
|
85
|
+
min-height: var(--button-height);
|
|
86
|
+
padding-inline: var(--sigvelo-control-padding-inline-md);
|
|
77
87
|
font-size: var(--sigvelo-control-text-md);
|
|
88
|
+
line-height: var(--sigvelo-control-line-height-md);
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
&.lg {
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
--button-height: var(--sigvelo-control-height-lg);
|
|
93
|
+
--button-icon-size: var(--sigvelo-control-icon-size-lg);
|
|
94
|
+
min-height: var(--button-height);
|
|
95
|
+
padding-inline: var(--sigvelo-control-padding-inline-lg);
|
|
83
96
|
font-size: var(--sigvelo-control-text-lg);
|
|
97
|
+
line-height: var(--sigvelo-control-line-height-lg);
|
|
84
98
|
}
|
|
85
99
|
|
|
86
100
|
&.xl {
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
--button-height: var(--sigvelo-control-height-xl);
|
|
102
|
+
--button-icon-size: var(--sigvelo-control-icon-size-xl);
|
|
103
|
+
min-height: var(--button-height);
|
|
104
|
+
padding-inline: var(--sigvelo-control-padding-inline-xl);
|
|
89
105
|
font-size: var(--sigvelo-control-text-xl);
|
|
106
|
+
line-height: var(--sigvelo-control-line-height-xl);
|
|
90
107
|
}
|
|
91
108
|
|
|
92
109
|
/* Normal buttons */
|
|
@@ -97,17 +114,14 @@ var button_styles_default = css`
|
|
|
97
114
|
color: var(--sigvelo-color-neutral-text-on-subtle);
|
|
98
115
|
|
|
99
116
|
@media (hover: hover) {
|
|
100
|
-
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
101
|
-
background-color:
|
|
117
|
+
&:hover:not(.disabled, [aria-pressed="true"], :active) {
|
|
118
|
+
background-color: var(--sigvelo-color-neutral-bg-hover);
|
|
102
119
|
}
|
|
103
120
|
}
|
|
104
121
|
|
|
122
|
+
&:active:not(.disabled),
|
|
105
123
|
&[aria-pressed="true"] {
|
|
106
|
-
background-color: color-
|
|
107
|
-
in oklab,
|
|
108
|
-
var(--sigvelo-color-neutral-bg-subtle),
|
|
109
|
-
light-dark(black, white) 7.5%
|
|
110
|
-
);
|
|
124
|
+
background-color: var(--sigvelo-color-neutral-bg-press);
|
|
111
125
|
}
|
|
112
126
|
}
|
|
113
127
|
|
|
@@ -117,17 +131,14 @@ var button_styles_default = css`
|
|
|
117
131
|
color: var(--sigvelo-color-primary-text-on-bg);
|
|
118
132
|
|
|
119
133
|
@media (hover: hover) {
|
|
120
|
-
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
121
|
-
background-color:
|
|
134
|
+
&:hover:not(.disabled, [aria-pressed="true"], :active) {
|
|
135
|
+
background-color: var(--sigvelo-color-primary-bg-hover);
|
|
122
136
|
}
|
|
123
137
|
}
|
|
124
138
|
|
|
139
|
+
&:active:not(.disabled),
|
|
125
140
|
&[aria-pressed="true"] {
|
|
126
|
-
background-color: color-
|
|
127
|
-
in oklab,
|
|
128
|
-
var(--sigvelo-color-primary-bg),
|
|
129
|
-
light-dark(black, white) 7.5%
|
|
130
|
-
);
|
|
141
|
+
background-color: var(--sigvelo-color-primary-bg-press);
|
|
131
142
|
}
|
|
132
143
|
}
|
|
133
144
|
|
|
@@ -137,17 +148,14 @@ var button_styles_default = css`
|
|
|
137
148
|
color: var(--sigvelo-color-danger-text-on-bg);
|
|
138
149
|
|
|
139
150
|
@media (hover: hover) {
|
|
140
|
-
&:hover:not(.disabled, [aria-pressed="true"]) {
|
|
141
|
-
background-color:
|
|
151
|
+
&:hover:not(.disabled, [aria-pressed="true"], :active) {
|
|
152
|
+
background-color: var(--sigvelo-color-danger-bg-hover);
|
|
142
153
|
}
|
|
143
154
|
}
|
|
144
155
|
|
|
156
|
+
&:active:not(.disabled),
|
|
145
157
|
&[aria-pressed="true"] {
|
|
146
|
-
background-color: color-
|
|
147
|
-
in oklab,
|
|
148
|
-
var(--sigvelo-color-danger-bg),
|
|
149
|
-
light-dark(black, white) 7.5%
|
|
150
|
-
);
|
|
158
|
+
background-color: var(--sigvelo-color-danger-bg-press);
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
161
|
}
|
|
@@ -207,6 +215,16 @@ var button_styles_default = css`
|
|
|
207
215
|
}
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
&.ghost.destructive {
|
|
219
|
+
color: var(--sigvelo-color-danger-text);
|
|
220
|
+
|
|
221
|
+
@media (hover: hover) {
|
|
222
|
+
&:hover:not(.disabled) {
|
|
223
|
+
background-color: color-mix(in oklab, transparent, var(--sigvelo-color-danger-bg) 12.5%);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
210
228
|
/* Raised surface buttons */
|
|
211
229
|
&.surface {
|
|
212
230
|
background-color: var(--sigvelo-color-surface-raised);
|
|
@@ -232,25 +250,10 @@ var button_styles_default = css`
|
|
|
232
250
|
}
|
|
233
251
|
}
|
|
234
252
|
|
|
235
|
-
/* Icon buttons */
|
|
253
|
+
/* Icon buttons share the control's height and icon size. */
|
|
236
254
|
&.icon {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
&.xs {
|
|
240
|
-
padding-inline: 0.525em;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
&.sm {
|
|
244
|
-
padding-inline: 0.65em;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
&.lg {
|
|
248
|
-
padding-inline: 0.675em;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
&.xl {
|
|
252
|
-
padding-inline: 0.55em;
|
|
253
|
-
}
|
|
255
|
+
width: var(--button-height);
|
|
256
|
+
padding-inline: 0;
|
|
254
257
|
}
|
|
255
258
|
|
|
256
259
|
/* Pills */
|
|
@@ -285,7 +288,7 @@ var button_styles_default = css`
|
|
|
285
288
|
cursor: not-allowed;
|
|
286
289
|
|
|
287
290
|
#label {
|
|
288
|
-
|
|
291
|
+
opacity: 0;
|
|
289
292
|
}
|
|
290
293
|
}
|
|
291
294
|
|
|
@@ -301,8 +304,8 @@ var button_styles_default = css`
|
|
|
301
304
|
font-size: 1.25em;
|
|
302
305
|
}
|
|
303
306
|
|
|
304
|
-
/*
|
|
305
|
-
|
|
307
|
+
/* Opacity needs a box; the default slot display of contents ignores it. */
|
|
308
|
+
#label {
|
|
306
309
|
display: inline;
|
|
307
310
|
}
|
|
308
311
|
}
|
|
@@ -341,15 +344,39 @@ var button_styles_default = css`
|
|
|
341
344
|
margin-inline-start: calc(var(--sigvelo-border-width) * -2);
|
|
342
345
|
}
|
|
343
346
|
|
|
347
|
+
@media (forced-colors: active) {
|
|
348
|
+
#button {
|
|
349
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width) ButtonText;
|
|
350
|
+
|
|
351
|
+
&.ghost,
|
|
352
|
+
&.link {
|
|
353
|
+
border-color: transparent;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
&.disabled:not(.loading),
|
|
357
|
+
&.disabled.loading {
|
|
358
|
+
border-color: GrayText;
|
|
359
|
+
color: GrayText;
|
|
360
|
+
opacity: 1;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@media (prefers-reduced-motion: reduce) {
|
|
366
|
+
#button:active:not(.disabled) {
|
|
367
|
+
translate: none;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
344
371
|
/* Icons */
|
|
345
372
|
::slotted(sigvelo-icon) {
|
|
346
|
-
font-size:
|
|
373
|
+
font-size: var(--button-icon-size);
|
|
347
374
|
stroke-width: 1.75px;
|
|
348
375
|
}
|
|
349
376
|
|
|
350
377
|
::slotted(svg) {
|
|
351
|
-
width:
|
|
352
|
-
height:
|
|
378
|
+
width: var(--button-icon-size);
|
|
379
|
+
height: var(--button-icon-size);
|
|
353
380
|
}
|
|
354
381
|
`;
|
|
355
382
|
//#endregion
|
|
@@ -440,7 +467,7 @@ var button_styles_default = css`
|
|
|
440
467
|
* </sigvelo-button>
|
|
441
468
|
* ```
|
|
442
469
|
*
|
|
443
|
-
* **Note:**
|
|
470
|
+
* **Note:** Link buttons support `disabled`; `loading`, toggle state, and form actions apply only to buttons.
|
|
444
471
|
*
|
|
445
472
|
* @example Changing the width
|
|
446
473
|
* To change a button's width, use the CSS `width` property.
|
|
@@ -637,16 +664,33 @@ var SigveloButton = class extends SigveloFormControlElement {
|
|
|
637
664
|
this.styles = [hostStyles, button_styles_default];
|
|
638
665
|
}
|
|
639
666
|
get focusableAnchor() {
|
|
640
|
-
return this.shadowRoot.querySelector("button");
|
|
667
|
+
return this.shadowRoot.querySelector("#button");
|
|
668
|
+
}
|
|
669
|
+
connectedCallback() {
|
|
670
|
+
super.connectedCallback();
|
|
671
|
+
this.syncLongPress();
|
|
672
|
+
}
|
|
673
|
+
disconnectedCallback() {
|
|
674
|
+
super.disconnectedCallback();
|
|
675
|
+
this.longPress?.stop();
|
|
641
676
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
this.
|
|
645
|
-
|
|
677
|
+
formDisabledCallback() {
|
|
678
|
+
super.formDisabledCallback();
|
|
679
|
+
this.syncLongPress();
|
|
680
|
+
}
|
|
681
|
+
syncLongPress() {
|
|
682
|
+
if (this.isConnected && !this.effectiveDisabled && !(this.loading && typeof this.href !== "string")) this.longPress?.start();
|
|
683
|
+
else this.longPress?.stop();
|
|
646
684
|
}
|
|
647
685
|
updated(changedProperties) {
|
|
648
|
-
if (changedProperties.has("
|
|
649
|
-
|
|
686
|
+
if (!this.longPress || changedProperties.has("href")) {
|
|
687
|
+
this.longPress?.stop();
|
|
688
|
+
this.longPress = new LongPress(this.focusableAnchor, { eventName: "sigvelo-long-press" });
|
|
689
|
+
}
|
|
690
|
+
this.syncLongPress();
|
|
691
|
+
if (changedProperties.has("disabled")) this.customStates.set("disabled", this.effectiveDisabled);
|
|
692
|
+
if (changedProperties.has("loading") || changedProperties.has("href")) this.customStates.set("loading", this.loading && typeof this.href !== "string");
|
|
693
|
+
if (changedProperties.has("toggle") || changedProperties.has("href") || changedProperties.has("type")) this.customStates.set("toggled", this.toggle === "on" && typeof this.href !== "string" && this.type !== "submit");
|
|
650
694
|
}
|
|
651
695
|
handleBlur() {
|
|
652
696
|
this.customStates.set("focused", false);
|
|
@@ -657,15 +701,13 @@ var SigveloButton = class extends SigveloFormControlElement {
|
|
|
657
701
|
this.dispatchEvent(new SigveloFocusEvent());
|
|
658
702
|
}
|
|
659
703
|
handleClick(event) {
|
|
660
|
-
if (this.
|
|
704
|
+
if (this.effectiveDisabled || typeof this.href !== "string" && this.loading) {
|
|
661
705
|
event.preventDefault();
|
|
662
706
|
event.stopImmediatePropagation();
|
|
663
707
|
return;
|
|
664
708
|
}
|
|
665
|
-
if (this.
|
|
666
|
-
|
|
667
|
-
this.customStates.set("toggled", this.toggle === "on");
|
|
668
|
-
}
|
|
709
|
+
if (typeof this.href === "string") return;
|
|
710
|
+
if (this.toggle !== void 0 && this.type !== "submit") this.toggle = this.toggle === "on" ? "off" : "on";
|
|
669
711
|
if (this.type === "reset" && this.internals.form) {
|
|
670
712
|
this.internals.form.reset();
|
|
671
713
|
return;
|
|
@@ -699,7 +741,7 @@ var SigveloButton = class extends SigveloFormControlElement {
|
|
|
699
741
|
}
|
|
700
742
|
render() {
|
|
701
743
|
const isLink = typeof this.href === "string";
|
|
702
|
-
const isDisabled = this.
|
|
744
|
+
const isDisabled = this.effectiveDisabled || !isLink && this.loading;
|
|
703
745
|
const isLoading = !isLink && this.loading;
|
|
704
746
|
const isSubmit = this.type === "submit";
|
|
705
747
|
const isToggle = this.toggle !== void 0 && !isLink && !isSubmit;
|
|
@@ -728,9 +770,11 @@ var SigveloButton = class extends SigveloFormControlElement {
|
|
|
728
770
|
loading: isLoading
|
|
729
771
|
})}
|
|
730
772
|
type=${ifDefined(isLink ? void 0 : this.type)}
|
|
731
|
-
?disabled=${
|
|
773
|
+
?disabled=${!isLink && isDisabled}
|
|
774
|
+
aria-disabled=${ifDefined(isLink && isDisabled ? "true" : void 0)}
|
|
775
|
+
aria-busy=${ifDefined(isLoading ? "true" : void 0)}
|
|
732
776
|
value=${ifDefined(isLink ? void 0 : this.value)}
|
|
733
|
-
href=${ifDefined(isLink && !this.
|
|
777
|
+
href=${ifDefined(isLink && !this.effectiveDisabled ? this.href : void 0)}
|
|
734
778
|
target=${ifDefined(isLink ? this.target : void 0)}
|
|
735
779
|
download=${ifDefined(isLink ? this.download : void 0)}
|
|
736
780
|
rel=${ifDefined(isLink && this.rel ? this.rel : void 0)}
|
|
@@ -88,7 +88,7 @@ import { SigveloFormControlElement } from "@mcp-b/wc-support/base/sigvelo-elemen
|
|
|
88
88
|
* </sigvelo-button>
|
|
89
89
|
* ```
|
|
90
90
|
*
|
|
91
|
-
* **Note:**
|
|
91
|
+
* **Note:** Link buttons support `disabled`; `loading`, toggle state, and form actions apply only to buttons.
|
|
92
92
|
*
|
|
93
93
|
* @example Changing the width
|
|
94
94
|
* To change a button's width, use the CSS `width` property.
|
|
@@ -272,7 +272,7 @@ declare class SigveloButton extends SigveloFormControlElement {
|
|
|
272
272
|
static styles: CSSResultGroup;
|
|
273
273
|
protected internals: ElementInternals;
|
|
274
274
|
private longPress;
|
|
275
|
-
protected get focusableAnchor():
|
|
275
|
+
protected get focusableAnchor(): HTMLElement;
|
|
276
276
|
/** Determines the button's variant. */
|
|
277
277
|
variant: "normal" | "surface" | "outline" | "ghost" | "link";
|
|
278
278
|
/** The semantic color intent of the button. */
|
|
@@ -338,7 +338,10 @@ declare class SigveloButton extends SigveloFormControlElement {
|
|
|
338
338
|
* absorb the literals and offer no suggestions at all.
|
|
339
339
|
*/
|
|
340
340
|
formTarget: "_self" | "_blank" | "_parent" | "_top" | (string & {}) | undefined;
|
|
341
|
-
|
|
341
|
+
connectedCallback(): void;
|
|
342
|
+
disconnectedCallback(): void;
|
|
343
|
+
formDisabledCallback(): void;
|
|
344
|
+
private syncLongPress;
|
|
342
345
|
updated(changedProperties: PropertyValues<this>): void;
|
|
343
346
|
private handleBlur;
|
|
344
347
|
private handleFocus;
|
|
@@ -324,19 +324,13 @@ declare class SigveloCheckbox extends SigveloFormControlElement {
|
|
|
324
324
|
* Makes the checkbox required. Form submission will not be allowed until the checkbox is checked.
|
|
325
325
|
*/
|
|
326
326
|
required: boolean;
|
|
327
|
-
connectedCallback(): void;
|
|
328
|
-
disconnectedCallback(): void;
|
|
329
327
|
updated(changedProperties: PropertyValues<this>): void;
|
|
330
|
-
/** @internal Called when a containing fieldset is disabled. */
|
|
331
|
-
formDisabledCallback(isDisabled: boolean): void;
|
|
332
328
|
/** @internal Called when the form is reset. */
|
|
333
329
|
formResetCallback(): void;
|
|
334
|
-
private handleClick;
|
|
335
330
|
private handleBlur;
|
|
336
331
|
private handleChange;
|
|
337
332
|
private handleInput;
|
|
338
333
|
private handleFocus;
|
|
339
|
-
private handleHostInvalid;
|
|
340
334
|
/** Sets the form control's validity */
|
|
341
335
|
private updateValidity;
|
|
342
336
|
/** Sets focus to the checkbox. */
|