@tcn/ui 0.12.2 → 0.12.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.
Files changed (165) hide show
  1. package/dist/actions/index.d.ts +0 -2
  2. package/dist/actions/index.d.ts.map +1 -1
  3. package/dist/actions/index.js +6 -10
  4. package/dist/actions/index.js.map +1 -1
  5. package/dist/group.css +1 -0
  6. package/dist/inputs/color_input/color_input.js +2 -4
  7. package/dist/inputs/color_input/color_input.js.map +1 -1
  8. package/dist/inputs/date_picker/date_picker_header.js +20 -22
  9. package/dist/inputs/date_picker/date_picker_header.js.map +1 -1
  10. package/dist/inputs/date_picker/date_picker_input.js +2 -4
  11. package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
  12. package/dist/inputs/date_picker/date_picker_time_selector.js +9 -11
  13. package/dist/inputs/date_picker/date_picker_time_selector.js.map +1 -1
  14. package/dist/inputs/date_picker/date_picker_year_input.js +5 -7
  15. package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
  16. package/dist/inputs/date_picker/date_picker_year_selector.js +2 -4
  17. package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
  18. package/dist/inputs/index.d.ts +2 -0
  19. package/dist/inputs/index.d.ts.map +1 -1
  20. package/dist/inputs/index.js +24 -20
  21. package/dist/inputs/index.js.map +1 -1
  22. package/dist/inputs/multiselect/multiselect_inline_values.js +7 -9
  23. package/dist/inputs/multiselect/multiselect_inline_values.js.map +1 -1
  24. package/dist/inputs/multiselect/multiselect_values.js +2 -4
  25. package/dist/inputs/multiselect/multiselect_values.js.map +1 -1
  26. package/dist/inputs/phone_number_input/phone_number_input_adapter.js +2 -4
  27. package/dist/inputs/phone_number_input/phone_number_input_adapter.js.map +1 -1
  28. package/dist/inputs/phone_number_input/sip_input.js +13 -15
  29. package/dist/inputs/phone_number_input/sip_input.js.map +1 -1
  30. package/dist/inputs/select/select.js +2 -4
  31. package/dist/inputs/select/select.js.map +1 -1
  32. package/dist/{actions/button → inputs}/select_group/select_group.d.ts +1 -1
  33. package/dist/inputs/select_group/select_group.d.ts.map +1 -0
  34. package/dist/{actions/button → inputs}/select_group/select_group.js +3 -3
  35. package/dist/inputs/select_group/select_group.js.map +1 -0
  36. package/dist/inputs/select_group/single_select_group.d.ts.map +1 -0
  37. package/dist/inputs/select_group/single_select_group.js.map +1 -0
  38. package/dist/inputs/suggestions/suggestion_list.js +2 -4
  39. package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
  40. package/dist/layouts/group/group.d.ts +5 -0
  41. package/dist/layouts/group/group.d.ts.map +1 -0
  42. package/dist/layouts/group/group.js +26 -0
  43. package/dist/layouts/group/group.js.map +1 -0
  44. package/dist/layouts/index.d.ts +2 -0
  45. package/dist/layouts/index.d.ts.map +1 -1
  46. package/dist/layouts/index.js +36 -32
  47. package/dist/layouts/index.js.map +1 -1
  48. package/dist/overlay/popper/base/dismissal_decorator.js +6 -6
  49. package/dist/overlay/popper/base/dismissal_decorator.js.map +1 -1
  50. package/dist/overlay/popper/context_popper.d.ts.map +1 -1
  51. package/dist/overlay/popper/context_popper.js +34 -26
  52. package/dist/overlay/popper/context_popper.js.map +1 -1
  53. package/dist/overlay/popper/element_popper.d.ts.map +1 -1
  54. package/dist/overlay/popper/element_popper.js +43 -25
  55. package/dist/overlay/popper/element_popper.js.map +1 -1
  56. package/dist/overlay/tethered/hooks/use_ref_dimensions.d.ts +3 -0
  57. package/dist/overlay/tethered/hooks/use_ref_dimensions.d.ts.map +1 -0
  58. package/dist/overlay/tethered/hooks/use_ref_dimensions.js +26 -0
  59. package/dist/overlay/tethered/hooks/use_ref_dimensions.js.map +1 -0
  60. package/dist/overlay/tethered/hooks/{useTether.d.ts → use_tether.d.ts} +7 -4
  61. package/dist/overlay/tethered/hooks/use_tether.d.ts.map +1 -0
  62. package/dist/overlay/tethered/hooks/{useTether.js → use_tether.js} +19 -15
  63. package/dist/overlay/tethered/hooks/use_tether.js.map +1 -0
  64. package/dist/overlay/tethered/hooks/use_tether_origin.d.ts +10 -0
  65. package/dist/overlay/tethered/hooks/use_tether_origin.d.ts.map +1 -0
  66. package/dist/overlay/tethered/hooks/use_tether_origin.js +22 -0
  67. package/dist/overlay/tethered/hooks/use_tether_origin.js.map +1 -0
  68. package/dist/overlay/tethered/hooks/{calculate_origin.d.ts → utils/calculate_origin.d.ts} +4 -10
  69. package/dist/overlay/tethered/hooks/utils/calculate_origin.d.ts.map +1 -0
  70. package/dist/overlay/tethered/hooks/utils/calculate_origin.js +41 -0
  71. package/dist/overlay/tethered/hooks/utils/calculate_origin.js.map +1 -0
  72. package/dist/overlay/tethered/hooks/{calculate_position.d.ts → utils/calculate_position.d.ts} +2 -2
  73. package/dist/overlay/tethered/hooks/utils/calculate_position.d.ts.map +1 -0
  74. package/dist/overlay/tethered/hooks/utils/calculate_position.js.map +1 -0
  75. package/dist/overlay/tethered/tethered.d.ts.map +1 -1
  76. package/dist/overlay/tethered/tethered.js +63 -62
  77. package/dist/overlay/tethered/tethered.js.map +1 -1
  78. package/dist/select_group.css +1 -1
  79. package/dist/surfaces/alert/alert.d.ts +0 -2
  80. package/dist/surfaces/alert/alert.d.ts.map +1 -1
  81. package/dist/surfaces/alert/alert.js +5 -7
  82. package/dist/surfaces/alert/alert.js.map +1 -1
  83. package/dist/surfaces/confirm/confirm.d.ts +3 -3
  84. package/dist/surfaces/confirm/confirm.d.ts.map +1 -1
  85. package/dist/surfaces/confirm/confirm.js +46 -45
  86. package/dist/surfaces/confirm/confirm.js.map +1 -1
  87. package/dist/surfaces/pop_confirm/pop_confirm.js +11 -9
  88. package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
  89. package/dist/surfaces/tooltip/tooltip.d.ts.map +1 -1
  90. package/dist/surfaces/tooltip/tooltip.js +27 -28
  91. package/dist/surfaces/tooltip/tooltip.js.map +1 -1
  92. package/dist/themes/stories/button_showcase.d.ts.map +1 -1
  93. package/dist/themes/stylesheets/reset.css +1 -1
  94. package/dist/themes/stylesheets/reset.js +3 -3
  95. package/dist/themes/stylesheets/reset.js.map +1 -1
  96. package/dist/themes/themes/ergo/ergo_theme.css +1 -1
  97. package/dist/themes/themes/ergo/ergo_theme.js +128 -12
  98. package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
  99. package/package.json +3 -2
  100. package/src/actions/index.ts +0 -8
  101. package/src/inputs/index.ts +9 -0
  102. package/src/{actions/button/__stories__ → inputs/select_group}/select_group.stories.tsx +5 -26
  103. package/src/{actions/button → inputs}/select_group/select_group.tsx +3 -3
  104. package/src/layouts/bar/bar.stories.tsx +61 -0
  105. package/src/layouts/group/group.module.css +8 -0
  106. package/src/layouts/group/group.tsx +23 -0
  107. package/src/layouts/index.ts +2 -0
  108. package/src/overlay/popper/__stories__/element_popper.stories.tsx +1 -1
  109. package/src/overlay/popper/base/dismissal_decorator.tsx +1 -1
  110. package/src/overlay/popper/context_popper.tsx +7 -3
  111. package/src/overlay/popper/element_popper.tsx +14 -4
  112. package/src/overlay/tethered/__stories__/shared/base_story_config.ts +1 -1
  113. package/src/overlay/tethered/hooks/use_ref_dimensions.ts +32 -0
  114. package/src/overlay/tethered/hooks/{useTether.ts → use_tether.ts} +7 -2
  115. package/src/overlay/tethered/hooks/use_tether_origin.ts +46 -0
  116. package/src/overlay/tethered/hooks/{calculate_origin.ts → utils/calculate_origin.ts} +12 -12
  117. package/src/overlay/tethered/hooks/{calculate_position.ts → utils/calculate_position.ts} +3 -3
  118. package/src/overlay/tethered/tethered.tsx +22 -26
  119. package/src/surfaces/alert/alert.tsx +0 -2
  120. package/src/surfaces/confirm/confirm.tsx +24 -9
  121. package/src/surfaces/pop_confirm/pop_confirm.stories.tsx +206 -6
  122. package/src/surfaces/pop_confirm/pop_confirm.tsx +1 -1
  123. package/src/surfaces/tooltip/__stories__/tooltip.stories.tsx +136 -0
  124. package/src/surfaces/tooltip/__stories__/tooltip_stories.module.css +14 -0
  125. package/src/surfaces/tooltip/tooltip.tsx +6 -2
  126. package/src/themes/stories/button_showcase.tsx +19 -51
  127. package/src/themes/stylesheets/reset.css +3 -3
  128. package/src/themes/themes/ergo/ergo_theme.css +128 -12
  129. package/dist/actions/button/select_group/select_group.d.ts.map +0 -1
  130. package/dist/actions/button/select_group/select_group.js.map +0 -1
  131. package/dist/actions/button/select_group/single_select_group.d.ts.map +0 -1
  132. package/dist/actions/button/select_group/single_select_group.js.map +0 -1
  133. package/dist/overlay/tethered/hooks/calculate_origin.d.ts.map +0 -1
  134. package/dist/overlay/tethered/hooks/calculate_origin.js +0 -41
  135. package/dist/overlay/tethered/hooks/calculate_origin.js.map +0 -1
  136. package/dist/overlay/tethered/hooks/calculate_position.d.ts.map +0 -1
  137. package/dist/overlay/tethered/hooks/calculate_position.js.map +0 -1
  138. package/dist/overlay/tethered/hooks/useCaretRefDimensions.d.ts +0 -9
  139. package/dist/overlay/tethered/hooks/useCaretRefDimensions.d.ts.map +0 -1
  140. package/dist/overlay/tethered/hooks/useCaretRefDimensions.js +0 -14
  141. package/dist/overlay/tethered/hooks/useCaretRefDimensions.js.map +0 -1
  142. package/dist/overlay/tethered/hooks/useTether.d.ts.map +0 -1
  143. package/dist/overlay/tethered/hooks/useTether.js.map +0 -1
  144. package/dist/overlay/tethered/hooks/useTetherContentRect.d.ts +0 -3
  145. package/dist/overlay/tethered/hooks/useTetherContentRect.d.ts.map +0 -1
  146. package/dist/overlay/tethered/hooks/useTetherContentRect.js +0 -36
  147. package/dist/overlay/tethered/hooks/useTetherContentRect.js.map +0 -1
  148. package/dist/overlay/tethered/hooks/useTetherOrigin.d.ts +0 -14
  149. package/dist/overlay/tethered/hooks/useTetherOrigin.d.ts.map +0 -1
  150. package/dist/overlay/tethered/hooks/useTetherOrigin.js +0 -24
  151. package/dist/overlay/tethered/hooks/useTetherOrigin.js.map +0 -1
  152. package/dist/surfaces/popconfirm/pop_confirm.d.ts +0 -5
  153. package/dist/surfaces/popconfirm/pop_confirm.d.ts.map +0 -1
  154. package/dist/surfaces/popconfirm/pop_confirm.js +0 -13
  155. package/dist/surfaces/popconfirm/pop_confirm.js.map +0 -1
  156. package/src/overlay/tethered/hooks/useCaretRefDimensions.ts +0 -22
  157. package/src/overlay/tethered/hooks/useTetherContentRect.ts +0 -49
  158. package/src/overlay/tethered/hooks/useTetherOrigin.ts +0 -49
  159. package/src/surfaces/popconfirm/pop_confirm.tsx +0 -18
  160. package/src/surfaces/tooltip/tooltip.stories.tsx +0 -54
  161. /package/dist/{actions/button → inputs}/select_group/single_select_group.d.ts +0 -0
  162. /package/dist/{actions/button → inputs}/select_group/single_select_group.js +0 -0
  163. /package/dist/overlay/tethered/hooks/{calculate_position.js → utils/calculate_position.js} +0 -0
  164. /package/src/{actions/button → inputs}/select_group/select_group.module.css +0 -0
  165. /package/src/{actions/button → inputs}/select_group/single_select_group.tsx +0 -0
@@ -2,25 +2,35 @@ import { useRef, useState } from 'react';
2
2
  import { Button } from '../../actions/index.js';
3
3
  import { Footer, Header, Section, VBody } from '../../layouts/index.js';
4
4
  import { HStack } from '../../stacks/h_stack.js';
5
- import { PopConfirm as PopConfirmComponent } from './pop_confirm.js';
5
+ import { PopConfirm, type PopConfirmProps } from './pop_confirm.js';
6
6
  import { BodyText, Title } from '../../typography/index.js';
7
7
  import { VStack } from '../../stacks/v_stack.js';
8
8
  import { Spacer } from '../../stacks/spacer.js';
9
+ import { PopperDismissal } from '../../overlay/popper/base/dismissal_decorator.js';
10
+ import {
11
+ tetheredArgs,
12
+ tetheredArgTypes,
13
+ } from '../../overlay/tethered/__stories__/shared/base_story_config.js';
9
14
 
10
15
  export default {
11
16
  title: 'Surfaces/Pop Confirm',
12
- component: PopConfirmComponent,
17
+ component: PopConfirm,
13
18
  tags: ['autodocs'],
14
19
  parameters: {
15
20
  docs: {
16
21
  description: {
17
- component: 'A tooltip component that displays a tooltip when hovered.',
22
+ component:
23
+ 'A confirmation popover triggered by a button. Supports different dismissal behaviors: click away, mouse leave, and scroll away.',
18
24
  },
19
25
  },
20
26
  },
27
+ args: tetheredArgs,
28
+ argTypes: tetheredArgTypes,
21
29
  };
22
30
 
23
- export const DefaultPopConfirm = () => {
31
+ export const DefaultPopConfirm = (
32
+ args: Omit<PopConfirmProps, 'anchorElement' | 'open' | 'onDismissal'>
33
+ ) => {
24
34
  const anchorRef = useRef<HTMLButtonElement>(null);
25
35
  const [open, setOpen] = useState(false);
26
36
 
@@ -42,11 +52,14 @@ export const DefaultPopConfirm = () => {
42
52
  <Button ref={anchorRef} onClick={prompt}>
43
53
  Click to Confirm
44
54
  </Button>
45
- <PopConfirmComponent
55
+ <PopConfirm
46
56
  height={'200px'}
47
57
  open={open}
48
58
  onDismissal={cancel}
49
59
  anchorElement={anchorRef}
60
+ // PopperDismissal.CLICK_AWAY is the default dismissal behavior but shown here for demonstration purposes
61
+ dismissals={[PopperDismissal.CLICK_AWAY]}
62
+ {...args}
50
63
  >
51
64
  <Header>
52
65
  <Title>Confirmation Title</Title>
@@ -65,8 +78,195 @@ export const DefaultPopConfirm = () => {
65
78
  Confirm
66
79
  </Button>
67
80
  </Footer>
68
- </PopConfirmComponent>
81
+ </PopConfirm>
69
82
  </HStack>
70
83
  </VStack>
71
84
  );
72
85
  };
86
+
87
+ DefaultPopConfirm.parameters = {
88
+ docs: {
89
+ description: {
90
+ story:
91
+ 'Closes only when clicking outside the popover. Clicking inside (title, body, or buttons) keeps it open.',
92
+ },
93
+ },
94
+ };
95
+
96
+ export const ManualCloseOnly = () => {
97
+ const anchorRef = useRef<HTMLButtonElement>(null);
98
+ const [open, setOpen] = useState(false);
99
+
100
+ return (
101
+ <VStack hAlign="center" vAlign="center" height="100%" width="100%">
102
+ <HStack hAlign="center" vAlign="center">
103
+ <Button ref={anchorRef} onClick={() => setOpen(true)}>
104
+ Open
105
+ </Button>
106
+ <PopConfirm
107
+ height={'200px'}
108
+ open={open}
109
+ onDismissal={() => setOpen(false)}
110
+ anchorElement={anchorRef}
111
+ dismissals={[]}
112
+ >
113
+ <Header>
114
+ <Title>Must confirm or cancel</Title>
115
+ </Header>
116
+ <VBody>
117
+ <Section>
118
+ <BodyText>
119
+ No automatic dismissal. The popover stays open until you click Cancel or
120
+ Confirm. Clicking or scrolling outside does nothing.
121
+ </BodyText>
122
+ </Section>
123
+ </VBody>
124
+ <Footer>
125
+ <Spacer />
126
+ <Button hierarchy="secondary" onClick={() => setOpen(false)}>
127
+ Cancel
128
+ </Button>
129
+ <Button hierarchy="primary" onClick={() => setOpen(false)}>
130
+ Confirm
131
+ </Button>
132
+ </Footer>
133
+ </PopConfirm>
134
+ </HStack>
135
+ </VStack>
136
+ );
137
+ };
138
+
139
+ ManualCloseOnly.parameters = {
140
+ docs: {
141
+ description: {
142
+ story:
143
+ 'No dismissal behaviors. The popover only closes when the user clicks Cancel or Confirm—clicking outside, scrolling, or moving the pointer away has no effect.',
144
+ },
145
+ },
146
+ };
147
+
148
+ export const MouseLeaveOnly = () => {
149
+ const anchorRef = useRef<HTMLButtonElement>(null);
150
+ const [open, setOpen] = useState(false);
151
+
152
+ return (
153
+ <VStack hAlign="center" vAlign="center" height="100%" width="100%">
154
+ <HStack hAlign="center" vAlign="center">
155
+ <Button ref={anchorRef} onMouseEnter={() => setOpen(true)}>
156
+ Hover to confirm
157
+ </Button>
158
+ <PopConfirm
159
+ height={'200px'}
160
+ open={open}
161
+ onDismissal={() => setOpen(false)}
162
+ anchorElement={anchorRef}
163
+ dismissals={[PopperDismissal.MOUSE_LEAVE]}
164
+ >
165
+ <Header>
166
+ <Title>Confirm action</Title>
167
+ </Header>
168
+ <VBody>
169
+ <Section>
170
+ <BodyText>
171
+ Closes when the pointer leaves the popover and trigger area.
172
+ </BodyText>
173
+ </Section>
174
+ </VBody>
175
+ <Footer>
176
+ <Spacer />
177
+ <Button hierarchy="secondary" onClick={() => setOpen(false)}>
178
+ Cancel
179
+ </Button>
180
+ <Button hierarchy="primary" onClick={() => setOpen(false)}>
181
+ OK
182
+ </Button>
183
+ </Footer>
184
+ </PopConfirm>
185
+ </HStack>
186
+ </VStack>
187
+ );
188
+ };
189
+
190
+ MouseLeaveOnly.parameters = {
191
+ docs: {
192
+ description: {
193
+ story:
194
+ 'Closes when the mouse leaves the region (popover + trigger). No click-away or scroll-away. Suited to hover-triggered flows.',
195
+ },
196
+ },
197
+ };
198
+
199
+ export const ClickAwayAndScrollAway = () => {
200
+ const anchorRef = useRef<HTMLButtonElement>(null);
201
+ const [open, setOpen] = useState(false);
202
+
203
+ return (
204
+ <div
205
+ style={{
206
+ height: '320px',
207
+ overflow: 'auto',
208
+ padding: '16px',
209
+ boxSizing: 'border-box',
210
+ }}
211
+ >
212
+ <VStack gap="24px" padding="16px" style={{ minHeight: '600px' }}>
213
+ <Section>
214
+ <BodyText>
215
+ Scroll down to find the button and open the popover. Then scroll this
216
+ container—the popover will close when you scroll away.
217
+ </BodyText>
218
+ </Section>
219
+ <Spacer />
220
+ <HStack hAlign="center" vAlign="center">
221
+ <Button ref={anchorRef} onClick={() => setOpen(true)}>
222
+ Open
223
+ </Button>
224
+ <PopConfirm
225
+ height={'200px'}
226
+ open={open}
227
+ onDismissal={() => setOpen(false)}
228
+ anchorElement={anchorRef}
229
+ dismissals={[PopperDismissal.CLICK_AWAY, PopperDismissal.SCROLL_AWAY]}
230
+ >
231
+ <Header>
232
+ <Title>Scroll or click away</Title>
233
+ </Header>
234
+ <VBody>
235
+ <Section>
236
+ <BodyText>
237
+ Closes when you click outside or when you scroll outside the popover.
238
+ Scroll the container above or below to see it close.
239
+ </BodyText>
240
+ </Section>
241
+ </VBody>
242
+ <Footer>
243
+ <Spacer />
244
+ <Button hierarchy="secondary" onClick={() => setOpen(false)}>
245
+ Cancel
246
+ </Button>
247
+ <Button hierarchy="primary" onClick={() => setOpen(false)}>
248
+ Confirm
249
+ </Button>
250
+ </Footer>
251
+ </PopConfirm>
252
+ </HStack>
253
+ <Spacer />
254
+ <Section>
255
+ <BodyText>
256
+ More content below. After opening the popover, scroll up or down within this
257
+ panel—the popover dismisses because the scroll happened outside of it.
258
+ </BodyText>
259
+ </Section>
260
+ </VStack>
261
+ </div>
262
+ );
263
+ };
264
+
265
+ ClickAwayAndScrollAway.parameters = {
266
+ docs: {
267
+ description: {
268
+ story:
269
+ 'Closes on outside click or when scrolling outside the popover. This story uses a scrollable container—open the popover, then scroll the panel; the popover dismisses because the scroll happened outside it.',
270
+ },
271
+ },
272
+ };
@@ -14,7 +14,7 @@ export const PopConfirm = React.forwardRef<HTMLDivElement, PopConfirmProps>(
14
14
  {
15
15
  children,
16
16
  className,
17
- precision = 'low',
17
+ precision = 'high',
18
18
  dismissals = [PopperDismissal.CLICK_AWAY],
19
19
  ...props
20
20
  },
@@ -0,0 +1,136 @@
1
+ import { StyleBox } from '../../../stacks/story_components/style_box.js';
2
+ import { ZStack } from '../../../stacks/z_stack.js';
3
+ import { Tooltip as TooltipComponent, type TooltipProps } from '../tooltip.js';
4
+ import {
5
+ tetheredArgs,
6
+ tetheredArgTypes,
7
+ } from '../../../overlay/tethered/__stories__/shared/base_story_config.js';
8
+ import { BodyText, Title } from '../../../typography/index.js';
9
+ import { VStack } from '../../../stacks/v_stack.js';
10
+ import styles from './tooltip_stories.module.css';
11
+
12
+ export default {
13
+ title: 'Surfaces/Tooltip',
14
+ component: TooltipComponent,
15
+ tags: ['autodocs'],
16
+ parameters: {
17
+ docs: {
18
+ description: {
19
+ component: 'A tooltip component that displays a tooltip when hovered.',
20
+ },
21
+ },
22
+ },
23
+ argTypes: tetheredArgTypes,
24
+ args: tetheredArgs,
25
+ };
26
+
27
+ type TooltipStoryProps = TooltipProps & {
28
+ label: string;
29
+ };
30
+ export const DefaultTooltip = ({
31
+ label = 'Tooltip content',
32
+ precision = 'high',
33
+ ...args
34
+ }: TooltipStoryProps) => {
35
+ return (
36
+ <ZStack width="100%" minWidth="400px" minHeight="300px">
37
+ <TooltipComponent label={label} precision={precision} {...args}>
38
+ <StyleBox
39
+ backgroundColor="red"
40
+ padding="8px"
41
+ borderRadius={'8px'}
42
+ width="200px"
43
+ height="100px"
44
+ display="flex"
45
+ justifyContent="center"
46
+ alignItems="center"
47
+ >
48
+ Hover to open
49
+ </StyleBox>
50
+ </TooltipComponent>
51
+ </ZStack>
52
+ );
53
+ };
54
+
55
+ export const CustomTooltip = ({
56
+ label = 'Tooltip content',
57
+ precision = 'high',
58
+ ...args
59
+ }: TooltipStoryProps) => {
60
+ return (
61
+ <ZStack width="100%" minWidth="400px" minHeight="400px">
62
+ <TooltipComponent
63
+ className={styles.tooltip}
64
+ label={
65
+ <VStack
66
+ className={styles.label}
67
+ vAlign="center"
68
+ hAlign="center"
69
+ width="200px"
70
+ height="100px"
71
+ >
72
+ <Title>{label}</Title>
73
+ <BodyText>Custom Tooltip Content</BodyText>
74
+ </VStack>
75
+ }
76
+ precision={precision}
77
+ {...args}
78
+ >
79
+ <StyleBox
80
+ backgroundColor="red"
81
+ padding="8px"
82
+ borderRadius={'8px'}
83
+ width="200px"
84
+ height="100px"
85
+ display="flex"
86
+ justifyContent="center"
87
+ alignItems="center"
88
+ >
89
+ Hover to open
90
+ </StyleBox>
91
+ </TooltipComponent>
92
+ </ZStack>
93
+ );
94
+ };
95
+
96
+ export const CustomTooltipLabel = ({
97
+ label = 'Tooltip content',
98
+ precision = 'high',
99
+ ...args
100
+ }: TooltipStoryProps) => {
101
+ return (
102
+ <ZStack width="100%" minWidth="400px" minHeight="400px">
103
+ <TooltipComponent
104
+ label={
105
+ <VStack
106
+ className="tcn-tooltip-label"
107
+ vAlign="center"
108
+ hAlign="center"
109
+ width="200px"
110
+ height="100px"
111
+ >
112
+ <BodyText>✨ Can have custom children and styles</BodyText>
113
+ <BodyText>
114
+ ✨ But still inherits the themes tooltip label container styles
115
+ </BodyText>
116
+ </VStack>
117
+ }
118
+ precision={precision}
119
+ {...args}
120
+ >
121
+ <StyleBox
122
+ backgroundColor="red"
123
+ padding="8px"
124
+ borderRadius={'8px'}
125
+ width="200px"
126
+ height="100px"
127
+ display="flex"
128
+ justifyContent="center"
129
+ alignItems="center"
130
+ >
131
+ Hover to open
132
+ </StyleBox>
133
+ </TooltipComponent>
134
+ </ZStack>
135
+ );
136
+ };
@@ -0,0 +1,14 @@
1
+ .tooltip {
2
+ --custom-color: #e5735c;
3
+ color: #561a0b;
4
+
5
+ :global(.tcn-tethered-origin-indicator) {
6
+ border-top-color: var(--custom-color);
7
+ }
8
+
9
+ .label {
10
+ background-color: var(--custom-color);
11
+ border-radius: 8px;
12
+ gap: 8px;
13
+ }
14
+ }
@@ -22,7 +22,7 @@ export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(function T
22
22
  verticalOrigin = 'bottom',
23
23
  horizontalAnchor = 'center',
24
24
  horizontalOrigin = 'center',
25
- precision = 'low', // TODO: Fix caret styles and set to high
25
+ precision = 'high',
26
26
  label,
27
27
  ...props
28
28
  },
@@ -54,7 +54,11 @@ export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(function T
54
54
  className={clsx(className, styles.tooltip, 'tcn-surface', 'tcn-tooltip')}
55
55
  {...props}
56
56
  >
57
- {label}
57
+ {typeof label === 'string' ? (
58
+ <span className="tcn-tooltip-label">{label}</span>
59
+ ) : (
60
+ label
61
+ )}
58
62
  </PreviewPopper>
59
63
  </>
60
64
  );
@@ -1,14 +1,7 @@
1
- import { useState } from 'react';
2
1
  import { CrossIcon } from '@tcn/icons/cross_icon.js';
3
2
  import { PhoneIcon } from '@tcn/icons/phone_icon.js';
4
3
  import { BluetoothIcon } from '@tcn/icons/bluetooth_icon.js';
5
- import {
6
- Button,
7
- ButtonGroup,
8
- SelectGroup,
9
- SingleSelectGroup,
10
- SlimButton,
11
- } from '../../actions/index.js';
4
+ import { Button, ButtonGroup } from '../../actions/index.js';
12
5
  import { HStack } from '../../stacks/h_stack.js';
13
6
  import { VStack } from '../../stacks/v_stack.js';
14
7
  import { Spacer } from '../../stacks/spacer.js';
@@ -17,12 +10,6 @@ import { FieldSet } from '../../form/field_set/field_set.js';
17
10
  import { BodyText } from '../../typography/index.js';
18
11
 
19
12
  export function ButtonShowcase() {
20
- const [singleSelectedOptions, setSingleSelectedOptions] = useState<string>('option1');
21
- const [multiselectOptions, setMultiselectOptions] = useState<string[]>([
22
- 'option1',
23
- 'option2',
24
- ]);
25
-
26
13
  return (
27
14
  <FieldSet legend="Button Showcase">
28
15
  {/* Basic Buttons */}
@@ -57,60 +44,41 @@ export function ButtonShowcase() {
57
44
  </VStack>
58
45
  </Field>
59
46
 
60
- {/* Select Groups */}
61
- <Field label="Select Groups">
62
- <VStack width="400px" gap="20px" hAlign="center">
63
- <SingleSelectGroup
64
- value={singleSelectedOptions}
65
- onChange={setSingleSelectedOptions}
66
- >
67
- <option value="option1">Option 1</option>
68
- <option value="option2">Option 2</option>
69
- <option value="option3">Option 3</option>
70
- </SingleSelectGroup>
71
- <SelectGroup value={multiselectOptions} onChange={setMultiselectOptions}>
72
- <option value="option1">Option 1</option>
73
- <option value="option2">Option 2</option>
74
- <option value="option3">Option 3</option>
75
- </SelectGroup>
76
- </VStack>
77
- </Field>
78
-
79
47
  {/* Slim Buttons */}
80
48
  <Field label="Slim Buttons">
81
49
  <VStack width="400px" gap="20px" hAlign="center">
82
50
  <HStack gap="8px" hAlign="center">
83
- <SlimButton size="sm" hierarchy="primary">
51
+ <Button utility size="sm" hierarchy="primary">
84
52
  <CrossIcon size="sm" />
85
- </SlimButton>
86
- <SlimButton size="md" hierarchy="primary">
53
+ </Button>
54
+ <Button utility size="md" hierarchy="primary">
87
55
  <CrossIcon size="md" />
88
- </SlimButton>
89
- <SlimButton size="lg" hierarchy="primary">
56
+ </Button>
57
+ <Button utility size="lg" hierarchy="primary">
90
58
  <CrossIcon size="lg" />
91
- </SlimButton>
59
+ </Button>
92
60
  </HStack>
93
61
  <HStack gap="8px" hAlign="center">
94
- <SlimButton size="sm" hierarchy="secondary">
62
+ <Button utility size="sm" hierarchy="secondary">
95
63
  <PhoneIcon size="sm" />
96
- </SlimButton>
97
- <SlimButton size="md" hierarchy="secondary">
64
+ </Button>
65
+ <Button utility size="md" hierarchy="secondary">
98
66
  <PhoneIcon size="md" />
99
- </SlimButton>
100
- <SlimButton size="lg" hierarchy="secondary">
67
+ </Button>
68
+ <Button utility size="lg" hierarchy="secondary">
101
69
  <PhoneIcon size="lg" />
102
- </SlimButton>
70
+ </Button>
103
71
  </HStack>
104
72
  <HStack gap="8px" hAlign="center">
105
- <SlimButton size="sm" hierarchy="tertiary">
73
+ <Button utility size="sm" hierarchy="tertiary">
106
74
  <BluetoothIcon size="sm" />
107
- </SlimButton>
108
- <SlimButton size="md" hierarchy="tertiary">
75
+ </Button>
76
+ <Button utility size="md" hierarchy="tertiary">
109
77
  <BluetoothIcon size="md" />
110
- </SlimButton>
111
- <SlimButton size="lg" hierarchy="tertiary">
78
+ </Button>
79
+ <Button utility size="lg" hierarchy="tertiary">
112
80
  <BluetoothIcon size="lg" />
113
- </SlimButton>
81
+ </Button>
114
82
  </HStack>
115
83
  </VStack>
116
84
  </Field>
@@ -91,17 +91,17 @@
91
91
  vertical-align: baseline;
92
92
  }
93
93
  /* HTML5 display-role reset for older browsers */
94
+ /* FIXME: sometimes reset breaks stacks display value (flex) */
95
+ /* header, section */
94
96
  article,
95
97
  aside,
96
98
  details,
97
99
  figcaption,
98
100
  figure,
99
101
  footer,
100
- header,
101
102
  hgroup,
102
103
  menu,
103
- nav,
104
- section {
104
+ nav {
105
105
  display: block;
106
106
  }
107
107
  body {