flet-box 1.1.2 → 1.1.3
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/AGENTS_FOR_CODE_GEN.md +284 -0
- package/CONTRIBUTING.md +238 -0
- package/README.md +2 -2
- package/bin/cli.js +88 -1
- package/bin/commands/auditFix.js +181 -27
- package/bin/commands/checkApi.js +14 -3
- package/bin/commands/checkStructure.js +368 -0
- package/bin/commands/checkSyntax.js +293 -0
- package/bin/commands/checkUi.js +666 -14
- package/bin/commands/create.js +14 -0
- package/bin/commands/createBundle.js +2 -2
- package/bin/commands/metrics.js +448 -0
- package/bin/commands/release.js +18 -0
- package/bin/commands/report.js +849 -0
- package/bin/commands/tools.js +76 -0
- package/bin/commands/unpack.js +39 -11
- package/bin/commands/verify.js +879 -0
- package/bin/mcp.js +280 -0
- package/bin/utils/contract.js +27 -0
- package/bin/utils/dtsProps.js +5 -1
- package/bin/utils/migrationGuide.js +146 -0
- package/bin/utils/moduleExports.js +9 -5
- package/bin/utils/templates.js +225 -18
- package/bin/utils/toolkit.js +191 -0
- package/docs/README.md +5 -1
- package/docs/arquitectura.md +1 -1
- package/docs/cli/README.md +168 -2
- package/docs/guides/README.md +6 -0
- package/docs/guides/accessibility.md +2 -1
- package/docs/guides/ai-toolkit.md +166 -0
- package/docs/guides/compatibility.md +1 -1
- package/docs/guides/migration.md +92 -0
- package/docs/guides/minification-and-protection.md +2 -1
- package/docs/guides/mobile-and-platforms.md +1 -1
- package/docs/guides/online-updates.md +2 -0
- package/docs/server/deployment.md +1 -1
- package/docs/tools/styling.md +2 -2
- package/docs/tools/theme.md +139 -4
- package/docs/widget/Accordion.md +74 -8
- package/docs/widget/AdMob.md +68 -3
- package/docs/widget/AdSense.md +67 -2
- package/docs/widget/AlertDialog.md +1 -1
- package/docs/widget/AnimatedBox.md +80 -39
- package/docs/widget/AnimatedText.md +74 -18
- package/docs/widget/Audio.md +73 -14
- package/docs/widget/Avatar.md +69 -4
- package/docs/widget/Badge.md +68 -3
- package/docs/widget/BottomSheet.md +2 -2
- package/docs/widget/Button.md +69 -3
- package/docs/widget/Card.md +69 -4
- package/docs/widget/Carousel.md +67 -2
- package/docs/widget/Chart.md +67 -2
- package/docs/widget/Checkbox.md +74 -8
- package/docs/widget/Chip.md +68 -3
- package/docs/widget/CircularBar.md +74 -15
- package/docs/widget/CircularChart.md +71 -10
- package/docs/widget/CodeViewer.md +67 -2
- package/docs/widget/Column.md +68 -3
- package/docs/widget/Container.md +68 -3
- package/docs/widget/DataTable.md +67 -2
- package/docs/widget/Divider.md +67 -2
- package/docs/widget/DraggBox.md +67 -2
- package/docs/widget/Dropdown.md +76 -10
- package/docs/widget/DroppBox.md +67 -2
- package/docs/widget/FloatingActionButton.md +68 -3
- package/docs/widget/GridView.md +67 -2
- package/docs/widget/Icon.md +71 -5
- package/docs/widget/Image.md +68 -3
- package/docs/widget/Input.md +68 -3
- package/docs/widget/Inspector.md +2 -2
- package/docs/widget/InstallButton.md +73 -13
- package/docs/widget/ListTile.md +69 -3
- package/docs/widget/ListView.md +67 -2
- package/docs/widget/Maps.md +68 -3
- package/docs/widget/Markdown.md +74 -15
- package/docs/widget/MatrixRain.md +72 -11
- package/docs/widget/Menu.md +209 -0
- package/docs/widget/Modal.md +3 -3
- package/docs/widget/Pagination.md +68 -3
- package/docs/widget/ParallaxBox.md +72 -12
- package/docs/widget/ProgressBar.md +69 -4
- package/docs/widget/QRCode.md +67 -2
- package/docs/widget/README.md +54 -50
- package/docs/widget/Radio.md +76 -10
- package/docs/widget/Rating.md +70 -6
- package/docs/widget/Row.md +68 -3
- package/docs/widget/Skeleton.md +68 -3
- package/docs/widget/Slider.md +75 -9
- package/docs/widget/SnackBar.md +2 -2
- package/docs/widget/Stack.md +68 -3
- package/docs/widget/Stepper.md +68 -3
- package/docs/widget/Switch.md +74 -8
- package/docs/widget/Text.md +71 -4
- package/docs/widget/ThemePicker.md +197 -0
- package/docs/widget/Tooltip.md +72 -7
- package/docs/widget/TreeView.md +70 -10
- package/docs/widget/Video.md +71 -10
- package/package.json +10 -3
- package/skills/fletbox-design/SKILL.md +89 -5
- package/skills/fletbox-motion/SKILL.md +1 -1
- package/skills/fletbox-rules/SKILL.md +56 -4
- package/src/core/runApp.js +12 -0
- package/src/index.d.ts +374 -101
- package/src/index.js +9 -0
- package/src/navigations/AdaptiveScaffold.js +2 -2
- package/src/navigations/BottomNavigation.js +1 -1
- package/src/navigations/Scaffold.js +18 -6
- package/src/tools/useState.js +11 -4
- package/src/utils/colors.js +275 -0
- package/src/utils/errorBoundary.js +288 -0
- package/src/utils/index.js +10 -2
- package/src/utils/stackPosition.js +39 -24
- package/src/utils/syntaxHighlight.js +4 -1
- package/src/utils/themes.js +279 -3
- package/src/widget-factory/addChildren.js +17 -10
- package/src/widget-factory/assignProps.js +18 -6
- package/src/widget-factory/createWidget.js +7 -0
- package/src/widget-factory/deprecations.js +77 -0
- package/src/widget-factory/translateProps.js +11 -1
- package/src/widget-factory/warnings.js +1 -27
- package/src/widget-factory/widgetFactory.js +59 -17
- package/src/widgets/Accordion.js +21 -7
- package/src/widgets/Badge.js +11 -2
- package/src/widgets/Button.js +15 -3
- package/src/widgets/Carousel.js +12 -4
- package/src/widgets/Chart.js +7 -2
- package/src/widgets/Checkbox.js +1 -2
- package/src/widgets/Chip.js +24 -10
- package/src/widgets/CircularBar.js +9 -3
- package/src/widgets/CircularChart.js +5 -3
- package/src/widgets/Container.js +6 -0
- package/src/widgets/Divider.js +3 -1
- package/src/widgets/DraggBox.js +9 -0
- package/src/widgets/Dropdown.js +3 -3
- package/src/widgets/DroppBox.js +5 -0
- package/src/widgets/FloatingActionButton.js +1 -1
- package/src/widgets/Icon.js +5 -1
- package/src/widgets/InstallButton.js +4 -2
- package/src/widgets/Markdown.js +171 -103
- package/src/widgets/Menu.js +340 -0
- package/src/widgets/Modal.js +7 -1
- package/src/widgets/Pagination.js +10 -5
- package/src/widgets/ProgressBar.js +5 -4
- package/src/widgets/QRCode.js +4 -0
- package/src/widgets/Radio.js +1 -2
- package/src/widgets/Rating.js +9 -0
- package/src/widgets/Slider.js +4 -1
- package/src/widgets/SnackBar.js +2 -2
- package/src/widgets/Switch.js +1 -2
- package/src/widgets/Text.js +9 -5
- package/src/widgets/ThemePicker.js +234 -0
- package/src/widgets/TreeView.js +2 -1
- package/src/widgets/index.js +2 -0
- package/docs/CONTRIBUTING.md +0 -156
package/docs/widget/Maps.md
CHANGED
|
@@ -51,11 +51,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
51
51
|
|
|
52
52
|
| Prop | Type | Description |
|
|
53
53
|
| --- | --- | --- |
|
|
54
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
55
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
56
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
57
|
+
| `center` | `boolean` | View centre as `[lat, lng]`, `{lat, lng}` or `{latitude, longitude}`. |
|
|
58
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
59
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
60
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
61
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
62
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
63
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
64
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
65
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
66
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
67
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
68
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
69
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
70
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
54
71
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
55
72
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
56
73
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
74
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
75
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
76
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
77
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
78
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
79
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
80
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
81
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
82
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
83
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
84
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
85
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
86
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
87
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
88
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
89
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
90
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
91
|
+
| `fontSize` | `number` | Size of the font. |
|
|
92
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
93
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
57
94
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
95
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
96
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
97
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
98
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
99
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
100
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
101
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
102
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
58
103
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
104
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
105
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
106
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
107
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
108
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
109
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
110
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
111
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
59
112
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
60
113
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
61
114
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -65,11 +118,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
65
118
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
66
119
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
67
120
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
121
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
122
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
123
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
124
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
68
125
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
69
126
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
70
127
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
71
|
-
| `onPress` | `(
|
|
72
|
-
| `onClick` | `(
|
|
128
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
129
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
130
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
131
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
132
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
133
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
134
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
135
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
136
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
137
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
73
138
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
74
139
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
75
140
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -80,7 +145,7 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
80
145
|
### Everyday
|
|
81
146
|
|
|
82
147
|
```javascript
|
|
83
|
-
import { Maps, colors } from "flet-box";
|
|
148
|
+
import { Maps, colors, pick } from "flet-box";
|
|
84
149
|
|
|
85
150
|
const stops = Maps({
|
|
86
151
|
center: [40.4168, -3.7038],
|
package/docs/widget/Markdown.md
CHANGED
|
@@ -62,7 +62,7 @@ const notes = Markdown({
|
|
|
62
62
|
| `imageBorderRadius` | `number` | Corner radius for the image. |
|
|
63
63
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
64
64
|
| `maxHeight` | `number` | Maximum height the widget may grow to. |
|
|
65
|
-
| `overflow` | `
|
|
65
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
66
66
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
67
67
|
| `borderRadius` | `number` | Rounds the corners of the widget. |
|
|
68
68
|
| `allowDangerousHtml` | `boolean` | Allows raw HTML inside markdown output. |
|
|
@@ -73,11 +73,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
73
73
|
|
|
74
74
|
| Prop | Type | Description |
|
|
75
75
|
| --- | --- | --- |
|
|
76
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
77
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
78
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
79
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
80
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
81
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
82
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
83
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
84
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
85
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
86
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
87
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
88
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
89
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
90
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
91
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
92
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
76
93
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
77
94
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
78
95
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
96
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
97
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
98
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
99
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
100
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
101
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
102
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
103
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
104
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
105
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
106
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
107
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
108
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
109
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
110
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
111
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
112
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
113
|
+
| `fontSize` | `number` | Size of the font. |
|
|
114
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
115
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
79
116
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
117
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
118
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
119
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
120
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
121
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
122
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
123
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
124
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
80
125
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
126
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
127
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
128
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
129
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
130
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
131
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
132
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
133
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
81
134
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
82
135
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
83
136
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -87,11 +140,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
87
140
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
88
141
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
89
142
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
143
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
144
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
145
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
146
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
90
147
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
91
148
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
92
149
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
93
|
-
| `onPress` | `(
|
|
94
|
-
| `onClick` | `(
|
|
150
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
151
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
152
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
153
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
154
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
155
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
156
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
157
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
158
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
159
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
95
160
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
96
161
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
97
162
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -145,26 +210,20 @@ const guide = Markdown({
|
|
|
145
210
|
## Tips
|
|
146
211
|
|
|
147
212
|
- text, source, and content are interchangeable aliases for the markdown source.
|
|
148
|
-
- Tune the palette with the per-instance props (codeBgColor, preBgColor, linkColor),
|
|
149
|
-
- and set maxHeight with overflow to keep long pages scrollable.
|
|
213
|
+
- Tune the palette with the per-instance props (codeBgColor, preBgColor, linkColor), and set maxHeight with overflow to keep long pages scrollable.
|
|
150
214
|
- Code blocks are syntax-highlighted and get a one-click copy action out of the box.
|
|
151
215
|
|
|
152
216
|
## Accessibility
|
|
153
217
|
|
|
154
|
-
- Keep link text descriptive; rendered links stay real anchors that the keyboard can
|
|
155
|
-
- tab to.
|
|
218
|
+
- Keep link text descriptive; rendered links stay real anchors that the keyboard can tab to.
|
|
156
219
|
- Heading levels map to real h1-h6 elements, so keep the document hierarchy sensible.
|
|
157
220
|
|
|
158
221
|
## Behavior
|
|
159
222
|
|
|
160
|
-
- Generated styles are scoped to each instance, so several Markdown blocks never leak
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
- Inline code writes the palette's readable red, so 12px words clear 4.5:1 on the code
|
|
165
|
-
- plate in both themes.
|
|
166
|
-
- A link takes the palette's readable blue, because in light `primary` is the page's
|
|
167
|
-
- own ink and the link would vanish into the sentence.
|
|
223
|
+
- Generated styles are scoped to each instance, so several Markdown blocks never leak CSS into each other.
|
|
224
|
+
- Rendered HTML is sanitized before insert; allowDangerousHtml stays false by default for untrusted input.
|
|
225
|
+
- Inline code writes the palette's readable red, so 12px words clear 4.5:1 on the code plate in both themes.
|
|
226
|
+
- A link takes the palette's readable blue, because in light `primary` is the page's own ink and the link would vanish into the sentence.
|
|
168
227
|
|
|
169
228
|
## Related widgets
|
|
170
229
|
|
|
@@ -27,7 +27,7 @@ const rain = MatrixRain({});
|
|
|
27
27
|
| `resetProbability` | `number` | Chance a column resets to the top each frame. |
|
|
28
28
|
| `useDynamicColor` | `boolean` | Cycles colors instead of using a fixed color. |
|
|
29
29
|
| `position` | `'fixed' \| 'absolute'` | CSS `position` value, or `stack` for centered stacking. |
|
|
30
|
-
| `zIndex` | `number` |
|
|
30
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
31
31
|
|
|
32
32
|
### Common props
|
|
33
33
|
|
|
@@ -35,11 +35,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
35
35
|
|
|
36
36
|
| Prop | Type | Description |
|
|
37
37
|
| --- | --- | --- |
|
|
38
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
39
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
40
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
41
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
42
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
43
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
44
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
45
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
46
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
47
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
48
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
49
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
50
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
51
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
52
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
53
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
54
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
38
55
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
39
56
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
40
57
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
58
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
59
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
60
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
61
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
62
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
63
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
64
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
65
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
66
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
67
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
68
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
69
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
70
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
71
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
72
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
73
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
74
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
75
|
+
| `fontSize` | `number` | Size of the font. |
|
|
76
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
77
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
41
78
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
79
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
80
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
81
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
82
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
83
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
84
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
85
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
86
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
42
87
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
88
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
89
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
90
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
91
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
92
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
93
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
94
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
95
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
43
96
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
44
97
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
45
98
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -49,11 +102,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
49
102
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
50
103
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
51
104
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
105
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
106
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
107
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
108
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
52
109
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
53
110
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
54
111
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
55
|
-
| `onPress` | `(
|
|
56
|
-
| `onClick` | `(
|
|
112
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
113
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
114
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
115
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
116
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
117
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
118
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
119
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
120
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
121
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
57
122
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
58
123
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
59
124
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -92,22 +157,18 @@ const rain = MatrixRain({
|
|
|
92
157
|
|
|
93
158
|
## Tips
|
|
94
159
|
|
|
95
|
-
- position: "fixed" fills the viewport; "absolute" fills a positioned parent
|
|
96
|
-
- instead.
|
|
160
|
+
- position: "fixed" fills the viewport; "absolute" fills a positioned parent instead.
|
|
97
161
|
- Set zIndex low (1 or negative) so the rain renders behind your regular UI.
|
|
98
162
|
- Tune resetProbability closer to 1 to make trails longer or drops rarer.
|
|
99
163
|
|
|
100
164
|
## Accessibility
|
|
101
165
|
|
|
102
|
-
- The rain is decorative canvas output; pair it with real content on top and make it
|
|
103
|
-
- pausable for motion-sensitive users.
|
|
166
|
+
- The rain is decorative canvas output; pair it with real content on top and make it pausable for motion-sensitive users.
|
|
104
167
|
|
|
105
168
|
## Behavior
|
|
106
169
|
|
|
107
|
-
- The returned canvas runs its animation loop immediately and exposes _cleanup() to
|
|
108
|
-
-
|
|
109
|
-
- Changing speed or fadeAmount only affects future frames; update them before mount
|
|
110
|
-
- for a clean start.
|
|
170
|
+
- The returned canvas runs its animation loop immediately and exposes _cleanup() to stop drawing and disconnect the ResizeObserver.
|
|
171
|
+
- Changing speed or fadeAmount only affects future frames; update them before mount for a clean start.
|
|
111
172
|
|
|
112
173
|
## Related widgets
|
|
113
174
|
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Menu
|
|
2
|
+
|
|
3
|
+
A trigger button that opens an anchored menu of actions. The panel is a portal on document.body, so a row's overflow cannot clip it, and it speaks the menu keyboard pattern instead of being a second list of links.
|
|
4
|
+
|
|
5
|
+
## When to use it
|
|
6
|
+
|
|
7
|
+
Use it for the secondary actions of a row — rename, duplicate, delete — when two permanent buttons would take the space the row's own label needs.
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import { Menu } from "flet-box";
|
|
13
|
+
|
|
14
|
+
const actions = Menu({
|
|
15
|
+
label: "Conversation actions",
|
|
16
|
+
items: [
|
|
17
|
+
{ text: "Rename", icon: "edit", onPress: rename },
|
|
18
|
+
{ text: "Delete", icon: "delete", danger: true, onPress: remove },
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> The prop table is generated from `src/index.d.ts`; the examples use only documented props.
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| Prop | Type | Description |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| `items` | `MenuItem[]` | The actions, as `{ text, icon?, onPress?, disabled?, danger? }` records. `danger: true` writes the row in `colors.dangerStrong`. |
|
|
30
|
+
| `label` | `string` | Accessible name of the trigger and of the open menu. An icon-only trigger has no visible text, so this is the name a screen reader reads. |
|
|
31
|
+
| `icon` | `string` | Glyph drawn in the trigger. Defaults to `more_vert`, the vertical ellipsis a row menu is recognised by. |
|
|
32
|
+
| `width` | `number \| string` | Width of the open panel, in framework units. The trigger itself is a square `size` wide. |
|
|
33
|
+
| `align` | `'start' \| 'end'` | Which edge of the trigger the panel lines up with. `end` keeps a menu at the right edge of a row from hanging off the sidebar. |
|
|
34
|
+
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
35
|
+
| `portal` | `boolean` | Mount the panel on `document.body` so no ancestor's overflow can clip it. On by default; turn it off only when the trigger already lives in an unclipped stacking context. |
|
|
36
|
+
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
37
|
+
| `borderRadius` | `number` | Rounds the corners of the widget. |
|
|
38
|
+
| `size` | `number` | Side of the square trigger, in framework units. Defaults to 40 — the tap minimum — and the glyph scales with it. |
|
|
39
|
+
|
|
40
|
+
### Common props
|
|
41
|
+
|
|
42
|
+
Every widget also accepts these shared props — see [common props](COMMON_PROPS.md) for the full rules and aliases.
|
|
43
|
+
|
|
44
|
+
| Prop | Type | Description |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
47
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
48
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
49
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
50
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
51
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
52
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
53
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
54
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
55
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
56
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
57
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
58
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
59
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
60
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
61
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
62
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
63
|
+
| `width` | `Size` | Width of the open panel, in framework units. The trigger itself is a square `size` wide. |
|
|
64
|
+
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
65
|
+
| `size` | `Size` | Side of the square trigger, in framework units. Defaults to 40 — the tap minimum — and the glyph scales with it. |
|
|
66
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
67
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
68
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
69
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
70
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
71
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
72
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
73
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
74
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
75
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
76
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
77
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
78
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
79
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
80
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
81
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
82
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
83
|
+
| `fontSize` | `number` | Size of the font. |
|
|
84
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
85
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
86
|
+
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
87
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
88
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
89
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
90
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
91
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
92
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
93
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
94
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
95
|
+
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
96
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
97
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
98
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
99
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
100
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
101
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
102
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
103
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
104
|
+
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
105
|
+
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
106
|
+
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
107
|
+
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
108
|
+
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
109
|
+
| `shadow` | `string` | Raw CSS `box-shadow` value, for a custom shadow. |
|
|
110
|
+
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
111
|
+
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
112
|
+
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
113
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
114
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
115
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
116
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
117
|
+
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
118
|
+
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
119
|
+
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
120
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
121
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
122
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
123
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
124
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
125
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
126
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
127
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
128
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
129
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
130
|
+
| `id` | `string` | DOM `id` for the rendered element. |
|
|
131
|
+
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
132
|
+
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
133
|
+
| `disableTransform` | `boolean` | Disables the default press/scale transform animation. |
|
|
134
|
+
|
|
135
|
+
## Examples
|
|
136
|
+
|
|
137
|
+
### Everyday
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
import { Menu } from "flet-box";
|
|
141
|
+
|
|
142
|
+
const rowMenu = Menu({
|
|
143
|
+
label: "Project actions",
|
|
144
|
+
items: [
|
|
145
|
+
{ text: "Rename project", icon: "edit", onPress: renameProject },
|
|
146
|
+
{ text: "Delete project", icon: "delete", danger: true, onPress: deleteProject },
|
|
147
|
+
],
|
|
148
|
+
align: "end",
|
|
149
|
+
width: 220,
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Full
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
import { Menu } from "flet-box";
|
|
157
|
+
|
|
158
|
+
const menu = Menu({
|
|
159
|
+
label: "Message actions",
|
|
160
|
+
icon: "more_vert",
|
|
161
|
+
items: [
|
|
162
|
+
{ text: "Copy", icon: "content_copy", onPress: copy },
|
|
163
|
+
{ text: "Edit", icon: "edit", onPress: edit },
|
|
164
|
+
{ text: "Archive", icon: "archive", onPress: archive, disabled: true },
|
|
165
|
+
{ text: "Delete", icon: "delete", danger: true, onPress: remove },
|
|
166
|
+
],
|
|
167
|
+
size: 40,
|
|
168
|
+
width: 220,
|
|
169
|
+
align: "start",
|
|
170
|
+
portal: true,
|
|
171
|
+
bgColor: "#ffffff",
|
|
172
|
+
borderRadius: 8,
|
|
173
|
+
disabled: false,
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Tips
|
|
178
|
+
|
|
179
|
+
- Keep the items to the actions of the row it belongs to. A menu that copies the whole app navigation is a drawer with extra steps.
|
|
180
|
+
- Mark a destructive item with danger: true; the ink becomes colors.dangerStrong, the token that is readable as words.
|
|
181
|
+
- The trigger is an icon-only control, so label is not optional in practice: it is the name a screen reader reads before opening the menu.
|
|
182
|
+
|
|
183
|
+
## Accessibility
|
|
184
|
+
|
|
185
|
+
- The trigger keeps the Tab stop and reports aria-haspopup and aria-expanded; ArrowDown and ArrowUp open the panel on the first and last action.
|
|
186
|
+
- Inside the panel the arrow keys move focus between role=menuitem rows, Enter or Space runs the action, Escape closes and returns focus to the trigger, and Tab closes and moves on.
|
|
187
|
+
- The panel holds Tab while it is open through the same focus scope as the overlays, and gives focus back when it closes or unmounts.
|
|
188
|
+
|
|
189
|
+
## Behavior
|
|
190
|
+
|
|
191
|
+
- The panel is measured against the viewport: it aligns to the trigger's start or end edge and flips above the trigger when it does not fit below.
|
|
192
|
+
- Escape, a click outside the trigger and the panel, or scrolling with the menu open closes it; every listener is released on unmount.
|
|
193
|
+
- Changing items through update() rebuilds the open panel; setting disabled closes it and disables the trigger.
|
|
194
|
+
|
|
195
|
+
## Related widgets
|
|
196
|
+
|
|
197
|
+
- [Button](Button.md)
|
|
198
|
+
- [Dropdown](Dropdown.md)
|
|
199
|
+
- [ListTile](ListTile.md)
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Continue reading
|
|
204
|
+
|
|
205
|
+
- **Previous:** [Tooltip](Tooltip.md)
|
|
206
|
+
- **Next:** [ProgressBar](ProgressBar.md)
|
|
207
|
+
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
208
|
+
|
|
209
|
+
You are reading **Chapter 4 · Feedback and overlays** (6 of 11).
|
package/docs/widget/Modal.md
CHANGED
|
@@ -34,7 +34,7 @@ const dialog = Modal({
|
|
|
34
34
|
| `maxHeight` | `number \| string` | Maximum height the widget may grow to. |
|
|
35
35
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
36
36
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
37
|
-
| `border` | `string` |
|
|
37
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
38
38
|
| `borderColor` | `Color` | Color used for the border. |
|
|
39
39
|
| `borderWidth` | `number` | Width of the border. |
|
|
40
40
|
| `shadow` | `string` | Raw CSS `box-shadow` value, for a custom shadow. |
|
|
@@ -53,7 +53,7 @@ const dialog = Modal({
|
|
|
53
53
|
| `footerElevation` | `number` | Elevation (shadow depth) of the footer. |
|
|
54
54
|
| `overlayColor` | `Color` | Color of the dimmed backdrop behind the overlay. |
|
|
55
55
|
| `showCloseButton` | `boolean` | Shows a close button in the header. |
|
|
56
|
-
| `zIndex` | `number` |
|
|
56
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
57
57
|
| `onOpen` | `() => void` | Fired when the overlay opens. |
|
|
58
58
|
| `onClose` | `() => void` | Fired when the overlay closes. |
|
|
59
59
|
|
|
@@ -126,4 +126,4 @@ const settings = Modal({
|
|
|
126
126
|
- **Next:** [BottomSheet](BottomSheet.md)
|
|
127
127
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
128
128
|
|
|
129
|
-
You are reading **Chapter 4 · Feedback and overlays** (2 of
|
|
129
|
+
You are reading **Chapter 4 · Feedback and overlays** (2 of 11).
|