haya-select 1.0.38 → 1.0.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,4 @@
1
- import "./style"
2
1
  import {anythingDifferent} from "set-state-compare/src/diff-utils"
3
- import classNames from "classnames"
4
2
  import config from "../config.js"
5
3
  import {digg, digs} from "diggerize"
6
4
  import debounce from "debounce"
@@ -9,8 +7,10 @@ import nameForComponent from "@kaspernj/api-maker/src/inputs/name-for-component.
9
7
  import Option from "./option"
10
8
  import OptionGroup from "./option-group"
11
9
  import PropTypes from "prop-types"
10
+ import propTypesExact from "prop-types-exact"
12
11
  import {memo, useRef} from "react"
13
12
  import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component.js"
13
+ import {Platform, Pressable, Text, TextInput, View} from "react-native"
14
14
  import useEventListener from "@kaspernj/api-maker/src/use-event-listener"
15
15
 
16
16
  const nameForComponentWithMultiple = (component) => {
@@ -27,7 +27,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
27
27
  search: false
28
28
  }
29
29
 
30
- static propTypes = {
30
+ static propTypes = propTypesExact({
31
31
  attribute: PropTypes.string,
32
32
  className: PropTypes.string,
33
33
  defaultToggled: PropTypes.object,
@@ -37,11 +37,13 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
37
37
  id: PropTypes.node,
38
38
  model: PropTypes.object,
39
39
  multiple: PropTypes.bool.isRequired,
40
+ name: PropTypes.string,
40
41
  onChange: PropTypes.func,
41
42
  onOptionsClosed: PropTypes.func,
42
43
  options: PropTypes.oneOfType([PropTypes.array, PropTypes.func]).isRequired,
43
44
  placeholder: PropTypes.node,
44
45
  search: PropTypes.bool.isRequired,
46
+ selectContainerStyle: PropTypes.object,
45
47
  toggled: PropTypes.object,
46
48
  toggleOptions: PropTypes.arrayOf(PropTypes.shape({
47
49
  icon: PropTypes.string.isRequired,
@@ -49,7 +51,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
49
51
  value: PropTypes.string.isRequired
50
52
  })),
51
53
  values: PropTypes.array
52
- }
54
+ })
53
55
 
54
56
  p = fetchingObject(() => this.props)
55
57
  s = fetchingObject(() => this.state)
@@ -58,6 +60,14 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
58
60
  setup() {
59
61
  const {t} = useI18n({namespace: "haya_select"})
60
62
 
63
+ if (this.props.values) {
64
+ for (const value of this.props.values) {
65
+ if (typeof value == "undefined") {
66
+ throw new Error("HayaSelect: Undefined given as value")
67
+ }
68
+ }
69
+ }
70
+
61
71
  this.setInstance({
62
72
  endOfSelectRef: useRef(),
63
73
  optionsContainerRef: useRef(),
@@ -74,6 +84,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
74
84
  optionsTop: undefined,
75
85
  optionsVisibility: undefined,
76
86
  optionsWidth: undefined,
87
+ searchText: "",
77
88
  scrollLeft: undefined,
78
89
  scrollTop: undefined,
79
90
  toggled: () => this.defaultToggled()
@@ -112,10 +123,14 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
112
123
  getToggled = () => ("toggled" in this.props) ? this.p.toggled : this.s.toggled
113
124
  getValues = () => ("values" in this.props) ? this.p.values : this.s.currentOptions.map((currentOption) => currentOption.value)
114
125
  getCurrentOptions = () => {
115
- if ("values" in this.props) {
116
- if (this.s.loadedOptions) {
117
- return this.p.values.map((value) => this.s.loadedOptions.find((option) => option.value == value))
118
- } else if (this.props.options) {
126
+ if ("values" in this.props && typeof this.props.values != "undefined") {
127
+ if (this.s.loadedOptions || typeof this.props.options == "function" && this.props.values) {
128
+ if (this.s.loadedOptions) {
129
+ return this.p.values.map((value) => this.s.loadedOptions.find((option) => option.value == value))
130
+ } else {
131
+ this.setCurrentFromGivenValues()
132
+ }
133
+ } else if (Array.isArray(this.props.options)) {
119
134
  return this.p.values.map((value) => this.p.options.find((option) => option.value == value))
120
135
  } else {
121
136
  return this.p.values.map((value) => ({value}))
@@ -136,14 +151,6 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
136
151
  componentDidUpdate() {
137
152
  const newState = {}
138
153
 
139
- if ("values" in this.props) {
140
- const newCurrentOptions = this.defaultCurrentOptions()
141
-
142
- if (anythingDifferent(this.state.currentOptions, newCurrentOptions)) {
143
- newState.currentOptions = newCurrentOptions
144
- }
145
- }
146
-
147
154
  if ("toggled" in this.props) {
148
155
  const newToggled = this.p.toggled
149
156
 
@@ -158,7 +165,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
158
165
  }
159
166
 
160
167
  render() {
161
- const {currentSelectedRef, endOfSelectRef, onSelectClicked, onSearchTextInputChangedDebounced} = this.tt
168
+ const {currentSelectedRef, endOfSelectRef} = this.tt
162
169
  const {
163
170
  attribute,
164
171
  className,
@@ -174,6 +181,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
174
181
  options,
175
182
  placeholder,
176
183
  search,
184
+ selectContainerStyle,
177
185
  toggleOptions,
178
186
  ...restProps
179
187
  } = this.props
@@ -181,13 +189,49 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
181
189
  const currentOptions = this.getCurrentOptions()
182
190
  const BodyPortal = config.getBodyPortal()
183
191
 
192
+ const selectContainerStyleActual = Object.assign(
193
+ {
194
+ display: "flex",
195
+ flexDirection: "row",
196
+ alignItems: "center",
197
+ backgroundColor: "#fff",
198
+ border: "1px solid #999",
199
+ color: "#000",
200
+ cursor: "pointer",
201
+ paddingTop: 5,
202
+ paddingBottom: 5,
203
+ paddingLeft: 5
204
+ },
205
+ selectContainerStyle
206
+ )
207
+
208
+ if (opened) {
209
+ if (optionsPlacement == "above") {
210
+ selectContainerStyleActual.borderTopLeftRadius = 0
211
+ selectContainerStyleActual.borderTopRightRadius = 0
212
+ selectContainerStyleActual.borderBottomRightRadius = 4
213
+ selectContainerStyleActual.borderBottomLeftRadius = 4
214
+ } else if (optionsPlacement == "below") {
215
+ selectContainerStyleActual.borderTopLeftRadius = 4
216
+ selectContainerStyleActual.borderTopRightRadius = 4
217
+ selectContainerStyleActual.borderBottomRightRadius = 0
218
+ selectContainerStyleActual.borderBottomLeftRadius = 0
219
+ }
220
+ } else {
221
+ selectContainerStyleActual.borderRadius = 4
222
+ }
223
+
224
+ const chevronStyle = {fontSize: 24}
225
+
226
+ if (opened) {
227
+ chevronStyle.marginBottom = -9
228
+ } else {
229
+ chevronStyle.marginTop = -9
230
+ }
231
+
184
232
  return (
185
- <div
186
- className={classNames("haya-select", className)}
187
- data-id={idForComponent(this)}
188
- data-opened={opened}
189
- data-options-placement={optionsPlacement}
190
- data-toggles={Boolean(toggleOptions)}
233
+ <View
234
+ dataSet={{class: className, component: "haya-select", id: idForComponent(this), opened, optionsPlacement, toggles: Boolean(toggleOptions)}}
191
235
  {...restProps}
192
236
  >
193
237
  {opened &&
@@ -195,25 +239,40 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
195
239
  {this.optionsContainer()}
196
240
  </BodyPortal>
197
241
  }
198
- <div className="haya-select-container" onClick={onSelectClicked}>
199
- <div className="haya-select-current-selected" ref={currentSelectedRef}>
242
+ <Pressable
243
+ dataSet={{class: "select-container"}}
244
+ onPress={this.tt.onSelectClicked}
245
+ style={selectContainerStyleActual}
246
+ >
247
+ <View
248
+ dataSet={{class: "current-selected"}}
249
+ ref={currentSelectedRef}
250
+ style={{flexWrap: "wrap"}}
251
+ >
200
252
  {opened &&
201
- <input
202
- className="haya-select-search-text-input"
203
- onChange={onSearchTextInputChangedDebounced}
253
+ <TextInput
254
+ dataSet={{class: "search-text-input"}}
255
+ onChange={this.tt.onSearchTextInputChangedDebounced}
256
+ onChangeText={this.tt.onChangeSearchText}
204
257
  placeholder={this.t(".search_dot_dot_dot")}
205
- type="text"
206
258
  ref={this.tt.searchTextInputRef}
259
+ style={{
260
+ width: "100%",
261
+ border: 0,
262
+ outline: "none",
263
+ padding: 0
264
+ }}
265
+ value={this.state.searchText}
207
266
  />
208
267
  }
209
268
  {!opened &&
210
269
  <>
211
270
  {currentOptions.length == 0 &&
212
- <div style={{color: "grey"}}>
271
+ <Text style={{color: "grey"}}>
213
272
  {placeholder || this.t(".nothing_selected")}
214
- </div>
273
+ </Text>
215
274
  }
216
- {currentOptions.length == 0 &&
275
+ {currentOptions.length == 0 && Platform.OS == "web" &&
217
276
  <input
218
277
  id={idForComponent(this)}
219
278
  name={nameForComponentWithMultiple(this)}
@@ -222,15 +281,17 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
222
281
  />
223
282
  }
224
283
  {currentOptions.map((currentOption) =>
225
- <div className="current-option" key={currentOption.key || `current-value-${currentOption.value}`}>
284
+ <View dataSet={{class: "current-option"}} key={currentOption.key || `current-value-${currentOption.value}`} style={{marginRight: 6}}>
226
285
  {currentOption.type == "group" &&
227
- <div style={{fontWeight: "bold"}}>
228
- {currentOption.text}
229
- </div>
286
+ <View style={{fontWeight: "bold"}}>
287
+ <Text>
288
+ {currentOption.text}
289
+ </Text>
290
+ </View>
230
291
  }
231
292
  {currentOption.type != "group" &&
232
293
  <>
233
- {nameForComponentWithMultiple(this) &&
294
+ {Platform.OS == "web" && nameForComponentWithMultiple(this) &&
234
295
  <input
235
296
  id={idForComponent(this)}
236
297
  name={nameForComponentWithMultiple(this)}
@@ -241,17 +302,34 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
241
302
  {this.presentOption(currentOption)}
242
303
  </>
243
304
  }
244
- </div>
305
+ </View>
245
306
  )}
246
307
  </>
247
308
  }
248
- </div>
249
- <div className="haya-select-chevron-down-container">
250
- <i className="fa fa-chevron-down" />
251
- </div>
252
- </div>
253
- <div ref={endOfSelectRef} />
254
- </div>
309
+ </View>
310
+ <View
311
+ className="chevron-container"
312
+ style={{
313
+ display: "flex",
314
+ alignItems: "center",
315
+ justifyContent: "center",
316
+ height: "100%",
317
+ marginRight: 8,
318
+ marginLeft: "auto"
319
+ }}
320
+ >
321
+ <Text style={chevronStyle}>
322
+ {opened &&
323
+ <>&#8963;</>
324
+ }
325
+ {!opened &&
326
+ <>&#8964;</>
327
+ }
328
+ </Text>
329
+ </View>
330
+ </Pressable>
331
+ <View ref={endOfSelectRef} />
332
+ </View>
255
333
  )
256
334
  }
257
335
 
@@ -283,7 +361,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
283
361
  if (!defaultValues) return
284
362
 
285
363
  const result = await this.props.options({
286
- searchValue: digg(this.tt.searchTextInputRef, "current")?.value,
364
+ searchValue: this.s.searchText,
287
365
  values: defaultValues
288
366
  })
289
367
 
@@ -292,7 +370,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
292
370
 
293
371
  loadOptions = async () => {
294
372
  const {options} = this.p
295
- const searchValue = digg(this.tt.searchTextInputRef, "current")?.value
373
+ const searchValue = this.s.searchText
296
374
 
297
375
  if (Array.isArray(options)) {
298
376
  return this.loadOptionsFromArray(options, searchValue)
@@ -308,14 +386,16 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
308
386
  return <OptionGroup key={key} option={loadedOption} />
309
387
  }
310
388
 
311
- return <Option
312
- currentOptions={this.getCurrentOptions()}
313
- icon={this.iconForOption(loadedOption)}
314
- key={key}
315
- option={loadedOption}
316
- onOptionClicked={this.onOptionClicked}
317
- presentOption={this.presentOption}
318
- />
389
+ return (
390
+ <Option
391
+ currentOptions={this.getCurrentOptions()}
392
+ icon={this.iconForOption(loadedOption)}
393
+ key={key}
394
+ option={loadedOption}
395
+ onOptionClicked={this.onOptionClicked}
396
+ presentOption={this.presentOption}
397
+ />
398
+ )
319
399
  }
320
400
 
321
401
  loadOptionsFromArray(options, searchValue) {
@@ -351,11 +431,13 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
351
431
  }
352
432
  }
353
433
 
434
+ onChangeSearchText = (searchText) => this.setState({searchText})
435
+
354
436
  openOptions() {
355
437
  this.setOptionsPositionBelow()
356
438
  this.loadOptions()
357
439
  this.setState(
358
- {opened: true},
440
+ {opened: true, searchText: ""},
359
441
  () => {
360
442
  this.focusTextInput()
361
443
  this.setOptionsPositionAboveIfOutsideScreen()
@@ -380,8 +462,9 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
380
462
  const optionsHeight = digg(optionsContainerRef, "current", "offsetHeight")
381
463
  const scrollTop = document.documentElement.scrollTop
382
464
  const optionsTotalHeight = optionsHeight + optionsTop + scrollTop
465
+ const windowHeightWithScroll = window.innerHeight + scrollTop
383
466
 
384
- if (window.innerHeight < optionsTotalHeight) {
467
+ if (windowHeightWithScroll < optionsTotalHeight) {
385
468
  this.setOptionsPositionAbove()
386
469
  } else {
387
470
  this.setState({optionsVisibility: "visible"})
@@ -389,11 +472,12 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
389
472
  }
390
473
 
391
474
  setOptionsPositionAbove() {
392
- const {optionsContainerRef, currentSelectedRef, searchTextInputRef} = this.tt
475
+ const {optionsContainerRef, currentSelectedRef, endOfSelectRef} = this.tt
393
476
  const optionsHeight = digg(optionsContainerRef, "current", "offsetHeight")
394
477
  const position = currentSelectedRef.current.getBoundingClientRect()
395
- const {left, top, width} = digs(position, "left", "top", "width")
478
+ const {top} = digs(position, "top")
396
479
  const optionsTop = top - optionsHeight + 2
480
+ const {left, width} = digs(endOfSelectRef.current.getBoundingClientRect(), "left", "width")
397
481
 
398
482
  this.setState(
399
483
  {
@@ -411,7 +495,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
411
495
  }
412
496
 
413
497
  setOptionsPositionBelow() {
414
- const {endOfSelectRef, searchTextInputRef} = this.tt
498
+ const {endOfSelectRef} = this.tt
415
499
  const position = endOfSelectRef.current.getBoundingClientRect()
416
500
  const {left, top, width} = digs(position, "left", "top", "width")
417
501
 
@@ -461,15 +545,20 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
461
545
  const {loadedOptions, optionsLeft, optionsTop, optionsVisibility, optionsWidth, scrollLeft, scrollTop} = this.s
462
546
 
463
547
  return (
464
- <div
465
- className="haya-select-options-container"
466
- data-id={idForComponent(this)}
548
+ <View
549
+ dataSet={{class: "options-container", id: idForComponent(this)}}
467
550
  ref={optionsContainerRef}
468
551
  style={{
552
+ position: "absolute",
469
553
  left: optionsLeft + scrollLeft,
470
554
  top: optionsTop + scrollTop - 1,
555
+ zIndex: 99999,
471
556
  visibility: optionsVisibility,
472
557
  width: optionsWidth,
558
+ backgroundColor: "#fff",
559
+ border: "1px solid #999",
560
+ maxHeight: 300,
561
+ overflowY: "auto"
473
562
  }}
474
563
  >
475
564
  {loadedOptions?.map((loadedOption) =>
@@ -479,11 +568,13 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
479
568
  })
480
569
  )}
481
570
  {loadedOptions?.length === 0 &&
482
- <div className="haya-select-no-options-container">
483
- {this.t(".no_options_found")}
484
- </div>
571
+ <View dataSet={{class: "no-options-container"}}>
572
+ <Text>
573
+ {this.t(".no_options_found")}
574
+ </Text>
575
+ </View>
485
576
  }
486
- </div>
577
+ </View>
487
578
  )
488
579
  }
489
580
 
@@ -573,8 +664,8 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
573
664
  const toggleOption = toggleOptions?.find((toggleOptionI) => toggleOptionI.value == toggleValue)
574
665
 
575
666
  return (
576
- <div
577
- className="haya-select-option-presentation"
667
+ <View
668
+ dataSet={{class: "option-presentation"}}
578
669
  data-toggle-icon={toggleOption?.icon}
579
670
  data-toggle-value={toggleOption?.value}
580
671
  data-value={currentValue.value}
@@ -586,11 +677,24 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
586
677
  <i className={`fa fa-fw fa-${icon}`} />
587
678
  }
588
679
  {currentValue.content}
589
- {!currentValue.content && currentValue.text}
680
+ {!currentValue.content &&
681
+ <Text>{currentValue.text}</Text>
682
+ }
590
683
  {("html" in currentValue) &&
591
684
  <div dangerouslySetInnerHTML={{__html: digg(currentValue, "html")}} />
592
685
  }
593
- </div>
686
+ </View>
594
687
  )
595
688
  }
689
+
690
+ async setCurrentFromGivenValues() {
691
+ const {options, values} = this.p
692
+ const currentOptions = await options({values})
693
+ const currentValues = currentOptions?.map((currentOption) => currentOption.value)
694
+ const stateValues = this.s.currentOptions?.map((currentOption) => currentOption.value)
695
+
696
+ if (anythingDifferent(currentValues, stateValues)) {
697
+ this.setState({currentOptions})
698
+ }
699
+ }
596
700
  }))
@@ -1,6 +1,7 @@
1
1
  import PropTypes from "prop-types"
2
2
  import {memo} from "react"
3
3
  import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component.js"
4
+ import {Text, View} from "react-native"
4
5
 
5
6
  export default memo(shapeComponent(class OptionGroup extends ShapeComponent {
6
7
  static propTypes = {
@@ -9,9 +10,21 @@ export default memo(shapeComponent(class OptionGroup extends ShapeComponent {
9
10
 
10
11
  render() {
11
12
  return (
12
- <div className="haya-select--option-group">
13
- {this.props.option.text}
14
- </div>
13
+ <View
14
+ dataSet={{class: "haya-select--option-group"}}
15
+ style={{
16
+ paddingTop: 4,
17
+ paddingRight: 8,
18
+ paddingBottom: 4,
19
+ paddingLeft: 8,
20
+ color: "#000",
21
+ fontWeight: "bold"
22
+ }}
23
+ >
24
+ <Text>
25
+ {this.props.option.text}
26
+ </Text>
27
+ </View>
15
28
  )
16
29
  }
17
30
  }))
@@ -1,6 +1,7 @@
1
1
  import PropTypes from "prop-types"
2
2
  import {memo} from "react"
3
3
  import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component.js"
4
+ import {View} from "react-native"
4
5
 
5
6
  export default memo(shapeComponent(class Option extends ShapeComponent {
6
7
  static propTypes = {
@@ -12,21 +13,57 @@ export default memo(shapeComponent(class Option extends ShapeComponent {
12
13
  presentOption: PropTypes.func.isRequired
13
14
  }
14
15
 
16
+ setup() {
17
+ this.useStates({
18
+ hover: false
19
+ })
20
+ }
21
+
15
22
  render() {
23
+ const disabled = Boolean(this.props.option.disabled)
16
24
  const selected = Boolean(this.props.currentOptions.find((currentOption) => currentOption.value == this.props.option.value))
25
+ const style = {
26
+ paddingTop: 4,
27
+ paddingRight: 8,
28
+ paddingBottom: 4,
29
+ paddingLeft: 8,
30
+ color: "#000"
31
+ }
32
+
33
+ if (disabled) {
34
+ style.cursor = "default"
35
+ style.opacity = 0.6
36
+ } else {
37
+ style.cursor = "pointer"
38
+ }
39
+
40
+ if (selected) {
41
+ style.backgroundColor = "#80b2ff"
42
+ }
43
+
44
+ if (this.state.hover) {
45
+ style.backgroundColor = "steelblue"
46
+ }
17
47
 
18
48
  return (
19
- <div
20
- className="haya-select-option"
21
- data-disabled={Boolean(this.props.option.disabled)}
22
- data-selected={selected}
23
- data-value={this.props.option.value}
49
+ <View
50
+ dataSet={{
51
+ class: "haya-select-option",
52
+ disabled,
53
+ selected,
54
+ value: this.props.option.value
55
+ }}
24
56
  onClick={this.onClick}
57
+ onPointerOver={this.onPointerOver}
58
+ onPointerOut={this.onPointerOut}
59
+ style={style}
25
60
  >
26
61
  {this.props.presentOption(this.props.option)}
27
- </div>
62
+ </View>
28
63
  )
29
64
  }
30
65
 
31
66
  onClick = (e) => this.props.onOptionClicked(e, this.props.option)
67
+ onPointerOver = () => this.setState({hover: true})
68
+ onPointerOut = () => this.setState({hover: false})
32
69
  }))
@@ -1,88 +0,0 @@
1
- .haya-select {
2
- .haya-select-current-selected {
3
- display: flex;
4
- flex-wrap: wrap;
5
- position: relative;
6
-
7
- .current-option {
8
- margin-right: 6px;
9
- }
10
- }
11
-
12
- .haya-select-container {
13
- display: flex;
14
- align-items: center;
15
- background-color: #fff;
16
- border: 1px solid #999;
17
- color: #000;
18
- cursor: pointer;
19
- padding-top: 5px;
20
- padding-bottom: 5px;
21
- padding-left: 5px;
22
- }
23
-
24
- .haya-select-chevron-down-container {
25
- display: flex;
26
- align-items: center;
27
- justify-content: center;
28
- height: 100%;
29
- margin-right: 8px;
30
- margin-left: auto;
31
- }
32
-
33
- &[data-opened="false"] .haya-select-container {
34
- border-radius: 4px;
35
- }
36
-
37
- &[data-opened="true"][data-options-placement="above"] .haya-select-container {
38
- border-radius: 0 0 4px 4px;
39
- }
40
-
41
- &[data-opened="true"][data-options-placement="below"] .haya-select-container {
42
- border-radius: 4px 4px 0 0;
43
- }
44
- }
45
-
46
- .haya-select-search-text-input {
47
- width: 100%;
48
- border: 0;
49
- outline: none;
50
- padding: 0;
51
- }
52
-
53
- .haya-select-options-container {
54
- background-color: #fff;
55
- border: 1px solid #999;
56
- max-height: 300px;
57
- overflow-y: auto;
58
- position: absolute;
59
- z-index: 99999;
60
-
61
- .haya-select-option {
62
- padding: 4px 8px;
63
- color: #000;
64
-
65
- &[data-disabled="true"] {
66
- cursor: default;
67
- opacity: .6;
68
- }
69
-
70
- &[data-disabled="false"] {
71
- cursor: pointer;
72
- }
73
-
74
- &[data-selected="true"] {
75
- background-color: #80b2ff;
76
- }
77
-
78
- &:hover {
79
- background-color: steelblue;
80
- }
81
- }
82
-
83
- .haya-select--option-group {
84
- padding: 4px 8px;
85
- color: #000;
86
- font-weight: bold;
87
- }
88
- }