@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
|
@@ -24,7 +24,15 @@ var Button_exports = {};
|
|
|
24
24
|
__export(Button_exports, {
|
|
25
25
|
Button: () => Button,
|
|
26
26
|
ButtonFrame: () => ButtonFrame,
|
|
27
|
+
ICON_BUTTON_CIRCLE_GLYPH_RATIO: () => ICON_BUTTON_CIRCLE_GLYPH_RATIO,
|
|
28
|
+
ICON_BUTTON_GLASS_MERGE_PX: () => import_IconButtonGroup.ICON_BUTTON_GLASS_MERGE_PX,
|
|
29
|
+
ICON_BUTTON_GLYPH_PX: () => ICON_BUTTON_GLYPH_PX,
|
|
30
|
+
ICON_BUTTON_NEUTRAL_GLYPH_PX: () => ICON_BUTTON_NEUTRAL_GLYPH_PX,
|
|
31
|
+
ICON_BUTTON_PRESS_OPACITY: () => ICON_BUTTON_PRESS_OPACITY,
|
|
32
|
+
IconButton: () => IconButton,
|
|
33
|
+
IconButtonGroup: () => import_IconButtonGroup.IconButtonGroup,
|
|
27
34
|
buttonSizeRecipes: () => buttonSizeRecipes,
|
|
35
|
+
iconButtonGlyphPx: () => iconButtonGlyphPx,
|
|
28
36
|
labelLinePx: () => labelLinePx,
|
|
29
37
|
resolveButtonSizeRecipe: () => resolveButtonSizeRecipe
|
|
30
38
|
});
|
|
@@ -46,6 +54,10 @@ var import_actionLabel = require("../actionLabel.cjs");
|
|
|
46
54
|
var import_colorRamps = require("../shared/colorRamps.cjs");
|
|
47
55
|
var import_devWarn = require("../shared/devWarn.cjs");
|
|
48
56
|
var import_groupContext = require("../shared/groupContext.cjs");
|
|
57
|
+
var import_glass = require("./glass.cjs");
|
|
58
|
+
var import_mediaPlate = require("./mediaPlate.cjs");
|
|
59
|
+
var import_iconButtonGroupContext = require("./iconButtonGroupContext.cjs");
|
|
60
|
+
var import_IconButtonGroup = require("./IconButtonGroup.cjs");
|
|
49
61
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
62
|
const buttonSizeRecipes = import_theme3.recipeFamilies.control.recipes;
|
|
51
63
|
function resolveButtonSizeRecipe(size, family = "control", touch = false) {
|
|
@@ -210,6 +222,36 @@ const ButtonFrame = (0, import_tamagui.styled)(import_tamagui.View, {
|
|
|
210
222
|
size: "$true"
|
|
211
223
|
}
|
|
212
224
|
});
|
|
225
|
+
const ICON_BUTTON_PRESS_OPACITY = 0.35;
|
|
226
|
+
const ICON_BUTTON_GLYPH_PX = 24;
|
|
227
|
+
const ICON_BUTTON_NEUTRAL_GLYPH_PX = 24;
|
|
228
|
+
const PHOSPHOR_INK_RATIO = 208 / 256;
|
|
229
|
+
function iconButtonGlyphPx(rowLinePx) {
|
|
230
|
+
if (rowLinePx === void 0) return ICON_BUTTON_GLYPH_PX;
|
|
231
|
+
return Math.max(ICON_BUTTON_GLYPH_PX, Math.round(rowLinePx / PHOSPHOR_INK_RATIO));
|
|
232
|
+
}
|
|
233
|
+
const ICON_BUTTON_CIRCLE_GLYPH_RATIO = 0.58;
|
|
234
|
+
const INLINE_GLYPH_RATIO = 1.2;
|
|
235
|
+
function withGlyphWeight(icon, size, weight) {
|
|
236
|
+
if (icon == null || icon === false) return icon;
|
|
237
|
+
if ((0, import_react.isValidElement)(icon)) {
|
|
238
|
+
return (0, import_react.cloneElement)(icon, {
|
|
239
|
+
...(icon.props.size == null ? {
|
|
240
|
+
size
|
|
241
|
+
} : void 0),
|
|
242
|
+
...(icon.props.weight == null ? {
|
|
243
|
+
weight
|
|
244
|
+
} : void 0)
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
if (typeof icon === "function" || typeof icon === "object" && "$$typeof" in icon) {
|
|
248
|
+
return (0, import_react.createElement)(icon, {
|
|
249
|
+
size,
|
|
250
|
+
weight
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
return icon;
|
|
254
|
+
}
|
|
213
255
|
function Button({
|
|
214
256
|
children,
|
|
215
257
|
action,
|
|
@@ -230,10 +272,13 @@ function Button({
|
|
|
230
272
|
iconAfter,
|
|
231
273
|
selected,
|
|
232
274
|
nested = false,
|
|
233
|
-
circular,
|
|
275
|
+
circular: circularProp,
|
|
234
276
|
chromeless,
|
|
235
277
|
edge,
|
|
236
278
|
accentInk,
|
|
279
|
+
plate,
|
|
280
|
+
inline,
|
|
281
|
+
glyphWeight,
|
|
237
282
|
verb,
|
|
238
283
|
noun,
|
|
239
284
|
actionRole,
|
|
@@ -292,7 +337,8 @@ function Button({
|
|
|
292
337
|
} = (0, import_react_store.useStore)(resolvedForm?.store ?? dummyStore, s => ({
|
|
293
338
|
isValid: s.isValid ?? true
|
|
294
339
|
}));
|
|
295
|
-
const
|
|
340
|
+
const primaryPlate = plate === "primary";
|
|
341
|
+
const intent = (accent || primaryPlate) && "accent" || error && "error" || warning && "warning" || success && "success" || void 0;
|
|
296
342
|
const sizeProp = props.size;
|
|
297
343
|
const {
|
|
298
344
|
knobProps,
|
|
@@ -309,8 +355,21 @@ function Button({
|
|
|
309
355
|
const hostAccentInk = (0, import_theme3.useAccentOnSurface)();
|
|
310
356
|
const hostIdentityInk = (0, import_theme3.useIdentityInkOnSurface)();
|
|
311
357
|
const grouped = (0, import_groupContext.useControlGrouped)();
|
|
358
|
+
const labelled = verb != null || children != null && children !== false && children !== "";
|
|
359
|
+
const iconOnly = !labelled && Boolean(icon || iconAfter);
|
|
360
|
+
const circular = circularProp && !(iconOnly && chromeless === true && plate == null);
|
|
361
|
+
const groupGround = (0, import_iconButtonGroupContext.useIconButtonGroupGround)();
|
|
362
|
+
const mediaPlate = iconOnly && plate === "media" && groupGround !== "media";
|
|
363
|
+
const confirmPlate = iconOnly && primaryPlate;
|
|
364
|
+
const iconButton = iconOnly && !mediaPlate && !confirmPlate && !grouped && chromeless !== false && outlined !== true && !circular;
|
|
312
365
|
if (import_tamagui.isWeb) (0, import_theme3.ensureKeyboardModalityTracking)();
|
|
313
366
|
const barSurface = (0, import_theme3.useBarSurface)();
|
|
367
|
+
const neutralGlyph = iconButton && !(theme ?? intent) && !barSurface && accentInk == null && inline !== true;
|
|
368
|
+
if (iconButton) {
|
|
369
|
+
chromeless = true;
|
|
370
|
+
accentInk = accentInk ?? (!(theme ?? intent) && (barSurface || inline === true));
|
|
371
|
+
}
|
|
372
|
+
const resolvedGlyphWeight = glyphWeight ?? (iconOnly ? "bold" : "regular");
|
|
314
373
|
const elevatedGround = (0, import_theme3.useElevatedSurface)();
|
|
315
374
|
const darkScheme = (0, import_theme3.isDarkThemeName)((0, import_tamagui.useThemeName)());
|
|
316
375
|
const resolvedSize = typeof sizeProp === "number" ? sizeProp : knobProps.sizeToken;
|
|
@@ -356,19 +415,20 @@ function Button({
|
|
|
356
415
|
const tierDisabled = tier && disabledState.style !== "dimWhole" ? (0, import_theme3.controlTierDisabled)(tier) : void 0;
|
|
357
416
|
const hostScoped = fragment => Object.fromEntries(Object.entries(fragment).map(([key, value]) => [key, typeof value === "string" && value.startsWith("$") ? parentScopeTheme[value.slice(1)]?.val ?? value : value]));
|
|
358
417
|
const washOnHost = Boolean(unavailable && activeThemeName && import_theme3.solidPaletteThemes.has(activeThemeName));
|
|
359
|
-
const
|
|
418
|
+
const frameless = Boolean(chromeless);
|
|
419
|
+
const disabledSurface = frameless ? disabledState.glyphKnobProps : tierDisabled ? {
|
|
360
420
|
...disabledState.surfaceKnobProps,
|
|
361
421
|
backgroundColor: tierDisabled.backgroundColor,
|
|
362
422
|
borderColor: tierDisabled.borderColor
|
|
363
423
|
} : washOnHost ? hostScoped(disabledState.surfaceKnobProps) : disabledState.surfaceKnobProps;
|
|
364
|
-
const disabledText = tierDisabled ? {
|
|
424
|
+
const disabledText = frameless ? {} : tierDisabled ? {
|
|
365
425
|
...disabledState.textKnobProps,
|
|
366
426
|
color: tierDisabled.color
|
|
367
427
|
} : washOnHost ? hostScoped(disabledState.textKnobProps) : activeThemeName && import_theme3.solidButtonIntents.has(activeThemeName) && disabledState.textKnobProps.color ? {
|
|
368
428
|
...disabledState.textKnobProps,
|
|
369
429
|
color: "$color12"
|
|
370
430
|
} : disabledState.textKnobProps;
|
|
371
|
-
outlined = tier ? false : outlined ?? knobProps.outlined;
|
|
431
|
+
outlined = tier || iconButton || mediaPlate || confirmPlate ? false : outlined ?? knobProps.outlined;
|
|
372
432
|
const isLow = knobProps.textAccent === "low";
|
|
373
433
|
const isMedium = knobProps.textAccent === "medium";
|
|
374
434
|
const resolvedBorderWidth = knobProps.borderRadius.borderWidth;
|
|
@@ -389,10 +449,11 @@ function Button({
|
|
|
389
449
|
}, []);
|
|
390
450
|
const handlePressOut = (0, import_react.useCallback)(() => setPressing(false), []);
|
|
391
451
|
const textColor = isLow ? pressing ? textAccentLow.press : hovering ? textAccentLow.hover : textAccentLow.default : isMedium ? import_colorRamps.formCommonColors.text : void 0;
|
|
392
|
-
const
|
|
393
|
-
const
|
|
452
|
+
const onPage = outlined || iconButton;
|
|
453
|
+
const outlinedIntentInk = Boolean(onPage && activeThemeName && import_theme3.solidButtonIntents.has(activeThemeName));
|
|
454
|
+
const outlinedOnHost = Boolean(onPage && activeThemeName && import_theme3.solidPaletteThemes.has(activeThemeName));
|
|
394
455
|
const outlinedInk = outlinedOnHost ? hostAccentInk : outlinedIntentInk ? "$color11" : void 0;
|
|
395
|
-
const resolvedRole = actionRole ?? (accent ? "primary" : void 0);
|
|
456
|
+
const resolvedRole = actionRole ?? (accent || confirmPlate ? "primary" : void 0);
|
|
396
457
|
const labelFromParts = children == null && verb != null ? (0, import_actionLabel.formatActionLabel)({
|
|
397
458
|
verb,
|
|
398
459
|
noun
|
|
@@ -400,11 +461,22 @@ function Button({
|
|
|
400
461
|
const resolvedChildren = children ?? labelFromParts;
|
|
401
462
|
const ariaPressedProp = props["aria-pressed"];
|
|
402
463
|
const isSelected = selected ?? (ariaPressedProp === true || ariaPressedProp === "true" ? true : void 0);
|
|
403
|
-
const selectedFill = Boolean(isSelected) && !unavailable;
|
|
464
|
+
const selectedFill = Boolean(isSelected) && !unavailable && !mediaPlate;
|
|
404
465
|
const barInk = accentInk && chromeless && !selectedFill && !unavailable ? hostIdentityInk : null;
|
|
405
|
-
const
|
|
406
|
-
const
|
|
466
|
+
const inlineGlyph = iconButton && inline === true && !nested;
|
|
467
|
+
const barGlyph = (iconButton || mediaPlate || confirmPlate) && !nested || labelled && chromeless && accentInk === true && edge === "start";
|
|
407
468
|
const labelLine = labelLinePx(knobProps.body.fontFamily);
|
|
469
|
+
const glyphFloor = iconButtonGlyphPx(labelLine);
|
|
470
|
+
const glassGroup = groupGround === "glass";
|
|
471
|
+
const GlassView = iconButton && !inlineGlyph && !nested && accentInk && barSurface && !selectedFill && !glassGroup ? (0, import_glass.loadGlassView)() : null;
|
|
472
|
+
const framedCircle = iconOnly && Boolean(circular) && !nested && !mediaPlate && !confirmPlate;
|
|
473
|
+
const framedCirclePx = touch && typeof sizeProp !== "number" ? Math.max(sizeTokenPx(resolvedSize), import_theme3.MIN_PRESS_TARGET) : sizeTokenPx(resolvedSize);
|
|
474
|
+
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) :
|
|
475
|
+
// A pointer toolbar keeps its token box (LC-54); the glyph fills it
|
|
476
|
+
// up to the same floor.
|
|
477
|
+
Math.max(recipe.iconSize, Math.min(glyphFloor, recipe.height - 8)) : recipe.iconSize;
|
|
478
|
+
const glyph = barGlyph || inlineGlyph || framedCircle ? withGlyphWeight(icon, iconSize, resolvedGlyphWeight) : icon;
|
|
479
|
+
const labelBoxPx = nested ? knobProps.nestedControl.px : recipe.height;
|
|
408
480
|
const labelMaxFontScale = Math.min((0, import_theme3.maxFontScaleToFit)(labelBoxPx, nested ? (0, import_tamagui.getFontSize)(knobProps.label.fontSize) : recipe.fontSize, import_theme3.dynamicTypeFit.controlLabelFill), labelLine === void 0 ? Number.POSITIVE_INFINITY : (0, import_theme3.maxFontScaleToFit)(labelBoxPx, labelLine, 1));
|
|
409
481
|
const renderLabelText = (label, key) => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.SizableText, {
|
|
410
482
|
userSelect: "none",
|
|
@@ -448,18 +520,19 @@ function Button({
|
|
|
448
520
|
color: nativeIconColor,
|
|
449
521
|
"aria-hidden": true
|
|
450
522
|
})
|
|
451
|
-
}) :
|
|
523
|
+
}) : glyph ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
452
524
|
flexShrink: 0,
|
|
453
|
-
children: import_tamagui.isWeb ? normalizeButtonIcon(
|
|
454
|
-
icon,
|
|
525
|
+
children: import_tamagui.isWeb ? normalizeButtonIcon(glyph, iconSize) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeButtonIcon, {
|
|
526
|
+
icon: glyph,
|
|
455
527
|
size: iconSize,
|
|
456
528
|
color: nativeIconColor
|
|
457
529
|
})
|
|
458
530
|
}) : null;
|
|
459
|
-
const
|
|
531
|
+
const glyphAfter = iconAfter && (barGlyph || inlineGlyph || framedCircle) ? withGlyphWeight(iconAfter, iconSize, resolvedGlyphWeight) : iconAfter;
|
|
532
|
+
const iconAfterElement = glyphAfter ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
460
533
|
flexShrink: 0,
|
|
461
|
-
children: import_tamagui.isWeb ? normalizeButtonIcon(
|
|
462
|
-
icon:
|
|
534
|
+
children: import_tamagui.isWeb ? normalizeButtonIcon(glyphAfter, iconSize) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeButtonIcon, {
|
|
535
|
+
icon: glyphAfter,
|
|
463
536
|
size: iconSize,
|
|
464
537
|
color: nativeIconColor
|
|
465
538
|
})
|
|
@@ -469,7 +542,7 @@ function Button({
|
|
|
469
542
|
const reasonId = explainedDisable ? `${props.id ?? generatedId}-disabled-reason` : void 0;
|
|
470
543
|
const isCircular = Boolean(circular);
|
|
471
544
|
const circularTokenPx = sizeTokenPx(resolvedSize);
|
|
472
|
-
const visualPx = nested ? knobProps.nestedControl.px : recipe.height;
|
|
545
|
+
const visualPx = nested ? knobProps.nestedControl.px : inlineGlyph ? iconSize : iconButton ? Math.max(recipe.height, iconSize) : recipe.height;
|
|
473
546
|
const circularPressFloor = isCircular && touch && typeof sizeProp !== "number" && circularTokenPx < import_theme3.MIN_PRESS_TARGET ? {
|
|
474
547
|
width: import_theme3.MIN_PRESS_TARGET,
|
|
475
548
|
height: import_theme3.MIN_PRESS_TARGET,
|
|
@@ -501,6 +574,23 @@ function Button({
|
|
|
501
574
|
const selectedPressFill = selectedFill ? "$backgroundPress" : tierPaint ? tierPaint.press : outlined ? "transparent" : "$backgroundPress";
|
|
502
575
|
const restFill = selectedFill ? outlined ? "$background" : "$backgroundPress" : tierPaint?.rest;
|
|
503
576
|
const plainTier = tier === "plain";
|
|
577
|
+
const glyphState = iconButton && !selectedFill;
|
|
578
|
+
const iconHover = glyphState ? import_tamagui.isWeb ? hostScoped({
|
|
579
|
+
backgroundColor: "$backgroundHover"
|
|
580
|
+
}) : {
|
|
581
|
+
backgroundColor: "transparent"
|
|
582
|
+
} : mediaPlate ? {
|
|
583
|
+
backgroundColor: "$shadow5"
|
|
584
|
+
} : void 0;
|
|
585
|
+
const iconPress = glyphState ? import_tamagui.isWeb ? hostScoped({
|
|
586
|
+
backgroundColor: "$backgroundPress"
|
|
587
|
+
}) : {
|
|
588
|
+
backgroundColor: "transparent",
|
|
589
|
+
opacity: ICON_BUTTON_PRESS_OPACITY
|
|
590
|
+
} : mediaPlate ? {
|
|
591
|
+
backgroundColor: "$shadow5"
|
|
592
|
+
} : void 0;
|
|
593
|
+
const glyphEdgePull = GlassView || glassGroup ? 0 : iconButton ? -Math.max(0, (visualPx - iconSize) / 2) : edgePull;
|
|
504
594
|
const buttonElement = /* @__PURE__ */(0, import_jsx_runtime.jsxs)(ButtonFrame, {
|
|
505
595
|
disabled: explainedDisable ? false : isDisabled || false,
|
|
506
596
|
"aria-busy": loading || void 0,
|
|
@@ -512,8 +602,8 @@ function Button({
|
|
|
512
602
|
} : void 0),
|
|
513
603
|
borderWidth: resolvedBorderWidth,
|
|
514
604
|
size: resolvedSize,
|
|
515
|
-
...(chromeless || plainTier ? void 0 : knobProps.elevationChrome),
|
|
516
|
-
elevation: plainTier ? void 0 : knobProps.elevation,
|
|
605
|
+
...(chromeless || plainTier || mediaPlate || confirmPlate ? void 0 : knobProps.elevationChrome),
|
|
606
|
+
elevation: plainTier || confirmPlate ? void 0 : knobProps.elevation,
|
|
517
607
|
outlined: outlined || void 0,
|
|
518
608
|
borderColor: outlined ? knobBorderColor : "transparent",
|
|
519
609
|
circular: !nested && isCircular ? true : void 0,
|
|
@@ -528,10 +618,31 @@ function Button({
|
|
|
528
618
|
height: visualPx,
|
|
529
619
|
minHeight: visualPx
|
|
530
620
|
} : void 0),
|
|
531
|
-
...(
|
|
532
|
-
|
|
621
|
+
...(iconButton || mediaPlate || confirmPlate ? {
|
|
622
|
+
width: visualPx,
|
|
623
|
+
minWidth: visualPx,
|
|
624
|
+
paddingHorizontal: 0
|
|
625
|
+
} : void 0),
|
|
626
|
+
...(inlineGlyph ? {
|
|
627
|
+
marginInlineStart: "$2"
|
|
628
|
+
} : void 0),
|
|
629
|
+
...(GlassView ? {
|
|
630
|
+
borderRadius: 1e5
|
|
631
|
+
} : void 0),
|
|
632
|
+
...(confirmPlate ? {
|
|
633
|
+
borderRadius: 1e5
|
|
634
|
+
} : void 0),
|
|
635
|
+
...(mediaPlate ? {
|
|
636
|
+
borderRadius: 1e5,
|
|
637
|
+
backgroundColor: "$shadow4",
|
|
638
|
+
...(import_tamagui.isWeb ? {
|
|
639
|
+
style: import_mediaPlate.MEDIA_PLATE_WEB_STYLE
|
|
640
|
+
} : void 0)
|
|
641
|
+
} : void 0),
|
|
642
|
+
...(edge && !inlineGlyph && chromeless && !selectedFill && !isCircular ? edge === "start" ? {
|
|
643
|
+
marginInlineStart: glyphEdgePull
|
|
533
644
|
} : {
|
|
534
|
-
marginInlineEnd:
|
|
645
|
+
marginInlineEnd: glyphEdgePull
|
|
535
646
|
} : void 0),
|
|
536
647
|
...(restFill ? {
|
|
537
648
|
backgroundColor: restFill
|
|
@@ -563,7 +674,8 @@ function Button({
|
|
|
563
674
|
// A selected fill, or the LC-153 tier's wash, beats the knob state fill.
|
|
564
675
|
...(selectedFill || tierPaint ? {
|
|
565
676
|
backgroundColor: selectedHoverFill
|
|
566
|
-
} : void 0)
|
|
677
|
+
} : void 0),
|
|
678
|
+
...iconHover
|
|
567
679
|
},
|
|
568
680
|
pressStyle: {
|
|
569
681
|
backgroundColor: selectedPressFill,
|
|
@@ -575,7 +687,8 @@ function Button({
|
|
|
575
687
|
// A selected fill, or the LC-153 tier's wash, beats the knob state fill.
|
|
576
688
|
...(selectedFill || tierPaint ? {
|
|
577
689
|
backgroundColor: selectedPressFill
|
|
578
|
-
} : void 0)
|
|
690
|
+
} : void 0),
|
|
691
|
+
...iconPress
|
|
579
692
|
},
|
|
580
693
|
focusStyle: {
|
|
581
694
|
outlineWidth: 0
|
|
@@ -615,6 +728,7 @@ function Button({
|
|
|
615
728
|
}
|
|
616
729
|
} : void 0),
|
|
617
730
|
...(isCircular && !grouped ? (0, import_theme3.radiusClassProps)("R-IDENTITY", "circular Button") : void 0),
|
|
731
|
+
...(!isCircular && (GlassView || confirmPlate || mediaPlate) ? (0, import_theme3.radiusClassProps)("R-IDENTITY", "icon button plate") : void 0),
|
|
618
732
|
...(explainedDisable ? {
|
|
619
733
|
// No `title`: hover-only reveals are banned on disabled controls
|
|
620
734
|
// (DG-OVL-05) — the reason renders as visible adjacent text.
|
|
@@ -628,11 +742,11 @@ function Button({
|
|
|
628
742
|
// Hover/press keep the LC-40 washed chrome — an aria-disabled
|
|
629
743
|
// control must not light up like a pressable one.
|
|
630
744
|
hoverStyle: {
|
|
631
|
-
backgroundColor: outlined ? "transparent" : "$background",
|
|
745
|
+
backgroundColor: outlined || frameless ? "transparent" : "$background",
|
|
632
746
|
...disabledSurface
|
|
633
747
|
},
|
|
634
748
|
pressStyle: {
|
|
635
|
-
backgroundColor: outlined ? "transparent" : "$background",
|
|
749
|
+
backgroundColor: outlined || frameless ? "transparent" : "$background",
|
|
636
750
|
...disabledSurface
|
|
637
751
|
},
|
|
638
752
|
"data-mp-disabled-explained": "true"
|
|
@@ -649,18 +763,43 @@ function Button({
|
|
|
649
763
|
...(tier ? {
|
|
650
764
|
"data-mp-tier": tier
|
|
651
765
|
} : void 0),
|
|
766
|
+
...(iconButton ? {
|
|
767
|
+
"data-mp-icon-button": GlassView ? "glass" : inlineGlyph ? "inline" : neutralGlyph ? "neutral" : "glyph"
|
|
768
|
+
} : void 0),
|
|
769
|
+
...(mediaPlate ? {
|
|
770
|
+
"data-mp-icon-button": "media"
|
|
771
|
+
} : void 0),
|
|
772
|
+
...(confirmPlate ? {
|
|
773
|
+
"data-mp-icon-button": "primary"
|
|
774
|
+
} : void 0),
|
|
652
775
|
"data-mp-button-height": String(nested ? visualPx : isCircular ? touch && typeof sizeProp !== "number" ? Math.max(circularTokenPx, import_theme3.MIN_PRESS_TARGET) : circularTokenPx : visualPx),
|
|
653
776
|
"data-size-token": knobProps.sizeToken,
|
|
654
777
|
...(selectedFill ? {
|
|
655
778
|
"aria-pressed": true,
|
|
656
779
|
"data-mp-selected": "true"
|
|
657
780
|
} : void 0),
|
|
658
|
-
children: [
|
|
781
|
+
children: [GlassView ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(GlassView, {
|
|
782
|
+
glassEffectStyle: "regular",
|
|
783
|
+
isInteractive: true,
|
|
784
|
+
pointerEvents: "none",
|
|
785
|
+
style: {
|
|
786
|
+
position: "absolute",
|
|
787
|
+
top: 0,
|
|
788
|
+
right: 0,
|
|
789
|
+
bottom: 0,
|
|
790
|
+
left: 0,
|
|
791
|
+
borderRadius: visualPx / 2
|
|
792
|
+
}
|
|
793
|
+
}) : null, iconElement, labelContent, iconAfterElement]
|
|
659
794
|
});
|
|
660
|
-
const
|
|
795
|
+
const intentButton = activeThemeName ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.Theme, {
|
|
661
796
|
name: activeThemeName,
|
|
662
797
|
children: buttonElement
|
|
663
798
|
}) : buttonElement;
|
|
799
|
+
const themedButton = mediaPlate ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.Theme, {
|
|
800
|
+
name: "dark",
|
|
801
|
+
children: intentButton
|
|
802
|
+
}) : intentButton;
|
|
664
803
|
const reasonText = explainedDisable ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_theme2.SizableText, {
|
|
665
804
|
id: reasonId,
|
|
666
805
|
size: "$2",
|
|
@@ -684,4 +823,9 @@ function Button({
|
|
|
684
823
|
});
|
|
685
824
|
}
|
|
686
825
|
Button.Icon = import_tamagui.Button.Icon;
|
|
687
|
-
Button.Text = import_tamagui.SizableText;
|
|
826
|
+
Button.Text = import_tamagui.SizableText;
|
|
827
|
+
function IconButton(props) {
|
|
828
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Button, {
|
|
829
|
+
...props
|
|
830
|
+
});
|
|
831
|
+
}
|