@duro-app/ui 0.39.0 → 0.40.0

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.
Files changed (74) hide show
  1. package/dist/components/ActionBar/styles.css.d.ts +2 -2
  2. package/dist/components/ActionBar/styles.css.d.ts.map +1 -1
  3. package/dist/components/Checkbox/styles.css.d.ts +2 -2
  4. package/dist/components/Checkbox/styles.css.d.ts.map +1 -1
  5. package/dist/components/ColorMode/styles.css.d.ts +2 -2
  6. package/dist/components/ColorMode/styles.css.d.ts.map +1 -1
  7. package/dist/components/Combobox/styles.css.d.ts +2 -2
  8. package/dist/components/Combobox/styles.css.d.ts.map +1 -1
  9. package/dist/components/Dialog/styles.css.d.ts +5 -5
  10. package/dist/components/Dialog/styles.css.d.ts.map +1 -1
  11. package/dist/components/Drawer/styles.css.d.ts +13 -13
  12. package/dist/components/Drawer/styles.css.d.ts.map +1 -1
  13. package/dist/components/Input/styles.css.d.ts +2 -2
  14. package/dist/components/Input/styles.css.d.ts.map +1 -1
  15. package/dist/components/InputGroup/styles.css.d.ts +4 -4
  16. package/dist/components/InputGroup/styles.css.d.ts.map +1 -1
  17. package/dist/components/LinkButton/styles.css.d.ts +2 -2
  18. package/dist/components/LinkButton/styles.css.d.ts.map +1 -1
  19. package/dist/components/Menu/styles.css.d.ts +2 -2
  20. package/dist/components/Menu/styles.css.d.ts.map +1 -1
  21. package/dist/components/RadioGroup/styles.css.d.ts +2 -2
  22. package/dist/components/RadioGroup/styles.css.d.ts.map +1 -1
  23. package/dist/components/ScrollArea/styles.css.d.ts +3 -3
  24. package/dist/components/ScrollArea/styles.css.d.ts.map +1 -1
  25. package/dist/components/Select/styles.css.d.ts +2 -2
  26. package/dist/components/Select/styles.css.d.ts.map +1 -1
  27. package/dist/components/SideNav/styles.css.d.ts +6 -6
  28. package/dist/components/SideNav/styles.css.d.ts.map +1 -1
  29. package/dist/components/Switch/styles.css.d.ts +4 -4
  30. package/dist/components/Switch/styles.css.d.ts.map +1 -1
  31. package/dist/components/Table/styles.css.d.ts +2 -2
  32. package/dist/components/Table/styles.css.d.ts.map +1 -1
  33. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  34. package/dist/components/Tabs/TabsContext.d.ts +2 -0
  35. package/dist/components/Tabs/TabsContext.d.ts.map +1 -1
  36. package/dist/components/Tabs/styles.css.d.ts +33 -2
  37. package/dist/components/Tabs/styles.css.d.ts.map +1 -1
  38. package/dist/components/Tabs/useTabsRoot.d.ts.map +1 -1
  39. package/dist/components/TagGroup/styles.css.d.ts +2 -2
  40. package/dist/components/TagGroup/styles.css.d.ts.map +1 -1
  41. package/dist/components/Textarea/styles.css.d.ts +2 -2
  42. package/dist/components/Textarea/styles.css.d.ts.map +1 -1
  43. package/dist/components/Toast/styles.css.d.ts +1 -1
  44. package/dist/components/Toast/styles.css.d.ts.map +1 -1
  45. package/dist/components/Toggle/styles.css.d.ts +2 -2
  46. package/dist/components/Toggle/styles.css.d.ts.map +1 -1
  47. package/dist/index.css +1 -1
  48. package/dist/index.js +2143 -2066
  49. package/dist/index.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/components/ActionBar/styles.css.ts +3 -2
  52. package/src/components/Checkbox/styles.css.ts +3 -2
  53. package/src/components/ColorMode/styles.css.ts +3 -2
  54. package/src/components/Combobox/styles.css.ts +3 -2
  55. package/src/components/Dialog/styles.css.ts +6 -5
  56. package/src/components/Drawer/styles.css.ts +14 -13
  57. package/src/components/Input/styles.css.ts +3 -2
  58. package/src/components/InputGroup/styles.css.ts +5 -4
  59. package/src/components/LinkButton/styles.css.ts +3 -2
  60. package/src/components/Menu/styles.css.ts +3 -2
  61. package/src/components/RadioGroup/styles.css.ts +3 -2
  62. package/src/components/ScrollArea/styles.css.ts +4 -3
  63. package/src/components/Select/styles.css.ts +3 -2
  64. package/src/components/SideNav/styles.css.ts +7 -6
  65. package/src/components/Switch/styles.css.ts +5 -4
  66. package/src/components/Table/styles.css.ts +3 -2
  67. package/src/components/Tabs/Tabs.tsx +52 -3
  68. package/src/components/Tabs/TabsContext.ts +6 -0
  69. package/src/components/Tabs/styles.css.ts +41 -2
  70. package/src/components/Tabs/useTabsRoot.ts +12 -2
  71. package/src/components/TagGroup/styles.css.ts +3 -2
  72. package/src/components/Textarea/styles.css.ts +3 -2
  73. package/src/components/Toast/styles.css.ts +2 -1
  74. package/src/components/Toggle/styles.css.ts +3 -2
@@ -2,6 +2,7 @@ import {css} from 'react-strict-dom'
2
2
  import {colors} from '@duro-app/tokens/tokens/colors.css'
3
3
  import {spacing, radii} from '@duro-app/tokens/tokens/spacing.css'
4
4
  import {typography} from '@duro-app/tokens/tokens/typography.css'
5
+ import {duration, easing} from '@duro-app/tokens/tokens/motion.css'
5
6
 
6
7
  export const styles = css.create({
7
8
  root: {
@@ -18,6 +19,8 @@ export const styles = css.create({
18
19
  borderBottomStyle: 'solid',
19
20
  borderBottomColor: colors.border,
20
21
  gap: spacing.xs,
22
+ // Positioning context for the sliding indicator.
23
+ position: 'relative',
21
24
  },
22
25
  listVertical: {
23
26
  flexDirection: 'column',
@@ -49,8 +52,8 @@ export const styles = css.create({
49
52
  borderBottomColor: 'transparent',
50
53
  cursor: 'pointer',
51
54
  transitionProperty: 'color, border-color',
52
- transitionDuration: '150ms',
53
- transitionTimingFunction: 'ease',
55
+ transitionDuration: duration.fast,
56
+ transitionTimingFunction: easing.standard,
54
57
  outlineWidth: {
55
58
  default: 0,
56
59
  ':focus-visible': 2,
@@ -83,6 +86,42 @@ export const styles = css.create({
83
86
  color: colors.text,
84
87
  borderRightColor: colors.accent,
85
88
  },
89
+ // Applied to the active tab once JS drives the sliding indicator: drop the
90
+ // per-tab accent border so the single sliding bar is the only underline
91
+ // (avoids a double line and an instant-pop that would undercut the slide).
92
+ tabIndicatorActive: {
93
+ borderBottomColor: 'transparent',
94
+ borderRightColor: 'transparent',
95
+ },
96
+ // --- Sliding active indicator (positioned by measuring the active tab) ---
97
+ indicator: {
98
+ position: 'absolute',
99
+ backgroundColor: colors.accent,
100
+ pointerEvents: 'none',
101
+ transitionProperty: 'transform, width, height',
102
+ transitionDuration: duration.base,
103
+ transitionTimingFunction: easing.easeOut,
104
+ },
105
+ indicatorHorizontal: {
106
+ bottom: -1,
107
+ left: 0,
108
+ height: 2,
109
+ },
110
+ indicatorVertical: {
111
+ right: -1,
112
+ top: 0,
113
+ width: 2,
114
+ },
115
+ // Dynamic transform/size from the measured active tab (StyleX dynamic style:
116
+ // simple identifier params only).
117
+ indicatorOffsetH: (offset: number, size: number) => ({
118
+ transform: `translateX(${offset}px)`,
119
+ width: size,
120
+ }),
121
+ indicatorOffsetV: (offset: number, size: number) => ({
122
+ transform: `translateY(${offset}px)`,
123
+ height: size,
124
+ }),
86
125
  tabDisabled: {
87
126
  opacity: 0.5,
88
127
  cursor: 'not-allowed',
@@ -1,4 +1,4 @@
1
- import {useCallback, useRef} from 'react'
1
+ import {useCallback, useRef, useState} from 'react'
2
2
  import {useControllableValue} from '../../hooks/useControllableValue'
3
3
  import type {Orientation, TabsContextValue} from './TabsContext'
4
4
 
@@ -26,6 +26,7 @@ export function useTabsRoot({
26
26
  )
27
27
  const tabsRef = useRef(new Map<string, boolean>())
28
28
  const orderRef = useRef<string[]>([])
29
+ const [indicatorActive, setIndicatorActive] = useState(false)
29
30
 
30
31
  const registerTab = useCallback((value: string, disabled: boolean) => {
31
32
  tabsRef.current.set(value, disabled)
@@ -38,5 +39,14 @@ export function useTabsRoot({
38
39
  }
39
40
  }, [])
40
41
 
41
- return {activeValue, onSelect, orientation, registerTab, tabsRef, orderRef}
42
+ return {
43
+ activeValue,
44
+ onSelect,
45
+ orientation,
46
+ registerTab,
47
+ tabsRef,
48
+ orderRef,
49
+ indicatorActive,
50
+ setIndicatorActive,
51
+ }
42
52
  }
@@ -2,6 +2,7 @@ import {css} from 'react-strict-dom'
2
2
  import {colors} from '@duro-app/tokens/tokens/colors.css'
3
3
  import {spacing, radii} from '@duro-app/tokens/tokens/spacing.css'
4
4
  import {typography} from '@duro-app/tokens/tokens/typography.css'
5
+ import {duration, easing} from '@duro-app/tokens/tokens/motion.css'
5
6
 
6
7
  export const styles = css.create({
7
8
  root: {
@@ -48,8 +49,8 @@ export const styles = css.create({
48
49
  paddingRight: spacing.sm,
49
50
  minHeight: 40,
50
51
  transitionProperty: 'border-color',
51
- transitionDuration: '150ms',
52
- transitionTimingFunction: 'ease',
52
+ transitionDuration: duration.fast,
53
+ transitionTimingFunction: easing.standard,
53
54
  outlineWidth: {
54
55
  default: 0,
55
56
  ':focus': 2,
@@ -2,6 +2,7 @@ import {css} from 'react-strict-dom'
2
2
  import {colors} from '@duro-app/tokens/tokens/colors.css'
3
3
  import {spacing, radii} from '@duro-app/tokens/tokens/spacing.css'
4
4
  import {typography} from '@duro-app/tokens/tokens/typography.css'
5
+ import {duration, easing} from '@duro-app/tokens/tokens/motion.css'
5
6
 
6
7
  export const styles = css.create({
7
8
  base: {
@@ -20,8 +21,8 @@ export const styles = css.create({
20
21
  borderRadius: radii.sm,
21
22
  resize: 'vertical' as const,
22
23
  transitionProperty: 'border-color',
23
- transitionDuration: '150ms',
24
- transitionTimingFunction: 'ease',
24
+ transitionDuration: duration.fast,
25
+ transitionTimingFunction: easing.standard,
25
26
  outlineWidth: {
26
27
  default: 0,
27
28
  ':focus-visible': 2,
@@ -3,6 +3,7 @@ import {colors} from '@duro-app/tokens/tokens/colors.css'
3
3
  import {spacing, radii} from '@duro-app/tokens/tokens/spacing.css'
4
4
  import {typography} from '@duro-app/tokens/tokens/typography.css'
5
5
  import {shadows} from '@duro-app/tokens/tokens/shadows.css'
6
+ import {easing} from '@duro-app/tokens/tokens/motion.css'
6
7
 
7
8
  const enter = css.keyframes({
8
9
  from: {opacity: 0, transform: 'translateY(10px)'},
@@ -51,7 +52,7 @@ export const styles = css.create({
51
52
  '@media (prefers-reduced-motion: reduce)': 'none',
52
53
  },
53
54
  animationDuration: '160ms',
54
- animationTimingFunction: 'ease-out',
55
+ animationTimingFunction: easing.easeOut,
55
56
  },
56
57
  success: {borderLeftColor: colors.successBorder},
57
58
  error: {borderLeftColor: colors.errorBorder},
@@ -2,6 +2,7 @@ import {css} from 'react-strict-dom'
2
2
  import {colors} from '@duro-app/tokens/tokens/colors.css'
3
3
  import {spacing, radii} from '@duro-app/tokens/tokens/spacing.css'
4
4
  import {typography} from '@duro-app/tokens/tokens/typography.css'
5
+ import {duration, easing} from '@duro-app/tokens/tokens/motion.css'
5
6
 
6
7
  export const styles = css.create({
7
8
  base: {
@@ -14,8 +15,8 @@ export const styles = css.create({
14
15
  fontFamily: typography.fontFamily,
15
16
  fontWeight: typography.fontWeightMedium,
16
17
  transitionProperty: 'background-color, border-color, color, opacity',
17
- transitionDuration: '150ms',
18
- transitionTimingFunction: 'ease',
18
+ transitionDuration: duration.fast,
19
+ transitionTimingFunction: easing.standard,
19
20
  outlineWidth: {default: 0, ':focus-visible': 2},
20
21
  outlineStyle: 'solid',
21
22
  outlineColor: colors.accent,