@mrpelz/uikit-ish 0.0.0-stage → 7.8.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/action-sheet/main.d.ts +39 -0
- package/dist/components/action-sheet/main.d.ts.map +1 -0
- package/dist/components/action-sheet/main.js +35 -0
- package/dist/components/action-sheet/main.js.map +1 -0
- package/dist/components/action-sheet/props.d.ts +10 -0
- package/dist/components/action-sheet/props.d.ts.map +1 -0
- package/dist/components/action-sheet/props.js +2 -0
- package/dist/components/action-sheet/props.js.map +1 -0
- package/dist/components/action-sheet/style.css +8 -0
- package/dist/components/activity-view/main.d.ts +45 -0
- package/dist/components/activity-view/main.d.ts.map +1 -0
- package/dist/components/activity-view/main.js +64 -0
- package/dist/components/activity-view/main.js.map +1 -0
- package/dist/components/activity-view/props.d.ts +12 -0
- package/dist/components/activity-view/props.d.ts.map +1 -0
- package/dist/components/activity-view/props.js +2 -0
- package/dist/components/activity-view/props.js.map +1 -0
- package/dist/components/activity-view/style.css +209 -0
- package/dist/components/alert/main.d.ts +53 -0
- package/dist/components/alert/main.d.ts.map +1 -0
- package/dist/components/alert/main.js +57 -0
- package/dist/components/alert/main.js.map +1 -0
- package/dist/components/alert/props.d.ts +18 -0
- package/dist/components/alert/props.d.ts.map +1 -0
- package/dist/components/alert/props.js +2 -0
- package/dist/components/alert/props.js.map +1 -0
- package/dist/components/alert/style.css +205 -0
- package/dist/components/avatar/main.d.ts +20 -0
- package/dist/components/avatar/main.d.ts.map +1 -0
- package/dist/components/avatar/main.js +42 -0
- package/dist/components/avatar/main.js.map +1 -0
- package/dist/components/avatar/props.d.ts +18 -0
- package/dist/components/avatar/props.d.ts.map +1 -0
- package/dist/components/avatar/props.js +2 -0
- package/dist/components/avatar/props.js.map +1 -0
- package/dist/components/avatar/style.css +83 -0
- package/dist/components/badge/main.d.ts +12 -0
- package/dist/components/badge/main.d.ts.map +1 -0
- package/dist/components/badge/main.js +33 -0
- package/dist/components/badge/main.js.map +1 -0
- package/dist/components/badge/props.d.ts +20 -0
- package/dist/components/badge/props.d.ts.map +1 -0
- package/dist/components/badge/props.js +2 -0
- package/dist/components/badge/props.js.map +1 -0
- package/dist/components/badge/style.css +71 -0
- package/dist/components/button/main.d.ts +16 -0
- package/dist/components/button/main.d.ts.map +1 -0
- package/dist/components/button/main.js +64 -0
- package/dist/components/button/main.js.map +1 -0
- package/dist/components/button/props.d.ts +45 -0
- package/dist/components/button/props.d.ts.map +1 -0
- package/dist/components/button/props.js +2 -0
- package/dist/components/button/props.js.map +1 -0
- package/dist/components/button/style.css +338 -0
- package/dist/components/checkbox/main.d.ts +23 -0
- package/dist/components/checkbox/main.d.ts.map +1 -0
- package/dist/components/checkbox/main.js +43 -0
- package/dist/components/checkbox/main.js.map +1 -0
- package/dist/components/checkbox/props.d.ts +14 -0
- package/dist/components/checkbox/props.d.ts.map +1 -0
- package/dist/components/checkbox/props.js +2 -0
- package/dist/components/checkbox/props.js.map +1 -0
- package/dist/components/checkbox/style.css +73 -0
- package/dist/components/color-picker/main.d.ts +31 -0
- package/dist/components/color-picker/main.d.ts.map +1 -0
- package/dist/components/color-picker/main.js +356 -0
- package/dist/components/color-picker/main.js.map +1 -0
- package/dist/components/color-picker/props.d.ts +61 -0
- package/dist/components/color-picker/props.d.ts.map +1 -0
- package/dist/components/color-picker/props.js +2 -0
- package/dist/components/color-picker/props.js.map +1 -0
- package/dist/components/color-picker/style.css +374 -0
- package/dist/components/contextual-menu/main.d.ts +84 -0
- package/dist/components/contextual-menu/main.d.ts.map +1 -0
- package/dist/components/contextual-menu/main.js +255 -0
- package/dist/components/contextual-menu/main.js.map +1 -0
- package/dist/components/contextual-menu/props.d.ts +44 -0
- package/dist/components/contextual-menu/props.d.ts.map +1 -0
- package/dist/components/contextual-menu/props.js +2 -0
- package/dist/components/contextual-menu/props.js.map +1 -0
- package/dist/components/contextual-menu/style.css +80 -0
- package/dist/components/date-picker/main.d.ts +57 -0
- package/dist/components/date-picker/main.d.ts.map +1 -0
- package/dist/components/date-picker/main.js +770 -0
- package/dist/components/date-picker/main.js.map +1 -0
- package/dist/components/date-picker/props.d.ts +220 -0
- package/dist/components/date-picker/props.d.ts.map +1 -0
- package/dist/components/date-picker/props.js +2 -0
- package/dist/components/date-picker/props.js.map +1 -0
- package/dist/components/date-picker/style.css +446 -0
- package/dist/components/edit-menu/main.d.ts +71 -0
- package/dist/components/edit-menu/main.d.ts.map +1 -0
- package/dist/components/edit-menu/main.js +317 -0
- package/dist/components/edit-menu/main.js.map +1 -0
- package/dist/components/edit-menu/props.d.ts +21 -0
- package/dist/components/edit-menu/props.d.ts.map +1 -0
- package/dist/components/edit-menu/props.js +2 -0
- package/dist/components/edit-menu/props.js.map +1 -0
- package/dist/components/edit-menu/style.css +189 -0
- package/dist/components/form/main.d.ts +21 -0
- package/dist/components/form/main.d.ts.map +1 -0
- package/dist/components/form/main.js +32 -0
- package/dist/components/form/main.js.map +1 -0
- package/dist/components/form/props.d.ts +4 -0
- package/dist/components/form/props.d.ts.map +1 -0
- package/dist/components/form/props.js +2 -0
- package/dist/components/form/props.js.map +1 -0
- package/dist/components/form/style.css +9 -0
- package/dist/components/glass/main.d.ts +34 -0
- package/dist/components/glass/main.d.ts.map +1 -0
- package/dist/components/glass/main.js +157 -0
- package/dist/components/glass/main.js.map +1 -0
- package/dist/components/glass/props.d.ts +22 -0
- package/dist/components/glass/props.d.ts.map +1 -0
- package/dist/components/glass/props.js +2 -0
- package/dist/components/glass/props.js.map +1 -0
- package/dist/components/glass/style.css +488 -0
- package/dist/components/header/main.d.ts +15 -0
- package/dist/components/header/main.d.ts.map +1 -0
- package/dist/components/header/main.js +78 -0
- package/dist/components/header/main.js.map +1 -0
- package/dist/components/header/props.d.ts +16 -0
- package/dist/components/header/props.d.ts.map +1 -0
- package/dist/components/header/props.js +2 -0
- package/dist/components/header/props.js.map +1 -0
- package/dist/components/header/style.css +119 -0
- package/dist/components/index.d.ts +38 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +45 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/layout/main.d.ts +15 -0
- package/dist/components/layout/main.d.ts.map +1 -0
- package/dist/components/layout/main.js +241 -0
- package/dist/components/layout/main.js.map +1 -0
- package/dist/components/layout/props.d.ts +52 -0
- package/dist/components/layout/props.d.ts.map +1 -0
- package/dist/components/layout/props.js +2 -0
- package/dist/components/layout/props.js.map +1 -0
- package/dist/components/layout/style.css +208 -0
- package/dist/components/list/main.d.ts +104 -0
- package/dist/components/list/main.d.ts.map +1 -0
- package/dist/components/list/main.js +1553 -0
- package/dist/components/list/main.js.map +1 -0
- package/dist/components/list/props.d.ts +178 -0
- package/dist/components/list/props.d.ts.map +1 -0
- package/dist/components/list/props.js +2 -0
- package/dist/components/list/props.js.map +1 -0
- package/dist/components/list/style.css +1689 -0
- package/dist/components/menu/main.d.ts +119 -0
- package/dist/components/menu/main.d.ts.map +1 -0
- package/dist/components/menu/main.js +487 -0
- package/dist/components/menu/main.js.map +1 -0
- package/dist/components/menu/props.d.ts +54 -0
- package/dist/components/menu/props.d.ts.map +1 -0
- package/dist/components/menu/props.js +2 -0
- package/dist/components/menu/props.js.map +1 -0
- package/dist/components/menu/style.css +446 -0
- package/dist/components/navigation/main.d.ts +9 -0
- package/dist/components/navigation/main.d.ts.map +1 -0
- package/dist/components/navigation/main.js +201 -0
- package/dist/components/navigation/main.js.map +1 -0
- package/dist/components/navigation/props.d.ts +16 -0
- package/dist/components/navigation/props.d.ts.map +1 -0
- package/dist/components/navigation/props.js +2 -0
- package/dist/components/navigation/props.js.map +1 -0
- package/dist/components/navigation/style.css +83 -0
- package/dist/components/page/main.d.ts +9 -0
- package/dist/components/page/main.d.ts.map +1 -0
- package/dist/components/page/main.js +20 -0
- package/dist/components/page/main.js.map +1 -0
- package/dist/components/page/props.d.ts +10 -0
- package/dist/components/page/props.d.ts.map +1 -0
- package/dist/components/page/props.js +2 -0
- package/dist/components/page/props.js.map +1 -0
- package/dist/components/page/style.css +19 -0
- package/dist/components/page-control/main.d.ts +13 -0
- package/dist/components/page-control/main.d.ts.map +1 -0
- package/dist/components/page-control/main.js +138 -0
- package/dist/components/page-control/main.js.map +1 -0
- package/dist/components/page-control/props.d.ts +36 -0
- package/dist/components/page-control/props.d.ts.map +1 -0
- package/dist/components/page-control/props.js +2 -0
- package/dist/components/page-control/props.js.map +1 -0
- package/dist/components/page-control/style.css +111 -0
- package/dist/components/popover/main.d.ts +34 -0
- package/dist/components/popover/main.d.ts.map +1 -0
- package/dist/components/popover/main.js +232 -0
- package/dist/components/popover/main.js.map +1 -0
- package/dist/components/popover/props.d.ts +23 -0
- package/dist/components/popover/props.d.ts.map +1 -0
- package/dist/components/popover/props.js +2 -0
- package/dist/components/popover/props.js.map +1 -0
- package/dist/components/popover/style.css +160 -0
- package/dist/components/progress/main.d.ts +31 -0
- package/dist/components/progress/main.d.ts.map +1 -0
- package/dist/components/progress/main.js +77 -0
- package/dist/components/progress/main.js.map +1 -0
- package/dist/components/progress/props.d.ts +56 -0
- package/dist/components/progress/props.d.ts.map +1 -0
- package/dist/components/progress/props.js +2 -0
- package/dist/components/progress/props.js.map +1 -0
- package/dist/components/progress/style.css +264 -0
- package/dist/components/roll/main.d.ts +18 -0
- package/dist/components/roll/main.d.ts.map +1 -0
- package/dist/components/roll/main.js +463 -0
- package/dist/components/roll/main.js.map +1 -0
- package/dist/components/roll/props.d.ts +58 -0
- package/dist/components/roll/props.d.ts.map +1 -0
- package/dist/components/roll/props.js +2 -0
- package/dist/components/roll/props.js.map +1 -0
- package/dist/components/roll/style.css +173 -0
- package/dist/components/segmented/main.d.ts +17 -0
- package/dist/components/segmented/main.d.ts.map +1 -0
- package/dist/components/segmented/main.js +151 -0
- package/dist/components/segmented/main.js.map +1 -0
- package/dist/components/segmented/props.d.ts +16 -0
- package/dist/components/segmented/props.d.ts.map +1 -0
- package/dist/components/segmented/props.js +2 -0
- package/dist/components/segmented/props.js.map +1 -0
- package/dist/components/segmented/style.css +428 -0
- package/dist/components/sheet/main.d.ts +32 -0
- package/dist/components/sheet/main.d.ts.map +1 -0
- package/dist/components/sheet/main.js +101 -0
- package/dist/components/sheet/main.js.map +1 -0
- package/dist/components/sheet/props.d.ts +11 -0
- package/dist/components/sheet/props.d.ts.map +1 -0
- package/dist/components/sheet/props.js +2 -0
- package/dist/components/sheet/props.js.map +1 -0
- package/dist/components/sheet/style.css +125 -0
- package/dist/components/sidebar/main.d.ts +15 -0
- package/dist/components/sidebar/main.d.ts.map +1 -0
- package/dist/components/sidebar/main.js +42 -0
- package/dist/components/sidebar/main.js.map +1 -0
- package/dist/components/sidebar/props.d.ts +5 -0
- package/dist/components/sidebar/props.d.ts.map +1 -0
- package/dist/components/sidebar/props.js +2 -0
- package/dist/components/sidebar/props.js.map +1 -0
- package/dist/components/sidebar/style.css +94 -0
- package/dist/components/slider/main.d.ts +35 -0
- package/dist/components/slider/main.d.ts.map +1 -0
- package/dist/components/slider/main.js +153 -0
- package/dist/components/slider/main.js.map +1 -0
- package/dist/components/slider/props.d.ts +56 -0
- package/dist/components/slider/props.d.ts.map +1 -0
- package/dist/components/slider/props.js +2 -0
- package/dist/components/slider/props.js.map +1 -0
- package/dist/components/slider/style.css +345 -0
- package/dist/components/stepper/main.d.ts +22 -0
- package/dist/components/stepper/main.d.ts.map +1 -0
- package/dist/components/stepper/main.js +56 -0
- package/dist/components/stepper/main.js.map +1 -0
- package/dist/components/stepper/props.d.ts +10 -0
- package/dist/components/stepper/props.d.ts.map +1 -0
- package/dist/components/stepper/props.js +2 -0
- package/dist/components/stepper/props.js.map +1 -0
- package/dist/components/stepper/style.css +115 -0
- package/dist/components/switch/main.d.ts +14 -0
- package/dist/components/switch/main.d.ts.map +1 -0
- package/dist/components/switch/main.js +143 -0
- package/dist/components/switch/main.js.map +1 -0
- package/dist/components/switch/props.d.ts +34 -0
- package/dist/components/switch/props.d.ts.map +1 -0
- package/dist/components/switch/props.js +2 -0
- package/dist/components/switch/props.js.map +1 -0
- package/dist/components/switch/style.css +168 -0
- package/dist/components/symbol/main.d.ts +8 -0
- package/dist/components/symbol/main.d.ts.map +1 -0
- package/dist/components/symbol/main.js +32 -0
- package/dist/components/symbol/main.js.map +1 -0
- package/dist/components/symbol/props.d.ts +10 -0
- package/dist/components/symbol/props.d.ts.map +1 -0
- package/dist/components/symbol/props.js +2 -0
- package/dist/components/symbol/props.js.map +1 -0
- package/dist/components/symbol/style.css +26 -0
- package/dist/components/tab-bar/main.d.ts +39 -0
- package/dist/components/tab-bar/main.d.ts.map +1 -0
- package/dist/components/tab-bar/main.js +1133 -0
- package/dist/components/tab-bar/main.js.map +1 -0
- package/dist/components/tab-bar/props.d.ts +152 -0
- package/dist/components/tab-bar/props.d.ts.map +1 -0
- package/dist/components/tab-bar/props.js +2 -0
- package/dist/components/tab-bar/props.js.map +1 -0
- package/dist/components/tab-bar/style.css +936 -0
- package/dist/components/text-field/main.d.ts +28 -0
- package/dist/components/text-field/main.d.ts.map +1 -0
- package/dist/components/text-field/main.js +105 -0
- package/dist/components/text-field/main.js.map +1 -0
- package/dist/components/text-field/props.d.ts +3 -0
- package/dist/components/text-field/props.d.ts.map +1 -0
- package/dist/components/text-field/props.js +2 -0
- package/dist/components/text-field/props.js.map +1 -0
- package/dist/components/text-field/style.css +230 -0
- package/dist/components/toolbar/main.d.ts +37 -0
- package/dist/components/toolbar/main.d.ts.map +1 -0
- package/dist/components/toolbar/main.js +142 -0
- package/dist/components/toolbar/main.js.map +1 -0
- package/dist/components/toolbar/props.d.ts +46 -0
- package/dist/components/toolbar/props.d.ts.map +1 -0
- package/dist/components/toolbar/props.js +2 -0
- package/dist/components/toolbar/props.js.map +1 -0
- package/dist/components/toolbar/style.css +210 -0
- package/dist/components/tooltip/main.d.ts +29 -0
- package/dist/components/tooltip/main.d.ts.map +1 -0
- package/dist/components/tooltip/main.js +37 -0
- package/dist/components/tooltip/main.js.map +1 -0
- package/dist/components/tooltip/props.d.ts +11 -0
- package/dist/components/tooltip/props.d.ts.map +1 -0
- package/dist/components/tooltip/props.js +2 -0
- package/dist/components/tooltip/props.js.map +1 -0
- package/dist/components/tooltip/style.css +29 -0
- package/dist/components/typography/main.d.ts +8 -0
- package/dist/components/typography/main.d.ts.map +1 -0
- package/dist/components/typography/main.js +21 -0
- package/dist/components/typography/main.js.map +1 -0
- package/dist/components/typography/props.d.ts +35 -0
- package/dist/components/typography/props.d.ts.map +1 -0
- package/dist/components/typography/props.js +2 -0
- package/dist/components/typography/props.js.map +1 -0
- package/dist/components/typography/style.css +719 -0
- package/dist/components/utils/main.d.ts +114 -0
- package/dist/components/utils/main.d.ts.map +1 -0
- package/dist/components/utils/main.js +431 -0
- package/dist/components/utils/main.js.map +1 -0
- package/dist/components/utils/props.d.ts +52 -0
- package/dist/components/utils/props.d.ts.map +1 -0
- package/dist/components/utils/props.js +2 -0
- package/dist/components/utils/props.js.map +1 -0
- package/dist/components/utils/style.css +77 -0
- package/dist/components/viewport/main.d.ts +32 -0
- package/dist/components/viewport/main.d.ts.map +1 -0
- package/dist/components/viewport/main.js +197 -0
- package/dist/components/viewport/main.js.map +1 -0
- package/dist/components/viewport/props.d.ts +71 -0
- package/dist/components/viewport/props.d.ts.map +1 -0
- package/dist/components/viewport/props.js +2 -0
- package/dist/components/viewport/props.js.map +1 -0
- package/dist/components/viewport/style.css +112 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +3 -0
- package/dist/main.js.map +1 -0
- package/dist/styles.css +567 -0
- package/dist/styles.d.ts +25 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +39 -0
- package/dist/styles.js.map +1 -0
- package/package.json +55 -4
- package/README.md +0 -3
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import '../glass/style.css';
|
|
3
|
+
import '../menu/style.css';
|
|
4
|
+
import './style.css';
|
|
5
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
6
|
+
import { forwardRef, useCallback, useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
7
|
+
import { dragOverItems, MenuContext, useCloseOutOfView, useRootActions, } from '../menu/main.js';
|
|
8
|
+
import { cn, MovingHighlight, positionerSide, useForwardedRef, } from '../utils/main.js';
|
|
9
|
+
// Source: Apple iOS 26 Figma (“Menus”: “Edit Menu”, “_Edit Menu Item”,
|
|
10
|
+
// Mode=Light and Dark), with the destructive color mapped to `systemRed`; the
|
|
11
|
+
// “Medium” glass material and vibrant content colors are tokens in
|
|
12
|
+
// `styles.css`, used via `glass/style.css` (`uikit-glass-medium`). Its metrics
|
|
13
|
+
// are iOS 26's own edit menu's, measured on an iPhone (see Deviations).
|
|
14
|
+
//
|
|
15
|
+
// A Base UI menu in a horizontal glass capsule (UIKit `UIEditMenuInteraction`):
|
|
16
|
+
// its actions are items, and `EditMenu.More` opens a submenu (a `Menu` popup)
|
|
17
|
+
// with further actions. It's opened by the app (`open`) at an anchor (the
|
|
18
|
+
// positioner's `anchor`, e.g. a selection), not by a trigger.
|
|
19
|
+
//
|
|
20
|
+
// It closes when its anchor or capsule leaves the viewport (see `Menu`).
|
|
21
|
+
//
|
|
22
|
+
// It never overflows its collision boundary (the viewport, or the positioner's
|
|
23
|
+
// `collisionBoundary`): too narrow for its actions, they scroll within the
|
|
24
|
+
// capsule, the “more” button staying at its end. Touches drag over the actions
|
|
25
|
+
// (no native scrolling), highlighting the one under the finger and choosing it
|
|
26
|
+
// on release; held near an end, they scroll the actions (as the tab bar's lens
|
|
27
|
+
// and menus do).
|
|
28
|
+
//
|
|
29
|
+
// Deviations:
|
|
30
|
+
// - More actions open in a menu below the capsule, an iPad (`regular`) menu
|
|
31
|
+
// (UIKit: pages of the capsule).
|
|
32
|
+
// - Highlighted actions (pointer, keyboard) show the selection, as the “more”
|
|
33
|
+
// button does (Figma: no highlighted actions).
|
|
34
|
+
// - The chevron is an SVG stroke (Figma: SF Symbols glyph ).
|
|
35
|
+
// - Metrics of iOS 26's own edit menu (measured): 42px high, 14px labels, 16px
|
|
36
|
+
// dividers, a 34px “more” button (Figma: 44px, 15px, 18px, 36px).
|
|
37
|
+
// - The capsule is Framework7's popover glass, as the menu's popup (see
|
|
38
|
+
// `Menu`).
|
|
39
|
+
/**
|
|
40
|
+
* An edit menu: controlled by `open` (e.g. when a selection is made), shown
|
|
41
|
+
* at its positioner's `anchor`; it has no visible trigger. It isn't modal
|
|
42
|
+
* (by default): the page stays interactive, and pressing outside of it
|
|
43
|
+
* reaches the page (e.g. clearing the selection) as it closes the menu.
|
|
44
|
+
*/
|
|
45
|
+
const Root = ({ children, orientation = 'horizontal', size = 'compact', ...props }) => {
|
|
46
|
+
const actionsRef = useRootActions(props.actionsRef);
|
|
47
|
+
return (_jsx(MenuContext.Provider, { value: { actionsRef, orientation, size }, children: _jsxs(BaseMenu.Root, { modal: false, orientation: orientation, ...props, actionsRef: actionsRef, children: [_jsx(BaseMenu.Trigger, { "aria-hidden": "true", nativeButton: false, tabIndex: -1, render: _jsx("span", { className: "uikit-edit-menu-hidden-trigger" }) }), children] }) }));
|
|
48
|
+
};
|
|
49
|
+
const Positioner = forwardRef(({ className, side = 'block-start', ...props }, forwardedRef) => {
|
|
50
|
+
const ref = useForwardedRef(forwardedRef);
|
|
51
|
+
useCloseOutOfView(ref);
|
|
52
|
+
return (_jsx(BaseMenu.Positioner, { ref: ref, ...props, className: cn('uikit-edit-menu-positioner', className), "data-edit-menu-part": "positioner", side: positionerSide(side), sideOffset: props.sideOffset ?? 8 }));
|
|
53
|
+
});
|
|
54
|
+
const getRanges = (selection) => selection
|
|
55
|
+
? Array.from({ length: selection.rangeCount }, (_, index) => selection.getRangeAt(index).cloneRange())
|
|
56
|
+
: [];
|
|
57
|
+
const inMenu = (target) => target instanceof Element && target.closest('[role="menu"]') !== null;
|
|
58
|
+
/**
|
|
59
|
+
* Keeps the document's selection while the popup, its submenus or their
|
|
60
|
+
* items have focus:
|
|
61
|
+
* Base UI focuses the popup on opening and items when highlighted, and
|
|
62
|
+
* WebKit clears a selection when focus moves outside of it, which would take
|
|
63
|
+
* the edit menu's anchor away (internal).
|
|
64
|
+
*/
|
|
65
|
+
const useKeepSelection = (popupRef) => {
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
const { current: popup } = popupRef;
|
|
68
|
+
if (!popup)
|
|
69
|
+
return undefined;
|
|
70
|
+
const document = popup.ownerDocument;
|
|
71
|
+
let ranges = getRanges(document.getSelection());
|
|
72
|
+
// Selections made while the popup isn't focused (its own focusing
|
|
73
|
+
// changes it asynchronously, too late for the restore).
|
|
74
|
+
const save = () => {
|
|
75
|
+
if (inMenu(document.activeElement))
|
|
76
|
+
return;
|
|
77
|
+
ranges = getRanges(document.getSelection());
|
|
78
|
+
};
|
|
79
|
+
// On every focus inside, too: highlighting an item focuses it.
|
|
80
|
+
const restore = () => {
|
|
81
|
+
const selection = document.getSelection();
|
|
82
|
+
if (!selection?.isCollapsed || ranges.length === 0)
|
|
83
|
+
return;
|
|
84
|
+
selection.removeAllRanges();
|
|
85
|
+
for (const range of ranges)
|
|
86
|
+
selection.addRange(range);
|
|
87
|
+
};
|
|
88
|
+
// Submenus too (in portals).
|
|
89
|
+
const onFocusIn = ({ target }) => {
|
|
90
|
+
if (inMenu(target))
|
|
91
|
+
restore();
|
|
92
|
+
};
|
|
93
|
+
document.addEventListener('selectionchange', save);
|
|
94
|
+
document.addEventListener('focusin', onFocusIn);
|
|
95
|
+
return () => {
|
|
96
|
+
document.removeEventListener('selectionchange', save);
|
|
97
|
+
document.removeEventListener('focusin', onFocusIn);
|
|
98
|
+
};
|
|
99
|
+
}, [popupRef]);
|
|
100
|
+
};
|
|
101
|
+
// Marks the scroller while its actions overflow it, and whether there are
|
|
102
|
+
// more of them before or after those in view: its first and last actions
|
|
103
|
+
// fully in view, or not (the “more” button's space excluded).
|
|
104
|
+
const useOverflow = (scrollerRef) => {
|
|
105
|
+
useLayoutEffect(() => {
|
|
106
|
+
const { current: scroller } = scrollerRef;
|
|
107
|
+
const actions = scroller?.parentElement;
|
|
108
|
+
if (!scroller || !actions)
|
|
109
|
+
return undefined;
|
|
110
|
+
const hidden = new Set();
|
|
111
|
+
let observer;
|
|
112
|
+
let ends = [];
|
|
113
|
+
const update = () => {
|
|
114
|
+
const [first, last] = ends;
|
|
115
|
+
const before = first !== undefined && hidden.has(first);
|
|
116
|
+
const after = last !== undefined && hidden.has(last);
|
|
117
|
+
actions.toggleAttribute('data-before', before);
|
|
118
|
+
actions.toggleAttribute('data-after', after);
|
|
119
|
+
actions.toggleAttribute('data-overflowing', before || after);
|
|
120
|
+
};
|
|
121
|
+
const observe = () => {
|
|
122
|
+
observer?.disconnect();
|
|
123
|
+
hidden.clear();
|
|
124
|
+
// Not the “more” button, positioned by the popup (also before Base UI
|
|
125
|
+
// marks it as a submenu trigger).
|
|
126
|
+
const items = [...scroller.children].filter((child) => getComputedStyle(child).position !== 'absolute');
|
|
127
|
+
ends = [items[0], items.at(-1)].filter((end) => end !== undefined);
|
|
128
|
+
observer = new IntersectionObserver((entries) => {
|
|
129
|
+
for (const { intersectionRatio, target } of entries) {
|
|
130
|
+
if (intersectionRatio < 0.99) {
|
|
131
|
+
hidden.add(target);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
hidden.delete(target);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
update();
|
|
138
|
+
}, { root: scroller, threshold: [0, 0.99, 1] });
|
|
139
|
+
for (const end of new Set(ends))
|
|
140
|
+
observer.observe(end);
|
|
141
|
+
};
|
|
142
|
+
observe();
|
|
143
|
+
const mutations = new MutationObserver(observe);
|
|
144
|
+
mutations.observe(scroller, { childList: true });
|
|
145
|
+
return () => {
|
|
146
|
+
observer?.disconnect();
|
|
147
|
+
mutations.disconnect();
|
|
148
|
+
};
|
|
149
|
+
}, [scrollerRef]);
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Touches in the edit menu and its submenus drag over their items (see
|
|
153
|
+
* `dragOverItems`): no tap reaches the page, which would clear the
|
|
154
|
+
* selection (iOS), so even the “more” button opens by the drag (hovered,
|
|
155
|
+
* or clicked on release).
|
|
156
|
+
*/
|
|
157
|
+
const useTouchDrag = (popupRef) => {
|
|
158
|
+
useLayoutEffect(() => {
|
|
159
|
+
const { current: popup } = popupRef;
|
|
160
|
+
if (!popup)
|
|
161
|
+
return undefined;
|
|
162
|
+
const document = popup.ownerDocument;
|
|
163
|
+
const onPointerDown = (event) => {
|
|
164
|
+
if (event.pointerType !== 'touch' ||
|
|
165
|
+
!event.isPrimary ||
|
|
166
|
+
!inMenu(event.target)) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
if (event.target instanceof Element) {
|
|
171
|
+
const { target } = event;
|
|
172
|
+
if (target.hasPointerCapture(event.pointerId)) {
|
|
173
|
+
target.releasePointerCapture(event.pointerId);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
dragOverItems(document, event.pointerId, {
|
|
177
|
+
x: event.clientX,
|
|
178
|
+
y: event.clientY,
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
const onTouchStart = (event) => {
|
|
182
|
+
if (inMenu(event.target) && event.cancelable)
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
};
|
|
185
|
+
document.addEventListener('pointerdown', onPointerDown, { capture: true });
|
|
186
|
+
document.addEventListener('touchstart', onTouchStart, {
|
|
187
|
+
capture: true,
|
|
188
|
+
passive: false,
|
|
189
|
+
});
|
|
190
|
+
return () => {
|
|
191
|
+
document.removeEventListener('pointerdown', onPointerDown, {
|
|
192
|
+
capture: true,
|
|
193
|
+
});
|
|
194
|
+
document.removeEventListener('touchstart', onTouchStart, {
|
|
195
|
+
capture: true,
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
}, [popupRef]);
|
|
199
|
+
};
|
|
200
|
+
const highlightSelectors = [':scope > [data-highlighted]:not([aria-haspopup])'];
|
|
201
|
+
/** The edit menu's glass capsule (Figma “Liquid Glass”, Medium). */
|
|
202
|
+
const Popup = forwardRef(({ className, children, ...props }, forwardedRef) => {
|
|
203
|
+
const ref = useForwardedRef(forwardedRef);
|
|
204
|
+
const scrollerRef = useRef(null);
|
|
205
|
+
useKeepSelection(ref);
|
|
206
|
+
useOverflow(scrollerRef);
|
|
207
|
+
useTouchDrag(ref);
|
|
208
|
+
return (_jsx(BaseMenu.Popup, { ref: ref, ...props, "data-edit-menu-part": "popup", className: cn('uikit-edit-menu-popup uikit-glass-medium uikit-popup-transition', className), children: _jsx("div", { className: "uikit-edit-menu-actions", "data-edit-menu-part": "actions", children: _jsxs("div", { ref: scrollerRef, className: "uikit-edit-menu-scroller", "data-menu-part": "scroller", children: [children, _jsx(MovingHighlight, { selectors: highlightSelectors })] }) }) }));
|
|
209
|
+
});
|
|
210
|
+
const Item = forwardRef(({ className, children, destructive, ...props }, ref) => (_jsx(BaseMenu.Item, { ref: ref, "data-clickable": props.onClick ? '' : undefined, "data-destructive": destructive ? '' : undefined, ...props, className: cn('uikit-edit-menu-item uikit-menu-action-cursor', className), "data-edit-menu-part": "item", children: _jsx("span", { children: children }) })));
|
|
211
|
+
/**
|
|
212
|
+
* The “more” button, opening a submenu with further actions: place it in a
|
|
213
|
+
* `Menu.SubmenuRoot`, followed by a `Menu.Portal` with the submenu.
|
|
214
|
+
*/
|
|
215
|
+
const More = forwardRef(({ className, children, ...props }, ref) => (_jsx(BaseMenu.SubmenuTrigger, { ref: ref, "aria-label": "More", ...props, className: cn('uikit-edit-menu-more uikit-menu-toggle-cursor', className), "data-edit-menu-part": "more", children: children ?? (_jsx("svg", { "aria-hidden": "true", fill: "none", height: "14", stroke: "currentcolor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2.2", viewBox: "0 0 10 16", width: "9", children: _jsx("path", { d: "M2.5 2.5L8 8l-5.5 5.5" }) })) })));
|
|
216
|
+
/**
|
|
217
|
+
* The text selection in `container` once it's made, as an anchor for the
|
|
218
|
+
* edit menu's positioner (null while there's none, or while selecting):
|
|
219
|
+
* once the pointer is released, or after a pause (keyboard, touch:
|
|
220
|
+
* selecting by touch cancels the pointer, the selection handles don't use
|
|
221
|
+
* it). Selection changes keeping the range (e.g. restored after the menu's
|
|
222
|
+
* focusing cleared it, in WebKit) are ignored, and so are presses not
|
|
223
|
+
* changing it (e.g. outside the text): they only clear it. The second
|
|
224
|
+
* value clears it (e.g. when the menu closes).
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const [text, setText] = useState<HTMLElement | null>(null);
|
|
228
|
+
* const [selection, clearSelection] = useSelectionAnchor(text);
|
|
229
|
+
* <EditMenu.Root open={selection !== null} onOpenChange={(open) => { if (!open) clearSelection(); }}>
|
|
230
|
+
* <p ref={setText}>…</p>
|
|
231
|
+
* <EditMenu.Portal>
|
|
232
|
+
* <EditMenu.Positioner anchor={selection}>…
|
|
233
|
+
*/
|
|
234
|
+
export const useSelectionAnchor = (container) => {
|
|
235
|
+
const [anchor, setAnchor] = useState(null);
|
|
236
|
+
useEffect(() => {
|
|
237
|
+
let selecting = false;
|
|
238
|
+
let timeout;
|
|
239
|
+
let shown = null;
|
|
240
|
+
let changed = false;
|
|
241
|
+
const current = () => {
|
|
242
|
+
const documentSelection = document.getSelection();
|
|
243
|
+
const range = documentSelection && documentSelection.rangeCount > 0
|
|
244
|
+
? documentSelection.getRangeAt(0)
|
|
245
|
+
: null;
|
|
246
|
+
return range &&
|
|
247
|
+
!range.collapsed &&
|
|
248
|
+
container?.contains(range.commonAncestorContainer)
|
|
249
|
+
? range.cloneRange()
|
|
250
|
+
: null;
|
|
251
|
+
};
|
|
252
|
+
const isShown = (range) => shown !== null &&
|
|
253
|
+
range !== null &&
|
|
254
|
+
range.compareBoundaryPoints(Range.START_TO_START, shown) === 0 &&
|
|
255
|
+
range.compareBoundaryPoints(Range.END_TO_END, shown) === 0;
|
|
256
|
+
const hide = () => {
|
|
257
|
+
shown = null;
|
|
258
|
+
setAnchor(null);
|
|
259
|
+
};
|
|
260
|
+
const update = () => {
|
|
261
|
+
const range = current();
|
|
262
|
+
shown = range;
|
|
263
|
+
setAnchor(range
|
|
264
|
+
? { getBoundingClientRect: () => range.getBoundingClientRect() }
|
|
265
|
+
: null);
|
|
266
|
+
};
|
|
267
|
+
const onPointerDown = ({ target }) => {
|
|
268
|
+
// Pressing a menu keeps it.
|
|
269
|
+
if (target instanceof Element && target.closest('[role=menu]'))
|
|
270
|
+
return;
|
|
271
|
+
selecting = true;
|
|
272
|
+
changed = false;
|
|
273
|
+
hide();
|
|
274
|
+
};
|
|
275
|
+
const onPointerUp = () => {
|
|
276
|
+
if (!selecting)
|
|
277
|
+
return;
|
|
278
|
+
selecting = false;
|
|
279
|
+
if (changed)
|
|
280
|
+
update();
|
|
281
|
+
};
|
|
282
|
+
const onPointerCancel = () => {
|
|
283
|
+
selecting = false;
|
|
284
|
+
};
|
|
285
|
+
const onSelectionChange = () => {
|
|
286
|
+
if (selecting)
|
|
287
|
+
changed = true;
|
|
288
|
+
if (selecting || isShown(current()))
|
|
289
|
+
return;
|
|
290
|
+
clearTimeout(timeout);
|
|
291
|
+
hide();
|
|
292
|
+
timeout = setTimeout(update, 500);
|
|
293
|
+
};
|
|
294
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
295
|
+
document.addEventListener('pointerup', onPointerUp);
|
|
296
|
+
document.addEventListener('pointercancel', onPointerCancel);
|
|
297
|
+
document.addEventListener('selectionchange', onSelectionChange);
|
|
298
|
+
return () => {
|
|
299
|
+
clearTimeout(timeout);
|
|
300
|
+
document.removeEventListener('pointerdown', onPointerDown);
|
|
301
|
+
document.removeEventListener('pointerup', onPointerUp);
|
|
302
|
+
document.removeEventListener('pointercancel', onPointerCancel);
|
|
303
|
+
document.removeEventListener('selectionchange', onSelectionChange);
|
|
304
|
+
};
|
|
305
|
+
}, [container]);
|
|
306
|
+
const clear = useCallback(() => setAnchor(null), []);
|
|
307
|
+
return [anchor, clear];
|
|
308
|
+
};
|
|
309
|
+
export const EditMenu = {
|
|
310
|
+
...BaseMenu,
|
|
311
|
+
Root,
|
|
312
|
+
Positioner,
|
|
313
|
+
Popup,
|
|
314
|
+
Item,
|
|
315
|
+
More,
|
|
316
|
+
};
|
|
317
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/edit-menu/main.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,UAAU,EAEV,WAAW,EACX,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,aAAa,EACb,WAAW,EAEX,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,EAAE,EACF,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAK1B,uEAAuE;AACvE,8EAA8E;AAC9E,mEAAmE;AACnE,+EAA+E;AAC/E,wEAAwE;AACxE,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,0EAA0E;AAC1E,8DAA8D;AAC9D,EAAE;AACF,yEAAyE;AACzE,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,iBAAiB;AACjB,EAAE;AACF,cAAc;AACd,4EAA4E;AAC5E,mCAAmC;AACnC,8EAA8E;AAC9E,iDAAiD;AACjD,+DAA+D;AAC/D,+EAA+E;AAC/E,oEAAoE;AACpE,wEAAwE;AACxE,aAAa;AAEb;;;;;GAKG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,QAAQ,EACR,WAAW,GAAG,YAAY,EAC1B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AAC;QACpD,QAAQ,CAAC,gBAAgB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QAC5D,QAAQ,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;QAChE,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;YAC3D,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;YAC/D,QAAQ,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;QACrE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAErD,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,QAAQ;IACX,IAAI;IACJ,UAAU;IACV,KAAK;IACL,IAAI;IACJ,IAAI;CACL,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import type { Properties } from 'csstype';
|
|
3
|
+
import type { LogicalSide } from '../utils/main.js';
|
|
4
|
+
export type EditMenuPositionerProps = Omit<BaseMenu.Positioner.Props, 'ref' | 'side'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Its side of its anchor (logical).
|
|
7
|
+
* @default 'block-start'
|
|
8
|
+
*/
|
|
9
|
+
side?: LogicalSide;
|
|
10
|
+
};
|
|
11
|
+
export type ItemProps = {
|
|
12
|
+
/**
|
|
13
|
+
* The cursor (where the pointer hovers).
|
|
14
|
+
* @default 'pointer' with a click handler, otherwise or while disabled
|
|
15
|
+
* 'not-allowed'
|
|
16
|
+
*/
|
|
17
|
+
cursor?: Properties['cursor'];
|
|
18
|
+
/** Red label (Figma State=Destructive). */
|
|
19
|
+
destructive?: boolean;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/edit-menu/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,QAAQ,CAAC,UAAU,CAAC,KAAK,EACzB,KAAK,GAAG,MAAM,CACf,GAAG;IACF;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/components/edit-menu/props.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/* Edit-menu (see main.tsx). */
|
|
2
|
+
@layer uikit-ish {
|
|
3
|
+
.uikit-edit-menu-hidden-trigger {
|
|
4
|
+
position: absolute;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
width: 0;
|
|
7
|
+
height: 0;
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.uikit-edit-menu-positioner {
|
|
12
|
+
z-index: 100;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.uikit-edit-menu-popup {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: flex;
|
|
18
|
+
max-width: var(--available-width);
|
|
19
|
+
min-height: 42px;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
align-items: center;
|
|
22
|
+
padding: 0 4px;
|
|
23
|
+
border-radius: 100px;
|
|
24
|
+
outline: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.uikit-edit-menu-actions {
|
|
28
|
+
--uikit-edit-menu-fade: to right;
|
|
29
|
+
--uikit-edit-menu-fade-start: 0px;
|
|
30
|
+
--uikit-edit-menu-fade-end: 0px;
|
|
31
|
+
--uikit-edit-menu-more: 0px;
|
|
32
|
+
|
|
33
|
+
display: flex;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
flex: 1 1 auto;
|
|
36
|
+
padding-inline-end: var(--uikit-edit-menu-more);
|
|
37
|
+
|
|
38
|
+
&:dir(rtl) {
|
|
39
|
+
--uikit-edit-menu-fade: to left;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:has(> * > [aria-haspopup='menu']) {
|
|
43
|
+
--uikit-edit-menu-more: 34px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[data-before] {
|
|
47
|
+
--uikit-edit-menu-fade-start: 16px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&[data-after] {
|
|
51
|
+
--uikit-edit-menu-fade-end: 16px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&[data-overflowing] {
|
|
55
|
+
mask-image: linear-gradient(
|
|
56
|
+
var(--uikit-edit-menu-fade),
|
|
57
|
+
transparent,
|
|
58
|
+
#000 var(--uikit-edit-menu-fade-start),
|
|
59
|
+
#000
|
|
60
|
+
calc(
|
|
61
|
+
100% - var(--uikit-edit-menu-more) - var(--uikit-edit-menu-fade-end)
|
|
62
|
+
),
|
|
63
|
+
transparent calc(100% - var(--uikit-edit-menu-more)),
|
|
64
|
+
#000 calc(100% - var(--uikit-edit-menu-more))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.uikit-edit-menu-scroller {
|
|
70
|
+
display: flex;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
flex: 1 1 auto;
|
|
73
|
+
align-items: center;
|
|
74
|
+
overscroll-behavior-x: contain;
|
|
75
|
+
scrollbar-width: none;
|
|
76
|
+
touch-action: none;
|
|
77
|
+
|
|
78
|
+
[data-overflowing] > & {
|
|
79
|
+
overflow: auto hidden;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.uikit-edit-menu-item {
|
|
84
|
+
position: relative;
|
|
85
|
+
display: flex;
|
|
86
|
+
min-height: 34px;
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
flex: none;
|
|
89
|
+
align-items: center;
|
|
90
|
+
padding: 0 16px;
|
|
91
|
+
color: var(--uikit-glass-content);
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
font-variation-settings: 'wght' 400;
|
|
94
|
+
font-weight: round(down, 400, 100);
|
|
95
|
+
letter-spacing: -0.15px;
|
|
96
|
+
line-height: 18px;
|
|
97
|
+
mix-blend-mode: var(--uikit-glass-content-blend);
|
|
98
|
+
outline: none;
|
|
99
|
+
stroke: currentcolor;
|
|
100
|
+
stroke-linejoin: round;
|
|
101
|
+
stroke-width: max(0px, (400 - 400) / 326 * 1px);
|
|
102
|
+
user-select: none;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
|
|
105
|
+
--uikit-symbol-thinning: max(0px, (400 - 400) / 326 * 1px);
|
|
106
|
+
|
|
107
|
+
&::before {
|
|
108
|
+
position: absolute;
|
|
109
|
+
border-radius: 100px;
|
|
110
|
+
background-color: var(--uikit-glass-selection);
|
|
111
|
+
content: '';
|
|
112
|
+
inset: 0;
|
|
113
|
+
opacity: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Highlighted, the scroller's moving selection (see Popup). Touch: the
|
|
117
|
+
selection while pressed (no hover highlights). */
|
|
118
|
+
&:active:not([data-disabled]) {
|
|
119
|
+
&::before {
|
|
120
|
+
opacity: 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
& + & {
|
|
125
|
+
margin-inline-start: 1px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
& + &::after {
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: calc(50% - 8px);
|
|
131
|
+
left: -1px;
|
|
132
|
+
width: 1px;
|
|
133
|
+
height: 16px;
|
|
134
|
+
background-color: var(--uikit-glass-divider);
|
|
135
|
+
content: '';
|
|
136
|
+
transition: opacity 200ms;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Hidden next to the highlighted action, as in Segmented. */
|
|
140
|
+
&[data-highlighted]::after,
|
|
141
|
+
&:active::after,
|
|
142
|
+
&[data-highlighted] + &::after,
|
|
143
|
+
&:active + &::after {
|
|
144
|
+
opacity: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&[data-disabled] {
|
|
148
|
+
--uikit-glass-content: var(--uikit-glass-content-disabled);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&[data-destructive]:not([data-disabled]) {
|
|
152
|
+
--uikit-glass-content: var(--color-ios-system-red);
|
|
153
|
+
|
|
154
|
+
mix-blend-mode: normal;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
& > * {
|
|
158
|
+
position: relative;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.uikit-edit-menu-more {
|
|
163
|
+
/* At the popup's end (see Actions) */
|
|
164
|
+
position: absolute;
|
|
165
|
+
top: calc(50% - 17px);
|
|
166
|
+
display: flex;
|
|
167
|
+
width: 34px;
|
|
168
|
+
height: 34px;
|
|
169
|
+
flex: none;
|
|
170
|
+
align-items: center;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
border-radius: 50%;
|
|
173
|
+
background-color: var(--uikit-glass-selection);
|
|
174
|
+
color: var(--uikit-glass-content);
|
|
175
|
+
inset-inline-end: 4px;
|
|
176
|
+
mix-blend-mode: var(--uikit-glass-content-blend);
|
|
177
|
+
outline: none;
|
|
178
|
+
|
|
179
|
+
&[data-highlighted],
|
|
180
|
+
&[data-popup-open],
|
|
181
|
+
&:active {
|
|
182
|
+
filter: brightness(0.95);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
& > svg {
|
|
186
|
+
translate: 1px 0;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import '../list/style.css';
|
|
2
|
+
import './style.css';
|
|
3
|
+
import { Form as BaseForm } from '@base-ui/react/form';
|
|
4
|
+
import type { FieldsetLegendProps } from './props.js';
|
|
5
|
+
export type { FieldsetLegendProps } from './props.js';
|
|
6
|
+
export declare const Fieldset: {
|
|
7
|
+
Root: import("preact").FunctionalComponent<import("react").PropsWithoutRef<Omit<import("@base-ui/react/fieldset").FieldsetRootProps, "ref">> & {
|
|
8
|
+
ref?: import("preact").Ref<HTMLElement> | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
Legend: import("preact").FunctionalComponent<import("react").PropsWithoutRef<FieldsetLegendProps> & {
|
|
11
|
+
ref?: import("preact").Ref<HTMLDivElement> | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Base UI's form: it validates its fields (by `name`) and shows `errors`
|
|
16
|
+
* (e.g. a server's) on them; `onFormSubmit` gets the values.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Form: <FormValues extends Record<string, any> = Record<string, any>>(props: BaseForm.Props<FormValues> & {
|
|
19
|
+
ref?: import("preact").Ref<HTMLFormElement> | undefined;
|
|
20
|
+
}) => import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/form/main.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA+CtD,eAAO,MAAM,QAAQ;;;;;;;CAIpB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI;OApD2B,CAAC;iCAoDjB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import '../list/style.css';
|
|
3
|
+
import './style.css';
|
|
4
|
+
import { Fieldset as BaseFieldset } from '@base-ui/react/fieldset';
|
|
5
|
+
import { Form as BaseForm } from '@base-ui/react/form';
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
|
+
import { List } from '../list/main.js';
|
|
8
|
+
// Forms (Base UI `Form`, `Fieldset`), as iOS lays them out (Settings,
|
|
9
|
+
// Contacts): in a `List`, a fieldset is a section, its legend the section's
|
|
10
|
+
// header (`List.Header`), its fields rows (`TextField.Root` rendering a
|
|
11
|
+
// `List.Item`; `Checkbox`, `Radio`, `Switch`, `Stepper`, `Slider`, … in
|
|
12
|
+
// rows). A form submits with a `Button` of `type="submit"`.
|
|
13
|
+
// Source: behavior after Framework7 (`form.js`, `list.less`: inputs in list
|
|
14
|
+
// rows); Figma has no forms.
|
|
15
|
+
/**
|
|
16
|
+
* A fieldset (Base UI): a list section (`List.Section`), disabling its
|
|
17
|
+
* fields (`disabled`).
|
|
18
|
+
*/
|
|
19
|
+
const FieldsetRoot = forwardRef((props, ref) => (_jsx(BaseFieldset.Root, { ref: ref, ...props, render: props.render ?? (_jsx(List.Section, { render: _jsx("fieldset", { className: "uikit-form-fieldset-element" }) })) })));
|
|
20
|
+
/** A fieldset's legend (Base UI): its section's header (`List.Header`). */
|
|
21
|
+
const FieldsetLegend = forwardRef(({ children, prominence, ...props }, ref) => (_jsx(BaseFieldset.Legend, { ref: ref, ...props, render: props.render ?? _jsx(List.Header, { prominence: prominence }), children: _jsx(List.Title, { children: children }) })));
|
|
22
|
+
export const Fieldset = {
|
|
23
|
+
...BaseFieldset,
|
|
24
|
+
Root: FieldsetRoot,
|
|
25
|
+
Legend: FieldsetLegend,
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Base UI's form: it validates its fields (by `name`) and shows `errors`
|
|
29
|
+
* (e.g. a server's) on them; `onFormSubmit` gets the values.
|
|
30
|
+
*/
|
|
31
|
+
export const Form = BaseForm;
|
|
32
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/form/main.tsx"],"names":[],"mappings":";AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,sEAAsE;AACtE,4EAA4E;AAC5E,wEAAwE;AACxE,wEAAwE;AACxE,4DAA4D;AAC5D,4EAA4E;AAC5E,6BAA6B;AAE7B;;;GAGG;AACH,MAAM,YAAY,GAAG,UAAU,CAG7B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAChB,KAAC,YAAY,CAAC,IAAI,IAChB,GAAG,EAAE,GAAG,KACJ,KAAK,EACT,MAAM,EACJ,KAAK,CAAC,MAAM,IAAI,CACd,KAAC,IAAI,CAAC,OAAO,IACX,MAAM,EAEJ,mBAAU,SAAS,EAAC,6BAA6B,GAAG,GAEtD,CACH,GAEH,CACH,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,cAAc,GAAG,UAAU,CAC/B,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC3C,KAAC,YAAY,CAAC,MAAM,IAClB,GAAG,EAAE,GAAG,KACJ,KAAK,EACT,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAC,IAAI,CAAC,MAAM,IAAC,UAAU,EAAE,UAAU,GAAI,YAE/D,KAAC,IAAI,CAAC,KAAK,cAAE,QAAQ,GAAc,GACf,CACvB,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,YAAY;IACf,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Fieldset as BaseFieldset } from '@base-ui/react/fieldset';
|
|
2
|
+
import type { ListHeaderProps } from '../list/main.js';
|
|
3
|
+
export type FieldsetLegendProps = Omit<BaseFieldset.Legend.Props, 'ref'> & Pick<ListHeaderProps, 'prominence'>;
|
|
4
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/form/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GACtE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/components/form/props.tsx"],"names":[],"mappings":""}
|