@nativescript-community/ui-searchbar 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 +193 -2
- package/index-common.d.ts +29 -0
- package/index-common.js +22 -0
- package/index-common.js.map +1 -0
- package/index.android.d.ts +20 -0
- package/index.android.js +104 -0
- package/index.android.js.map +1 -0
- package/index.d.ts +23 -0
- package/index.ios.d.ts +13 -0
- package/index.ios.js +30 -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
|
+
* **searchbar,checkbox:** add ui-searchbar (M3 pill / UISearchBar) and ui-checkbox (MaterialCheckBox / SF Symbols, indeterminate) ([f2f56e7](https://github.com/nativescript-community/ui-native-components/commit/f2f56e7ebe38bb57fab7f142f9b0151fa680d6ec))
|
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,194 @@
|
|
|
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-searchbar</h1>
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://npmcharts.com/compare/@nativescript-community/ui-searchbar?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/@nativescript-community/ui-searchbar.svg" height="20"/></a>
|
|
24
|
+
<a href="https://www.npmjs.com/package/@nativescript-community/ui-searchbar"><img alt="NPM Version" src="https://img.shields.io/npm/v/@nativescript-community/ui-searchbar.svg" height="20"/></a>
|
|
25
|
+
</p>
|
|
2
26
|
|
|
3
|
-
|
|
27
|
+
<p align="center">
|
|
28
|
+
<b>SearchBar augmented with variants: Material 3 search bar on Android, native UISearchBar (Liquid Glass) 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-searchbar-ios.png" height="500" /> | <img src="https://github.com/nativescript-community/ui-native-components/raw/master/images/ui-searchbar-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
|
+
| `SearchView` styled as a M3 search bar | `UISearchBar` |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
[](#installation)
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install @nativescript-community/ui-searchbar
|
|
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
|
+
<SearchBar hint="Search" variant="filled" textChange="onText" submit="onSubmit" />
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
[](#api)
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
|
|
88
|
+
Same API as the core `SearchBar` (`text`, `hint`, `submit`, `clear`...), plus:
|
|
89
|
+
|
|
90
|
+
| Property | |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `variant` | `filled`, `outline` (Material) or `prominent`, `minimal` (iOS) |
|
|
93
|
+
| `formattedHint`, `formattedText` | spans. Uses `@nativescript-community/text` when installed (optional) |
|
|
94
|
+
|
|
95
|
+
`background-color`, `border` and `border-radius` apply to the bar.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
[](#demos-and-development)
|
|
99
|
+
|
|
100
|
+
## Demos and Development
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### Repo Setup
|
|
104
|
+
|
|
105
|
+
The repo uses submodules. If you did not clone with ` --recursive` then you need to call
|
|
106
|
+
```
|
|
107
|
+
git submodule update --init
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work.
|
|
111
|
+
|
|
112
|
+
To develop and test:
|
|
113
|
+
if you use `yarn` then run `yarn`
|
|
114
|
+
if you use `pnpm` then run `pnpm i`
|
|
115
|
+
|
|
116
|
+
**Interactive Menu:**
|
|
117
|
+
|
|
118
|
+
To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts.
|
|
119
|
+
|
|
120
|
+
### Build
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm run build.all
|
|
124
|
+
```
|
|
125
|
+
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`
|
|
126
|
+
|
|
127
|
+
### Demos
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm run demo.[ng|react|svelte|vue].[ios|android]
|
|
131
|
+
|
|
132
|
+
npm run demo.svelte.ios # Example
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
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]`
|
|
136
|
+
Instead you work in `demo-snippets/[ng|react|svelte|vue]`
|
|
137
|
+
You can start from the `install.ts` of each flavor to see how to register new demos
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
[](#contributing)
|
|
141
|
+
|
|
142
|
+
## Contributing
|
|
143
|
+
|
|
144
|
+
### Update repo
|
|
145
|
+
|
|
146
|
+
You can update the repo files quite easily
|
|
147
|
+
|
|
148
|
+
First update the submodules
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npm run update
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Then commit the changes
|
|
155
|
+
Then update common files
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
npm run sync
|
|
159
|
+
```
|
|
160
|
+
Then you can run `yarn|pnpm`, commit changed files if any
|
|
161
|
+
|
|
162
|
+
### Update readme
|
|
163
|
+
```bash
|
|
164
|
+
npm run readme
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Update doc
|
|
168
|
+
```bash
|
|
169
|
+
npm run doc
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Publish
|
|
173
|
+
|
|
174
|
+
The publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release)
|
|
175
|
+
Simply run
|
|
176
|
+
```shell
|
|
177
|
+
npm run publish
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### modifying submodules
|
|
181
|
+
|
|
182
|
+
The repo uses https:// for submodules which means you won't be able to push directly into the submodules.
|
|
183
|
+
One easy solution is t modify `~/.gitconfig` and add
|
|
184
|
+
```
|
|
185
|
+
[url "ssh://git@github.com/"]
|
|
186
|
+
pushInsteadOf = https://github.com/
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
[](#questions)
|
|
191
|
+
|
|
192
|
+
## Questions
|
|
193
|
+
|
|
194
|
+
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,29 @@
|
|
|
1
|
+
import { FormattedString, Property, SearchBar as CoreSearchBar } from '@nativescript/core';
|
|
2
|
+
/**
|
|
3
|
+
* `filled` and `outline` are the Material names, `prominent` and `minimal` the UISearchBar styles:
|
|
4
|
+
* filled = prominent, outline = minimal.
|
|
5
|
+
*/
|
|
6
|
+
export type SearchBarVariant = 'filled' | 'outline' | 'prominent' | 'minimal';
|
|
7
|
+
export declare abstract class SearchBarCommon extends CoreSearchBar {
|
|
8
|
+
/**
|
|
9
|
+
* Android: Material 3 search bar, a filled or outlined pill. iOS: the prominent (glass) or minimal UISearchBar. Default: filled
|
|
10
|
+
*/
|
|
11
|
+
variant: SearchBarVariant;
|
|
12
|
+
/**
|
|
13
|
+
* Rich text (spans) of the hint, it wins over `hint`.
|
|
14
|
+
* `@nativescript-community/text` is used when it is installed (optional).
|
|
15
|
+
*/
|
|
16
|
+
formattedHint: FormattedString;
|
|
17
|
+
/**
|
|
18
|
+
* Rich text (spans) of the content. It is replaced by the plain text when the user edits it.
|
|
19
|
+
*/
|
|
20
|
+
formattedText: FormattedString;
|
|
21
|
+
/**
|
|
22
|
+
* Native rich text (SpannableString on Android, NSAttributedString on iOS) of a FormattedString
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
protected createNativeRichText(formatted: FormattedString): any;
|
|
26
|
+
}
|
|
27
|
+
export declare const variantProperty: Property<SearchBarCommon, SearchBarVariant>;
|
|
28
|
+
export declare const formattedHintProperty: Property<SearchBarCommon, FormattedString>;
|
|
29
|
+
export declare const formattedTextProperty: Property<SearchBarCommon, FormattedString>;
|
package/index-common.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CSSType, Property, SearchBar as CoreSearchBar } from '@nativescript/core';
|
|
2
|
+
import { createNativeFormattedText } from '@nativescript-community/ui-core/formatted-text';
|
|
3
|
+
let SearchBarCommon = class SearchBarCommon extends CoreSearchBar {
|
|
4
|
+
/**
|
|
5
|
+
* Native rich text (SpannableString on Android, NSAttributedString on iOS) of a FormattedString
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
createNativeRichText(formatted) {
|
|
9
|
+
return formatted ? createNativeFormattedText(formatted) : null;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
SearchBarCommon = __decorate([
|
|
13
|
+
CSSType('SearchBar')
|
|
14
|
+
], SearchBarCommon);
|
|
15
|
+
export { SearchBarCommon };
|
|
16
|
+
export const variantProperty = new Property({ name: 'variant', defaultValue: 'filled' });
|
|
17
|
+
variantProperty.register(SearchBarCommon);
|
|
18
|
+
export const formattedHintProperty = new Property({ name: 'formattedHint' });
|
|
19
|
+
formattedHintProperty.register(SearchBarCommon);
|
|
20
|
+
export const formattedTextProperty = new Property({ name: 'formattedText' });
|
|
21
|
+
formattedTextProperty.register(SearchBarCommon);
|
|
22
|
+
//# sourceMappingURL=index-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-common.js","sourceRoot":"","sources":["../../src/ui-searchbar/index-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,QAAQ,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AASpF,IAAe,eAAe,GAA9B,MAAe,eAAgB,SAAQ,aAAa;IAiBvD;;;OAGG;IACO,oBAAoB,CAAC,SAA0B;QACrD,OAAO,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,CAAC;CACJ,CAAA;AAxBqB,eAAe;IADpC,OAAO,CAAC,WAAW,CAAC;GACC,eAAe,CAwBpC;;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAoC,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC5H,eAAe,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,QAAQ,CAAmC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;AAC/G,qBAAqB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,QAAQ,CAAmC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;AAC/G,qBAAqB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Background, Color, backgroundColorProperty, backgroundInternalProperty } from '@nativescript/core';
|
|
2
|
+
import { SearchBarCommon, SearchBarVariant, formattedHintProperty, formattedTextProperty, variantProperty } from './index-common';
|
|
3
|
+
export * from './index-common';
|
|
4
|
+
/**
|
|
5
|
+
* Android: the androidx SearchView of the core SearchBar, styled as a Material 3 search bar:
|
|
6
|
+
* a pill (28dp radius, 56dp high) filled with the surface container color, or outlined.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SearchBar extends SearchBarCommon {
|
|
9
|
+
[formattedHintProperty.setNative]: (value: any) => void;
|
|
10
|
+
[formattedTextProperty.setNative]: (value: any) => void;
|
|
11
|
+
[backgroundColorProperty.setNative]: (value: Color) => void;
|
|
12
|
+
[backgroundInternalProperty.setNative]: (value: Background) => void;
|
|
13
|
+
[variantProperty.setNative]: (value: SearchBarVariant) => void;
|
|
14
|
+
initNativeView(): void;
|
|
15
|
+
private styleSearchView;
|
|
16
|
+
private mUserColor;
|
|
17
|
+
private mUserBackground;
|
|
18
|
+
private applyVariant;
|
|
19
|
+
private get editText();
|
|
20
|
+
}
|
package/index.android.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Color, Utils, backgroundColorProperty, backgroundInternalProperty } from '@nativescript/core';
|
|
2
|
+
import { SearchBarCommon, formattedHintProperty, formattedTextProperty, variantProperty } from './index-common';
|
|
3
|
+
export * from './index-common';
|
|
4
|
+
const HEIGHT_DP = 56;
|
|
5
|
+
function themeColor(context, attr, fallback) {
|
|
6
|
+
const value = new android.util.TypedValue();
|
|
7
|
+
return context.getTheme().resolveAttribute(attr, value, true) ? value.data : fallback;
|
|
8
|
+
}
|
|
9
|
+
function id(context, name) {
|
|
10
|
+
return context.getResources().getIdentifier(name, 'id', context.getPackageName());
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Android: the androidx SearchView of the core SearchBar, styled as a Material 3 search bar:
|
|
14
|
+
* a pill (28dp radius, 56dp high) filled with the surface container color, or outlined.
|
|
15
|
+
*/
|
|
16
|
+
export class SearchBar extends SearchBarCommon {
|
|
17
|
+
initNativeView() {
|
|
18
|
+
super.initNativeView();
|
|
19
|
+
this.styleSearchView();
|
|
20
|
+
}
|
|
21
|
+
styleSearchView() {
|
|
22
|
+
const searchView = this.nativeViewProtected;
|
|
23
|
+
const context = searchView.getContext();
|
|
24
|
+
const R = com.google.android.material.R;
|
|
25
|
+
const onSurface = themeColor(context, R.attr.colorOnSurface, android.graphics.Color.BLACK);
|
|
26
|
+
const onSurfaceVariant = themeColor(context, R.attr.colorOnSurfaceVariant, android.graphics.Color.GRAY);
|
|
27
|
+
const height = Utils.layout.toDevicePixels(HEIGHT_DP);
|
|
28
|
+
searchView.setIconifiedByDefault(false);
|
|
29
|
+
searchView.setMaxWidth(java.lang.Integer.MAX_VALUE);
|
|
30
|
+
searchView.setMinimumHeight(height);
|
|
31
|
+
searchView.setPadding(Utils.layout.toDevicePixels(8), 0, Utils.layout.toDevicePixels(8), 0);
|
|
32
|
+
// the parts of the SearchView: no underline, M3 colors
|
|
33
|
+
const plate = searchView.findViewById(id(context, 'search_plate'));
|
|
34
|
+
plate?.setBackground(null);
|
|
35
|
+
const frame = searchView.findViewById(id(context, 'search_edit_frame'));
|
|
36
|
+
frame?.setBackground(null);
|
|
37
|
+
const text = searchView.findViewById(id(context, 'search_src_text'));
|
|
38
|
+
if (text) {
|
|
39
|
+
text.setTextColor(onSurface);
|
|
40
|
+
text.setHintTextColor(onSurfaceVariant);
|
|
41
|
+
text.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 16);
|
|
42
|
+
}
|
|
43
|
+
for (const name of ['search_mag_icon', 'search_button', 'search_close_btn', 'search_go_btn']) {
|
|
44
|
+
const icon = searchView.findViewById(id(context, name));
|
|
45
|
+
icon?.setColorFilter(onSurfaceVariant, android.graphics.PorterDuff.Mode.SRC_IN);
|
|
46
|
+
}
|
|
47
|
+
this.applyVariant(this.variant);
|
|
48
|
+
}
|
|
49
|
+
applyVariant(variant) {
|
|
50
|
+
const searchView = this.nativeViewProtected;
|
|
51
|
+
if (!searchView) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const context = searchView.getContext();
|
|
55
|
+
const R = com.google.android.material.R;
|
|
56
|
+
const outlined = variant === 'outline' || variant === 'minimal';
|
|
57
|
+
const user = this.mUserBackground;
|
|
58
|
+
const background = new android.graphics.drawable.GradientDrawable();
|
|
59
|
+
// background-color, border and border-radius of the view replace the ones of the variant
|
|
60
|
+
const radius = user?.borderTopLeftRadius ? Utils.layout.toDevicePixels(user.borderTopLeftRadius) : Utils.layout.toDevicePixels(HEIGHT_DP / 2);
|
|
61
|
+
background.setCornerRadius(radius);
|
|
62
|
+
if (this.mUserColor) {
|
|
63
|
+
background.setColor(this.mUserColor.android);
|
|
64
|
+
}
|
|
65
|
+
else if (outlined) {
|
|
66
|
+
background.setColor(android.graphics.Color.TRANSPARENT);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
background.setColor(themeColor(context, R.attr.colorSurfaceContainerHigh, android.graphics.Color.LTGRAY));
|
|
70
|
+
}
|
|
71
|
+
if (user?.borderTopWidth) {
|
|
72
|
+
background.setStroke(Utils.layout.toDevicePixels(user.borderTopWidth), user.borderTopColor ? user.borderTopColor.android : android.graphics.Color.GRAY);
|
|
73
|
+
}
|
|
74
|
+
else if (outlined) {
|
|
75
|
+
background.setStroke(Utils.layout.toDevicePixels(1), themeColor(context, R.attr.colorOutline, android.graphics.Color.GRAY));
|
|
76
|
+
}
|
|
77
|
+
searchView.setBackground(background);
|
|
78
|
+
}
|
|
79
|
+
get editText() {
|
|
80
|
+
const searchView = this.nativeViewProtected;
|
|
81
|
+
return searchView.findViewById(id(searchView.getContext(), 'search_src_text'));
|
|
82
|
+
}
|
|
83
|
+
[formattedHintProperty.setNative](value) {
|
|
84
|
+
// a hint can be a spannable: the plain hint of the core SearchBar is restored without spans
|
|
85
|
+
this.editText?.setHint(value ? this.createNativeRichText(value) : this.hint || '');
|
|
86
|
+
}
|
|
87
|
+
[formattedTextProperty.setNative](value) {
|
|
88
|
+
if (value) {
|
|
89
|
+
this.editText?.setText(this.createNativeRichText(value));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
[backgroundColorProperty.setNative](value) {
|
|
93
|
+
this.mUserColor = value instanceof Color ? value : value ? new Color(value) : null;
|
|
94
|
+
this.applyVariant(this.variant);
|
|
95
|
+
}
|
|
96
|
+
[backgroundInternalProperty.setNative](value) {
|
|
97
|
+
this.mUserBackground = value;
|
|
98
|
+
this.applyVariant(this.variant);
|
|
99
|
+
}
|
|
100
|
+
[variantProperty.setNative](value) {
|
|
101
|
+
this.applyVariant(value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../src/ui-searchbar/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,eAAe,EAAoB,qBAAqB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAClI,cAAc,gBAAgB,CAAC;AAE/B,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,UAAU,CAAC,OAAgC,EAAE,IAAY,EAAE,QAAgB;IAChF,MAAM,KAAK,GAAG,IAAI,OA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uB,CAAC,SAAS,CAAC,CAAC,KAAY;QAC5C,IAAI,CAAC,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1F,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IACD,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,KAAiB;QACpD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,KAAuB;QAC/C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;CACJ"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchBar augmented with `variant`. Same API as the core SearchBar (`text`, `hint`, `submit` and `clear` events...).
|
|
3
|
+
* Android: Material 3 search bar look. iOS: native UISearchBar (Liquid Glass on iOS 26+).
|
|
4
|
+
* @module @nativescript-community/ui-searchbar
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { FormattedString, SearchBar as CoreSearchBar } from '@nativescript/core';
|
|
8
|
+
import { SearchBarVariant } from './index-common';
|
|
9
|
+
export { SearchBarVariant };
|
|
10
|
+
|
|
11
|
+
export class SearchBar extends CoreSearchBar {
|
|
12
|
+
/**
|
|
13
|
+
* Android: Material 3 search bar, a filled or outlined pill. iOS: the prominent (glass) or minimal UISearchBar. Default: filled
|
|
14
|
+
*/
|
|
15
|
+
variant: SearchBarVariant;
|
|
16
|
+
/**
|
|
17
|
+
* Rich text (spans) of the hint, it wins over `hint`.
|
|
18
|
+
* `@nativescript-community/text` is used when installed (optional).
|
|
19
|
+
*/
|
|
20
|
+
formattedHint: FormattedString;
|
|
21
|
+
/** Rich text (spans) of the content. It is replaced by the plain text when the user edits it. */
|
|
22
|
+
formattedText: FormattedString;
|
|
23
|
+
}
|
package/index.ios.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Background, backgroundInternalProperty } from '@nativescript/core';
|
|
2
|
+
import { SearchBarCommon, SearchBarVariant, formattedHintProperty, formattedTextProperty, variantProperty } from './index-common';
|
|
3
|
+
export * from './index-common';
|
|
4
|
+
/**
|
|
5
|
+
* iOS: the native UISearchBar, which has the Liquid Glass look on iOS 26+
|
|
6
|
+
*/
|
|
7
|
+
export declare class SearchBar extends SearchBarCommon {
|
|
8
|
+
[formattedHintProperty.setNative]: (value: any) => void;
|
|
9
|
+
[formattedTextProperty.setNative]: (value: any) => void;
|
|
10
|
+
[backgroundInternalProperty.setNative]: (value: Background) => void;
|
|
11
|
+
[variantProperty.setNative]: (value: SearchBarVariant) => void;
|
|
12
|
+
private get searchTextField();
|
|
13
|
+
}
|
package/index.ios.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { backgroundInternalProperty } from '@nativescript/core';
|
|
2
|
+
import { applyBorderBackground } from '@nativescript-community/ui-core/border-background';
|
|
3
|
+
import { SearchBarCommon, formattedHintProperty, formattedTextProperty, variantProperty } from './index-common';
|
|
4
|
+
export * from './index-common';
|
|
5
|
+
/**
|
|
6
|
+
* iOS: the native UISearchBar, which has the Liquid Glass look on iOS 26+
|
|
7
|
+
*/
|
|
8
|
+
export class SearchBar extends SearchBarCommon {
|
|
9
|
+
get searchTextField() {
|
|
10
|
+
return this.nativeViewProtected.searchTextField;
|
|
11
|
+
}
|
|
12
|
+
[formattedHintProperty.setNative](value) {
|
|
13
|
+
// without spans the plain hint of the core SearchBar is restored
|
|
14
|
+
this.searchTextField.attributedPlaceholder = value ? this.createNativeRichText(value) : this.hint ? NSAttributedString.alloc().initWithString(this.hint) : null;
|
|
15
|
+
}
|
|
16
|
+
[formattedTextProperty.setNative](value) {
|
|
17
|
+
if (value) {
|
|
18
|
+
this.searchTextField.attributedText = this.createNativeRichText(value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// the core discards the background of the SearchBar (the color is the color of the bar): the border and the radius are still drawn
|
|
22
|
+
[backgroundInternalProperty.setNative](value) {
|
|
23
|
+
applyBorderBackground(this, value);
|
|
24
|
+
}
|
|
25
|
+
[variantProperty.setNative](value) {
|
|
26
|
+
const minimal = value === 'minimal' || value === 'outline';
|
|
27
|
+
this.nativeViewProtected.searchBarStyle = minimal ? 2 /* UISearchBarStyle.Minimal */ : 1 /* UISearchBarStyle.Prominent */;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# 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-searchbar/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAoB,qBAAqB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAClI,cAAc,gBAAgB,CAAC;AAE/B;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,eAAe;IAC1C,IAAY,eAAe;QACvB,OAAQ,IAAI,CAAC,mBAAmC,CAAC,eAAe,CAAC;IACrE,CAAC;IAED,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,KAAK;QACnC,iEAAiE;QACjE,IAAI,CAAC,eAAe,CAAC,qBAAqB,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpK,CAAC;IAED,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,KAAK;QACnC,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,eAAe,CAAC,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC3E,CAAC;IACL,CAAC;IAED,mIAAmI;IACnI,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,KAAiB;QACpD,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,KAAuB;QAC/C,MAAM,OAAO,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,CAAC;QAC1D,IAAI,CAAC,mBAAmC,CAAC,cAAc,GAAG,OAAO,CAAC,CAAC,kCAA0B,CAAC,mCAA2B,CAAC;IAC/H,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@nativescript-community/ui-searchbar",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SearchBar augmented with variants: Material 3 search bar on Android, native UISearchBar (Liquid Glass) on iOS.",
|
|
5
|
+
"main": "./index",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"typings": "./index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"tsc": "cpy '**/*.d.ts' '../../packages/ui-searchbar' --parents --cwd=../../src/ui-searchbar && 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-searchbar#readme",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/nativescript-community/ui-native-components.git",
|
|
43
|
+
"directory": "packages/ui-searchbar"
|
|
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.content:Context",
|
|
4
|
+
"android.graphics.drawable:GradientDrawable",
|
|
5
|
+
"android.graphics:Color",
|
|
6
|
+
"android.graphics:PorterDuff.Mode",
|
|
7
|
+
"android.util:TypedValue",
|
|
8
|
+
"android.widget:EditText",
|
|
9
|
+
"android.widget:ImageView",
|
|
10
|
+
"androidx.appcompat.widget:SearchView"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../../src/ui-searchbar/index-common.ts","../../src/ui-searchbar/index.android.ts","../../src/ui-searchbar/index.d.ts","../../src/ui-searchbar/index.ios.ts","../../references.d.ts","../../tools/references.d.ts","../../src/references.d.ts"],"version":"5.8.3"}
|