create-basicjs 0.1.4 → 0.1.6
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/README.md +12 -2
- package/bin/create-basicjs.js +58 -5
- package/bin/verify-package.js +1 -1
- package/package.json +2 -2
- package/payload/projects/tauri/.github/workflows/build.yml +86 -0
- package/payload/projects/tauri/.github/workflows/tests.yml +87 -0
- package/payload/projects/tauri/AGENTS.md +128 -0
- package/payload/projects/tauri/CLAUDE.md +1 -0
- package/payload/projects/tauri/LICENSE +201 -0
- package/payload/projects/tauri/NOTICE +8 -0
- package/payload/projects/tauri/README.md +269 -0
- package/payload/projects/tauri/checks/window-check.js +189 -0
- package/payload/projects/tauri/gitignore +8 -0
- package/payload/projects/tauri/handbook/01-getting-started.md +188 -0
- package/payload/projects/tauri/handbook/02-the-project.md +264 -0
- package/payload/projects/tauri/handbook/03-the-page.md +260 -0
- package/payload/projects/tauri/handbook/04-commands.md +265 -0
- package/payload/projects/tauri/handbook/05-events-and-state.md +275 -0
- package/payload/projects/tauri/handbook/06-plugins.md +282 -0
- package/payload/projects/tauri/handbook/07-the-window-and-the-app.md +431 -0
- package/payload/projects/tauri/handbook/08-security.md +374 -0
- package/payload/projects/tauri/handbook/09-tests-and-checks.md +266 -0
- package/payload/projects/tauri/handbook/10-building-and-releasing.md +238 -0
- package/payload/projects/tauri/handbook/11-troubleshooting.md +259 -0
- package/payload/projects/tauri/handbook/README.md +125 -0
- package/payload/projects/tauri/handbook/turkce/01-getting-started.md +193 -0
- package/payload/projects/tauri/handbook/turkce/02-the-project.md +272 -0
- package/payload/projects/tauri/handbook/turkce/03-the-page.md +272 -0
- package/payload/projects/tauri/handbook/turkce/04-commands.md +271 -0
- package/payload/projects/tauri/handbook/turkce/05-events-and-state.md +284 -0
- package/payload/projects/tauri/handbook/turkce/06-plugins.md +286 -0
- package/payload/projects/tauri/handbook/turkce/07-the-window-and-the-app.md +433 -0
- package/payload/projects/tauri/handbook/turkce/08-security.md +384 -0
- package/payload/projects/tauri/handbook/turkce/09-tests-and-checks.md +275 -0
- package/payload/projects/tauri/handbook/turkce/10-building-and-releasing.md +241 -0
- package/payload/projects/tauri/handbook/turkce/11-troubleshooting.md +264 -0
- package/payload/projects/tauri/handbook/turkce/README.md +128 -0
- package/payload/projects/tauri/images/app.png +0 -0
- package/payload/projects/tauri/src-tauri/Cargo.lock +4389 -0
- package/payload/projects/tauri/src-tauri/Cargo.toml +31 -0
- package/payload/projects/tauri/src-tauri/app-icon.svg +16 -0
- package/payload/projects/tauri/src-tauri/build.rs +15 -0
- package/payload/projects/tauri/src-tauri/capabilities/default.json +7 -0
- package/payload/projects/tauri/src-tauri/gitignore +5 -0
- package/payload/projects/tauri/src-tauri/icons/128x128.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/128x128@2x.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/32x32.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/icon.icns +0 -0
- package/payload/projects/tauri/src-tauri/icons/icon.ico +0 -0
- package/payload/projects/tauri/src-tauri/src/check.rs +144 -0
- package/payload/projects/tauri/src-tauri/src/files.rs +255 -0
- package/payload/projects/tauri/src-tauri/src/main.rs +45 -0
- package/payload/projects/tauri/src-tauri/src/sizes.rs +214 -0
- package/payload/projects/tauri/src-tauri/tauri.conf.json +44 -0
- package/payload/projects/tauri/src-tauri/tests/project.rs +243 -0
- package/payload/projects/tauri/ui/app.js +459 -0
- package/payload/projects/tauri/ui/backend.js +196 -0
- package/payload/projects/tauri/ui/basic/LICENSE +14 -0
- package/payload/projects/tauri/ui/basic/basic.min.css +1 -0
- package/payload/projects/tauri/ui/basic/basic.min.js +78 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/LICENSE.txt +206 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
- package/payload/projects/tauri/ui/basic/scroll-bar.min.js +3 -0
- package/payload/projects/tauri/ui/comp/_sources.txt +9 -0
- package/payload/projects/tauri/ui/comp/components.min.js +21 -0
- package/payload/projects/tauri/ui/index.html +28 -0
- package/payload/projects/tauri/ui/sizes.js +104 -0
- package/payload/starter/AGENTS.md +11 -6
- package/payload/starter/README.md +1 -1
- package/payload/starter/_basic/VERSION +1 -1
- package/payload/starter/_basic/assets/cards/almond-blossom.png +0 -0
- package/payload/starter/_basic/assets/cards/blackberry.png +0 -0
- package/payload/starter/_basic/assets/cards/borage.png +0 -0
- package/payload/starter/_basic/assets/cards/chamomile.png +0 -0
- package/payload/starter/_basic/assets/cards/dill.png +0 -0
- package/payload/starter/_basic/assets/cards/eucalyptus.png +0 -0
- package/payload/starter/_basic/assets/cards/fennel.png +0 -0
- package/payload/starter/_basic/assets/cards/fig.png +0 -0
- package/payload/starter/_basic/assets/cards/juniper.png +0 -0
- package/payload/starter/_basic/assets/cards/lavender.png +0 -0
- package/payload/starter/_basic/assets/cards/lemon.png +0 -0
- package/payload/starter/_basic/assets/cards/olives.png +0 -0
- package/payload/starter/_basic/assets/cards/oregano.png +0 -0
- package/payload/starter/_basic/assets/cards/pepper.png +0 -0
- package/payload/starter/_basic/assets/cards/physalis.png +0 -0
- package/payload/starter/_basic/assets/cards/pomegranate.png +0 -0
- package/payload/starter/_basic/assets/cards/poppy.png +0 -0
- package/payload/starter/_basic/assets/cards/rosehip.png +0 -0
- package/payload/starter/_basic/assets/cards/saffron.png +0 -0
- package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
- package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
- package/payload/starter/_basic/assets/categories/coffee.png +0 -0
- package/payload/starter/_basic/assets/categories/frappe.png +0 -0
- package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
- package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
- package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
- package/payload/starter/_basic/assets/categories/tea.png +0 -0
- package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
- package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
- package/payload/starter/_basic/assets/fruids/domates.png +0 -0
- package/payload/starter/_basic/assets/fruids/elma.png +0 -0
- package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
- package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
- package/payload/starter/_basic/assets/fruids/limon.png +0 -0
- package/payload/starter/_basic/assets/fruids/muz.png +0 -0
- package/payload/starter/_basic/assets/fruids/nar.png +0 -0
- package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
- package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
- package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
- package/payload/starter/_basic/basic/LICENSE +1 -1
- package/payload/starter/_basic/basic/basic.css +3 -6
- package/payload/starter/_basic/basic/basic.js +154 -60
- package/payload/starter/_basic/basic/basic.min.js +19 -6
- package/payload/starter/_basic/basic/scroll-bar.js +4 -2
- package/payload/starter/_basic/basic/scroll-bar.min.js +1 -0
- package/payload/starter/_basic/comp/accordion.js +659 -0
- package/payload/starter/_basic/comp/action-button.js +22 -23
- package/payload/starter/_basic/comp/action-tab-bar.js +8 -8
- package/payload/starter/_basic/comp/app-bar.js +12 -11
- package/payload/starter/_basic/comp/{badge-v2.js → badge.js} +51 -5
- package/payload/starter/_basic/comp/bottom-bar.js +62 -26
- package/payload/starter/_basic/comp/breadcrumbs.js +4 -2
- package/payload/starter/_basic/comp/canvas.js +652 -0
- package/payload/starter/_basic/comp/chat-view.js +827 -0
- package/payload/starter/_basic/comp/check-box.js +137 -21
- package/payload/starter/_basic/comp/code-editor.js +1171 -0
- package/payload/starter/_basic/comp/{select-color.js → color-picker.js} +62 -29
- package/payload/starter/_basic/comp/context-menu.js +348 -31
- package/payload/starter/_basic/comp/{currency-input-b.js → currency-field.js} +48 -29
- package/payload/starter/_basic/comp/data-table.js +114 -42
- package/payload/starter/_basic/comp/{select-date.js → date-picker.js} +104 -52
- package/payload/starter/_basic/comp/dialog.js +214 -76
- package/payload/starter/_basic/comp/email-field.js +65 -0
- package/payload/starter/_basic/comp/{select-file.js → file-picker.js} +245 -57
- package/payload/starter/_basic/comp/filters.js +374 -60
- package/payload/starter/_basic/comp/form.js +38 -26
- package/payload/starter/_basic/comp/full-screen-select.js +36 -33
- package/payload/starter/_basic/comp/gauge.js +12 -8
- package/payload/starter/_basic/comp/graph-box.js +3911 -0
- package/payload/starter/_basic/comp/grid-group.js +185 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button.js +16 -7
- package/payload/starter/_basic/comp/image-view.js +598 -0
- package/payload/starter/_basic/comp/item-list.js +507 -163
- package/payload/starter/_basic/comp/json-editor.js +3221 -0
- package/payload/starter/_basic/comp/json-view.js +597 -0
- package/payload/starter/_basic/comp/label-editor.js +22 -19
- package/payload/starter/_basic/comp/left-menu.js +89 -22
- package/payload/starter/_basic/comp/line-progress-bar.js +196 -45
- package/payload/starter/_basic/comp/loading-screen.js +49 -18
- package/payload/starter/_basic/comp/log-view.js +530 -0
- package/payload/starter/_basic/comp/{login-page-v2.js → login-page.js} +205 -106
- package/payload/starter/_basic/comp/markdown-view.js +1046 -0
- package/payload/starter/_basic/comp/menu-bar.js +624 -0
- package/payload/starter/_basic/comp/mini-graph-box.js +20 -11
- package/payload/starter/_basic/comp/minimal-accent.js +208 -0
- package/payload/starter/_basic/comp/notice.js +15 -13
- package/payload/starter/_basic/comp/{number-input-b.js → number-field.js} +26 -19
- package/payload/starter/_basic/comp/numeric-keyboard.js +15 -13
- package/payload/starter/_basic/comp/page-control.js +21 -4
- package/payload/starter/_basic/comp/page-header.js +7 -6
- package/payload/starter/_basic/comp/password-field.js +192 -0
- package/payload/starter/_basic/comp/period-bar.js +8 -7
- package/payload/starter/_basic/comp/{phone-input-b.js → phone-field.js} +80 -45
- package/payload/starter/_basic/comp/progress-bar.js +401 -85
- package/payload/starter/_basic/comp/property-panel.js +1022 -123
- package/payload/starter/_basic/comp/radio-button.js +79 -19
- package/payload/starter/_basic/comp/range-slider.js +569 -0
- package/payload/starter/_basic/comp/rich-text-editor.js +33 -30
- package/payload/starter/_basic/comp/scroll-area.js +308 -0
- package/payload/starter/_basic/comp/scrolling-text.js +10 -9
- package/payload/starter/_basic/comp/search-input.js +725 -0
- package/payload/starter/_basic/comp/search-results.js +60 -24
- package/payload/starter/_basic/comp/select-box.js +229 -107
- package/payload/starter/_basic/comp/settings-row.js +20 -19
- package/payload/starter/_basic/comp/side-panel.js +53 -10
- package/payload/starter/_basic/comp/slider-field.js +264 -88
- package/payload/starter/_basic/comp/slider.js +556 -86
- package/payload/starter/_basic/comp/smart-button.js +438 -353
- package/payload/starter/_basic/comp/smart-table.js +748 -186
- package/payload/starter/_basic/comp/sortable-list.js +47 -38
- package/payload/starter/_basic/comp/spark-line-box.js +25 -16
- package/payload/starter/_basic/comp/splitter.js +411 -0
- package/payload/starter/_basic/comp/status-bar.js +408 -0
- package/payload/starter/_basic/comp/step-bar.js +345 -0
- package/payload/starter/_basic/comp/stepper.js +103 -49
- package/payload/starter/_basic/comp/tabs.js +67 -18
- package/payload/starter/_basic/comp/tag-input.js +50 -10
- package/payload/starter/_basic/comp/tap-effect.js +6 -4
- package/payload/starter/_basic/comp/text-area-field.js +233 -0
- package/payload/starter/_basic/comp/text-field.js +1006 -0
- package/payload/starter/_basic/comp/time-line.js +102 -28
- package/payload/starter/_basic/comp/{select-time.js → time-picker.js} +104 -51
- package/payload/starter/_basic/comp/tiny-select.js +79 -39
- package/payload/starter/_basic/comp/tiny-table.js +12 -8
- package/payload/starter/_basic/comp/toast.js +87 -34
- package/payload/starter/_basic/comp/toggle.js +149 -28
- package/payload/starter/_basic/comp/tool-bar.js +760 -0
- package/payload/starter/_basic/comp/tooltip.js +80 -17
- package/payload/starter/_basic/comp/tree-view.js +124 -41
- package/payload/starter/_basic/comp/ui-effects.js +17 -11
- package/payload/starter/_basic/comp/ui-standards.js +5 -4
- package/payload/starter/_basic/comp/url-field.js +190 -0
- package/payload/starter/_basic/comp/web-view.js +70 -16
- package/payload/starter/_basic/docs/basic-js-animated-rules.md +15 -9
- package/payload/starter/_basic/docs/basic-js-code-rules.md +42 -5
- package/payload/starter/_basic/docs/basic-js-components.md +12 -17
- package/payload/starter/_basic/docs/basic-js-core.md +5 -4
- package/payload/starter/_basic/docs/component-index.md +248 -107
- package/payload/starter/_basic/docs/component-template.js +28 -24
- package/payload/starter/_basic/docs/handbook/00-introduction.md +6 -2
- package/payload/starter/_basic/docs/handbook/00-what-is-new.md +21 -0
- package/payload/starter/_basic/docs/handbook/01-label.md +4 -4
- package/payload/starter/_basic/docs/handbook/02-box.md +7 -7
- package/payload/starter/_basic/docs/handbook/03-image.md +4 -4
- package/payload/starter/_basic/docs/handbook/04-common-properties.md +6 -5
- package/payload/starter/_basic/docs/handbook/05-autolayout.md +8 -7
- package/payload/starter/_basic/docs/handbook/06-button.md +3 -3
- package/payload/starter/_basic/docs/handbook/07-input.md +3 -3
- package/payload/starter/_basic/docs/handbook/08-page.md +3 -3
- package/payload/starter/_basic/docs/handbook/09-useful-examples.md +39 -58
- package/payload/starter/_basic/docs/handbook/10-motion.md +6 -6
- package/payload/starter/_basic/docs/handbook/11-other-functions.md +1 -0
- package/payload/starter/_basic/docs/handbook/13-sound.md +3 -3
- package/payload/starter/_basic/docs/handbook/14-using-components.md +180 -0
- package/payload/starter/_basic/docs/handbook/15-making-a-component.md +338 -0
- package/payload/starter/_basic/docs/what-is-new.md +106 -0
- package/payload/starter/_basic/examples/accordion.htm +174 -0
- package/payload/starter/_basic/examples/action-button.htm +74 -32
- package/payload/starter/_basic/examples/action-tab-bar.htm +5 -6
- package/payload/starter/_basic/examples/app-bar.htm +63 -41
- package/payload/starter/_basic/examples/badge.htm +96 -0
- package/payload/starter/_basic/examples/bottom-bar-2.htm +61 -48
- package/payload/starter/_basic/examples/bottom-bar.htm +74 -16
- package/payload/starter/_basic/examples/breadcrumbs.htm +160 -150
- package/payload/starter/_basic/examples/canvas.htm +190 -0
- package/payload/starter/_basic/examples/chat-view.htm +143 -0
- package/payload/starter/_basic/examples/check-box-2.htm +71 -82
- package/payload/starter/_basic/examples/check-box-3.htm +72 -83
- package/payload/starter/_basic/examples/check-box.htm +207 -0
- package/payload/starter/_basic/examples/code-editor-2.htm +259 -0
- package/payload/starter/_basic/examples/code-editor.htm +272 -0
- package/payload/starter/_basic/examples/color-picker.htm +206 -0
- package/payload/starter/_basic/examples/context-menu.htm +180 -139
- package/payload/starter/_basic/examples/currency-field.htm +105 -0
- package/payload/starter/_basic/examples/data-table-2.htm +2 -1
- package/payload/starter/_basic/examples/data-table-3.htm +1 -1
- package/payload/starter/_basic/examples/data-table-4.htm +15 -12
- package/payload/starter/_basic/examples/data-table-5.htm +11 -3
- package/payload/starter/_basic/examples/data-table.htm +90 -40
- package/payload/starter/_basic/examples/date-picker.htm +239 -0
- package/payload/starter/_basic/examples/dialog-centered.htm +394 -40
- package/payload/starter/_basic/examples/dialog.htm +267 -46
- package/payload/starter/_basic/examples/email-field.htm +102 -0
- package/payload/starter/_basic/examples/file-picker.htm +296 -0
- package/payload/starter/_basic/examples/filters.htm +33 -22
- package/payload/starter/_basic/examples/{form-1.htm → form.htm} +18 -19
- package/payload/starter/_basic/examples/full-screen-select.htm +81 -58
- package/payload/starter/_basic/examples/gallery-styled.htm +896 -0
- package/payload/starter/_basic/examples/gauge.htm +95 -81
- package/payload/starter/_basic/examples/graph-box.htm +365 -0
- package/payload/starter/_basic/examples/grid-group.htm +179 -0
- package/payload/starter/_basic/examples/hold-to-confirm-button.htm +102 -113
- package/payload/starter/_basic/examples/image-view.htm +195 -0
- package/payload/starter/_basic/examples/item-list-2.htm +138 -94
- package/payload/starter/_basic/examples/item-list.htm +191 -86
- package/payload/starter/_basic/examples/json-editor.htm +206 -0
- package/payload/starter/_basic/examples/json-view.htm +153 -0
- package/payload/starter/_basic/examples/label-editor.htm +85 -89
- package/payload/starter/_basic/examples/left-menu-2.htm +93 -0
- package/payload/starter/_basic/examples/left-menu.htm +42 -37
- package/payload/starter/_basic/examples/line-progress-bar.htm +155 -114
- package/payload/starter/_basic/examples/loading-screen.htm +149 -125
- package/payload/starter/_basic/examples/log-view.htm +175 -0
- package/payload/starter/_basic/examples/{login-page-dark-v2.htm → login-page-dark.htm} +265 -267
- package/payload/starter/_basic/examples/{login-page-v2.htm → login-page.htm} +266 -267
- package/payload/starter/_basic/examples/markdown-view.htm +220 -0
- package/payload/starter/_basic/examples/menu-bar-2.htm +225 -0
- package/payload/starter/_basic/examples/menu-bar.htm +145 -0
- package/payload/starter/_basic/examples/mini-graph-box.htm +98 -109
- package/payload/starter/_basic/examples/minimal-accent.htm +196 -0
- package/payload/starter/_basic/examples/minimal-theme.htm +432 -0
- package/payload/starter/_basic/examples/notice.htm +13 -4
- package/payload/starter/_basic/examples/number-field.htm +103 -0
- package/payload/starter/_basic/examples/numeric-keyboard.htm +44 -42
- package/payload/starter/_basic/examples/page-control.htm +181 -130
- package/payload/starter/_basic/examples/page-header.htm +57 -30
- package/payload/starter/_basic/examples/password-field.htm +117 -0
- package/payload/starter/_basic/examples/period-bar.htm +43 -29
- package/payload/starter/_basic/examples/phone-field-select-country.htm +292 -0
- package/payload/starter/_basic/examples/phone-field.htm +104 -0
- package/payload/starter/_basic/examples/progress-bar-ozden.htm +229 -92
- package/payload/starter/_basic/examples/progress-bar.htm +222 -174
- package/payload/starter/_basic/examples/property-panel.htm +152 -52
- package/payload/starter/_basic/examples/radio-button-2.htm +101 -109
- package/payload/starter/_basic/examples/radio-button-3.htm +81 -71
- package/payload/starter/_basic/examples/radio-button.htm +289 -0
- package/payload/starter/_basic/examples/range-slider.htm +171 -0
- package/payload/starter/_basic/examples/rich-text-editor.htm +115 -110
- package/payload/starter/_basic/examples/scroll-area.htm +293 -0
- package/payload/starter/_basic/examples/scrolling-text.htm +27 -6
- package/payload/starter/_basic/examples/search-input-2-light.htm +112 -0
- package/payload/starter/_basic/examples/search-input-3-dark.htm +105 -0
- package/payload/starter/_basic/examples/{search-input-v2-place.htm → search-input-place.htm} +25 -26
- package/payload/starter/_basic/examples/search-input.htm +159 -0
- package/payload/starter/_basic/examples/search-results.htm +85 -88
- package/payload/starter/_basic/examples/select-box-2-item-view.htm +304 -0
- package/payload/starter/_basic/examples/select-box-ozden-dark-text.htm +70 -0
- package/payload/starter/_basic/examples/select-box-ozden-item.htm +6 -5
- package/payload/starter/_basic/examples/select-box-ozden-text.htm +5 -3
- package/payload/starter/_basic/examples/select-box.htm +190 -159
- package/payload/starter/_basic/examples/settings-row.htm +92 -43
- package/payload/starter/_basic/examples/side-panel-2.htm +63 -25
- package/payload/starter/_basic/examples/side-panel.htm +84 -70
- package/payload/starter/_basic/examples/slider-2-split.htm +186 -0
- package/payload/starter/_basic/examples/slider-field-ozden.htm +286 -0
- package/payload/starter/_basic/examples/slider-field.htm +174 -134
- package/payload/starter/_basic/examples/slider.htm +257 -180
- package/payload/starter/_basic/examples/smart-button-3-ozden.htm +170 -257
- package/payload/starter/_basic/examples/smart-button-4-dark.htm +86 -47
- package/payload/starter/_basic/examples/smart-button-5-features.htm +130 -125
- package/payload/starter/_basic/examples/smart-button-alternatif.htm +266 -0
- package/payload/starter/_basic/examples/smart-button.htm +207 -174
- package/payload/starter/_basic/examples/smart-table-2.htm +43 -56
- package/payload/starter/_basic/examples/smart-table-3.htm +148 -113
- package/payload/starter/_basic/examples/smart-table-4.htm +37 -50
- package/payload/starter/_basic/examples/{smart-table-1.htm → smart-table-5.htm} +37 -48
- package/payload/starter/_basic/examples/smart-table.htm +183 -0
- package/payload/starter/_basic/examples/sortable-list.htm +191 -142
- package/payload/starter/_basic/examples/spark-line-box.htm +149 -161
- package/payload/starter/_basic/examples/splitter.htm +164 -0
- package/payload/starter/_basic/examples/status-bar.htm +166 -0
- package/payload/starter/_basic/examples/step-bar.htm +129 -0
- package/payload/starter/_basic/examples/stepper-2.htm +86 -58
- package/payload/starter/_basic/examples/stepper.htm +146 -135
- package/payload/starter/_basic/examples/tabs-2.htm +58 -67
- package/payload/starter/_basic/examples/tabs.htm +197 -180
- package/payload/starter/_basic/examples/tag-input.htm +150 -153
- package/payload/starter/_basic/examples/tap-effect.htm +23 -19
- package/payload/starter/_basic/examples/text-area-field.htm +104 -0
- package/payload/starter/_basic/examples/text-field-2.htm +113 -0
- package/payload/starter/_basic/examples/text-field-3-style.htm +105 -0
- package/payload/starter/_basic/examples/text-field-4-custom-unit.htm +96 -0
- package/payload/starter/_basic/examples/{input-b-ex5-warning-icon.htm → text-field-5-warning-icon.htm} +19 -19
- package/payload/starter/_basic/examples/text-field-6-modern-dark.htm +114 -0
- package/payload/starter/_basic/examples/text-field-7-modern.htm +106 -0
- package/payload/starter/_basic/examples/text-field-8-light-dark.htm +159 -0
- package/payload/starter/_basic/examples/text-field.htm +163 -0
- package/payload/starter/_basic/examples/time-line.htm +180 -116
- package/payload/starter/_basic/examples/time-picker.htm +240 -0
- package/payload/starter/_basic/examples/tiny-select.htm +118 -86
- package/payload/starter/_basic/examples/tiny-table.htm +40 -34
- package/payload/starter/_basic/examples/toast.htm +145 -147
- package/payload/starter/_basic/examples/toggle-2.htm +99 -68
- package/payload/starter/_basic/examples/toggle-3.htm +104 -101
- package/payload/starter/_basic/examples/toggle.htm +161 -93
- package/payload/starter/_basic/examples/tool-bar.htm +172 -0
- package/payload/starter/_basic/examples/tooltip-2.htm +110 -60
- package/payload/starter/_basic/examples/tooltip-3.htm +124 -65
- package/payload/starter/_basic/examples/tooltip-4.htm +218 -0
- package/payload/starter/_basic/examples/tooltip.htm +206 -124
- package/payload/starter/_basic/examples/tree-view.htm +210 -182
- package/payload/starter/_basic/examples/ui-effects.htm +207 -185
- package/payload/starter/_basic/examples/ui-standards.htm +200 -139
- package/payload/starter/_basic/examples/url-field.htm +120 -0
- package/payload/starter/_basic/examples/web-view.htm +109 -110
- package/payload/starter/_basic/min/accordion.min.js +2 -0
- package/payload/starter/_basic/min/action-button.min.js +1 -1
- package/payload/starter/_basic/min/app-bar.min.js +1 -1
- package/payload/starter/_basic/min/badge.min.js +2 -0
- package/payload/starter/_basic/min/bottom-bar.min.js +1 -1
- package/payload/starter/_basic/min/canvas.min.js +2 -0
- package/payload/starter/_basic/min/chat-view.min.js +2 -0
- package/payload/starter/_basic/min/check-box.min.js +1 -1
- package/payload/starter/_basic/min/code-editor.min.js +2 -0
- package/payload/starter/_basic/min/color-picker.min.js +2 -0
- package/payload/starter/_basic/min/context-menu.min.js +1 -1
- package/payload/starter/_basic/min/currency-field.min.js +2 -0
- package/payload/starter/_basic/min/data-table.min.js +1 -1
- package/payload/starter/_basic/min/date-picker.min.js +2 -0
- package/payload/starter/_basic/min/dialog.min.js +1 -1
- package/payload/starter/_basic/min/email-field.min.js +2 -0
- package/payload/starter/_basic/min/file-picker.min.js +2 -0
- package/payload/starter/_basic/min/filters.min.js +1 -1
- package/payload/starter/_basic/min/form.min.js +1 -1
- package/payload/starter/_basic/min/full-screen-select.min.js +1 -1
- package/payload/starter/_basic/min/gauge.min.js +1 -1
- package/payload/starter/_basic/min/graph-box.min.js +2 -0
- package/payload/starter/_basic/min/grid-group.min.js +2 -0
- package/payload/starter/_basic/min/hold-to-confirm-button.min.js +1 -1
- package/payload/starter/_basic/min/image-view.min.js +2 -0
- package/payload/starter/_basic/min/item-list.min.js +1 -1
- package/payload/starter/_basic/min/json-editor.min.js +2 -0
- package/payload/starter/_basic/min/json-view.min.js +2 -0
- package/payload/starter/_basic/min/label-editor.min.js +1 -1
- package/payload/starter/_basic/min/left-menu.min.js +1 -1
- package/payload/starter/_basic/min/line-progress-bar.min.js +1 -1
- package/payload/starter/_basic/min/loading-screen.min.js +1 -1
- package/payload/starter/_basic/min/log-view.min.js +2 -0
- package/payload/starter/_basic/min/login-page.min.js +2 -0
- package/payload/starter/_basic/min/markdown-view.min.js +2 -0
- package/payload/starter/_basic/min/menu-bar.min.js +2 -0
- package/payload/starter/_basic/min/mini-graph-box.min.js +1 -1
- package/payload/starter/_basic/min/minimal-accent.min.js +2 -0
- package/payload/starter/_basic/min/notice.min.js +1 -1
- package/payload/starter/_basic/min/number-field.min.js +2 -0
- package/payload/starter/_basic/min/numeric-keyboard.min.js +1 -1
- package/payload/starter/_basic/min/page-control.min.js +1 -1
- package/payload/starter/_basic/min/password-field.min.js +2 -0
- package/payload/starter/_basic/min/phone-field.min.js +2 -0
- package/payload/starter/_basic/min/progress-bar.min.js +1 -1
- package/payload/starter/_basic/min/property-panel.min.js +1 -1
- package/payload/starter/_basic/min/radio-button.min.js +1 -1
- package/payload/starter/_basic/min/range-slider.min.js +2 -0
- package/payload/starter/_basic/min/rich-text-editor.min.js +1 -1
- package/payload/starter/_basic/min/scroll-area.min.js +2 -0
- package/payload/starter/_basic/min/scrolling-text.min.js +1 -1
- package/payload/starter/_basic/min/search-input.min.js +2 -0
- package/payload/starter/_basic/min/search-results.min.js +1 -1
- package/payload/starter/_basic/min/select-box.min.js +1 -1
- package/payload/starter/_basic/min/settings-row.min.js +1 -1
- package/payload/starter/_basic/min/side-panel.min.js +1 -1
- package/payload/starter/_basic/min/slider-field.min.js +1 -1
- package/payload/starter/_basic/min/slider.min.js +1 -1
- package/payload/starter/_basic/min/smart-button.min.js +1 -1
- package/payload/starter/_basic/min/smart-table.min.js +1 -1
- package/payload/starter/_basic/min/sortable-list.min.js +1 -1
- package/payload/starter/_basic/min/spark-line-box.min.js +1 -1
- package/payload/starter/_basic/min/splitter.min.js +2 -0
- package/payload/starter/_basic/min/status-bar.min.js +2 -0
- package/payload/starter/_basic/min/step-bar.min.js +2 -0
- package/payload/starter/_basic/min/stepper.min.js +1 -1
- package/payload/starter/_basic/min/tabs.min.js +1 -1
- package/payload/starter/_basic/min/tag-input.min.js +1 -1
- package/payload/starter/_basic/min/text-area-field.min.js +2 -0
- package/payload/starter/_basic/min/text-field.min.js +2 -0
- package/payload/starter/_basic/min/time-line.min.js +1 -1
- package/payload/starter/_basic/min/time-picker.min.js +2 -0
- package/payload/starter/_basic/min/tiny-select.min.js +1 -1
- package/payload/starter/_basic/min/toast.min.js +1 -1
- package/payload/starter/_basic/min/toggle.min.js +1 -1
- package/payload/starter/_basic/min/tool-bar.min.js +2 -0
- package/payload/starter/_basic/min/tooltip.min.js +1 -1
- package/payload/starter/_basic/min/tree-view.min.js +1 -1
- package/payload/starter/_basic/min/ui-effects.min.js +1 -1
- package/payload/starter/_basic/min/url-field.min.js +2 -0
- package/payload/starter/_basic/min/web-view.min.js +1 -1
- package/payload/templates/booking/app/app.js +11 -8
- package/payload/templates/booking/app/settings.js +4 -4
- package/payload/templates/booking/index.htm +3 -3
- package/payload/templates/booking/pages/account.js +6 -6
- package/payload/templates/booking/pages/book.js +1 -1
- package/payload/templates/booking/pages/services.js +5 -4
- package/payload/templates/classic/app/app.js +15 -11
- package/payload/templates/classic/app/settings.js +22 -20
- package/payload/templates/classic/assets/_attribute.txt +2 -0
- package/payload/templates/classic/assets/cards/dill.png +0 -0
- package/payload/templates/classic/assets/cards/fennel.png +0 -0
- package/payload/templates/classic/assets/cards/juniper.png +0 -0
- package/payload/templates/classic/assets/cards/olives.png +0 -0
- package/payload/templates/classic/assets/cards/oregano.png +0 -0
- package/payload/templates/classic/assets/cards/pepper.png +0 -0
- package/payload/templates/classic/assets/cards/rosehip.png +0 -0
- package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
- package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
- package/payload/templates/classic/assets/categories/coffee.png +0 -0
- package/payload/templates/classic/assets/categories/frappe.png +0 -0
- package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
- package/payload/templates/classic/assets/categories/milkshake.png +0 -0
- package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
- package/payload/templates/classic/assets/categories/tea.png +0 -0
- package/payload/templates/classic/index.htm +2 -2
- package/payload/templates/classic/pages/example.js +10 -10
- package/payload/templates/classic/pages/examples.js +44 -43
- package/payload/templates/classic/pages/home.js +16 -15
- package/payload/templates/classic/pages/info-pages.js +5 -5
- package/payload/templates/classic/pages/search.js +8 -7
- package/payload/templates/classic/pages/settings.js +13 -13
- package/payload/templates/classic/pages/tasks.js +1 -0
- package/payload/templates/classic/pages/template-pages.js +12 -11
- package/payload/templates/coffee-shop/app/app.js +12 -8
- package/payload/templates/coffee-shop/app/settings.js +4 -4
- package/payload/templates/coffee-shop/index.htm +3 -3
- package/payload/templates/coffee-shop/pages/drink.js +1 -1
- package/payload/templates/coffee-shop/pages/menu.js +5 -4
- package/payload/templates/forms/TEMPLATE.md +1 -1
- package/payload/templates/forms/appointment-form.htm +55 -53
- package/payload/templates/forms/contact-form-to-mail.htm +38 -37
- package/payload/templates/forms/contact-form-to-supabase.htm +47 -46
- package/payload/templates/forms/dark-contact-form.htm +43 -40
- package/payload/templates/forms/event-registration-form.htm +80 -77
- package/payload/templates/forms/feedback-form.htm +54 -54
- package/payload/templates/forms/order-form.htm +88 -84
- package/payload/templates/forms/recruitment-form.htm +60 -60
- package/payload/templates/forms/service/readme.md +9 -8
- package/payload/templates/forms/service/send-form-mail.php +38 -21
- package/payload/templates/forms/support-ticket-form.htm +67 -65
- package/payload/templates/panel/common/module-page.js +2 -2
- package/payload/templates/panel/common/theme.js +37 -10
- package/payload/templates/panel/common/top-bar.js +45 -40
- package/payload/templates/panel/index.htm +59 -60
- package/payload/templates/panel/module10/greenhouse.htm +98 -113
- package/payload/templates/panel/module11/arduino-projects.htm +47 -58
- package/payload/templates/panel/module6/energy-hub.htm +71 -103
- package/payload/templates/panel/module7/3d-printers.htm +58 -81
- package/payload/templates/panel/module8/cold-rooms.htm +58 -79
- package/payload/templates/panel/module9/elevator-fleet.htm +72 -93
- package/payload/templates/panel/pages/activity.js +134 -152
- package/payload/templates/panel/pages/contents.js +291 -308
- package/payload/templates/panel/pages/customers.js +250 -267
- package/payload/templates/panel/pages/edit-user.js +31 -30
- package/payload/templates/panel/pages/home.js +39 -70
- package/payload/templates/panel/pages/media.js +166 -183
- package/payload/templates/panel/pages/notifications.js +7 -7
- package/payload/templates/panel/pages/orders.js +200 -217
- package/payload/templates/panel/pages/products.js +259 -278
- package/payload/templates/panel/pages/reports.js +74 -123
- package/payload/templates/panel/pages/roles.js +57 -60
- package/payload/templates/panel/pages/settings.js +127 -143
- package/payload/templates/panel/pages/user-actions.js +106 -110
- package/payload/templates/panel/pages/user-list.js +221 -238
- package/payload/templates/panel/pages/users.js +14 -29
- package/payload/templates/shop/TEMPLATE.md +1 -1
- package/payload/templates/shop/app/app.js +11 -8
- package/payload/templates/shop/app/settings.js +4 -4
- package/payload/templates/shop/index.htm +3 -3
- package/payload/templates/shop/pages/account.js +7 -7
- package/payload/templates/shop/pages/cart.js +1 -1
- package/payload/templates/shop/pages/checkout.js +2 -2
- package/payload/templates/shop/pages/product.js +2 -2
- package/payload/templates/shop/pages/shop.js +6 -5
- package/payload/templates/starter/TEMPLATE.md +1 -1
- package/payload/templates/starter/app/app.js +12 -8
- package/payload/templates/starter/app/settings.js +14 -11
- package/payload/templates/starter/index.htm +3 -3
- package/payload/templates/starter/pages/about.js +1 -1
- package/payload/templates/starter/pages/home.js +2 -2
- package/payload/templates/starter/pages/product.js +1 -1
- package/payload/templates/starter/pages/products.js +5 -5
- package/payload/templates/starter/pages/settings.js +1 -1
- package/payload/templates/starter/pages/tasks.js +8 -8
- package/payload/templates/starter/pages/website.js +1 -1
- package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +0 -13
- package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +0 -9
- package/payload/starter/_basic/comp/chart-box.js +0 -868
- package/payload/starter/_basic/comp/email-input-b.js +0 -57
- package/payload/starter/_basic/comp/input-b.js +0 -759
- package/payload/starter/_basic/comp/password-input-b.js +0 -164
- package/payload/starter/_basic/comp/search-input-v2.js +0 -427
- package/payload/starter/_basic/comp/textarea-b.js +0 -184
- package/payload/starter/_basic/comp/url-input-b.js +0 -145
- package/payload/starter/_basic/examples/badgeV2.htm +0 -68
- package/payload/starter/_basic/examples/chart-box.htm +0 -287
- package/payload/starter/_basic/examples/check-box-1.htm +0 -220
- package/payload/starter/_basic/examples/currency-input-b.htm +0 -71
- package/payload/starter/_basic/examples/email-input-b.htm +0 -67
- package/payload/starter/_basic/examples/input-b-ex1.htm +0 -132
- package/payload/starter/_basic/examples/input-b-ex2.htm +0 -136
- package/payload/starter/_basic/examples/input-b-ex3-style.htm +0 -113
- package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +0 -112
- package/payload/starter/_basic/examples/input-b-ex6-dark.htm +0 -108
- package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +0 -153
- package/payload/starter/_basic/examples/number-input-b.htm +0 -68
- package/payload/starter/_basic/examples/password-input-b.htm +0 -70
- package/payload/starter/_basic/examples/phone-input-b-select-country.htm +0 -298
- package/payload/starter/_basic/examples/phone-input-b.htm +0 -72
- package/payload/starter/_basic/examples/radio-button-1.htm +0 -264
- package/payload/starter/_basic/examples/search-input-v2-ozden.htm +0 -128
- package/payload/starter/_basic/examples/search-input-v2.htm +0 -65
- package/payload/starter/_basic/examples/select-color.htm +0 -215
- package/payload/starter/_basic/examples/select-date.htm +0 -244
- package/payload/starter/_basic/examples/select-file.htm +0 -268
- package/payload/starter/_basic/examples/select-time.htm +0 -249
- package/payload/starter/_basic/examples/smart-button-2.htm +0 -220
- package/payload/starter/_basic/examples/textarea-b.htm +0 -76
- package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +0 -221
- package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +0 -221
- package/payload/starter/_basic/examples/url-input-b.htm +0 -85
- package/payload/starter/_basic/min/badge-v2.min.js +0 -2
- package/payload/starter/_basic/min/chart-box.min.js +0 -2
- package/payload/starter/_basic/min/currency-input-b.min.js +0 -2
- package/payload/starter/_basic/min/email-input-b.min.js +0 -2
- package/payload/starter/_basic/min/input-b.min.js +0 -2
- package/payload/starter/_basic/min/login-page-v2.min.js +0 -2
- package/payload/starter/_basic/min/number-input-b.min.js +0 -2
- package/payload/starter/_basic/min/password-input-b.min.js +0 -2
- package/payload/starter/_basic/min/phone-input-b.min.js +0 -2
- package/payload/starter/_basic/min/search-input-v2.min.js +0 -2
- package/payload/starter/_basic/min/select-color.min.js +0 -2
- package/payload/starter/_basic/min/select-date.min.js +0 -2
- package/payload/starter/_basic/min/select-file.min.js +0 -2
- package/payload/starter/_basic/min/select-time.min.js +0 -2
- package/payload/starter/_basic/min/textarea-b.min.js +0 -2
- package/payload/starter/_basic/min/url-input-b.min.js +0 -2
- package/payload/templates/panel/common/bridge.min.js +0 -0
- package/payload/templates/panel/common/full-view.min.js +0 -1
- package/payload/templates/panel/common/main-view.min.js +0 -1
- package/payload/templates/panel/common/module-page.min.js +0 -1
- package/payload/templates/panel/common/right-view.min.js +0 -1
- package/payload/templates/panel/common/start-page.min.js +0 -1
- package/payload/templates/panel/common/top-bar-v25-07-29-1.js +0 -330
- package/payload/templates/panel/common/top-bar-v25-07-29-2.js +0 -265
- package/payload/templates/panel/common/top-bar.min.js +0 -1
- package/payload/templates/panel/common/ui-standards.min.js +0 -1
- package/payload/templates/panel/managers/database.min.js +0 -1
- package/payload/templates/panel/managers/login.min.js +0 -1
- package/payload/templates/panel/pages/_page-template.min.js +0 -1
- package/payload/templates/panel/pages/contents.min.js +0 -1
- package/payload/templates/panel/pages/edit-user.min.js +0 -1
- package/payload/templates/panel/pages/edit-users-table.min.js +0 -1
- package/payload/templates/panel/pages/home.min.js +0 -1
- package/payload/templates/panel/pages/notifications.min.js +0 -1
- package/payload/templates/panel/pages/reports.min.js +0 -1
- package/payload/templates/panel/pages/settings.min.js +0 -1
- package/payload/templates/panel/pages/user-actions.min.js +0 -2
- package/payload/templates/panel/pages/users.min.js +0 -1
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn2.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn2.png +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear-round.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.png +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/search.svg +0 -0
|
@@ -2,65 +2,80 @@
|
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
|
|
5
|
-
Smart Button - v26.
|
|
5
|
+
Smart Button - v26.11
|
|
6
6
|
|
|
7
|
-
THE DEFAULT BUTTON of new pages and projects
|
|
8
|
-
|
|
7
|
+
THE DEFAULT BUTTON of new pages and projects.
|
|
8
|
+
|
|
9
|
+
THE MODEL PAGE: _basic/examples/smart-button.htm: new pages and projects take their buttons from it.
|
|
10
|
+
The other samples: smart-button-alternatif.htm (pill and outlined with the colors of the page), smart-button-3-ozden.htm
|
|
11
|
+
(the templates), smart-button-4-dark.htm (the dark templates and tones), smart-button-5-features.htm.
|
|
9
12
|
|
|
10
13
|
- A button with an icon and a text (or only one of them); the icon on the left or on top (iconPosition).
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
- THE LOOK IN THREE STEPS. The order: style > tone > the template.
|
|
15
|
+
1. styleName: the template (the shape), gray. "ozden" (THE DEFAULT: #E3E3E3, a thin dark edge and a darker
|
|
16
|
+
line at the bottom), "ozden2" (no bottom line), "ozden3" (a faint edge), "ozden4" (a ghost: no
|
|
17
|
+
surface, no edge, only its hover is gray), "pill" (round, no edge, a bold text), "outlined" (round, a thicker
|
|
18
|
+
edge with a line at its bottom). For a dark page (the draft _designs/smart-button-dark.htm):
|
|
19
|
+
"ozdenDark" ... "ozden4Dark" (#2E2E2C, a white text and icon, the dark waiting clock).
|
|
20
|
+
"minimal" / "minimalDark" (the minimal theme, _designs/minimal-theme.htm): 28 px high, a 13 px text, only a line
|
|
21
|
+
that gets darker under the mouse; the main action takes the tone "ink" / "inkDark"; a delete "minimalDanger" /
|
|
22
|
+
"minimalDangerDark" (the line and the text in the danger color).
|
|
23
|
+
A template is only a style (SmartButton.styles); the minimal ones also give the height.
|
|
24
|
+
2. tone: a color of the kit (SmartButton.tones), three colors: the button, the button under the mouse, its text.
|
|
25
|
+
"white", "cyan" (the main action), "orange" (a delete, a reject), "yellow" (go on, but look first), "green"
|
|
26
|
+
(after a good result), "blue" (nothing changes). For a dark page: "cyanDark", "orangeDark", "yellowDark",
|
|
27
|
+
"greenDark", "blueDark" (deeper, a light text and a white icon). "": the gray of the template. setTone().
|
|
28
|
+
"ink" / "inkDark" (the main action of the minimal templates) color the edge too (a tone with edge / hoverEdge).
|
|
29
|
+
A tone looks the same on every template: its text (and its icon) come with it.
|
|
30
|
+
3. style: your own look, only the keys you change. A color is two colors: the button and the button under the mouse.
|
|
31
|
+
style: { box: { color: "#9DC7B5" }, hover: { color: "#91BCA9" } }
|
|
32
|
+
Pressed, a button gets a little smaller and darker (animated: 1, style.press): a press has no color of its own.
|
|
33
|
+
- AN ICON BUTTON: labelText: "" -> the icon in the middle, no room at the sides; with no width it is a square
|
|
34
|
+
(44 x 44). The same template and tone as a text button. Give it an ariaLabel.
|
|
35
|
+
An "auto" height keeps the room of style.layout.padding (Ex: padding [10, 10] -> 44 x 44).
|
|
36
|
+
- HEIGHT: 44 by default (40 looked narrow); every template, pill and outlined too. An icon on
|
|
37
|
+
top of a text makes it "auto" (as high as its padding and content).
|
|
29
38
|
- KEYBOARD AND ACCESSIBILITY: role "button", Tab reaches it, Enter / Space press it (Space when it goes up), a focus
|
|
30
|
-
ring only for the keyboard;
|
|
39
|
+
ring only for the keyboard; a click of the mouse does not take the focus (as the buttons of macOS: Enter and Space
|
|
40
|
+
stay with the page or the field that had them); ariaLabel for a button with only an icon (else labelText is read).
|
|
31
41
|
- setEnabled(0): no click, no hover, out of the Tab order (aria-disabled): a flat light gray button, a faint edge, no
|
|
32
42
|
bottom line, the text and the icon faint gray (the same for every color; chosen on
|
|
33
43
|
experimental/smart-button-bench.htm).
|
|
34
|
-
- ASK (two clicks): ask: "Click again to delete." -> the first click turns the button
|
|
44
|
+
- ASK (two clicks): ask: "Click again to delete." -> the first click turns the button orange (style.ask.button) and
|
|
35
45
|
shows the text in a bubble over it (comp/tooltip.js, Tooltip.show(): it stays inside the screen; without
|
|
36
|
-
tooltip.js only the
|
|
46
|
+
tooltip.js only the orange button); the second click runs onClick. It forgets after style.ask.time. One button asks
|
|
37
47
|
at a time. setAsk(text), cancelAsk(), isAsking. onBeforeClick(self) returns false: no ask and no onClick (Ex: a
|
|
38
48
|
form with an error must not ask "Sure?" first). press(): a press like a click (the ask too), Ex: Enter in a field.
|
|
39
49
|
- WAITING: setWaiting(1) while a job runs (a download, a save): the text and the icon fade and a small animation is
|
|
40
50
|
in the middle; the button can not be clicked. waitingType: "clock" (the default: the clock of the waiting views
|
|
41
|
-
with moving hands;
|
|
51
|
+
with moving hands; style.waiting.clock "ozden", or "ozdenDark" in the dark templates) or "dots" (three dots one
|
|
52
|
+
after the other).
|
|
42
53
|
setWaiting(0) ends it (after delay ms, if given). Nothing turns with prefers-reduced-motion.
|
|
43
54
|
(comp/loading-screen.js draws its clock and its dots with SmartButton.createClockSvg / createDots)
|
|
44
|
-
- MOTION: animated: 1 (default): pressed 0.94 and a little darker. ripple:
|
|
45
|
-
point
|
|
55
|
+
- MOTION: animated: 1 (default): pressed 0.94 and a little darker. ripple: 0 (default; 1 gives a wave from the
|
|
56
|
+
pressed point, from the middle for the keyboard; its color fits the button). setAnimated(0/1), setRipple(0/1).
|
|
46
57
|
- setStyle(style): changes the look after create with only the keys it gets.
|
|
47
58
|
|
|
48
59
|
USAGE:
|
|
49
|
-
SmartButton({ labelText: "
|
|
60
|
+
SmartButton({ labelText: "Cancel", onClick: function (self) { } }); // the default: ozden, gray
|
|
61
|
+
SmartButton({ tone: "cyan", labelText: "Send", iconFile: "_basic/assets/icons/send.png", onClick: send });
|
|
62
|
+
SmartButton({ styleName: "pill", tone: "blue", labelText: "Follow" });
|
|
63
|
+
SmartButton({ styleName: "ozdenDark", tone: "blueDark", labelText: "Send" }); // on a dark page
|
|
64
|
+
SmartButton({ styleName: "ozden2", tone: "white", labelText: "", iconFile: "trash.svg", ariaLabel: "Delete", ask: "Click again to delete.", onClick: deleteFile });
|
|
65
|
+
SmartButton({ labelText: "Archive", style: { box: { color: "#C3DBCE" }, hover: { color: "#B5D0C1" } } }); // your own color
|
|
50
66
|
const btnDownload = SmartButton({ labelText: "Download", onClick: function (self) {
|
|
51
67
|
self.setWaiting(1);
|
|
52
68
|
download().then(function () { self.setWaiting(0); });
|
|
53
69
|
} });
|
|
54
|
-
|
|
55
|
-
SmartButton({ styleName: "pill", tone: "green", labelText: "Accepted", iconFile: "check.svg" });
|
|
56
|
-
button.setTone("blue", "pillSolid"); // another color and shape after create
|
|
57
|
-
btnSave.setStyle({ box: { color: "#9DC7B5" }, hover: { color: "#91BCA9" }, active: { color: "#91BCA9" } });
|
|
70
|
+
btnSave.setTone("green"); // another color after create ("": the gray of its template)
|
|
58
71
|
|
|
59
72
|
Started Date: January 2026
|
|
60
|
-
Developer: Bugra Ozden
|
|
61
|
-
Email: bugra.ozden@gmail.com
|
|
62
73
|
Webpage: https://bug7a.github.io/js-components/
|
|
63
74
|
|
|
75
|
+
Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
|
|
76
|
+
Licensed under the Apache License, Version 2.0
|
|
77
|
+
SPDX-License-Identifier: Apache-2.0
|
|
78
|
+
|
|
64
79
|
*/
|
|
65
80
|
|
|
66
81
|
"use strict";
|
|
@@ -68,38 +83,38 @@ Webpage: https://bug7a.github.io/js-components/
|
|
|
68
83
|
// Default values:
|
|
69
84
|
const SmartButtonDefaults = {
|
|
70
85
|
key: "0",
|
|
71
|
-
styleName: "
|
|
72
|
-
tone: "", //
|
|
73
|
-
width: "auto",
|
|
74
|
-
height: "auto"
|
|
75
|
-
labelText: "Button",
|
|
86
|
+
styleName: "ozden", // the template (SmartButton.styles): "ozden" (the default) ... "ozden4", "pill", "outlined", "ozdenDark" ... "ozden4Dark", "minimal", "minimalDark", "minimalDanger", "minimalDangerDark"
|
|
87
|
+
tone: "", // a color of the kit (SmartButton.tones): "white", "cyan", "orange", "yellow", "green", "blue", "cyanDark"..., "ink" / "inkDark" (minimal). "": the gray of the template. setTone()
|
|
88
|
+
width: "auto", // an icon button (labelText: "") is a square
|
|
89
|
+
height: 44, // "auto": as high as its padding and content (an icon on top of a text is "auto")
|
|
90
|
+
labelText: "Button", // "": an icon button
|
|
91
|
+
allowHtml: 0, // 1: labelText is HTML (only for your own texts)
|
|
76
92
|
iconFile: "", // "": no icon (Ex: "_basic/comp/smart-button/alert-black.png")
|
|
77
93
|
iconPosition: "left", // "left", "top"
|
|
78
94
|
enabled: 1, // 0: gray, can not be pressed (set later with setEnabled)
|
|
79
|
-
ariaLabel: "", // "": labelText is read.
|
|
95
|
+
ariaLabel: "", // "": labelText is read. An icon button needs it (Ex: "Delete")
|
|
80
96
|
waiting: 0, // 1: it waits (set later with setWaiting)
|
|
81
97
|
waitingType: "clock", // "clock" (the default wait) or "dots"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
ask: "", // "Click again to delete.": two clicks (the first one asks with a red button and this text in a bubble). setAsk()
|
|
98
|
+
animated: 1, // 1: pressed it gets smaller and darker (style.press). setAnimated()
|
|
99
|
+
ripple: 0, // 1: a wave from the pressed point (it works with animated: 0 too). setRipple()
|
|
100
|
+
ask: "", // "Click again to delete.": two clicks (the first one asks with an orange button and this text in a bubble). setAsk()
|
|
86
101
|
onBeforeClick: null, // function (self): false stops the press, with no ask either
|
|
87
102
|
onClick: function (self) { }, // Not called while waiting
|
|
88
103
|
onWaitingEnd: function (self) { }, // The wait ended (setWaiting(0))
|
|
89
|
-
style: { //
|
|
104
|
+
style: { // ozden (the default template)
|
|
90
105
|
layout: {
|
|
91
106
|
gap: 8,
|
|
92
107
|
padding: [16, 0],
|
|
93
108
|
align: "center center",
|
|
94
109
|
// px less space on the side of the icon (an icon left of a text): the empty edge in an icon file and its
|
|
95
|
-
// thin lines made that side look wider (measured 1 - 3 px
|
|
110
|
+
// thin lines made that side look wider (measured 1 - 3 px). 0: the same on both sides
|
|
96
111
|
iconSideTrim: 2,
|
|
97
112
|
},
|
|
98
113
|
icon: {
|
|
99
114
|
width: 24,
|
|
100
115
|
height: 24,
|
|
101
116
|
opacity: 0.8,
|
|
102
|
-
filter: "none", // a CSS filter: the dark
|
|
117
|
+
filter: "none", // a CSS filter: the dark templates turn the icon white ("brightness(0) invert(1)")
|
|
103
118
|
},
|
|
104
119
|
label: {
|
|
105
120
|
fontSize: 20,
|
|
@@ -114,22 +129,23 @@ const SmartButtonDefaults = {
|
|
|
114
129
|
boxShadow: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)",
|
|
115
130
|
},
|
|
116
131
|
hover: {
|
|
117
|
-
color: "#D9D9D9",
|
|
118
|
-
|
|
119
|
-
active: {
|
|
120
|
-
color: "#D9D9D9",
|
|
132
|
+
color: "#D9D9D9", // under the mouse (pressed: this color, darker)
|
|
133
|
+
borderColor: "", // the edge under the mouse. "": the edge of box (the minimal templates darken it)
|
|
121
134
|
},
|
|
122
|
-
// ask: the
|
|
135
|
+
// ask: the look of the button while it asks, and the bubble over it (Tooltip.BUBBLE_LOOK keys).
|
|
136
|
+
// #DE815B (the orange of danger); its own value, not the orange tone,
|
|
137
|
+
// so the two can be changed apart.
|
|
123
138
|
ask: {
|
|
124
139
|
button: {
|
|
125
|
-
color: "#
|
|
126
|
-
border:
|
|
127
|
-
|
|
140
|
+
color: "#DE815B", // also under the mouse and pressed
|
|
141
|
+
// WHY no border width: the edge of the template stays, so a pill (0) or an outlined (2) button keeps
|
|
142
|
+
// its size while it asks (border: 1 made an "auto" pill 2 px wider)
|
|
143
|
+
borderColor: "#DE815B",
|
|
128
144
|
boxShadow: "none",
|
|
129
145
|
textColor: "white",
|
|
130
146
|
iconFilter: "brightness(0) invert(1)", // the icon turns white, whatever color its file has
|
|
131
147
|
},
|
|
132
|
-
bubble: { color: "#
|
|
148
|
+
bubble: { color: "#DE815B", textColor: "white", fontSize: 13, bold: 1, round: 8, padding: [12, 7], border: 0, borderColor: "", shadow: "0 6px 16px rgba(0, 0, 0, 0.18)", arrow: 12, gap: 6, edge: 8, grow: 1 },
|
|
133
149
|
time: 5000, // ms: it forgets the question
|
|
134
150
|
},
|
|
135
151
|
focus: {
|
|
@@ -141,9 +157,10 @@ const SmartButtonDefaults = {
|
|
|
141
157
|
textColor: "rgba(0, 0, 0, 0.3)",
|
|
142
158
|
iconOpacity: 0.25, // (and no color)
|
|
143
159
|
},
|
|
160
|
+
// The press (animated: 1). WHY no color for it: two colors are enough, the press
|
|
161
|
+
// only darkens the color of the moment
|
|
144
162
|
press: {
|
|
145
163
|
scale: 0.94, // while pressed
|
|
146
|
-
removeShadow: 0, // 1: while pressed the box shadow (Ex: the inset bottom line) goes away, as if pushed in
|
|
147
164
|
brightness: 0.92, // while pressed
|
|
148
165
|
time: 0.15, // s
|
|
149
166
|
},
|
|
@@ -154,6 +171,7 @@ const SmartButtonDefaults = {
|
|
|
154
171
|
time: 0.6, // s
|
|
155
172
|
},
|
|
156
173
|
waiting: {
|
|
174
|
+
clock: "ozden", // the look of the clock: "ozden" (a white face, dark lines), "ozdenDark", or the ring of "minimal" / "minimalDark" (SmartButton.clocks)
|
|
157
175
|
contentOpacity: 0.18, // the text and the icon while waiting
|
|
158
176
|
clockSize: 30, // at most; a small button gets a smaller clock
|
|
159
177
|
space: 14, // the room around the clock in a small button
|
|
@@ -164,74 +182,76 @@ const SmartButtonDefaults = {
|
|
|
164
182
|
|
|
165
183
|
const SmartButton = function (params = {}) {
|
|
166
184
|
|
|
167
|
-
// Merge params:
|
|
168
|
-
SmartButton.
|
|
169
|
-
|
|
185
|
+
// Merge params: style > tone > the template (styleName) > the defaults
|
|
186
|
+
SmartButton.applyLook(params);
|
|
187
|
+
const hasText = (params.labelText !== "");
|
|
188
|
+
// WHY: 44 is the height of a row; an icon above its text needs more (about 60)
|
|
189
|
+
if (params.iconPosition === "top" && hasText && params.height === undefined) params.height = "auto";
|
|
170
190
|
mergeIntoIfMissing(params, SmartButtonDefaults);
|
|
191
|
+
// AN ICON BUTTON (no text): a square when no width is given.
|
|
192
|
+
// WHY only with a number height: an "auto" one is as big as its padding and its icon (Ex: 10 + 24 + 10)
|
|
193
|
+
const isIconButton = !hasText && (typeof params.height === "number");
|
|
194
|
+
if (isIconButton && params.width === "auto") params.width = params.height;
|
|
171
195
|
|
|
172
196
|
// BOX: Component container
|
|
173
197
|
const box = startObject(params);
|
|
174
198
|
|
|
175
199
|
// *** PRIVATE VARIABLES:
|
|
176
200
|
const WAITING_MOTION = "opacity 0.2s"; // the content fades while waiting
|
|
177
|
-
const
|
|
201
|
+
const ASK_ANSWER_DELAY = 400; // ms: a click this soon after the question is the second click of a double click
|
|
202
|
+
const STILL_MOTION = "background-color 0.2s"; // the color under the mouse (animated: 0 too)
|
|
178
203
|
let cancelWaitingEnd = null;
|
|
179
204
|
let cancelAskTimer = null;
|
|
180
205
|
let askBubble = null;
|
|
206
|
+
let askStartTime = 0; // when the question was shown (isAnswerTooSoon)
|
|
181
207
|
let isHover = 0;
|
|
182
208
|
let isPressed = 0;
|
|
183
209
|
let isSpaceDown = 0; // Space went down on this button (it presses when it goes up, like a real button)
|
|
184
|
-
let
|
|
210
|
+
let isMotionStarted = 0; // the transitions are on after the first view (startMotion)
|
|
185
211
|
|
|
186
212
|
// *** PRIVATE FUNCTIONS:
|
|
187
213
|
|
|
214
|
+
const setText = function (label, text) {
|
|
215
|
+
const value = (text === undefined || text === null) ? "" : String(text);
|
|
216
|
+
if (box.allowHtml == 1) label.text = value;
|
|
217
|
+
else label.plainText = value;
|
|
218
|
+
};
|
|
219
|
+
|
|
188
220
|
const canPress = function () {
|
|
189
221
|
return box.enabled == 1 && box.waiting != 1;
|
|
190
222
|
};
|
|
191
223
|
|
|
192
224
|
const isReducedMotion = function () {
|
|
193
|
-
return
|
|
225
|
+
return SmartButton.isReducedMotion();
|
|
194
226
|
};
|
|
195
227
|
|
|
196
228
|
const isMotionOn = function () {
|
|
197
229
|
return box.animated == 1 && !isReducedMotion();
|
|
198
230
|
};
|
|
199
231
|
|
|
200
|
-
// THE LOOK OF THE STATE: disabled > asking >
|
|
201
|
-
|
|
232
|
+
// THE LOOK OF THE STATE: the normal look, and over it the keys of the state: disabled > asking > under the mouse.
|
|
233
|
+
// (style.disabled and style.ask.button have the key names of the look; pressed: getPressCss darkens it)
|
|
234
|
+
// WHY one order: an ask never meets a disabled or waiting button (setEnabled(0) and setWaiting(1) end it)
|
|
235
|
+
const getLook = function () {
|
|
202
236
|
const _s = box.style;
|
|
203
|
-
|
|
204
|
-
|
|
237
|
+
const look = {
|
|
238
|
+
color: _s.box.color,
|
|
239
|
+
border: _s.box.border,
|
|
240
|
+
borderColor: _s.box.borderColor,
|
|
241
|
+
boxShadow: _s.box.boxShadow,
|
|
242
|
+
textColor: _s.label.textColor,
|
|
243
|
+
iconOpacity: _s.icon.opacity,
|
|
244
|
+
iconFilter: _s.icon.filter,
|
|
245
|
+
};
|
|
246
|
+
// WHY no shadow when disabled: a flat button is not one that can be pressed in
|
|
247
|
+
if (box.enabled != 1) return Object.assign(look, _s.disabled, { boxShadow: "none" });
|
|
248
|
+
if (box.isAsking == 1) return Object.assign(look, _s.ask.button);
|
|
205
249
|
// WHY not while waiting: the button stays in its own color under the animation
|
|
206
|
-
if (box.waiting
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const getBorderColor = function () {
|
|
213
|
-
if (box.enabled != 1) return box.style.disabled.borderColor;
|
|
214
|
-
if (box.isAsking == 1) return box.style.ask.button.borderColor;
|
|
215
|
-
return box.style.box.borderColor;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
// WHY none when disabled: a flat button is not one that can be pressed in
|
|
219
|
-
const getBoxShadow = function () {
|
|
220
|
-
if (box.enabled != 1) return "none";
|
|
221
|
-
if (box.isAsking == 1) return box.style.ask.button.boxShadow;
|
|
222
|
-
if (isPressed && canPress() && box.style.press.removeShadow == 1) return "none";
|
|
223
|
-
return box.style.box.boxShadow || "";
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const getTextColor = function () {
|
|
227
|
-
if (box.enabled != 1) return box.style.disabled.textColor;
|
|
228
|
-
if (box.isAsking == 1) return box.style.ask.button.textColor;
|
|
229
|
-
return box.style.label.textColor;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const getIconOpacity = function () {
|
|
233
|
-
if (box.enabled != 1) return box.style.disabled.iconOpacity;
|
|
234
|
-
return (box.style.icon.opacity === undefined) ? 1 : box.style.icon.opacity;
|
|
250
|
+
if (isHover && box.waiting != 1) {
|
|
251
|
+
look.color = _s.hover.color;
|
|
252
|
+
if (_s.hover.borderColor) look.borderColor = _s.hover.borderColor;
|
|
253
|
+
}
|
|
254
|
+
return look;
|
|
235
255
|
};
|
|
236
256
|
|
|
237
257
|
// The press: smaller and darker while pressed (only with animated: 1)
|
|
@@ -243,22 +263,19 @@ const SmartButton = function (params = {}) {
|
|
|
243
263
|
};
|
|
244
264
|
};
|
|
245
265
|
|
|
246
|
-
const getIconFilter = function () {
|
|
247
|
-
if (box.isAsking == 1 && box.enabled == 1) return box.style.ask.button.iconFilter;
|
|
248
|
-
return box.style.icon.filter || "none";
|
|
249
|
-
};
|
|
250
|
-
|
|
251
266
|
// Everything that changes with the state: the box, the content, the press, the keyboard and the screen reader
|
|
252
267
|
const render = function () {
|
|
253
268
|
const isEnabled = (box.enabled == 1);
|
|
254
|
-
|
|
255
|
-
box.
|
|
256
|
-
box.
|
|
257
|
-
box.
|
|
258
|
-
|
|
269
|
+
const look = getLook();
|
|
270
|
+
box.color = look.color;
|
|
271
|
+
box.border = look.border;
|
|
272
|
+
box.borderColor = look.borderColor;
|
|
273
|
+
box.boxShadow = look.boxShadow;
|
|
274
|
+
box.css = getPressCss();
|
|
275
|
+
if (box.label) box.label.textColor = look.textColor;
|
|
259
276
|
if (box.icon) {
|
|
260
|
-
box.icon.opacity =
|
|
261
|
-
box.icon.css = { filter:
|
|
277
|
+
box.icon.opacity = look.iconOpacity;
|
|
278
|
+
box.icon.css = { filter: look.iconFilter };
|
|
262
279
|
}
|
|
263
280
|
box.layout.css = { filter: isEnabled ? "none" : "grayscale(1)" };
|
|
264
281
|
box.layout.opacity = (box.waiting == 1) ? box.style.waiting.contentOpacity : 1;
|
|
@@ -267,8 +284,42 @@ const SmartButton = function (params = {}) {
|
|
|
267
284
|
box.aria = { disabled: !isEnabled, label: box.ariaLabel || box.labelText || "" };
|
|
268
285
|
};
|
|
269
286
|
|
|
287
|
+
// The room inside: an icon button has none (its icon in the middle); an icon left of a text has a little less
|
|
288
|
+
// on its side (style.layout.iconSideTrim)
|
|
289
|
+
const paintPadding = function () {
|
|
290
|
+
if (isIconButton) {
|
|
291
|
+
box.layout.padding = 0;
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const _l = box.style.layout;
|
|
295
|
+
const isIconLeft = box.icon && box.label && box.iconPosition !== "top";
|
|
296
|
+
const padding = Array.isArray(_l.padding) ? _l.padding[0] : _l.padding;
|
|
297
|
+
const trim = isIconLeft ? _l.iconSideTrim : 0;
|
|
298
|
+
box.layout.css = { paddingLeft: Math.max(0, padding - trim) + "px" };
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// The style on the objects (box, layout, icon, label, focus ring); render() gives the colors of the state.
|
|
302
|
+
const applyStyle = function () {
|
|
303
|
+
const _s = box.style;
|
|
304
|
+
box.props(_s.box);
|
|
305
|
+
box.layout.props(_s.layout);
|
|
306
|
+
paintPadding();
|
|
307
|
+
if (box.icon) box.icon.props(_s.icon);
|
|
308
|
+
if (box.label) box.label.props(_s.label);
|
|
309
|
+
box.setFocusRing(_s.focus.ringColor);
|
|
310
|
+
render();
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// WHY: the second click of a double click answered the ask before it was read (SmartButton({ ask }) and a
|
|
314
|
+
// Dialog.confirm with danger and ask ran at once)
|
|
315
|
+
const isAnswerTooSoon = function (event) {
|
|
316
|
+
if (event && event.detail > 1) return true;
|
|
317
|
+
return (Date.now() - askStartTime < ASK_ANSWER_DELAY);
|
|
318
|
+
};
|
|
319
|
+
|
|
270
320
|
const press = function (event) {
|
|
271
321
|
if (!canPress()) return;
|
|
322
|
+
if (box.isAsking == 1 && isAnswerTooSoon(event)) return;
|
|
272
323
|
if (typeof box.onBeforeClick === "function" && box.onBeforeClick(box) === false) return;
|
|
273
324
|
if (box.ask && box.isAsking != 1) {
|
|
274
325
|
startAsk();
|
|
@@ -278,14 +329,14 @@ const SmartButton = function (params = {}) {
|
|
|
278
329
|
if (box.onClick) box.onClick(box, event);
|
|
279
330
|
};
|
|
280
331
|
|
|
281
|
-
// *** ASK (two clicks): the
|
|
332
|
+
// *** ASK (two clicks): the orange look (render) and the bubble (Tooltip.show)
|
|
282
333
|
|
|
283
334
|
const startAsk = function () {
|
|
284
335
|
// WHY one at a time: the bubble of another button would stay over this one
|
|
285
|
-
|
|
286
|
-
if (other && other !== box) other.cancelAsk();
|
|
336
|
+
if (SmartButton.askingButton) SmartButton.askingButton.cancelAsk();
|
|
287
337
|
SmartButton.askingButton = box;
|
|
288
338
|
box.isAsking = 1;
|
|
339
|
+
askStartTime = Date.now();
|
|
289
340
|
render();
|
|
290
341
|
if (typeof Tooltip !== "undefined") askBubble = Tooltip.show(box, box.ask, box.style.ask.bubble);
|
|
291
342
|
cancelAskTimer = box.after(box.style.ask.time, box.cancelAsk);
|
|
@@ -322,7 +373,8 @@ const SmartButton = function (params = {}) {
|
|
|
322
373
|
dot.style.cssText = "position: absolute; border-radius: 50%; pointer-events: none; background: " + getRippleColor() + ";" +
|
|
323
374
|
" left: " + (point.x - radius) + "px; top: " + (point.y - radius) + "px; width: " + (radius * 2) + "px; height: " + (radius * 2) + "px;";
|
|
324
375
|
layer.appendChild(dot);
|
|
325
|
-
|
|
376
|
+
// WHY under the waiting cover: onClick often starts it (no cover yet: the layer goes last, the cover comes over it)
|
|
377
|
+
elem.insertBefore(layer, box.waitingCover ? box.waitingCover.elem : null);
|
|
326
378
|
const wave = dot.animate([
|
|
327
379
|
{ transform: "scale(0)", opacity: 1 },
|
|
328
380
|
{ transform: "scale(1)", opacity: 0.7, offset: 0.6 },
|
|
@@ -331,53 +383,98 @@ const SmartButton = function (params = {}) {
|
|
|
331
383
|
wave.onfinish = function () { layer.remove(); };
|
|
332
384
|
};
|
|
333
385
|
|
|
334
|
-
// ***
|
|
386
|
+
// *** THE MOTION
|
|
335
387
|
|
|
336
|
-
// The press
|
|
388
|
+
// The transitions: the press (animated: 1, not with reduced motion) and the color under the mouse (always)
|
|
389
|
+
// WHY not setMotion(): it starts after a timer, and the press must answer the first click
|
|
337
390
|
const applyAnimated = function () {
|
|
338
|
-
if (!
|
|
339
|
-
if (!wasAnimated) return;
|
|
340
|
-
wasAnimated = 0;
|
|
341
|
-
render();
|
|
342
|
-
box.setMotionNow(STILL_MOTION);
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
wasAnimated = 1;
|
|
391
|
+
if (!isMotionStarted) return; // (startMotion turns them on)
|
|
346
392
|
const time = box.style.press.time + "s";
|
|
347
|
-
|
|
348
|
-
box.setMotionNow(
|
|
349
|
-
|
|
393
|
+
const pressMotion = isMotionOn() ? "transform " + time + ", filter " + time + ", box-shadow " + time + ", " : "";
|
|
394
|
+
box.setMotionNow(pressMotion + STILL_MOTION);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// The transitions start after the first view: a state set while the button is made (Ex: setEnabled(0) right
|
|
398
|
+
// after a Dialog is made) is drawn at once, not as a move from its first look (the Save
|
|
399
|
+
// button of a dialog turned from blue to gray when the dialog opened)
|
|
400
|
+
// WHY the frame and the read: the look of now must be the start of a transition, not the look before it
|
|
401
|
+
const startMotion = function () {
|
|
402
|
+
requestAnimationFrame(function () {
|
|
403
|
+
if (box._isRemoved) return;
|
|
404
|
+
void box.elem.offsetWidth; // (the browser takes the look of now)
|
|
405
|
+
isMotionStarted = 1;
|
|
406
|
+
box.layout.setMotionNow(WAITING_MOTION);
|
|
407
|
+
applyAnimated();
|
|
408
|
+
});
|
|
350
409
|
};
|
|
351
410
|
|
|
411
|
+
// *** WAITING
|
|
412
|
+
|
|
352
413
|
// The clock fits the button: at most its size, smaller in a small button (the dots keep their size)
|
|
353
414
|
const fitWaitingIcon = function () {
|
|
354
415
|
const icon = box.waitingCover.icon;
|
|
355
416
|
if (box.waitingType == "clock") {
|
|
356
417
|
const _w = box.style.waiting;
|
|
357
|
-
const
|
|
418
|
+
const room = Math.min(box.width, box.height) - _w.space;
|
|
419
|
+
const size = basic.clamp(room, 0, _w.clockSize);
|
|
358
420
|
icon.setSize(size, size);
|
|
359
421
|
}
|
|
360
422
|
icon.center();
|
|
361
423
|
};
|
|
362
424
|
|
|
425
|
+
// BOX: Waiting cover, made at the first wait: most buttons never wait (it is 2/3 of the objects of a button).
|
|
426
|
+
// Clear: the content fades under it; it holds the animation and takes the mouse.
|
|
427
|
+
const createWaitingCover = function () {
|
|
428
|
+
saveCurrentThat(); // WHY: a wait must not change `that` (Ex: that.setWaiting(1) right after create)
|
|
429
|
+
box.waitingCover = createIn(box, function () {
|
|
430
|
+
const cover = startBox(0, 0, "100%", "100%", {
|
|
431
|
+
color: "transparent",
|
|
432
|
+
clickable: 1, // WHY: it takes the mouse, so its "progress" cursor shows (the hover color: render())
|
|
433
|
+
cursor: "progress",
|
|
434
|
+
});
|
|
435
|
+
if (box.waitingType == "dots") {
|
|
436
|
+
cover.icon = SmartButton.createDots(box.style.waiting.dots);
|
|
437
|
+
} else {
|
|
438
|
+
const clockStyle = SmartButton.clocks[box.style.waiting.clock] || SmartButton.clocks.ozden;
|
|
439
|
+
cover.icon = Box(0, 0, 0, 0, { color: "transparent", html: SmartButton.createClockSvg(clockStyle) });
|
|
440
|
+
}
|
|
441
|
+
endBox();
|
|
442
|
+
return cover;
|
|
443
|
+
});
|
|
444
|
+
restoreThatFromSaved();
|
|
445
|
+
box.onResize(function () {
|
|
446
|
+
if (box.waiting == 1) fitWaitingIcon();
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
const startWaiting = function () {
|
|
451
|
+
box.cancelAsk();
|
|
452
|
+
box.waiting = 1;
|
|
453
|
+
box.aria = { busy: true };
|
|
454
|
+
if (!box.waitingCover) createWaitingCover();
|
|
455
|
+
box.waitingCover.visible = 1;
|
|
456
|
+
fitWaitingIcon();
|
|
457
|
+
render();
|
|
458
|
+
};
|
|
459
|
+
|
|
363
460
|
const endWaiting = function () {
|
|
364
461
|
box.waiting = 0;
|
|
365
462
|
box.aria = { busy: false };
|
|
366
463
|
box.waitingCover.visible = 0;
|
|
367
464
|
render();
|
|
368
|
-
box.onWaitingEnd(box);
|
|
465
|
+
if (typeof box.onWaitingEnd === "function") box.onWaitingEnd(box);
|
|
369
466
|
};
|
|
370
467
|
|
|
371
468
|
// *** PUBLIC FUNCTIONS:
|
|
372
469
|
|
|
373
470
|
box.isAsking = 0; // 1: the first click of ask was made, the button is red
|
|
374
471
|
|
|
375
|
-
box.
|
|
472
|
+
box.setLabelText = function (text) {
|
|
376
473
|
box.labelText = text;
|
|
377
|
-
if (box.label) box.label
|
|
474
|
+
if (box.label) setText(box.label, text);
|
|
378
475
|
render(); // (the label read by a screen reader)
|
|
379
476
|
};
|
|
380
|
-
|
|
477
|
+
// USAGE: button.setLabelText("Save")
|
|
381
478
|
|
|
382
479
|
box.setIcon = function (file) {
|
|
383
480
|
box.iconFile = file;
|
|
@@ -388,6 +485,7 @@ const SmartButton = function (params = {}) {
|
|
|
388
485
|
box.setAnimated = function (value) {
|
|
389
486
|
box.animated = basic.isOn(value) ? 1 : 0;
|
|
390
487
|
applyAnimated();
|
|
488
|
+
render(); // WHY: a button pressed now loses its press look with animated: 0
|
|
391
489
|
};
|
|
392
490
|
// USAGE: get: button.animated, set: button.setAnimated(0)
|
|
393
491
|
|
|
@@ -400,11 +498,8 @@ const SmartButton = function (params = {}) {
|
|
|
400
498
|
box.enabled = basic.isOn(value) ? 1 : 0;
|
|
401
499
|
if (box.enabled != 1) {
|
|
402
500
|
box.cancelAsk();
|
|
403
|
-
isHover = 0;
|
|
404
501
|
isPressed = 0;
|
|
405
502
|
isSpaceDown = 0;
|
|
406
|
-
} else {
|
|
407
|
-
isHover = box.elem.matches(":hover") ? 1 : 0; // WHY: the mouse may have stayed on it while it was off
|
|
408
503
|
}
|
|
409
504
|
render();
|
|
410
505
|
};
|
|
@@ -439,61 +534,40 @@ const SmartButton = function (params = {}) {
|
|
|
439
534
|
const superRemove = box.remove;
|
|
440
535
|
box.superRemove = superRemove;
|
|
441
536
|
box.remove = function () {
|
|
537
|
+
if (box.isRemoved) return;
|
|
442
538
|
box.cancelAsk();
|
|
443
539
|
superRemove.call(box);
|
|
444
540
|
};
|
|
445
541
|
|
|
446
|
-
// Only the given keys change; the other keys of the style stay.
|
|
542
|
+
// Only the given keys change; the other keys of the style stay, inside a part too (ask.button, waiting.dots).
|
|
447
543
|
// WHY a new object for each part: the old one can be shared with other buttons (the same style object of a page)
|
|
544
|
+
// WHY not Object.assign: it replaces ask.button whole, so { ask: { button: { color } } } would lose
|
|
545
|
+
// the white text and the white icon of the ask
|
|
448
546
|
box.setStyle = function (style) {
|
|
449
547
|
Object.keys(style || {}).forEach(function (part) {
|
|
450
|
-
|
|
548
|
+
const merged = {};
|
|
549
|
+
mergeIntoIfMissing(merged, style[part]); // the new keys first
|
|
550
|
+
mergeIntoIfMissing(merged, box.style[part]); // then the old ones under them
|
|
551
|
+
box.style[part] = merged;
|
|
451
552
|
});
|
|
452
553
|
applyStyle();
|
|
554
|
+
applyAnimated(); // WHY: style.press.time is in the transitions
|
|
453
555
|
};
|
|
454
556
|
// USAGE: button.setStyle({ box: { color: "tomato", borderColor: "red" }, hover: { color: "tomato" } })
|
|
455
557
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
box.
|
|
459
|
-
box.tone
|
|
460
|
-
if (toneName) box.setStyle(SmartButton.getToneStyle(toneName, box.styleName));
|
|
461
|
-
};
|
|
462
|
-
// USAGE: button.setTone("blue"), button.setTone("blue", "pillSolid"), button.setTone("", "pill") (only the package)
|
|
463
|
-
|
|
464
|
-
// The style on the objects (box, layout, icon, label, focus ring); render() gives the colors of the state.
|
|
465
|
-
// The side of the icon a little narrower (style.layout.iconSideTrim), only for an icon left of a text
|
|
466
|
-
const paintIconSide = function () {
|
|
467
|
-
const _l = box.style.layout;
|
|
468
|
-
const isIconLeft = box.icon && box.label && box.iconPosition !== "top";
|
|
469
|
-
const padding = Array.isArray(_l.padding) ? _l.padding[0] : _l.padding;
|
|
470
|
-
const trim = isIconLeft ? (Number(_l.iconSideTrim) || 0) : 0;
|
|
471
|
-
box.layout.css = { paddingLeft: Math.max(0, padding - trim) + "px" };
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
const applyStyle = function () {
|
|
475
|
-
const _s = box.style;
|
|
476
|
-
box.props(_s.box);
|
|
477
|
-
box.layout.props(_s.layout);
|
|
478
|
-
paintIconSide();
|
|
479
|
-
if (box.icon) box.icon.props(_s.icon);
|
|
480
|
-
if (box.label) box.label.props(_s.label);
|
|
481
|
-
box.setFocusRing(_s.focus.ringColor);
|
|
482
|
-
render();
|
|
558
|
+
// The two colors of a tone (a color of the page given with style goes)
|
|
559
|
+
box.setTone = function (toneName) {
|
|
560
|
+
box.tone = toneName || "";
|
|
561
|
+
box.setStyle(SmartButton.getToneStyle(box.tone, box.styleName));
|
|
483
562
|
};
|
|
563
|
+
// USAGE: button.setTone("green"), button.setTone("") (the gray of its template)
|
|
484
564
|
|
|
485
565
|
// delay: ms before the wait ends (only for 0)
|
|
486
566
|
box.setWaiting = function (value, delay = 0) {
|
|
487
|
-
const isWaiting = basic.isOn(value) ? 1 : 0;
|
|
488
567
|
if (cancelWaitingEnd) cancelWaitingEnd();
|
|
489
568
|
cancelWaitingEnd = null;
|
|
490
|
-
if (
|
|
491
|
-
|
|
492
|
-
box.waiting = 1;
|
|
493
|
-
box.aria = { busy: true };
|
|
494
|
-
box.waitingCover.visible = 1;
|
|
495
|
-
fitWaitingIcon();
|
|
496
|
-
render();
|
|
569
|
+
if (basic.isOn(value)) {
|
|
570
|
+
startWaiting();
|
|
497
571
|
return;
|
|
498
572
|
}
|
|
499
573
|
if (box.waiting != 1) return;
|
|
@@ -501,22 +575,15 @@ const SmartButton = function (params = {}) {
|
|
|
501
575
|
endWaiting();
|
|
502
576
|
return;
|
|
503
577
|
}
|
|
504
|
-
cancelWaitingEnd = box.after(delay,
|
|
505
|
-
cancelWaitingEnd = null;
|
|
506
|
-
endWaiting();
|
|
507
|
-
});
|
|
578
|
+
cancelWaitingEnd = box.after(delay, endWaiting);
|
|
508
579
|
};
|
|
509
580
|
// USAGE: get: button.waiting, set: button.setWaiting(1) / button.setWaiting(0, 1000)
|
|
510
581
|
|
|
511
582
|
// *** OBJECT VIEW:
|
|
512
583
|
|
|
513
|
-
// BOX: Container look
|
|
514
|
-
box.props(box.style.box);
|
|
584
|
+
// BOX: Container (its look: applyStyle(), when its objects are made)
|
|
515
585
|
box.clickable = 1;
|
|
516
586
|
box.role = "button";
|
|
517
|
-
box.setFocusRing(box.style.focus.ringColor);
|
|
518
|
-
// (the transitions: applyAnimated(); WHY not setMotion() here: its timer came after them and wrote over them)
|
|
519
|
-
box.setMotionNow(STILL_MOTION);
|
|
520
587
|
|
|
521
588
|
// GROUP: Layout (icon, label). iconPosition "top" puts the icon above the label.
|
|
522
589
|
// WHY "100%" for a fixed size: the group fills the inside of the border; with the size of the box itself it was
|
|
@@ -538,32 +605,19 @@ const SmartButton = function (params = {}) {
|
|
|
538
605
|
// LABEL: only when there is a text
|
|
539
606
|
if (box.labelText) {
|
|
540
607
|
box.label = Label(0, 0, box.style.label);
|
|
541
|
-
box.label
|
|
608
|
+
setText(box.label, box.labelText);
|
|
542
609
|
box.label.css.whiteSpace = "nowrap";
|
|
543
610
|
}
|
|
544
611
|
|
|
545
612
|
endAutoLayout();
|
|
546
|
-
|
|
547
|
-
paintIconSide();
|
|
548
|
-
|
|
549
|
-
// BOX: Waiting cover (clear: the content fades under it; it holds the animation and takes the mouse)
|
|
550
|
-
box.waitingCover = startBox(0, 0, "100%", "100%", {
|
|
551
|
-
color: "transparent",
|
|
552
|
-
clickable: 1, // WHY: the button under it gets no hover look while waiting
|
|
553
|
-
cursor: "progress",
|
|
554
|
-
});
|
|
555
|
-
if (box.waitingType == "dots") {
|
|
556
|
-
box.waitingCover.icon = SmartButton.createDots(box.style.waiting.dots);
|
|
557
|
-
} else {
|
|
558
|
-
const clock = Box(0, 0, 0, 0, { color: "transparent" });
|
|
559
|
-
clock.elem.innerHTML = SmartButton.createClockSvg(SmartButton.clocks[box.waitingClock] || SmartButton.clocks.ozden);
|
|
560
|
-
box.waitingCover.icon = clock;
|
|
561
|
-
}
|
|
562
|
-
endBox();
|
|
563
|
-
box.waitingCover.visible = 0;
|
|
613
|
+
// (the waiting cover: createWaitingCover(), at the first wait)
|
|
564
614
|
|
|
565
615
|
// *** OBJECT INIT CODE:
|
|
566
616
|
|
|
617
|
+
// WHY the look before the transitions: nothing fades in at the first view
|
|
618
|
+
applyStyle();
|
|
619
|
+
startMotion();
|
|
620
|
+
|
|
567
621
|
box.on("click", function (self, event) {
|
|
568
622
|
press(event);
|
|
569
623
|
});
|
|
@@ -591,10 +645,6 @@ const SmartButton = function (params = {}) {
|
|
|
591
645
|
isSpaceDown = 0;
|
|
592
646
|
});
|
|
593
647
|
|
|
594
|
-
box.onResize(function () {
|
|
595
|
-
if (box.waiting == 1) fitWaitingIcon();
|
|
596
|
-
});
|
|
597
|
-
|
|
598
648
|
// THE MOUSE: hover, pressed, back to normal (render)
|
|
599
649
|
box.onHoverChange(function (self, isOver) {
|
|
600
650
|
isHover = isOver;
|
|
@@ -602,6 +652,9 @@ const SmartButton = function (params = {}) {
|
|
|
602
652
|
render();
|
|
603
653
|
});
|
|
604
654
|
box.on("mousedown", function (self, event) {
|
|
655
|
+
// WHY: a button clicked with the mouse kept the focus, and a later Enter pressed it again (a calculator that
|
|
656
|
+
// takes Enter as "=" pressed the clicked key too). The focus stays where it was.
|
|
657
|
+
event.preventDefault();
|
|
605
658
|
if (!canPress() || event.button !== 0) return; // WHY: a right click gives no click
|
|
606
659
|
isPressed = 1;
|
|
607
660
|
render();
|
|
@@ -612,13 +665,7 @@ const SmartButton = function (params = {}) {
|
|
|
612
665
|
render();
|
|
613
666
|
});
|
|
614
667
|
|
|
615
|
-
|
|
616
|
-
render();
|
|
617
|
-
|
|
618
|
-
if (box.waiting == 1) {
|
|
619
|
-
box.waiting = 0;
|
|
620
|
-
box.setWaiting(1);
|
|
621
|
-
}
|
|
668
|
+
if (box.waiting == 1) box.setWaiting(1);
|
|
622
669
|
|
|
623
670
|
return endObject(box);
|
|
624
671
|
|
|
@@ -628,6 +675,13 @@ const SmartButton = function (params = {}) {
|
|
|
628
675
|
|
|
629
676
|
SmartButton.askingButton = null; // the button that asks now (ask: one at a time)
|
|
630
677
|
|
|
678
|
+
// WHY one query for the page: render() asks it at every hover and press
|
|
679
|
+
SmartButton.isReducedMotion = function () {
|
|
680
|
+
if (!window.matchMedia) return false;
|
|
681
|
+
if (!SmartButton.reducedMotionQuery) SmartButton.reducedMotionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
682
|
+
return SmartButton.reducedMotionQuery.matches;
|
|
683
|
+
};
|
|
684
|
+
|
|
631
685
|
// 1: a dark color (the ripple is light on it). A color of the browser: "rgb(r, g, b)" or "rgba(r, g, b, a)".
|
|
632
686
|
// A transparent color is not dark (the page under it shows).
|
|
633
687
|
SmartButton.DARK_LIMIT = 0.45; // the brightness (0 - 1) under it a color is dark
|
|
@@ -658,181 +712,188 @@ SmartButton.injectCss = function () {
|
|
|
658
712
|
"@media (prefers-reduced-motion: reduce) { .smart-button-hand, .smart-button-dot { animation: none !important; } }");
|
|
659
713
|
};
|
|
660
714
|
|
|
661
|
-
// *** THE
|
|
662
|
-
//
|
|
715
|
+
// *** THE TEMPLATES (the shapes), all gray. A template is a style with only the keys that differ from the default
|
|
716
|
+
// (ozden); its color comes from a tone or from style. Every template has the default height (44).
|
|
717
|
+
SmartButton.WHITE_ICON = "brightness(0) invert(1)"; // a CSS filter: any icon file turns white
|
|
718
|
+
SmartButton.ROUND = 100; // pill, outlined: always round, at any height
|
|
719
|
+
SmartButton.EDGE_WIDTH = 2; // outlined: the edge and the line at its bottom
|
|
720
|
+
|
|
663
721
|
SmartButton.styles = {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
722
|
+
// (the buttons of _basic/examples/smart-button-3-ozden.htm)
|
|
723
|
+
ozden: SmartButtonDefaults.style, // an edge and a bottom line
|
|
724
|
+
ozden2: { box: { boxShadow: "none" } }, // only the edge
|
|
725
|
+
ozden3: { box: { borderColor: Black(0.1), boxShadow: "none" } }, // a faint edge
|
|
726
|
+
ozden4: { box: { color: White(0), border: 0, borderColor: "transparent", boxShadow: "none" } }, // a ghost
|
|
727
|
+
// ROUND (the buttons of _basic/examples/smart-button-alternatif.htm). WHY a smaller text
|
|
728
|
+
// and icon: they were 52 px high with a 30 px icon; now as high as the other buttons
|
|
729
|
+
pill: { // no edge, a bold text
|
|
730
|
+
layout: { gap: 10, padding: [18, 0] },
|
|
731
|
+
icon: { width: 26, height: 26, opacity: 1 },
|
|
732
|
+
label: { fontSize: 18, fontFamily: "opensans-bold" },
|
|
733
|
+
box: { border: 0, borderColor: "transparent", round: SmartButton.ROUND, boxShadow: "none" },
|
|
734
|
+
},
|
|
735
|
+
outlined: { // a thicker edge with a line at its bottom
|
|
736
|
+
layout: { gap: 8, padding: [14, 0] },
|
|
737
|
+
icon: { width: 26, height: 26, opacity: 1 },
|
|
738
|
+
label: { fontSize: 18 },
|
|
739
|
+
box: { border: SmartButton.EDGE_WIDTH, round: SmartButton.ROUND, boxShadow: "inset 0 -" + SmartButton.EDGE_WIDTH + "px 0 " + Black(0.35) },
|
|
675
740
|
},
|
|
676
741
|
};
|
|
677
742
|
|
|
678
|
-
// THE DARK
|
|
743
|
+
// THE DARK TEMPLATES (the draft _designs/smart-button-dark.htm): the shapes of ozden ... ozden4 with the
|
|
679
744
|
// colors of a dark page (the cards of Ozden Panel / Ozden Manager, #1A1A19). The icon turns white, the waiting clock
|
|
680
|
-
// is the dark one, the dots yellow; the ask stays
|
|
681
|
-
|
|
745
|
+
// is the dark one, the dots yellow; the ask stays orange.
|
|
746
|
+
// THE EDGE AND THE BOTTOM LINE: the edge of ozden in white and its 2 px line in white, a
|
|
747
|
+
// little fainter. A light tone on a dark template keeps them too.
|
|
748
|
+
// WHY 0.2 / 0.12 (0.35 / 0.2 were too bright on a dark page; a white edge on a dark page is
|
|
749
|
+
// much stronger than the same black on a light one): still twice the faint edge of ozden3Dark (0.1).
|
|
750
|
+
SmartButton.DARK_EDGE = White(0.2);
|
|
751
|
+
SmartButton.DARK_BOTTOM_LINE = "inset 0 -2px 0 " + White(0.12);
|
|
752
|
+
// boxKeys: only the keys of the box that differ from ozdenDark (as the light templates from ozden)
|
|
753
|
+
SmartButton.createDarkTemplate = function (boxKeys, hoverColor = "#383835") {
|
|
682
754
|
return {
|
|
755
|
+
box: Object.assign({ color: "#2E2E2C", borderColor: SmartButton.DARK_EDGE, boxShadow: SmartButton.DARK_BOTTOM_LINE }, boxKeys),
|
|
756
|
+
hover: { color: hoverColor },
|
|
757
|
+
label: { textColor: White(0.85) },
|
|
758
|
+
icon: { opacity: 0.85, filter: SmartButton.WHITE_ICON },
|
|
759
|
+
focus: { ringColor: "rgba(101, 162, 147, 0.75)" },
|
|
760
|
+
disabled: { color: "#232322", borderColor: White(0.06), textColor: White(0.28), iconOpacity: 0.25 },
|
|
761
|
+
press: { brightness: 0.88 },
|
|
762
|
+
waiting: { clock: "ozdenDark", dots: { color: "#F1C74A" } },
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
SmartButton.styles.ozdenDark = SmartButton.createDarkTemplate({}); // an edge and a bottom line
|
|
766
|
+
SmartButton.styles.ozden2Dark = SmartButton.createDarkTemplate({ boxShadow: "none" }); // only the edge
|
|
767
|
+
SmartButton.styles.ozden3Dark = SmartButton.createDarkTemplate({ borderColor: White(0.1), boxShadow: "none" }); // a faint edge: the 0.1 of ozden3 in white
|
|
768
|
+
SmartButton.styles.ozden4Dark = SmartButton.createDarkTemplate({ color: White(0), border: 0, borderColor: "transparent", boxShadow: "none" }, White(0.08)); // a ghost
|
|
769
|
+
|
|
770
|
+
// THE MINIMAL TEMPLATES (the draft _designs/minimal-theme.htm): small (28 px, a 13 px text, a 14 px icon) and made of
|
|
771
|
+
// lines: no fill, the edge gets darker under the mouse, a blue focus ring, a ring that waits. The main action takes the
|
|
772
|
+
// tone "ink" (inkDark on a dark page): the only filled button of the theme.
|
|
773
|
+
SmartButton.MINIMAL_DANGER = "#C24A36"; // the ask of the minimal templates (on light and dark windows: a white text)
|
|
774
|
+
SmartButton.createMinimalTemplate = function (colors) {
|
|
775
|
+
const danger = SmartButton.MINIMAL_DANGER;
|
|
776
|
+
return {
|
|
777
|
+
height: 28,
|
|
683
778
|
style: {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
focus: { ringColor:
|
|
690
|
-
disabled: { color: "
|
|
691
|
-
press: {
|
|
692
|
-
waiting: {
|
|
779
|
+
layout: { gap: 6, padding: [10, 0], iconSideTrim: 0 },
|
|
780
|
+
icon: { width: 14, height: 14, opacity: 1, filter: colors.iconFilter },
|
|
781
|
+
label: { fontSize: 13, textColor: colors.text },
|
|
782
|
+
box: { color: "transparent", border: 1, borderColor: colors.line, round: 4, boxShadow: "none" },
|
|
783
|
+
hover: { color: "transparent", borderColor: colors.lineHover },
|
|
784
|
+
focus: { ringColor: colors.focus },
|
|
785
|
+
disabled: { color: "transparent", borderColor: colors.disabledLine, textColor: colors.disabledText, iconOpacity: 0.4 },
|
|
786
|
+
press: { scale: 0.97, brightness: 1 },
|
|
787
|
+
waiting: { clock: colors.clock, contentOpacity: 0.12, clockSize: 16, space: 6 },
|
|
788
|
+
ask: {
|
|
789
|
+
button: { color: danger, borderColor: danger, boxShadow: "none", textColor: "white", iconFilter: SmartButton.WHITE_ICON },
|
|
790
|
+
bubble: { color: danger, textColor: "white", fontSize: 12, bold: 0, round: 4, padding: [8, 4], border: 0, borderColor: "", shadow: "none", arrow: 8, gap: 4, edge: 6 },
|
|
791
|
+
},
|
|
693
792
|
},
|
|
694
|
-
waitingClock: "ozdenDark",
|
|
695
793
|
};
|
|
696
794
|
};
|
|
697
|
-
SmartButton.styles.
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
//
|
|
706
|
-
|
|
707
|
-
SmartButton.
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
795
|
+
SmartButton.styles.minimal = SmartButton.createMinimalTemplate({
|
|
796
|
+
text: Black(0.85), line: Black(0.2), lineHover: Black(0.45), focus: "#3D8BD9",
|
|
797
|
+
disabledLine: Black(0.08), disabledText: Black(0.34), iconFilter: "none", clock: "minimal",
|
|
798
|
+
});
|
|
799
|
+
SmartButton.styles.minimalDark = SmartButton.createMinimalTemplate({
|
|
800
|
+
text: White(0.88), line: White(0.18), lineHover: White(0.42), focus: "#7FB6DE",
|
|
801
|
+
disabledLine: White(0.07), disabledText: White(0.35), iconFilter: SmartButton.WHITE_ICON, clock: "minimalDark",
|
|
802
|
+
});
|
|
803
|
+
// A delete in the minimal theme: the line and the text in the danger color (the line half of it, all of it under the
|
|
804
|
+
// mouse). The icon keeps the color of its file: give it an icon drawn in the danger color.
|
|
805
|
+
SmartButton.styles.minimalDanger = SmartButton.createMinimalTemplate({
|
|
806
|
+
text: "#C24A36", line: "rgba(194, 74, 54, 0.5)", lineHover: "#C24A36", focus: "#3D8BD9",
|
|
807
|
+
disabledLine: Black(0.08), disabledText: Black(0.34), iconFilter: "none", clock: "minimal",
|
|
808
|
+
});
|
|
809
|
+
SmartButton.styles.minimalDangerDark = SmartButton.createMinimalTemplate({
|
|
810
|
+
text: "#FF9F93", line: "rgba(255, 159, 147, 0.5)", lineHover: "#FF9F93", focus: "#7FB6DE",
|
|
811
|
+
disabledLine: White(0.07), disabledText: White(0.35), iconFilter: "none", clock: "minimalDark",
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
// *** THE TONES: the colors of the kit, with simple color names; a tone for a dark page ends
|
|
815
|
+
// with "Dark". A tone is three colors: the button, the button under the mouse and its text (DARK_TEXT, or LIGHT_TEXT:
|
|
816
|
+
// it turns the icon white too). The light ones are white and the colors of the situations (chosen on the draft
|
|
817
|
+
// _designs/smart-button-colors.htm). Any other color: style (Ex: _basic/examples/smart-button-alternatif.htm).
|
|
818
|
+
SmartButton.DARK_TEXT = Black(0.75);
|
|
819
|
+
SmartButton.LIGHT_TEXT = White(0.9);
|
|
820
|
+
SmartButton.tones = {
|
|
821
|
+
white: { color: "white", hover: "whitesmoke", text: SmartButton.DARK_TEXT },
|
|
822
|
+
cyan: { color: "#5BBAC1", hover: "#50AEB5", text: SmartButton.DARK_TEXT }, // the main action: Save, Send
|
|
823
|
+
orange: { color: "#DE815B", hover: "#D4724B", text: SmartButton.DARK_TEXT }, // a delete, a reject
|
|
824
|
+
yellow: { color: "#F1C74A", hover: "#E6BB3C", text: SmartButton.DARK_TEXT }, // go on, but look first
|
|
825
|
+
green: { color: "#7BC362", hover: "#70B756", text: SmartButton.DARK_TEXT }, // after a good result: Done
|
|
826
|
+
blue: { color: "#52A8D0", hover: "#479CC4", text: SmartButton.DARK_TEXT }, // nothing changes: Details, Help
|
|
827
|
+
// For a dark page: the same colors, 45 % over the dark card #1A1A19 (53 % under the mouse); chosen by the user on
|
|
828
|
+
// the draft _designs/smart-button2-dark-tones.htm.
|
|
829
|
+
// WHY 45 %: the light text reads on every one of them (contrast 4.8 - 6.7; 4.5 is enough)
|
|
830
|
+
cyanDark: { color: "#376265", hover: "#3C6F72", text: SmartButton.LIGHT_TEXT },
|
|
831
|
+
orangeDark: { color: "#724837", hover: "#82513C", text: SmartButton.LIGHT_TEXT },
|
|
832
|
+
yellowDark: { color: "#7B682F", hover: "#8C7633", text: SmartButton.LIGHT_TEXT },
|
|
833
|
+
greenDark: { color: "#46663A", hover: "#4D7440", text: SmartButton.LIGHT_TEXT },
|
|
834
|
+
blueDark: { color: "#335A6B", hover: "#38657A", text: SmartButton.LIGHT_TEXT },
|
|
835
|
+
// The main action of the minimal templates (the ink of the theme). edge / hoverEdge: the edge in the color of the
|
|
836
|
+
// button (a line of the template around a filled button looked like a frame)
|
|
837
|
+
ink: { color: "#1F1F1F", hover: "#3A3A3A", text: SmartButton.LIGHT_TEXT, edge: "#1F1F1F", hoverEdge: "#3A3A3A" },
|
|
838
|
+
inkDark: { color: "#EDEDEB", hover: "#FFFFFF", text: "#1A1A19", edge: "#EDEDEB", hoverEdge: "#FFFFFF" },
|
|
725
839
|
};
|
|
726
840
|
|
|
727
|
-
//
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
hover: { color: tone.solidHover },
|
|
735
|
-
active: { color: tone.solidHover },
|
|
736
|
-
label: { textColor: textColor },
|
|
737
|
-
icon: { opacity: isWhiteText ? 1 : 0.8, filter: isWhiteText ? "brightness(0) invert(1)" : "none" },
|
|
738
|
-
};
|
|
739
|
-
},
|
|
740
|
-
ozdenType4: function (tone) {
|
|
741
|
-
return {
|
|
742
|
-
hover: { color: tone.tint },
|
|
743
|
-
active: { color: tone.tint },
|
|
744
|
-
label: { textColor: tone.deep },
|
|
745
|
-
};
|
|
746
|
-
},
|
|
747
|
-
pill: function (tone) {
|
|
748
|
-
return {
|
|
749
|
-
box: { color: tone.tint },
|
|
750
|
-
hover: { color: tone.hover },
|
|
751
|
-
active: { color: tone.hover },
|
|
752
|
-
label: { textColor: tone.pillText || tone.color },
|
|
753
|
-
};
|
|
754
|
-
},
|
|
755
|
-
pillSolid: function (tone) {
|
|
756
|
-
return {
|
|
757
|
-
box: { color: tone.color },
|
|
758
|
-
hover: { color: tone.solidHover },
|
|
759
|
-
active: { color: tone.solidHover },
|
|
760
|
-
label: { textColor: tone.onColor || "white" },
|
|
761
|
-
};
|
|
762
|
-
},
|
|
763
|
-
outlined: function (tone) {
|
|
764
|
-
return {
|
|
765
|
-
box: { color: tone.tint, borderColor: tone.color, boxShadow: "inset 0 -" + SmartButton.EDGE_WIDTH + "px 0 " + tone.color },
|
|
766
|
-
hover: { color: tone.hover },
|
|
767
|
-
active: { color: tone.hover },
|
|
768
|
-
label: { textColor: tone.deep },
|
|
769
|
-
};
|
|
770
|
-
},
|
|
841
|
+
// THE LOOK, the one place of its order: style > tone > the template (styleName) > the defaults. It fills params.style
|
|
842
|
+
// and returns params (getTemplateColors reads a template with it too).
|
|
843
|
+
SmartButton.applyLook = function (params) {
|
|
844
|
+
SmartButton.applyTone(params);
|
|
845
|
+
basic.applyStylePackage(params, SmartButton.styles, SmartButtonDefaults);
|
|
846
|
+
mergeIntoIfMissing(params.style, SmartButtonDefaults.style);
|
|
847
|
+
return params;
|
|
771
848
|
};
|
|
772
849
|
|
|
850
|
+
// A tone as a style. No tone: the colors of the template (setTone("") makes a button gray again).
|
|
773
851
|
SmartButton.getToneStyle = function (toneName, styleName) {
|
|
774
|
-
|
|
852
|
+
if (!toneName) return SmartButton.getTemplateColors(styleName);
|
|
853
|
+
const tone = SmartButton.tones[toneName];
|
|
775
854
|
if (!tone) {
|
|
776
855
|
console.warn("SmartButton: tone not found: " + toneName);
|
|
777
856
|
return {};
|
|
778
857
|
}
|
|
779
|
-
|
|
780
|
-
|
|
858
|
+
// WHY the icon: an icon file is drawn dark; with a light text it turns white
|
|
859
|
+
const isLightText = (tone.text === SmartButton.LIGHT_TEXT);
|
|
860
|
+
const toneStyle = {
|
|
861
|
+
box: { color: tone.color },
|
|
862
|
+
hover: { color: tone.hover },
|
|
863
|
+
label: { textColor: tone.text },
|
|
864
|
+
icon: { filter: isLightText ? SmartButton.WHITE_ICON : "none" },
|
|
865
|
+
};
|
|
866
|
+
if (tone.edge) {
|
|
867
|
+
toneStyle.box.borderColor = tone.edge;
|
|
868
|
+
toneStyle.hover.borderColor = tone.hoverEdge || tone.edge;
|
|
869
|
+
}
|
|
870
|
+
return toneStyle;
|
|
781
871
|
};
|
|
782
872
|
|
|
783
|
-
// The
|
|
784
|
-
SmartButton.
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
873
|
+
// The colors of a template: the button, the button under the mouse, its text and its icon
|
|
874
|
+
SmartButton.getTemplateColors = function (styleName) {
|
|
875
|
+
const template = SmartButton.applyLook({ styleName: styleName }).style;
|
|
876
|
+
return {
|
|
877
|
+
box: { color: template.box.color },
|
|
878
|
+
hover: { color: template.hover.color },
|
|
879
|
+
label: { textColor: template.label.textColor },
|
|
880
|
+
icon: { filter: template.icon.filter },
|
|
881
|
+
};
|
|
790
882
|
};
|
|
791
883
|
|
|
792
|
-
// The tone goes under
|
|
884
|
+
// The tone goes under the style of the page, so a color the page gives still wins.
|
|
885
|
+
// WHY a new object: params.style can be a template given as it is (style: SmartButton.styles.ozden2)
|
|
793
886
|
SmartButton.applyTone = function (params) {
|
|
794
887
|
if (!params.tone) return;
|
|
795
|
-
const styleName = params.styleName || SmartButtonDefaults.styleName;
|
|
796
888
|
const ownStyle = {};
|
|
797
889
|
mergeIntoIfMissing(ownStyle, params.style || {});
|
|
798
|
-
mergeIntoIfMissing(ownStyle, SmartButton.getToneStyle(params.tone
|
|
890
|
+
mergeIntoIfMissing(ownStyle, SmartButton.getToneStyle(params.tone));
|
|
799
891
|
params.style = ownStyle;
|
|
800
892
|
};
|
|
801
893
|
|
|
802
|
-
// THE SITUATION PACKAGES: ozdenType1 (an edge and a bottom line) in the color of a situation.
|
|
803
|
-
["primary", "danger", "warning", "success", "info"].forEach(function (toneName) {
|
|
804
|
-
SmartButton.styles[toneName] = SmartButton.toneLooks.filled(SmartButton.TONES[toneName]);
|
|
805
|
-
});
|
|
806
|
-
|
|
807
|
-
// THE PILL AND OUTLINED SHAPES (the user: the buttons of _basic/examples/smart-button.htm): gray without a tone.
|
|
808
|
-
SmartButton.PILL_ROUND = 100; // always round, at any height
|
|
809
|
-
SmartButton.EDGE_WIDTH = 2; // outlined: the edge and the bottom line on it
|
|
810
|
-
|
|
811
|
-
SmartButton.PILL_SHAPE = {
|
|
812
|
-
layout: { gap: 12, padding: [22, 11] },
|
|
813
|
-
icon: { width: 30, height: 30, opacity: 1 },
|
|
814
|
-
label: { fontFamily: "opensans-bold" },
|
|
815
|
-
box: { border: 0, borderColor: "transparent", round: SmartButton.PILL_ROUND, boxShadow: "none" },
|
|
816
|
-
};
|
|
817
|
-
SmartButton.OUTLINED_SHAPE = {
|
|
818
|
-
layout: { gap: 8, padding: [16, 9] },
|
|
819
|
-
icon: { width: 30, height: 30, opacity: 1 },
|
|
820
|
-
label: { fontFamily: "opensans" },
|
|
821
|
-
box: { border: SmartButton.EDGE_WIDTH, round: SmartButton.PILL_ROUND },
|
|
822
|
-
};
|
|
823
|
-
SmartButton.createShapePackage = function (shape, look) {
|
|
824
|
-
const shapePackage = {};
|
|
825
|
-
mergeIntoIfMissing(shapePackage, look);
|
|
826
|
-
mergeIntoIfMissing(shapePackage, shape);
|
|
827
|
-
return shapePackage;
|
|
828
|
-
};
|
|
829
|
-
SmartButton.styles.pill = SmartButton.createShapePackage(SmartButton.PILL_SHAPE, SmartButton.toneLooks.pill(SmartButton.TONES.gray));
|
|
830
|
-
SmartButton.styles.pillSolid = SmartButton.createShapePackage(SmartButton.PILL_SHAPE, SmartButton.toneLooks.pillSolid(SmartButton.TONES.gray));
|
|
831
|
-
SmartButton.styles.outlined = SmartButton.createShapePackage(SmartButton.OUTLINED_SHAPE, SmartButton.toneLooks.outlined(SmartButton.TONES.gray));
|
|
832
|
-
|
|
833
894
|
// *** THE WAITING DRAWINGS: the clock and the dots (comp/loading-screen.js uses them too)
|
|
834
895
|
|
|
835
|
-
// The clocks of the waiting views with moving hands
|
|
896
|
+
// The clocks of the waiting views with moving hands. The sizes are px on a 30 px clock.
|
|
836
897
|
SmartButton.clocks = {
|
|
837
898
|
ozden: { // a white face, dark lines
|
|
838
899
|
faceColor: "#FFFFFF",
|
|
@@ -849,7 +910,7 @@ SmartButton.clocks = {
|
|
|
849
910
|
hourTurn: 19.2, // seconds for one turn of the hour hand (12 x minuteTurn: a real clock)
|
|
850
911
|
},
|
|
851
912
|
};
|
|
852
|
-
// a dark face, light lines; WHY yellow
|
|
913
|
+
// a dark face, light lines; WHY yellow: indianred was weak on the dark face (contrast 3.6,
|
|
853
914
|
// #F1C74A 8.9); the hour hand is dimmer, so the yellow minute hand leads (as the red one on the light clock)
|
|
854
915
|
SmartButton.clocks.ozdenDark = Object.assign({}, SmartButton.clocks.ozden, {
|
|
855
916
|
faceColor: "#2A2A2A",
|
|
@@ -859,10 +920,22 @@ SmartButton.clocks.ozdenDark = Object.assign({}, SmartButton.clocks.ozden, {
|
|
|
859
920
|
centerColor: "#F1C74A",
|
|
860
921
|
});
|
|
861
922
|
|
|
923
|
+
// The waiting ring of the minimal templates: a faint circle and a quarter arc turning on it, in the color of the text
|
|
924
|
+
// (isRing: SmartButton.createRingSvg draws it in place of a clock).
|
|
925
|
+
SmartButton.clocks.minimal = {
|
|
926
|
+
isRing: 1,
|
|
927
|
+
lineColor: Black(0.85),
|
|
928
|
+
edgeWidth: 3, // on the 30 px drawing (1.6 px at 16 px)
|
|
929
|
+
trackOpacity: 0.2, // the circle under the arc
|
|
930
|
+
turnTime: 0.8, // seconds for one turn of the arc
|
|
931
|
+
};
|
|
932
|
+
SmartButton.clocks.minimalDark = Object.assign({}, SmartButton.clocks.minimal, { lineColor: White(0.88) });
|
|
933
|
+
|
|
862
934
|
// The clock as an SVG text (as wide as its box): a face with an edge, the minute hand up, the hour hand to the right.
|
|
863
935
|
SmartButton.CLOCK_SIZE = 30; // the px of the drawing
|
|
864
936
|
SmartButton.createClockSvg = function (clockStyle) {
|
|
865
937
|
SmartButton.injectCss();
|
|
938
|
+
if (clockStyle.isRing) return SmartButton.createRingSvg(clockStyle);
|
|
866
939
|
const c = clockStyle;
|
|
867
940
|
const size = SmartButton.CLOCK_SIZE;
|
|
868
941
|
const middle = size / 2;
|
|
@@ -879,6 +952,18 @@ SmartButton.createClockSvg = function (clockStyle) {
|
|
|
879
952
|
"</svg>";
|
|
880
953
|
};
|
|
881
954
|
|
|
955
|
+
// A ring that waits: a faint circle and a quarter arc turning on it (the turn of the hands of the clock)
|
|
956
|
+
SmartButton.createRingSvg = function (ring) {
|
|
957
|
+
const size = SmartButton.CLOCK_SIZE;
|
|
958
|
+
const middle = size / 2;
|
|
959
|
+
const radius = middle - ring.edgeWidth / 2;
|
|
960
|
+
const arc = "M" + middle + " " + (middle - radius) + " A" + radius + " " + radius + " 0 0 1 " + (middle + radius) + " " + middle;
|
|
961
|
+
return '<svg viewBox="0 0 ' + size + ' ' + size + '" width="100%" height="100%" aria-hidden="true" style="display: block">' +
|
|
962
|
+
'<circle cx="' + middle + '" cy="' + middle + '" r="' + radius + '" fill="none" stroke="' + ring.lineColor + '" stroke-opacity="' + ring.trackOpacity + '" stroke-width="' + ring.edgeWidth + '"/>' +
|
|
963
|
+
'<path class="smart-button-hand" d="' + arc + '" fill="none" stroke="' + ring.lineColor + '" stroke-width="' + ring.edgeWidth + '" stroke-linecap="round" style="animation-duration: ' + ring.turnTime + 's"/>' +
|
|
964
|
+
"</svg>";
|
|
965
|
+
};
|
|
966
|
+
|
|
882
967
|
// GROUP: Three dots that grow one after the other. dots: { size, gap, color }
|
|
883
968
|
SmartButton.DOT_COUNT = 3;
|
|
884
969
|
SmartButton.DOT_TIME = 1.2; // seconds for one bounce of a dot
|