@operato/input 8.0.0-alpha.20 → 8.0.0-alpha.21
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/CHANGELOG.md +9 -0
- package/dist/src/ox-select-floor.d.ts +2 -1
- package/dist/src/ox-select-floor.js +13 -7
- package/dist/src/ox-select-floor.js.map +1 -1
- package/dist/stories/ox-select-floor.stories.js +64 -40
- package/dist/stories/ox-select-floor.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ox-select-floor.ts +14 -7
- package/stories/ox-select-floor.stories.ts +64 -40
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@operato/input",
|
3
3
|
"description": "Webcomponents for input following open-wc recommendations",
|
4
4
|
"author": "heartyoh@hatiolab.com",
|
5
|
-
"version": "8.0.0-alpha.
|
5
|
+
"version": "8.0.0-alpha.21",
|
6
6
|
"main": "dist/src/index.js",
|
7
7
|
"module": "dist/src/index.js",
|
8
8
|
"license": "MIT",
|
@@ -262,5 +262,5 @@
|
|
262
262
|
"prettier --write"
|
263
263
|
]
|
264
264
|
},
|
265
|
-
"gitHead": "
|
265
|
+
"gitHead": "2a7eabbdab4073648f5d8bd49c02f2e62b7d3a8a"
|
266
266
|
}
|
package/src/ox-select-floor.ts
CHANGED
@@ -57,14 +57,15 @@ export class OxSelectFloor extends OxFormField {
|
|
57
57
|
}
|
58
58
|
|
59
59
|
.selected {
|
60
|
-
z-index: 10;
|
61
60
|
opacity: 0.8;
|
61
|
+
z-index: 1;
|
62
62
|
border: 4px solid #3b82f6;
|
63
63
|
box-shadow: 0 8px 16px rgba(59, 130, 246, 0.4);
|
64
64
|
}
|
65
65
|
|
66
66
|
.selected.active {
|
67
67
|
opacity: 1;
|
68
|
+
z-index: 2;
|
68
69
|
transform: perspective(var(--ox-select-floor-perspective)) rotateX(var(--ox-select-floor-rotate-x-active));
|
69
70
|
box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
|
70
71
|
}
|
@@ -72,7 +73,7 @@ export class OxSelectFloor extends OxFormField {
|
|
72
73
|
[template-container] {
|
73
74
|
position: absolute;
|
74
75
|
right: 10px;
|
75
|
-
z-index:
|
76
|
+
z-index: 1;
|
76
77
|
}
|
77
78
|
`
|
78
79
|
]
|
@@ -88,6 +89,7 @@ export class OxSelectFloor extends OxFormField {
|
|
88
89
|
private isDragging = false
|
89
90
|
private lastTouchY = 0
|
90
91
|
private lastMouseY = 0
|
92
|
+
private startY = 0
|
91
93
|
|
92
94
|
render() {
|
93
95
|
const length = this.cards.length
|
@@ -162,15 +164,20 @@ export class OxSelectFloor extends OxFormField {
|
|
162
164
|
|
163
165
|
handleTouchStart(event: TouchEvent) {
|
164
166
|
this.lastTouchY = event.touches[0].clientY
|
167
|
+
this.startY = this.lastTouchY
|
165
168
|
}
|
166
169
|
|
167
170
|
handleTouchMove(event: TouchEvent) {
|
168
171
|
const touch = event.touches[0]
|
169
|
-
const deltaY = touch.clientY - this.
|
170
|
-
|
172
|
+
const deltaY = touch.clientY - this.lastMouseY
|
173
|
+
|
174
|
+
if (!this.lastMouseY) {
|
175
|
+
this.lastMouseY = touch.clientY
|
176
|
+
}
|
171
177
|
|
172
178
|
if (Math.abs(deltaY) > 30) {
|
173
|
-
|
179
|
+
this.lastMouseY = touch.clientY
|
180
|
+
const direction = deltaY > 0 ? -1 : 1
|
174
181
|
this.updateSelectedIndex(this.selectedIndex + direction)
|
175
182
|
}
|
176
183
|
}
|
@@ -234,11 +241,11 @@ export class OxSelectFloor extends OxFormField {
|
|
234
241
|
|
235
242
|
private selectCard(index: number) {
|
236
243
|
this.selectedIndex = index
|
237
|
-
this.
|
244
|
+
this.notifySelection()
|
238
245
|
this.scrollToSelectedCard()
|
239
246
|
}
|
240
247
|
|
241
|
-
private
|
248
|
+
private notifySelection() {
|
242
249
|
this.value = this.selectedIndex !== -1 ? this.cards[this.selectedIndex]?.name : undefined
|
243
250
|
|
244
251
|
this.dispatchEvent(
|
@@ -71,6 +71,23 @@ const Template: Story<ArgTypes> = ({
|
|
71
71
|
</style>
|
72
72
|
|
73
73
|
<style>
|
74
|
+
html,
|
75
|
+
body {
|
76
|
+
margin: 0;
|
77
|
+
padding: 0;
|
78
|
+
overflow: hidden;
|
79
|
+
|
80
|
+
overscroll-behavior-y: none;
|
81
|
+
|
82
|
+
/* This is a font-stack that tries to use the system-default sans-serifs first */
|
83
|
+
font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
84
|
+
line-height: 1.5;
|
85
|
+
-webkit-font-smoothing: antialiased;
|
86
|
+
|
87
|
+
accent-color: var(--md-sys-color-primary);
|
88
|
+
background-color: var(--md-sys-color-background);
|
89
|
+
}
|
90
|
+
|
74
91
|
.container {
|
75
92
|
height: 1000px;
|
76
93
|
text-align: center;
|
@@ -86,48 +103,55 @@ const Template: Story<ArgTypes> = ({
|
|
86
103
|
right: 0px;
|
87
104
|
bottom: 0px;
|
88
105
|
align-items: center;
|
89
|
-
z-index: 2;
|
90
106
|
right: 3%;
|
107
|
+
}
|
108
|
+
|
109
|
+
div[status] > div[content] {
|
110
|
+
display: flex;
|
111
|
+
background-color: #4e5055;
|
112
|
+
color: #fff;
|
113
|
+
padding: 5px 7px;
|
114
|
+
border-radius: 7px;
|
115
|
+
gap: 10px;
|
116
|
+
font-size: 14px;
|
117
|
+
}
|
118
|
+
|
119
|
+
div[status] span {
|
120
|
+
display: flex;
|
121
|
+
align-items: center;
|
122
|
+
width: 48px;
|
123
|
+
}
|
124
|
+
|
125
|
+
div[status] md-icon {
|
126
|
+
width: 20px;
|
127
|
+
height: 20px;
|
128
|
+
margin-right: 4px;
|
129
|
+
border-radius: 5px;
|
130
|
+
font-size: 21px;
|
131
|
+
font-weight: 700;
|
132
|
+
}
|
133
|
+
div[status] md-icon[request] {
|
134
|
+
background-color: #f7f7f7;
|
135
|
+
color: #4e5055;
|
136
|
+
}
|
137
|
+
div[status] md-icon[pass] {
|
138
|
+
background-color: #4bbb4a;
|
139
|
+
}
|
140
|
+
div[status] md-icon[fail] {
|
141
|
+
background-color: #ff4444;
|
142
|
+
}
|
143
|
+
|
144
|
+
span[name] {
|
145
|
+
width: 40px;
|
146
|
+
color: #4e5055;
|
147
|
+
margin-left: 6px;
|
148
|
+
text-align: center;
|
149
|
+
}
|
91
150
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
padding: 5px 7px;
|
97
|
-
border-radius: 7px;
|
98
|
-
gap: 10px;
|
99
|
-
font-size: 14px;
|
100
|
-
|
101
|
-
span {
|
102
|
-
display: flex;
|
103
|
-
align-items: center;
|
104
|
-
width: 48px;
|
105
|
-
|
106
|
-
md-icon {
|
107
|
-
width: 20px;
|
108
|
-
height: 20px;
|
109
|
-
margin-right: 4px;
|
110
|
-
border-radius: 5px;
|
111
|
-
font-size: 21px;
|
112
|
-
font-weight: 700;
|
113
|
-
}
|
114
|
-
md-icon[request] {
|
115
|
-
background-color: #f7f7f7;
|
116
|
-
color: #4e5055;
|
117
|
-
}
|
118
|
-
md-icon[pass] {
|
119
|
-
background-color: #4bbb4a;
|
120
|
-
}
|
121
|
-
md-icon[fail] {
|
122
|
-
background-color: #ff4444;
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
span[name] {
|
127
|
-
color: #4e5055;
|
128
|
-
margin-left: 6px;
|
129
|
-
width: 40px;
|
130
|
-
}
|
151
|
+
span[name][active] {
|
152
|
+
color: var(--md-sys-color-on-error);
|
153
|
+
background-color: var(--md-sys-color-error);
|
154
|
+
border-radius: 999px;
|
131
155
|
}
|
132
156
|
|
133
157
|
ox-select-floor {
|