@mrpelz/uikit-ish 7.8.0 → 7.9.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.
- package/dist/components/accordion/main.d.ts +12 -0
- package/dist/components/accordion/main.d.ts.map +1 -0
- package/dist/components/accordion/main.js +20 -0
- package/dist/components/accordion/main.js.map +1 -0
- package/dist/components/accordion/style.css +23 -0
- package/dist/components/action-sheet/main.d.ts +22 -15
- package/dist/components/action-sheet/main.d.ts.map +1 -1
- package/dist/components/action-sheet/main.js +86 -16
- package/dist/components/action-sheet/main.js.map +1 -1
- package/dist/components/action-sheet/props.d.ts +17 -5
- package/dist/components/action-sheet/props.d.ts.map +1 -1
- package/dist/components/action-sheet/style.css +15 -0
- package/dist/components/activity-view/main.d.ts +14 -3
- package/dist/components/activity-view/main.d.ts.map +1 -1
- package/dist/components/activity-view/main.js +19 -4
- package/dist/components/activity-view/main.js.map +1 -1
- package/dist/components/activity-view/props.d.ts +2 -10
- package/dist/components/activity-view/props.d.ts.map +1 -1
- package/dist/components/activity-view/style.css +8 -46
- package/dist/components/alert/main.d.ts +6 -4
- package/dist/components/alert/main.d.ts.map +1 -1
- package/dist/components/alert/main.js +20 -4
- package/dist/components/alert/main.js.map +1 -1
- package/dist/components/alert/props.d.ts +12 -1
- package/dist/components/alert/props.d.ts.map +1 -1
- package/dist/components/alert/style.css +13 -27
- package/dist/components/avatar/main.d.ts +5 -3
- package/dist/components/avatar/main.d.ts.map +1 -1
- package/dist/components/avatar/main.js +3 -0
- package/dist/components/avatar/main.js.map +1 -1
- package/dist/components/avatar/props.d.ts +4 -0
- package/dist/components/avatar/props.d.ts.map +1 -1
- package/dist/components/avatar/style.css +0 -6
- package/dist/components/badge/main.d.ts +2 -2
- package/dist/components/badge/main.d.ts.map +1 -1
- package/dist/components/badge/main.js +5 -5
- package/dist/components/badge/main.js.map +1 -1
- package/dist/components/badge/props.d.ts +4 -3
- package/dist/components/badge/props.d.ts.map +1 -1
- package/dist/components/badge/style.css +3 -2
- package/dist/components/button/main.d.ts.map +1 -1
- package/dist/components/button/main.js +6 -6
- package/dist/components/button/main.js.map +1 -1
- package/dist/components/button/style.css +11 -27
- package/dist/components/checkbox/style.css +2 -5
- package/dist/components/collapsible/main.d.ts +9 -0
- package/dist/components/collapsible/main.d.ts.map +1 -0
- package/dist/components/collapsible/main.js +19 -0
- package/dist/components/collapsible/main.js.map +1 -0
- package/dist/components/collapsible/style.css +23 -0
- package/dist/components/color-picker/main.d.ts +1 -1
- package/dist/components/color-picker/main.d.ts.map +1 -1
- package/dist/components/color-picker/main.js +40 -33
- package/dist/components/color-picker/main.js.map +1 -1
- package/dist/components/color-picker/props.d.ts +21 -7
- package/dist/components/color-picker/props.d.ts.map +1 -1
- package/dist/components/color-picker/style.css +9 -27
- package/dist/components/contextual-menu/main.d.ts +11 -7
- package/dist/components/contextual-menu/main.d.ts.map +1 -1
- package/dist/components/contextual-menu/main.js +99 -47
- package/dist/components/contextual-menu/main.js.map +1 -1
- package/dist/components/contextual-menu/props.d.ts +17 -7
- package/dist/components/contextual-menu/props.d.ts.map +1 -1
- package/dist/components/contextual-menu/style.css +11 -8
- package/dist/components/date-picker/handle.d.ts +41 -0
- package/dist/components/date-picker/handle.d.ts.map +1 -0
- package/dist/components/date-picker/handle.js +47 -0
- package/dist/components/date-picker/handle.js.map +1 -0
- package/dist/components/date-picker/main.d.ts +31 -49
- package/dist/components/date-picker/main.d.ts.map +1 -1
- package/dist/components/date-picker/main.js +300 -139
- package/dist/components/date-picker/main.js.map +1 -1
- package/dist/components/date-picker/pager.d.ts +24 -0
- package/dist/components/date-picker/pager.d.ts.map +1 -0
- package/dist/components/date-picker/pager.js +307 -0
- package/dist/components/date-picker/pager.js.map +1 -0
- package/dist/components/date-picker/props.d.ts +93 -22
- package/dist/components/date-picker/props.d.ts.map +1 -1
- package/dist/components/date-picker/style.css +59 -71
- package/dist/components/drawer/main.d.ts +31 -0
- package/dist/components/drawer/main.d.ts.map +1 -0
- package/dist/components/drawer/main.js +74 -0
- package/dist/components/drawer/main.js.map +1 -0
- package/dist/components/drawer/props.d.ts +39 -0
- package/dist/components/drawer/props.d.ts.map +1 -0
- package/dist/components/drawer/props.js +2 -0
- package/dist/components/drawer/props.js.map +1 -0
- package/dist/components/drawer/style.css +135 -0
- package/dist/components/edit-menu/main.d.ts +7 -7
- package/dist/components/edit-menu/main.d.ts.map +1 -1
- package/dist/components/edit-menu/main.js +31 -23
- package/dist/components/edit-menu/main.js.map +1 -1
- package/dist/components/edit-menu/props.d.ts +13 -0
- package/dist/components/edit-menu/props.d.ts.map +1 -1
- package/dist/components/edit-menu/style.css +5 -7
- package/dist/components/form/main.d.ts +8 -0
- package/dist/components/form/main.d.ts.map +1 -1
- package/dist/components/form/main.js +15 -2
- package/dist/components/form/main.js.map +1 -1
- package/dist/components/form/props.d.ts +1 -2
- package/dist/components/form/props.d.ts.map +1 -1
- package/dist/components/glass/style.css +19 -4
- package/dist/components/header/main.d.ts +5 -4
- package/dist/components/header/main.d.ts.map +1 -1
- package/dist/components/header/main.js +56 -27
- package/dist/components/header/main.js.map +1 -1
- package/dist/components/header/props.d.ts +2 -3
- package/dist/components/header/props.d.ts.map +1 -1
- package/dist/components/header/style.css +62 -42
- package/dist/components/index.d.ts +26 -22
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +17 -13
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/main.d.ts +2 -2
- package/dist/components/layout/main.d.ts.map +1 -1
- package/dist/components/layout/main.js +59 -163
- package/dist/components/layout/main.js.map +1 -1
- package/dist/components/layout/props.d.ts +2 -20
- package/dist/components/layout/props.d.ts.map +1 -1
- package/dist/components/layout/style.css +18 -89
- package/dist/components/list/main.d.ts +49 -9
- package/dist/components/list/main.d.ts.map +1 -1
- package/dist/components/list/main.js +769 -208
- package/dist/components/list/main.js.map +1 -1
- package/dist/components/list/props.d.ts +165 -8
- package/dist/components/list/props.d.ts.map +1 -1
- package/dist/components/list/style.css +308 -371
- package/dist/components/list/swipe-actions-handle.d.ts +40 -0
- package/dist/components/list/swipe-actions-handle.d.ts.map +1 -0
- package/dist/components/list/swipe-actions-handle.js +51 -0
- package/dist/components/list/swipe-actions-handle.js.map +1 -0
- package/dist/components/menu/main.d.ts +31 -8
- package/dist/components/menu/main.d.ts.map +1 -1
- package/dist/components/menu/main.js +175 -39
- package/dist/components/menu/main.js.map +1 -1
- package/dist/components/menu/props.d.ts +2 -1
- package/dist/components/menu/props.d.ts.map +1 -1
- package/dist/components/menu/style.css +10 -32
- package/dist/components/navigation/main.d.ts +11 -2
- package/dist/components/navigation/main.d.ts.map +1 -1
- package/dist/components/navigation/main.js +186 -98
- package/dist/components/navigation/main.js.map +1 -1
- package/dist/components/navigation/props.d.ts +20 -3
- package/dist/components/navigation/props.d.ts.map +1 -1
- package/dist/components/navigation/style.css +24 -7
- package/dist/components/page/main.d.ts.map +1 -1
- package/dist/components/page/main.js +2 -2
- package/dist/components/page/main.js.map +1 -1
- package/dist/components/page/props.d.ts +8 -0
- package/dist/components/page/props.d.ts.map +1 -1
- package/dist/components/page/style.css +39 -1
- package/dist/components/page-control/main.d.ts +1 -1
- package/dist/components/page-control/main.d.ts.map +1 -1
- package/dist/components/page-control/main.js +59 -25
- package/dist/components/page-control/main.js.map +1 -1
- package/dist/components/page-control/props.d.ts +10 -2
- package/dist/components/page-control/props.d.ts.map +1 -1
- package/dist/components/page-control/style.css +5 -0
- package/dist/components/popover/main.d.ts +11 -6
- package/dist/components/popover/main.d.ts.map +1 -1
- package/dist/components/popover/main.js +53 -31
- package/dist/components/popover/main.js.map +1 -1
- package/dist/components/popover/props.d.ts +7 -6
- package/dist/components/popover/props.d.ts.map +1 -1
- package/dist/components/popover/style.css +45 -4
- package/dist/components/progress/main.d.ts +1 -1
- package/dist/components/progress/main.d.ts.map +1 -1
- package/dist/components/progress/main.js +108 -15
- package/dist/components/progress/main.js.map +1 -1
- package/dist/components/progress/props.d.ts +25 -5
- package/dist/components/progress/props.d.ts.map +1 -1
- package/dist/components/progress/style.css +67 -35
- package/dist/components/roll/main.d.ts +1 -1
- package/dist/components/roll/main.d.ts.map +1 -1
- package/dist/components/roll/main.js +81 -25
- package/dist/components/roll/main.js.map +1 -1
- package/dist/components/roll/props.d.ts +24 -7
- package/dist/components/roll/props.d.ts.map +1 -1
- package/dist/components/roll/style.css +1 -13
- package/dist/components/segmented/main.js +3 -3
- package/dist/components/segmented/main.js.map +1 -1
- package/dist/components/segmented/style.css +2 -14
- package/dist/components/sheet/main.d.ts +25 -15
- package/dist/components/sheet/main.d.ts.map +1 -1
- package/dist/components/sheet/main.js +57 -73
- package/dist/components/sheet/main.js.map +1 -1
- package/dist/components/sheet/props.d.ts +36 -2
- package/dist/components/sheet/props.d.ts.map +1 -1
- package/dist/components/sheet/style.css +176 -44
- package/dist/components/sidebar/style.css +13 -7
- package/dist/components/slider/main.d.ts.map +1 -1
- package/dist/components/slider/main.js +6 -5
- package/dist/components/slider/main.js.map +1 -1
- package/dist/components/slider/style.css +2 -28
- package/dist/components/stepper/main.d.ts +4 -6
- package/dist/components/stepper/main.d.ts.map +1 -1
- package/dist/components/stepper/main.js +17 -11
- package/dist/components/stepper/main.js.map +1 -1
- package/dist/components/stepper/style.css +4 -8
- package/dist/components/switch/main.d.ts.map +1 -1
- package/dist/components/switch/main.js +16 -11
- package/dist/components/switch/main.js.map +1 -1
- package/dist/components/switch/props.d.ts +2 -2
- package/dist/components/switch/props.d.ts.map +1 -1
- package/dist/components/switch/style.css +28 -1
- package/dist/components/symbol/main.d.ts +2 -2
- package/dist/components/symbol/main.d.ts.map +1 -1
- package/dist/components/symbol/main.js +34 -27
- package/dist/components/symbol/main.js.map +1 -1
- package/dist/components/symbol/props.d.ts +39 -4
- package/dist/components/symbol/props.d.ts.map +1 -1
- package/dist/components/symbol/style.css +25 -4
- package/dist/components/tab-bar/main.d.ts.map +1 -1
- package/dist/components/tab-bar/main.js +59 -46
- package/dist/components/tab-bar/main.js.map +1 -1
- package/dist/components/tab-bar/props.d.ts +3 -3
- package/dist/components/tab-bar/props.d.ts.map +1 -1
- package/dist/components/tab-bar/style.css +24 -46
- package/dist/components/text-field/main.d.ts.map +1 -1
- package/dist/components/text-field/main.js +9 -8
- package/dist/components/text-field/main.js.map +1 -1
- package/dist/components/text-field/props.d.ts +8 -1
- package/dist/components/text-field/props.d.ts.map +1 -1
- package/dist/components/text-field/style.css +21 -55
- package/dist/components/toolbar/main.d.ts.map +1 -1
- package/dist/components/toolbar/main.js +11 -9
- package/dist/components/toolbar/main.js.map +1 -1
- package/dist/components/toolbar/style.css +28 -22
- package/dist/components/tooltip/main.d.ts +10 -9
- package/dist/components/tooltip/main.d.ts.map +1 -1
- package/dist/components/tooltip/main.js +35 -6
- package/dist/components/tooltip/main.js.map +1 -1
- package/dist/components/tooltip/props.d.ts +2 -0
- package/dist/components/tooltip/props.d.ts.map +1 -1
- package/dist/components/tooltip/style.css +11 -11
- package/dist/components/typography/main.d.ts.map +1 -1
- package/dist/components/typography/main.js +16 -6
- package/dist/components/typography/main.js.map +1 -1
- package/dist/components/typography/props.d.ts +2 -9
- package/dist/components/typography/props.d.ts.map +1 -1
- package/dist/components/typography/style.css +0 -120
- package/dist/components/utils/main.d.ts +34 -5
- package/dist/components/utils/main.d.ts.map +1 -1
- package/dist/components/utils/main.js +81 -12
- package/dist/components/utils/main.js.map +1 -1
- package/dist/components/utils/props.d.ts +4 -2
- package/dist/components/utils/props.d.ts.map +1 -1
- package/dist/components/utils/style.css +29 -16
- package/dist/components/viewport/input.d.ts +23 -0
- package/dist/components/viewport/input.d.ts.map +1 -0
- package/dist/components/viewport/input.js +95 -0
- package/dist/components/viewport/input.js.map +1 -0
- package/dist/components/viewport/main.d.ts +42 -9
- package/dist/components/viewport/main.d.ts.map +1 -1
- package/dist/components/viewport/main.js +488 -66
- package/dist/components/viewport/main.js.map +1 -1
- package/dist/components/viewport/padding.d.ts +50 -0
- package/dist/components/viewport/padding.d.ts.map +1 -0
- package/dist/components/viewport/padding.js +226 -0
- package/dist/components/viewport/padding.js.map +1 -0
- package/dist/components/viewport/props.d.ts +155 -7
- package/dist/components/viewport/props.d.ts.map +1 -1
- package/dist/components/viewport/style.css +172 -6
- package/dist/main.d.ts +0 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js.map +1 -1
- package/dist/styles.css +35 -2
- package/dist/styles.d.ts +2 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +2 -1
- package/dist/styles.js.map +1 -1
- package/package.json +6 -13
|
@@ -3,8 +3,8 @@ import '../glass/style.css';
|
|
|
3
3
|
import '../typography/style.css';
|
|
4
4
|
import './style.css';
|
|
5
5
|
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
6
|
-
import { forwardRef } from 'react';
|
|
7
|
-
import { cn, positionerSide, useForwardedRef } from '../utils/main.js';
|
|
6
|
+
import { createContext, forwardRef, useContext, useState, } from 'react';
|
|
7
|
+
import { cn, positionerSide, useCollision, useForwardedRef, usePortalContainer, } from '../utils/main.js';
|
|
8
8
|
// No Figma (iOS has no tooltips; Framework7's: a dark panel, white text,
|
|
9
9
|
// 4px corners): in iOS 26's language, a capsule of the menus' glass (see
|
|
10
10
|
// `Menu`), its text Subheadline in the glass' content color, 6px by 12px
|
|
@@ -17,21 +17,50 @@ import { cn, positionerSide, useForwardedRef } from '../utils/main.js';
|
|
|
17
17
|
// in a popover). Held open (`open`), anchored to any element (`anchor`), it
|
|
18
18
|
// labels something for good, on touch too (e.g. a slider's thumb, a
|
|
19
19
|
// progress bar's fill).
|
|
20
|
-
|
|
21
|
-
const
|
|
20
|
+
// Whether its trigger is in a `Provider` (its delay the provider's).
|
|
21
|
+
const ProvidedContext = createContext(false);
|
|
22
|
+
/** Base UI's provider: its tooltips' delays shared (see `Trigger`). */
|
|
23
|
+
const Provider = (props) => (_jsx(ProvidedContext.Provider, { value: true, children: _jsx(BaseTooltip.Provider, { ...props }) }));
|
|
24
|
+
/**
|
|
25
|
+
* Its trigger, opening it after 300ms (Base UI: 600ms) of hovering; in a
|
|
26
|
+
* `Provider`, after the provider's delay.
|
|
27
|
+
*/
|
|
28
|
+
const Trigger = forwardRef(({ delay, ...props }, ref) => {
|
|
29
|
+
const isProvided = useContext(ProvidedContext);
|
|
22
30
|
const triggerRef = useForwardedRef(ref);
|
|
23
|
-
return (_jsx(BaseTooltip.Trigger, { ref: triggerRef, delay: delay, ...props }));
|
|
31
|
+
return (_jsx(BaseTooltip.Trigger, { ref: triggerRef, delay: delay ?? (isProvided ? undefined : 300), ...props }));
|
|
24
32
|
});
|
|
25
|
-
const Positioner = forwardRef(({
|
|
33
|
+
const Positioner = forwardRef(({ className, collisionBoundary, collisionPadding, side, sideOffset = 8, ...props }, ref) => (_jsx(BaseTooltip.Positioner, { ref: ref, ...useCollision({ collisionBoundary, collisionPadding }), side: positionerSide(side), sideOffset: sideOffset, ...props, className: cn('uikit-tooltip-positioner', className) })));
|
|
26
34
|
const Popup = forwardRef(({ className, ...props }, ref) => (_jsx(BaseTooltip.Popup, { ref: ref, "data-tooltip-part": "popup", className: cn('uikit-tooltip-popup uikit-tooltip-surface uikit-glass-medium uikit-popup-transition', className), ...props })));
|
|
35
|
+
/**
|
|
36
|
+
* A handle linking a tooltip to its triggers outside it, and opening or
|
|
37
|
+
* closing it imperatively (Base UI's `Tooltip.createHandle`): pass it to
|
|
38
|
+
* the root's and the triggers' `handle` (in a component, see
|
|
39
|
+
* `useCreateTooltipHandle`).
|
|
40
|
+
*/
|
|
41
|
+
const createHandle = () => BaseTooltip.createHandle();
|
|
42
|
+
/** `Tooltip.createHandle`, in a component: made once, for its lifetime. */
|
|
43
|
+
export const useCreateTooltipHandle = () => {
|
|
44
|
+
const [handle] = useState(() => createHandle());
|
|
45
|
+
return handle;
|
|
46
|
+
};
|
|
27
47
|
/**
|
|
28
48
|
* A tooltip (Base UI's `Tooltip`; no UIKit equivalent): a short label in a
|
|
29
49
|
* glass capsule at its trigger, on hover and focus, or held open.
|
|
30
50
|
*/
|
|
51
|
+
/**
|
|
52
|
+
* Its portal (Base UI's): no box of its own (`display: contents`), so
|
|
53
|
+
* rendered into a container (e.g. a screen laid out as a flex column) it
|
|
54
|
+
* doesn't shift its content.
|
|
55
|
+
*/
|
|
56
|
+
const Portal = forwardRef(({ className, container, ...props }, ref) => (_jsx(BaseTooltip.Portal, { ref: ref, container: usePortalContainer(container), ...props, className: cn('uikit-tooltip-portal', className) })));
|
|
31
57
|
export const Tooltip = {
|
|
32
58
|
...BaseTooltip,
|
|
59
|
+
Provider,
|
|
60
|
+
Portal,
|
|
33
61
|
Trigger,
|
|
34
62
|
Positioner,
|
|
35
63
|
Popup,
|
|
64
|
+
createHandle,
|
|
36
65
|
};
|
|
37
66
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/tooltip/main.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,yBAAyB,CAAC;AACjC,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/tooltip/main.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,yBAAyB,CAAC;AACjC,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAEL,aAAa,EACb,UAAU,EAEV,UAAU,EACV,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,EAAE,EACF,cAAc,EACd,YAAY,EACZ,eAAe,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAa1B,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,EAAE;AACF,oEAAoE;A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AGtB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,WAAW,CAAC,KAAK,IAChB,GAAG,EAAE,GAAG,uBACU,OAAO,EACzB,SAAS,EAAE,EAAE,CACX,qFAAqF,EACrF,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,YAAY,GAAG,GAA+C,EAAE,CACpE,WAAW,CAAC,YAAY,EAAW,CAAC;AAEtC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAEV,EAAE;IAC5B,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,YAAY,EAAW,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACH;;;;GAIG;AACH,MAAM,MAAM,GAAG,UAAU,CAGvB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC7C,KAAC,WAAW,CAAC,MAAM,IACjB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC,KACpC,KAAK,EACT,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,GAChD,CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,GAAG,WAAW;IACd,QAAQ;IACR,MAAM;IACN,OAAO;IACP,UAAU;IACV,KAAK;IACL,YAAY;CACb,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
2
2
|
import type { LogicalSide } from '../utils/main.js';
|
|
3
3
|
export type TooltipTriggerProps = Omit<BaseTooltip.Trigger.Props, 'ref'>;
|
|
4
|
+
/** A handle linking a tooltip to its triggers outside it. */
|
|
5
|
+
export type TooltipHandle<Payload = unknown> = BaseTooltip.Handle<Payload>;
|
|
4
6
|
export type TooltipPositionerProps = Omit<BaseTooltip.Positioner.Props, 'ref' | 'side'> & {
|
|
5
7
|
/**
|
|
6
8
|
* Its side of its anchor (logical).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAEzE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,WAAW,CAAC,UAAU,CAAC,KAAK,EAC5B,KAAK,GAAG,MAAM,CACf,GAAG;IACF;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAEzE,6DAA6D;AAC7D,MAAM,MAAM,aAAa,CAAC,OAAO,GAAG,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAE3E,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,WAAW,CAAC,UAAU,CAAC,KAAK,EAC5B,KAAK,GAAG,MAAM,CACf,GAAG;IACF;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/* Tooltip (see main.tsx). */
|
|
2
2
|
@layer uikit-ish {
|
|
3
|
+
/* Its portal (see Portal): no box of its own. */
|
|
4
|
+
.uikit-tooltip-portal {
|
|
5
|
+
display: contents;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.uikit-tooltip-positioner {
|
|
9
|
+
/* An overlay: above the page's layers (e.g. Viewport's bars), overlays
|
|
10
|
+
among themselves in the order they open (see Menu). */
|
|
11
|
+
z-index: 100;
|
|
12
|
+
}
|
|
13
|
+
|
|
3
14
|
/* (Shared: page-control, progress, slider.) */
|
|
4
15
|
.uikit-tooltip-surface {
|
|
5
16
|
max-width: min(320px, calc(100vw - 16px));
|
|
@@ -14,16 +25,5 @@
|
|
|
14
25
|
letter-spacing: var(--font-ios-subheadline-tracking);
|
|
15
26
|
line-height: var(--font-ios-subheadline-line-height);
|
|
16
27
|
pointer-events: none;
|
|
17
|
-
stroke: currentcolor;
|
|
18
|
-
stroke-linejoin: round;
|
|
19
|
-
stroke-width: max(
|
|
20
|
-
0px,
|
|
21
|
-
(var(--font-ios-subheadline-weight) - 400) / 326 * 1px
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
--uikit-symbol-thinning: max(
|
|
25
|
-
0px,
|
|
26
|
-
(400 - var(--font-ios-subheadline-weight)) / 326 * 1px
|
|
27
|
-
);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/typography/main.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/typography/main.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAMrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,YAAY,EACV,eAAe,EACf,SAAS,EACT,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC;AAcpB,iEAAiE;AACjE,eAAO,MAAM,UAAU;;EA4BtB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import './style.css';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { cn
|
|
4
|
+
import { cn } from '../utils/main.js';
|
|
5
5
|
// Source: Apple iOS 26 Figma (“Typography”: “Text styles” in the label
|
|
6
6
|
// colors, “Dynamic Type”, “Dynamic Type – Accessibility Sizes”); HIG
|
|
7
7
|
// (Typography). The text styles' tokens (`--font-ios-*`) are declared in
|
|
@@ -14,8 +14,18 @@ import { cn, withStyle } from '../utils/main.js';
|
|
|
14
14
|
// Title 1) and Title 3 at AX4 (43/51, as at AX3), Title 2 at Medium
|
|
15
15
|
// (21/28).
|
|
16
16
|
/** Text in one of the text styles (UIKit `UIFont.TextStyle`). */
|
|
17
|
-
export const Typography = forwardRef(({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export const Typography = forwardRef(({ className, color, dynamicTypeSize: size, emphasized, italic, render, textStyle, ...props }, ref) => useRender({
|
|
18
|
+
defaultTagName: 'span',
|
|
19
|
+
props: {
|
|
20
|
+
...props,
|
|
21
|
+
className: cn('uikit-typography', className),
|
|
22
|
+
'data-color': color,
|
|
23
|
+
'data-dynamic-type-size': size,
|
|
24
|
+
'data-emphasized': emphasized ? '' : undefined,
|
|
25
|
+
'data-italic': italic ? '' : undefined,
|
|
26
|
+
'data-text-style': textStyle,
|
|
27
|
+
},
|
|
28
|
+
ref,
|
|
29
|
+
render,
|
|
30
|
+
}));
|
|
21
31
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/typography/main.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/typography/main.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAUtC,uEAAuE;AACvE,qEAAqE;AACrE,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,cAAc;AACd,0EAA0E;AAC1E,8DAA8D;AAC9D,2EAA2E;AAC3E,sEAAsE;AACtE,aAAa;AAEb,iEAAiE;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,KAAK,EACL,eAAe,EAAE,IAAI,EACrB,UAAU,EACV,MAAM,EACN,MAAM,EACN,SAAS,EACT,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE,CACF,SAAS,CAAC;IACR,cAAc,EAAE,MAAM;IACtB,KAAK,EAAE;QACL,GAAG,KAAK;QACR,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC;QAC5C,YAAY,EAAE,KAAK;QACnB,wBAAwB,EAAE,IAAI;QAC9B,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC9C,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QACtC,iBAAiB,EAAE,SAAS;KAC7B;IACD,GAAG;IACH,MAAM;CACP,CAAC,CACL,CAAC"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ComponentProps, JSX } from 'react';
|
|
1
|
+
import type { useRender } from '@base-ui/react/use-render';
|
|
3
2
|
/** UIKit `UIFont.TextStyle`. */
|
|
4
3
|
export type TextStyle = 'body' | 'callout' | 'caption1' | 'caption2' | 'footnote' | 'headline' | 'largeTitle' | 'subheadline' | 'title1' | 'title2' | 'title3';
|
|
5
4
|
/** UIKit `UIContentSizeCategory` (Dynamic Type), `large` by default. */
|
|
6
5
|
export type DynamicTypeSize = 'ax1' | 'ax2' | 'ax3' | 'ax4' | 'ax5' | 'large' | 'medium' | 'small' | 'xLarge' | 'xSmall' | 'xxLarge' | 'xxxLarge';
|
|
7
6
|
/** Label colors of the text styles (Figma: the four label colors). */
|
|
8
7
|
export type TextColor = 'primary' | 'quaternary' | 'secondary' | 'tertiary';
|
|
9
|
-
export type TypographyProps = ComponentProps<'span'> & {
|
|
10
|
-
/**
|
|
11
|
-
* The element to render.
|
|
12
|
-
* @default 'span'
|
|
13
|
-
*/
|
|
14
|
-
as?: keyof JSX.IntrinsicElements;
|
|
8
|
+
export type TypographyProps = useRender.ComponentProps<'span'> & {
|
|
15
9
|
/**
|
|
16
10
|
* Label color.
|
|
17
11
|
* @default inherited
|
|
@@ -30,6 +24,5 @@ export type TypographyProps = ComponentProps<'span'> & {
|
|
|
30
24
|
* @default 'body'
|
|
31
25
|
*/
|
|
32
26
|
textStyle?: TextStyle;
|
|
33
|
-
textWrap?: Properties['textWrap'];
|
|
34
27
|
};
|
|
35
28
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/typography/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/typography/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,gCAAgC;AAChC,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,YAAY,GACZ,aAAa,GACb,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb,wEAAwE;AACxE,MAAM,MAAM,eAAe,GACvB,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,CAAC;AAEf,sEAAsE;AACtE,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;AAE5E,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG;IAC/D;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC"}
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
font-weight: round(down, var(--font-ios-body-weight), 100);
|
|
13
13
|
letter-spacing: var(--font-ios-body-tracking);
|
|
14
14
|
line-height: var(--font-ios-body-line-height);
|
|
15
|
-
stroke: currentcolor;
|
|
16
|
-
stroke-linejoin: round;
|
|
17
|
-
stroke-width: max(0px, (var(--font-ios-body-weight) - 400) / 326 * 1px);
|
|
18
|
-
|
|
19
|
-
--uikit-symbol-thinning: max(
|
|
20
|
-
0px,
|
|
21
|
-
(400 - var(--font-ios-body-weight)) / 326 * 1px
|
|
22
|
-
);
|
|
23
15
|
|
|
24
16
|
&[data-text-style='callout'] {
|
|
25
17
|
font-size: var(--font-ios-callout-size);
|
|
@@ -27,17 +19,6 @@
|
|
|
27
19
|
font-weight: round(down, var(--font-ios-callout-weight), 100);
|
|
28
20
|
letter-spacing: var(--font-ios-callout-tracking);
|
|
29
21
|
line-height: var(--font-ios-callout-line-height);
|
|
30
|
-
stroke: currentcolor;
|
|
31
|
-
stroke-linejoin: round;
|
|
32
|
-
stroke-width: max(
|
|
33
|
-
0px,
|
|
34
|
-
(var(--font-ios-callout-weight) - 400) / 326 * 1px
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
--uikit-symbol-thinning: max(
|
|
38
|
-
0px,
|
|
39
|
-
(400 - var(--font-ios-callout-weight)) / 326 * 1px
|
|
40
|
-
);
|
|
41
22
|
}
|
|
42
23
|
|
|
43
24
|
&[data-text-style='caption1'] {
|
|
@@ -46,17 +27,6 @@
|
|
|
46
27
|
font-weight: round(down, var(--font-ios-caption1-weight), 100);
|
|
47
28
|
letter-spacing: var(--font-ios-caption1-tracking);
|
|
48
29
|
line-height: var(--font-ios-caption1-line-height);
|
|
49
|
-
stroke: currentcolor;
|
|
50
|
-
stroke-linejoin: round;
|
|
51
|
-
stroke-width: max(
|
|
52
|
-
0px,
|
|
53
|
-
(var(--font-ios-caption1-weight) - 400) / 326 * 1px
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
--uikit-symbol-thinning: max(
|
|
57
|
-
0px,
|
|
58
|
-
(400 - var(--font-ios-caption1-weight)) / 326 * 1px
|
|
59
|
-
);
|
|
60
30
|
}
|
|
61
31
|
|
|
62
32
|
&[data-text-style='caption2'] {
|
|
@@ -65,17 +35,6 @@
|
|
|
65
35
|
font-weight: round(down, var(--font-ios-caption2-weight), 100);
|
|
66
36
|
letter-spacing: var(--font-ios-caption2-tracking);
|
|
67
37
|
line-height: var(--font-ios-caption2-line-height);
|
|
68
|
-
stroke: currentcolor;
|
|
69
|
-
stroke-linejoin: round;
|
|
70
|
-
stroke-width: max(
|
|
71
|
-
0px,
|
|
72
|
-
(var(--font-ios-caption2-weight) - 400) / 326 * 1px
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
--uikit-symbol-thinning: max(
|
|
76
|
-
0px,
|
|
77
|
-
(400 - var(--font-ios-caption2-weight)) / 326 * 1px
|
|
78
|
-
);
|
|
79
38
|
}
|
|
80
39
|
|
|
81
40
|
&[data-text-style='footnote'] {
|
|
@@ -84,17 +43,6 @@
|
|
|
84
43
|
font-weight: round(down, var(--font-ios-footnote-weight), 100);
|
|
85
44
|
letter-spacing: var(--font-ios-footnote-tracking);
|
|
86
45
|
line-height: var(--font-ios-footnote-line-height);
|
|
87
|
-
stroke: currentcolor;
|
|
88
|
-
stroke-linejoin: round;
|
|
89
|
-
stroke-width: max(
|
|
90
|
-
0px,
|
|
91
|
-
(var(--font-ios-footnote-weight) - 400) / 326 * 1px
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
--uikit-symbol-thinning: max(
|
|
95
|
-
0px,
|
|
96
|
-
(400 - var(--font-ios-footnote-weight)) / 326 * 1px
|
|
97
|
-
);
|
|
98
46
|
}
|
|
99
47
|
|
|
100
48
|
&[data-text-style='headline'] {
|
|
@@ -103,17 +51,6 @@
|
|
|
103
51
|
font-weight: round(down, var(--font-ios-headline-weight), 100);
|
|
104
52
|
letter-spacing: var(--font-ios-headline-tracking);
|
|
105
53
|
line-height: var(--font-ios-headline-line-height);
|
|
106
|
-
stroke: currentcolor;
|
|
107
|
-
stroke-linejoin: round;
|
|
108
|
-
stroke-width: max(
|
|
109
|
-
0px,
|
|
110
|
-
(var(--font-ios-headline-weight) - 400) / 326 * 1px
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
--uikit-symbol-thinning: max(
|
|
114
|
-
0px,
|
|
115
|
-
(400 - var(--font-ios-headline-weight)) / 326 * 1px
|
|
116
|
-
);
|
|
117
54
|
}
|
|
118
55
|
|
|
119
56
|
&[data-text-style='largeTitle'] {
|
|
@@ -122,17 +59,6 @@
|
|
|
122
59
|
font-weight: round(down, var(--font-ios-large-title-weight), 100);
|
|
123
60
|
letter-spacing: var(--font-ios-large-title-tracking);
|
|
124
61
|
line-height: var(--font-ios-large-title-line-height);
|
|
125
|
-
stroke: currentcolor;
|
|
126
|
-
stroke-linejoin: round;
|
|
127
|
-
stroke-width: max(
|
|
128
|
-
0px,
|
|
129
|
-
(var(--font-ios-large-title-weight) - 400) / 326 * 1px
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
--uikit-symbol-thinning: max(
|
|
133
|
-
0px,
|
|
134
|
-
(400 - var(--font-ios-large-title-weight)) / 326 * 1px
|
|
135
|
-
);
|
|
136
62
|
}
|
|
137
63
|
|
|
138
64
|
&[data-text-style='subheadline'] {
|
|
@@ -141,17 +67,6 @@
|
|
|
141
67
|
font-weight: round(down, var(--font-ios-subheadline-weight), 100);
|
|
142
68
|
letter-spacing: var(--font-ios-subheadline-tracking);
|
|
143
69
|
line-height: var(--font-ios-subheadline-line-height);
|
|
144
|
-
stroke: currentcolor;
|
|
145
|
-
stroke-linejoin: round;
|
|
146
|
-
stroke-width: max(
|
|
147
|
-
0px,
|
|
148
|
-
(var(--font-ios-subheadline-weight) - 400) / 326 * 1px
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
--uikit-symbol-thinning: max(
|
|
152
|
-
0px,
|
|
153
|
-
(400 - var(--font-ios-subheadline-weight)) / 326 * 1px
|
|
154
|
-
);
|
|
155
70
|
}
|
|
156
71
|
|
|
157
72
|
&[data-text-style='title1'] {
|
|
@@ -160,14 +75,6 @@
|
|
|
160
75
|
font-weight: round(down, var(--font-ios-title1-weight), 100);
|
|
161
76
|
letter-spacing: var(--font-ios-title1-tracking);
|
|
162
77
|
line-height: var(--font-ios-title1-line-height);
|
|
163
|
-
stroke: currentcolor;
|
|
164
|
-
stroke-linejoin: round;
|
|
165
|
-
stroke-width: max(0px, (var(--font-ios-title1-weight) - 400) / 326 * 1px);
|
|
166
|
-
|
|
167
|
-
--uikit-symbol-thinning: max(
|
|
168
|
-
0px,
|
|
169
|
-
(400 - var(--font-ios-title1-weight)) / 326 * 1px
|
|
170
|
-
);
|
|
171
78
|
}
|
|
172
79
|
|
|
173
80
|
&[data-text-style='title2'] {
|
|
@@ -176,14 +83,6 @@
|
|
|
176
83
|
font-weight: round(down, var(--font-ios-title2-weight), 100);
|
|
177
84
|
letter-spacing: var(--font-ios-title2-tracking);
|
|
178
85
|
line-height: var(--font-ios-title2-line-height);
|
|
179
|
-
stroke: currentcolor;
|
|
180
|
-
stroke-linejoin: round;
|
|
181
|
-
stroke-width: max(0px, (var(--font-ios-title2-weight) - 400) / 326 * 1px);
|
|
182
|
-
|
|
183
|
-
--uikit-symbol-thinning: max(
|
|
184
|
-
0px,
|
|
185
|
-
(400 - var(--font-ios-title2-weight)) / 326 * 1px
|
|
186
|
-
);
|
|
187
86
|
}
|
|
188
87
|
|
|
189
88
|
&[data-text-style='title3'] {
|
|
@@ -192,14 +91,6 @@
|
|
|
192
91
|
font-weight: round(down, var(--font-ios-title3-weight), 100);
|
|
193
92
|
letter-spacing: var(--font-ios-title3-tracking);
|
|
194
93
|
line-height: var(--font-ios-title3-line-height);
|
|
195
|
-
stroke: currentcolor;
|
|
196
|
-
stroke-linejoin: round;
|
|
197
|
-
stroke-width: max(0px, (var(--font-ios-title3-weight) - 400) / 326 * 1px);
|
|
198
|
-
|
|
199
|
-
--uikit-symbol-thinning: max(
|
|
200
|
-
0px,
|
|
201
|
-
(400 - var(--font-ios-title3-weight)) / 326 * 1px
|
|
202
|
-
);
|
|
203
94
|
}
|
|
204
95
|
|
|
205
96
|
&[data-emphasized] {
|
|
@@ -207,17 +98,6 @@
|
|
|
207
98
|
|
|
208
99
|
font-variation-settings: 'wght' var(--uikit-typography-emphasized);
|
|
209
100
|
font-weight: round(down, var(--uikit-typography-emphasized), 100);
|
|
210
|
-
stroke: currentcolor;
|
|
211
|
-
stroke-linejoin: round;
|
|
212
|
-
stroke-width: max(
|
|
213
|
-
0px,
|
|
214
|
-
(var(--uikit-typography-emphasized) - 400) / 326 * 1px
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
--uikit-symbol-thinning: max(
|
|
218
|
-
0px,
|
|
219
|
-
(400 - var(--uikit-typography-emphasized)) / 326 * 1px
|
|
220
|
-
);
|
|
221
101
|
}
|
|
222
102
|
|
|
223
103
|
&[data-text-style='callout'][data-emphasized] {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import './style.css';
|
|
2
|
+
import type { Popover as BasePopover } from '@base-ui/react/popover';
|
|
2
3
|
import type { Signalish } from 'preact';
|
|
3
|
-
import { CSSProperties, FunctionComponent, ReactNode, Ref } from 'react';
|
|
4
|
-
import type { LogicalSide, PointerDrag, PointerDragHandlers, SecondaryClickProps } from './props.js';
|
|
5
|
-
export type { ColorScheme, LogicalSide, PointerDrag, PointerDragHandlers, SecondaryClickProps, } from './props.js';
|
|
4
|
+
import { CSSProperties, FunctionComponent, ReactNode, Ref, RefObject } from 'react';
|
|
5
|
+
import type { LogicalSide, PointerDrag, PointerDragHandlers, PortalContainer, SecondaryClickProps } from './props.js';
|
|
6
|
+
export type { ColorScheme, LogicalSide, PointerDrag, PointerDragHandlers, PortalContainer, SecondaryClickProps, } from './props.js';
|
|
6
7
|
/**
|
|
7
8
|
* Joins CSS class name strings, dropping empty entries and duplicates.
|
|
8
9
|
*
|
|
@@ -30,10 +31,31 @@ export declare const withStyle: <Style>(properties: Record<string, string | unde
|
|
|
30
31
|
*/
|
|
31
32
|
export declare const positionerSide: (side: LogicalSide | undefined) => "bottom" | "inline-end" | "inline-start" | "top" | undefined;
|
|
32
33
|
/**
|
|
33
|
-
* Attribute
|
|
34
|
-
*
|
|
34
|
+
* Attribute that forces a color scheme regardless of the browser's
|
|
35
|
+
* preference: on the root element (`<html>`, see `Styles`), or on any
|
|
36
|
+
* element, for what's within it.
|
|
35
37
|
*/
|
|
36
38
|
export declare const colorSchemeAttribute = "data-color-scheme";
|
|
39
|
+
/**
|
|
40
|
+
* Where popups given no `container` are portaled into (their portals':
|
|
41
|
+
* the `Alert`'s, `Sheet`'s, `ActionSheet`'s, `Menu`'s, `Popover`'s,
|
|
42
|
+
* `Tooltip`'s, `ContextualMenu`'s), for what's within it; none: Base UI's
|
|
43
|
+
* default, the body. E.g. a device's screen in a page of demos, or an
|
|
44
|
+
* app's layer above its own.
|
|
45
|
+
*/
|
|
46
|
+
export declare const PortalContainerContext: import("preact").Context<PortalContainer | undefined>;
|
|
47
|
+
/** A portal's container: its own, or else the provided one (see above). */
|
|
48
|
+
export declare const usePortalContainer: (container: PortalContainer | null | undefined) => PortalContainer | null | undefined;
|
|
49
|
+
type CollisionProps = Pick<BasePopover.Positioner.Props, 'collisionBoundary' | 'collisionPadding'>;
|
|
50
|
+
/**
|
|
51
|
+
* A positioner's collision defaults (Popover's, Menu's, Tooltip's,
|
|
52
|
+
* ActionSheet's): within its portal's container (e.g. a device's screen in a
|
|
53
|
+
* page of demos; else the clipping ancestors), `padding` clear of its safe
|
|
54
|
+
* area (the container's `--uikit-safe-area-inset-*`, the window's `env()`
|
|
55
|
+
* by default, see styles.css), so it shifts and shrinks to fit inside it.
|
|
56
|
+
* Either given, it wins.
|
|
57
|
+
*/
|
|
58
|
+
export declare const useCollision: ({ collisionBoundary, collisionPadding }: CollisionProps, padding?: number) => CollisionProps;
|
|
37
59
|
/**
|
|
38
60
|
* How far to scroll in a frame while a pointer drags near an end of a
|
|
39
61
|
* scrolling area (as text selections scroll): within `edge` of its start
|
|
@@ -74,6 +96,13 @@ export declare const useSecondaryClick: <Props extends SecondaryClickProps>(prop
|
|
|
74
96
|
* take no forwarded ref.)
|
|
75
97
|
*/
|
|
76
98
|
export declare const withSecondaryClick: <Props extends SecondaryClickProps>(Component: FunctionComponent<Props>) => FunctionComponent<Props>;
|
|
99
|
+
/**
|
|
100
|
+
* A Base UI popup's `initialFocus` as its default (its first tabbable
|
|
101
|
+
* element; opened by touch, or without one, the popup itself), but not
|
|
102
|
+
* scrolling: Base UI focuses the element scrolling it into view, which
|
|
103
|
+
* Safari does before the popup is in place, scrolling its content down.
|
|
104
|
+
*/
|
|
105
|
+
export declare const useInitialFocus: (popup: RefObject<HTMLElement | null>) => ((openType: string) => boolean);
|
|
77
106
|
/**
|
|
78
107
|
* Returns an internal ref object for a `forwardRef` component's element that
|
|
79
108
|
* is also exposed through the forwarded ref.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/utils/main.tsx"],"names":[],"mappings":"AACA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/utils/main.tsx"],"names":[],"mappings":"AACA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAEL,aAAa,EAEb,iBAAiB,EAGjB,SAAS,EACT,GAAG,EACH,SAAS,EAMV,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EAEnB,eAAe,EAEf,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,GAAG,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,KACpC,MAAM,GAAG,SAcX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,EAAE,EAAE;IACf,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC;IAClE,CAAC,KAAK,EACJ,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,SAAS,CAAC,GAC1D,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,CAAC;CAiBxC,CAAC;AAEF;;;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3
|
import './style.css';
|
|
4
|
-
import { forwardRef, useCallback, useImperativeHandle, useLayoutEffect, useRef, } from 'react';
|
|
4
|
+
import { createContext, forwardRef, useCallback, useContext, useImperativeHandle, useLayoutEffect, useRef, } from 'react';
|
|
5
5
|
/**
|
|
6
6
|
* Joins CSS class name strings, dropping empty entries and duplicates.
|
|
7
7
|
*
|
|
@@ -58,10 +58,54 @@ export const positionerSide = (side) => {
|
|
|
58
58
|
return side;
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
|
-
* Attribute
|
|
62
|
-
*
|
|
61
|
+
* Attribute that forces a color scheme regardless of the browser's
|
|
62
|
+
* preference: on the root element (`<html>`, see `Styles`), or on any
|
|
63
|
+
* element, for what's within it.
|
|
63
64
|
*/
|
|
64
65
|
export const colorSchemeAttribute = 'data-color-scheme';
|
|
66
|
+
/**
|
|
67
|
+
* Where popups given no `container` are portaled into (their portals':
|
|
68
|
+
* the `Alert`'s, `Sheet`'s, `ActionSheet`'s, `Menu`'s, `Popover`'s,
|
|
69
|
+
* `Tooltip`'s, `ContextualMenu`'s), for what's within it; none: Base UI's
|
|
70
|
+
* default, the body. E.g. a device's screen in a page of demos, or an
|
|
71
|
+
* app's layer above its own.
|
|
72
|
+
*/
|
|
73
|
+
export const PortalContainerContext = createContext(undefined);
|
|
74
|
+
/** A portal's container: its own, or else the provided one (see above). */
|
|
75
|
+
export const usePortalContainer = (container) => {
|
|
76
|
+
const provided = useContext(PortalContainerContext);
|
|
77
|
+
return container === undefined ? provided : container;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* A positioner's collision defaults (Popover's, Menu's, Tooltip's,
|
|
81
|
+
* ActionSheet's): within its portal's container (e.g. a device's screen in a
|
|
82
|
+
* page of demos; else the clipping ancestors), `padding` clear of its safe
|
|
83
|
+
* area (the container's `--uikit-safe-area-inset-*`, the window's `env()`
|
|
84
|
+
* by default, see styles.css), so it shifts and shrinks to fit inside it.
|
|
85
|
+
* Either given, it wins.
|
|
86
|
+
*/
|
|
87
|
+
export const useCollision = ({ collisionBoundary, collisionPadding }, padding = 8) => {
|
|
88
|
+
const container = usePortalContainer(undefined);
|
|
89
|
+
const resolved = container && 'current' in container ? container.current : container;
|
|
90
|
+
const element = resolved instanceof ShadowRoot ? resolved.host : resolved;
|
|
91
|
+
if (collisionPadding !== undefined || typeof document === 'undefined') {
|
|
92
|
+
return {
|
|
93
|
+
collisionBoundary: collisionBoundary ?? element ?? undefined,
|
|
94
|
+
collisionPadding: collisionPadding ?? padding,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const style = getComputedStyle(element ?? document.documentElement);
|
|
98
|
+
const inset = (side) => Number.parseFloat(style.getPropertyValue(`--uikit-safe-area-inset-${side}`)) || 0;
|
|
99
|
+
return {
|
|
100
|
+
collisionBoundary: collisionBoundary ?? element ?? undefined,
|
|
101
|
+
collisionPadding: {
|
|
102
|
+
bottom: padding + inset('bottom'),
|
|
103
|
+
left: padding + inset('left'),
|
|
104
|
+
right: padding + inset('right'),
|
|
105
|
+
top: padding + inset('top'),
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
};
|
|
65
109
|
/** A frame at 60 Hz, in ms: what `edgeScrollDelta`'s speed is per. */
|
|
66
110
|
const frameDuration = 1000 / 60;
|
|
67
111
|
/**
|
|
@@ -225,6 +269,31 @@ export const withSecondaryClick = (Component) => {
|
|
|
225
269
|
const Loose = Component;
|
|
226
270
|
return forwardRef((props, ref) => (_jsx(Loose, { ref: ref, ...useSecondaryClick(props) })));
|
|
227
271
|
};
|
|
272
|
+
// What a popup's first tabbable element can be (roughly: enabled, in the
|
|
273
|
+
// tab order).
|
|
274
|
+
const tabbable = [
|
|
275
|
+
'a[href]',
|
|
276
|
+
'button:not(:disabled)',
|
|
277
|
+
'input:not(:disabled)',
|
|
278
|
+
'select:not(:disabled)',
|
|
279
|
+
'textarea:not(:disabled)',
|
|
280
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
281
|
+
].join(', ');
|
|
282
|
+
/**
|
|
283
|
+
* A Base UI popup's `initialFocus` as its default (its first tabbable
|
|
284
|
+
* element; opened by touch, or without one, the popup itself), but not
|
|
285
|
+
* scrolling: Base UI focuses the element scrolling it into view, which
|
|
286
|
+
* Safari does before the popup is in place, scrolling its content down.
|
|
287
|
+
*/
|
|
288
|
+
export const useInitialFocus = (popup) => useCallback((openType) => {
|
|
289
|
+
if (openType === 'touch')
|
|
290
|
+
return true;
|
|
291
|
+
const first = popup.current?.querySelector(tabbable);
|
|
292
|
+
if (!first)
|
|
293
|
+
return true;
|
|
294
|
+
first.focus({ preventScroll: true });
|
|
295
|
+
return false;
|
|
296
|
+
}, [popup]);
|
|
228
297
|
/**
|
|
229
298
|
* Returns an internal ref object for a `forwardRef` component's element that
|
|
230
299
|
* is also exposed through the forwarded ref.
|
|
@@ -262,11 +331,11 @@ export const usePointerDrag = (drag, handlers = {}) => {
|
|
|
262
331
|
active.event = undefined;
|
|
263
332
|
dragRef.current.move?.(element, active.state, event);
|
|
264
333
|
}, []);
|
|
265
|
-
const finish = useCallback((element, pointerId,
|
|
334
|
+
const finish = useCallback((element, pointerId, isCancelled) => {
|
|
266
335
|
const { current: active } = activeRef;
|
|
267
336
|
if (active?.pointerId !== pointerId)
|
|
268
337
|
return;
|
|
269
|
-
if (
|
|
338
|
+
if (isCancelled) {
|
|
270
339
|
if (active.frame !== undefined)
|
|
271
340
|
cancelAnimationFrame(active.frame);
|
|
272
341
|
}
|
|
@@ -274,7 +343,7 @@ export const usePointerDrag = (drag, handlers = {}) => {
|
|
|
274
343
|
flush(element);
|
|
275
344
|
}
|
|
276
345
|
activeRef.current = null;
|
|
277
|
-
dragRef.current.end(element, active.state,
|
|
346
|
+
dragRef.current.end(element, active.state, isCancelled);
|
|
278
347
|
}, [flush]);
|
|
279
348
|
const onPointerDown = useCallback((event) => {
|
|
280
349
|
call('onPointerDown', event);
|
|
@@ -346,22 +415,22 @@ export const MovingHighlight = ({ selectors }) => {
|
|
|
346
415
|
const container = highlight?.parentElement;
|
|
347
416
|
if (!highlight || !container)
|
|
348
417
|
return undefined;
|
|
349
|
-
let
|
|
418
|
+
let isShown = false;
|
|
350
419
|
// Between items (e.g. over a separator), it stays a moment: the next
|
|
351
420
|
// highlighted item moves it there.
|
|
352
421
|
let hiding;
|
|
353
422
|
// Instantly while its items scroll (it scrolls with them).
|
|
354
|
-
const update = (
|
|
423
|
+
const update = (isInstant = false) => {
|
|
355
424
|
const item = key
|
|
356
425
|
.split('\n')
|
|
357
426
|
.map((selector) => container.querySelector(selector))
|
|
358
427
|
.find(Boolean);
|
|
359
428
|
if (!item) {
|
|
360
|
-
if (!
|
|
429
|
+
if (!isShown || hiding !== undefined)
|
|
361
430
|
return;
|
|
362
431
|
hiding = setTimeout(() => {
|
|
363
432
|
hiding = undefined;
|
|
364
|
-
|
|
433
|
+
isShown = false;
|
|
365
434
|
highlight.style.opacity = '0';
|
|
366
435
|
}, hideDelay);
|
|
367
436
|
return;
|
|
@@ -388,7 +457,7 @@ export const MovingHighlight = ({ selectors }) => {
|
|
|
388
457
|
width: `${String(rect.width / scaleX)}px`,
|
|
389
458
|
};
|
|
390
459
|
// Appearing (or scrolling): in place, not moving there.
|
|
391
|
-
if (
|
|
460
|
+
if (isShown && !isInstant) {
|
|
392
461
|
Object.assign(highlight.style, place);
|
|
393
462
|
}
|
|
394
463
|
else {
|
|
@@ -397,7 +466,7 @@ export const MovingHighlight = ({ selectors }) => {
|
|
|
397
466
|
highlight.getBoundingClientRect();
|
|
398
467
|
highlight.style.removeProperty('transition-property');
|
|
399
468
|
}
|
|
400
|
-
|
|
469
|
+
isShown = true;
|
|
401
470
|
highlight.style.opacity = '1';
|
|
402
471
|
};
|
|
403
472
|
update();
|