@rettangoli/ui 1.0.24 → 1.1.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/dist/rettangoli-iife-layout.min.js +14 -5
- package/dist/rettangoli-iife-ui.min.js +40 -31
- package/package.json +1 -1
- package/src/components/dropdownMenu/dropdownMenu.view.yaml +1 -1
- package/src/components/popoverInput/popoverInput.view.yaml +1 -1
- package/src/components/select/select.handlers.js +11 -4
- package/src/components/select/select.store.js +3 -0
- package/src/components/select/select.view.yaml +5 -3
- package/src/components/tooltip/tooltip.store.js +1 -1
- package/src/components/tooltip/tooltip.view.yaml +4 -3
- package/src/primitives/button.js +4 -0
- package/src/primitives/popover.js +10 -5
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ styles:
|
|
|
15
15
|
color: inherit
|
|
16
16
|
template:
|
|
17
17
|
- rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place}:
|
|
18
|
-
- rtgl-view w=${w} h=${h} sv g=xs slot=content bgc=
|
|
18
|
+
- rtgl-view w=${w} h=${h} sv g=xs slot=content bgc=bg pv=sm:
|
|
19
19
|
- $for item, i in items:
|
|
20
20
|
- $if item.isLabel:
|
|
21
21
|
- rtgl-view w=f ph=lg pv=md:
|
|
@@ -21,7 +21,7 @@ template:
|
|
|
21
21
|
- rtgl-view#textDisplay w=f cur=pointer:
|
|
22
22
|
- rtgl-text c=${valueColor}: ${value}
|
|
23
23
|
- rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y}:
|
|
24
|
-
- rtgl-view g=md w=240 slot=content bgc=
|
|
24
|
+
- rtgl-view g=md w=240 slot=content bgc=bg br=md:
|
|
25
25
|
- rtgl-text: ${label}
|
|
26
26
|
- rtgl-input#input w=f placeholder=${placeholder} ?disabled=${disabled}: null
|
|
27
27
|
- rtgl-view w=f ah=e:
|
|
@@ -41,10 +41,7 @@ export const handleButtonClick = (deps, payload) => {
|
|
|
41
41
|
event.stopPropagation();
|
|
42
42
|
|
|
43
43
|
const button = refs.selectButton;
|
|
44
|
-
|
|
45
|
-
// Get first child's bounding rectangle (since button has display: contents)
|
|
46
|
-
const firstChild = button.firstElementChild;
|
|
47
|
-
const rect = firstChild ? firstChild.getBoundingClientRect() : button.getBoundingClientRect();
|
|
44
|
+
const rect = button.getBoundingClientRect();
|
|
48
45
|
|
|
49
46
|
// Find the index of the currently selected option
|
|
50
47
|
const storeSelectedValue = store.selectSelectedValue();
|
|
@@ -65,6 +62,16 @@ export const handleButtonClick = (deps, payload) => {
|
|
|
65
62
|
render();
|
|
66
63
|
}
|
|
67
64
|
|
|
65
|
+
export const handleButtonKeyDown = (deps, payload) => {
|
|
66
|
+
const event = payload._event;
|
|
67
|
+
if (event.key !== "Enter" && event.key !== " ") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
handleButtonClick(deps, payload);
|
|
73
|
+
}
|
|
74
|
+
|
|
68
75
|
export const handleClickOptionsPopoverOverlay = (deps) => {
|
|
69
76
|
const { store, render } = deps;
|
|
70
77
|
store.closeOptionsPopover({});
|
|
@@ -75,6 +75,9 @@ export const selectViewData = ({ state, props }) => {
|
|
|
75
75
|
selectedValue: currentValue,
|
|
76
76
|
selectedLabel: displayLabel,
|
|
77
77
|
selectedLabelColor: isPlaceholderLabel ? "mu-fg" : "fg",
|
|
78
|
+
selectButtonCursor: isDisabled ? "not-allowed" : "pointer",
|
|
79
|
+
selectButtonHoverBorderColor: isDisabled ? "bo" : "ac",
|
|
80
|
+
selectButtonTabIndex: isDisabled ? -1 : 0,
|
|
78
81
|
hasValue: currentValue !== null && currentValue !== undefined,
|
|
79
82
|
showClear: !isDisabled && !props.noClear && (currentValue !== null && currentValue !== undefined),
|
|
80
83
|
showAddOption: !isDisabled && !!props.addOption,
|
|
@@ -3,6 +3,8 @@ refs:
|
|
|
3
3
|
eventListeners:
|
|
4
4
|
click:
|
|
5
5
|
handler: handleButtonClick
|
|
6
|
+
keydown:
|
|
7
|
+
handler: handleButtonKeyDown
|
|
6
8
|
clearButton:
|
|
7
9
|
eventListeners:
|
|
8
10
|
click:
|
|
@@ -28,14 +30,14 @@ refs:
|
|
|
28
30
|
mouseleave:
|
|
29
31
|
handler: handleAddOptionMouseLeave
|
|
30
32
|
template:
|
|
31
|
-
- rtgl-
|
|
33
|
+
- 'rtgl-view#selectButton style="display: inline-flex;" d=h av=c h=32 ph=md bw=xs bc=bo h-bc=${selectButtonHoverBorderColor} br=md bgc=bg cur=${selectButtonCursor} ${containerAttrString} data-testid="select-button" role="button" tabindex=${selectButtonTabIndex} aria-disabled=${isDisabled}':
|
|
32
34
|
- rtgl-view d=h av=c ah=s w=f:
|
|
33
35
|
- rtgl-text w=1fg ta=s c=${selectedLabelColor} ellipsis: ${selectedLabel}
|
|
34
36
|
- $if showClear:
|
|
35
37
|
- rtgl-svg#clearButton ml=md svg=x wh=16 c=mu-fg cur=pointer data-testid="select-clear-button": null
|
|
36
38
|
- rtgl-svg ml=md svg=chevronDown wh=16 c=mu-fg: null
|
|
37
|
-
-
|
|
38
|
-
- rtgl-view wh=300 g=xs slot=content bgc=
|
|
39
|
+
- rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y} place=rs:
|
|
40
|
+
- rtgl-view wh=300 g=xs slot=content bgc=bg sv=true pv=sm:
|
|
39
41
|
- $for option, i in options:
|
|
40
42
|
- rtgl-view#option${i} w=f ph=lg pv=md cur=pointer bgc=${option.bgc} data-testid=${option.testId}:
|
|
41
43
|
- rtgl-text s=sm: ${option.label}
|
|
@@ -35,6 +35,6 @@ export const selectViewData = ({ props }) => {
|
|
|
35
35
|
textSize: preset.textSize,
|
|
36
36
|
paddingX: preset.paddingX,
|
|
37
37
|
paddingY: preset.paddingY,
|
|
38
|
-
|
|
38
|
+
contentStyle: `padding: 0; min-width: 0; max-width: ${preset.maxWidth};`,
|
|
39
39
|
};
|
|
40
40
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
template:
|
|
2
|
-
-
|
|
3
|
-
- rtgl-view slot=content
|
|
4
|
-
- rtgl-
|
|
2
|
+
- rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place} no-overlay:
|
|
3
|
+
- 'rtgl-view slot=content style="${contentStyle}"':
|
|
4
|
+
- rtgl-view ph=${paddingX} pv=${paddingY} ah=s av=c:
|
|
5
|
+
- rtgl-text ta=s s=${textSize} c=fg: ${content}
|
|
5
6
|
refs: {}
|
package/src/primitives/button.js
CHANGED
|
@@ -148,6 +148,10 @@ class RettangoliButtonElement extends HTMLElement {
|
|
|
148
148
|
background-color: var(--accent);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
:host([v="ol"]) .surface:active {
|
|
152
|
+
background-color: var(--accent);
|
|
153
|
+
}
|
|
154
|
+
|
|
151
155
|
:host([v="gh"]) .surface:hover {
|
|
152
156
|
background-color: var(--accent);
|
|
153
157
|
}
|
|
@@ -53,13 +53,18 @@ class RettangoliPopoverElement extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
slot[name="content"] {
|
|
56
|
+
display: contents;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
::slotted([slot="content"]) {
|
|
56
60
|
display: block;
|
|
57
|
-
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
background-color: var(--background);
|
|
58
63
|
border: 1px solid var(--border);
|
|
59
|
-
border-radius: var(--
|
|
60
|
-
padding: var(--
|
|
61
|
-
min-width:
|
|
62
|
-
max-width:
|
|
64
|
+
border-radius: var(--border-radius-md);
|
|
65
|
+
padding: var(--spacing-md);
|
|
66
|
+
min-width: 200px;
|
|
67
|
+
max-width: 400px;
|
|
63
68
|
}
|
|
64
69
|
`);
|
|
65
70
|
}
|