oddsgate-ds 1.0.64 → 1.0.66

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.
@@ -0,0 +1,2 @@
1
+ declare const isTouchDevice: () => boolean;
2
+ export default isTouchDevice;
@@ -45,4 +45,5 @@ export { default as CircularSlider } from './components/organisms/CircularSlider
45
45
  export { iconsList } from './helpers/getIcons';
46
46
  export { default as GlobalStyles } from './styles/Global';
47
47
  export { default as clickOutSideToClose } from './helpers/clickOutsideToClose';
48
+ export { default as isTouchDevice } from './helpers/isTouchDevice';
48
49
  export { variables };
@@ -2,9 +2,9 @@ export declare const pxToRem: (size: number) => string;
2
2
  export declare const fontName = "MD Nichrome";
3
3
  export declare const alternativeFont = "Red Hat Display";
4
4
  export declare const gutter: string;
5
- export declare const desktop_width = "1620";
6
- export declare const tablet_width = "768";
7
- export declare const mobile_width = "375";
5
+ export declare const desktop_width: number;
6
+ export declare const tablet_width: number;
7
+ export declare const mobile_width: number;
8
8
  export declare const responsiveMedia = "980px";
9
9
  export declare const mobileMedia = "360px";
10
10
  export declare const easeOutExpo = "cubic-bezier(.32,.94,.6,1);";
package/dist/types.d.ts CHANGED
@@ -7,9 +7,9 @@ declare const pxToRem: (size: number) => string;
7
7
  declare const fontName = "MD Nichrome";
8
8
  declare const alternativeFont = "Red Hat Display";
9
9
  declare const gutter: string;
10
- declare const desktop_width = "1620";
11
- declare const tablet_width = "768";
12
- declare const mobile_width = "375";
10
+ declare const desktop_width: number;
11
+ declare const tablet_width: number;
12
+ declare const mobile_width: number;
13
13
  declare const responsiveMedia = "980px";
14
14
  declare const mobileMedia = "360px";
15
15
  declare const easeOutExpo = "cubic-bezier(.32,.94,.6,1);";
@@ -619,4 +619,6 @@ declare const GlobalStyles: React$1.NamedExoticComponent<styled_components.Execu
619
619
 
620
620
  declare function clickOutSideToClose(ref: React.RefObject<HTMLDivElement>, closeFunction: () => void): void;
621
621
 
622
- export { Accordion, AccordionItem, BlogCard, Button, CheckRadioField, Chip, CircularSlider, CloseButton, Column, Counter, Cover, Dropdown, DropdownItem, EmptyState, EventsCard, Flex, FormField, GlobalStyles, Heading, Icon, IconBox, IconTitle, ImageWrapper, Loader, LogosCard, Marquee, Modal, NewsCard, OffCanvas, PortalComponent, ProductCard, Quote, RichText, Row, ScrollingNav, Separator, ShareModal, Slider, SocialLinks, Spacer, Tabs, TeamCard, Video, VideoEmbed, clickOutSideToClose, iconsList, variables };
622
+ declare const isTouchDevice: () => boolean;
623
+
624
+ export { Accordion, AccordionItem, BlogCard, Button, CheckRadioField, Chip, CircularSlider, CloseButton, Column, Counter, Cover, Dropdown, DropdownItem, EmptyState, EventsCard, Flex, FormField, GlobalStyles, Heading, Icon, IconBox, IconTitle, ImageWrapper, Loader, LogosCard, Marquee, Modal, NewsCard, OffCanvas, PortalComponent, ProductCard, Quote, RichText, Row, ScrollingNav, Separator, ShareModal, Slider, SocialLinks, Spacer, Tabs, TeamCard, Video, VideoEmbed, clickOutSideToClose, iconsList, isTouchDevice, variables };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oddsgate-ds",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "description": "Miew theme component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -4,6 +4,7 @@ import Button from '@/components/atoms/Button/Button.component'
4
4
  import { ISlider } from './Slider.interface'
5
5
  import Icon from '@/components/atoms/Icon/Icon.component'
6
6
  import { StyledSlider } from './Slider.theme'
7
+ import isTouchDevice from '@/helpers/isTouchDevice'
7
8
  import { useBlazeSlider } from './Slider.utils'
8
9
 
9
10
  const Slider = ({
@@ -27,6 +28,8 @@ const Slider = ({
27
28
  let elRef: any = null
28
29
  let sliderRef: any = null
29
30
 
31
+ const isMobile = isTouchDevice();
32
+
30
33
  const setConfig = () => {
31
34
  if (sliderRef?.current) sliderRef.current.destroy()
32
35
  responsiveCSS = `
@@ -102,7 +105,12 @@ const Slider = ({
102
105
  // mediaQueries
103
106
  // ])
104
107
 
105
- setConfig()
108
+ if (mobileOnly) {
109
+ isMobile && setConfig();
110
+ } else {
111
+ setConfig();
112
+ }
113
+
106
114
 
107
115
  return (
108
116
  <StyledSlider
@@ -86,9 +86,11 @@ export const MobileOnly: StoryObj<ISlider> = {
86
86
  slidesToScroll={1}
87
87
  infinite={false}
88
88
  spacing={'1rem'}
89
+ autoplay={false}
89
90
  mediaQueries={{
90
91
  900: {
91
- slidesToShow: 2
92
+ slidesToShow: 2,
93
+ autoplay: true,
92
94
  },
93
95
  500: {
94
96
  slidesToShow: 1
@@ -96,12 +98,12 @@ export const MobileOnly: StoryObj<ISlider> = {
96
98
  }}
97
99
  {...args}
98
100
  >
99
- <div>{image}</div>
100
- <div>{image}</div>
101
- <div>{image}</div>
102
- <div>{image}</div>
103
- <div>{image}</div>
104
- <div>{image}</div>
101
+ <div style={{ maxWidth: "100%" }}>{image}</div>
102
+ <div style={{ maxWidth: "25%" }}>{image}</div>
103
+ <div style={{ maxWidth: "25%" }}>{image}</div>
104
+ <div style={{ maxWidth: "25%" }}>{image}</div>
105
+ <div style={{ maxWidth: "25%" }}>{image}</div>
106
+ <div style={{ maxWidth: "25%" }}>{image}</div>
105
107
  </Slider>
106
108
  </div>
107
109
  ),
@@ -3,10 +3,7 @@ import styled, { css } from 'styled-components';
3
3
 
4
4
  import { ISlider } from './Slider.interface';
5
5
 
6
- export const StyledSlider = styled.div<ISlider>`
7
- position:relative;
8
- width: 100%;
9
-
6
+ const SliderStyles = `
10
7
  //vendor styles
11
8
  .blaze-slider {
12
9
  /* default config */
@@ -36,16 +33,9 @@ export const StyledSlider = styled.div<ISlider>`
36
33
  );
37
34
  }
38
35
 
39
- .blaze-track,
40
36
  .blaze-track > div {
41
- box-sizing: border-box;
42
- }
43
-
44
- .blaze-track > div {
45
- position: relative;
46
37
  width: var(--slide-width);
47
- flex-basis: unset;
48
- max-width: unset;
38
+ max-width: unset !important;
49
39
  flex-shrink: 0;
50
40
  }
51
41
 
@@ -122,17 +112,45 @@ export const StyledSlider = styled.div<ISlider>`
122
112
  `}
123
113
 
124
114
  ${({ $mobileOnly }) => $mobileOnly && `
125
- .blaze-track{
126
- flex-flow: row wrap;
127
- width: 100% !important;
128
- max-width: 100% !important;
129
- transform: none !important;
130
- }
115
+ @media only screen and (min-width: ${responsiveMedia}) {
116
+ .blaze-track{
117
+ flex-flow: row wrap;
118
+ width: 100% !important;
119
+ max-width: 100% !important;
120
+ transform: none !important;
121
+ gap: 0 !important;
122
+
123
+ &>div{
124
+ width: 100% !important;
125
+ }
126
+ }
131
127
 
132
- .blaze-arrows,
133
- .blaze-controls{
134
- display:none;
128
+ .blaze-arrows,
129
+ .blaze-controls{
130
+ display:none;
131
+ }
135
132
  }
136
133
  `}
137
134
  }
138
135
  `;
136
+
137
+
138
+ export const StyledSlider = styled.div<ISlider>`
139
+ position:relative;
140
+ width: 100%;
141
+
142
+ ${({ $mobileOnly }) => $mobileOnly ? (`
143
+ @media only screen and (max-width: ${responsiveMedia}) {
144
+ ${SliderStyles}
145
+ }
146
+ @media only screen and (min-width: ${responsiveMedia}) {
147
+ .blaze-controls{
148
+ display:none;
149
+ }
150
+ }
151
+ `)
152
+ : (`
153
+ ${SliderStyles}
154
+ `)}
155
+
156
+ `;
@@ -0,0 +1,11 @@
1
+ const isTouchDevice = () => {
2
+ try {
3
+ document.createEvent('TouchEvent');
4
+ return true;
5
+ } catch (e) {
6
+ return false;
7
+ }
8
+ }
9
+
10
+
11
+ export default isTouchDevice
package/src/index.ts CHANGED
@@ -55,6 +55,7 @@ export { iconsList } from './helpers/getIcons'
55
55
  export { default as GlobalStyles } from './styles/Global'
56
56
 
57
57
  export { default as clickOutSideToClose } from './helpers/clickOutsideToClose'
58
+ export { default as isTouchDevice } from './helpers/isTouchDevice'
58
59
 
59
60
  export { variables };
60
61
 
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  colors,
3
+ desktop_width,
3
4
  gradients,
4
5
  grid_conf,
5
6
  radius,
@@ -12,17 +13,15 @@ import {
12
13
  } from './variables';
13
14
 
14
15
  export const fontSize = (typo: string) => {
15
- return `
16
- ${typography[typo]?.sizeMob ? `
17
- font-size: ${typography[typo].sizeMob};
16
+ const size = parseInt(typography[typo].size as string);
17
+ const percentage = 0.2;
18
18
 
19
- @media only screen and (min-width: ${responsiveMedia}) {
20
- font-size: ${typography[typo].size};
21
- }
22
- ` : `
23
- font-size: ${typography[typo].size};
24
- `}
19
+ const min = typography[typo].sizeMob ?? typography[typo].size; // check if size mobile exists
20
+ const max = ((size / desktop_width) * 100).toFixed(3); // get vw value divise font size for desktop width
21
+ const range = Math.ceil(size + (size * percentage)); // use desktop font-size and add a range of percentage
25
22
 
23
+ return `
24
+ font-size: clamp(${min}, ${max}vw, ${range}px);
26
25
  line-height: ${typography[typo].height};
27
26
  `
28
27
  }
@@ -7,9 +7,9 @@ export const alternativeFont = "Red Hat Display";
7
7
 
8
8
  export const gutter = pxToRem(8); //needs to be in this file
9
9
 
10
- export const desktop_width = "1620"; //container size of design on desktop
11
- export const tablet_width = "768"; //container size of design on tablet
12
- export const mobile_width = "375"; //container size of design on mobile
10
+ export const desktop_width:number = 1620; //container size of design on desktop
11
+ export const tablet_width:number = 768; //container size of design on tablet
12
+ export const mobile_width:number = 375; //container size of design on mobile
13
13
  export const responsiveMedia = "980px"; //mobile media value for bootstrap
14
14
  export const mobileMedia = "360px"; //mobile media value
15
15
 
@@ -89,38 +89,38 @@ export const spacesNegative = <Record<string, string>>{
89
89
  //if responsive is not needed for a size just set the size as px instead of rem
90
90
  export const typography = <Record<string, Record<string, unknown>>>{
91
91
  display: {
92
- size: pxToRem(250),
93
- sizeMob: pxToRem(64),
92
+ size: "250px",
93
+ sizeMob: "64px",
94
94
  height: 1.2,
95
95
  },
96
96
  h1: {
97
- size: pxToRem(120),
98
- sizeMob: pxToRem(48),
97
+ size: "120px",
98
+ sizeMob: "48px",
99
99
  height: 1.2,
100
100
  },
101
101
  h2: {
102
- size: pxToRem(80),
103
- sizeMob: pxToRem(36),
102
+ size: "80px",
103
+ sizeMob: "36px",
104
104
  height: 1.2,
105
105
  },
106
106
  h3: {
107
- size: pxToRem(48),
108
- sizeMob: pxToRem(24),
107
+ size: "48px",
108
+ sizeMob: "24px",
109
109
  height: 1.2,
110
110
  },
111
111
  h4: {
112
- size: pxToRem(36),
113
- sizeMob: pxToRem(20),
112
+ size: "36px",
113
+ sizeMob: "20px",
114
114
  height: 1.2,
115
115
  },
116
116
  h5: {
117
- size: pxToRem(24),
118
- sizeMob: pxToRem(18),
117
+ size: "24px",
118
+ sizeMob: "18px",
119
119
  height: 1.4,
120
120
  },
121
121
  h6: {
122
- size: pxToRem(18),
123
- sizeMob: pxToRem(16),
122
+ size: "18px",
123
+ sizeMob: "16px",
124
124
  height: 1.4,
125
125
  },
126
126
  texts: {