@bricks-toolkit/toolkit 0.1.10 → 0.1.11

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.
@@ -202,6 +202,7 @@ var Phone = react.forwardRef(function Phone2({
202
202
  onChange,
203
203
  showFlag = true,
204
204
  defaultCountryCode = "+91",
205
+ defaultCountry,
205
206
  autoComplete = "tel",
206
207
  ...rest
207
208
  }, ref) {
@@ -213,8 +214,17 @@ var Phone = react.forwardRef(function Phone2({
213
214
  const [isOpen, setIsOpen] = react.useState(false);
214
215
  const [searchTerm, setSearchTerm] = react.useState("");
215
216
  const dropdownRef = react.useRef(null);
217
+ const initialDialCode = (() => {
218
+ if (defaultCountry) {
219
+ const country = COUNTRIES.find(
220
+ (c) => c.id.toLowerCase() === defaultCountry.toLowerCase()
221
+ );
222
+ if (country) return country.dialCode;
223
+ }
224
+ return defaultCountryCode;
225
+ })();
216
226
  const [internalPhone, setInternalPhone] = react.useState(
217
- defaultValue ?? { countryCode: defaultCountryCode, phoneNumber: "" }
227
+ defaultValue ?? { countryCode: initialDialCode, phoneNumber: "" }
218
228
  );
219
229
  const isControlled = value !== void 0;
220
230
  const currentPhone = isControlled ? value : internalPhone;
@@ -200,6 +200,7 @@ var Phone = forwardRef(function Phone2({
200
200
  onChange,
201
201
  showFlag = true,
202
202
  defaultCountryCode = "+91",
203
+ defaultCountry,
203
204
  autoComplete = "tel",
204
205
  ...rest
205
206
  }, ref) {
@@ -211,8 +212,17 @@ var Phone = forwardRef(function Phone2({
211
212
  const [isOpen, setIsOpen] = useState(false);
212
213
  const [searchTerm, setSearchTerm] = useState("");
213
214
  const dropdownRef = useRef(null);
215
+ const initialDialCode = (() => {
216
+ if (defaultCountry) {
217
+ const country = COUNTRIES.find(
218
+ (c) => c.id.toLowerCase() === defaultCountry.toLowerCase()
219
+ );
220
+ if (country) return country.dialCode;
221
+ }
222
+ return defaultCountryCode;
223
+ })();
214
224
  const [internalPhone, setInternalPhone] = useState(
215
- defaultValue ?? { countryCode: defaultCountryCode, phoneNumber: "" }
225
+ defaultValue ?? { countryCode: initialDialCode, phoneNumber: "" }
216
226
  );
217
227
  const isControlled = value !== void 0;
218
228
  const currentPhone = isControlled ? value : internalPhone;
package/dist/index.cjs CHANGED
@@ -16,7 +16,7 @@ var chunkS7VEND5Z_cjs = require('./chunk-S7VEND5Z.cjs');
16
16
  var chunk56ILK7Y4_cjs = require('./chunk-56ILK7Y4.cjs');
17
17
  var chunkNRZIXK35_cjs = require('./chunk-NRZIXK35.cjs');
18
18
  var chunk5RKET2JO_cjs = require('./chunk-5RKET2JO.cjs');
19
- var chunkB4OV5GRT_cjs = require('./chunk-B4OV5GRT.cjs');
19
+ var chunkB2FU2E2X_cjs = require('./chunk-B2FU2E2X.cjs');
20
20
  var chunkVRZFAKSV_cjs = require('./chunk-VRZFAKSV.cjs');
21
21
  var chunk7R5JRJ2W_cjs = require('./chunk-7R5JRJ2W.cjs');
22
22
  var chunkOEU5VG3D_cjs = require('./chunk-OEU5VG3D.cjs');
@@ -697,7 +697,7 @@ Object.defineProperty(exports, "PasswordInput", {
697
697
  });
698
698
  Object.defineProperty(exports, "Phone", {
699
699
  enumerable: true,
700
- get: function () { return chunkB4OV5GRT_cjs.Phone; }
700
+ get: function () { return chunkB2FU2E2X_cjs.Phone; }
701
701
  });
702
702
  Object.defineProperty(exports, "RadioButton", {
703
703
  enumerable: true,
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ export { Skeleton, SkeletonAvatar, SkeletonCard, SkeletonTable, SkeletonText } f
14
14
  export { MultiSelect } from './chunk-JKPNJ4PZ.mjs';
15
15
  export { OtpInput } from './chunk-RYWDZHKG.mjs';
16
16
  export { PasswordInput } from './chunk-446OJWC6.mjs';
17
- export { Phone } from './chunk-CBA54EY4.mjs';
17
+ export { Phone } from './chunk-TBMIMUU4.mjs';
18
18
  export { RadioButton } from './chunk-DN2GFJF4.mjs';
19
19
  export { Select } from './chunk-TIVSMCXZ.mjs';
20
20
  export { Pagination, Table } from './chunk-7364SUK6.mjs';
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkB4OV5GRT_cjs = require('../chunk-B4OV5GRT.cjs');
3
+ var chunkB2FU2E2X_cjs = require('../chunk-B2FU2E2X.cjs');
4
4
  require('../chunk-L5VQZZVR.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "Phone", {
9
9
  enumerable: true,
10
- get: function () { return chunkB4OV5GRT_cjs.Phone; }
10
+ get: function () { return chunkB2FU2E2X_cjs.Phone; }
11
11
  });
@@ -1,2 +1,2 @@
1
- export { Phone } from '../chunk-CBA54EY4.mjs';
1
+ export { Phone } from '../chunk-TBMIMUU4.mjs';
2
2
  import '../chunk-OCPFOFJ4.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bricks-toolkit/toolkit",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Micro-modularized, fully independent, type-safe UI component library",
5
5
  "license": "MIT",
6
6
  "author": "ITProfound",
@@ -373,24 +373,6 @@
373
373
  "README.md",
374
374
  "LICENSE"
375
375
  ],
376
- "scripts": {
377
- "storybook": "storybook dev -p 6006 --no-version-updates",
378
- "build": "tsup && copy src\\styles\\theme.css dist\\theme.css",
379
- "build:watch": "tsup --watch",
380
- "build:storybook": "storybook build",
381
- "test": "vitest run",
382
- "test:watch": "vitest",
383
- "test:coverage": "vitest run --coverage",
384
- "lint": "eslint .",
385
- "lint:fix": "eslint . --fix",
386
- "format": "prettier --write .",
387
- "format:check": "prettier --check .",
388
- "typecheck": "tsc --noEmit",
389
- "validate": "pnpm typecheck && pnpm lint && pnpm test",
390
- "clean": "rimraf dist",
391
- "prepare": "husky",
392
- "audit": "pnpm audit"
393
- },
394
376
  "devDependencies": {
395
377
  "@eslint/js": "10.0.1",
396
378
  "@storybook/addon-a11y": "10.3.5",
@@ -462,5 +444,22 @@
462
444
  },
463
445
  "dependencies": {
464
446
  "@heroicons/react": "2.2.0"
447
+ },
448
+ "scripts": {
449
+ "storybook": "storybook dev -p 6006 --no-version-updates",
450
+ "build": "tsup && copy src\\styles\\theme.css dist\\theme.css",
451
+ "build:watch": "tsup --watch",
452
+ "build:storybook": "storybook build",
453
+ "test": "vitest run",
454
+ "test:watch": "vitest",
455
+ "test:coverage": "vitest run --coverage",
456
+ "lint": "eslint .",
457
+ "lint:fix": "eslint . --fix",
458
+ "format": "prettier --write .",
459
+ "format:check": "prettier --check .",
460
+ "typecheck": "tsc --noEmit",
461
+ "validate": "pnpm typecheck && pnpm lint && pnpm test",
462
+ "clean": "rimraf dist",
463
+ "audit": "pnpm audit"
465
464
  }
466
- }
465
+ }
package/dist/theme.css DELETED
@@ -1,62 +0,0 @@
1
- @theme {
2
- /* Brand & Status Colors */
3
- --color-primary: var(--primary);
4
- --color-primary-hover: var(--primary-hover);
5
- --color-primary-active: var(--primary-active);
6
- --color-secondary: var(--secondary);
7
- --color-secondary-hover: var(--secondary-hover);
8
- --color-accent: var(--accent);
9
- --color-success: var(--success);
10
- --color-warning: var(--warning);
11
- --color-error: var(--error);
12
- --color-info: var(--info);
13
-
14
- /* Layout & Surface Colors */
15
- --color-background: var(--background);
16
- --color-surface: var(--surface);
17
- --color-surface-secondary: var(--surface-secondary);
18
- --color-border: var(--border);
19
- --color-border-light: var(--border-light);
20
- --color-divider: var(--divider);
21
-
22
- /* Text Colors */
23
- --color-text: var(--text);
24
- --color-text-secondary: var(--text-secondary);
25
- --color-text-muted: var(--text-muted);
26
- --color-text-inverse: var(--text-inverse);
27
-
28
- /* Interaction Colors */
29
- --color-hover: var(--hover);
30
- --color-active: var(--active);
31
- --color-focus: var(--focus);
32
- --color-disabled: var(--disabled);
33
-
34
- /* Semantic Mappings (Shadcn-like) */
35
- --color-primary-foreground: var(--text-inverse);
36
- --color-secondary-foreground: var(--text);
37
- --color-muted: var(--surface-secondary);
38
- --color-muted-foreground: var(--text-muted);
39
- --color-accent-foreground: var(--text-inverse);
40
- --color-destructive: var(--error);
41
- --color-destructive-foreground: var(--text-inverse);
42
-
43
- /* Shadows */
44
- --shadow-sm: var(--shadow-sm);
45
- --shadow-md: var(--shadow-md);
46
- --shadow-lg: var(--shadow-lg);
47
- --shadow-xl: var(--shadow-xl);
48
- --shadow-2xl: var(--shadow-2xl);
49
- --shadow-premium: var(--shadow-premium);
50
-
51
- /* Durations */
52
- --duration-fast: 150ms;
53
- --duration-normal: 250ms;
54
- --duration-slow: 400ms;
55
-
56
- /* Z-Index */
57
- --z-index-dropdown: 1000;
58
- --z-index-sticky: 1020;
59
- --z-index-popover: 1030;
60
- --z-index-modal: 1050;
61
- --z-index-tooltip: 1100;
62
- }