@aglyn/plugins-mui 1.0.0-beta.143
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/LICENSE +201 -0
- package/README.md +22 -0
- package/package.json +47 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/accordion.d.ts +96 -0
- package/src/lib/components/accordion.js +392 -0
- package/src/lib/components/accordion.js.map +1 -0
- package/src/lib/components/app-bar.d.ts +32 -0
- package/src/lib/components/app-bar.js +86 -0
- package/src/lib/components/app-bar.js.map +1 -0
- package/src/lib/components/blocks.d.ts +46 -0
- package/src/lib/components/blocks.js +1007 -0
- package/src/lib/components/blocks.js.map +1 -0
- package/src/lib/components/box.d.ts +47 -0
- package/src/lib/components/box.js +125 -0
- package/src/lib/components/box.js.map +1 -0
- package/src/lib/components/breadcrumbs.d.ts +44 -0
- package/src/lib/components/breadcrumbs.js +172 -0
- package/src/lib/components/breadcrumbs.js.map +1 -0
- package/src/lib/components/button.d.ts +89 -0
- package/src/lib/components/button.js +272 -0
- package/src/lib/components/button.js.map +1 -0
- package/src/lib/components/card.d.ts +61 -0
- package/src/lib/components/card.js +336 -0
- package/src/lib/components/card.js.map +1 -0
- package/src/lib/components/collection.d.ts +514 -0
- package/src/lib/components/collection.js +2999 -0
- package/src/lib/components/collection.js.map +1 -0
- package/src/lib/components/container.d.ts +42 -0
- package/src/lib/components/container.js +169 -0
- package/src/lib/components/container.js.map +1 -0
- package/src/lib/components/custom-html.d.ts +78 -0
- package/src/lib/components/custom-html.js +219 -0
- package/src/lib/components/custom-html.js.map +1 -0
- package/src/lib/components/data-table.d.ts +57 -0
- package/src/lib/components/data-table.js +216 -0
- package/src/lib/components/data-table.js.map +1 -0
- package/src/lib/components/document-root.d.ts +77 -0
- package/src/lib/components/document-root.js +118 -0
- package/src/lib/components/document-root.js.map +1 -0
- package/src/lib/components/drawer.d.ts +93 -0
- package/src/lib/components/drawer.js +566 -0
- package/src/lib/components/drawer.js.map +1 -0
- package/src/lib/components/function-controls.d.ts +66 -0
- package/src/lib/components/function-controls.js +207 -0
- package/src/lib/components/function-controls.js.map +1 -0
- package/src/lib/components/function-scope.d.ts +110 -0
- package/src/lib/components/function-scope.js +478 -0
- package/src/lib/components/function-scope.js.map +1 -0
- package/src/lib/components/function-widget.d.ts +75 -0
- package/src/lib/components/function-widget.js +307 -0
- package/src/lib/components/function-widget.js.map +1 -0
- package/src/lib/components/grid.d.ts +91 -0
- package/src/lib/components/grid.js +322 -0
- package/src/lib/components/grid.js.map +1 -0
- package/src/lib/components/icon.d.ts +54 -0
- package/src/lib/components/icon.js +163 -0
- package/src/lib/components/icon.js.map +1 -0
- package/src/lib/components/image-list.d.ts +58 -0
- package/src/lib/components/image-list.js +336 -0
- package/src/lib/components/image-list.js.map +1 -0
- package/src/lib/components/image.d.ts +154 -0
- package/src/lib/components/image.js +451 -0
- package/src/lib/components/image.js.map +1 -0
- package/src/lib/components/inline-text.d.ts +74 -0
- package/src/lib/components/inline-text.js +407 -0
- package/src/lib/components/inline-text.js.map +1 -0
- package/src/lib/components/language-switcher.d.ts +35 -0
- package/src/lib/components/language-switcher.js +179 -0
- package/src/lib/components/language-switcher.js.map +1 -0
- package/src/lib/components/layout-slot.d.ts +68 -0
- package/src/lib/components/layout-slot.js +192 -0
- package/src/lib/components/layout-slot.js.map +1 -0
- package/src/lib/components/link-box-accessible-name.d.ts +79 -0
- package/src/lib/components/link-box-accessible-name.js +158 -0
- package/src/lib/components/link-box-accessible-name.js.map +1 -0
- package/src/lib/components/link-box.d.ts +66 -0
- package/src/lib/components/link-box.js +212 -0
- package/src/lib/components/link-box.js.map +1 -0
- package/src/lib/components/list-item-text.d.ts +22 -0
- package/src/lib/components/list-item-text.js +86 -0
- package/src/lib/components/list-item-text.js.map +1 -0
- package/src/lib/components/list-item.d.ts +32 -0
- package/src/lib/components/list-item.js +127 -0
- package/src/lib/components/list-item.js.map +1 -0
- package/src/lib/components/list.d.ts +34 -0
- package/src/lib/components/list.js +108 -0
- package/src/lib/components/list.js.map +1 -0
- package/src/lib/components/markdown.d.ts +129 -0
- package/src/lib/components/markdown.js +853 -0
- package/src/lib/components/markdown.js.map +1 -0
- package/src/lib/components/nav-menu.d.ts +68 -0
- package/src/lib/components/nav-menu.js +683 -0
- package/src/lib/components/nav-menu.js.map +1 -0
- package/src/lib/components/pagination.d.ts +59 -0
- package/src/lib/components/pagination.js +243 -0
- package/src/lib/components/pagination.js.map +1 -0
- package/src/lib/components/paper.d.ts +47 -0
- package/src/lib/components/paper.js +202 -0
- package/src/lib/components/paper.js.map +1 -0
- package/src/lib/components/plugin-frame.d.ts +64 -0
- package/src/lib/components/plugin-frame.js +335 -0
- package/src/lib/components/plugin-frame.js.map +1 -0
- package/src/lib/components/plugin.d.ts +95 -0
- package/src/lib/components/plugin.js +304 -0
- package/src/lib/components/plugin.js.map +1 -0
- package/src/lib/components/product.d.ts +40 -0
- package/src/lib/components/product.js +287 -0
- package/src/lib/components/product.js.map +1 -0
- package/src/lib/components/reusable-instance.d.ts +57 -0
- package/src/lib/components/reusable-instance.js +126 -0
- package/src/lib/components/reusable-instance.js.map +1 -0
- package/src/lib/components/screen-link.d.ts +85 -0
- package/src/lib/components/screen-link.js +324 -0
- package/src/lib/components/screen-link.js.map +1 -0
- package/src/lib/components/search-box.d.ts +41 -0
- package/src/lib/components/search-box.js +125 -0
- package/src/lib/components/search-box.js.map +1 -0
- package/src/lib/components/section.d.ts +56 -0
- package/src/lib/components/section.js +132 -0
- package/src/lib/components/section.js.map +1 -0
- package/src/lib/components/stack.d.ts +55 -0
- package/src/lib/components/stack.js +309 -0
- package/src/lib/components/stack.js.map +1 -0
- package/src/lib/components/tabs.d.ts +288 -0
- package/src/lib/components/tabs.js +788 -0
- package/src/lib/components/tabs.js.map +1 -0
- package/src/lib/components/theme-mode-switcher.d.ts +38 -0
- package/src/lib/components/theme-mode-switcher.js +168 -0
- package/src/lib/components/theme-mode-switcher.js.map +1 -0
- package/src/lib/components/toolbar.d.ts +37 -0
- package/src/lib/components/toolbar.js +117 -0
- package/src/lib/components/toolbar.js.map +1 -0
- package/src/lib/components/typography.d.ts +33 -0
- package/src/lib/components/typography.js +433 -0
- package/src/lib/components/typography.js.map +1 -0
- package/src/lib/components/video-lightbox-controls.d.ts +131 -0
- package/src/lib/components/video-lightbox-controls.js +536 -0
- package/src/lib/components/video-lightbox-controls.js.map +1 -0
- package/src/lib/components/video-lightbox.d.ts +60 -0
- package/src/lib/components/video-lightbox.js +247 -0
- package/src/lib/components/video-lightbox.js.map +1 -0
- package/src/lib/components/video-playback-beacon.d.ts +80 -0
- package/src/lib/components/video-playback-beacon.js +128 -0
- package/src/lib/components/video-playback-beacon.js.map +1 -0
- package/src/lib/components/video-player-frame.d.ts +58 -0
- package/src/lib/components/video-player-frame.js +51 -0
- package/src/lib/components/video-player-frame.js.map +1 -0
- package/src/lib/components/video.d.ts +220 -0
- package/src/lib/components/video.js +874 -0
- package/src/lib/components/video.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +17 -0
- package/src/lib/constants/bundle-common.js +18 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/constants/field-presets.d.ts +93 -0
- package/src/lib/constants/field-presets.js +248 -0
- package/src/lib/constants/field-presets.js.map +1 -0
- package/src/lib/plugin.d.ts +80 -0
- package/src/lib/plugin.js +599 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/utils/author-html-label.d.ts +73 -0
- package/src/lib/utils/author-html-label.js +89 -0
- package/src/lib/utils/author-html-label.js.map +1 -0
- package/src/lib/utils/drop-cleared-props.d.ts +18 -0
- package/src/lib/utils/drop-cleared-props.js +74 -0
- package/src/lib/utils/drop-cleared-props.js.map +1 -0
- package/src/lib/utils/element-picker.d.ts +99 -0
- package/src/lib/utils/element-picker.js +140 -0
- package/src/lib/utils/element-picker.js.map +1 -0
- package/src/lib/utils/generate-preset-id.d.ts +19 -0
- package/src/lib/utils/generate-preset-id.js +25 -0
- package/src/lib/utils/generate-preset-id.js.map +1 -0
- package/src/lib/utils/link-target-props.d.ts +53 -0
- package/src/lib/utils/link-target-props.js +53 -0
- package/src/lib/utils/link-target-props.js.map +1 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Aglyn LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
20
|
+
import { mdiGestureTapButton } from "@aglyn/shared-data-mdi";
|
|
21
|
+
import { getMdiIconPath } from "@aglyn/shared-data-mdi";
|
|
22
|
+
import { AppLink, MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
23
|
+
import Button from "@mui/material/Button";
|
|
24
|
+
import { forwardRef } from "react";
|
|
25
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
26
|
+
import { withAuthorHtmlLabel } from "../utils/author-html-label.js";
|
|
27
|
+
import { dropClearedProps } from "../utils/drop-cleared-props.js";
|
|
28
|
+
import { FIELD_COLOR, FIELD_DISABLED, FIELD_FULL_WIDTH, FIELD_LINK_TARGET, FIELD_LINK_TARGET_NAME, FIELD_SIZE, FIELD_TEXT_CONTENT } from "../constants/field-presets.js";
|
|
29
|
+
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
30
|
+
import { linkTargetProps } from "../utils/link-target-props.js";
|
|
31
|
+
// Component ids are persisted in screen documents; keep the legacy ids.
|
|
32
|
+
export const ID = 'muiButton';
|
|
33
|
+
/**
|
|
34
|
+
* What a button-styled LINK renders as while navigation is suppressed
|
|
35
|
+
* (besigner canvas, preview). `role: undefined` is the load-bearing half:
|
|
36
|
+
* MUI's `ButtonBase` stamps `role="button"` onto any non-`<button>` root,
|
|
37
|
+
* and merges the caller's props AFTER its own, so an explicit `undefined`
|
|
38
|
+
* is what removes it. Mirrors `screen-link.tsx` (AGL-1347).
|
|
39
|
+
*/ const STYLED_LINK_PLACEHOLDER = {
|
|
40
|
+
component: 'span',
|
|
41
|
+
role: undefined
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* mdi id → icon element; unknown/empty ids render nothing.
|
|
45
|
+
*
|
|
46
|
+
* Prefers the persisted path (AGL-1212) so render surfaces never need the
|
|
47
|
+
* ~2.9 MB catalog, and falls back to the catalog for buttons authored before
|
|
48
|
+
* paths were stored. `getMdiIconPath` rather than `getMdiIconFromId`: the
|
|
49
|
+
* latter substitutes `DEFAULT_ICON`, which has a real path, so a miss used to
|
|
50
|
+
* render a "help" glyph instead of nothing.
|
|
51
|
+
*/ function iconFromId(iconId, iconPath) {
|
|
52
|
+
const path = iconPath || getMdiIconPath(iconId);
|
|
53
|
+
return path ? /*#__PURE__*/ _jsx(MdiIcon, {
|
|
54
|
+
path: path,
|
|
55
|
+
fontSize: "small"
|
|
56
|
+
}) : undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Button with optional link mode (AGL-139): a screen id or external URL
|
|
60
|
+
* renders through AppLink exactly like the Screen Link component —
|
|
61
|
+
* degrading to a plain button in the besigner/preview and when the id
|
|
62
|
+
* doesn't resolve.
|
|
63
|
+
*
|
|
64
|
+
* Resolution (id-vs-URL precedence, protocol hardening) is `useLinkTarget`
|
|
65
|
+
* so a `Link`-typed component prop bound into EITHER field resolves the
|
|
66
|
+
* same way here as in Screen Link, Link Box and Image (AGL-1335).
|
|
67
|
+
*
|
|
68
|
+
* `renderAs="linkButton"` splits appearance from semantics in that link mode
|
|
69
|
+
* (AGL-1426), the same split `screen-link.tsx` got in AGL-1347. The 12 chips
|
|
70
|
+
* in "Dig in, or just say hello" on `aglyn.com/` are Buttons, not Screen
|
|
71
|
+
* Links: docs URLs, `mailto:` and social profiles, every one of them purely
|
|
72
|
+
* navigating, and every one announcing as a button — which tells a
|
|
73
|
+
* screen-reader user to expect an action and costs them the link list and
|
|
74
|
+
* the open-in-new-tab affordance. This mode keeps the `variant`/`size`/
|
|
75
|
+
* `fullWidth` pixels and drops the role, exactly as MUI's own
|
|
76
|
+
* `Button component={Link}` does.
|
|
77
|
+
*
|
|
78
|
+
* It only touches the link branch. A Button with no link target is a genuine
|
|
79
|
+
* `<button>` whose role is correct, so the value is inert there.
|
|
80
|
+
*/ const LinkableButton = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
81
|
+
const { screenId, href: externalHref, startIconId, endIconId, startIconPath, endIconPath, renderAs, target, targetName, html } = props, spread = _object_without_properties_loose(props, [
|
|
82
|
+
"screenId",
|
|
83
|
+
"href",
|
|
84
|
+
"startIconId",
|
|
85
|
+
"endIconId",
|
|
86
|
+
"startIconPath",
|
|
87
|
+
"endIconPath",
|
|
88
|
+
"renderAs",
|
|
89
|
+
"target",
|
|
90
|
+
"targetName",
|
|
91
|
+
"html"
|
|
92
|
+
]);
|
|
93
|
+
// A CLEARED attribute persists as null, and null is not "use the default"
|
|
94
|
+
// in React — `color={null}` reaches MUI, which capitalizes it and throws
|
|
95
|
+
// error #7 during SSR, 500ing the page (AGL-1226).
|
|
96
|
+
//
|
|
97
|
+
// The formatted label (AGL-2557) is substituted for `children` here rather
|
|
98
|
+
// than at each return below, so the two branches keep one shape and an
|
|
99
|
+
// unformatted button renders the identical tree it always did.
|
|
100
|
+
const rest = withAuthorHtmlLabel(dropClearedProps(spread), html);
|
|
101
|
+
const iconProps = {
|
|
102
|
+
startIcon: iconFromId(startIconId, startIconPath),
|
|
103
|
+
endIcon: iconFromId(endIconId, endIconPath)
|
|
104
|
+
};
|
|
105
|
+
const { href, suppressNavigation, leavesSite } = Aglyn.useLinkTarget(screenId, externalHref);
|
|
106
|
+
// Resolved rather than spread: `'custom'` is an authoring sentinel, and an
|
|
107
|
+
// anchor carrying `target="custom"` would open a window literally named
|
|
108
|
+
// that. The pair is destructured OUT of `spread` above, so the plain-button
|
|
109
|
+
// and suppressed branches below never stamp it on a `<button>`.
|
|
110
|
+
const targetAttrs = linkTargetProps(target, targetName, leavesSite);
|
|
111
|
+
// Semantics and appearance are independent choices now (AGL-1426): a
|
|
112
|
+
// styled link takes the button's styling props and none of its role.
|
|
113
|
+
const asStyledLink = renderAs === 'linkButton';
|
|
114
|
+
if (!href || suppressNavigation) {
|
|
115
|
+
// The canvas must not lie about which element the page will ship, so a
|
|
116
|
+
// suppressed styled link mirrors the live shape. Gated on `href` unlike
|
|
117
|
+
// `screen-link.tsx`: there, no target still means a link, but here it
|
|
118
|
+
// means a genuine button, which must keep being a real `<button>`.
|
|
119
|
+
return /*#__PURE__*/ _jsx(Button, _extends({
|
|
120
|
+
ref: ref
|
|
121
|
+
}, asStyledLink && href ? STYLED_LINK_PLACEHOLDER : {}, iconProps, rest));
|
|
122
|
+
}
|
|
123
|
+
return /*#__PURE__*/ _jsx(AppLink, _extends({
|
|
124
|
+
ref: ref,
|
|
125
|
+
componentVariant: "button",
|
|
126
|
+
href: href
|
|
127
|
+
}, targetAttrs, {
|
|
128
|
+
// The whole defect in one attribute. `ButtonBase` adds `role="button"`
|
|
129
|
+
// to every non-`<button>` root, so the button LOOK used to drag the
|
|
130
|
+
// button ROLE onto a navigating anchor. It spreads the caller's props
|
|
131
|
+
// after its own, so passing `undefined` here is what clears it — and
|
|
132
|
+
// only for the mode that asked to be a link. `'button'` is what
|
|
133
|
+
// `ButtonBase` stamps anyway, so nothing already authored moves.
|
|
134
|
+
role: asStyledLink ? undefined : 'button'
|
|
135
|
+
}, iconProps, rest));
|
|
136
|
+
});
|
|
137
|
+
LinkableButton.displayName = 'LinkableButton';
|
|
138
|
+
export const schema = {
|
|
139
|
+
$id: ID,
|
|
140
|
+
pluginId: BUNDLE_ID,
|
|
141
|
+
displayName: 'Button',
|
|
142
|
+
description: 'A button — or a link styled as one, if you point it at a screen or URL.',
|
|
143
|
+
category: Aglyn.ComponentCategory.INPUT,
|
|
144
|
+
icon: {
|
|
145
|
+
path: mdiGestureTapButton.path,
|
|
146
|
+
sx: {
|
|
147
|
+
color: '#2196f3'
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
flags: {
|
|
151
|
+
textEditable: Aglyn.FEATURE_FLAG.ENABLED,
|
|
152
|
+
richTextEditable: Aglyn.FEATURE_FLAG.ENABLED
|
|
153
|
+
},
|
|
154
|
+
// Emphasis only (AGL-2557). With no link target this is a real `<button>`,
|
|
155
|
+
// whose content model admits no list and no nested control; with one it is
|
|
156
|
+
// an `<a>`, where a second anchor is the same invalid nesting. Both shapes
|
|
157
|
+
// land on the same answer, so the schema does not have to know which one
|
|
158
|
+
// an author picked.
|
|
159
|
+
richTextCommands: [
|
|
160
|
+
Aglyn.RICH_TEXT_COMMANDS.EMPHASIS
|
|
161
|
+
],
|
|
162
|
+
attributes: [
|
|
163
|
+
FIELD_TEXT_CONTENT,
|
|
164
|
+
FIELD_COLOR,
|
|
165
|
+
FIELD_DISABLED,
|
|
166
|
+
FIELD_FULL_WIDTH,
|
|
167
|
+
FIELD_SIZE,
|
|
168
|
+
{
|
|
169
|
+
name: 'variant',
|
|
170
|
+
description: 'How much weight the button carries: Contained is a filled primary ' + 'action, Outlined a secondary one, Text the lightest. One contained ' + 'button per view is a good rule.',
|
|
171
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
172
|
+
label: 'Variant',
|
|
173
|
+
// "Default" deleted (AGL-1453): it could not persist, and `text` — the
|
|
174
|
+
// value it resolved to, MUI's own default — is already on the list.
|
|
175
|
+
options: [
|
|
176
|
+
{
|
|
177
|
+
value: 'text',
|
|
178
|
+
label: 'Text'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
value: 'outlined',
|
|
182
|
+
label: 'Outlined'
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
value: 'contained',
|
|
186
|
+
label: 'Contained'
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'screenId',
|
|
192
|
+
description: 'Optional: navigate to this screen when clicked — the address ' + 'follows the published path like a Screen Link (AGL-139).',
|
|
193
|
+
component: Aglyn.FieldComponentType.SCREEN_SELECT,
|
|
194
|
+
label: 'Link to screen'
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'href',
|
|
198
|
+
description: 'Where the button goes when it points off this site. Ignored while ' + 'Link to screen names one — that field wins, so clear it to use a ' + 'URL. Absolute (https://…) for another site, or a path for one of ' + 'your own routes.',
|
|
199
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD,
|
|
200
|
+
label: 'External URL',
|
|
201
|
+
// A bare `#fragment` saves and goes nowhere (AGL-2867).
|
|
202
|
+
resolveProps: Aglyn.bareFragmentLinkFieldProps
|
|
203
|
+
},
|
|
204
|
+
FIELD_LINK_TARGET,
|
|
205
|
+
FIELD_LINK_TARGET_NAME,
|
|
206
|
+
{
|
|
207
|
+
name: 'renderAs',
|
|
208
|
+
description: 'What this announces as once it links somewhere. Button is for ' + 'calls to action; pick "Link (button styling)" for a chip that only ' + 'navigates, so it keeps this look but announces as the link it is. ' + 'Ignored when there is no screen or URL to point at.',
|
|
209
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
210
|
+
label: 'Render as',
|
|
211
|
+
// `'button'` is a REAL SENTINEL, not a deletion (AGL-1453). Unlike the
|
|
212
|
+
// "Default" options on this component, `''` here spelled an author's
|
|
213
|
+
// actual choice, and one they could not make: the attributes form
|
|
214
|
+
// strips `''` before save (AGL-1191), so a button switched to Link
|
|
215
|
+
// (button styling) had no route in this dropdown back to Button — the
|
|
216
|
+
// pick reverted and the stored `linkButton` stayed.
|
|
217
|
+
//
|
|
218
|
+
// Safe because `renderAs` never reaches MUI: it is destructured out
|
|
219
|
+
// above and read only as `renderAs === 'linkButton'`. So `'button'` and
|
|
220
|
+
// an absent value take the identical branch, which is also what keeps
|
|
221
|
+
// every button authored before this existed rendering unchanged.
|
|
222
|
+
options: [
|
|
223
|
+
{
|
|
224
|
+
value: 'button',
|
|
225
|
+
label: 'Button'
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
value: 'linkButton',
|
|
229
|
+
label: 'Link (button styling)'
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'startIconId',
|
|
235
|
+
description: 'Icon shown before the label.',
|
|
236
|
+
component: Aglyn.FieldComponentType.ICON_PICKER,
|
|
237
|
+
label: 'Start icon'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'endIconId',
|
|
241
|
+
description: 'Icon shown after the label.',
|
|
242
|
+
component: Aglyn.FieldComponentType.ICON_PICKER,
|
|
243
|
+
label: 'End icon'
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
};
|
|
247
|
+
export const presets = [
|
|
248
|
+
{
|
|
249
|
+
$id: generatePresetId(ID),
|
|
250
|
+
type: Aglyn.NodeType.PRESET,
|
|
251
|
+
displayName: 'Outlined Button',
|
|
252
|
+
icon: {
|
|
253
|
+
path: mdiGestureTapButton.path,
|
|
254
|
+
sx: {
|
|
255
|
+
color: '#2196f3'
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
category: Aglyn.ComponentCategory.INPUT,
|
|
259
|
+
data: {
|
|
260
|
+
$id: null,
|
|
261
|
+
componentId: ID,
|
|
262
|
+
pluginId: BUNDLE_ID,
|
|
263
|
+
props: {
|
|
264
|
+
variant: 'outlined',
|
|
265
|
+
children: 'Click Me'
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
];
|
|
270
|
+
export default LinkableButton;
|
|
271
|
+
|
|
272
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/button.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport { mdiGestureTapButton } from '@aglyn/shared-data-mdi'\nimport { getMdiIconPath } from '@aglyn/shared-data-mdi'\nimport { AppLink, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport Button, { type ButtonProps } from '@mui/material/Button'\nimport { forwardRef } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { withAuthorHtmlLabel } from '../utils/author-html-label'\nimport { dropClearedProps } from '../utils/drop-cleared-props'\nimport {\n FIELD_COLOR,\n FIELD_DISABLED,\n FIELD_FULL_WIDTH,\n FIELD_LINK_TARGET,\n FIELD_LINK_TARGET_NAME,\n FIELD_SIZE,\n FIELD_TEXT_CONTENT,\n} from '../constants/field-presets'\nimport { generatePresetId } from '../utils/generate-preset-id'\nimport {\n type LinkTargetChoice,\n linkTargetProps,\n} from '../utils/link-target-props'\n\n// Component ids are persisted in screen documents; keep the legacy ids.\nexport const ID: Aglyn.ComponentId = 'muiButton'\n\nexport interface LinkableButtonProps extends ButtonProps {\n /** Target screen id; resolved from the routing map (AGL-139). */\n screenId?: string\n /** External URL, used only when no `screenId` is set. */\n href?: string\n /** mdi icon id rendered before the label (AGL-146). */\n startIconId?: string\n /** mdi icon id rendered after the label (AGL-146). */\n endIconId?: string\n /** Resolved SVG path for `startIconId`, stored at author time (AGL-1212). */\n startIconPath?: string\n /** Resolved SVG path for `endIconId`, stored at author time (AGL-1212). */\n endIconPath?: string\n /**\n * What the LINK MODE announces as (AGL-1426). Persisted in screen\n * documents; never rename, and `undefined` must keep meaning `'button'` —\n * every button authored before this existed is one.\n *\n * - `'button'` (or unset) — `<a role=\"button\">` with the button's look.\n * - `'linkButton'` — a plain `<a>` with NO role, keeping the button's\n * `variant`/`size`/`fullWidth`. Appearance without semantics.\n *\n * There is no `'link'` value here: a plain text link is `muiScreenLink`'s\n * job, and this component's whole purpose is the button styling.\n */\n renderAs?: 'button' | 'linkButton'\n /**\n * Where LINK MODE opens. Persisted in screen documents; never rename a\n * value, and `undefined` must keep meaning `'_self'`. Inert on a button\n * with nothing to point at — that is a real `<button>`, which has no\n * browsing context to choose.\n */\n target?: LinkTargetChoice\n /** Window name used only when `target` is `'custom'`. */\n targetName?: string\n /**\n * Sanitized emphasis markup for the label, written by the inline editor's\n * rich mode (AGL-2557). `children` keeps the plain-text reading of it, and\n * is what every surface that cannot render markup falls back to.\n */\n html?: string\n}\n\n/**\n * What a button-styled LINK renders as while navigation is suppressed\n * (besigner canvas, preview). `role: undefined` is the load-bearing half:\n * MUI's `ButtonBase` stamps `role=\"button\"` onto any non-`<button>` root,\n * and merges the caller's props AFTER its own, so an explicit `undefined`\n * is what removes it. Mirrors `screen-link.tsx` (AGL-1347).\n */\nconst STYLED_LINK_PLACEHOLDER = { component: 'span', role: undefined } as const\n\n/**\n * mdi id → icon element; unknown/empty ids render nothing.\n *\n * Prefers the persisted path (AGL-1212) so render surfaces never need the\n * ~2.9 MB catalog, and falls back to the catalog for buttons authored before\n * paths were stored. `getMdiIconPath` rather than `getMdiIconFromId`: the\n * latter substitutes `DEFAULT_ICON`, which has a real path, so a miss used to\n * render a \"help\" glyph instead of nothing.\n */\nfunction iconFromId(iconId?: string, iconPath?: string) {\n const path = iconPath || getMdiIconPath(iconId)\n return path ? <MdiIcon path={path} fontSize=\"small\" /> : undefined\n}\n\n/**\n * Button with optional link mode (AGL-139): a screen id or external URL\n * renders through AppLink exactly like the Screen Link component —\n * degrading to a plain button in the besigner/preview and when the id\n * doesn't resolve.\n *\n * Resolution (id-vs-URL precedence, protocol hardening) is `useLinkTarget`\n * so a `Link`-typed component prop bound into EITHER field resolves the\n * same way here as in Screen Link, Link Box and Image (AGL-1335).\n *\n * `renderAs=\"linkButton\"` splits appearance from semantics in that link mode\n * (AGL-1426), the same split `screen-link.tsx` got in AGL-1347. The 12 chips\n * in \"Dig in, or just say hello\" on `aglyn.com/` are Buttons, not Screen\n * Links: docs URLs, `mailto:` and social profiles, every one of them purely\n * navigating, and every one announcing as a button — which tells a\n * screen-reader user to expect an action and costs them the link list and\n * the open-in-new-tab affordance. This mode keeps the `variant`/`size`/\n * `fullWidth` pixels and drops the role, exactly as MUI's own\n * `Button component={Link}` does.\n *\n * It only touches the link branch. A Button with no link target is a genuine\n * `<button>` whose role is correct, so the value is inert there.\n */\nconst LinkableButton = forwardRef<any, LinkableButtonProps>((props, ref) => {\n const {\n screenId,\n href: externalHref,\n startIconId,\n endIconId,\n startIconPath,\n endIconPath,\n renderAs,\n target,\n targetName,\n html,\n ...spread\n } = props\n // A CLEARED attribute persists as null, and null is not \"use the default\"\n // in React — `color={null}` reaches MUI, which capitalizes it and throws\n // error #7 during SSR, 500ing the page (AGL-1226).\n //\n // The formatted label (AGL-2557) is substituted for `children` here rather\n // than at each return below, so the two branches keep one shape and an\n // unformatted button renders the identical tree it always did.\n const rest = withAuthorHtmlLabel(dropClearedProps(spread), html)\n const iconProps = {\n startIcon: iconFromId(startIconId, startIconPath),\n endIcon: iconFromId(endIconId, endIconPath),\n }\n const { href, suppressNavigation, leavesSite } = Aglyn.useLinkTarget(\n screenId,\n externalHref,\n )\n // Resolved rather than spread: `'custom'` is an authoring sentinel, and an\n // anchor carrying `target=\"custom\"` would open a window literally named\n // that. The pair is destructured OUT of `spread` above, so the plain-button\n // and suppressed branches below never stamp it on a `<button>`.\n const targetAttrs = linkTargetProps(target, targetName, leavesSite)\n // Semantics and appearance are independent choices now (AGL-1426): a\n // styled link takes the button's styling props and none of its role.\n const asStyledLink = renderAs === 'linkButton'\n\n if (!href || suppressNavigation) {\n // The canvas must not lie about which element the page will ship, so a\n // suppressed styled link mirrors the live shape. Gated on `href` unlike\n // `screen-link.tsx`: there, no target still means a link, but here it\n // means a genuine button, which must keep being a real `<button>`.\n return (\n <Button\n ref={ref}\n {...(asStyledLink && href ? STYLED_LINK_PLACEHOLDER : {})}\n {...iconProps}\n {...rest}\n />\n )\n }\n return (\n <AppLink\n ref={ref}\n componentVariant=\"button\"\n href={href}\n {...targetAttrs}\n // The whole defect in one attribute. `ButtonBase` adds `role=\"button\"`\n // to every non-`<button>` root, so the button LOOK used to drag the\n // button ROLE onto a navigating anchor. It spreads the caller's props\n // after its own, so passing `undefined` here is what clears it — and\n // only for the mode that asked to be a link. `'button'` is what\n // `ButtonBase` stamps anyway, so nothing already authored moves.\n role={asStyledLink ? undefined : 'button'}\n {...iconProps}\n {...rest}\n />\n )\n})\nLinkableButton.displayName = 'LinkableButton'\n\nexport const schema: Aglyn.ComponentSchema<LinkableButtonProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Button',\n description:\n 'A button — or a link styled as one, if you point it at a screen or URL.',\n category: Aglyn.ComponentCategory.INPUT,\n icon: {\n path: mdiGestureTapButton.path,\n sx: { color: '#2196f3' },\n },\n flags: {\n textEditable: Aglyn.FEATURE_FLAG.ENABLED,\n richTextEditable: Aglyn.FEATURE_FLAG.ENABLED,\n },\n // Emphasis only (AGL-2557). With no link target this is a real `<button>`,\n // whose content model admits no list and no nested control; with one it is\n // an `<a>`, where a second anchor is the same invalid nesting. Both shapes\n // land on the same answer, so the schema does not have to know which one\n // an author picked.\n richTextCommands: [Aglyn.RICH_TEXT_COMMANDS.EMPHASIS],\n attributes: [\n FIELD_TEXT_CONTENT,\n FIELD_COLOR,\n FIELD_DISABLED,\n FIELD_FULL_WIDTH,\n FIELD_SIZE,\n {\n name: 'variant',\n description:\n 'How much weight the button carries: Contained is a filled primary ' +\n 'action, Outlined a secondary one, Text the lightest. One contained ' +\n 'button per view is a good rule.',\n component: Aglyn.FieldComponentType.SELECT,\n label: 'Variant',\n // \"Default\" deleted (AGL-1453): it could not persist, and `text` — the\n // value it resolved to, MUI's own default — is already on the list.\n options: [\n { value: 'text', label: 'Text' },\n { value: 'outlined', label: 'Outlined' },\n { value: 'contained', label: 'Contained' },\n ],\n },\n {\n name: 'screenId',\n description:\n 'Optional: navigate to this screen when clicked — the address ' +\n 'follows the published path like a Screen Link (AGL-139).',\n component: Aglyn.FieldComponentType.SCREEN_SELECT,\n label: 'Link to screen',\n },\n {\n name: 'href',\n description:\n 'Where the button goes when it points off this site. Ignored while ' +\n 'Link to screen names one — that field wins, so clear it to use a ' +\n 'URL. Absolute (https://…) for another site, or a path for one of ' +\n 'your own routes.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n label: 'External URL',\n // A bare `#fragment` saves and goes nowhere (AGL-2867).\n resolveProps: Aglyn.bareFragmentLinkFieldProps,\n },\n FIELD_LINK_TARGET,\n FIELD_LINK_TARGET_NAME,\n {\n name: 'renderAs',\n description:\n 'What this announces as once it links somewhere. Button is for ' +\n 'calls to action; pick \"Link (button styling)\" for a chip that only ' +\n 'navigates, so it keeps this look but announces as the link it is. ' +\n 'Ignored when there is no screen or URL to point at.',\n component: Aglyn.FieldComponentType.SELECT,\n label: 'Render as',\n // `'button'` is a REAL SENTINEL, not a deletion (AGL-1453). Unlike the\n // \"Default\" options on this component, `''` here spelled an author's\n // actual choice, and one they could not make: the attributes form\n // strips `''` before save (AGL-1191), so a button switched to Link\n // (button styling) had no route in this dropdown back to Button — the\n // pick reverted and the stored `linkButton` stayed.\n //\n // Safe because `renderAs` never reaches MUI: it is destructured out\n // above and read only as `renderAs === 'linkButton'`. So `'button'` and\n // an absent value take the identical branch, which is also what keeps\n // every button authored before this existed rendering unchanged.\n options: [\n { value: 'button', label: 'Button' },\n { value: 'linkButton', label: 'Link (button styling)' },\n ],\n },\n {\n name: 'startIconId',\n description: 'Icon shown before the label.',\n component: Aglyn.FieldComponentType.ICON_PICKER,\n label: 'Start icon',\n },\n {\n name: 'endIconId',\n description: 'Icon shown after the label.',\n component: Aglyn.FieldComponentType.ICON_PICKER,\n label: 'End icon',\n },\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Outlined Button',\n icon: {\n path: mdiGestureTapButton.path,\n sx: { color: '#2196f3' },\n },\n category: Aglyn.ComponentCategory.INPUT,\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: {\n variant: 'outlined',\n children: 'Click Me',\n },\n },\n },\n]\n\nexport default LinkableButton\n"],"names":["Aglyn","mdiGestureTapButton","getMdiIconPath","AppLink","MdiIcon","Button","forwardRef","BUNDLE_ID","withAuthorHtmlLabel","dropClearedProps","FIELD_COLOR","FIELD_DISABLED","FIELD_FULL_WIDTH","FIELD_LINK_TARGET","FIELD_LINK_TARGET_NAME","FIELD_SIZE","FIELD_TEXT_CONTENT","generatePresetId","linkTargetProps","ID","STYLED_LINK_PLACEHOLDER","component","role","undefined","iconFromId","iconId","iconPath","path","fontSize","LinkableButton","props","ref","screenId","href","externalHref","startIconId","endIconId","startIconPath","endIconPath","renderAs","target","targetName","html","spread","rest","iconProps","startIcon","endIcon","suppressNavigation","leavesSite","useLinkTarget","targetAttrs","asStyledLink","componentVariant","displayName","schema","$id","pluginId","description","category","ComponentCategory","INPUT","icon","sx","color","flags","textEditable","FEATURE_FLAG","ENABLED","richTextEditable","richTextCommands","RICH_TEXT_COMMANDS","EMPHASIS","attributes","name","FieldComponentType","SELECT","label","options","value","SCREEN_SELECT","TEXT_FIELD","resolveProps","bareFragmentLinkFieldProps","ICON_PICKER","presets","type","NodeType","PRESET","data","componentId","variant","children"],"mappings":"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"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn';
|
|
18
|
+
import { type ReactNode } from 'react';
|
|
19
|
+
export declare const CARD_ID: Aglyn.ComponentId;
|
|
20
|
+
export declare const CARD_HEADER_ID: Aglyn.ComponentId;
|
|
21
|
+
export declare const CARD_CONTENT_ID: Aglyn.ComponentId;
|
|
22
|
+
export declare const CARD_ACTIONS_ID: Aglyn.ComponentId;
|
|
23
|
+
export interface CardElementProps {
|
|
24
|
+
variant?: 'elevation' | 'outlined';
|
|
25
|
+
/** Shadow depth, 0–24; ignored on the outlined variant. */
|
|
26
|
+
elevation?: number | string;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export interface CardHeaderElementProps {
|
|
30
|
+
title?: string;
|
|
31
|
+
subheader?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CardActionsElementProps {
|
|
34
|
+
/** If true, the 8px gap between action buttons is removed. */
|
|
35
|
+
disableSpacing?: boolean;
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Card (https://mui.com/material-ui/react-card/) — a Paper with card
|
|
40
|
+
* padding conventions. Composed from separate Header/Content/Actions
|
|
41
|
+
* elements rather than a single element with a dozen text props, so the
|
|
42
|
+
* pieces are individually selectable, stylable and reorderable on the
|
|
43
|
+
* canvas like everything else.
|
|
44
|
+
*/
|
|
45
|
+
declare const CardElement: import("react").ForwardRefExoticComponent<CardElementProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
46
|
+
/**
|
|
47
|
+
* Card header. `title`/`subheader` are plain strings: MUI wraps each in
|
|
48
|
+
* its own Typography, and passing children instead would drop the
|
|
49
|
+
* heading/subheading type scale a card header exists to provide.
|
|
50
|
+
*/
|
|
51
|
+
export declare const CardHeaderElement: import("react").ForwardRefExoticComponent<CardHeaderElementProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
52
|
+
export declare const CardContentElement: import("react").ForwardRefExoticComponent<{
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
|
+
export declare const CardActionsElement: import("react").ForwardRefExoticComponent<CardActionsElementProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
56
|
+
export declare const cardSchema: Aglyn.ComponentSchema<CardElementProps>;
|
|
57
|
+
export declare const cardHeaderSchema: Aglyn.ComponentSchema<CardHeaderElementProps>;
|
|
58
|
+
export declare const cardContentSchema: Aglyn.ComponentSchema;
|
|
59
|
+
export declare const cardActionsSchema: Aglyn.ComponentSchema<CardActionsElementProps>;
|
|
60
|
+
export declare const cardPresets: Aglyn.PresetSchema[];
|
|
61
|
+
export default CardElement;
|