@korsolutions/ui 0.0.37 → 0.0.39
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/module/components/alert-dialog/alert-dialog.js +41 -0
- package/dist/module/components/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/module/components/alert-dialog/async-alert-dialog.js +117 -0
- package/dist/module/components/alert-dialog/async-alert-dialog.js.map +1 -0
- package/dist/module/components/alert-dialog/index.js +6 -0
- package/dist/module/components/alert-dialog/index.js.map +1 -0
- package/dist/module/components/alert-dialog/variants/default.js +93 -0
- package/dist/module/components/alert-dialog/variants/default.js.map +1 -0
- package/dist/module/components/alert-dialog/variants/index.js +7 -0
- package/dist/module/components/alert-dialog/variants/index.js.map +1 -0
- package/dist/module/components/autocomplete/autocomplete.js +31 -0
- package/dist/module/components/autocomplete/autocomplete.js.map +1 -0
- package/dist/module/components/autocomplete/variants/default.js +88 -0
- package/dist/module/components/autocomplete/variants/default.js.map +1 -0
- package/dist/module/components/autocomplete/variants/index.js +7 -0
- package/dist/module/components/autocomplete/variants/index.js.map +1 -0
- package/dist/module/components/index.js +2 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/input/numeric-input.js +7 -6
- package/dist/module/components/input/numeric-input.js.map +1 -1
- package/dist/module/index.js +2 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/primitives/alert-dialog/alert-dialog-action.js +34 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-action.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-cancel.js +34 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-cancel.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-content.js +23 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-content.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-description.js +23 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-description.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-footer.js +23 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-footer.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-overlay.js +26 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-overlay.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-portal.js +20 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-portal.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-root.js +22 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-root.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-title.js +23 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-title.js.map +1 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-trigger.js +28 -0
- package/dist/module/primitives/alert-dialog/alert-dialog-trigger.js.map +1 -0
- package/dist/module/primitives/alert-dialog/context.js +12 -0
- package/dist/module/primitives/alert-dialog/context.js.map +1 -0
- package/dist/module/primitives/alert-dialog/index.js +26 -0
- package/dist/module/primitives/alert-dialog/index.js.map +1 -0
- package/dist/module/primitives/alert-dialog/types.js +4 -0
- package/dist/module/primitives/alert-dialog/types.js.map +1 -0
- package/dist/module/primitives/autocomplete/autocomplete-content.js +33 -0
- package/dist/module/primitives/autocomplete/autocomplete-content.js.map +1 -0
- package/dist/module/primitives/autocomplete/autocomplete-empty.js +17 -0
- package/dist/module/primitives/autocomplete/autocomplete-empty.js.map +1 -0
- package/dist/module/primitives/autocomplete/autocomplete-input.js +73 -0
- package/dist/module/primitives/autocomplete/autocomplete-input.js.map +1 -0
- package/dist/module/primitives/autocomplete/autocomplete-option.js +54 -0
- package/dist/module/primitives/autocomplete/autocomplete-option.js.map +1 -0
- package/dist/module/primitives/autocomplete/autocomplete-overlay.js +20 -0
- package/dist/module/primitives/autocomplete/autocomplete-overlay.js.map +1 -0
- package/dist/module/primitives/autocomplete/autocomplete-portal.js +25 -0
- package/dist/module/primitives/autocomplete/autocomplete-portal.js.map +1 -0
- package/dist/module/primitives/autocomplete/autocomplete-root.js +69 -0
- package/dist/module/primitives/autocomplete/autocomplete-root.js.map +1 -0
- package/dist/module/primitives/autocomplete/context.js +12 -0
- package/dist/module/primitives/autocomplete/context.js.map +1 -0
- package/dist/module/primitives/autocomplete/index.js +20 -0
- package/dist/module/primitives/autocomplete/index.js.map +1 -0
- package/dist/module/primitives/autocomplete/types.js +4 -0
- package/dist/module/primitives/autocomplete/types.js.map +1 -0
- package/dist/module/primitives/dropdown-menu/dropdown-menu-divider.js +2 -2
- package/dist/module/primitives/dropdown-menu/dropdown-menu-divider.js.map +1 -1
- package/dist/module/primitives/dropdown-menu/dropdown-menu-trigger.js +3 -7
- package/dist/module/primitives/dropdown-menu/dropdown-menu-trigger.js.map +1 -1
- package/dist/module/primitives/index.js +2 -0
- package/dist/module/primitives/index.js.map +1 -1
- package/dist/module/primitives/input/input.js +3 -4
- package/dist/module/primitives/input/input.js.map +1 -1
- package/dist/module/primitives/popover/popover-portal.js +1 -1
- package/dist/module/primitives/popover/popover-portal.js.map +1 -1
- package/dist/module/primitives/popover/popover-trigger.js +3 -7
- package/dist/module/primitives/popover/popover-trigger.js.map +1 -1
- package/dist/module/primitives/portal/portal.js +4 -35
- package/dist/module/primitives/portal/portal.js.map +1 -1
- package/dist/module/primitives/select/context.js.map +1 -1
- package/dist/module/primitives/select/select-content.js +16 -5
- package/dist/module/primitives/select/select-content.js.map +1 -1
- package/dist/module/primitives/select/select-root.js +7 -3
- package/dist/module/primitives/select/select-root.js.map +1 -1
- package/dist/module/primitives/select/select-trigger.js +16 -11
- package/dist/module/primitives/select/select-trigger.js.map +1 -1
- package/dist/module/utils/normalize-layout.js +17 -0
- package/dist/module/utils/normalize-layout.js.map +1 -1
- package/dist/typescript/src/components/alert-dialog/alert-dialog.d.ts +15 -0
- package/dist/typescript/src/components/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/typescript/src/components/alert-dialog/async-alert-dialog.d.ts +19 -0
- package/dist/typescript/src/components/alert-dialog/async-alert-dialog.d.ts.map +1 -0
- package/dist/typescript/src/components/alert-dialog/index.d.ts +4 -0
- package/dist/typescript/src/components/alert-dialog/index.d.ts.map +1 -0
- package/dist/typescript/src/components/alert-dialog/variants/default.d.ts +3 -0
- package/dist/typescript/src/components/alert-dialog/variants/default.d.ts.map +1 -0
- package/dist/typescript/src/components/alert-dialog/variants/index.d.ts +4 -0
- package/dist/typescript/src/components/alert-dialog/variants/index.d.ts.map +1 -0
- package/dist/typescript/src/components/autocomplete/autocomplete.d.ts +11 -0
- package/dist/typescript/src/components/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/typescript/src/components/autocomplete/variants/default.d.ts +3 -0
- package/dist/typescript/src/components/autocomplete/variants/default.d.ts.map +1 -0
- package/dist/typescript/src/components/autocomplete/variants/index.d.ts +5 -0
- package/dist/typescript/src/components/autocomplete/variants/index.d.ts.map +1 -0
- package/dist/typescript/src/components/index.d.ts +2 -0
- package/dist/typescript/src/components/index.d.ts.map +1 -1
- package/dist/typescript/src/components/input/numeric-input.d.ts +2 -1
- package/dist/typescript/src/components/input/numeric-input.d.ts.map +1 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-action.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-action.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-cancel.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-cancel.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-content.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-content.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-description.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-description.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-footer.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-footer.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-overlay.d.ts +7 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-overlay.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-portal.d.ts +7 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-portal.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-root.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-root.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-title.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-title.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-trigger.d.ts +8 -0
- package/dist/typescript/src/primitives/alert-dialog/alert-dialog-trigger.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/context.d.ts +10 -0
- package/dist/typescript/src/primitives/alert-dialog/context.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/index.d.ts +33 -0
- package/dist/typescript/src/primitives/alert-dialog/index.d.ts.map +1 -0
- package/dist/typescript/src/primitives/alert-dialog/types.d.ts +13 -0
- package/dist/typescript/src/primitives/alert-dialog/types.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-content.d.ts +8 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-content.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-empty.d.ts +9 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-empty.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-input.d.ts +7 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-input.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-option.d.ts +11 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-option.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-overlay.d.ts +10 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-overlay.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-portal.d.ts +6 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-portal.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-root.d.ts +24 -0
- package/dist/typescript/src/primitives/autocomplete/autocomplete-root.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/context.d.ts +30 -0
- package/dist/typescript/src/primitives/autocomplete/context.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/index.d.ts +25 -0
- package/dist/typescript/src/primitives/autocomplete/index.d.ts.map +1 -0
- package/dist/typescript/src/primitives/autocomplete/types.d.ts +21 -0
- package/dist/typescript/src/primitives/autocomplete/types.d.ts.map +1 -0
- package/dist/typescript/src/primitives/dropdown-menu/dropdown-menu-divider.d.ts.map +1 -1
- package/dist/typescript/src/primitives/dropdown-menu/dropdown-menu-trigger.d.ts.map +1 -1
- package/dist/typescript/src/primitives/index.d.ts +2 -0
- package/dist/typescript/src/primitives/index.d.ts.map +1 -1
- package/dist/typescript/src/primitives/input/input.d.ts +1 -2
- package/dist/typescript/src/primitives/input/input.d.ts.map +1 -1
- package/dist/typescript/src/primitives/popover/popover-trigger.d.ts.map +1 -1
- package/dist/typescript/src/primitives/portal/portal.constants.d.ts +6 -2
- package/dist/typescript/src/primitives/portal/portal.constants.d.ts.map +1 -1
- package/dist/typescript/src/primitives/portal/portal.d.ts +2 -5
- package/dist/typescript/src/primitives/portal/portal.d.ts.map +1 -1
- package/dist/typescript/src/primitives/select/context.d.ts +5 -2
- package/dist/typescript/src/primitives/select/context.d.ts.map +1 -1
- package/dist/typescript/src/primitives/select/select-content.d.ts.map +1 -1
- package/dist/typescript/src/primitives/select/select-root.d.ts.map +1 -1
- package/dist/typescript/src/primitives/select/select-trigger.d.ts +0 -5
- package/dist/typescript/src/primitives/select/select-trigger.d.ts.map +1 -1
- package/dist/typescript/src/types/element.types.d.ts +10 -3
- package/dist/typescript/src/types/element.types.d.ts.map +1 -1
- package/dist/typescript/src/utils/normalize-layout.d.ts +3 -1
- package/dist/typescript/src/utils/normalize-layout.d.ts.map +1 -1
- package/package.json +8 -5
- package/scripts/build.sh +2 -2
- package/src/components/alert-dialog/alert-dialog.tsx +38 -0
- package/src/components/alert-dialog/async-alert-dialog.tsx +121 -0
- package/src/components/alert-dialog/index.ts +3 -0
- package/src/components/alert-dialog/variants/default.tsx +82 -0
- package/src/components/alert-dialog/variants/index.ts +5 -0
- package/src/components/autocomplete/autocomplete.tsx +34 -0
- package/src/components/autocomplete/variants/default.tsx +84 -0
- package/src/components/autocomplete/variants/index.ts +5 -0
- package/src/components/index.ts +2 -0
- package/src/components/input/numeric-input.tsx +8 -6
- package/src/index.tsx +2 -0
- package/src/primitives/alert-dialog/alert-dialog-action.tsx +27 -0
- package/src/primitives/alert-dialog/alert-dialog-cancel.tsx +27 -0
- package/src/primitives/alert-dialog/alert-dialog-content.tsx +21 -0
- package/src/primitives/alert-dialog/alert-dialog-description.tsx +21 -0
- package/src/primitives/alert-dialog/alert-dialog-footer.tsx +21 -0
- package/src/primitives/alert-dialog/alert-dialog-overlay.tsx +25 -0
- package/src/primitives/alert-dialog/alert-dialog-portal.tsx +20 -0
- package/src/primitives/alert-dialog/alert-dialog-root.tsx +25 -0
- package/src/primitives/alert-dialog/alert-dialog-title.tsx +21 -0
- package/src/primitives/alert-dialog/alert-dialog-trigger.tsx +27 -0
- package/src/primitives/alert-dialog/context.ts +18 -0
- package/src/primitives/alert-dialog/index.ts +34 -0
- package/src/primitives/alert-dialog/types.ts +13 -0
- package/src/primitives/autocomplete/autocomplete-content.tsx +38 -0
- package/src/primitives/autocomplete/autocomplete-empty.tsx +19 -0
- package/src/primitives/autocomplete/autocomplete-input.tsx +85 -0
- package/src/primitives/autocomplete/autocomplete-option.tsx +66 -0
- package/src/primitives/autocomplete/autocomplete-overlay.tsx +29 -0
- package/src/primitives/autocomplete/autocomplete-portal.tsx +27 -0
- package/src/primitives/autocomplete/autocomplete-root.tsx +111 -0
- package/src/primitives/autocomplete/context.ts +45 -0
- package/src/primitives/autocomplete/index.ts +27 -0
- package/src/primitives/autocomplete/types.ts +23 -0
- package/src/primitives/dropdown-menu/dropdown-menu-divider.tsx +2 -2
- package/src/primitives/dropdown-menu/dropdown-menu-trigger.tsx +3 -7
- package/src/primitives/index.ts +2 -0
- package/src/primitives/input/input.tsx +3 -6
- package/src/primitives/popover/popover-portal.tsx +1 -1
- package/src/primitives/popover/popover-trigger.tsx +3 -7
- package/src/primitives/portal/portal.constants.tsx +2 -2
- package/src/primitives/portal/portal.tsx +4 -36
- package/src/primitives/select/context.ts +5 -2
- package/src/primitives/select/select-content.tsx +16 -9
- package/src/primitives/select/select-root.tsx +7 -3
- package/src/primitives/select/select-trigger.tsx +19 -21
- package/src/types/element.types.ts +10 -3
- package/src/utils/normalize-layout.ts +22 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LayoutPosition } from "../../hooks";
|
|
1
2
|
import { type Dispatch } from "react";
|
|
2
3
|
import type { LayoutRectangle } from "react-native";
|
|
3
4
|
import type { SelectOption, SelectState, SelectStyles } from "./types";
|
|
@@ -7,8 +8,10 @@ export interface SelectContext {
|
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
isOpen: boolean;
|
|
9
10
|
setIsOpen: Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
triggerPosition: LayoutPosition;
|
|
12
|
+
setTriggerPosition: Dispatch<React.SetStateAction<LayoutPosition>>;
|
|
13
|
+
contentLayout: LayoutRectangle;
|
|
14
|
+
setContentLayout: Dispatch<React.SetStateAction<LayoutRectangle>>;
|
|
12
15
|
options: Array<SelectOption>;
|
|
13
16
|
setOptions: Dispatch<React.SetStateAction<Array<SelectOption>>>;
|
|
14
17
|
isDisabled: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,QAAQ,EAAc,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAiB,KAAK,QAAQ,EAAc,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,eAAe,EAAE,cAAc,CAAC;IAChC,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;IACnE,aAAa,EAAE,eAAe,CAAC;IAC/B,gBAAgB,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;IAClE,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC7B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAEhE,UAAU,EAAE,OAAO,CAAC;IAEpB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,oDAAsD,CAAC;AAEjF,eAAO,MAAM,SAAS,qBAMrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-content.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/select-content.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select-content.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/select-content.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,KAAK,CAAC,YAAY,CAAC;IAE3D,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBA0BtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-root.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/select-root.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select-root.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/select-root.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAwB,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1F,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvE,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,KAAK,CAAC,YAAY,CAAC;IAEhE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AASD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAgChD"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
-
interface SelectTriggerInjectionProps {
|
|
4
|
-
onPress?: () => void;
|
|
5
|
-
}
|
|
6
3
|
export interface SelectTriggerProps {
|
|
7
4
|
children?: React.ReactNode;
|
|
8
5
|
style?: StyleProp<ViewStyle>;
|
|
9
|
-
render?: (props: SelectTriggerInjectionProps) => React.ReactElement;
|
|
10
6
|
}
|
|
11
7
|
export declare function SelectTrigger(props: SelectTriggerProps): React.JSX.Element;
|
|
12
|
-
export {};
|
|
13
8
|
//# sourceMappingURL=select-trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-trigger.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/select-trigger.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select-trigger.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/select/select-trigger.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAsBtD"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type ViewRef =
|
|
3
|
-
export type TextInputRef =
|
|
1
|
+
import type { HostInstance } from "react-native";
|
|
2
|
+
export type ViewRef = HostInstance;
|
|
3
|
+
export type TextInputRef = HostInstance & {
|
|
4
|
+
focus: () => void;
|
|
5
|
+
blur: () => void;
|
|
6
|
+
clear: () => void;
|
|
7
|
+
isFocused: () => boolean;
|
|
8
|
+
getNativeRef: () => HostInstance;
|
|
9
|
+
setSelection: (start: number, end?: number) => void;
|
|
10
|
+
};
|
|
4
11
|
//# sourceMappingURL=element.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.types.d.ts","sourceRoot":"","sources":["../../../../src/types/element.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"element.types.d.ts","sourceRoot":"","sources":["../../../../src/types/element.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,OAAO,GAAG,YAAY,CAAC;AACnC,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IACxC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,YAAY,CAAC;IACjC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LayoutPosition } from "../hooks";
|
|
2
|
+
import type { HostInstance, LayoutRectangle } from "react-native";
|
|
2
3
|
export declare const normalizeLayout: (layout: LayoutRectangle) => {
|
|
3
4
|
x: number;
|
|
4
5
|
y: number;
|
|
5
6
|
width: number;
|
|
6
7
|
height: number;
|
|
7
8
|
};
|
|
9
|
+
export declare const measureLayoutPosition: (ref: HostInstance | null, callback: (layout: LayoutPosition) => void) => void;
|
|
8
10
|
//# sourceMappingURL=normalize-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-layout.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalize-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-layout.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalize-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,QAAQ,eAAe;;;;;CAUtD,CAAC;AAUF,eAAO,MAAM,qBAAqB,GAAI,KAAK,YAAY,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,SASzG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@korsolutions/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,20 +35,23 @@
|
|
|
35
35
|
"types": "./dist/typescript/src/primitives/index.d.ts"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"prepare": "./scripts/build.sh",
|
|
40
|
+
"ts-check": "tsc --noEmit"
|
|
41
|
+
},
|
|
38
42
|
"devDependencies": {
|
|
43
|
+
"@react-navigation/native": "^7.1.28",
|
|
39
44
|
"@types/react": "^19.2.3",
|
|
40
45
|
"@types/react-dom": "^19.2.3",
|
|
41
46
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
42
47
|
"react-native-builder-bob": "^0.40.17",
|
|
43
|
-
"tsc-alias": "^1.8.16"
|
|
48
|
+
"tsc-alias": "^1.8.16",
|
|
49
|
+
"typescript": "^5.9.3"
|
|
44
50
|
},
|
|
45
51
|
"peerDependencies": {
|
|
46
52
|
"react": "*",
|
|
47
53
|
"react-dom": "*",
|
|
48
54
|
"react-native": "*",
|
|
49
55
|
"react-native-web": "*"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"ts-check": "tsc --noEmit"
|
|
53
56
|
}
|
|
54
57
|
}
|
package/scripts/build.sh
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
bob build
|
|
2
|
-
tsc-alias -p tsconfig.json --outDir dist/typescript
|
|
1
|
+
bunx bob build
|
|
2
|
+
bunx tsc-alias -p tsconfig.json --outDir dist/typescript
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AlertDialogPrimitive } from "@/primitives";
|
|
2
|
+
import type { PressableProps } from "react-native";
|
|
3
|
+
import { AlertDialogVariants } from "./variants";
|
|
4
|
+
|
|
5
|
+
interface AlertDialogProps {
|
|
6
|
+
trigger: React.ReactElement<PressableProps>;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
actionLabel?: string;
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
onAction?: () => void;
|
|
12
|
+
onCancel?: () => void;
|
|
13
|
+
variant?: keyof typeof AlertDialogVariants;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function AlertDialog(props: AlertDialogProps) {
|
|
17
|
+
const { title, description, actionLabel = "Continue", cancelLabel = "Cancel", onAction, onCancel, variant = "default" } = props;
|
|
18
|
+
|
|
19
|
+
const useVariantStyles = AlertDialogVariants[variant];
|
|
20
|
+
const variantStyles = useVariantStyles();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<AlertDialogPrimitive.Root styles={variantStyles}>
|
|
24
|
+
<AlertDialogPrimitive.Trigger>{props.trigger}</AlertDialogPrimitive.Trigger>
|
|
25
|
+
<AlertDialogPrimitive.Portal>
|
|
26
|
+
<AlertDialogPrimitive.Overlay />
|
|
27
|
+
<AlertDialogPrimitive.Content>
|
|
28
|
+
<AlertDialogPrimitive.Title>{title}</AlertDialogPrimitive.Title>
|
|
29
|
+
<AlertDialogPrimitive.Description>{description}</AlertDialogPrimitive.Description>
|
|
30
|
+
<AlertDialogPrimitive.Footer>
|
|
31
|
+
<AlertDialogPrimitive.Cancel onPress={onCancel}>{cancelLabel}</AlertDialogPrimitive.Cancel>
|
|
32
|
+
<AlertDialogPrimitive.Action onPress={onAction}>{actionLabel}</AlertDialogPrimitive.Action>
|
|
33
|
+
</AlertDialogPrimitive.Footer>
|
|
34
|
+
</AlertDialogPrimitive.Content>
|
|
35
|
+
</AlertDialogPrimitive.Portal>
|
|
36
|
+
</AlertDialogPrimitive.Root>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { AlertDialogPrimitive } from "@/primitives";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import { useAlertDialog } from "@/primitives/alert-dialog/context";
|
|
4
|
+
import { AlertDialogVariants } from "./variants";
|
|
5
|
+
|
|
6
|
+
interface AsyncAlertDialogProps {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
actionLabel?: string;
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
variant?: keyof typeof AlertDialogVariants;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface AsyncAlertDialogResult {
|
|
15
|
+
confirmed: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface AsyncAlertDialogInstance {
|
|
19
|
+
id: string;
|
|
20
|
+
resolve: (result: AsyncAlertDialogResult) => void;
|
|
21
|
+
props: AsyncAlertDialogProps;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Global state
|
|
25
|
+
const dialogQueue: AsyncAlertDialogInstance[] = [];
|
|
26
|
+
let currentDialog: AsyncAlertDialogInstance | null = null;
|
|
27
|
+
let setCurrentDialogFn: ((dialog: AsyncAlertDialogInstance | null) => void) | null = null;
|
|
28
|
+
|
|
29
|
+
// Process next dialog in queue
|
|
30
|
+
function processQueue() {
|
|
31
|
+
if (currentDialog || dialogQueue.length === 0) return;
|
|
32
|
+
|
|
33
|
+
currentDialog = dialogQueue.shift()!;
|
|
34
|
+
setCurrentDialogFn?.(currentDialog);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Close current dialog
|
|
38
|
+
function closeDialog(confirmed: boolean) {
|
|
39
|
+
if (!currentDialog) return;
|
|
40
|
+
|
|
41
|
+
currentDialog.resolve({ confirmed });
|
|
42
|
+
currentDialog = null;
|
|
43
|
+
setCurrentDialogFn?.(null);
|
|
44
|
+
|
|
45
|
+
// Process next in queue after a small delay
|
|
46
|
+
setTimeout(processQueue, 100);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Inner component that has access to the dialog context
|
|
50
|
+
function AsyncAlertDialogContent({ instance }: { instance: AsyncAlertDialogInstance }) {
|
|
51
|
+
const { title, description, actionLabel = "Continue", cancelLabel = "Cancel" } = instance.props;
|
|
52
|
+
const { setIsOpen } = useAlertDialog();
|
|
53
|
+
|
|
54
|
+
const handleAction = () => closeDialog(true);
|
|
55
|
+
const handleCancel = () => closeDialog(false);
|
|
56
|
+
|
|
57
|
+
// Automatically open the dialog when mounted
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setIsOpen(true);
|
|
60
|
+
}, [setIsOpen]);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<AlertDialogPrimitive.Portal>
|
|
64
|
+
<AlertDialogPrimitive.Overlay onPress={handleCancel} />
|
|
65
|
+
<AlertDialogPrimitive.Content>
|
|
66
|
+
<AlertDialogPrimitive.Title>{title}</AlertDialogPrimitive.Title>
|
|
67
|
+
<AlertDialogPrimitive.Description>{description}</AlertDialogPrimitive.Description>
|
|
68
|
+
<AlertDialogPrimitive.Footer>
|
|
69
|
+
<AlertDialogPrimitive.Cancel onPress={handleCancel}>{cancelLabel}</AlertDialogPrimitive.Cancel>
|
|
70
|
+
<AlertDialogPrimitive.Action onPress={handleAction}>{actionLabel}</AlertDialogPrimitive.Action>
|
|
71
|
+
</AlertDialogPrimitive.Footer>
|
|
72
|
+
</AlertDialogPrimitive.Content>
|
|
73
|
+
</AlertDialogPrimitive.Portal>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Component that renders a single dialog instance
|
|
78
|
+
function AsyncAlertDialogInstance({ instance }: { instance: AsyncAlertDialogInstance }) {
|
|
79
|
+
const { variant = "default" } = instance.props;
|
|
80
|
+
|
|
81
|
+
const useVariantStyles = AlertDialogVariants[variant];
|
|
82
|
+
const variantStyles = useVariantStyles();
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<AlertDialogPrimitive.Root styles={variantStyles}>
|
|
86
|
+
<AsyncAlertDialogContent instance={instance} />
|
|
87
|
+
</AlertDialogPrimitive.Root>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function AsyncAlertDialogManager() {
|
|
92
|
+
const [dialog, setDialog] = useState<AsyncAlertDialogInstance | null>(null);
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
setCurrentDialogFn = setDialog;
|
|
96
|
+
return () => {
|
|
97
|
+
setCurrentDialogFn = null;
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
100
|
+
|
|
101
|
+
if (!dialog) return null;
|
|
102
|
+
|
|
103
|
+
return <AsyncAlertDialogInstance instance={dialog} />;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function show(props: AsyncAlertDialogProps): Promise<AsyncAlertDialogResult> {
|
|
107
|
+
return new Promise((resolve) => {
|
|
108
|
+
const instance: AsyncAlertDialogInstance = {
|
|
109
|
+
id: Date.now().toString(),
|
|
110
|
+
props,
|
|
111
|
+
resolve,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
dialogQueue.push(instance);
|
|
115
|
+
processQueue();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const AsyncAlertDialog = {
|
|
120
|
+
show,
|
|
121
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type AlertDialogStyles } from "@/primitives";
|
|
2
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
3
|
+
|
|
4
|
+
export const useAlertDialogVariantDefault = (): AlertDialogStyles => {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): AlertDialogStyles => ({
|
|
7
|
+
overlay: {
|
|
8
|
+
position: "absolute",
|
|
9
|
+
top: 0,
|
|
10
|
+
left: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
},
|
|
17
|
+
content: {
|
|
18
|
+
backgroundColor: colors.background,
|
|
19
|
+
borderRadius: radius,
|
|
20
|
+
padding: 24,
|
|
21
|
+
maxWidth: 400,
|
|
22
|
+
width: "90%",
|
|
23
|
+
shadowColor: "#000",
|
|
24
|
+
shadowOffset: { width: 0, height: 2 },
|
|
25
|
+
shadowOpacity: 0.25,
|
|
26
|
+
shadowRadius: 8,
|
|
27
|
+
elevation: 5,
|
|
28
|
+
position: "absolute",
|
|
29
|
+
top: "50%",
|
|
30
|
+
left: "50%",
|
|
31
|
+
transform: [{ translateX: "-50%" }, { translateY: "-50%" }],
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
borderColor: colors.border,
|
|
34
|
+
},
|
|
35
|
+
title: {
|
|
36
|
+
fontSize: fontSize * 1.25,
|
|
37
|
+
fontWeight: "600",
|
|
38
|
+
color: colors.foreground,
|
|
39
|
+
fontFamily,
|
|
40
|
+
marginBottom: 8,
|
|
41
|
+
},
|
|
42
|
+
description: {
|
|
43
|
+
fontSize,
|
|
44
|
+
color: colors.mutedForeground,
|
|
45
|
+
fontFamily,
|
|
46
|
+
lineHeight: fontSize * 1.5,
|
|
47
|
+
},
|
|
48
|
+
footer: {
|
|
49
|
+
flexDirection: "row",
|
|
50
|
+
justifyContent: "flex-end",
|
|
51
|
+
gap: 12,
|
|
52
|
+
marginTop: 24,
|
|
53
|
+
},
|
|
54
|
+
cancel: {
|
|
55
|
+
paddingVertical: 10,
|
|
56
|
+
paddingHorizontal: 16,
|
|
57
|
+
borderRadius: radius,
|
|
58
|
+
borderWidth: 1,
|
|
59
|
+
borderColor: colors.border,
|
|
60
|
+
backgroundColor: colors.background,
|
|
61
|
+
},
|
|
62
|
+
cancelText: {
|
|
63
|
+
color: colors.foreground,
|
|
64
|
+
fontSize,
|
|
65
|
+
fontWeight: "500",
|
|
66
|
+
fontFamily,
|
|
67
|
+
},
|
|
68
|
+
action: {
|
|
69
|
+
paddingVertical: 10,
|
|
70
|
+
paddingHorizontal: 16,
|
|
71
|
+
borderRadius: radius,
|
|
72
|
+
backgroundColor: colors.primary,
|
|
73
|
+
},
|
|
74
|
+
actionText: {
|
|
75
|
+
color: colors.primaryForeground,
|
|
76
|
+
fontSize,
|
|
77
|
+
fontWeight: "500",
|
|
78
|
+
fontFamily,
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AutocompletePrimitive, type AutocompleteOption, type AutocompleteRootBaseProps } from "@/primitives";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AutocompleteVariants } from "./variants";
|
|
4
|
+
|
|
5
|
+
export type { AutocompleteOption };
|
|
6
|
+
|
|
7
|
+
export interface AutocompleteProps extends AutocompleteRootBaseProps {
|
|
8
|
+
options: AutocompleteOption[];
|
|
9
|
+
variant?: keyof typeof AutocompleteVariants;
|
|
10
|
+
emptyMessage?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function Autocomplete(props: AutocompleteProps) {
|
|
14
|
+
const { options, variant = "default", emptyMessage = "No results found", ...rootProps } = props;
|
|
15
|
+
const useVariantStyles = AutocompleteVariants[variant];
|
|
16
|
+
const variantStyles = useVariantStyles();
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<AutocompletePrimitive.Root {...rootProps} styles={variantStyles}>
|
|
20
|
+
<AutocompletePrimitive.Input />
|
|
21
|
+
<AutocompletePrimitive.Portal>
|
|
22
|
+
<AutocompletePrimitive.Overlay />
|
|
23
|
+
<AutocompletePrimitive.Content>
|
|
24
|
+
{options.map((option) => (
|
|
25
|
+
<AutocompletePrimitive.Option key={option.value} value={option.value}>
|
|
26
|
+
{option.label}
|
|
27
|
+
</AutocompletePrimitive.Option>
|
|
28
|
+
))}
|
|
29
|
+
{!options.length && <AutocompletePrimitive.Empty>{emptyMessage}</AutocompletePrimitive.Empty>}
|
|
30
|
+
</AutocompletePrimitive.Content>
|
|
31
|
+
</AutocompletePrimitive.Portal>
|
|
32
|
+
</AutocompletePrimitive.Root>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type AutocompleteStyles } from "@/primitives";
|
|
2
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
3
|
+
|
|
4
|
+
export function useAutocompleteVariantDefault(): AutocompleteStyles {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): AutocompleteStyles => ({
|
|
7
|
+
root: {
|
|
8
|
+
default: {},
|
|
9
|
+
focused: {},
|
|
10
|
+
disabled: {},
|
|
11
|
+
},
|
|
12
|
+
input: {
|
|
13
|
+
default: {
|
|
14
|
+
borderWidth: 1,
|
|
15
|
+
borderColor: colors.border,
|
|
16
|
+
borderRadius: radius,
|
|
17
|
+
paddingVertical: 12,
|
|
18
|
+
paddingHorizontal: 16,
|
|
19
|
+
height: 48,
|
|
20
|
+
fontFamily,
|
|
21
|
+
fontSize,
|
|
22
|
+
color: colors.foreground,
|
|
23
|
+
backgroundColor: colors.background,
|
|
24
|
+
},
|
|
25
|
+
focused: {
|
|
26
|
+
borderColor: colors.primary,
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
backgroundColor: colors.muted,
|
|
30
|
+
color: colors.mutedForeground,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
overlay: {
|
|
34
|
+
default: {},
|
|
35
|
+
focused: {},
|
|
36
|
+
disabled: {},
|
|
37
|
+
},
|
|
38
|
+
content: {
|
|
39
|
+
default: {
|
|
40
|
+
backgroundColor: colors.surface,
|
|
41
|
+
borderRadius: radius,
|
|
42
|
+
borderWidth: 1,
|
|
43
|
+
borderColor: colors.border,
|
|
44
|
+
padding: 4,
|
|
45
|
+
gap: 4,
|
|
46
|
+
maxHeight: 300,
|
|
47
|
+
},
|
|
48
|
+
focused: {},
|
|
49
|
+
disabled: {},
|
|
50
|
+
},
|
|
51
|
+
option: {
|
|
52
|
+
default: {
|
|
53
|
+
paddingVertical: 12,
|
|
54
|
+
paddingHorizontal: 16,
|
|
55
|
+
fontFamily,
|
|
56
|
+
fontSize,
|
|
57
|
+
color: colors.foreground,
|
|
58
|
+
borderRadius: radius / 2,
|
|
59
|
+
},
|
|
60
|
+
disabled: {
|
|
61
|
+
color: colors.mutedForeground,
|
|
62
|
+
},
|
|
63
|
+
selected: {
|
|
64
|
+
backgroundColor: colors.muted,
|
|
65
|
+
},
|
|
66
|
+
hovered: {
|
|
67
|
+
backgroundColor: colors.muted,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
empty: {
|
|
71
|
+
default: {
|
|
72
|
+
paddingVertical: 12,
|
|
73
|
+
paddingHorizontal: 16,
|
|
74
|
+
fontFamily,
|
|
75
|
+
fontSize,
|
|
76
|
+
color: colors.mutedForeground,
|
|
77
|
+
textAlign: "center",
|
|
78
|
+
},
|
|
79
|
+
focused: {},
|
|
80
|
+
disabled: {},
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./card/card";
|
|
|
3
3
|
export * from "./input";
|
|
4
4
|
export * from "./field/field";
|
|
5
5
|
export * from "./select/select";
|
|
6
|
+
export * from "./autocomplete/autocomplete";
|
|
6
7
|
export * from "./typography/typography";
|
|
7
8
|
export * from "./link/link";
|
|
8
9
|
export * from "./empty/empty";
|
|
@@ -15,3 +16,4 @@ export * from "./popover/popover";
|
|
|
15
16
|
export * from "./calendar/calendar";
|
|
16
17
|
export * from "./tabs";
|
|
17
18
|
export * from "./checkbox";
|
|
19
|
+
export * from "./alert-dialog";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useNumericMask, type NumericMaskFormat } from "@/hooks/use-numeric-mask";
|
|
2
|
-
import { type InputPrimitiveBaseProps } from "@/primitives";
|
|
2
|
+
import { InputPrimitive, type InputPrimitiveBaseProps } from "@/primitives";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { InputVariants } from "./variants";
|
|
5
5
|
|
|
6
6
|
export interface NumericInputProps extends Omit<InputPrimitiveBaseProps, "value" | "onChange" | "keyboardType"> {
|
|
7
|
-
variant?:
|
|
7
|
+
variant?: keyof typeof InputVariants;
|
|
8
8
|
value?: number | null;
|
|
9
9
|
onChange?: (value: number | null) => void;
|
|
10
10
|
format?: NumericMaskFormat;
|
|
@@ -42,7 +42,6 @@ export function NumericInput({
|
|
|
42
42
|
onChange,
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
// Sync external value changes with internal state
|
|
46
45
|
useEffect(() => {
|
|
47
46
|
if (value !== numericMask.numericValue) {
|
|
48
47
|
numericMask.setValue(value ?? null);
|
|
@@ -59,15 +58,18 @@ export function NumericInput({
|
|
|
59
58
|
onFocus?.(e);
|
|
60
59
|
};
|
|
61
60
|
|
|
61
|
+
const useVariantStyles = InputVariants[variant];
|
|
62
|
+
const variantStyles = useVariantStyles();
|
|
63
|
+
|
|
62
64
|
return (
|
|
63
|
-
<
|
|
65
|
+
<InputPrimitive
|
|
64
66
|
{...props}
|
|
65
|
-
variant={variant}
|
|
66
67
|
value={numericMask.value}
|
|
67
68
|
onChange={numericMask.onChangeText}
|
|
68
69
|
onBlur={handleBlur}
|
|
69
70
|
onFocus={handleFocus}
|
|
70
71
|
keyboardType={numericMask.keyboardType}
|
|
72
|
+
styles={variantStyles}
|
|
71
73
|
/>
|
|
72
74
|
);
|
|
73
75
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ThemeProvider } from "@/themes";
|
|
2
|
+
import { AsyncAlertDialogManager } from "./components/alert-dialog/async-alert-dialog";
|
|
2
3
|
import { ToastContainer } from "./components/toast/toast-manager";
|
|
3
4
|
import { PortalHost } from "./primitives/portal";
|
|
4
5
|
import { type PortalHostProps } from "./primitives/portal/portal.constants";
|
|
@@ -15,6 +16,7 @@ export const UniversalUIProvider = ({ children, portalContainer }: ProviderProps
|
|
|
15
16
|
<ToastContainer />
|
|
16
17
|
{children}
|
|
17
18
|
<PortalHost container={portalContainer} />
|
|
19
|
+
<AsyncAlertDialogManager />
|
|
18
20
|
</ThemeProvider>
|
|
19
21
|
);
|
|
20
22
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable, Text, type PressableProps, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { useAlertDialog } from "./context";
|
|
4
|
+
|
|
5
|
+
export interface AlertDialogPrimitiveActionProps extends PressableProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function AlertDialogAction(props: AlertDialogPrimitiveActionProps) {
|
|
11
|
+
const { children, style, onPress, ...pressableProps } = props;
|
|
12
|
+
const { styles, setIsOpen } = useAlertDialog();
|
|
13
|
+
|
|
14
|
+
const handlePress: PressableProps["onPress"] = (event) => {
|
|
15
|
+
onPress?.(event);
|
|
16
|
+
setIsOpen(false);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const calculatedStyle = [styles?.action, style];
|
|
20
|
+
const textStyle = styles?.actionText;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Pressable {...pressableProps} style={calculatedStyle} onPress={handlePress}>
|
|
24
|
+
<Text style={textStyle}>{children}</Text>
|
|
25
|
+
</Pressable>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable, Text, type PressableProps, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { useAlertDialog } from "./context";
|
|
4
|
+
|
|
5
|
+
export interface AlertDialogPrimitiveCancelProps extends PressableProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function AlertDialogCancel(props: AlertDialogPrimitiveCancelProps) {
|
|
11
|
+
const { children, style, onPress, ...pressableProps } = props;
|
|
12
|
+
const { styles, setIsOpen } = useAlertDialog();
|
|
13
|
+
|
|
14
|
+
const handlePress: PressableProps["onPress"] = (event) => {
|
|
15
|
+
onPress?.(event);
|
|
16
|
+
setIsOpen(false);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const calculatedStyle = [styles?.cancel, style];
|
|
20
|
+
const textStyle = styles?.cancelText;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Pressable {...pressableProps} style={calculatedStyle} onPress={handlePress}>
|
|
24
|
+
<Text style={textStyle}>{children}</Text>
|
|
25
|
+
</Pressable>
|
|
26
|
+
);
|
|
27
|
+
}
|