hds-web 0.1.5 → 0.1.6

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": "hds-web",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -2,6 +2,21 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Icon } from '../common-components/Icon';
4
4
 
5
+ const ANIMATED_ARR_CLASSES = {
6
+ 'icon1':{
7
+ 'sm':'h-5 ',
8
+ 'md': 'h-5',
9
+ 'lg': 'h-6'
10
+ },
11
+ 'icon2':{
12
+ 'sm':'h-5 -mt-5',
13
+ 'md': 'h-5 -mt-5',
14
+ 'lg': 'h-6 -mt-6'
15
+ },
16
+
17
+ }
18
+
19
+
5
20
  const Buttonclasses = {
6
21
  'primary': {
7
22
  'default': {
@@ -95,6 +110,7 @@ export default function Button(props) {
95
110
 
96
111
  const buttonClasses = [
97
112
  'inline-flex items-center',
113
+ 'hover:shadow',
98
114
  'rounded-full',
99
115
  `button-${size}`,
100
116
  'group',
@@ -119,9 +135,9 @@ export default function Button(props) {
119
135
 
120
136
  {rightAnimatedArrow && rightAnimatedArrow !== 'none' && (
121
137
  <div className=' hover:transition-all '>
122
- <Icon className='z-10 stroke-2 group-hover:translate-x-[0.098rem] group-hover:transition-all' height='h-4' variant={'chevronright'} strokeColor={rightAnimatedArrowColor} />
138
+ <Icon className='z-10 stroke-[1.5px] group-hover:translate-x-[0.15rem] group-hover:transition-all' height={`${ANIMATED_ARR_CLASSES['icon1'][`${size}`]}`} variant={'chevronright'} strokeColor={rightAnimatedArrowColor} />
123
139
 
124
- <Icon className='invisible stroke-2 -mt-4 group-hover:transition-all group-hover:delay-100 group-hover:visible ' height='h-4' variant='minus01' strokeColor={rightAnimatedArrowColor} />
140
+ <Icon className='invisible stroke-[1.5px] group-hover:transition-all group-hover:delay-100 group-hover:visible' height={`${ANIMATED_ARR_CLASSES['icon2'][`${size}`]}`} variant='minus01' strokeColor={rightAnimatedArrowColor} />
125
141
 
126
142
  </div>
127
143
  )}
@@ -5,6 +5,22 @@ export default function Carouseltest(props) {
5
5
  const [currentCard, setCurrentCard] = React.useState(0);
6
6
  const [touchStart, setTouchStart] = React.useState(0);
7
7
  const [touchEnd, setTouchEnd] = React.useState(0);
8
+ const [visibleCardsContainerWidth, setvisibleCardsContainerWidth] = React.useState(0);
9
+ const [cardWidth, setcardWidth] = React.useState(0);
10
+ const [totalContainerWidth, setTotalContainerWidth] = React.useState(0);
11
+ React.useEffect(() => {
12
+ const visibleCardsContainerWidth = refs[0]?.current?.parentNode?.offsetWidth;
13
+ setvisibleCardsContainerWidth(visibleCardsContainerWidth);
14
+ const cardWidth = refs[0]?.current?.getBoundingClientRect().width;
15
+ setcardWidth(cardWidth);
16
+
17
+ const totalCardsWidth = Object.values(refs).reduce((acc, ref) => {
18
+ const rect = ref.current.getBoundingClientRect();
19
+ return acc + rect.width + parseFloat(getComputedStyle(ref.current).marginLeft) + parseFloat(getComputedStyle(ref.current).marginRight);
20
+ }, 0);
21
+ setTotalContainerWidth(totalCardsWidth);
22
+ }, []);
23
+
8
24
 
9
25
  const handleTouchStart = e => {
10
26
  setTouchStart(e.targetTouches[0].clientX);
@@ -57,13 +73,31 @@ export default function Carouseltest(props) {
57
73
  }
58
74
  };
59
75
  const slider = () => {
60
- let sliderWidth = 24/(totalCards-1) * (currentCard) + 'rem';
61
- let sliderClass = 'w-[' + sliderWidth +'rem]';
62
- console.log(sliderClass);
76
+
77
+ let x = visibleCardsContainerWidth;
78
+ let noOfcardsinaview = visibleCardsContainerWidth/cardWidth;
79
+ let y = 1;
80
+ console.log('noOfcardsinaview*currentCard',noOfcardsinaview*(currentCard+1));
81
+ // if((noOfcardsinaview*(currentCard+1))<=totalCards){
82
+ // let y = (totalContainerWidth/(noOfcardsinaview*visibleCardsContainerWidth))*(noOfcardsinaview*(currentCard+1));
83
+
84
+ // }
85
+ console.log(totalContainerWidth, visibleCardsContainerWidth, currentCard )
86
+ let slider1 = (384/(totalCards*cardWidth)) * (328)* (currentCard);
87
+ if(slider1>384){
88
+ slider1 = 384;
89
+ }
90
+
91
+
92
+ console.log('x',x, 'slider1', slider1 );
93
+
94
+
95
+
96
+ let sliderWidth = slider1+ 'px';
63
97
  return (
64
98
  <div className=' '>
65
- <div className='bg-blue-100 w-96 rounded-md content-center h-1'>
66
- <div className={`bg-blue-600 rounded-md h-1 `} style={{ width: `${sliderWidth}` }} />
99
+ <div className='bg-pink-500 w-96 rounded-md content-center h-1'>
100
+ <div className={`bg-blue-600 transition-all ease-in duration-300 rounded-md h-1 `} style={{ width: `${sliderWidth}` }} />
67
101
  </div>
68
102
  </div>
69
103
  )
@@ -17,9 +17,9 @@ const Card = ({ text }) => {
17
17
 
18
18
  return (
19
19
  <div className="relative bg-white rounded-md shadow-md p-4 border bg-storybook-default-heading">
20
- <p className="code-md font-medium text-center text-neutral-100">{text}</p>
20
+ <p className="code-md whitespace-pre-wrap font-medium text-neutral-100">{text}</p>
21
21
  <button
22
- className=" code-md absolute bottom-0 right-0 border px-4 py-4 bg-neutral-100 text-storybook-default-heading rounded hover:bg-blue-600 focus:bg-blue-600 focus:outline-none"
22
+ className=" code-md absolute bottom-0 right-0 border px-4 py-4 bg-neutral-100 text-storybook-default-heading rounded hover:bg-blue-100 focus:bg-blue-100 focus:outline-none"
23
23
  onClick={handleCopy}
24
24
  >
25
25
  {isCopied ? "Copied!" : "Copy"}
@@ -1128,6 +1128,14 @@ select {
1128
1128
  margin-top: -1rem;
1129
1129
  }
1130
1130
 
1131
+ .-mt-5 {
1132
+ margin-top: -1.25rem;
1133
+ }
1134
+
1135
+ .-mt-6 {
1136
+ margin-top: -1.5rem;
1137
+ }
1138
+
1131
1139
  .mb-2 {
1132
1140
  margin-bottom: 0.5rem;
1133
1141
  }
@@ -1829,6 +1837,10 @@ select {
1829
1837
  white-space: pre-line;
1830
1838
  }
1831
1839
 
1840
+ .whitespace-pre-wrap {
1841
+ white-space: pre-wrap;
1842
+ }
1843
+
1832
1844
  .rounded {
1833
1845
  border-radius: 0.25rem;
1834
1846
  }
@@ -2509,8 +2521,8 @@ select {
2509
2521
  background-color: rgb(133 77 24 / var(--tw-bg-opacity));
2510
2522
  }
2511
2523
 
2512
- .stroke-2 {
2513
- stroke-width: 2;
2524
+ .stroke-\[1\.5px\] {
2525
+ stroke-width: 1.5px;
2514
2526
  }
2515
2527
 
2516
2528
  .object-contain {
@@ -3704,6 +3716,10 @@ select {
3704
3716
  transition-duration: 200ms;
3705
3717
  }
3706
3718
 
3719
+ .duration-300 {
3720
+ transition-duration: 300ms;
3721
+ }
3722
+
3707
3723
  .duration-500 {
3708
3724
  transition-duration: 500ms;
3709
3725
  }
@@ -4789,8 +4805,8 @@ select {
4789
4805
  display: block;
4790
4806
  }
4791
4807
 
4792
- .group:hover .group-hover\:translate-x-\[0\.098rem\] {
4793
- --tw-translate-x: 0.098rem;
4808
+ .group:hover .group-hover\:translate-x-\[0\.15rem\] {
4809
+ --tw-translate-x: 0.15rem;
4794
4810
  -webkit-transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
4795
4811
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
4796
4812
  }