@operato/input 8.0.0-alpha.33 → 8.0.0-alpha.34
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 +1 -0
- package/dist/src/ox-select-floor.js +9 -4
- package/dist/src/ox-select-floor.js.map +1 -1
- package/dist/stories/ox-select-floor.stories.d.ts +4 -0
- package/dist/stories/ox-select-floor.stories.js +6 -3
- 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 +6 -4
- package/stories/ox-select-floor.stories.ts +8 -3
- package/yarn-error.log +17084 -0
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.34",
|
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": "66c3958a36981146574502db824281fec708c6a8"
|
266
266
|
}
|
package/src/ox-select-floor.ts
CHANGED
@@ -24,7 +24,6 @@ export class OxSelectFloor extends OxFormField {
|
|
24
24
|
|
25
25
|
.carousel-container {
|
26
26
|
position: relative;
|
27
|
-
height: 100%;
|
28
27
|
width: 100%;
|
29
28
|
overflow: hidden;
|
30
29
|
user-select: none;
|
@@ -81,6 +80,7 @@ export class OxSelectFloor extends OxFormField {
|
|
81
80
|
@property({ type: Array }) cards: Card[] = []
|
82
81
|
@property({ type: String }) value?: string
|
83
82
|
@property({ type: Number }) bottomLimit = 70
|
83
|
+
@property({ type: Number }) interval = 0
|
84
84
|
|
85
85
|
@state() private selectedIndex = -1
|
86
86
|
@state() private activeIndex: number | null = null
|
@@ -92,21 +92,23 @@ export class OxSelectFloor extends OxFormField {
|
|
92
92
|
render() {
|
93
93
|
const length = this.cards.length
|
94
94
|
const cards = this.cards
|
95
|
+
const interval = this.interval
|
95
96
|
|
96
97
|
return html`
|
97
98
|
<div
|
98
99
|
class="carousel-container"
|
99
|
-
@wheel=${this.handleWheel}
|
100
|
+
@wheel=${interval ? () => {} : this.handleWheel}
|
100
101
|
@pointerdown=${this.handlePointerDown}
|
101
102
|
@pointermove=${this.handlePointerMove}
|
102
103
|
@pointerup=${this.handlePointerUp}
|
103
104
|
@pointerleave=${this.handlePointerLeave}
|
105
|
+
style=${interval ? `height: ${interval * length + 200}px;` : 'height: 100%;'}
|
104
106
|
>
|
105
107
|
${cards.map(({ image, name }, index) => {
|
106
108
|
return html`
|
107
109
|
<div
|
108
110
|
class="card ${this.getClassForCard(index)} ${this.isActive(index) ? 'active' : ''}"
|
109
|
-
style
|
111
|
+
style=${`bottom: ${interval ? interval * index + 'px' : (this.bottomLimit * index) / length + '%'};`}
|
110
112
|
@click=${() => {
|
111
113
|
this.selectCard(index)
|
112
114
|
this.toggleActiveCard(index)
|
@@ -119,7 +121,7 @@ export class OxSelectFloor extends OxFormField {
|
|
119
121
|
${cards.map(({ image, name }, index) => {
|
120
122
|
return html`
|
121
123
|
<div
|
122
|
-
style
|
124
|
+
style=${`bottom: ${interval ? interval * index + 'px' : (this.bottomLimit * index) / length + '%'};`}
|
123
125
|
@click=${() => this.selectCard(index)}
|
124
126
|
template-container
|
125
127
|
>
|
@@ -13,7 +13,8 @@ export default {
|
|
13
13
|
bottomLimit: { control: 'number' },
|
14
14
|
perspective: { control: 'number' },
|
15
15
|
rotateX: { control: 'number' },
|
16
|
-
rotateXForActive: { control: 'number' }
|
16
|
+
rotateXForActive: { control: 'number' },
|
17
|
+
interval: { control: 'number' }
|
17
18
|
}
|
18
19
|
}
|
19
20
|
|
@@ -30,6 +31,7 @@ interface ArgTypes {
|
|
30
31
|
rotateX?: number
|
31
32
|
rotateXForActive?: number
|
32
33
|
disabled?: boolean
|
34
|
+
interval?: number
|
33
35
|
}
|
34
36
|
|
35
37
|
const cards = new Array(10).fill({}).map((_, index) => {
|
@@ -45,7 +47,8 @@ const Template: Story<ArgTypes> = ({
|
|
45
47
|
bottomLimit = 70,
|
46
48
|
perspective = 1200,
|
47
49
|
rotateX = 60,
|
48
|
-
rotateXForActive = 40
|
50
|
+
rotateXForActive = 40,
|
51
|
+
interval = 0
|
49
52
|
}: ArgTypes) => html`
|
50
53
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
51
54
|
|
@@ -166,6 +169,7 @@ const Template: Story<ArgTypes> = ({
|
|
166
169
|
.cards=${cards}
|
167
170
|
.bottomLimit=${bottomLimit}
|
168
171
|
?disabled=${disabled}
|
172
|
+
.interval=${interval}
|
169
173
|
@change=${(e: Event) => console.log(((e as CustomEvent).target as any)!.value)}
|
170
174
|
>
|
171
175
|
${cards.map(
|
@@ -188,5 +192,6 @@ Regular.args = {
|
|
188
192
|
bottomLimit: 70,
|
189
193
|
perspective: 1200,
|
190
194
|
rotateX: 60,
|
191
|
-
rotateXForActive: 40
|
195
|
+
rotateXForActive: 40,
|
196
|
+
interval: 0
|
192
197
|
}
|