@terreno/ui 56.0.0-beta.0 → 57.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -203
- package/dist/Badge.d.ts +1 -1
- package/dist/Badge.js +37 -1
- package/dist/Badge.js.map +1 -1
- package/dist/Common.d.ts +149 -3
- package/dist/Common.js.map +1 -1
- package/dist/DateTimeField.js +5 -21
- package/dist/DateTimeField.js.map +1 -1
- package/dist/EditableCard.d.ts +3 -0
- package/dist/EditableCard.js +23 -0
- package/dist/EditableCard.js.map +1 -0
- package/dist/Filter.d.ts +13 -0
- package/dist/Filter.js +120 -0
- package/dist/Filter.js.map +1 -0
- package/dist/FilterAccordion.d.ts +8 -0
- package/dist/FilterAccordion.js +59 -0
- package/dist/FilterAccordion.js.map +1 -0
- package/dist/FilterBoolean.d.ts +8 -0
- package/dist/FilterBoolean.js +74 -0
- package/dist/FilterBoolean.js.map +1 -0
- package/dist/FilterChangesBadge.d.ts +8 -0
- package/dist/FilterChangesBadge.js +11 -0
- package/dist/FilterChangesBadge.js.map +1 -0
- package/dist/FilterSelectMenu.d.ts +8 -0
- package/dist/FilterSelectMenu.js +37 -0
- package/dist/FilterSelectMenu.js.map +1 -0
- package/dist/IconRegistry.js +11 -6
- package/dist/IconRegistry.js.map +1 -1
- package/dist/Page.d.ts +2 -1
- package/dist/Page.js +0 -2
- package/dist/Page.js.map +1 -1
- package/dist/PickerSelect.d.ts +8 -1
- package/dist/PickerSelect.js +2 -2
- package/dist/PickerSelect.js.map +1 -1
- package/dist/SelectField.js +2 -2
- package/dist/SelectField.js.map +1 -1
- package/dist/Theme.js +3 -0
- package/dist/Theme.js.map +1 -1
- package/dist/WebDropdownMenu.d.ts +5 -1
- package/dist/WebDropdownMenu.js +24 -10
- package/dist/WebDropdownMenu.js.map +1 -1
- package/dist/icons/BarsFilterIcon.d.ts +9 -0
- package/dist/icons/BarsFilterIcon.js +12 -0
- package/dist/icons/BarsFilterIcon.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +26 -25
- package/src/ActionSheet.test.tsx +202 -172
- package/src/Badge.test.tsx +22 -1
- package/src/Badge.tsx +43 -0
- package/src/Box.test.tsx +31 -23
- package/src/Common.ts +167 -5
- package/src/ConsentFormScreen.test.tsx +22 -0
- package/src/ConsentNavigator.test.tsx +6 -8
- package/src/DateTimeField.test.tsx +66 -18
- package/src/DateTimeField.tsx +5 -19
- package/src/DraggableList.test.tsx +377 -0
- package/src/EditableCard.test.tsx +69 -0
- package/src/EditableCard.tsx +73 -0
- package/src/Filter.test.tsx +94 -0
- package/src/Filter.tsx +257 -0
- package/src/FilterAccordion.test.tsx +58 -0
- package/src/FilterAccordion.tsx +113 -0
- package/src/FilterBoolean.test.tsx +65 -0
- package/src/FilterBoolean.tsx +130 -0
- package/src/FilterChangesBadge.test.tsx +16 -0
- package/src/FilterChangesBadge.tsx +13 -0
- package/src/FilterSelectMenu.test.tsx +56 -0
- package/src/FilterSelectMenu.tsx +76 -0
- package/src/IconRegistry.test.tsx +6 -4
- package/src/IconRegistry.tsx +13 -8
- package/src/Page.tsx +2 -3
- package/src/PickerSelect.test.tsx +43 -12
- package/src/PickerSelect.tsx +10 -0
- package/src/SelectField.tsx +2 -0
- package/src/SidebarNavigation.test.tsx +339 -0
- package/src/Theme.tsx +3 -0
- package/src/WebDropdownMenu.test.tsx +214 -1
- package/src/WebDropdownMenu.tsx +43 -21
- package/src/__snapshots__/Card.test.tsx.snap +1 -0
- package/src/__snapshots__/EditableCard.test.tsx.snap +242 -0
- package/src/__snapshots__/Filter.test.tsx.snap +161 -0
- package/src/__snapshots__/FilterAccordion.test.tsx.snap +83 -0
- package/src/__snapshots__/FilterBoolean.test.tsx.snap +109 -0
- package/src/__snapshots__/FilterChangesBadge.test.tsx.snap +18 -0
- package/src/__snapshots__/FilterSelectMenu.test.tsx.snap +359 -0
- package/src/bunSetup.ts +6 -2
- package/src/conflictFieldDiff.test.ts +43 -0
- package/src/icons/BarsFilterIcon.tsx +18 -0
- package/src/index.tsx +7 -0
package/LICENSE
CHANGED
|
@@ -1,203 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 2018 Pinterest Inc.
|
|
190
|
-
Copyright 2020 Josh Gachnang
|
|
191
|
-
Copyright 2022 Flourish Health Inc.
|
|
192
|
-
|
|
193
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
-
you may not use this file except in compliance with the License.
|
|
195
|
-
You may obtain a copy of the License at
|
|
196
|
-
|
|
197
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
-
|
|
199
|
-
Unless required by applicable law or agreed to in writing, software
|
|
200
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
-
See the License for the specific language governing permissions and
|
|
203
|
-
limitations under the License.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Flourish Health, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/Badge.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
import type { BadgeProps } from "./Common";
|
|
3
|
-
export declare const Badge: ({ value, iconName, status, secondary, variant, maxValue, customBackgroundColor, customTextColor, customBorderColor, customIconColor, customIconName, testID, }: BadgeProps) => React.ReactElement;
|
|
3
|
+
export declare const Badge: ({ value, iconName, status, secondary, variant, color, maxValue, customBackgroundColor, customTextColor, customBorderColor, customIconColor, customIconName, testID, }: BadgeProps) => React.ReactElement;
|
package/dist/Badge.js
CHANGED
|
@@ -2,12 +2,42 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Text, View } from "react-native";
|
|
3
3
|
import { Icon } from "./Icon";
|
|
4
4
|
import { useTheme } from "./Theme";
|
|
5
|
-
|
|
5
|
+
const STATUS_DOT_SIZE = 8;
|
|
6
|
+
// Surface tokens for the "status" dot variant, per bold vs subtle tone.
|
|
7
|
+
const STATUS_DOT_BOLD = {
|
|
8
|
+
active: "primary",
|
|
9
|
+
error: "error",
|
|
10
|
+
info: "secondaryDark",
|
|
11
|
+
neutral: "neutralDark",
|
|
12
|
+
success: "success",
|
|
13
|
+
warning: "warning",
|
|
14
|
+
};
|
|
15
|
+
const STATUS_DOT_SUBTLE = {
|
|
16
|
+
active: "secondaryLight",
|
|
17
|
+
error: "errorLight",
|
|
18
|
+
info: "secondaryLight",
|
|
19
|
+
neutral: "neutralLight",
|
|
20
|
+
success: "successLight",
|
|
21
|
+
warning: "warningLight",
|
|
22
|
+
};
|
|
23
|
+
export const Badge = ({ value, iconName, status = "info", secondary = false, variant, color = "bold", maxValue = 100, customBackgroundColor, customTextColor, customBorderColor, customIconColor, customIconName, testID, }) => {
|
|
24
|
+
var _a;
|
|
6
25
|
const { theme } = useTheme();
|
|
7
26
|
const isIconOnly = variant === "iconOnly";
|
|
27
|
+
if (variant === "status") {
|
|
28
|
+
const dotSurface = (_a = (color === "subtle" ? STATUS_DOT_SUBTLE : STATUS_DOT_BOLD)[status]) !== null && _a !== void 0 ? _a : "primary";
|
|
29
|
+
const dotColor = status === "custom" ? customBackgroundColor : theme.surface[dotSurface];
|
|
30
|
+
return (_jsx(View, { style: {
|
|
31
|
+
backgroundColor: dotColor,
|
|
32
|
+
borderRadius: STATUS_DOT_SIZE,
|
|
33
|
+
height: STATUS_DOT_SIZE,
|
|
34
|
+
width: STATUS_DOT_SIZE,
|
|
35
|
+
}, testID: testID }));
|
|
36
|
+
}
|
|
8
37
|
let badgeColor = "inverted";
|
|
9
38
|
// TODO: Move to theme
|
|
10
39
|
const secondaryBorderColors = {
|
|
40
|
+
active: "#8FC1D2",
|
|
11
41
|
custom: "#AAAAAA",
|
|
12
42
|
error: "#F39E9E",
|
|
13
43
|
info: "#8FC1D2",
|
|
@@ -31,6 +61,9 @@ export const Badge = ({ value, iconName, status = "info", secondary = false, var
|
|
|
31
61
|
else if (status === "neutral") {
|
|
32
62
|
badgeColor = "primary";
|
|
33
63
|
}
|
|
64
|
+
else if (status === "active") {
|
|
65
|
+
badgeColor = "link";
|
|
66
|
+
}
|
|
34
67
|
}
|
|
35
68
|
let badgeBgColor = "neutralDark";
|
|
36
69
|
if (status === "error") {
|
|
@@ -48,6 +81,9 @@ export const Badge = ({ value, iconName, status = "info", secondary = false, var
|
|
|
48
81
|
else if (status === "neutral") {
|
|
49
82
|
badgeBgColor = secondary ? "neutralLight" : "neutralDark";
|
|
50
83
|
}
|
|
84
|
+
else if (status === "active") {
|
|
85
|
+
badgeBgColor = secondary ? "secondaryLight" : "primary";
|
|
86
|
+
}
|
|
51
87
|
const backgroundColor = status === "custom" ? customBackgroundColor : theme.surface[badgeBgColor];
|
|
52
88
|
const borderColor = status === "custom" ? customBorderColor : secondaryBorderColors[status];
|
|
53
89
|
const textColor = status === "custom" ? customTextColor : theme.text[badgeColor];
|
package/dist/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../src/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EACpB,KAAK,EACL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C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;oBACnE,eAAe,EAAE,CAAC;oBAClB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;iBAChC;gBACD,OAAO,KAAK,YAAY,IAAI,EAAC,QAAQ,EAAE,EAAE,EAAC;gBAC1C,SAAS,IAAI,EAAC,WAAW,EAAE,WAAW,EAAE,CAAC,EAAC;aAC3C,EACD,MAAM,EAAE,MAAM,aAEb,OAAO,CAAC,OAAO,KAAK,YAAY,IAAI,QAAQ,CAAC,IAAI,CAChD,KAAC,IAAI,IAAC,KAAK,EAAE,EAAC,WAAW,EAAE,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAC,EAAE,MAAM,EAAC,MAAM,YACtF,KAAC,IAAI,IAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,QAAS,EAAE,IAAI,EAAC,IAAI,GAAG,GACtE,CACR,EACA,OAAO,CAAC,OAAO,KAAK,UAAU,CAAC,IAAI,CAClC,KAAC,IAAI,IACH,KAAK,EAAE;wBACL,KAAK,EAAE,SAAS;wBAChB,UAAU,EAAE,MAAM;wBAClB,QAAQ,EAAE,EAAE;wBACZ,UAAU,EAAE,KAAK;qBAClB,YAEA,UAAU,GACN,CACR,IACI,GACF,CACR,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/Common.d.ts
CHANGED
|
@@ -155,7 +155,10 @@ export interface TextThemeConfig {
|
|
|
155
155
|
}
|
|
156
156
|
export interface SurfaceThemeConfig {
|
|
157
157
|
base: keyof ThemePrimitiveColors;
|
|
158
|
+
baseAlternate: keyof ThemePrimitiveColors;
|
|
159
|
+
baseHover: keyof ThemePrimitiveColors;
|
|
158
160
|
primary: keyof ThemePrimitiveColors;
|
|
161
|
+
secondaryExtraLight: keyof ThemePrimitiveColors;
|
|
159
162
|
secondaryLight: keyof ThemePrimitiveColors;
|
|
160
163
|
secondaryDark: keyof ThemePrimitiveColors;
|
|
161
164
|
secondaryExtraDark: keyof ThemePrimitiveColors;
|
|
@@ -217,7 +220,10 @@ export interface TextTheme {
|
|
|
217
220
|
}
|
|
218
221
|
export interface SurfaceTheme {
|
|
219
222
|
base: string;
|
|
223
|
+
baseAlternate: string;
|
|
224
|
+
baseHover: string;
|
|
220
225
|
primary: string;
|
|
226
|
+
secondaryExtraLight: string;
|
|
221
227
|
secondaryLight: string;
|
|
222
228
|
secondaryDark: string;
|
|
223
229
|
secondaryExtraDark: string;
|
|
@@ -312,6 +318,8 @@ export type OnChangeCallback = (result: string) => void;
|
|
|
312
318
|
* ```
|
|
313
319
|
*/
|
|
314
320
|
export interface CustomIconRegistry {
|
|
321
|
+
/** Built-in "bars-filter" glyph (FontAwesome Classic Solid, E0AD). */
|
|
322
|
+
"bars-filter": true;
|
|
315
323
|
}
|
|
316
324
|
/** The set of custom icon names registered via {@link CustomIconRegistry}. */
|
|
317
325
|
export type CustomIconName = keyof CustomIconRegistry & string;
|
|
@@ -330,6 +338,91 @@ export type CustomIconComponent = FC<CustomIconProps>;
|
|
|
330
338
|
* `TerrenoProvider` via the `icons` prop to register custom icons.
|
|
331
339
|
*/
|
|
332
340
|
export type IconRegistryMap = Record<string, CustomIconComponent>;
|
|
341
|
+
export interface FilterOption {
|
|
342
|
+
label: string;
|
|
343
|
+
value: string;
|
|
344
|
+
}
|
|
345
|
+
/** Small blue dot that signals a filter control differs from its default. */
|
|
346
|
+
export type FilterChangesBadgeProps = WithTestID;
|
|
347
|
+
export interface FilterSelectMenuProps extends WithTestID {
|
|
348
|
+
/** Label shown to the left of the select control. */
|
|
349
|
+
title: string;
|
|
350
|
+
/** Selectable options for the single-select control. */
|
|
351
|
+
options: FilterOption[];
|
|
352
|
+
/** Currently selected value. */
|
|
353
|
+
value?: string;
|
|
354
|
+
/** Called with the newly selected value. */
|
|
355
|
+
onChange: (value: string) => void;
|
|
356
|
+
/** Text shown when no value is selected. */
|
|
357
|
+
placeholder?: string;
|
|
358
|
+
/** When true, shows the blue changes dot next to the title. */
|
|
359
|
+
showChangesBadge?: boolean;
|
|
360
|
+
/** Disables the control. */
|
|
361
|
+
disabled?: boolean;
|
|
362
|
+
}
|
|
363
|
+
export interface FilterBooleanProps extends WithTestID {
|
|
364
|
+
/** Label shown to the left of the toggle. */
|
|
365
|
+
title: string;
|
|
366
|
+
/** Whether the toggle is on. */
|
|
367
|
+
value: boolean;
|
|
368
|
+
/** Called with the next toggle value. The entire row is the click zone. */
|
|
369
|
+
onChange: (value: boolean) => void;
|
|
370
|
+
/** When true, shows the blue changes dot next to the title. */
|
|
371
|
+
showChangesBadge?: boolean;
|
|
372
|
+
/** Disables the toggle and the row click zone. */
|
|
373
|
+
disabled?: boolean;
|
|
374
|
+
/** Renders the toggle in a focused (keyboard) state. */
|
|
375
|
+
focused?: boolean;
|
|
376
|
+
}
|
|
377
|
+
export interface FilterAccordionProps extends WithTestID {
|
|
378
|
+
/** Label shown in the always-visible header row. */
|
|
379
|
+
title: string;
|
|
380
|
+
/** Custom content revealed when expanded. Empty by default. */
|
|
381
|
+
children?: React.ReactNode;
|
|
382
|
+
/** Controlled expanded state. Omit to use `defaultExpanded`. */
|
|
383
|
+
expanded?: boolean;
|
|
384
|
+
/** Initial expanded state when uncontrolled. */
|
|
385
|
+
defaultExpanded?: boolean;
|
|
386
|
+
/** Called with the next expanded state when the header row is pressed. */
|
|
387
|
+
onToggle?: (expanded: boolean) => void;
|
|
388
|
+
/** When true, shows the blue changes dot next to the title. */
|
|
389
|
+
showChangesBadge?: boolean;
|
|
390
|
+
}
|
|
391
|
+
export interface FilterProps extends WithTestID {
|
|
392
|
+
/** Composed filter controls rendered inside the dropdown panel. */
|
|
393
|
+
children: React.ReactNode;
|
|
394
|
+
/** Trigger button label. */
|
|
395
|
+
label?: string;
|
|
396
|
+
/** Trigger button icon. Defaults to the built-in `bars-filter` glyph. */
|
|
397
|
+
iconName?: IconName;
|
|
398
|
+
/** Controlled open state. Omit to use `defaultOpen`. */
|
|
399
|
+
isOpen?: boolean;
|
|
400
|
+
/** Initial open state when uncontrolled. */
|
|
401
|
+
defaultOpen?: boolean;
|
|
402
|
+
/** Called whenever the dropdown opens or closes. */
|
|
403
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
404
|
+
/** Master toggle for the Apply/Clear/Cancel footer. */
|
|
405
|
+
showActionButtons?: boolean;
|
|
406
|
+
/** Show the Apply button in the footer. */
|
|
407
|
+
showApplyButton?: boolean;
|
|
408
|
+
/** Show the Clear hyperlink in the footer. */
|
|
409
|
+
showClearButton?: boolean;
|
|
410
|
+
/** Show the Cancel button in the footer. */
|
|
411
|
+
showCancelButton?: boolean;
|
|
412
|
+
applyButtonText?: string;
|
|
413
|
+
clearButtonText?: string;
|
|
414
|
+
cancelButtonText?: string;
|
|
415
|
+
/** Called when Apply is pressed. The dropdown then closes. */
|
|
416
|
+
onApply?: () => void;
|
|
417
|
+
/** Called when Clear is pressed. The dropdown then closes. */
|
|
418
|
+
onClear?: () => void;
|
|
419
|
+
/** Called when Cancel or a click-outside closes the dropdown. */
|
|
420
|
+
onCancel?: () => void;
|
|
421
|
+
/** Primary theming for the trigger and Apply button. */
|
|
422
|
+
variant?: "primary" | "secondary";
|
|
423
|
+
/** Panel width in pixels. Defaults to 320 per the design spec. */
|
|
424
|
+
width?: number;
|
|
425
|
+
}
|
|
333
426
|
export type AlignContent = "start" | "end" | "center" | "between" | "around" | "stretch";
|
|
334
427
|
export type AlignSelf = "auto" | "start" | "end" | "center" | "baseline" | "stretch";
|
|
335
428
|
export type AlignItems = "start" | "end" | "center" | "baseline" | "stretch";
|
|
@@ -530,6 +623,43 @@ export type CardProps = BoxProps & {
|
|
|
530
623
|
*/
|
|
531
624
|
imageHeight?: number;
|
|
532
625
|
};
|
|
626
|
+
export type EditableCardProps = BoxProps & {
|
|
627
|
+
/**
|
|
628
|
+
* The name of an icon shown before the title.
|
|
629
|
+
*/
|
|
630
|
+
iconName?: IconName;
|
|
631
|
+
/**
|
|
632
|
+
* The title of the summarized information.
|
|
633
|
+
*/
|
|
634
|
+
title?: string;
|
|
635
|
+
/**
|
|
636
|
+
* Props for a badge rendered next to the title.
|
|
637
|
+
*/
|
|
638
|
+
badge?: BadgeProps;
|
|
639
|
+
/**
|
|
640
|
+
* The summarized information itself, displayed below the title.
|
|
641
|
+
*/
|
|
642
|
+
description?: string;
|
|
643
|
+
/**
|
|
644
|
+
* Secondary text displayed below the description, in a muted style.
|
|
645
|
+
*/
|
|
646
|
+
helperText?: string;
|
|
647
|
+
/**
|
|
648
|
+
* Callback invoked when the edit button is pressed. The edit button is only rendered when this
|
|
649
|
+
* is provided.
|
|
650
|
+
*/
|
|
651
|
+
onEdit?: () => void | Promise<void>;
|
|
652
|
+
/**
|
|
653
|
+
* Accessibility label for the edit button.
|
|
654
|
+
* @default "Edit"
|
|
655
|
+
*/
|
|
656
|
+
editAccessibilityLabel?: string;
|
|
657
|
+
/**
|
|
658
|
+
* If true, the card is highlighted to draw attention to it, e.g. for content that needs review.
|
|
659
|
+
* @default false
|
|
660
|
+
*/
|
|
661
|
+
attention?: boolean;
|
|
662
|
+
};
|
|
533
663
|
export interface ErrorBoundaryProps {
|
|
534
664
|
onError?: (error: Error, stack: string) => void;
|
|
535
665
|
children?: ReactNode;
|
|
@@ -1202,15 +1332,22 @@ export interface BadgeProps extends WithTestID {
|
|
|
1202
1332
|
* The status of the badge. Determines its color and appearance.
|
|
1203
1333
|
* @default "info"
|
|
1204
1334
|
*/
|
|
1205
|
-
status?: "info" | "error" | "warning" | "success" | "neutral" | "custom";
|
|
1335
|
+
status?: "info" | "error" | "warning" | "success" | "neutral" | "active" | "custom";
|
|
1336
|
+
/**
|
|
1337
|
+
* For the "status" variant, whether the dot uses the bold (saturated) or
|
|
1338
|
+
* subtle (light) tone.
|
|
1339
|
+
* @default "bold"
|
|
1340
|
+
*/
|
|
1341
|
+
color?: "bold" | "subtle";
|
|
1206
1342
|
/**
|
|
1207
1343
|
* The text or number to display inside the badge.
|
|
1208
1344
|
*/
|
|
1209
1345
|
value?: number | string;
|
|
1210
1346
|
/**
|
|
1211
|
-
* The variant of the badge.
|
|
1347
|
+
* The variant of the badge. "status" renders a small colored dot (no text)
|
|
1348
|
+
* used to indicate an active/modified state.
|
|
1212
1349
|
*/
|
|
1213
|
-
variant?: "iconOnly" | "numberOnly";
|
|
1350
|
+
variant?: "iconOnly" | "numberOnly" | "status";
|
|
1214
1351
|
}
|
|
1215
1352
|
export type ThumbsUpDownFeedbackValue = "positive" | "negative";
|
|
1216
1353
|
export interface ThumbsUpDownFeedbackProps extends WithTestID {
|
|
@@ -2462,6 +2599,15 @@ export interface SelectFieldPropsBase extends WithTestID {
|
|
|
2462
2599
|
* @default false
|
|
2463
2600
|
*/
|
|
2464
2601
|
disableSearch?: boolean;
|
|
2602
|
+
/**
|
|
2603
|
+
* Web only. When true, the dropdown menu renders in a fixed portal on
|
|
2604
|
+
* `document.body` (zIndex 9999) instead of a React Native `Modal`. Use this
|
|
2605
|
+
* when the select lives inside another portaled/high-zIndex overlay (e.g. the
|
|
2606
|
+
* `Filter` panel) where a `Modal` would stack behind the overlay and be
|
|
2607
|
+
* invisible and unclickable.
|
|
2608
|
+
* @default false
|
|
2609
|
+
*/
|
|
2610
|
+
renderMenuInBodyPortal?: boolean;
|
|
2465
2611
|
/**
|
|
2466
2612
|
* The title of the select field.
|
|
2467
2613
|
*/
|
package/dist/Common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.js","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AA6BA,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,EAC5B,4BAA4B,EAC5B,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,WAAW,GACZ,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{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AAE;IACN,EAAE,EAAE,CAAC;IACL,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,GAAG;IACZ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAkB,EAAE,EAAE;IAChD,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC;AA81EF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC"}
|
package/dist/DateTimeField.js
CHANGED
|
@@ -163,8 +163,6 @@ export const DateTimeField = ({ type, title, value, onChange, timezone: provided
|
|
|
163
163
|
var _a;
|
|
164
164
|
const { theme } = useTheme();
|
|
165
165
|
const fieldTestIDs = resolveFieldTestIDsFromProps({ testID, testIDs });
|
|
166
|
-
// noExplicitAny: ActionSheet class is defined in ActionSheet.tsx which imports from Common.ts indirectly; using its type here would create a circular dependency
|
|
167
|
-
// biome-ignore lint/suspicious/noExplicitAny: ActionSheet class is defined in ActionSheet.tsx which imports from Common.ts indirectly; using its type here would create a circular dependency
|
|
168
166
|
const dateActionSheetRef = React.createRef();
|
|
169
167
|
const [amPm, setAmPm] = useState("am");
|
|
170
168
|
const [showDate, setShowDate] = useState(false);
|
|
@@ -242,6 +240,7 @@ export const DateTimeField = ({ type, title, value, onChange, timezone: provided
|
|
|
242
240
|
}
|
|
243
241
|
}
|
|
244
242
|
}
|
|
243
|
+
// Minutes are not validated here: handleFieldChange validates them before this is reached.
|
|
245
244
|
if (type === "time" || type === "datetime") {
|
|
246
245
|
if (fieldIndex === (type === "time" ? 0 : 3)) {
|
|
247
246
|
// Hour
|
|
@@ -250,13 +249,6 @@ export const DateTimeField = ({ type, title, value, onChange, timezone: provided
|
|
|
250
249
|
return "Hour must be between 1 and 12";
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
|
-
else if (fieldIndex === (type === "time" ? 1 : 4)) {
|
|
254
|
-
// Minute
|
|
255
|
-
const minuteNum = parseInt(fieldValue, 10);
|
|
256
|
-
if (Number.isNaN(minuteNum) || minuteNum < 0 || minuteNum > 59) {
|
|
257
|
-
return "Minute must be between 0 and 59";
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
252
|
}
|
|
261
253
|
return undefined;
|
|
262
254
|
}, [type]);
|
|
@@ -347,7 +339,7 @@ export const DateTimeField = ({ type, title, value, onChange, timezone: provided
|
|
|
347
339
|
* Auto-advances focus to the next segment when the current one is full.
|
|
348
340
|
*/
|
|
349
341
|
const handleFieldChange = useCallback((index, text, config) => {
|
|
350
|
-
var _a
|
|
342
|
+
var _a;
|
|
351
343
|
const numericValue = text.replace(/[^0-9]/g, "");
|
|
352
344
|
// For minutes, just ensure it's at most 2 digits and valid (0-59)
|
|
353
345
|
if ((type === "time" && index === 1) || (type === "datetime" && index === 4)) {
|
|
@@ -377,11 +369,7 @@ export const DateTimeField = ({ type, title, value, onChange, timezone: provided
|
|
|
377
369
|
else {
|
|
378
370
|
setFieldErrors((prev) => (Object.assign(Object.assign({}, prev), { [index]: "Minute must be between 0 and 59" })));
|
|
379
371
|
}
|
|
380
|
-
//
|
|
381
|
-
const configs = getFieldConfigs();
|
|
382
|
-
if (finalValue.length === config.maxLength && index < configs.length - 1) {
|
|
383
|
-
(_a = inputRefs.current[index + 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
384
|
-
}
|
|
372
|
+
// The minute segment is always last, so there is nothing to advance focus to.
|
|
385
373
|
return;
|
|
386
374
|
}
|
|
387
375
|
// For other fields, handle leading zeros
|
|
@@ -438,7 +426,7 @@ export const DateTimeField = ({ type, title, value, onChange, timezone: provided
|
|
|
438
426
|
// Auto-advance to next field if current field is full
|
|
439
427
|
const configs = getFieldConfigs();
|
|
440
428
|
if (finalValue.length === config.maxLength && index < configs.length - 1) {
|
|
441
|
-
(
|
|
429
|
+
(_a = inputRefs.current[index + 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
442
430
|
}
|
|
443
431
|
}, [type, getFieldConfigs, getISOFromFields, onChange, value, validateField, month, day, year]);
|
|
444
432
|
/**
|
|
@@ -479,11 +467,7 @@ export const DateTimeField = ({ type, title, value, onChange, timezone: provided
|
|
|
479
467
|
.set({ millisecond: 0, second: 0 })
|
|
480
468
|
.toISO()
|
|
481
469
|
: parsedDate.set({ millisecond: 0, second: 0 }).toUTC().toISO();
|
|
482
|
-
|
|
483
|
-
console.warn("Invalid date passed to DateTimeField", parsedDate);
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
onChange(normalized);
|
|
470
|
+
onChange(normalized !== null && normalized !== void 0 ? normalized : "");
|
|
487
471
|
setShowDate(false);
|
|
488
472
|
}, [onChange, type]);
|
|
489
473
|
/**
|