@drawbridge/components 0.0.72 → 0.0.74
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/dist/input-number.js +11 -1
- package/dist/input-number.mjs +11 -1
- package/dist/input-phone.js +19 -3
- package/dist/input-phone.mjs +20 -4
- package/package.json +3 -3
package/dist/input-number.js
CHANGED
|
@@ -268,9 +268,19 @@ var InputNumber = ({
|
|
|
268
268
|
// the utility could render zero-width. inputStyle supplies the color.
|
|
269
269
|
style: {
|
|
270
270
|
...inputStyle(style),
|
|
271
|
-
...inline
|
|
271
|
+
...inline ? {
|
|
272
272
|
borderStyle: "solid",
|
|
273
273
|
borderWidth: 1
|
|
274
|
+
} : {
|
|
275
|
+
// The `p-0` above cannot be trusted to cancel `.input`'s padding.
|
|
276
|
+
// share defines `.input` UNLAYERED after `@import 'tailwindcss'`,
|
|
277
|
+
// and v4 emits every utility inside `@layer utilities` — unlayered
|
|
278
|
+
// rules beat layered ones at any specificity, so `.input`'s
|
|
279
|
+
// py-2/px-3 won and the stepper row rendered 60px tall with the
|
|
280
|
+
// buttons inset from the border. An inline style outranks both
|
|
281
|
+
// layers; app-web (v3, `.input` in @layer base, where `p-0`
|
|
282
|
+
// already wins) is unchanged.
|
|
283
|
+
padding: 0
|
|
274
284
|
}
|
|
275
285
|
}
|
|
276
286
|
},
|
package/dist/input-number.mjs
CHANGED
|
@@ -178,9 +178,19 @@ var InputNumber = ({
|
|
|
178
178
|
// the utility could render zero-width. inputStyle supplies the color.
|
|
179
179
|
style: {
|
|
180
180
|
...inputStyle(style),
|
|
181
|
-
...inline
|
|
181
|
+
...inline ? {
|
|
182
182
|
borderStyle: "solid",
|
|
183
183
|
borderWidth: 1
|
|
184
|
+
} : {
|
|
185
|
+
// The `p-0` above cannot be trusted to cancel `.input`'s padding.
|
|
186
|
+
// share defines `.input` UNLAYERED after `@import 'tailwindcss'`,
|
|
187
|
+
// and v4 emits every utility inside `@layer utilities` — unlayered
|
|
188
|
+
// rules beat layered ones at any specificity, so `.input`'s
|
|
189
|
+
// py-2/px-3 won and the stepper row rendered 60px tall with the
|
|
190
|
+
// buttons inset from the border. An inline style outranks both
|
|
191
|
+
// layers; app-web (v3, `.input` in @layer base, where `p-0`
|
|
192
|
+
// already wins) is unchanged.
|
|
193
|
+
padding: 0
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
196
|
},
|
package/dist/input-phone.js
CHANGED
|
@@ -104,12 +104,18 @@ var InputPhone = ({
|
|
|
104
104
|
(0, import_react.useEffect)(
|
|
105
105
|
() => {
|
|
106
106
|
if (value == null ? void 0 : value.country) return;
|
|
107
|
+
const detected = (0, import_phone.detectCountry)(value == null ? void 0 : value.number);
|
|
108
|
+
if (detected && countries.includes(detected)) {
|
|
109
|
+
setCountry(detected);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
;
|
|
107
113
|
const tags = [navigator.language, ...navigator.languages || []];
|
|
108
|
-
const
|
|
114
|
+
const locale = tags.map((tag) => {
|
|
109
115
|
var _a2, _b2;
|
|
110
116
|
return (_b2 = (_a2 = tag == null ? void 0 : tag.split("-")) == null ? void 0 : _a2[1]) == null ? void 0 : _b2.toUpperCase();
|
|
111
117
|
}).find((code) => code && countries.includes(code));
|
|
112
|
-
if (
|
|
118
|
+
if (locale) setCountry(locale);
|
|
113
119
|
},
|
|
114
120
|
[]
|
|
115
121
|
);
|
|
@@ -221,9 +227,19 @@ var InputPhone = ({
|
|
|
221
227
|
...{
|
|
222
228
|
"aria-label": "Phone Number",
|
|
223
229
|
className: "input w-full border-none focus:outline-none focus:ring-0 focus:border-inherit",
|
|
224
|
-
onChange: (val) =>
|
|
230
|
+
onChange: (val) => {
|
|
231
|
+
setNumber(val);
|
|
232
|
+
const detected = (0, import_phone.detectCountry)(val);
|
|
233
|
+
if (detected && countries.includes(detected)) setCountry(detected);
|
|
234
|
+
},
|
|
225
235
|
style: inputPhoneStyle(style),
|
|
226
236
|
value: number,
|
|
237
|
+
// country-mode pins the input to the selected calling code, so
|
|
238
|
+
// detection can only follow countries SHARING that code (US/CA
|
|
239
|
+
// on +1) — any other '+xx' the visitor types is discarded by the
|
|
240
|
+
// library before it reaches onChange. Reaching every country
|
|
241
|
+
// needs defaultCountry mode instead, which unpins the prefix but
|
|
242
|
+
// changes the field to national-format display.
|
|
227
243
|
...country && {
|
|
228
244
|
country,
|
|
229
245
|
international: true,
|
package/dist/input-phone.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
// components/input-phone.js
|
|
10
10
|
import { useEffect, useState } from "react";
|
|
11
11
|
import Input from "react-phone-number-input/input";
|
|
12
|
-
import { isValid } from "@drawbridge/drawbridge-utils/phone";
|
|
12
|
+
import { detectCountry, isValid } from "@drawbridge/drawbridge-utils/phone";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
var isValidPhone = (number = "", country = "") => {
|
|
15
15
|
const valid = isValid(number, country);
|
|
@@ -27,12 +27,18 @@ var InputPhone = ({
|
|
|
27
27
|
useEffect(
|
|
28
28
|
() => {
|
|
29
29
|
if (value == null ? void 0 : value.country) return;
|
|
30
|
+
const detected = detectCountry(value == null ? void 0 : value.number);
|
|
31
|
+
if (detected && countries.includes(detected)) {
|
|
32
|
+
setCountry(detected);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
;
|
|
30
36
|
const tags = [navigator.language, ...navigator.languages || []];
|
|
31
|
-
const
|
|
37
|
+
const locale = tags.map((tag) => {
|
|
32
38
|
var _a2, _b2;
|
|
33
39
|
return (_b2 = (_a2 = tag == null ? void 0 : tag.split("-")) == null ? void 0 : _a2[1]) == null ? void 0 : _b2.toUpperCase();
|
|
34
40
|
}).find((code) => code && countries.includes(code));
|
|
35
|
-
if (
|
|
41
|
+
if (locale) setCountry(locale);
|
|
36
42
|
},
|
|
37
43
|
[]
|
|
38
44
|
);
|
|
@@ -144,9 +150,19 @@ var InputPhone = ({
|
|
|
144
150
|
...{
|
|
145
151
|
"aria-label": "Phone Number",
|
|
146
152
|
className: "input w-full border-none focus:outline-none focus:ring-0 focus:border-inherit",
|
|
147
|
-
onChange: (val) =>
|
|
153
|
+
onChange: (val) => {
|
|
154
|
+
setNumber(val);
|
|
155
|
+
const detected = detectCountry(val);
|
|
156
|
+
if (detected && countries.includes(detected)) setCountry(detected);
|
|
157
|
+
},
|
|
148
158
|
style: inputPhoneStyle(style),
|
|
149
159
|
value: number,
|
|
160
|
+
// country-mode pins the input to the selected calling code, so
|
|
161
|
+
// detection can only follow countries SHARING that code (US/CA
|
|
162
|
+
// on +1) — any other '+xx' the visitor types is discarded by the
|
|
163
|
+
// library before it reaches onChange. Reaching every country
|
|
164
|
+
// needs defaultCountry mode instead, which unpins the prefix but
|
|
165
|
+
// changes the field to national-format display.
|
|
150
166
|
...country && {
|
|
151
167
|
country,
|
|
152
168
|
international: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawbridge/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./advertisement": {
|
|
6
6
|
"types": "./types/advertisement.d.ts",
|
|
@@ -407,7 +407,7 @@
|
|
|
407
407
|
"build": ". \"$HOME/.nvm/nvm.sh\" && nvm use && tsup && node --test && npm publish"
|
|
408
408
|
},
|
|
409
409
|
"peerDependencies": {
|
|
410
|
-
"@drawbridge/drawbridge-utils": ">=0.0.
|
|
410
|
+
"@drawbridge/drawbridge-utils": ">=0.0.118",
|
|
411
411
|
"@drawbridge/shopify": ">=0.0.8",
|
|
412
412
|
"next": ">=14",
|
|
413
413
|
"react": ">=18"
|
|
@@ -415,7 +415,7 @@
|
|
|
415
415
|
"devDependencies": {
|
|
416
416
|
"@types/react": "18.0.0",
|
|
417
417
|
"tsup": "8.5.1",
|
|
418
|
-
"@drawbridge/drawbridge-agents": "0.1.
|
|
418
|
+
"@drawbridge/drawbridge-agents": "0.1.47"
|
|
419
419
|
},
|
|
420
420
|
"dependencies": {
|
|
421
421
|
"embla-carousel-fade": "8.6.0",
|