@udixio/ui-react 2.9.3 → 2.9.4

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.
@@ -5,5 +5,5 @@ import { ToolTipInterface } from '../interfaces';
5
5
  * @status beta
6
6
  * @category Communication
7
7
  */
8
- export declare const ToolTip: ({ variant, buttons, className, children, title, text, position, targetRef, ref, trigger, ...props }: MotionProps<ToolTipInterface>) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const ToolTip: ({ variant, buttons, className, children, title, text, position, targetRef, ref, trigger, transition, ...props }: MotionProps<ToolTipInterface>) => import("react/jsx-runtime").JSX.Element;
9
9
  //# sourceMappingURL=ToolTip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolTip.d.ts","sourceRoot":"","sources":["../../../src/lib/components/ToolTip.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAMjD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,qGAYrB,WAAW,CAAC,gBAAgB,CAAC,4CA6M/B,CAAC"}
1
+ {"version":3,"file":"ToolTip.d.ts","sourceRoot":"","sources":["../../../src/lib/components/ToolTip.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAMjD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,iHAarB,WAAW,CAAC,gBAAgB,CAAC,4CA8N/B,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { ReactProps } from '../utils';
2
2
  import { ButtonInterface } from './button.interface';
3
3
  import { ReactNode, RefObject } from 'react';
4
+ import { Transition } from 'motion';
4
5
  type Trigger = 'hover' | 'click' | 'focus' | null;
5
6
  export type ToolTipInterface<T extends HTMLElement = any> = {
6
7
  type: 'div';
@@ -11,6 +12,7 @@ export type ToolTipInterface<T extends HTMLElement = any> = {
11
12
  buttons?: ReactProps<ButtonInterface> | ReactProps<ButtonInterface>[];
12
13
  position?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
13
14
  trigger?: Trigger | Trigger[];
15
+ transition?: Transition;
14
16
  } & ({
15
17
  children?: never;
16
18
  targetRef: RefObject<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/tooltip.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7C,KAAK,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;AAElD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,GAAG,IAAI;IAC1D,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE;QACL,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACtE,QAAQ,CAAC,EACL,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;KAC/B,GAAG,CACA;QACE,QAAQ,CAAC,EAAE,KAAK,CAAC;QACjB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;KACzB,GACD;QACE,QAAQ,EAAE,SAAS,CAAC;QACp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AC;KACnB,CACJ,CAAC;IACF,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;CAC5E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fab-menu.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/fab-menu.style.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAapE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAGxB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAG3B,CAAC"}
1
+ {"version":3,"file":"fab-menu.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/fab-menu.style.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAcpE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAGxB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAG3B,CAAC"}
@@ -7,6 +7,7 @@ export declare const toolStyle: (states: ({
7
7
  buttons: any;
8
8
  position: any;
9
9
  trigger: any;
10
+ transition: any;
10
11
  children: any;
11
12
  targetRef: any;
12
13
  } | {
@@ -16,6 +17,7 @@ export declare const toolStyle: (states: ({
16
17
  buttons: any;
17
18
  position: any;
18
19
  trigger: any;
20
+ transition: any;
19
21
  children: any;
20
22
  targetRef: any;
21
23
  }) & (({
@@ -25,6 +27,7 @@ export declare const toolStyle: (states: ({
25
27
  buttons?: import('..').ReactProps<import('..').ButtonInterface> | import('..').ReactProps<import('..').ButtonInterface>[];
26
28
  position?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
27
29
  trigger?: ("click" | "focus" | "hover" | null) | ("click" | "focus" | "hover" | null)[];
30
+ transition?: import('motion').Transition;
28
31
  } & ({
29
32
  children: import('react').ReactNode;
30
33
  targetRef?: never;
@@ -41,6 +44,7 @@ export declare const useToolTipStyle: (states: ({
41
44
  buttons?: import('..').ReactProps<import('..').ButtonInterface> | import('..').ReactProps<import('..').ButtonInterface>[];
42
45
  position?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
43
46
  trigger?: ("click" | "focus" | "hover" | null) | ("click" | "focus" | "hover" | null)[];
47
+ transition?: import('motion').Transition;
44
48
  } & ({
45
49
  children: import('react').ReactNode;
46
50
  targetRef?: never;
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/tooltip.style.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA+BjD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yFAGrB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;wFAG3B,CAAC"}
1
+ {"version":3,"file":"tooltip.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/tooltip.style.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAgCjD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yFAGrB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;wFAG3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udixio/ui-react",
3
- "version": "2.9.3",
3
+ "version": "2.9.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -36,8 +36,8 @@
36
36
  "devDependencies": {
37
37
  "react": "^19.1.1",
38
38
  "react-dom": "^19.1.1",
39
- "@udixio/theme": "2.1.6",
40
- "@udixio/tailwind": "2.4.4"
39
+ "@udixio/theme": "2.1.7",
40
+ "@udixio/tailwind": "2.4.5"
41
41
  },
42
42
  "repository": {
43
43
  "type": "git",
@@ -29,8 +29,11 @@ export const ToolTip = ({
29
29
  targetRef,
30
30
  ref,
31
31
  trigger = ['hover', 'focus'],
32
+ transition,
32
33
  ...props
33
34
  }: MotionProps<ToolTipInterface>) => {
35
+ transition = { duration: 0.3, delay: 0.4, ...transition };
36
+
34
37
  if (!children && !targetRef) {
35
38
  throw new Error('ToolTip must have a child or a targetRef');
36
39
  }
@@ -50,6 +53,7 @@ export const ToolTip = ({
50
53
  const [isVisible, setIsVisible] = useState(false);
51
54
 
52
55
  const timeout = useRef<ReturnType<typeof setTimeout> | null>(null);
56
+ const showTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);
53
57
 
54
58
  useEffect(() => {
55
59
  const handleUpdate = (event: CustomEvent) => {
@@ -67,9 +71,19 @@ export const ToolTip = ({
67
71
 
68
72
  useEffect(() => {
69
73
  if (timeout.current) clearTimeout(timeout.current);
74
+ if (showTimeout.current) clearTimeout(showTimeout.current);
70
75
 
71
76
  if (currentToolTipId) {
72
- setIsVisible(currentToolTipId === id);
77
+ if (currentToolTipId === id) {
78
+ showTimeout.current = setTimeout(
79
+ () => {
80
+ setIsVisible(true);
81
+ },
82
+ (transition?.delay ?? 0) * 1000,
83
+ );
84
+ } else {
85
+ setIsVisible(false);
86
+ }
73
87
  } else {
74
88
  timeout.current = setTimeout(() => {
75
89
  setIsVisible(false);
@@ -188,6 +202,17 @@ export const ToolTip = ({
188
202
  children: children as any,
189
203
  });
190
204
 
205
+ const variants = {
206
+ open: {
207
+ opacity: 1,
208
+ height: 'auto',
209
+ },
210
+ close: {
211
+ opacity: 0,
212
+ height: 16,
213
+ },
214
+ };
215
+
191
216
  return (
192
217
  <>
193
218
  {enhancedChildren}
@@ -195,24 +220,17 @@ export const ToolTip = ({
195
220
  {isVisible && (
196
221
  <SyncedFixedWrapper targetRef={resolvedRef}>
197
222
  <motion.div
198
- initial={{ opacity: currentToolTipId ? 1 : 0 }}
199
- animate={{ opacity: 1 }}
200
- transition={{ duration: currentToolTipId ? 0 : 0.3 }}
201
- exit={{ opacity: currentToolTipId ? 1 : 0 }}
223
+ initial={'close'}
224
+ variants={variants}
225
+ animate={'open'}
226
+ transition={{ duration: transition.duration }}
227
+ exit={'close'}
202
228
  className={styles.toolTip}
203
229
  {...props}
204
230
  onMouseEnter={handleMouseEnter}
205
231
  onMouseLeave={handleMouseLeave}
206
232
  >
207
- <motion.div
208
- className={styles.container}
209
- layoutId={'tool-tip'}
210
- transition={{
211
- type: 'spring',
212
- stiffness: 200,
213
- damping: 20,
214
- }}
215
- >
233
+ <div className={styles.container}>
216
234
  {title && <div className={styles.subHead}>{title}</div>}
217
235
  <div className={styles.supportingText}>{text}</div>
218
236
  {buttons && (
@@ -228,7 +246,7 @@ export const ToolTip = ({
228
246
  ))}
229
247
  </div>
230
248
  )}
231
- </motion.div>
249
+ </div>
232
250
  </motion.div>
233
251
  </SyncedFixedWrapper>
234
252
  )}
@@ -1,6 +1,7 @@
1
1
  import { ReactProps } from '../utils';
2
2
  import { ButtonInterface } from './button.interface';
3
3
  import { ReactNode, RefObject } from 'react';
4
+ import { Transition } from 'motion';
4
5
 
5
6
  type Trigger = 'hover' | 'click' | 'focus' | null;
6
7
 
@@ -21,6 +22,7 @@ export type ToolTipInterface<T extends HTMLElement = any> = {
21
22
  | 'bottom-left'
22
23
  | 'bottom-right';
23
24
  trigger?: Trigger | Trigger[];
25
+ transition?: Transition;
24
26
  } & (
25
27
  | {
26
28
  children?: never;
@@ -15,6 +15,7 @@ const fabMenuConfig: ClassNameComponent<FabMenuInterface> = ({
15
15
  actions: classNames(
16
16
  'flex flex-col gap-1 items-end absolute bottom-[calc(100%_+_8px)] right-0',
17
17
  ),
18
+ label: classNames('text-nowrap'),
18
19
  });
19
20
 
20
21
  export const fabMenuStyle = defaultClassNames<FabMenuInterface>(
@@ -12,6 +12,9 @@ const toolTipConfig: ClassNameComponent<ToolTipInterface> = ({
12
12
  }) => ({
13
13
  toolTip: classNames(
14
14
  ' pointer-events-auto w-max z-10 absolute m-1 w-max-content max-w-[312px]',
15
+ variant == 'rich' &&
16
+ 'bg-surface-container rounded-2xl text-on-surface-container shadow-2',
17
+ variant == 'plain' && 'bg-inverse-surface rounded text-inverse-on-surface ',
15
18
  {
16
19
  'bottom-full left-1/2 -translate-x-1/2': position == 'top',
17
20
  'top-full left-1/2 -translate-x-1/2': position == 'bottom',
@@ -25,10 +28,8 @@ const toolTipConfig: ClassNameComponent<ToolTipInterface> = ({
25
28
  ),
26
29
  container: classNames(
27
30
  'pb-2',
28
- variant == 'rich' &&
29
- 'bg-surface-container rounded-2xl text-on-surface-container px-4 pt-3 shadow-2',
30
- variant == 'plain' &&
31
- 'bg-inverse-surface rounded text-inverse-on-surface px-2 py-1',
31
+ variant == 'rich' && 'px-4 pt-3 ',
32
+ variant == 'plain' && 'px-2 py-1',
32
33
  ),
33
34
  actions: classNames('flex gap-10 px-1 mt-2', variant == 'plain' && 'hidden'),
34
35
  subHead: classNames('text-title-small mb-1', variant == 'plain' && 'hidden'),