@multiplatform.one/forms 7.67.0 → 7.69.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/cjs/AdaptivePopup/index.cjs +45 -5
- package/dist/cjs/AdaptivePopup/index.native.js +47 -5
- package/dist/cjs/AdaptivePopup/index.native.js.map +1 -1
- package/dist/cjs/Button/IconButtonGroup.cjs +95 -0
- package/dist/cjs/Button/IconButtonGroup.native.js +101 -0
- package/dist/cjs/Button/IconButtonGroup.native.js.map +1 -0
- package/dist/cjs/Button/glass.cjs +34 -0
- package/dist/cjs/Button/glass.native.js +55 -0
- package/dist/cjs/Button/glass.native.js.map +1 -0
- package/dist/cjs/Button/iconButtonGroupContext.cjs +33 -0
- package/dist/cjs/Button/iconButtonGroupContext.native.js +36 -0
- package/dist/cjs/Button/iconButtonGroupContext.native.js.map +1 -0
- package/dist/cjs/Button/index.cjs +174 -30
- package/dist/cjs/Button/index.native.js +174 -29
- package/dist/cjs/Button/index.native.js.map +1 -1
- package/dist/cjs/Button/mediaPlate.cjs +31 -0
- package/dist/cjs/Button/mediaPlate.native.js +34 -0
- package/dist/cjs/Button/mediaPlate.native.js.map +1 -0
- package/dist/cjs/ContextualSaveBar/index.cjs +6 -8
- package/dist/cjs/ContextualSaveBar/index.native.js +6 -8
- package/dist/cjs/ContextualSaveBar/index.native.js.map +1 -1
- package/dist/cjs/DescriptionList/index.cjs +0 -1
- package/dist/cjs/DescriptionList/index.native.js +0 -1
- package/dist/cjs/DescriptionList/index.native.js.map +1 -1
- package/dist/cjs/FloatingPanel/index.native.js +21 -16
- package/dist/cjs/FloatingPanel/index.native.js.map +1 -1
- package/dist/cjs/fields/Barcode/BarcodeScanner.cjs +7 -8
- package/dist/cjs/fields/Barcode/BarcodeScanner.native.js +7 -8
- package/dist/cjs/fields/Barcode/BarcodeScanner.native.js.map +1 -1
- package/dist/cjs/fields/FileUpload/index.cjs +86 -60
- package/dist/cjs/fields/FileUpload/index.native.js +99 -73
- package/dist/cjs/fields/FileUpload/index.native.js.map +1 -1
- package/dist/cjs/fields/Geolocation/index.cjs +7 -8
- package/dist/cjs/fields/Geolocation/index.native.js +7 -8
- package/dist/cjs/fields/Geolocation/index.native.js.map +1 -1
- package/dist/cjs/fields/ImageField/index.cjs +4 -6
- package/dist/cjs/fields/ImageField/index.native.js +4 -6
- package/dist/cjs/fields/ImageField/index.native.js.map +1 -1
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.cjs +20 -28
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.native.js +20 -28
- package/dist/cjs/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/cjs/index.cjs +11 -1
- package/dist/cjs/index.native.js +10 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared/colorRamps.cjs +0 -8
- package/dist/cjs/shared/colorRamps.native.js +0 -8
- package/dist/cjs/shared/colorRamps.native.js.map +1 -1
- package/dist/cjs/standardActions.cjs +117 -0
- package/dist/cjs/standardActions.native.js +120 -0
- package/dist/cjs/standardActions.native.js.map +1 -0
- package/dist/esm/AdaptivePopup/index.mjs +45 -5
- package/dist/esm/AdaptivePopup/index.mjs.map +1 -1
- package/dist/esm/AdaptivePopup/index.native.js +47 -5
- package/dist/esm/AdaptivePopup/index.native.js.map +1 -1
- package/dist/esm/Button/IconButtonGroup.mjs +69 -0
- package/dist/esm/Button/IconButtonGroup.mjs.map +1 -0
- package/dist/esm/Button/IconButtonGroup.native.js +72 -0
- package/dist/esm/Button/IconButtonGroup.native.js.map +1 -0
- package/dist/esm/Button/glass.mjs +8 -0
- package/dist/esm/Button/glass.mjs.map +1 -0
- package/dist/esm/Button/glass.native.js +26 -0
- package/dist/esm/Button/glass.native.js.map +1 -0
- package/dist/esm/Button/iconButtonGroupContext.mjs +7 -0
- package/dist/esm/Button/iconButtonGroupContext.mjs.map +1 -0
- package/dist/esm/Button/iconButtonGroupContext.native.js +7 -0
- package/dist/esm/Button/iconButtonGroupContext.native.js.map +1 -0
- package/dist/esm/Button/index.mjs +166 -30
- package/dist/esm/Button/index.mjs.map +1 -1
- package/dist/esm/Button/index.native.js +167 -30
- package/dist/esm/Button/index.native.js.map +1 -1
- package/dist/esm/Button/mediaPlate.mjs +6 -0
- package/dist/esm/Button/mediaPlate.mjs.map +1 -0
- package/dist/esm/Button/mediaPlate.native.js +6 -0
- package/dist/esm/Button/mediaPlate.native.js.map +1 -0
- package/dist/esm/ContextualSaveBar/index.mjs +7 -9
- package/dist/esm/ContextualSaveBar/index.mjs.map +1 -1
- package/dist/esm/ContextualSaveBar/index.native.js +7 -9
- package/dist/esm/ContextualSaveBar/index.native.js.map +1 -1
- package/dist/esm/DescriptionList/index.mjs +0 -1
- package/dist/esm/DescriptionList/index.mjs.map +1 -1
- package/dist/esm/DescriptionList/index.native.js +0 -1
- package/dist/esm/DescriptionList/index.native.js.map +1 -1
- package/dist/esm/FloatingPanel/index.native.js +22 -17
- package/dist/esm/FloatingPanel/index.native.js.map +1 -1
- package/dist/esm/fields/Barcode/BarcodeScanner.mjs +8 -9
- package/dist/esm/fields/Barcode/BarcodeScanner.mjs.map +1 -1
- package/dist/esm/fields/Barcode/BarcodeScanner.native.js +8 -9
- package/dist/esm/fields/Barcode/BarcodeScanner.native.js.map +1 -1
- package/dist/esm/fields/FileUpload/index.mjs +87 -61
- package/dist/esm/fields/FileUpload/index.mjs.map +1 -1
- package/dist/esm/fields/FileUpload/index.native.js +100 -74
- package/dist/esm/fields/FileUpload/index.native.js.map +1 -1
- package/dist/esm/fields/Geolocation/index.mjs +8 -9
- package/dist/esm/fields/Geolocation/index.mjs.map +1 -1
- package/dist/esm/fields/Geolocation/index.native.js +8 -9
- package/dist/esm/fields/Geolocation/index.native.js.map +1 -1
- package/dist/esm/fields/ImageField/index.mjs +6 -8
- package/dist/esm/fields/ImageField/index.mjs.map +1 -1
- package/dist/esm/fields/ImageField/index.native.js +6 -8
- package/dist/esm/fields/ImageField/index.native.js.map +1 -1
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.mjs +20 -28
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.mjs.map +1 -1
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.native.js +20 -28
- package/dist/esm/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/shared/colorRamps.mjs +0 -8
- package/dist/esm/shared/colorRamps.mjs.map +1 -1
- package/dist/esm/shared/colorRamps.native.js +0 -8
- package/dist/esm/shared/colorRamps.native.js.map +1 -1
- package/dist/esm/standardActions.mjs +91 -0
- package/dist/esm/standardActions.mjs.map +1 -0
- package/dist/esm/standardActions.native.js +91 -0
- package/dist/esm/standardActions.native.js.map +1 -0
- package/dist/jsx/AdaptivePopup/index.mjs +45 -5
- package/dist/jsx/AdaptivePopup/index.mjs.map +1 -1
- package/dist/jsx/AdaptivePopup/index.native.js +47 -5
- package/dist/jsx/AdaptivePopup/index.native.js.map +1 -1
- package/dist/jsx/Button/IconButtonGroup.mjs +69 -0
- package/dist/jsx/Button/IconButtonGroup.mjs.map +1 -0
- package/dist/jsx/Button/IconButtonGroup.native.js +101 -0
- package/dist/jsx/Button/IconButtonGroup.native.js.map +1 -0
- package/dist/jsx/Button/glass.mjs +8 -0
- package/dist/jsx/Button/glass.mjs.map +1 -0
- package/dist/jsx/Button/glass.native.js +55 -0
- package/dist/jsx/Button/glass.native.js.map +1 -0
- package/dist/jsx/Button/iconButtonGroupContext.mjs +7 -0
- package/dist/jsx/Button/iconButtonGroupContext.mjs.map +1 -0
- package/dist/jsx/Button/iconButtonGroupContext.native.js +36 -0
- package/dist/jsx/Button/iconButtonGroupContext.native.js.map +1 -0
- package/dist/jsx/Button/index.mjs +166 -30
- package/dist/jsx/Button/index.mjs.map +1 -1
- package/dist/jsx/Button/index.native.js +174 -29
- package/dist/jsx/Button/index.native.js.map +1 -1
- package/dist/jsx/Button/mediaPlate.mjs +6 -0
- package/dist/jsx/Button/mediaPlate.mjs.map +1 -0
- package/dist/jsx/Button/mediaPlate.native.js +34 -0
- package/dist/jsx/Button/mediaPlate.native.js.map +1 -0
- package/dist/jsx/ContextualSaveBar/index.mjs +7 -9
- package/dist/jsx/ContextualSaveBar/index.mjs.map +1 -1
- package/dist/jsx/ContextualSaveBar/index.native.js +6 -8
- package/dist/jsx/ContextualSaveBar/index.native.js.map +1 -1
- package/dist/jsx/DescriptionList/index.mjs +0 -1
- package/dist/jsx/DescriptionList/index.mjs.map +1 -1
- package/dist/jsx/DescriptionList/index.native.js +0 -1
- package/dist/jsx/DescriptionList/index.native.js.map +1 -1
- package/dist/jsx/FloatingPanel/index.native.js +21 -16
- package/dist/jsx/FloatingPanel/index.native.js.map +1 -1
- package/dist/jsx/fields/Barcode/BarcodeScanner.mjs +8 -9
- package/dist/jsx/fields/Barcode/BarcodeScanner.mjs.map +1 -1
- package/dist/jsx/fields/Barcode/BarcodeScanner.native.js +7 -8
- package/dist/jsx/fields/Barcode/BarcodeScanner.native.js.map +1 -1
- package/dist/jsx/fields/FileUpload/index.mjs +87 -61
- package/dist/jsx/fields/FileUpload/index.mjs.map +1 -1
- package/dist/jsx/fields/FileUpload/index.native.js +99 -73
- package/dist/jsx/fields/FileUpload/index.native.js.map +1 -1
- package/dist/jsx/fields/Geolocation/index.mjs +8 -9
- package/dist/jsx/fields/Geolocation/index.mjs.map +1 -1
- package/dist/jsx/fields/Geolocation/index.native.js +7 -8
- package/dist/jsx/fields/Geolocation/index.native.js.map +1 -1
- package/dist/jsx/fields/ImageField/index.mjs +6 -8
- package/dist/jsx/fields/ImageField/index.mjs.map +1 -1
- package/dist/jsx/fields/ImageField/index.native.js +4 -6
- package/dist/jsx/fields/ImageField/index.native.js.map +1 -1
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.mjs +20 -28
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.mjs.map +1 -1
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.native.js +20 -28
- package/dist/jsx/fields/nativeDateTime/OsDateTimeSheet.native.js.map +1 -1
- package/dist/jsx/index.js +3 -2
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +3 -2
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +10 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared/colorRamps.mjs +0 -8
- package/dist/jsx/shared/colorRamps.mjs.map +1 -1
- package/dist/jsx/shared/colorRamps.native.js +0 -8
- package/dist/jsx/shared/colorRamps.native.js.map +1 -1
- package/dist/jsx/standardActions.mjs +91 -0
- package/dist/jsx/standardActions.mjs.map +1 -0
- package/dist/jsx/standardActions.native.js +120 -0
- package/dist/jsx/standardActions.native.js.map +1 -0
- package/package.json +12 -8
- package/src/AdaptivePopup/AdaptivePopup.spec.tsx +44 -0
- package/src/AdaptivePopup/AdaptivePopup.stories.tsx +12 -32
- package/src/AdaptivePopup/index.tsx +65 -13
- package/src/Button/Button.disabledGlyph.spec.tsx +111 -0
- package/src/Button/Button.iconButton.spec.tsx +341 -0
- package/src/Button/Button.stories.tsx +179 -2
- package/src/Button/IconButtonGroup.spec.tsx +126 -0
- package/src/Button/IconButtonGroup.tsx +87 -0
- package/src/Button/glass.native.ts +51 -0
- package/src/Button/glass.ts +33 -0
- package/src/Button/iconButtonGroupContext.ts +14 -0
- package/src/Button/index.tsx +314 -42
- package/src/Button/mediaPlate.ts +9 -0
- package/src/ContextualSaveBar/ContextualSaveBar.spec.tsx +3 -1
- package/src/ContextualSaveBar/ContextualSaveBar.stories.tsx +2 -2
- package/src/ContextualSaveBar/index.tsx +7 -10
- package/src/ControlGroup/ControlGroup.stories.tsx +3 -2
- package/src/DescriptionList/index.tsx +0 -1
- package/src/ErrorSummary.stories.tsx +2 -1
- package/src/FieldLayout.stories.tsx +3 -2
- package/src/FloatingPanel/FloatingPanel.pointMenu.native.spec.tsx +69 -0
- package/src/FloatingPanel/FloatingPanel.stories.tsx +6 -10
- package/src/FloatingPanel/index.native.tsx +25 -4
- package/src/Form/Form.stories.tsx +6 -5
- package/src/errorSummaryStories.spec.tsx +4 -4
- package/src/fields/Barcode/BarcodeScanner.native.tsx +10 -9
- package/src/fields/Barcode/BarcodeScanner.tsx +10 -9
- package/src/fields/Checkbox/Checkbox.stories.tsx +3 -3
- package/src/fields/Checkbox/CheckboxGroup.stories.tsx +2 -2
- package/src/fields/ColorPicker/ColorPicker.stories.tsx +2 -2
- package/src/fields/Combobox/Combobox.stories.tsx +2 -2
- package/src/fields/DatePicker/DatePicker.stories.tsx +2 -1
- package/src/fields/DatePicker/DateRangePicker.stories.tsx +2 -2
- package/src/fields/DatePicker/DatetimePicker.stories.tsx +2 -1
- package/src/fields/DatePicker/MonthPicker.stories.tsx +2 -2
- package/src/fields/DatePicker/MultiDatePicker.stories.tsx +2 -2
- package/src/fields/FileUpload/FileUpload.spec.tsx +14 -5
- package/src/fields/FileUpload/FileUpload.stories.tsx +2 -2
- package/src/fields/FileUpload/index.tsx +103 -77
- package/src/fields/Geolocation/index.tsx +12 -7
- package/src/fields/ImageField/ImageField.spec.tsx +5 -5
- package/src/fields/ImageField/ImageField.stories.tsx +2 -2
- package/src/fields/ImageField/index.tsx +6 -9
- package/src/fields/Input/Input.stories.tsx +2 -2
- package/src/fields/MentionInput/MentionInput.stories.tsx +2 -1
- package/src/fields/Progress/Progress.stories.tsx +2 -1
- package/src/fields/RadioGroup/RadioGroup.stories.tsx +2 -1
- package/src/fields/Signature/Signature.stories.tsx +2 -2
- package/src/fields/Stepper/Stepper.stories.tsx +2 -2
- package/src/fields/TextArea/TextArea.stories.tsx +2 -2
- package/src/fields/ToggleGroup/ToggleGroup.stories.tsx +2 -2
- package/src/fields/nativeDateTime/OsDateTimeSheet.presentation.spec.tsx +6 -5
- package/src/fields/nativeDateTime/OsDateTimeSheet.tsx +24 -12
- package/src/index.ts +18 -2
- package/src/shared/colorRamps.ts +1 -11
- package/src/standardActions.ts +96 -0
- package/types/AdaptivePopup/index.d.ts +13 -1
- package/types/AdaptivePopup/index.d.ts.map +1 -1
- package/types/Button/IconButtonGroup.d.ts +22 -0
- package/types/Button/IconButtonGroup.d.ts.map +1 -0
- package/types/Button/glass.d.ts +26 -0
- package/types/Button/glass.d.ts.map +1 -0
- package/types/Button/glass.native.d.ts +17 -0
- package/types/Button/glass.native.d.ts.map +1 -0
- package/types/Button/iconButtonGroupContext.d.ts +9 -0
- package/types/Button/iconButtonGroupContext.d.ts.map +1 -0
- package/types/Button/index.d.ts +55 -2
- package/types/Button/index.d.ts.map +1 -1
- package/types/Button/mediaPlate.d.ts +10 -0
- package/types/Button/mediaPlate.d.ts.map +1 -0
- package/types/ContextualSaveBar/index.d.ts.map +1 -1
- package/types/DescriptionList/index.d.ts.map +1 -1
- package/types/FloatingPanel/index.native.d.ts +2 -1
- package/types/FloatingPanel/index.native.d.ts.map +1 -1
- package/types/fields/Barcode/BarcodeScanner.d.ts.map +1 -1
- package/types/fields/Barcode/BarcodeScanner.native.d.ts.map +1 -1
- package/types/fields/FileUpload/index.d.ts.map +1 -1
- package/types/fields/Geolocation/index.d.ts.map +1 -1
- package/types/fields/ImageField/index.d.ts.map +1 -1
- package/types/fields/nativeDateTime/OsDateTimeSheet.d.ts.map +1 -1
- package/types/index.d.ts +4 -2
- package/types/index.d.ts.map +1 -1
- package/types/shared/colorRamps.d.ts +1 -11
- package/types/shared/colorRamps.d.ts.map +1 -1
- package/types/standardActions.d.ts +24 -0
- package/types/standardActions.d.ts.map +1 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var IconButtonGroup_exports = {};
|
|
26
|
+
__export(IconButtonGroup_exports, {
|
|
27
|
+
ICON_BUTTON_GLASS_MERGE_PX: () => ICON_BUTTON_GLASS_MERGE_PX,
|
|
28
|
+
IconButtonGroup: () => IconButtonGroup
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(IconButtonGroup_exports);
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_theme = require("@multiplatform.one/theme");
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_tamagui = require("tamagui");
|
|
35
|
+
var import_glass = require("./glass.native.js");
|
|
36
|
+
var import_mediaPlate = require("./mediaPlate.native.js");
|
|
37
|
+
var import_iconButtonGroupContext = require("./iconButtonGroupContext.native.js");
|
|
38
|
+
var ICON_BUTTON_GLASS_MERGE_PX = 22;
|
|
39
|
+
function IconButtonGroup(param) {
|
|
40
|
+
var {
|
|
41
|
+
plate,
|
|
42
|
+
children,
|
|
43
|
+
...rest
|
|
44
|
+
} = param;
|
|
45
|
+
var bar = (0, import_theme.useBarSurface)();
|
|
46
|
+
var [capsuleHeight, setCapsuleHeight] = (0, import_react.useState)(0);
|
|
47
|
+
if (plate === "media") {
|
|
48
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_iconButtonGroupContext.IconButtonGroupContext.Provider, {
|
|
49
|
+
value: "media",
|
|
50
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.Theme, {
|
|
51
|
+
name: "dark",
|
|
52
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.XStack, {
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
alignSelf: "flex-start",
|
|
55
|
+
borderRadius: 1e5,
|
|
56
|
+
backgroundColor: "$shadow4",
|
|
57
|
+
overflow: "hidden",
|
|
58
|
+
"data-mp-icon-button-group": "media",
|
|
59
|
+
...(0, import_theme.radiusClassProps)("R-IDENTITY", "icon button plate"),
|
|
60
|
+
...(import_tamagui.isWeb ? {
|
|
61
|
+
style: import_mediaPlate.MEDIA_PLATE_WEB_STYLE
|
|
62
|
+
} : void 0),
|
|
63
|
+
...rest,
|
|
64
|
+
children
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
var GlassView = bar ? (0, import_glass.loadGlassView)() : null;
|
|
70
|
+
var row = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.XStack, {
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
"data-mp-icon-button-group": GlassView ? "glass" : bar ? "bar" : "row",
|
|
73
|
+
...rest,
|
|
74
|
+
children
|
|
75
|
+
});
|
|
76
|
+
if (!GlassView) return row;
|
|
77
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_iconButtonGroupContext.IconButtonGroupContext.Provider, {
|
|
78
|
+
value: "glass",
|
|
79
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.View, {
|
|
80
|
+
position: "relative",
|
|
81
|
+
flexShrink: 1,
|
|
82
|
+
minWidth: 0,
|
|
83
|
+
onLayout: function onLayout(event) {
|
|
84
|
+
return setCapsuleHeight(event.nativeEvent.layout.height);
|
|
85
|
+
},
|
|
86
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(GlassView, {
|
|
87
|
+
glassEffectStyle: "regular",
|
|
88
|
+
pointerEvents: "none",
|
|
89
|
+
style: {
|
|
90
|
+
position: "absolute",
|
|
91
|
+
top: 0,
|
|
92
|
+
right: 0,
|
|
93
|
+
bottom: 0,
|
|
94
|
+
left: 0,
|
|
95
|
+
borderRadius: capsuleHeight / 2
|
|
96
|
+
}
|
|
97
|
+
}), row]
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=IconButtonGroup.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","IconButtonGroup_exports","ICON_BUTTON_GLASS_MERGE_PX","IconButtonGroup","module","exports","import_jsx_runtime","require","import_theme","import_react","import_tamagui","import_glass","import_mediaPlate","import_iconButtonGroupContext","param","plate","children","rest","bar","useBarSurface","capsuleHeight","setCapsuleHeight","useState","jsx","IconButtonGroupContext","Provider","Theme","XStack","alignItems","alignSelf","borderRadius","backgroundColor","overflow","radiusClassProps","isWeb","style","MEDIA_PLATE_WEB_STYLE","GlassView","loadGlassView","row"],"sources":["../../../src/Button/IconButtonGroup.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["loadGlassView","loadGlassContainer"],"sources":["../../../src/Button/glass.ts"],"sourcesContent":[null],"mappings":"AAsBO,SAASA,cAAA,EAA2C;EACzD,OAAO;AACT;AAMO,SAASC,mBAAA,EAAqD;EACnE,OAAO;AACT","ignoreList":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var glass_native_exports = {};
|
|
26
|
+
__export(glass_native_exports, {
|
|
27
|
+
loadGlassContainer: () => loadGlassContainer,
|
|
28
|
+
loadGlassView: () => loadGlassView
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(glass_native_exports);
|
|
31
|
+
var cachedGlassView;
|
|
32
|
+
var cachedGlassContainer;
|
|
33
|
+
function loadGlassView() {
|
|
34
|
+
if (cachedGlassView !== void 0) return cachedGlassView;
|
|
35
|
+
cachedGlassView = null;
|
|
36
|
+
try {
|
|
37
|
+
var _core_requireOptionalNativeModule, _glass_isLiquidGlassAvailable, _glass_isGlassEffectAPIAvailable;
|
|
38
|
+
var core = require("expo-modules-core");
|
|
39
|
+
if (((_core_requireOptionalNativeModule = core.requireOptionalNativeModule) === null || _core_requireOptionalNativeModule === void 0 ? void 0 : _core_requireOptionalNativeModule.call(core, "ExpoGlassEffect")) == null) return cachedGlassView;
|
|
40
|
+
var glass = require("expo-glass-effect");
|
|
41
|
+
if (glass.GlassView && ((_glass_isLiquidGlassAvailable = glass.isLiquidGlassAvailable) === null || _glass_isLiquidGlassAvailable === void 0 ? void 0 : _glass_isLiquidGlassAvailable.call(glass)) && ((_glass_isGlassEffectAPIAvailable = glass.isGlassEffectAPIAvailable) === null || _glass_isGlassEffectAPIAvailable === void 0 ? void 0 : _glass_isGlassEffectAPIAvailable.call(glass))) {
|
|
42
|
+
var _glass_GlassContainer;
|
|
43
|
+
cachedGlassView = glass.GlassView;
|
|
44
|
+
cachedGlassContainer = (_glass_GlassContainer = glass.GlassContainer) !== null && _glass_GlassContainer !== void 0 ? _glass_GlassContainer : null;
|
|
45
|
+
}
|
|
46
|
+
} catch (unused) {
|
|
47
|
+
cachedGlassView = null;
|
|
48
|
+
}
|
|
49
|
+
return cachedGlassView;
|
|
50
|
+
}
|
|
51
|
+
function loadGlassContainer() {
|
|
52
|
+
if (cachedGlassView === void 0) loadGlassView();
|
|
53
|
+
return cachedGlassContainer !== null && cachedGlassContainer !== void 0 ? cachedGlassContainer : null;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=glass.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["glass_native_exports","__export","loadGlassContainer","loadGlassView","module","exports","__toCommonJS","cachedGlassView","cachedGlassContainer","_core_requireOptionalNativeModule","_glass_isLiquidGlassAvailable","_glass_isGlassEffectAPIAvailable","core","require","requireOptionalNativeModule","call","glass","GlassView","isLiquidGlassAvailable","isGlassEffectAPIAvailable","_glass_GlassContainer","GlassContainer","unused"],"sources":["../../../src/Button/glass.native.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA,kBAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAN,oBAAA;AAAA,IAAIO,eAAA;AACJ,IAAIC,oBAAA;AAOO,SAASL,cAAA,EAAgB;EAChC,IAAII,eAAA,KAAoB,QAAW,OAAOA,eAAA;EAC1CA,eAAA,GAAkB;EAClB,IAAI;IACA,IAAIE,iCAAA,EAAmCC,6BAAA,EAA+BC,gCAAA;IACtE,IAAIC,IAAA,GAAOC,OAAA,CAAQ,mBAAmB;IACtC,MAAMJ,iCAAA,GAAoCG,IAAA,CAAKE,2BAAA,MAAiC,QAAQL,iCAAA,KAAsC,SAAS,SAASA,iCAAA,CAAkCM,IAAA,CAAKH,IAAA,EAAM,iBAAiB,MAAM,MAAM,OAAOL,eAAA;IACjO,IAAIS,KAAA,GAAQH,OAAA,CAAQ,mBAAmB;IACvC,IAAIG,KAAA,CAAMC,SAAA,MAAeP,6BAAA,GAAgCM,KAAA,CAAME,sBAAA,MAA4B,QAAQR,6BAAA,KAAkC,SAAS,SAASA,6BAAA,CAA8BK,IAAA,CAAKC,KAAK,QAAQL,gCAAA,GAAmCK,KAAA,CAAMG,yBAAA,MAA+B,QAAQR,gCAAA,KAAqC,SAAS,SAASA,gCAAA,CAAiCI,IAAA,CAAKC,KAAK,IAAI;MACzX,IAAII,qBAAA;MACJb,eAAA,GAAkBS,KAAA,CAAMC,SAAA;MACxBT,oBAAA,IAAwBY,qBAAA,GAAwBJ,KAAA,CAAMK,cAAA,MAAoB,QAAQD,qBAAA,KAA0B,SAASA,qBAAA,GAAwB;IACjJ;EACJ,SAASE,MAAA,EAAQ;IACbf,eAAA,GAAkB;EACtB;EACA,OAAOA,eAAA;AACX;AAKW,SAASL,mBAAA,EAAqB;EACrC,IAAIK,eAAA,KAAoB,QAAWJ,aAAA,CAAc;EACjD,OAAOK,oBAAA,KAAyB,QAAQA,oBAAA,KAAyB,SAASA,oBAAA,GAAuB;AACrG","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const IconButtonGroupContext = createContext(null);
|
|
3
|
+
function useIconButtonGroupGround() {
|
|
4
|
+
return useContext(IconButtonGroupContext);
|
|
5
|
+
}
|
|
6
|
+
export { IconButtonGroupContext, useIconButtonGroupGround };
|
|
7
|
+
//# sourceMappingURL=iconButtonGroupContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","IconButtonGroupContext","useIconButtonGroupGround"],"sources":["../../../src/Button/iconButtonGroupContext.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,EAAeC,UAAA,QAAkB;AASnC,MAAMC,sBAAA,GAAyBF,aAAA,CAAqC,IAAI;AAExE,SAASG,yBAAA,EAAkD;EAChE,OAAOF,UAAA,CAAWC,sBAAsB;AAC1C","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var iconButtonGroupContext_exports = {};
|
|
26
|
+
__export(iconButtonGroupContext_exports, {
|
|
27
|
+
IconButtonGroupContext: () => IconButtonGroupContext,
|
|
28
|
+
useIconButtonGroupGround: () => useIconButtonGroupGround
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(iconButtonGroupContext_exports);
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var IconButtonGroupContext = (0, import_react.createContext)(null);
|
|
33
|
+
function useIconButtonGroupGround() {
|
|
34
|
+
return (0, import_react.useContext)(IconButtonGroupContext);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=iconButtonGroupContext.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty"],"sources":["../../../src/Button/iconButtonGroupContext.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AASF,IAAAA,SAAM,GAAAC,MAAA,CAAAC,cAAyB;AAE/B,IAAAC,gBAAS,GAAAF,MAAA,CAAAG,wBAAkD;AAChE,IAAAC,iBAAkB,GAAAJ,MAAA,CAAAK,mBAAsB;AAC1C,IAAAC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA","ignoreList":[]}
|
|
@@ -15,6 +15,10 @@ import { formatActionLabel } from "../actionLabel.mjs";
|
|
|
15
15
|
import { formButtonColors, formCommonColors } from "../shared/colorRamps.mjs";
|
|
16
16
|
import { warnBareDisabled, warnPositiveTabIndex, warnSizeRecipeEscape } from "../shared/devWarn.mjs";
|
|
17
17
|
import { useControlGrouped } from "../shared/groupContext.mjs";
|
|
18
|
+
import { loadGlassView } from "./glass.mjs";
|
|
19
|
+
import { MEDIA_PLATE_WEB_STYLE } from "./mediaPlate.mjs";
|
|
20
|
+
import { useIconButtonGroupGround } from "./iconButtonGroupContext.mjs";
|
|
21
|
+
import { IconButtonGroup, ICON_BUTTON_GLASS_MERGE_PX } from "./IconButtonGroup.mjs";
|
|
18
22
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
23
|
const buttonSizeRecipes = recipeFamilies.control.recipes;
|
|
20
24
|
function resolveButtonSizeRecipe(size, family = "control", touch = false) {
|
|
@@ -179,6 +183,36 @@ const ButtonFrame = styled(View, {
|
|
|
179
183
|
size: "$true"
|
|
180
184
|
}
|
|
181
185
|
});
|
|
186
|
+
const ICON_BUTTON_PRESS_OPACITY = 0.35;
|
|
187
|
+
const ICON_BUTTON_GLYPH_PX = 24;
|
|
188
|
+
const ICON_BUTTON_NEUTRAL_GLYPH_PX = 24;
|
|
189
|
+
const PHOSPHOR_INK_RATIO = 208 / 256;
|
|
190
|
+
function iconButtonGlyphPx(rowLinePx) {
|
|
191
|
+
if (rowLinePx === void 0) return ICON_BUTTON_GLYPH_PX;
|
|
192
|
+
return Math.max(ICON_BUTTON_GLYPH_PX, Math.round(rowLinePx / PHOSPHOR_INK_RATIO));
|
|
193
|
+
}
|
|
194
|
+
const ICON_BUTTON_CIRCLE_GLYPH_RATIO = 0.58;
|
|
195
|
+
const INLINE_GLYPH_RATIO = 1.2;
|
|
196
|
+
function withGlyphWeight(icon, size, weight) {
|
|
197
|
+
if (icon == null || icon === false) return icon;
|
|
198
|
+
if (isValidElement(icon)) {
|
|
199
|
+
return cloneElement(icon, {
|
|
200
|
+
...(icon.props.size == null ? {
|
|
201
|
+
size
|
|
202
|
+
} : void 0),
|
|
203
|
+
...(icon.props.weight == null ? {
|
|
204
|
+
weight
|
|
205
|
+
} : void 0)
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (typeof icon === "function" || typeof icon === "object" && "$$typeof" in icon) {
|
|
209
|
+
return createElement(icon, {
|
|
210
|
+
size,
|
|
211
|
+
weight
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return icon;
|
|
215
|
+
}
|
|
182
216
|
function Button({
|
|
183
217
|
children,
|
|
184
218
|
action,
|
|
@@ -199,10 +233,13 @@ function Button({
|
|
|
199
233
|
iconAfter,
|
|
200
234
|
selected,
|
|
201
235
|
nested = false,
|
|
202
|
-
circular,
|
|
236
|
+
circular: circularProp,
|
|
203
237
|
chromeless,
|
|
204
238
|
edge,
|
|
205
239
|
accentInk,
|
|
240
|
+
plate,
|
|
241
|
+
inline,
|
|
242
|
+
glyphWeight,
|
|
206
243
|
verb,
|
|
207
244
|
noun,
|
|
208
245
|
actionRole,
|
|
@@ -261,7 +298,8 @@ function Button({
|
|
|
261
298
|
} = useStore(resolvedForm?.store ?? dummyStore, s => ({
|
|
262
299
|
isValid: s.isValid ?? true
|
|
263
300
|
}));
|
|
264
|
-
const
|
|
301
|
+
const primaryPlate = plate === "primary";
|
|
302
|
+
const intent = (accent || primaryPlate) && "accent" || error && "error" || warning && "warning" || success && "success" || void 0;
|
|
265
303
|
const sizeProp = props.size;
|
|
266
304
|
const {
|
|
267
305
|
knobProps,
|
|
@@ -278,8 +316,21 @@ function Button({
|
|
|
278
316
|
const hostAccentInk = useAccentOnSurface();
|
|
279
317
|
const hostIdentityInk = useIdentityInkOnSurface();
|
|
280
318
|
const grouped = useControlGrouped();
|
|
319
|
+
const labelled = verb != null || children != null && children !== false && children !== "";
|
|
320
|
+
const iconOnly = !labelled && Boolean(icon || iconAfter);
|
|
321
|
+
const circular = circularProp && !(iconOnly && chromeless === true && plate == null);
|
|
322
|
+
const groupGround = useIconButtonGroupGround();
|
|
323
|
+
const mediaPlate = iconOnly && plate === "media" && groupGround !== "media";
|
|
324
|
+
const confirmPlate = iconOnly && primaryPlate;
|
|
325
|
+
const iconButton = iconOnly && !mediaPlate && !confirmPlate && !grouped && chromeless !== false && outlined !== true && !circular;
|
|
281
326
|
if (isWeb) ensureKeyboardModalityTracking();
|
|
282
327
|
const barSurface = useBarSurface();
|
|
328
|
+
const neutralGlyph = iconButton && !(theme ?? intent) && !barSurface && accentInk == null && inline !== true;
|
|
329
|
+
if (iconButton) {
|
|
330
|
+
chromeless = true;
|
|
331
|
+
accentInk = accentInk ?? (!(theme ?? intent) && (barSurface || inline === true));
|
|
332
|
+
}
|
|
333
|
+
const resolvedGlyphWeight = glyphWeight ?? (iconOnly ? "bold" : "regular");
|
|
283
334
|
const elevatedGround = useElevatedSurface();
|
|
284
335
|
const darkScheme = isDarkThemeName(useThemeName());
|
|
285
336
|
const resolvedSize = typeof sizeProp === "number" ? sizeProp : knobProps.sizeToken;
|
|
@@ -325,19 +376,20 @@ function Button({
|
|
|
325
376
|
const tierDisabled = tier && disabledState.style !== "dimWhole" ? controlTierDisabled(tier) : void 0;
|
|
326
377
|
const hostScoped = fragment => Object.fromEntries(Object.entries(fragment).map(([key, value]) => [key, typeof value === "string" && value.startsWith("$") ? parentScopeTheme[value.slice(1)]?.val ?? value : value]));
|
|
327
378
|
const washOnHost = Boolean(unavailable && activeThemeName && solidPaletteThemes.has(activeThemeName));
|
|
328
|
-
const
|
|
379
|
+
const frameless = Boolean(chromeless);
|
|
380
|
+
const disabledSurface = frameless ? disabledState.glyphKnobProps : tierDisabled ? {
|
|
329
381
|
...disabledState.surfaceKnobProps,
|
|
330
382
|
backgroundColor: tierDisabled.backgroundColor,
|
|
331
383
|
borderColor: tierDisabled.borderColor
|
|
332
384
|
} : washOnHost ? hostScoped(disabledState.surfaceKnobProps) : disabledState.surfaceKnobProps;
|
|
333
|
-
const disabledText = tierDisabled ? {
|
|
385
|
+
const disabledText = frameless ? {} : tierDisabled ? {
|
|
334
386
|
...disabledState.textKnobProps,
|
|
335
387
|
color: tierDisabled.color
|
|
336
388
|
} : washOnHost ? hostScoped(disabledState.textKnobProps) : activeThemeName && solidButtonIntents.has(activeThemeName) && disabledState.textKnobProps.color ? {
|
|
337
389
|
...disabledState.textKnobProps,
|
|
338
390
|
color: "$color12"
|
|
339
391
|
} : disabledState.textKnobProps;
|
|
340
|
-
outlined = tier ? false : outlined ?? knobProps.outlined;
|
|
392
|
+
outlined = tier || iconButton || mediaPlate || confirmPlate ? false : outlined ?? knobProps.outlined;
|
|
341
393
|
const isLow = knobProps.textAccent === "low";
|
|
342
394
|
const isMedium = knobProps.textAccent === "medium";
|
|
343
395
|
const resolvedBorderWidth = knobProps.borderRadius.borderWidth;
|
|
@@ -358,10 +410,11 @@ function Button({
|
|
|
358
410
|
}, []);
|
|
359
411
|
const handlePressOut = useCallback(() => setPressing(false), []);
|
|
360
412
|
const textColor = isLow ? pressing ? textAccentLow.press : hovering ? textAccentLow.hover : textAccentLow.default : isMedium ? formCommonColors.text : void 0;
|
|
361
|
-
const
|
|
362
|
-
const
|
|
413
|
+
const onPage = outlined || iconButton;
|
|
414
|
+
const outlinedIntentInk = Boolean(onPage && activeThemeName && solidButtonIntents.has(activeThemeName));
|
|
415
|
+
const outlinedOnHost = Boolean(onPage && activeThemeName && solidPaletteThemes.has(activeThemeName));
|
|
363
416
|
const outlinedInk = outlinedOnHost ? hostAccentInk : outlinedIntentInk ? "$color11" : void 0;
|
|
364
|
-
const resolvedRole = actionRole ?? (accent ? "primary" : void 0);
|
|
417
|
+
const resolvedRole = actionRole ?? (accent || confirmPlate ? "primary" : void 0);
|
|
365
418
|
const labelFromParts = children == null && verb != null ? formatActionLabel({
|
|
366
419
|
verb,
|
|
367
420
|
noun
|
|
@@ -369,11 +422,22 @@ function Button({
|
|
|
369
422
|
const resolvedChildren = children ?? labelFromParts;
|
|
370
423
|
const ariaPressedProp = props["aria-pressed"];
|
|
371
424
|
const isSelected = selected ?? (ariaPressedProp === true || ariaPressedProp === "true" ? true : void 0);
|
|
372
|
-
const selectedFill = Boolean(isSelected) && !unavailable;
|
|
425
|
+
const selectedFill = Boolean(isSelected) && !unavailable && !mediaPlate;
|
|
373
426
|
const barInk = accentInk && chromeless && !selectedFill && !unavailable ? hostIdentityInk : null;
|
|
374
|
-
const
|
|
375
|
-
const
|
|
427
|
+
const inlineGlyph = iconButton && inline === true && !nested;
|
|
428
|
+
const barGlyph = (iconButton || mediaPlate || confirmPlate) && !nested || labelled && chromeless && accentInk === true && edge === "start";
|
|
376
429
|
const labelLine = labelLinePx(knobProps.body.fontFamily);
|
|
430
|
+
const glyphFloor = iconButtonGlyphPx(labelLine);
|
|
431
|
+
const glassGroup = groupGround === "glass";
|
|
432
|
+
const GlassView = iconButton && !inlineGlyph && !nested && accentInk && barSurface && !selectedFill && !glassGroup ? loadGlassView() : null;
|
|
433
|
+
const framedCircle = iconOnly && Boolean(circular) && !nested && !mediaPlate && !confirmPlate;
|
|
434
|
+
const framedCirclePx = touch && typeof sizeProp !== "number" ? Math.max(sizeTokenPx(resolvedSize), MIN_PRESS_TARGET) : sizeTokenPx(resolvedSize);
|
|
435
|
+
const iconSize = nested ? Math.min(recipe.iconSize, Math.max(12, Math.round(knobProps.nestedControl.px * 0.45))) : framedCircle ? Math.round(framedCirclePx * ICON_BUTTON_CIRCLE_GLYPH_RATIO) : inlineGlyph ? Math.round(recipe.fontSize * INLINE_GLYPH_RATIO) : barGlyph ? touch ? Math.max(glyphFloor, resolveButtonSizeRecipe("$6", recipeFamily, touch).iconSize) :
|
|
436
|
+
// A pointer toolbar keeps its token box (LC-54); the glyph fills it
|
|
437
|
+
// up to the same floor.
|
|
438
|
+
Math.max(recipe.iconSize, Math.min(glyphFloor, recipe.height - 8)) : recipe.iconSize;
|
|
439
|
+
const glyph = barGlyph || inlineGlyph || framedCircle ? withGlyphWeight(icon, iconSize, resolvedGlyphWeight) : icon;
|
|
440
|
+
const labelBoxPx = nested ? knobProps.nestedControl.px : recipe.height;
|
|
377
441
|
const labelMaxFontScale = Math.min(maxFontScaleToFit(labelBoxPx, nested ? getFontSize(knobProps.label.fontSize) : recipe.fontSize, dynamicTypeFit.controlLabelFill), labelLine === void 0 ? Number.POSITIVE_INFINITY : maxFontScaleToFit(labelBoxPx, labelLine, 1));
|
|
378
442
|
const renderLabelText = (label, key) => /* @__PURE__ */jsx(TamaguiSizableText, {
|
|
379
443
|
userSelect: "none",
|
|
@@ -417,18 +481,19 @@ function Button({
|
|
|
417
481
|
color: nativeIconColor,
|
|
418
482
|
"aria-hidden": true
|
|
419
483
|
})
|
|
420
|
-
}) :
|
|
484
|
+
}) : glyph ? /* @__PURE__ */jsx(View, {
|
|
421
485
|
flexShrink: 0,
|
|
422
|
-
children: isWeb ? normalizeButtonIcon(
|
|
423
|
-
icon,
|
|
486
|
+
children: isWeb ? normalizeButtonIcon(glyph, iconSize) : /* @__PURE__ */jsx(NativeButtonIcon, {
|
|
487
|
+
icon: glyph,
|
|
424
488
|
size: iconSize,
|
|
425
489
|
color: nativeIconColor
|
|
426
490
|
})
|
|
427
491
|
}) : null;
|
|
428
|
-
const
|
|
492
|
+
const glyphAfter = iconAfter && (barGlyph || inlineGlyph || framedCircle) ? withGlyphWeight(iconAfter, iconSize, resolvedGlyphWeight) : iconAfter;
|
|
493
|
+
const iconAfterElement = glyphAfter ? /* @__PURE__ */jsx(View, {
|
|
429
494
|
flexShrink: 0,
|
|
430
|
-
children: isWeb ? normalizeButtonIcon(
|
|
431
|
-
icon:
|
|
495
|
+
children: isWeb ? normalizeButtonIcon(glyphAfter, iconSize) : /* @__PURE__ */jsx(NativeButtonIcon, {
|
|
496
|
+
icon: glyphAfter,
|
|
432
497
|
size: iconSize,
|
|
433
498
|
color: nativeIconColor
|
|
434
499
|
})
|
|
@@ -438,7 +503,7 @@ function Button({
|
|
|
438
503
|
const reasonId = explainedDisable ? `${props.id ?? generatedId}-disabled-reason` : void 0;
|
|
439
504
|
const isCircular = Boolean(circular);
|
|
440
505
|
const circularTokenPx = sizeTokenPx(resolvedSize);
|
|
441
|
-
const visualPx = nested ? knobProps.nestedControl.px : recipe.height;
|
|
506
|
+
const visualPx = nested ? knobProps.nestedControl.px : inlineGlyph ? iconSize : iconButton ? Math.max(recipe.height, iconSize) : recipe.height;
|
|
442
507
|
const circularPressFloor = isCircular && touch && typeof sizeProp !== "number" && circularTokenPx < MIN_PRESS_TARGET ? {
|
|
443
508
|
width: MIN_PRESS_TARGET,
|
|
444
509
|
height: MIN_PRESS_TARGET,
|
|
@@ -470,6 +535,23 @@ function Button({
|
|
|
470
535
|
const selectedPressFill = selectedFill ? "$backgroundPress" : tierPaint ? tierPaint.press : outlined ? "transparent" : "$backgroundPress";
|
|
471
536
|
const restFill = selectedFill ? outlined ? "$background" : "$backgroundPress" : tierPaint?.rest;
|
|
472
537
|
const plainTier = tier === "plain";
|
|
538
|
+
const glyphState = iconButton && !selectedFill;
|
|
539
|
+
const iconHover = glyphState ? isWeb ? hostScoped({
|
|
540
|
+
backgroundColor: "$backgroundHover"
|
|
541
|
+
}) : {
|
|
542
|
+
backgroundColor: "transparent"
|
|
543
|
+
} : mediaPlate ? {
|
|
544
|
+
backgroundColor: "$shadow5"
|
|
545
|
+
} : void 0;
|
|
546
|
+
const iconPress = glyphState ? isWeb ? hostScoped({
|
|
547
|
+
backgroundColor: "$backgroundPress"
|
|
548
|
+
}) : {
|
|
549
|
+
backgroundColor: "transparent",
|
|
550
|
+
opacity: ICON_BUTTON_PRESS_OPACITY
|
|
551
|
+
} : mediaPlate ? {
|
|
552
|
+
backgroundColor: "$shadow5"
|
|
553
|
+
} : void 0;
|
|
554
|
+
const glyphEdgePull = GlassView || glassGroup ? 0 : iconButton ? -Math.max(0, (visualPx - iconSize) / 2) : edgePull;
|
|
473
555
|
const buttonElement = /* @__PURE__ */jsxs(ButtonFrame, {
|
|
474
556
|
disabled: explainedDisable ? false : isDisabled || false,
|
|
475
557
|
"aria-busy": loading || void 0,
|
|
@@ -481,8 +563,8 @@ function Button({
|
|
|
481
563
|
} : void 0),
|
|
482
564
|
borderWidth: resolvedBorderWidth,
|
|
483
565
|
size: resolvedSize,
|
|
484
|
-
...(chromeless || plainTier ? void 0 : knobProps.elevationChrome),
|
|
485
|
-
elevation: plainTier ? void 0 : knobProps.elevation,
|
|
566
|
+
...(chromeless || plainTier || mediaPlate || confirmPlate ? void 0 : knobProps.elevationChrome),
|
|
567
|
+
elevation: plainTier || confirmPlate ? void 0 : knobProps.elevation,
|
|
486
568
|
outlined: outlined || void 0,
|
|
487
569
|
borderColor: outlined ? knobBorderColor : "transparent",
|
|
488
570
|
circular: !nested && isCircular ? true : void 0,
|
|
@@ -497,10 +579,31 @@ function Button({
|
|
|
497
579
|
height: visualPx,
|
|
498
580
|
minHeight: visualPx
|
|
499
581
|
} : void 0),
|
|
500
|
-
...(
|
|
501
|
-
|
|
582
|
+
...(iconButton || mediaPlate || confirmPlate ? {
|
|
583
|
+
width: visualPx,
|
|
584
|
+
minWidth: visualPx,
|
|
585
|
+
paddingHorizontal: 0
|
|
586
|
+
} : void 0),
|
|
587
|
+
...(inlineGlyph ? {
|
|
588
|
+
marginInlineStart: "$2"
|
|
589
|
+
} : void 0),
|
|
590
|
+
...(GlassView ? {
|
|
591
|
+
borderRadius: 1e5
|
|
592
|
+
} : void 0),
|
|
593
|
+
...(confirmPlate ? {
|
|
594
|
+
borderRadius: 1e5
|
|
595
|
+
} : void 0),
|
|
596
|
+
...(mediaPlate ? {
|
|
597
|
+
borderRadius: 1e5,
|
|
598
|
+
backgroundColor: "$shadow4",
|
|
599
|
+
...(isWeb ? {
|
|
600
|
+
style: MEDIA_PLATE_WEB_STYLE
|
|
601
|
+
} : void 0)
|
|
602
|
+
} : void 0),
|
|
603
|
+
...(edge && !inlineGlyph && chromeless && !selectedFill && !isCircular ? edge === "start" ? {
|
|
604
|
+
marginInlineStart: glyphEdgePull
|
|
502
605
|
} : {
|
|
503
|
-
marginInlineEnd:
|
|
606
|
+
marginInlineEnd: glyphEdgePull
|
|
504
607
|
} : void 0),
|
|
505
608
|
...(restFill ? {
|
|
506
609
|
backgroundColor: restFill
|
|
@@ -532,7 +635,8 @@ function Button({
|
|
|
532
635
|
// A selected fill, or the LC-153 tier's wash, beats the knob state fill.
|
|
533
636
|
...(selectedFill || tierPaint ? {
|
|
534
637
|
backgroundColor: selectedHoverFill
|
|
535
|
-
} : void 0)
|
|
638
|
+
} : void 0),
|
|
639
|
+
...iconHover
|
|
536
640
|
},
|
|
537
641
|
pressStyle: {
|
|
538
642
|
backgroundColor: selectedPressFill,
|
|
@@ -544,7 +648,8 @@ function Button({
|
|
|
544
648
|
// A selected fill, or the LC-153 tier's wash, beats the knob state fill.
|
|
545
649
|
...(selectedFill || tierPaint ? {
|
|
546
650
|
backgroundColor: selectedPressFill
|
|
547
|
-
} : void 0)
|
|
651
|
+
} : void 0),
|
|
652
|
+
...iconPress
|
|
548
653
|
},
|
|
549
654
|
focusStyle: {
|
|
550
655
|
outlineWidth: 0
|
|
@@ -584,6 +689,7 @@ function Button({
|
|
|
584
689
|
}
|
|
585
690
|
} : void 0),
|
|
586
691
|
...(isCircular && !grouped ? radiusClassProps("R-IDENTITY", "circular Button") : void 0),
|
|
692
|
+
...(!isCircular && (GlassView || confirmPlate || mediaPlate) ? radiusClassProps("R-IDENTITY", "icon button plate") : void 0),
|
|
587
693
|
...(explainedDisable ? {
|
|
588
694
|
// No `title`: hover-only reveals are banned on disabled controls
|
|
589
695
|
// (DG-OVL-05) — the reason renders as visible adjacent text.
|
|
@@ -597,11 +703,11 @@ function Button({
|
|
|
597
703
|
// Hover/press keep the LC-40 washed chrome — an aria-disabled
|
|
598
704
|
// control must not light up like a pressable one.
|
|
599
705
|
hoverStyle: {
|
|
600
|
-
backgroundColor: outlined ? "transparent" : "$background",
|
|
706
|
+
backgroundColor: outlined || frameless ? "transparent" : "$background",
|
|
601
707
|
...disabledSurface
|
|
602
708
|
},
|
|
603
709
|
pressStyle: {
|
|
604
|
-
backgroundColor: outlined ? "transparent" : "$background",
|
|
710
|
+
backgroundColor: outlined || frameless ? "transparent" : "$background",
|
|
605
711
|
...disabledSurface
|
|
606
712
|
},
|
|
607
713
|
"data-mp-disabled-explained": "true"
|
|
@@ -618,18 +724,43 @@ function Button({
|
|
|
618
724
|
...(tier ? {
|
|
619
725
|
"data-mp-tier": tier
|
|
620
726
|
} : void 0),
|
|
727
|
+
...(iconButton ? {
|
|
728
|
+
"data-mp-icon-button": GlassView ? "glass" : inlineGlyph ? "inline" : neutralGlyph ? "neutral" : "glyph"
|
|
729
|
+
} : void 0),
|
|
730
|
+
...(mediaPlate ? {
|
|
731
|
+
"data-mp-icon-button": "media"
|
|
732
|
+
} : void 0),
|
|
733
|
+
...(confirmPlate ? {
|
|
734
|
+
"data-mp-icon-button": "primary"
|
|
735
|
+
} : void 0),
|
|
621
736
|
"data-mp-button-height": String(nested ? visualPx : isCircular ? touch && typeof sizeProp !== "number" ? Math.max(circularTokenPx, MIN_PRESS_TARGET) : circularTokenPx : visualPx),
|
|
622
737
|
"data-size-token": knobProps.sizeToken,
|
|
623
738
|
...(selectedFill ? {
|
|
624
739
|
"aria-pressed": true,
|
|
625
740
|
"data-mp-selected": "true"
|
|
626
741
|
} : void 0),
|
|
627
|
-
children: [
|
|
742
|
+
children: [GlassView ? /* @__PURE__ */jsx(GlassView, {
|
|
743
|
+
glassEffectStyle: "regular",
|
|
744
|
+
isInteractive: true,
|
|
745
|
+
pointerEvents: "none",
|
|
746
|
+
style: {
|
|
747
|
+
position: "absolute",
|
|
748
|
+
top: 0,
|
|
749
|
+
right: 0,
|
|
750
|
+
bottom: 0,
|
|
751
|
+
left: 0,
|
|
752
|
+
borderRadius: visualPx / 2
|
|
753
|
+
}
|
|
754
|
+
}) : null, iconElement, labelContent, iconAfterElement]
|
|
628
755
|
});
|
|
629
|
-
const
|
|
756
|
+
const intentButton = activeThemeName ? /* @__PURE__ */jsx(Theme, {
|
|
630
757
|
name: activeThemeName,
|
|
631
758
|
children: buttonElement
|
|
632
759
|
}) : buttonElement;
|
|
760
|
+
const themedButton = mediaPlate ? /* @__PURE__ */jsx(Theme, {
|
|
761
|
+
name: "dark",
|
|
762
|
+
children: intentButton
|
|
763
|
+
}) : intentButton;
|
|
633
764
|
const reasonText = explainedDisable ? /* @__PURE__ */jsx(SizableText, {
|
|
634
765
|
id: reasonId,
|
|
635
766
|
size: "$2",
|
|
@@ -654,5 +785,10 @@ function Button({
|
|
|
654
785
|
}
|
|
655
786
|
Button.Icon = TamaguiButton.Icon;
|
|
656
787
|
Button.Text = TamaguiSizableText;
|
|
657
|
-
|
|
788
|
+
function IconButton(props) {
|
|
789
|
+
return /* @__PURE__ */jsx(Button, {
|
|
790
|
+
...props
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
export { Button, ButtonFrame, ICON_BUTTON_CIRCLE_GLYPH_RATIO, ICON_BUTTON_GLASS_MERGE_PX, ICON_BUTTON_GLYPH_PX, ICON_BUTTON_NEUTRAL_GLYPH_PX, ICON_BUTTON_PRESS_OPACITY, IconButton, IconButtonGroup, buttonSizeRecipes, iconButtonGlyphPx, labelLinePx, resolveButtonSizeRecipe };
|
|
658
794
|
//# sourceMappingURL=index.mjs.map
|