@nativescript-community/ui-toolbar 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE +201 -0
- package/README.md +213 -2
- package/index-common.d.ts +45 -0
- package/index-common.js +33 -0
- package/index-common.js.map +1 -0
- package/index.android.d.ts +23 -0
- package/index.android.js +126 -0
- package/index.android.js.map +1 -0
- package/index.d.ts +30 -0
- package/index.ios.d.ts +21 -0
- package/index.ios.js +101 -0
- package/index.ios.js.map +1 -0
- package/package.json +49 -5
- package/platforms/android/native-api-usage.json +12 -0
- package/platforms/ios/native-api-usage.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 1.0.0 (2026-10-18)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* native-api-usage.json for every package on Android and iOS ([cfd7dcc](https://github.com/nativescript-community/ui-native-components/commit/cfd7dcc4b996b02319cfacee233bc56c29df70e4))
|
|
11
|
+
* **toolbar:** add ui-toolbar (MaterialToolbar / UINavigationBar) with sys, font and spans icons ([43116c6](https://github.com/nativescript-community/ui-native-components/commit/43116c6194b5e80f32a853ef8e68be84bf93a101))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,214 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
|
|
2
|
+
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
3
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
4
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
5
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
6
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
7
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
8
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
9
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
10
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
11
|
+
DO NOT EDIT THIS READEME DIRECTLY! Edit "bluesprint.md" instead.
|
|
12
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
13
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
14
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
15
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
16
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
17
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
18
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
19
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
20
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
21
|
+
<h1 align="center">@nativescript-community/ui-toolbar</h1>
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://npmcharts.com/compare/@nativescript-community/ui-toolbar?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/@nativescript-community/ui-toolbar.svg" height="20"/></a>
|
|
24
|
+
<a href="https://www.npmjs.com/package/@nativescript-community/ui-toolbar"><img alt="NPM Version" src="https://img.shields.io/npm/v/@nativescript-community/ui-toolbar.svg" height="20"/></a>
|
|
25
|
+
</p>
|
|
2
26
|
|
|
3
|
-
|
|
27
|
+
<p align="center">
|
|
28
|
+
<b>Toolbar with a title, a navigation icon, action items and an overflow menu: Material 3 MaterialToolbar on Android, UINavigationBar (glass bar buttons on iOS 26) on iOS.</b></br>
|
|
29
|
+
<sub><sub>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<br />
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
| iOS | Android |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| <img src="https://github.com/nativescript-community/ui-native-components/raw/master/images/ui-toolbar-ios.png" height="500" /> | <img src="https://github.com/nativescript-community/ui-native-components/raw/master/images/ui-toolbar-android.png" height="500" /> |
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
[](#table-of-contents)
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
|
|
44
|
+
* [Installation](#installation)
|
|
45
|
+
* [Usage](#usage)
|
|
46
|
+
* [API](#api)
|
|
47
|
+
* [Demos and Development](#demos-and-development)
|
|
48
|
+
* [Repo Setup](#repo-setup)
|
|
49
|
+
* [Build](#build)
|
|
50
|
+
* [Demos](#demos)
|
|
51
|
+
* [Contributing](#contributing)
|
|
52
|
+
* [Update repo ](#update-repo-)
|
|
53
|
+
* [Update readme ](#update-readme-)
|
|
54
|
+
* [Update doc ](#update-doc-)
|
|
55
|
+
* [Publish](#publish)
|
|
56
|
+
* [modifying submodules](#modifying-submodules)
|
|
57
|
+
* [Questions](#questions)
|
|
58
|
+
|
|
59
|
+
| Android | iOS |
|
|
60
|
+
|---|---|
|
|
61
|
+
| Material 3 `MaterialToolbar` | `UINavigationBar` used as a view: its bar buttons are in Liquid Glass capsules on iOS 26 |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
[](#installation)
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install @nativescript-community/ui-toolbar
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The Android components use **Material 3**: see the [repository README](https://github.com/nativescript-community/ui-native-components#installation) for the theme.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
[](#usage)
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
```xml
|
|
80
|
+
<GridLayout rows="auto,*">
|
|
81
|
+
<Toolbar title="Inbox" subtitle="3 unread" navigationIcon="sys://chevron.left" items="items" navigationTap="onBack" itemTap="onItem" />
|
|
82
|
+
<!-- the content -->
|
|
83
|
+
</GridLayout>
|
|
84
|
+
```
|
|
85
|
+
```ts
|
|
86
|
+
const items = [
|
|
87
|
+
{ id: 'search', title: 'Search', icon: 'sys://magnifyingglass', androidIcon: 'res://ic_search' },
|
|
88
|
+
{ id: 'font', title: 'Font icon', icon: 'font://' },
|
|
89
|
+
{ id: 'settings', title: 'Settings', showAsAction: 'never' }
|
|
90
|
+
];
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
[](#api)
|
|
95
|
+
|
|
96
|
+
## API
|
|
97
|
+
|
|
98
|
+
| Property | |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `title`, `subtitle` | the title (centered on iOS, `centerTitle` on Android) |
|
|
101
|
+
| `navigationIcon` | icon at the start: back, menu, close... |
|
|
102
|
+
| `items` | the actions (below) |
|
|
103
|
+
| `color` | color of the title and of the icons |
|
|
104
|
+
| `background-color` | background of the bar. Android: `colorSurface` by default |
|
|
105
|
+
| events `navigationTap`, `itemTap` (`event.item`) | |
|
|
106
|
+
|
|
107
|
+
An item: `id`, `title`, `icon`, `androidIcon`, `iosIcon`, `showAsAction` (`always`, `ifRoom`, `never`), `disabled`, `onTap`.
|
|
108
|
+
`showAsAction: 'never'` puts the item in the overflow menu (the `ellipsis` button on iOS).
|
|
109
|
+
|
|
110
|
+
An icon can be:
|
|
111
|
+
* `res://name` or a file path
|
|
112
|
+
* `sys://name`: an SF Symbol (iOS)
|
|
113
|
+
* `font://code`: a glyph of the `font-family` of the toolbar (a template image on iOS, tinted by the bar)
|
|
114
|
+
* an `ImageSource`
|
|
115
|
+
* a `FormattedString` (spans, with `@nativescript-community/text` when it is installed): drawn into an icon that keeps the colors of its spans
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
[](#demos-and-development)
|
|
119
|
+
|
|
120
|
+
## Demos and Development
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Repo Setup
|
|
124
|
+
|
|
125
|
+
The repo uses submodules. If you did not clone with ` --recursive` then you need to call
|
|
126
|
+
```
|
|
127
|
+
git submodule update --init
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work.
|
|
131
|
+
|
|
132
|
+
To develop and test:
|
|
133
|
+
if you use `yarn` then run `yarn`
|
|
134
|
+
if you use `pnpm` then run `pnpm i`
|
|
135
|
+
|
|
136
|
+
**Interactive Menu:**
|
|
137
|
+
|
|
138
|
+
To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts.
|
|
139
|
+
|
|
140
|
+
### Build
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm run build.all
|
|
144
|
+
```
|
|
145
|
+
WARNING: it seems `yarn build.all` wont always work (not finding binaries in `node_modules/.bin`) which is why the doc explicitly uses `npm run`
|
|
146
|
+
|
|
147
|
+
### Demos
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm run demo.[ng|react|svelte|vue].[ios|android]
|
|
151
|
+
|
|
152
|
+
npm run demo.svelte.ios # Example
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Demo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in `demo-[ng|react|svelte|vue]`
|
|
156
|
+
Instead you work in `demo-snippets/[ng|react|svelte|vue]`
|
|
157
|
+
You can start from the `install.ts` of each flavor to see how to register new demos
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
[](#contributing)
|
|
161
|
+
|
|
162
|
+
## Contributing
|
|
163
|
+
|
|
164
|
+
### Update repo
|
|
165
|
+
|
|
166
|
+
You can update the repo files quite easily
|
|
167
|
+
|
|
168
|
+
First update the submodules
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
npm run update
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Then commit the changes
|
|
175
|
+
Then update common files
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm run sync
|
|
179
|
+
```
|
|
180
|
+
Then you can run `yarn|pnpm`, commit changed files if any
|
|
181
|
+
|
|
182
|
+
### Update readme
|
|
183
|
+
```bash
|
|
184
|
+
npm run readme
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Update doc
|
|
188
|
+
```bash
|
|
189
|
+
npm run doc
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Publish
|
|
193
|
+
|
|
194
|
+
The publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release)
|
|
195
|
+
Simply run
|
|
196
|
+
```shell
|
|
197
|
+
npm run publish
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### modifying submodules
|
|
201
|
+
|
|
202
|
+
The repo uses https:// for submodules which means you won't be able to push directly into the submodules.
|
|
203
|
+
One easy solution is t modify `~/.gitconfig` and add
|
|
204
|
+
```
|
|
205
|
+
[url "ssh://git@github.com/"]
|
|
206
|
+
pushInsteadOf = https://github.com/
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
[](#questions)
|
|
211
|
+
|
|
212
|
+
## Questions
|
|
213
|
+
|
|
214
|
+
If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FormattedString, ImageSource, Property, View } from '@nativescript/core';
|
|
2
|
+
export type ToolbarShowAsAction = 'always' | 'ifRoom' | 'never';
|
|
3
|
+
/**
|
|
4
|
+
* An action of the toolbar
|
|
5
|
+
*/
|
|
6
|
+
export interface ToolbarItem {
|
|
7
|
+
id?: string | number;
|
|
8
|
+
title?: string;
|
|
9
|
+
/** `res://name`, a file path, `sys://name` (SF Symbol, iOS only), `font://code` (a glyph of the font-family of the toolbar), an ImageSource or a FormattedString (spans, as with `@nativescript-community/text`, drawn into an icon) */
|
|
10
|
+
icon?: string | ImageSource | FormattedString;
|
|
11
|
+
/** icon used on Android instead of `icon` */
|
|
12
|
+
androidIcon?: string | ImageSource | FormattedString;
|
|
13
|
+
/** icon used on iOS instead of `icon` */
|
|
14
|
+
iosIcon?: string | ImageSource | FormattedString;
|
|
15
|
+
/**
|
|
16
|
+
* `always` (default when there is an icon): shown in the bar. `ifRoom`: same, Android moves it to the overflow when there is no room.
|
|
17
|
+
* `never`: in the overflow menu (a menu on the trailing `ellipsis` button on iOS)
|
|
18
|
+
*/
|
|
19
|
+
showAsAction?: ToolbarShowAsAction;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
onTap?: (item: ToolbarItem) => void;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
export declare const itemTapEvent = "itemTap";
|
|
25
|
+
export declare const navigationTapEvent = "navigationTap";
|
|
26
|
+
/**
|
|
27
|
+
* Toolbar for a custom action bar: title, navigation icon and actions.
|
|
28
|
+
* Android: Material 3 MaterialToolbar. iOS: a UINavigationBar used as a view (its bar buttons are glass on iOS 26).
|
|
29
|
+
*/
|
|
30
|
+
export declare abstract class ToolbarBase extends View {
|
|
31
|
+
static itemTapEvent: string;
|
|
32
|
+
static navigationTapEvent: string;
|
|
33
|
+
title: string;
|
|
34
|
+
subtitle: string;
|
|
35
|
+
navigationIcon: string | ImageSource | FormattedString;
|
|
36
|
+
items: ToolbarItem[];
|
|
37
|
+
centerTitle: boolean;
|
|
38
|
+
protected notifyItemTap(item: ToolbarItem): void;
|
|
39
|
+
protected notifyNavigationTap(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare const titleProperty: Property<ToolbarBase, string>;
|
|
42
|
+
export declare const subtitleProperty: Property<ToolbarBase, string>;
|
|
43
|
+
export declare const navigationIconProperty: Property<ToolbarBase, string | ImageSource | FormattedString>;
|
|
44
|
+
export declare const itemsProperty: Property<ToolbarBase, ToolbarItem[]>;
|
|
45
|
+
export declare const centerTitleProperty: Property<ToolbarBase, boolean>;
|
package/index-common.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CSSType, Property, View } from '@nativescript/core';
|
|
2
|
+
export const itemTapEvent = 'itemTap';
|
|
3
|
+
export const navigationTapEvent = 'navigationTap';
|
|
4
|
+
/**
|
|
5
|
+
* Toolbar for a custom action bar: title, navigation icon and actions.
|
|
6
|
+
* Android: Material 3 MaterialToolbar. iOS: a UINavigationBar used as a view (its bar buttons are glass on iOS 26).
|
|
7
|
+
*/
|
|
8
|
+
let ToolbarBase = class ToolbarBase extends View {
|
|
9
|
+
notifyItemTap(item) {
|
|
10
|
+
item.onTap?.(item);
|
|
11
|
+
this.notify({ eventName: itemTapEvent, object: this, item });
|
|
12
|
+
}
|
|
13
|
+
notifyNavigationTap() {
|
|
14
|
+
this.notify({ eventName: navigationTapEvent, object: this });
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
ToolbarBase.itemTapEvent = itemTapEvent;
|
|
18
|
+
ToolbarBase.navigationTapEvent = navigationTapEvent;
|
|
19
|
+
ToolbarBase = __decorate([
|
|
20
|
+
CSSType('Toolbar')
|
|
21
|
+
], ToolbarBase);
|
|
22
|
+
export { ToolbarBase };
|
|
23
|
+
export const titleProperty = new Property({ name: 'title', defaultValue: '' });
|
|
24
|
+
titleProperty.register(ToolbarBase);
|
|
25
|
+
export const subtitleProperty = new Property({ name: 'subtitle', defaultValue: '' });
|
|
26
|
+
subtitleProperty.register(ToolbarBase);
|
|
27
|
+
export const navigationIconProperty = new Property({ name: 'navigationIcon' });
|
|
28
|
+
navigationIconProperty.register(ToolbarBase);
|
|
29
|
+
export const itemsProperty = new Property({ name: 'items' });
|
|
30
|
+
itemsProperty.register(ToolbarBase);
|
|
31
|
+
export const centerTitleProperty = new Property({ name: 'centerTitle', defaultValue: false, valueConverter: (v) => v === true || v === 'true' });
|
|
32
|
+
centerTitleProperty.register(ToolbarBase);
|
|
33
|
+
//# sourceMappingURL=index-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-common.js","sourceRoot":"","sources":["../../src/ui-toolbar/index-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgC,QAAQ,EAAE,IAAI,EAAE,MAAM,oBAAoB,C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E,CAAC,CAAC;AACzF,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,QAAQ,CAAuB,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;AAC5K,mBAAmB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Color, FormattedString, ImageSource, colorProperty } from '@nativescript/core';
|
|
2
|
+
import { ToolbarBase, ToolbarItem, centerTitleProperty, itemsProperty, navigationIconProperty, subtitleProperty, titleProperty } from './index-common';
|
|
3
|
+
export * from './index-common';
|
|
4
|
+
type Icon = string | ImageSource | FormattedString;
|
|
5
|
+
/**
|
|
6
|
+
* Android: Material 3 MaterialToolbar. The actions are the menu of the toolbar, those with `showAsAction: 'never'` are in the overflow menu.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Toolbar extends ToolbarBase {
|
|
9
|
+
[titleProperty.setNative]: (value: string) => void;
|
|
10
|
+
[subtitleProperty.setNative]: (value: string) => void;
|
|
11
|
+
[centerTitleProperty.setNative]: (value: boolean) => void;
|
|
12
|
+
[navigationIconProperty.setNative]: (value: Icon) => void;
|
|
13
|
+
[itemsProperty.setNative]: (value: ToolbarItem[]) => void;
|
|
14
|
+
[colorProperty.setNative]: (value: Color) => void;
|
|
15
|
+
nativeViewProtected: com.google.android.material.appbar.MaterialToolbar;
|
|
16
|
+
private mColor;
|
|
17
|
+
createNativeView(): com.google.android.material.appbar.MaterialToolbar;
|
|
18
|
+
initNativeView(): void;
|
|
19
|
+
disposeNativeView(): void;
|
|
20
|
+
private tint;
|
|
21
|
+
private updateItems;
|
|
22
|
+
private updateNavigationIcon;
|
|
23
|
+
}
|
package/index.android.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Color, Font, FormattedString, ImageSource, Utils, colorProperty } from '@nativescript/core';
|
|
2
|
+
import { renderFormattedTextToImageSource } from '@nativescript-community/ui-core/formatted-text';
|
|
3
|
+
import { ToolbarBase, centerTitleProperty, itemsProperty, navigationIconProperty, subtitleProperty, titleProperty } from './index-common';
|
|
4
|
+
export * from './index-common';
|
|
5
|
+
function toDrawable(icon, font, color) {
|
|
6
|
+
if (!icon) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
let source;
|
|
10
|
+
if (icon instanceof FormattedString) {
|
|
11
|
+
source = renderFormattedTextToImageSource(icon, undefined);
|
|
12
|
+
}
|
|
13
|
+
else if (icon instanceof ImageSource) {
|
|
14
|
+
source = icon;
|
|
15
|
+
}
|
|
16
|
+
else if (Utils.isFontIconURI(icon)) {
|
|
17
|
+
// an icon font glyph, drawn with the font-family and the color of the toolbar
|
|
18
|
+
source = ImageSource.fromFontIconCodeSync(icon.split('//')[1], (font || Font.default).withFontSize(24), color || new Color('black'));
|
|
19
|
+
}
|
|
20
|
+
else if (icon.startsWith(Utils.RESOURCE_PREFIX)) {
|
|
21
|
+
source = ImageSource.fromResourceSync(icon.slice(Utils.RESOURCE_PREFIX.length));
|
|
22
|
+
}
|
|
23
|
+
else if (!icon.startsWith(Utils.SYSTEM_PREFIX) && Utils.isFileOrResourcePath(icon)) {
|
|
24
|
+
source = ImageSource.fromFileSync(icon);
|
|
25
|
+
}
|
|
26
|
+
return source?.android ? new android.graphics.drawable.BitmapDrawable(Utils.android.getApplicationContext().getResources(), source.android) : null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Android: Material 3 MaterialToolbar. The actions are the menu of the toolbar, those with `showAsAction: 'never'` are in the overflow menu.
|
|
30
|
+
*/
|
|
31
|
+
export class Toolbar extends ToolbarBase {
|
|
32
|
+
createNativeView() {
|
|
33
|
+
return new com.google.android.material.appbar.MaterialToolbar(this._context);
|
|
34
|
+
}
|
|
35
|
+
initNativeView() {
|
|
36
|
+
super.initNativeView();
|
|
37
|
+
const owner = new WeakRef(this);
|
|
38
|
+
const toolbar = this.nativeViewProtected;
|
|
39
|
+
// Material 3 surface colors, whatever the toolbar style of the app theme: replaced by `background-color` and `color`
|
|
40
|
+
const context = toolbar.getContext();
|
|
41
|
+
const R = com.google.android.material.R;
|
|
42
|
+
const themeColor = (attr, fallback) => {
|
|
43
|
+
const value = new android.util.TypedValue();
|
|
44
|
+
return context.getTheme().resolveAttribute(attr, value, true) ? value.data : fallback;
|
|
45
|
+
};
|
|
46
|
+
const onSurface = themeColor(R.attr.colorOnSurface, android.graphics.Color.BLACK);
|
|
47
|
+
toolbar.setBackgroundColor(themeColor(R.attr.colorSurface, android.graphics.Color.WHITE));
|
|
48
|
+
toolbar.setTitleTextColor(onSurface);
|
|
49
|
+
toolbar.setSubtitleTextColor(themeColor(R.attr.colorOnSurfaceVariant, android.graphics.Color.GRAY));
|
|
50
|
+
this.mColor = new Color(onSurface);
|
|
51
|
+
toolbar.setNavigationOnClickListener(new android.view.View.OnClickListener({ onClick: () => owner.get()?.notifyNavigationTap() }));
|
|
52
|
+
toolbar.setOnMenuItemClickListener(new androidx.appcompat.widget.Toolbar.OnMenuItemClickListener({
|
|
53
|
+
onMenuItemClick(menuItem) {
|
|
54
|
+
const view = owner.get();
|
|
55
|
+
const item = view?.items?.[menuItem.getItemId()];
|
|
56
|
+
if (!item) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
view.notifyItemTap(item);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
disposeNativeView() {
|
|
65
|
+
this.nativeViewProtected?.setNavigationOnClickListener(null);
|
|
66
|
+
this.nativeViewProtected?.setOnMenuItemClickListener(null);
|
|
67
|
+
super.disposeNativeView();
|
|
68
|
+
}
|
|
69
|
+
// the spans icons keep their own colors
|
|
70
|
+
tint(drawable, icon) {
|
|
71
|
+
if (drawable && this.mColor && !(icon instanceof FormattedString)) {
|
|
72
|
+
drawable.setTint(this.mColor.android);
|
|
73
|
+
}
|
|
74
|
+
return drawable;
|
|
75
|
+
}
|
|
76
|
+
updateItems() {
|
|
77
|
+
const toolbar = this.nativeViewProtected;
|
|
78
|
+
if (!toolbar) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const menu = toolbar.getMenu();
|
|
82
|
+
menu.clear();
|
|
83
|
+
this.items?.forEach((item, index) => {
|
|
84
|
+
const icon = toDrawable(item.androidIcon || item.icon, this.style.fontInternal, this.mColor);
|
|
85
|
+
const menuItem = menu.add(0, index, index, item.title || '');
|
|
86
|
+
if (icon) {
|
|
87
|
+
menuItem.setIcon(this.tint(icon, item.androidIcon || item.icon));
|
|
88
|
+
}
|
|
89
|
+
const MenuItem = android.view.MenuItem;
|
|
90
|
+
const show = item.showAsAction || (icon ? 'always' : 'never');
|
|
91
|
+
menuItem.setShowAsAction(show === 'always' ? MenuItem.SHOW_AS_ACTION_ALWAYS : show === 'ifRoom' ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER);
|
|
92
|
+
menuItem.setEnabled(!item.disabled);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
[titleProperty.setNative](value) {
|
|
96
|
+
this.nativeViewProtected.setTitle(value || null);
|
|
97
|
+
}
|
|
98
|
+
[subtitleProperty.setNative](value) {
|
|
99
|
+
this.nativeViewProtected.setSubtitle(value || null);
|
|
100
|
+
}
|
|
101
|
+
[centerTitleProperty.setNative](value) {
|
|
102
|
+
this.nativeViewProtected.setTitleCentered(!!value);
|
|
103
|
+
this.nativeViewProtected.setSubtitleCentered(!!value);
|
|
104
|
+
}
|
|
105
|
+
updateNavigationIcon() {
|
|
106
|
+
this.nativeViewProtected?.setNavigationIcon(this.tint(toDrawable(this.navigationIcon, this.style.fontInternal, this.mColor), this.navigationIcon));
|
|
107
|
+
}
|
|
108
|
+
[navigationIconProperty.setNative](value) {
|
|
109
|
+
this.updateNavigationIcon();
|
|
110
|
+
}
|
|
111
|
+
[itemsProperty.setNative](value) {
|
|
112
|
+
this.updateItems();
|
|
113
|
+
}
|
|
114
|
+
[colorProperty.setNative](value) {
|
|
115
|
+
this.mColor = value instanceof Color ? value : value ? new Color(value) : null;
|
|
116
|
+
const toolbar = this.nativeViewProtected;
|
|
117
|
+
if (this.mColor) {
|
|
118
|
+
toolbar.setTitleTextColor(this.mColor.android);
|
|
119
|
+
toolbar.setSubtitleTextColor(this.mColor.android);
|
|
120
|
+
}
|
|
121
|
+
// the icons already set follow the color
|
|
122
|
+
this.updateItems();
|
|
123
|
+
this.updateNavigationIcon();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../src/ui-toolbar/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,WAAW,EAAe,mBAAmB,EAAE,aAAa,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvJ,cAAc,gBAAgB,CAAC;AAI/B,SAAS,UAAU,CAAC,IAAU,EAAE,IAAW,EAAE,KAAa;IACtD,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,MAAmB,CAAC;IACxB,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;QAClC,MAAM,GAAG,gCAAgC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;SAAM,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;QACrC,MAAM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AAE,CAAC;QACnB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;CACJ"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolbar for a custom action bar: a title, a navigation icon, action items and an overflow menu.
|
|
3
|
+
* Android: Material 3 `MaterialToolbar`. iOS: a `UINavigationBar` used as a view, its bar buttons get the Liquid Glass capsules on iOS 26.
|
|
4
|
+
* `background-color` and `color` apply to the bar and its icons.
|
|
5
|
+
* @module @nativescript-community/ui-toolbar
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { EventData, FormattedString, ImageSource, View } from '@nativescript/core';
|
|
9
|
+
import { ToolbarItem, ToolbarShowAsAction } from './index-common';
|
|
10
|
+
export { ToolbarItem, ToolbarShowAsAction };
|
|
11
|
+
|
|
12
|
+
export interface ToolbarItemTapEventData extends EventData {
|
|
13
|
+
item: ToolbarItem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class Toolbar extends View {
|
|
17
|
+
/** name of the event raised when an action is tapped */
|
|
18
|
+
static itemTapEvent: string;
|
|
19
|
+
/** name of the event raised when the navigation icon is tapped */
|
|
20
|
+
static navigationTapEvent: string;
|
|
21
|
+
|
|
22
|
+
title: string;
|
|
23
|
+
subtitle: string;
|
|
24
|
+
/** icon at the start of the bar: back, menu, close... */
|
|
25
|
+
navigationIcon: string | ImageSource | FormattedString;
|
|
26
|
+
/** the actions */
|
|
27
|
+
items: ToolbarItem[];
|
|
28
|
+
/** Android: the title is centered (always centered on iOS) */
|
|
29
|
+
centerTitle: boolean;
|
|
30
|
+
}
|
package/index.ios.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Color, FormattedString, ImageSource, colorProperty } from '@nativescript/core';
|
|
2
|
+
import { ToolbarBase, ToolbarItem, centerTitleProperty, itemsProperty, navigationIconProperty, subtitleProperty, titleProperty } from './index-common';
|
|
3
|
+
export * from './index-common';
|
|
4
|
+
type Icon = string | ImageSource | FormattedString;
|
|
5
|
+
/**
|
|
6
|
+
* iOS: a UINavigationBar used as a view. On iOS 26 its bar buttons are in Liquid Glass capsules.
|
|
7
|
+
* The `showAsAction: 'never'` actions are in a menu on a trailing `ellipsis` button.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Toolbar extends ToolbarBase {
|
|
10
|
+
[titleProperty.setNative]: (value: string) => void;
|
|
11
|
+
[subtitleProperty.setNative]: (value: string) => void;
|
|
12
|
+
[centerTitleProperty.setNative]: (value: boolean) => void;
|
|
13
|
+
[navigationIconProperty.setNative]: (value: Icon) => void;
|
|
14
|
+
[itemsProperty.setNative]: (value: ToolbarItem[]) => void;
|
|
15
|
+
[colorProperty.setNative]: (value: Color) => void;
|
|
16
|
+
nativeViewProtected: UINavigationBar;
|
|
17
|
+
private mNavigationItem;
|
|
18
|
+
createNativeView(): UINavigationBar;
|
|
19
|
+
private action;
|
|
20
|
+
private updateItems;
|
|
21
|
+
}
|
package/index.ios.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Color, Font, FormattedString, ImageSource, Utils, colorProperty } from '@nativescript/core';
|
|
2
|
+
import { renderFormattedTextToImageSource } from '@nativescript-community/ui-core/formatted-text';
|
|
3
|
+
import { ToolbarBase, centerTitleProperty, itemsProperty, navigationIconProperty, subtitleProperty, titleProperty } from './index-common';
|
|
4
|
+
export * from './index-common';
|
|
5
|
+
function toImage(icon, font) {
|
|
6
|
+
if (!icon) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (icon instanceof FormattedString) {
|
|
10
|
+
return renderFormattedTextToImageSource(icon, undefined)?.ios;
|
|
11
|
+
}
|
|
12
|
+
if (icon instanceof ImageSource) {
|
|
13
|
+
return icon.ios;
|
|
14
|
+
}
|
|
15
|
+
if (Utils.isFontIconURI(icon)) {
|
|
16
|
+
// an icon font glyph, a template image tinted by the bar
|
|
17
|
+
const image = ImageSource.fromFontIconCodeSync(icon.split('//')[1], (font || Font.default).withFontSize(24), new Color('black'))?.ios;
|
|
18
|
+
return image?.imageWithRenderingMode(2 /* UIImageRenderingMode.AlwaysTemplate */);
|
|
19
|
+
}
|
|
20
|
+
if (icon.startsWith(Utils.SYSTEM_PREFIX)) {
|
|
21
|
+
return UIImage.systemImageNamed(icon.slice(Utils.SYSTEM_PREFIX.length));
|
|
22
|
+
}
|
|
23
|
+
const source = icon.startsWith(Utils.RESOURCE_PREFIX) ? ImageSource.fromResourceSync(icon.slice(Utils.RESOURCE_PREFIX.length)) : ImageSource.fromFileSync(icon);
|
|
24
|
+
return source?.ios;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* iOS: a UINavigationBar used as a view. On iOS 26 its bar buttons are in Liquid Glass capsules.
|
|
28
|
+
* The `showAsAction: 'never'` actions are in a menu on a trailing `ellipsis` button.
|
|
29
|
+
*/
|
|
30
|
+
export class Toolbar extends ToolbarBase {
|
|
31
|
+
createNativeView() {
|
|
32
|
+
const bar = UINavigationBar.alloc().init();
|
|
33
|
+
const navigationItem = UINavigationItem.alloc().initWithTitle('');
|
|
34
|
+
bar.items = NSArray.arrayWithArray([navigationItem]);
|
|
35
|
+
this.mNavigationItem = navigationItem;
|
|
36
|
+
return bar;
|
|
37
|
+
}
|
|
38
|
+
action(title, image, handler) {
|
|
39
|
+
return UIAction.actionWithTitleImageIdentifierHandler(title, image, null, handler);
|
|
40
|
+
}
|
|
41
|
+
updateItems() {
|
|
42
|
+
const navigationItem = this.mNavigationItem;
|
|
43
|
+
if (!navigationItem) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const visible = [];
|
|
47
|
+
const overflow = [];
|
|
48
|
+
(this.items || []).forEach((item) => {
|
|
49
|
+
(item.showAsAction === 'never' ? overflow : visible).push(item);
|
|
50
|
+
});
|
|
51
|
+
const buttons = visible.map((item) => {
|
|
52
|
+
const image = toImage(item.iosIcon || item.icon, this.style.fontInternal);
|
|
53
|
+
const button = UIBarButtonItem.alloc().initWithPrimaryAction(this.action(image ? '' : item.title || '', image, () => this.notifyItemTap(item)));
|
|
54
|
+
button.enabled = !item.disabled;
|
|
55
|
+
if (item.title) {
|
|
56
|
+
button.accessibilityLabel = item.title;
|
|
57
|
+
}
|
|
58
|
+
return button;
|
|
59
|
+
});
|
|
60
|
+
if (overflow.length) {
|
|
61
|
+
const children = overflow.map((item) => {
|
|
62
|
+
const action = this.action(item.title || '', toImage(item.iosIcon || item.icon, this.style.fontInternal), () => this.notifyItemTap(item));
|
|
63
|
+
if (item.disabled) {
|
|
64
|
+
action.attributes = 1 /* UIMenuElementAttributes.Disabled */;
|
|
65
|
+
}
|
|
66
|
+
return action;
|
|
67
|
+
});
|
|
68
|
+
buttons.push(UIBarButtonItem.alloc().initWithImageMenu(UIImage.systemImageNamed('ellipsis'), UIMenu.menuWithChildren(NSArray.arrayWithArray(children))));
|
|
69
|
+
}
|
|
70
|
+
// the first of the items is the closest to the trailing edge
|
|
71
|
+
navigationItem.rightBarButtonItems = NSArray.arrayWithArray(buttons.reverse());
|
|
72
|
+
}
|
|
73
|
+
[titleProperty.setNative](value) {
|
|
74
|
+
this.mNavigationItem.title = value || null;
|
|
75
|
+
}
|
|
76
|
+
[subtitleProperty.setNative](value) {
|
|
77
|
+
// iOS 26 UINavigationItem.subtitle
|
|
78
|
+
this.mNavigationItem.subtitle = value || null;
|
|
79
|
+
}
|
|
80
|
+
// the title of a UINavigationBar is always centered
|
|
81
|
+
[centerTitleProperty.setNative](value) { }
|
|
82
|
+
[navigationIconProperty.setNative](value) {
|
|
83
|
+
const image = toImage(value, this.style.fontInternal);
|
|
84
|
+
this.mNavigationItem.leftBarButtonItem = image ? UIBarButtonItem.alloc().initWithPrimaryAction(this.action('', image, () => this.notifyNavigationTap())) : null;
|
|
85
|
+
}
|
|
86
|
+
[itemsProperty.setNative](value) {
|
|
87
|
+
this.updateItems();
|
|
88
|
+
}
|
|
89
|
+
[colorProperty.setNative](value) {
|
|
90
|
+
const color = value instanceof Color ? value.ios : value ? new Color(value).ios : null;
|
|
91
|
+
this.nativeViewProtected.tintColor = color;
|
|
92
|
+
const appearance = UINavigationBarAppearance.new();
|
|
93
|
+
appearance.configureWithDefaultBackground();
|
|
94
|
+
if (color) {
|
|
95
|
+
appearance.titleTextAttributes = { [NSForegroundColorAttributeName]: color };
|
|
96
|
+
}
|
|
97
|
+
this.nativeViewProtected.standardAppearance = appearance;
|
|
98
|
+
this.nativeViewProtected.scrollEdgeAppearance = appearance;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=index.ios.js.map
|
package/index.ios.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../src/ui-toolbar/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,WAAW,EAAe,mBAAmB,EAAE,aAAa,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvJ,cAAc,gBAAgB,CAAC;AAI/B,SAAS,OAAO,CAAC,IAAU,EAAE,IAAW;IACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;QAClC,OAAO,gCAAgC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC;IAClE,CAAC;IACD,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IACD,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,yDAAyD;QACzD,MAAM,KAAK,GAAG,WA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-community/ui-toolbar",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Toolbar with a title, a navigation icon, action items and an overflow menu: Material 3 MaterialToolbar on Android, UINavigationBar (glass bar buttons on iOS 26) on iOS.",
|
|
5
|
+
"main": "./index",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"typings": "./index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"tsc": "cpy '**/*.d.ts' '../../packages/ui-toolbar' --parents --cwd=../../src/ui-toolbar && tsc --build",
|
|
10
|
+
"readme": "readme generate -c ../../tools/readme/blueprint.json",
|
|
11
|
+
"build": "npm run tsc && npm run readme",
|
|
12
|
+
"build.watch": "npm run tsc -- -w",
|
|
13
|
+
"build.all": "npm run build",
|
|
14
|
+
"clean": "bin/rimraf ./*.d.ts ./*.js ./*.js.map ./*.tsbuildinfo ./*.mjs ./*.mjs.map ./angular ./svelte ./vue* ./react"
|
|
15
|
+
},
|
|
16
|
+
"nativescript": {
|
|
17
|
+
"platforms": {
|
|
18
|
+
"android": "6.2.0",
|
|
19
|
+
"ios": "6.2.0"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"NativeScript",
|
|
24
|
+
"JavaScript",
|
|
25
|
+
"Android",
|
|
26
|
+
"iOS"
|
|
27
|
+
],
|
|
28
|
+
"author": {
|
|
29
|
+
"name": "Martin Guillon",
|
|
30
|
+
"email": "martin@akylas.fr"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/nativescript-community/ui-native-components/issues"
|
|
34
|
+
},
|
|
35
|
+
"license": "Apache-2.0",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/nativescript-community/ui-native-components/tree/master/packages/ui-toolbar#readme",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/nativescript-community/ui-native-components.git",
|
|
43
|
+
"directory": "packages/ui-toolbar"
|
|
44
|
+
},
|
|
45
|
+
"readmeFilename": "README.md",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@nativescript-community/ui-core": "^1.0.0"
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "237dd97d2b9e0f62ea9d9810169bb800dd531f7b"
|
|
50
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uses": [
|
|
3
|
+
"android.graphics.drawable:BitmapDrawable",
|
|
4
|
+
"android.graphics.drawable:Drawable",
|
|
5
|
+
"android.graphics:Color",
|
|
6
|
+
"android.util:TypedValue",
|
|
7
|
+
"android.view:MenuItem",
|
|
8
|
+
"android.view:View.OnClickListener",
|
|
9
|
+
"androidx.appcompat.widget:Toolbar.OnMenuItemClickListener",
|
|
10
|
+
"com.google.android.material.appbar:MaterialToolbar"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../../src/ui-toolbar/index-common.ts","../../src/ui-toolbar/index.android.ts","../../src/ui-toolbar/index.d.ts","../../src/ui-toolbar/index.ios.ts","../../references.d.ts","../../tools/references.d.ts","../../src/references.d.ts"],"version":"5.8.3"}
|