@mcp-b/web-components 0.2.21 → 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.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 +23 -23
- 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/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 +24 -26
- 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
|
@@ -4003,8 +4003,9 @@ to a custom function to determine if the provided query matches the element's co
|
|
|
4003
4003
|
results?: SigveloSearchList["results"];
|
|
4004
4004
|
/** */
|
|
4005
4005
|
query?: SigveloSearchList["query"];
|
|
4006
|
-
/**
|
|
4007
|
-
|
|
4006
|
+
/** Whether any slotted item survived the current filter. Not the `empty` state — that one also needs a query.
|
|
4007
|
+
Public like its siblings because Lit keys `changedProperties` on `keyof this`, which excludes private members. */
|
|
4008
|
+
hasVisibleItems?: SigveloSearchList["hasVisibleItems"];
|
|
4008
4009
|
/** */
|
|
4009
4010
|
isInitial?: SigveloSearchList["isInitial"];
|
|
4010
4011
|
/** */
|
|
@@ -4031,8 +4032,9 @@ to a custom function to determine if the provided query matches the element's co
|
|
|
4031
4032
|
"prop:results"?: SigveloSearchList["results"];
|
|
4032
4033
|
/** */
|
|
4033
4034
|
"prop:query"?: SigveloSearchList["query"];
|
|
4034
|
-
/**
|
|
4035
|
-
|
|
4035
|
+
/** Whether any slotted item survived the current filter. Not the `empty` state — that one also needs a query.
|
|
4036
|
+
Public like its siblings because Lit keys `changedProperties` on `keyof this`, which excludes private members. */
|
|
4037
|
+
"prop:hasVisibleItems"?: SigveloSearchList["hasVisibleItems"];
|
|
4036
4038
|
/** */
|
|
4037
4039
|
"prop:isInitial"?: SigveloSearchList["isInitial"];
|
|
4038
4040
|
/** */
|
|
@@ -5647,6 +5649,12 @@ export type CustomElements = {
|
|
|
5647
5649
|
* - `start`: An icon or similar element to place before the label. Works great with `<sigvelo-icon>`.
|
|
5648
5650
|
* - `end`: An icon or similar element to place after the label. Works great with `<sigvelo-icon>`.
|
|
5649
5651
|
*
|
|
5652
|
+
* ## Methods
|
|
5653
|
+
*
|
|
5654
|
+
* Methods that can be called to access component functionality.
|
|
5655
|
+
*
|
|
5656
|
+
* - `formDisabledCallback() => void`: undefined
|
|
5657
|
+
*
|
|
5650
5658
|
* ## CSS Parts
|
|
5651
5659
|
*
|
|
5652
5660
|
* Custom selectors for styling elements within the component.
|
|
@@ -6125,6 +6133,7 @@ export type CustomElements = {
|
|
|
6125
6133
|
*
|
|
6126
6134
|
* Methods that can be called to access component functionality.
|
|
6127
6135
|
*
|
|
6136
|
+
* - `formDisabledCallback() => void`: undefined
|
|
6128
6137
|
* - `focus() => void`: Sets focus to the slider.
|
|
6129
6138
|
* - `blur() => void`: Removes focus from the slider.
|
|
6130
6139
|
* - `stepDown() => void`: Decreases the slider's value by `step`. This is a programmatic change, so `input` and `change` events will not be
|
|
@@ -6571,7 +6580,6 @@ export type CustomElements = {
|
|
|
6571
6580
|
*
|
|
6572
6581
|
* Methods that can be called to access component functionality.
|
|
6573
6582
|
*
|
|
6574
|
-
* - `formDisabledCallback(disabled: boolean) => void`: undefined
|
|
6575
6583
|
* - `formResetCallback() => void`: undefined
|
|
6576
6584
|
* - `getTagContent(item: SigveloComboboxItem) => TemplateResult`: A custom function for rendering tag content. By default, this function returns the item's full `textContent`. You
|
|
6577
6585
|
* can override it to customize the content that gets rendered in tags in `multiple` mode.
|
|
@@ -7345,7 +7353,6 @@ export type CustomElements = {
|
|
|
7345
7353
|
*
|
|
7346
7354
|
* Methods that can be called to access component functionality.
|
|
7347
7355
|
*
|
|
7348
|
-
* - `formDisabledCallback(isDisabled: boolean) => void`: undefined
|
|
7349
7356
|
* - `formResetCallback() => void`: undefined
|
|
7350
7357
|
* - `getSelectedValues() => void`: Returns an array of all selected values.
|
|
7351
7358
|
* - `setSelectedValues(values: string|string[]) => void`: Sets the selected items by value(s) without triggering events.
|
|
@@ -8101,6 +8108,7 @@ export type CustomElements = {
|
|
|
8101
8108
|
*
|
|
8102
8109
|
* Methods that can be called to access component functionality.
|
|
8103
8110
|
*
|
|
8111
|
+
* - `formDisabledCallback() => void`: undefined
|
|
8104
8112
|
* - `focus() => void`: Sets focus to the rating.
|
|
8105
8113
|
* - `blur() => void`: Removes focus from the rating.
|
|
8106
8114
|
* - `stepDown() => void`: Decreases the rating's value by `step`. This is a programmatic change, so `input` and `change` events will not be
|
|
@@ -8246,7 +8254,8 @@ export type CustomElements = {
|
|
|
8246
8254
|
* - `debounce`: The time in milliseconds to use for debouncing the search results while the user types.
|
|
8247
8255
|
* - `results`: undefined (property only)
|
|
8248
8256
|
* - `query`: undefined (property only)
|
|
8249
|
-
* - `
|
|
8257
|
+
* - `hasVisibleItems`: Whether any slotted item survived the current filter. Not the `empty` state — that one also needs a query.
|
|
8258
|
+
* Public like its siblings because Lit keys `changedProperties` on `keyof this`, which excludes private members. (property only)
|
|
8250
8259
|
* - `isInitial`: undefined (property only)
|
|
8251
8260
|
* - `resultsMessage`: undefined (property only)
|
|
8252
8261
|
* - `isMatch`: A custom search function you can provide to change the search behavior. The function is applied to each item when
|
|
@@ -9726,6 +9735,12 @@ export type CustomElementsSolidJs = {
|
|
|
9726
9735
|
* - `start`: An icon or similar element to place before the label. Works great with `<sigvelo-icon>`.
|
|
9727
9736
|
* - `end`: An icon or similar element to place after the label. Works great with `<sigvelo-icon>`.
|
|
9728
9737
|
*
|
|
9738
|
+
* ## Methods
|
|
9739
|
+
*
|
|
9740
|
+
* Methods that can be called to access component functionality.
|
|
9741
|
+
*
|
|
9742
|
+
* - `formDisabledCallback() => void`: undefined
|
|
9743
|
+
*
|
|
9729
9744
|
* ## CSS Parts
|
|
9730
9745
|
*
|
|
9731
9746
|
* Custom selectors for styling elements within the component.
|
|
@@ -10234,6 +10249,7 @@ export type CustomElementsSolidJs = {
|
|
|
10234
10249
|
*
|
|
10235
10250
|
* Methods that can be called to access component functionality.
|
|
10236
10251
|
*
|
|
10252
|
+
* - `formDisabledCallback() => void`: undefined
|
|
10237
10253
|
* - `focus() => void`: Sets focus to the slider.
|
|
10238
10254
|
* - `blur() => void`: Removes focus from the slider.
|
|
10239
10255
|
* - `stepDown() => void`: Decreases the slider's value by `step`. This is a programmatic change, so `input` and `change` events will not be
|
|
@@ -10695,7 +10711,6 @@ export type CustomElementsSolidJs = {
|
|
|
10695
10711
|
*
|
|
10696
10712
|
* Methods that can be called to access component functionality.
|
|
10697
10713
|
*
|
|
10698
|
-
* - `formDisabledCallback(disabled: boolean) => void`: undefined
|
|
10699
10714
|
* - `formResetCallback() => void`: undefined
|
|
10700
10715
|
* - `getTagContent(item: SigveloComboboxItem) => TemplateResult`: A custom function for rendering tag content. By default, this function returns the item's full `textContent`. You
|
|
10701
10716
|
* can override it to customize the content that gets rendered in tags in `multiple` mode.
|
|
@@ -11519,7 +11534,6 @@ export type CustomElementsSolidJs = {
|
|
|
11519
11534
|
*
|
|
11520
11535
|
* Methods that can be called to access component functionality.
|
|
11521
11536
|
*
|
|
11522
|
-
* - `formDisabledCallback(isDisabled: boolean) => void`: undefined
|
|
11523
11537
|
* - `formResetCallback() => void`: undefined
|
|
11524
11538
|
* - `getSelectedValues() => void`: Returns an array of all selected values.
|
|
11525
11539
|
* - `setSelectedValues(values: string|string[]) => void`: Sets the selected items by value(s) without triggering events.
|
|
@@ -12321,6 +12335,7 @@ export type CustomElementsSolidJs = {
|
|
|
12321
12335
|
*
|
|
12322
12336
|
* Methods that can be called to access component functionality.
|
|
12323
12337
|
*
|
|
12338
|
+
* - `formDisabledCallback() => void`: undefined
|
|
12324
12339
|
* - `focus() => void`: Sets focus to the rating.
|
|
12325
12340
|
* - `blur() => void`: Removes focus from the rating.
|
|
12326
12341
|
* - `stepDown() => void`: Decreases the rating's value by `step`. This is a programmatic change, so `input` and `change` events will not be
|
|
@@ -12478,7 +12493,8 @@ export type CustomElementsSolidJs = {
|
|
|
12478
12493
|
* - `debounce`: The time in milliseconds to use for debouncing the search results while the user types.
|
|
12479
12494
|
* - `results`: undefined (property only)
|
|
12480
12495
|
* - `query`: undefined (property only)
|
|
12481
|
-
* - `
|
|
12496
|
+
* - `hasVisibleItems`: Whether any slotted item survived the current filter. Not the `empty` state — that one also needs a query.
|
|
12497
|
+
* Public like its siblings because Lit keys `changedProperties` on `keyof this`, which excludes private members. (property only)
|
|
12482
12498
|
* - `isInitial`: undefined (property only)
|
|
12483
12499
|
* - `resultsMessage`: undefined (property only)
|
|
12484
12500
|
* - `isMatch`: A custom search function you can provide to change the search behavior. The function is applied to each item when
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Placement } from "@floating-ui/dom";
|
|
2
|
+
|
|
3
|
+
//#region src/utilities/anchored-surface.d.ts
|
|
4
|
+
interface AnchoredSurface {
|
|
5
|
+
/** The element the surface is positioned against. */
|
|
6
|
+
anchor: Element;
|
|
7
|
+
/** The element that carries the surface's own `data-placement` attribute, usually the component host. */
|
|
8
|
+
host: Element;
|
|
9
|
+
/** The floating element to position. */
|
|
10
|
+
surface: HTMLElement;
|
|
11
|
+
/** The arrow rendered inside the surface. */
|
|
12
|
+
arrow: HTMLElement;
|
|
13
|
+
/** The preferred placement. The surface shifts away from it when there isn't room. */
|
|
14
|
+
placement: Placement;
|
|
15
|
+
/** The distance of the surface from its anchor. */
|
|
16
|
+
distance: number;
|
|
17
|
+
/** The offset of the surface along its anchor. */
|
|
18
|
+
offset: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Positions a floating surface and its arrow against an anchor, then records the placement it settled on as
|
|
22
|
+
* `data-placement` on the host — which is both the hook consumers style against and what the transform-origin styles
|
|
23
|
+
* key on. Every arrow-bearing surface positions itself this way; the middleware stack and the arrow's static side are
|
|
24
|
+
* decided here rather than in each component.
|
|
25
|
+
*/
|
|
26
|
+
declare function positionAnchoredSurface({
|
|
27
|
+
anchor,
|
|
28
|
+
host,
|
|
29
|
+
surface,
|
|
30
|
+
arrow,
|
|
31
|
+
placement,
|
|
32
|
+
distance,
|
|
33
|
+
offset: offsetAlongAnchor
|
|
34
|
+
}: AnchoredSurface): Promise<void>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { AnchoredSurface, positionAnchoredSurface };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { arrow, computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
2
|
+
//#region src/utilities/anchored-surface.ts
|
|
3
|
+
/** The side of the surface its arrow sits on, keyed by the side the surface resolved to. */
|
|
4
|
+
const ARROW_SIDES = {
|
|
5
|
+
top: "bottom",
|
|
6
|
+
right: "left",
|
|
7
|
+
bottom: "top",
|
|
8
|
+
left: "right"
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Positions a floating surface and its arrow against an anchor, then records the placement it settled on as
|
|
12
|
+
* `data-placement` on the host — which is both the hook consumers style against and what the transform-origin styles
|
|
13
|
+
* key on. Every arrow-bearing surface positions itself this way; the middleware stack and the arrow's static side are
|
|
14
|
+
* decided here rather than in each component.
|
|
15
|
+
*/
|
|
16
|
+
function positionAnchoredSurface({ anchor, host, surface, arrow: arrow$1, placement, distance, offset: offsetAlongAnchor }) {
|
|
17
|
+
return computePosition(anchor, surface, {
|
|
18
|
+
placement,
|
|
19
|
+
middleware: [
|
|
20
|
+
offset({
|
|
21
|
+
mainAxis: distance,
|
|
22
|
+
crossAxis: offsetAlongAnchor
|
|
23
|
+
}),
|
|
24
|
+
flip(),
|
|
25
|
+
shift(),
|
|
26
|
+
arrow({ element: arrow$1 })
|
|
27
|
+
]
|
|
28
|
+
}).then(({ x, y, middlewareData, placement: resolvedPlacement }) => {
|
|
29
|
+
host.setAttribute("data-placement", resolvedPlacement);
|
|
30
|
+
Object.assign(surface.style, {
|
|
31
|
+
left: `${x}px`,
|
|
32
|
+
top: `${y}px`
|
|
33
|
+
});
|
|
34
|
+
if (middlewareData.arrow) {
|
|
35
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
36
|
+
const staticSide = ARROW_SIDES[resolvedPlacement.split("-")[0]];
|
|
37
|
+
Object.assign(arrow$1.style, {
|
|
38
|
+
left: typeof arrowX === "number" ? `${arrowX}px` : "",
|
|
39
|
+
top: typeof arrowY === "number" ? `${arrowY}px` : "",
|
|
40
|
+
[staticSide]: "calc(var(--arrow-diagonal-size) * -1)"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { positionAnchoredSurface };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utilities/copy-feedback.d.ts
|
|
2
|
+
/** Where the transient feedback appears, or `hidden` to suppress it entirely. */
|
|
3
|
+
type CopyFeedbackPlacement = "top" | "right" | "bottom" | "left" | "hidden";
|
|
4
|
+
/**
|
|
5
|
+
* Flashes the transient "Copied" / "Error" message that `<sigvelo-copy>` and `<sigvelo-share>` show after writing to
|
|
6
|
+
* the clipboard. Both elements render the same feedback chrome from `copy.styles.ts`, so they announce it the same
|
|
7
|
+
* way: position it against the host, animate it in, then take it back out of the top layer.
|
|
8
|
+
*
|
|
9
|
+
* @param host The element the feedback is positioned against.
|
|
10
|
+
* @param feedback The feedback element inside the host's shadow root.
|
|
11
|
+
* @param message The text to announce.
|
|
12
|
+
* @param placement Where to place the feedback relative to the host.
|
|
13
|
+
*/
|
|
14
|
+
declare function showCopyFeedback(host: Element, feedback: HTMLElement, message: string, placement: CopyFeedbackPlacement): Promise<void>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { CopyFeedbackPlacement, showCopyFeedback };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { animateWithClass } from "@mcp-b/wc-support/utilities/animate";
|
|
2
|
+
import { computePosition, flip } from "@floating-ui/dom";
|
|
3
|
+
//#region src/utilities/copy-feedback.ts
|
|
4
|
+
/**
|
|
5
|
+
* Flashes the transient "Copied" / "Error" message that `<sigvelo-copy>` and `<sigvelo-share>` show after writing to
|
|
6
|
+
* the clipboard. Both elements render the same feedback chrome from `copy.styles.ts`, so they announce it the same
|
|
7
|
+
* way: position it against the host, animate it in, then take it back out of the top layer.
|
|
8
|
+
*
|
|
9
|
+
* @param host The element the feedback is positioned against.
|
|
10
|
+
* @param feedback The feedback element inside the host's shadow root.
|
|
11
|
+
* @param message The text to announce.
|
|
12
|
+
* @param placement Where to place the feedback relative to the host.
|
|
13
|
+
*/
|
|
14
|
+
async function showCopyFeedback(host, feedback, message, placement) {
|
|
15
|
+
if (placement === "hidden") return;
|
|
16
|
+
feedback.textContent = message;
|
|
17
|
+
feedback.hidden = false;
|
|
18
|
+
feedback.showPopover();
|
|
19
|
+
computePosition(host, feedback, {
|
|
20
|
+
placement,
|
|
21
|
+
middleware: [flip()]
|
|
22
|
+
}).then(({ x, y }) => {
|
|
23
|
+
Object.assign(feedback.style, {
|
|
24
|
+
left: `${x}px`,
|
|
25
|
+
top: `${y}px`
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
await animateWithClass(feedback, "show");
|
|
29
|
+
feedback.hidden = true;
|
|
30
|
+
feedback.hidePopover();
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { showCopyFeedback };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/utilities/form-validity.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Form controls that wrap a native input, textarea, or select mirror that control's validity onto the host through
|
|
4
|
+
* `ElementInternals`. Which flags are mirrored, and how a custom validity message overrides the native one, is one
|
|
5
|
+
* rule — it lives here rather than being restated in every wrapping component.
|
|
6
|
+
*/
|
|
7
|
+
interface MirroredValidity {
|
|
8
|
+
/** The flags to hand to `ElementInternals.setValidity()`. */
|
|
9
|
+
flags: ValidityStateFlags;
|
|
10
|
+
/** The message to report: the custom one when set, otherwise the native control's own message. */
|
|
11
|
+
validationMessage: string;
|
|
12
|
+
/** Whether the host should consider itself invalid. */
|
|
13
|
+
isInvalid: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Mirrors a native form control's validity, letting a non-empty custom validity message win over it.
|
|
17
|
+
*
|
|
18
|
+
* Every flag is passed on every call, whatever constraints the wrapped control actually supports. A checkbox only
|
|
19
|
+
* validates `required`, so its other flags are always false — and `ElementInternals.setValidity()` clears any flag left
|
|
20
|
+
* out of the object anyway, which makes the short form and the full form equivalent. Passing them all keeps one rule
|
|
21
|
+
* here instead of a per-control opinion about which flags are worth naming.
|
|
22
|
+
*
|
|
23
|
+
* @param control The native control rendered inside the component's shadow root.
|
|
24
|
+
* @param customValidity The component's current custom validity message, or an empty string when none is set.
|
|
25
|
+
*/
|
|
26
|
+
declare function mirrorNativeValidity(control: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement, customValidity: string): MirroredValidity;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { MirroredValidity, mirrorNativeValidity };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/utilities/form-validity.ts
|
|
2
|
+
/**
|
|
3
|
+
* Mirrors a native form control's validity, letting a non-empty custom validity message win over it.
|
|
4
|
+
*
|
|
5
|
+
* Every flag is passed on every call, whatever constraints the wrapped control actually supports. A checkbox only
|
|
6
|
+
* validates `required`, so its other flags are always false — and `ElementInternals.setValidity()` clears any flag left
|
|
7
|
+
* out of the object anyway, which makes the short form and the full form equivalent. Passing them all keeps one rule
|
|
8
|
+
* here instead of a per-control opinion about which flags are worth naming.
|
|
9
|
+
*
|
|
10
|
+
* @param control The native control rendered inside the component's shadow root.
|
|
11
|
+
* @param customValidity The component's current custom validity message, or an empty string when none is set.
|
|
12
|
+
*/
|
|
13
|
+
function mirrorNativeValidity(control, customValidity) {
|
|
14
|
+
const hasCustomValidity = customValidity.length > 0;
|
|
15
|
+
return {
|
|
16
|
+
flags: {
|
|
17
|
+
badInput: control.validity.badInput,
|
|
18
|
+
customError: hasCustomValidity,
|
|
19
|
+
patternMismatch: control.validity.patternMismatch,
|
|
20
|
+
rangeOverflow: control.validity.rangeOverflow,
|
|
21
|
+
rangeUnderflow: control.validity.rangeUnderflow,
|
|
22
|
+
stepMismatch: control.validity.stepMismatch,
|
|
23
|
+
tooLong: control.validity.tooLong,
|
|
24
|
+
tooShort: control.validity.tooShort,
|
|
25
|
+
typeMismatch: control.validity.typeMismatch,
|
|
26
|
+
valueMissing: control.validity.valueMissing
|
|
27
|
+
},
|
|
28
|
+
validationMessage: hasCustomValidity ? customValidity : control.validationMessage,
|
|
29
|
+
isInvalid: hasCustomValidity ? true : !control.validity.valid
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { mirrorNativeValidity };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as Translation, c as update, i as LocalizeController, n as BaseTranslation, o as registerDefaultTranslation, r as Localize, s as registerTranslation } from "../en-ss05iPjS.js";
|
|
2
2
|
export { type BaseTranslation, Localize, LocalizeController, Translation, registerDefaultTranslation, registerTranslation, update };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../translations/en.js";
|
|
1
2
|
import { LocalizeController, LocalizeController as LocalizeController$1, registerDefaultTranslation, registerTranslation, update } from "@mcp-b/wc-support";
|
|
2
3
|
//#region src/utilities/localize.ts
|
|
3
4
|
/** `LocalizeController` pre-typed with the Sigvelo component library translations. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/web-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Sigvelo SaaS web components built with Lit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"custom-elements",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"./components/*": "./dist/components/*",
|
|
29
29
|
"./utilities/*": "./dist/utilities/*",
|
|
30
|
+
"./translations/*": "./dist/translations/*",
|
|
30
31
|
"./themes/*": "./dist/themes/*",
|
|
31
32
|
"./custom-elements.json": "./dist/docs/custom-elements.json"
|
|
32
33
|
},
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
"@floating-ui/dom": "^1.8.0",
|
|
39
40
|
"lit": "^3.3.3",
|
|
40
41
|
"lit-html": "^3.3.3",
|
|
41
|
-
"@mcp-b/wc-support": "0.
|
|
42
|
+
"@mcp-b/wc-support": "0.3.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@axe-core/playwright": "^4.12.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import "./icon-Df0H7LYB.js";
|
|
3
2
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
+
import { Localize } from "./utilities/localize.js";
|
|
4
4
|
import "./carousel-item-B5-X31Ha.js";
|
|
5
5
|
import { css, html } from "lit";
|
|
6
6
|
import { eventOptions, property, query, state } from "lit/decorators.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { Localize } from "./utilities/localize.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,5 +1,5 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { Localize } from "./utilities/localize.js";
|
|
3
3
|
import { css, html, nothing } from "lit";
|
|
4
4
|
import { property, query } from "lit/decorators.js";
|
|
5
5
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { Localize } from "./utilities/localize.js";
|
|
3
3
|
import { css, html } from "lit";
|
|
4
4
|
import { eventOptions, property, query } from "lit/decorators.js";
|
|
5
5
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { Localize } from "./utilities/localize.js";
|
|
3
3
|
import { css } from "lit";
|
|
4
4
|
import { property } from "lit/decorators.js";
|
|
5
5
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { Localize } from "./utilities/localize.js";
|
|
3
3
|
import { css } 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
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import "./icon-Df0H7LYB.js";
|
|
3
2
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
+
import { Localize } from "./utilities/localize.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";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { Localize } from "./utilities/localize.js";
|
|
3
3
|
import { css, html } from "lit";
|
|
4
4
|
import { eventOptions, property, query, state } from "lit/decorators.js";
|
|
5
5
|
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { Localize } from "./utilities/localize.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
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import "./icon-Df0H7LYB.js";
|
|
3
2
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
+
import { Localize } from "./utilities/localize.js";
|
|
4
4
|
import "./progress-DzVk260j.js";
|
|
5
5
|
import { css, html } from "lit";
|
|
6
6
|
import { property, state } from "lit/decorators.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Localize } from "./utilities/localize.js";
|
|
2
1
|
import "./icon-Df0H7LYB.js";
|
|
3
2
|
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
3
|
+
import { Localize } from "./utilities/localize.js";
|
|
4
4
|
import { css, html } from "lit";
|
|
5
5
|
import { property, query } from "lit/decorators.js";
|
|
6
6
|
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|