@orfium/ictinus 5.41.1 → 5.41.3
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/.turbo/turbo-build.log +22 -22
- package/CHANGELOG.md +13 -0
- package/dist/components/ThemeProvider/ThemeProvider.style.js +6 -4
- package/dist/src/components/ThemeProvider/ThemeProvider.style.d.ts +1 -3
- package/dist/src/sprinkles/properties.css.d.ts +36 -0
- package/dist/src/sprinkles/sprinkles.d.ts +53 -1
- package/dist/src/vanilla/Box/Box.d.ts +8 -0
- package/dist/src/vanilla/Box/extractBoxProps.d.ts +2 -2
- package/dist/src/vanilla/Table/Table.d.ts +8 -0
- package/dist/src/vanilla/Table/TableBody.d.ts +8 -0
- package/dist/src/vanilla/Table/TableCell.d.ts +8 -0
- package/dist/src/vanilla/Table/TableFooter.d.ts +8 -0
- package/dist/src/vanilla/Table/TableHeader.d.ts +8 -0
- package/dist/src/vanilla/Table/TableHeaderCell.d.ts +8 -0
- package/dist/src/vanilla/Table/TableRow.d.ts +8 -0
- package/dist/src/vanilla/Text/Text.d.ts +10 -2
- package/dist/src/vanilla/Tooltip/Tooltip.css.d.ts +20 -0
- package/dist/src/vanilla/Tooltip/Tooltip.d.ts +21 -0
- package/dist/src/vanilla/Tooltip/index.d.ts +1 -0
- package/dist/src/vanilla/index.d.ts +1 -0
- package/dist/vanilla/Table/Table-css.js +3 -3
- package/dist/vanilla/Table/TableCell-css.js +3 -3
- package/dist/vanilla/Table/TableHeader.js +10 -1
- package/dist/vanilla/Table/TableHeaderCell-css.js +6 -4
- package/dist/vanilla/Table/TableRow-css.js +1 -1
- package/dist/vanilla/Text/Text.js +1 -1
- package/dist/vanilla/Tooltip/Tooltip-css.js +12 -0
- package/dist/vanilla/Tooltip/Tooltip.js +96 -0
- package/dist/vanilla/assets/src/sprinkles/{properties.css.ts.vanilla-BQPG2W33.css → properties.css.ts.vanilla-Ckyezauv.css} +2440 -2410
- package/dist/vanilla/assets/src/vanilla/Table/{TableHeaderCell.css.ts.vanilla-DesAfHw6.css → TableHeaderCell.css.ts.vanilla-DHGpcMTl.css} +4 -1
- package/dist/vanilla/assets/src/vanilla/Tooltip/Tooltip.css.ts.vanilla-nRPDcOsw.css +39 -0
- package/dist/vanilla/index.d.ts +114 -8
- package/dist/vanilla/index.js +1 -0
- package/dist/vanilla/package.json.js +1 -1
- package/dist/vanilla/src/sprinkles/properties-css.js +4 -4
- package/package.json +2 -1
- package/src/components/ThemeProvider/ThemeProvider.style.ts +2 -32
- package/src/sprinkles/properties.css.ts +3 -0
- package/src/vanilla/Table/TableHeader.tsx +6 -1
- package/src/vanilla/Table/TableHeaderCell.css.ts +12 -2
- package/src/vanilla/Text/Text.tsx +4 -4
- package/src/vanilla/Tooltip/Tooltip.css.ts +93 -0
- package/src/vanilla/Tooltip/Tooltip.tsx +144 -0
- package/src/vanilla/Tooltip/index.ts +1 -0
- package/src/vanilla/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orfium/ictinus",
|
|
3
|
-
"version": "5.41.
|
|
3
|
+
"version": "5.41.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@radix-ui/react-slot": "^1.2.3",
|
|
96
|
+
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
96
97
|
"@tanstack/react-table": "^8.21.3",
|
|
97
98
|
"@vanilla-extract/recipes": "^0.5.7",
|
|
98
99
|
"@vanilla-extract/sprinkles": "^1.6.5",
|
|
@@ -1,37 +1,7 @@
|
|
|
1
|
-
import type { SerializedStyles } from '@emotion/react';
|
|
2
1
|
import { css } from '@emotion/react';
|
|
3
|
-
import type { Theme } from 'theme';
|
|
4
|
-
import {
|
|
5
|
-
headline01,
|
|
6
|
-
headline02,
|
|
7
|
-
headline03,
|
|
8
|
-
headline04,
|
|
9
|
-
headline05,
|
|
10
|
-
} from '../Typography/Typography.config.styles';
|
|
11
|
-
|
|
12
|
-
export const globalStyles = (theme: Theme): SerializedStyles => css`
|
|
13
|
-
h1 {
|
|
14
|
-
${headline01(theme)}
|
|
15
|
-
}
|
|
16
|
-
h2 {
|
|
17
|
-
${headline02(theme)}
|
|
18
|
-
}
|
|
19
|
-
h3 {
|
|
20
|
-
${headline03(theme)}
|
|
21
|
-
}
|
|
22
|
-
h4 {
|
|
23
|
-
${headline04(theme)}
|
|
24
|
-
}
|
|
25
|
-
h5 {
|
|
26
|
-
${headline05(theme)}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// default outline for all focused elements defined by the design team
|
|
30
|
-
// our lightGrey base color (500 shade) with opacity at 50%
|
|
31
|
-
*:focus {
|
|
32
|
-
outline: 0;
|
|
33
|
-
}
|
|
34
2
|
|
|
3
|
+
// TODO: View transitions used by toast remove when toast is migrated to vanilla extract
|
|
4
|
+
export const globalStyles = () => css`
|
|
35
5
|
::view-transition-group(*) {
|
|
36
6
|
animation-duration: 250ms;
|
|
37
7
|
/* swift out */
|
|
@@ -284,6 +284,7 @@ export const responsiveProps = defineProperties({
|
|
|
284
284
|
maxWidth: { ...vars.sizing, full: '100%', screen: '100vw' },
|
|
285
285
|
maxHeight: { ...vars.sizing, full: '100%', screen: '100vh' },
|
|
286
286
|
flexDirection: ['column', 'row', 'column-reverse', 'row-reverse'] as const,
|
|
287
|
+
flexShrink: ['0', '1'] as const,
|
|
287
288
|
position: ['absolute', 'fixed', 'relative', 'sticky'] as const,
|
|
288
289
|
gap: vars.spacing,
|
|
289
290
|
gridGap: vars.spacing,
|
|
@@ -345,12 +346,14 @@ export const unresponsiveProps = defineProperties({
|
|
|
345
346
|
fontSize: vars['font-size'],
|
|
346
347
|
typography,
|
|
347
348
|
fontWeight: vars.weight,
|
|
349
|
+
fontStyle: ['italic'] as const,
|
|
348
350
|
lineHeight: vars['line-height'],
|
|
349
351
|
letterSpacing: vars['letter-spacing'],
|
|
350
352
|
isolation: ['isolate'] as const,
|
|
351
353
|
objectFit: ['contain', 'cover'] as const,
|
|
352
354
|
pointerEvents: ['auto', 'none'] as const,
|
|
353
355
|
textTransform: ['capitalize', 'none', 'uppercase'] as const,
|
|
356
|
+
textDecoration: ['underline'] as const,
|
|
354
357
|
visibility: ['hidden', 'visible'] as const,
|
|
355
358
|
wordBreak: ['break-word'] as const,
|
|
356
359
|
wordWrap: ['normal', 'break-word'] as const,
|
|
@@ -8,7 +8,12 @@ export type TableHeaderProps = BoxProps<'thead', NonNullable<styles.HeaderVarian
|
|
|
8
8
|
|
|
9
9
|
export const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(
|
|
10
10
|
({ children, className, pinned, ...props }, ref) => (
|
|
11
|
-
<Box
|
|
11
|
+
<Box
|
|
12
|
+
asChild
|
|
13
|
+
data-pinned={pinned ? '' : undefined}
|
|
14
|
+
className={cn(styles.header({ pinned }), className)}
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
12
17
|
<thead ref={ref}>{children}</thead>
|
|
13
18
|
</Box>
|
|
14
19
|
)
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { vars } from '@orfium/tokens';
|
|
2
1
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
2
|
|
|
4
3
|
import { sprinkles } from '../../sprinkles';
|
|
5
4
|
import { style } from '../../vanilla-extract';
|
|
5
|
+
import * as headerStyles from './TableHeader.css';
|
|
6
|
+
import * as rowStyles from './TableRow.css';
|
|
7
|
+
|
|
8
|
+
const header = headerStyles.className;
|
|
9
|
+
const row = rowStyles.className;
|
|
6
10
|
|
|
7
11
|
export const cell = recipe({
|
|
8
12
|
base: [
|
|
@@ -49,7 +53,13 @@ export const content = recipe({
|
|
|
49
53
|
borderColor: 'decorative.default',
|
|
50
54
|
}),
|
|
51
55
|
style({
|
|
52
|
-
|
|
56
|
+
borderBottomWidth: '1px',
|
|
57
|
+
|
|
58
|
+
selectors: {
|
|
59
|
+
[`${header}:not([data-pinned]) ${row}:last-child &`]: {
|
|
60
|
+
borderBottomWidth: 0,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
53
63
|
}),
|
|
54
64
|
],
|
|
55
65
|
variants: {
|
|
@@ -8,19 +8,19 @@ import * as styles from './Text.css';
|
|
|
8
8
|
|
|
9
9
|
const Slot = createSlot('@orfium/ictinus/Text');
|
|
10
10
|
|
|
11
|
-
export type TextProps<T extends ElementType = '
|
|
11
|
+
export type TextProps<T extends ElementType = 'span', P = unknown> = BoxProps<
|
|
12
12
|
T,
|
|
13
13
|
ExtendProps<styles.TextVariants, P>
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
export const Text = forwardRef<
|
|
16
|
+
export const Text = forwardRef<HTMLSpanElement, TextProps>(
|
|
17
17
|
({ asChild, children, className, lineClamp, truncate, ...props }, ref) => {
|
|
18
|
-
const Comp = asChild ? Slot : '
|
|
18
|
+
const Comp = asChild ? Slot : 'span';
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<Box
|
|
22
22
|
asChild
|
|
23
|
-
ref={ref}
|
|
23
|
+
ref={ref as any} // Box expects HTMLDivElement ref, but asChild forwards to span at runtime
|
|
24
24
|
className={cn(styles.text({ lineClamp, truncate }), className)}
|
|
25
25
|
{...props}
|
|
26
26
|
>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { vars } from '@orfium/tokens';
|
|
2
|
+
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
|
+
|
|
4
|
+
import { sprinkles } from '../../sprinkles';
|
|
5
|
+
import { style } from '../../vanilla-extract';
|
|
6
|
+
|
|
7
|
+
export const tooltip = recipe({
|
|
8
|
+
base: [
|
|
9
|
+
sprinkles({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
p: '4',
|
|
13
|
+
borderRadius: '2',
|
|
14
|
+
typography: 'body03',
|
|
15
|
+
}),
|
|
16
|
+
style({
|
|
17
|
+
transform: 'translate3d(0, 0, 0)',
|
|
18
|
+
transformOrigin: 'var(--trigger-anchor-point)',
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
variants: {
|
|
22
|
+
inverse: {
|
|
23
|
+
true: sprinkles({
|
|
24
|
+
bg: 'alt',
|
|
25
|
+
color: 'primary',
|
|
26
|
+
border: '1',
|
|
27
|
+
borderColor: 'decorative.default',
|
|
28
|
+
boxShadow: '2',
|
|
29
|
+
}),
|
|
30
|
+
false: sprinkles({
|
|
31
|
+
bg: 'inverted',
|
|
32
|
+
color: 'inverted.primary',
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const trigger = style([
|
|
39
|
+
sprinkles({
|
|
40
|
+
cursor: 'default',
|
|
41
|
+
}),
|
|
42
|
+
style({
|
|
43
|
+
background: 'transparent',
|
|
44
|
+
}),
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
export const arrow = recipe({
|
|
48
|
+
base: [
|
|
49
|
+
style({
|
|
50
|
+
display: 'block',
|
|
51
|
+
fill: vars.color.background.inverted,
|
|
52
|
+
|
|
53
|
+
selectors: {
|
|
54
|
+
'[data-placement=bottom] &': {
|
|
55
|
+
transform: 'rotate(180deg)',
|
|
56
|
+
},
|
|
57
|
+
'[data-placement=right] &': {
|
|
58
|
+
transform: 'rotate(90deg) translateY(-5px)',
|
|
59
|
+
},
|
|
60
|
+
'[data-placement=left] &': {
|
|
61
|
+
transform: 'rotate(-90deg) translateY(-5px)',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const arrowInverse = recipe({
|
|
69
|
+
base: [
|
|
70
|
+
style({
|
|
71
|
+
display: 'block',
|
|
72
|
+
fill: vars.color.background.alt,
|
|
73
|
+
|
|
74
|
+
selectors: {
|
|
75
|
+
'[data-placement=bottom] &': {
|
|
76
|
+
transform: 'rotate(180deg)',
|
|
77
|
+
},
|
|
78
|
+
'[data-placement=right] &': {
|
|
79
|
+
transform: 'rotate(90deg) translateY(-5px)',
|
|
80
|
+
},
|
|
81
|
+
'[data-placement=left] &': {
|
|
82
|
+
transform: 'rotate(-90deg) translateY(-5px)',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const arrowInverseBorder = style({
|
|
90
|
+
fill: vars.color['border-color'].decorative.default,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export type TooltipVariants = RecipeVariants<typeof tooltip>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
useContext,
|
|
5
|
+
useRef,
|
|
6
|
+
type ComponentProps,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
type RefObject,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import type { TooltipProps as TooltipPrimitiveProps } from 'react-aria-components';
|
|
11
|
+
import {
|
|
12
|
+
composeRenderProps,
|
|
13
|
+
Focusable,
|
|
14
|
+
OverlayArrow,
|
|
15
|
+
Tooltip as TooltipPrimitive,
|
|
16
|
+
TooltipTrigger as TooltipTriggerPrimitive,
|
|
17
|
+
} from 'react-aria-components';
|
|
18
|
+
|
|
19
|
+
import { cn } from '../../utils/cn';
|
|
20
|
+
import * as styles from './Tooltip.css';
|
|
21
|
+
|
|
22
|
+
const TooltipContext = createContext<{
|
|
23
|
+
triggerRef: RefObject<HTMLElement> | null;
|
|
24
|
+
}>({ triggerRef: null });
|
|
25
|
+
|
|
26
|
+
type TooltipProps = ComponentProps<typeof TooltipTriggerPrimitive> & {
|
|
27
|
+
/**
|
|
28
|
+
* Only show the tooltip when children are partially hidden due to text overflow.
|
|
29
|
+
*/
|
|
30
|
+
auto?: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const Tooltip = ({
|
|
34
|
+
delay = 500,
|
|
35
|
+
auto = false,
|
|
36
|
+
defaultOpen = false,
|
|
37
|
+
onOpenChange,
|
|
38
|
+
isOpen: openProp,
|
|
39
|
+
...props
|
|
40
|
+
}: TooltipProps) => {
|
|
41
|
+
const triggerRef = useRef<HTMLElement>(null);
|
|
42
|
+
const [open, setOpen] = useControllableState({
|
|
43
|
+
caller: 'Tooltip',
|
|
44
|
+
defaultProp: defaultOpen,
|
|
45
|
+
onChange: onOpenChange,
|
|
46
|
+
prop: openProp,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<TooltipContext.Provider value={{ triggerRef }}>
|
|
51
|
+
<TooltipTriggerPrimitive
|
|
52
|
+
delay={delay}
|
|
53
|
+
defaultOpen={auto ? open : defaultOpen}
|
|
54
|
+
isDisabled={auto && openProp === undefined ? undefined : props.isDisabled}
|
|
55
|
+
isOpen={auto ? open : openProp}
|
|
56
|
+
onOpenChange={(isOpen) => {
|
|
57
|
+
if (auto && isOpen && triggerRef.current && !hasTruncatedContent(triggerRef.current)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setOpen(isOpen);
|
|
62
|
+
}}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
</TooltipContext.Provider>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
Tooltip.displayName = 'Tooltip';
|
|
70
|
+
|
|
71
|
+
interface TooltipContentProps
|
|
72
|
+
extends Omit<TooltipPrimitiveProps, 'children'>,
|
|
73
|
+
NonNullable<styles.TooltipVariants> {
|
|
74
|
+
showArrow?: boolean;
|
|
75
|
+
children?: ReactNode;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const TooltipContent = ({
|
|
79
|
+
offset = 8,
|
|
80
|
+
inverse = false,
|
|
81
|
+
showArrow = true,
|
|
82
|
+
children,
|
|
83
|
+
...props
|
|
84
|
+
}: TooltipContentProps) => {
|
|
85
|
+
return (
|
|
86
|
+
<TooltipPrimitive
|
|
87
|
+
{...props}
|
|
88
|
+
offset={offset}
|
|
89
|
+
className={composeRenderProps(props.className, (className) =>
|
|
90
|
+
cn(styles.tooltip({ inverse }), className)
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
{showArrow && (
|
|
94
|
+
<OverlayArrow>
|
|
95
|
+
{inverse ? (
|
|
96
|
+
<svg width={18} height={8} viewBox="0 0 18 8" className={styles.arrowInverse()}>
|
|
97
|
+
<path d="M9.00744 6.52304L1.6397 0.000488281L16.3752 0.000489658L9.00744 6.52304Z" />
|
|
98
|
+
<path
|
|
99
|
+
d="M9.00337 6.51095L16.3588 0.00158653H18.0034L9.00337 8.00049L0.00337219 0.00158653L1.6397 0.000488281L9.00337 6.51095Z"
|
|
100
|
+
className={styles.arrowInverseBorder}
|
|
101
|
+
/>
|
|
102
|
+
</svg>
|
|
103
|
+
) : (
|
|
104
|
+
<svg width={15} height={6} viewBox="0 0 15 6" className={styles.arrow()}>
|
|
105
|
+
<path d="M7.5 6L0.500001 -1.22392e-06L14.5 0L7.5 6Z" />
|
|
106
|
+
</svg>
|
|
107
|
+
)}
|
|
108
|
+
</OverlayArrow>
|
|
109
|
+
)}
|
|
110
|
+
{children}
|
|
111
|
+
</TooltipPrimitive>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
function TooltipTrigger({ ...props }: ComponentProps<typeof Focusable>) {
|
|
116
|
+
const { triggerRef } = useContext(TooltipContext);
|
|
117
|
+
|
|
118
|
+
return <Focusable ref={triggerRef} data-slot="tooltip-trigger" {...props} />;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const hasTruncatedContent = (element: HTMLElement) => {
|
|
122
|
+
let truncated = false;
|
|
123
|
+
|
|
124
|
+
const elements: Element[] = [element];
|
|
125
|
+
while (!truncated && elements.length) {
|
|
126
|
+
const element = elements.shift();
|
|
127
|
+
if (!(element instanceof HTMLElement)) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const { offsetHeight, offsetWidth, scrollHeight, scrollWidth } = element;
|
|
131
|
+
|
|
132
|
+
if (offsetWidth < scrollWidth || offsetHeight < scrollHeight) {
|
|
133
|
+
truncated = true;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
elements.push(...element.children);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return truncated;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export { Tooltip, TooltipContent, TooltipTrigger };
|
|
144
|
+
export type { TooltipContentProps, TooltipProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tooltip';
|
package/src/vanilla/index.ts
CHANGED