@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
|
@@ -28,7 +28,9 @@ import { cn, usePointerDrag, withStyle } from '../utils/main.js';
|
|
|
28
28
|
// current side (Framework7: swipes within 300ms toggle).
|
|
29
29
|
// - The browser's default focus ring is kept.
|
|
30
30
|
// - Indeterminate (as a checkbox, which the platform's switches are; UIKit:
|
|
31
|
-
// none): the knob in the middle, on the off color
|
|
31
|
+
// none): the knob in the middle, on the off color; checked, the on color
|
|
32
|
+
// from the start up to the knob, fading out (so checked and unchecked
|
|
33
|
+
// differ), faded in and out as the state changes.
|
|
32
34
|
//
|
|
33
35
|
// On/off labels (UIKit's accessibility setting “On/Off Labels”, measured on
|
|
34
36
|
// Apple's illustration): a 9px “I” bar (white) and a 9px “O” ring (tertiary
|
|
@@ -64,17 +66,20 @@ const Root = forwardRef(({ className, onClickCapture, onLostPointerCapture, onPo
|
|
|
64
66
|
input.indeterminate = indeterminate;
|
|
65
67
|
});
|
|
66
68
|
const handlers = usePointerDrag({
|
|
67
|
-
end: (root, drag,
|
|
69
|
+
end: (root, drag, isCancelled) => {
|
|
68
70
|
for (const property of dragProperties) {
|
|
69
71
|
root.style.removeProperty(property);
|
|
70
72
|
}
|
|
71
|
-
if (
|
|
73
|
+
if (isCancelled)
|
|
72
74
|
return;
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
+
const isQuick = performance.now() - drag.startTime < 300;
|
|
76
|
+
const isTowardsCurrent = drag.isChecked
|
|
77
|
+
? drag.moved > 0
|
|
78
|
+
: drag.moved < 0;
|
|
75
79
|
// The native click following this release toggles; suppress it
|
|
76
80
|
// unless the release acts as a tap.
|
|
77
|
-
suppressClickRef.current =
|
|
81
|
+
suppressClickRef.current =
|
|
82
|
+
drag.isFlipped || !isQuick || isTowardsCurrent;
|
|
78
83
|
setTimeout(() => {
|
|
79
84
|
suppressClickRef.current = false;
|
|
80
85
|
});
|
|
@@ -84,10 +89,10 @@ const Root = forwardRef(({ className, onClickCapture, onLostPointerCapture, onPo
|
|
|
84
89
|
const start = Math.max(drag.min, Math.min(drag.start + drag.moved, drag.max));
|
|
85
90
|
root.style.setProperty('--uikit-switch-knob-move-duration', '0s');
|
|
86
91
|
root.style.setProperty('--uikit-switch-knob-start', `${start}px`);
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
92
|
+
const willBeChecked = (start - drag.min) / (drag.max - drag.min) > 0.5;
|
|
93
|
+
if (willBeChecked === isChecked(root))
|
|
89
94
|
return;
|
|
90
|
-
drag.
|
|
95
|
+
drag.isFlipped = true;
|
|
91
96
|
root.click();
|
|
92
97
|
},
|
|
93
98
|
start: (root, event) => {
|
|
@@ -104,9 +109,9 @@ const Root = forwardRef(({ className, onClickCapture, onLostPointerCapture, onPo
|
|
|
104
109
|
const min = Number.parseFloat(getComputedStyle(thumb).top);
|
|
105
110
|
root.style.setProperty('--uikit-switch-pressed', '1');
|
|
106
111
|
return {
|
|
107
|
-
|
|
112
|
+
isChecked: isChecked(root),
|
|
108
113
|
direction,
|
|
109
|
-
|
|
114
|
+
isFlipped: false,
|
|
110
115
|
max: rootRect.width - thumbRect.width - min,
|
|
111
116
|
min,
|
|
112
117
|
moved: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/switch/main.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC7D,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,EAAE,cAAuC,KAC7C,KAAK,KACL,QAAQ,EACZ,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,sBAC5B,MAAM,EACvB,cAAc,EAAE,kBAAkB,aAEjC,QAAQ,EACR,WAAW,CAAC,CAAC,CAAC,CACb,8BACE,8BACc,MAAM,EAClB,SAAS,EAAC,uBAAuB,sBAChB,OAAO,GACxB,EACF,8BACc,MAAM,EAClB,SAAS,EAAC,wBAAwB,sBACjB,OAAO,GACxB,IACD,CACJ,CAAC,CAAC,CAAC,IAAI,IACC,CACZ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,KAAK,GAAG,UAAU,CAGtB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,UAAU,CAAC,KAAK,IACf,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC,sBAC7B,OAAO,KACpB,KAAK,GACT,CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,UAAU;IACb,IAAI;IACJ,KAAK;CACN,CAAC"}
|
|
@@ -21,9 +21,9 @@ export type SwitchRootProps = BaseSwitch.Root.Props & {
|
|
|
21
21
|
tint?: string;
|
|
22
22
|
};
|
|
23
23
|
export type Drag = {
|
|
24
|
-
checked: boolean;
|
|
25
24
|
direction: 1 | -1;
|
|
26
|
-
|
|
25
|
+
isChecked: boolean;
|
|
26
|
+
isFlipped: boolean;
|
|
27
27
|
max: number;
|
|
28
28
|
min: number;
|
|
29
29
|
moved: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/switch/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG;IACpD;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/switch/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG;IACpD;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
align-self: center;
|
|
61
61
|
border-radius: 100px;
|
|
62
62
|
touch-action: pan-y;
|
|
63
|
+
-webkit-user-select: none;
|
|
63
64
|
user-select: none;
|
|
64
65
|
vertical-align: middle;
|
|
65
66
|
|
|
@@ -78,6 +79,26 @@
|
|
|
78
79
|
transition-duration: var(--glass-ios-lens-duration);
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
/* Mixed but checked (see below): the on color from its start, fading
|
|
83
|
+
out halfway (under the knob), faded in. */
|
|
84
|
+
&::after {
|
|
85
|
+
position: absolute;
|
|
86
|
+
z-index: 0;
|
|
87
|
+
border-radius: inherit;
|
|
88
|
+
background-color: var(--uikit-switch-on-color);
|
|
89
|
+
content: '';
|
|
90
|
+
inset: 0;
|
|
91
|
+
mask-image: linear-gradient(to right, #000 25%, transparent 50%);
|
|
92
|
+
opacity: 0;
|
|
93
|
+
transform: scale(calc(1 - 0.25 * var(--uikit-switch-pressed)));
|
|
94
|
+
transition-duration: var(--glass-ios-lens-duration);
|
|
95
|
+
transition-property: opacity, transform;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:dir(rtl)::after {
|
|
99
|
+
mask-image: linear-gradient(to left, #000 25%, transparent 50%);
|
|
100
|
+
}
|
|
101
|
+
|
|
81
102
|
&[data-checked] {
|
|
82
103
|
--uikit-switch-knob-start: calc(
|
|
83
104
|
100% - var(--uikit-switch-knob-width) - 2px
|
|
@@ -103,7 +124,9 @@
|
|
|
103
124
|
opacity: 0.55;
|
|
104
125
|
}
|
|
105
126
|
|
|
106
|
-
/* Mixed: the knob centered, the track off (over checked, see above)
|
|
127
|
+
/* Mixed: the knob centered, the track off (over checked, see above);
|
|
128
|
+
checked, its start half tinted (see above), so it tells which it'll
|
|
129
|
+
be. */
|
|
107
130
|
&[data-indeterminate] {
|
|
108
131
|
--uikit-switch-knob-start: calc(50% - var(--uikit-switch-knob-width) / 2);
|
|
109
132
|
|
|
@@ -111,6 +134,10 @@
|
|
|
111
134
|
background-color: var(--uikit-switch-off-color);
|
|
112
135
|
}
|
|
113
136
|
|
|
137
|
+
&[data-checked]::after {
|
|
138
|
+
opacity: 1;
|
|
139
|
+
}
|
|
140
|
+
|
|
114
141
|
& > [data-switch-part='label'] {
|
|
115
142
|
opacity: 0;
|
|
116
143
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './style.css';
|
|
2
2
|
import type { SymbolProps } from './props.js';
|
|
3
|
-
export type { SymbolProps } from './props.js';
|
|
4
|
-
/** An SF Symbol
|
|
3
|
+
export type { SymbolIcon, SymbolProps } from './props.js';
|
|
4
|
+
/** An icon (e.g. an SF Symbol), with e.g. a `Badge`. */
|
|
5
5
|
export declare const Symbol: import("preact").FunctionalComponent<import("react").PropsWithoutRef<SymbolProps> & {
|
|
6
6
|
ref?: import("preact").Ref<HTMLSpanElement> | undefined;
|
|
7
7
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/symbol/main.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAKrB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/symbol/main.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAKrB,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyE1D,wDAAwD;AACxD,eAAO,MAAM,MAAM;;EAyClB,CAAC"}
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import './style.css';
|
|
3
|
-
import { forwardRef
|
|
4
|
-
import { cn } from '../utils/main.js';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { cn, withStyle } from '../utils/main.js';
|
|
5
5
|
// An SF Symbol, sized like the SF Pro glyph at the current font size, so it
|
|
6
|
-
// can stand in for one (e.g. `` in Figma). Its
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// (`--uikit-symbol-thinning`, in its units), which takes as much off its
|
|
10
|
-
// edges.
|
|
6
|
+
// can stand in for one (e.g. `` in Figma). Its outlines are filled as
|
|
7
|
+
// given (SF Symbols': the Regular weight only, whatever its host's font
|
|
8
|
+
// weight), its layers at their relative opacities.
|
|
11
9
|
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
10
|
+
// Emphasized (e.g. a selected tab's), it shows its `emphasizedIcon` (e.g.
|
|
11
|
+
// the filled variant) instead: both glyphs stacked, faded by
|
|
12
|
+
// `--uikit-symbol-emphasis` (0 to 1, inherited: set by its host, e.g. on
|
|
13
|
+
// its selected state; see styles.css), so no state of the app's needs to
|
|
14
|
+
// pick the icon.
|
|
15
|
+
//
|
|
16
|
+
// Its children (e.g. a `Badge`) sit on it: the glyphs alone are blended
|
|
17
|
+
// and scaled by its host (`--uikit-symbol-blend`, `--uikit-symbol-scale`,
|
|
14
18
|
// e.g. a glass button's vibrant content), so they stay solid.
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const [width = 0, height = 0] =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
19
|
+
// In a line of text, its ink's center on the text's: half the cap height up
|
|
20
|
+
// from the baseline (`baselineShift`, see style.css).
|
|
21
|
+
//
|
|
22
|
+
// SF Symbols' paths are SF Pro glyphs at 20pt (e.g. `circle` is 19.92 wide,
|
|
23
|
+
// the glyph's ink box 0.996em): other icons give their own units.
|
|
24
|
+
const defaultUnitsPerEm = 20;
|
|
25
|
+
/** An icon's size (em), from its view box. */
|
|
26
|
+
const sizeOf = ({ unitsPerEm = defaultUnitsPerEm, viewBox }) => {
|
|
27
|
+
const [width = 0, height = 0] = viewBox.split(' ').slice(2).map(Number);
|
|
28
|
+
return { height: height / unitsPerEm, width: width / unitsPerEm };
|
|
29
|
+
};
|
|
30
|
+
// An icon's glyph: its layers, each at its opacity relative to the most
|
|
31
|
+
// opaque one's.
|
|
32
|
+
const Glyph = ({ icon, variant, }) => {
|
|
33
|
+
const { height, width } = sizeOf(icon);
|
|
34
|
+
const opacity = Math.max(...icon.svgPathData.map(({ fillOpacity = 1 }) => fillOpacity));
|
|
35
|
+
return (_jsx("span", { className: "uikit-symbol-glyph", "data-symbol-part": "glyph", "data-variant": variant, children: _jsx("svg", { "aria-hidden": "true", fill: "currentcolor", height: `${String(height)}em`, viewBox: icon.viewBox, width: `${String(width)}em`, children: icon.svgPathData.map(({ d, fillOpacity = 1 }, index) => (_jsx("path", { d: d, fillOpacity: fillOpacity === opacity ? undefined : fillOpacity / opacity }, index))) }) }));
|
|
36
|
+
};
|
|
37
|
+
/** An icon (e.g. an SF Symbol), with e.g. a `Badge`. */
|
|
38
|
+
export const Symbol = forwardRef(({ baselineShift = 'optical', children, className, emphasizedIcon, icon, style, ...props }, ref) => (_jsxs("span", { ref: ref, "data-baseline-shift": baselineShift, "data-symbol": icon.sourceName, style: withStyle({ '--uikit-symbol-height': `${String(sizeOf(icon).height)}em` }, style), ...props, className: cn('uikit-symbol', className), children: [emphasizedIcon ? (_jsxs(_Fragment, { children: [_jsx(Glyph, { icon: icon, variant: "regular" }), _jsx(Glyph, { icon: emphasizedIcon, variant: "emphasized" })] })) : (_jsx(Glyph, { icon: icon })), children] })));
|
|
32
39
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/components/symbol/main.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAA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OAAO,EAAC,YAAY,GACpB,IACD,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,KAAK,IAAC,IAAI,EAAE,IAAI,GAAI,CACtB,EACA,QAAQ,IACJ,CACR,CACF,CAAC"}
|
|
@@ -1,10 +1,45 @@
|
|
|
1
|
-
import type { IconDefinition } from '@bradleyhodges/sfsymbols-types';
|
|
2
1
|
import type { ComponentProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* An icon's outlines: filled paths in a view box, e.g. an SF Symbol from
|
|
4
|
+
* `@bradleyhodges/sfsymbols` (`sfBell`; its icons have this shape, no
|
|
5
|
+
* dependency needed; mind Apple's terms for SF Symbols).
|
|
6
|
+
*/
|
|
7
|
+
export type SymbolIcon = {
|
|
8
|
+
/** Its name (e.g. `bell`), as its `data-symbol`. */
|
|
9
|
+
sourceName?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Its outlines (filled), each a layer: its opacity relative to the
|
|
12
|
+
* most opaque one's (SF Symbols' hierarchical layers: 0.85 primary,
|
|
13
|
+
* 0.425 secondary, 0.2125 tertiary; drawn 1, 0.5, 0.25).
|
|
14
|
+
*/
|
|
15
|
+
svgPathData: readonly {
|
|
16
|
+
d: string;
|
|
17
|
+
fillOpacity?: number;
|
|
18
|
+
}[];
|
|
19
|
+
/**
|
|
20
|
+
* Its view box's units in an em (its size at the font size).
|
|
21
|
+
* @default 20 (SF Symbols' outlines: SF Pro glyphs at 20pt)
|
|
22
|
+
*/
|
|
23
|
+
unitsPerEm?: number;
|
|
24
|
+
/** Its view box (`minX minY width height`): its ink's, as SF Symbols'. */
|
|
25
|
+
viewBox: string;
|
|
26
|
+
};
|
|
3
27
|
export type SymbolProps = ComponentProps<'span'> & {
|
|
4
28
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
29
|
+
* Its place in a line of text: its ink's center on the text's (its cap
|
|
30
|
+
* height's middle, as SF Symbols set with SF Pro), or its ink's bottom on
|
|
31
|
+
* the baseline. In a flex or grid container (e.g. a button's), none: the
|
|
32
|
+
* container places it.
|
|
33
|
+
* @default 'optical'
|
|
34
|
+
*/
|
|
35
|
+
baselineShift?: 'none' | 'optical';
|
|
36
|
+
/**
|
|
37
|
+
* The icon shown emphasized (e.g. `sfBellFill`), in place of `icon`: as
|
|
38
|
+
* much as its host emphasizes it (`--uikit-symbol-emphasis`, 0 to 1, e.g.
|
|
39
|
+
* a selected tab's), with no state of its own.
|
|
7
40
|
*/
|
|
8
|
-
|
|
41
|
+
emphasizedIcon?: SymbolIcon;
|
|
42
|
+
/** The icon (see `SymbolIcon`), e.g. `sfBell`. */
|
|
43
|
+
icon: SymbolIcon;
|
|
9
44
|
};
|
|
10
45
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/symbol/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/components/symbol/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,EAAE,SAAS;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5D;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IACjD;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,kDAAkD;IAClD,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC"}
|
|
@@ -6,12 +6,19 @@
|
|
|
6
6
|
position: relative;
|
|
7
7
|
display: inline-flex;
|
|
8
8
|
flex: none;
|
|
9
|
+
|
|
10
|
+
/* In a line of text, its ink's center on the text's: half the cap
|
|
11
|
+
height up from the baseline, its ink's bottom (its baseline) half its
|
|
12
|
+
height below that (`--uikit-symbol-height`, see main.tsx). In a flex
|
|
13
|
+
or grid container, no effect. */
|
|
14
|
+
&[data-baseline-shift='optical'] {
|
|
15
|
+
vertical-align: calc(0.5cap - var(--uikit-symbol-height, 1em) / 2);
|
|
16
|
+
}
|
|
9
17
|
}
|
|
10
18
|
|
|
11
|
-
/* Blended and scaled as its host's content (see main.tsx).
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`star.fill` 0.096em). */
|
|
19
|
+
/* Blended and scaled as its host's content (see main.tsx). The margin is
|
|
20
|
+
the glyph's side bearing (SF Pro: `circle` 0.087em, `magnifyingglass`
|
|
21
|
+
0.112em, `star.fill` 0.096em). */
|
|
15
22
|
.uikit-symbol-glyph {
|
|
16
23
|
display: inline-flex;
|
|
17
24
|
mix-blend-mode: var(--uikit-symbol-blend, normal);
|
|
@@ -22,5 +29,19 @@
|
|
|
22
29
|
overflow: visible;
|
|
23
30
|
margin-inline: 0.1em;
|
|
24
31
|
}
|
|
32
|
+
|
|
33
|
+
/* Its regular and emphasized glyphs, stacked (the emphasized one
|
|
34
|
+
centered on the regular one's box), faded by its host's emphasis. */
|
|
35
|
+
&[data-variant='regular'] {
|
|
36
|
+
opacity: calc(1 - var(--uikit-symbol-emphasis));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&[data-variant='emphasized'] {
|
|
40
|
+
position: absolute;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
inset: 0;
|
|
44
|
+
opacity: var(--uikit-symbol-emphasis);
|
|
45
|
+
}
|
|
25
46
|
}
|
|
26
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/tab-bar/main.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AA2BrB,OAAO,KAAK,EAGV,uBAAuB,EAKvB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/components/tab-bar/main.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AA2BrB,OAAO,KAAK,EAGV,uBAAuB,EAKvB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AA4OpB;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,EACtC,QAAQ,SAAS,CAAC,SAAS,KAAK,EAAE,CAAC,EAAE,EACrC,OAAO,KAAK,GAAG,SAAS,KACvB,uBAAuB,EAQzB,CAAC;AA21CF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;CAUlB,CAAC"}
|