lupine.components 1.1.47 → 1.1.48

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": "lupine.components",
3
- "version": "1.1.47",
3
+ "version": "1.1.48",
4
4
  "license": "MIT",
5
5
  "author": "uuware.com",
6
6
  "homepage": "https://github.com/uuware/lupine.js",
@@ -41,11 +41,14 @@ export const ToggleBase = (props: ToggleBaseProps) => {
41
41
  },
42
42
  };
43
43
  const onClick = (e: MouseEvent) => {
44
+ e.preventDefault();
44
45
  if (disabled) {
45
46
  return;
46
47
  }
47
48
 
48
- const checked = (e.target as HTMLInputElement).checked;
49
+ const input = ref.$('input.toggle-base-checkbox') as HTMLInputElement;
50
+ const checked = !input.checked;
51
+ input.checked = checked;
49
52
  !props.noToggle && applyToggle(checked, disabled);
50
53
  if (props.onClick) {
51
54
  props.onClick(checked);
@@ -77,6 +80,12 @@ export const ToggleBase = (props: ToggleBaseProps) => {
77
80
  width: `100%`,
78
81
  height: `100%`,
79
82
  },
83
+ '.toggle-base-box': {
84
+ cursor: 'pointer',
85
+ userSelect: 'none',
86
+ '-webkit-tap-highlight-color': 'transparent',
87
+ touchAction: 'manipulation',
88
+ },
80
89
  '.toggle-base-checkbox': {
81
90
  opacity: 0,
82
91
  width: 0,
@@ -95,14 +104,13 @@ export const ToggleBase = (props: ToggleBaseProps) => {
95
104
  }}
96
105
  class={['toggle-base-component', props.className].join(' ').trim()}
97
106
  >
98
- <label class='toggle-base-box'>
107
+ <label class='toggle-base-box' onClick={onClick}>
99
108
  <div class='toggle-base-container'>{props.children}</div>
100
109
  <input
101
110
  type='checkbox'
102
111
  class='toggle-base-checkbox'
103
112
  checked={props.checked || false}
104
113
  disabled={disabled}
105
- onClick={onClick}
106
114
  />
107
115
  </label>
108
116
  </div>
@@ -12,16 +12,12 @@
12
12
  </div>
13
13
  );
14
14
  */
15
- import { VNode, stopPropagation } from 'lupine.components';
15
+ import { MediaQueryMaxWidth, VNode, stopPropagation } from 'lupine.components';
16
16
  import { SliderHelper, SliderHelperCloseProps } from './slider-helper';
17
17
 
18
- // addClass(SliderFramePosition) is used to show two SliderFrames for big screens,
19
- // so when the second is showing, it needs to set this on the first one
20
- export type SliderFramePosition = 'desktop-slide-left' | 'desktop-slide-right';
21
18
  export type SliderFrameHookProps = {
22
19
  load?: (children: VNode<any>) => void;
23
20
  close?: (event: Event) => void;
24
- addClass?: (className: SliderFramePosition) => void;
25
21
  isOpened?: () => boolean;
26
22
  };
27
23
 
@@ -30,12 +26,11 @@ export type SliderFrameProps = {
30
26
  direction?: 'right' | 'bottom';
31
27
  hook?: SliderFrameHookProps;
32
28
  afterClose?: () => void | Promise<void>;
29
+ maxWidth?: string;
33
30
  };
34
- // deprecated
35
31
  export const SliderFrame = (props: SliderFrameProps) => {
36
32
  let closeSlider: SliderHelperCloseProps | undefined;
37
33
  let opened = false;
38
- let className = '';
39
34
 
40
35
  if (props.hook) {
41
36
  props.hook.load = (children) => {
@@ -43,7 +38,7 @@ export const SliderFrame = (props: SliderFrameProps) => {
43
38
  SliderHelper.show({
44
39
  direction: props.direction || 'right',
45
40
  children,
46
- className,
41
+ maxWidth: props.maxWidth || MediaQueryMaxWidth.MobileMax,
47
42
  closeEvent: () => {
48
43
  opened = false;
49
44
  closeSlider = undefined;
@@ -57,10 +52,6 @@ export const SliderFrame = (props: SliderFrameProps) => {
57
52
  stopPropagation(event);
58
53
  closeSlider?.();
59
54
  };
60
- // deprecated
61
- props.hook.addClass = (newClassName) => {
62
- className = [className, newClassName].join(' ').trim();
63
- };
64
55
  props.hook.isOpened = () => {
65
56
  return opened;
66
57
  };