@accelint/design-toolkit 2.5.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/dist/components/accordion/index.d.ts +42 -0
  2. package/dist/components/accordion/index.js.map +1 -1
  3. package/dist/components/accordion/styles.js +1 -1
  4. package/dist/components/accordion/styles.js.map +1 -1
  5. package/dist/components/avatar/index.d.ts +29 -0
  6. package/dist/components/avatar/index.js.map +1 -1
  7. package/dist/components/badge/index.d.ts +24 -0
  8. package/dist/components/badge/index.js.map +1 -1
  9. package/dist/components/button/index.d.ts +104 -0
  10. package/dist/components/button/index.js +1 -1
  11. package/dist/components/button/index.js.map +1 -1
  12. package/dist/components/button/styles.d.ts +28 -106
  13. package/dist/components/button/styles.js +1 -1
  14. package/dist/components/button/styles.js.map +1 -1
  15. package/dist/components/button/types.d.ts +6 -4
  16. package/dist/components/checkbox/index.d.ts +33 -0
  17. package/dist/components/checkbox/index.js.map +1 -1
  18. package/dist/components/checkbox/styles.d.ts +3 -3
  19. package/dist/components/checkbox/styles.js +1 -1
  20. package/dist/components/checkbox/styles.js.map +1 -1
  21. package/dist/components/chip/index.d.ts +34 -0
  22. package/dist/components/chip/index.js.map +1 -1
  23. package/dist/components/chip/styles.js +1 -1
  24. package/dist/components/chip/styles.js.map +1 -1
  25. package/dist/components/classification-badge/index.d.ts +15 -0
  26. package/dist/components/classification-badge/index.js.map +1 -1
  27. package/dist/components/classification-banner/index.d.ts +11 -0
  28. package/dist/components/classification-banner/index.js.map +1 -1
  29. package/dist/components/color-picker/styles.js +1 -1
  30. package/dist/components/color-picker/styles.js.map +1 -1
  31. package/dist/components/combobox-field/index.d.ts +19 -0
  32. package/dist/components/combobox-field/index.js +2 -0
  33. package/dist/components/combobox-field/index.js.map +1 -0
  34. package/dist/components/combobox-field/styles.d.ts +72 -0
  35. package/dist/components/combobox-field/styles.js +2 -0
  36. package/dist/components/combobox-field/styles.js.map +1 -0
  37. package/dist/components/combobox-field/types.d.ts +29 -0
  38. package/dist/components/date-field/index.d.ts +44 -0
  39. package/dist/components/date-field/index.js.map +1 -1
  40. package/dist/components/date-field/styles.d.ts +3 -3
  41. package/dist/components/date-field/styles.js +1 -1
  42. package/dist/components/date-field/styles.js.map +1 -1
  43. package/dist/components/dialog/index.d.ts +26 -4
  44. package/dist/components/dialog/index.js +1 -1
  45. package/dist/components/dialog/index.js.map +1 -1
  46. package/dist/components/drawer/events.d.ts +8 -0
  47. package/dist/components/drawer/events.js +2 -0
  48. package/dist/components/drawer/events.js.map +1 -0
  49. package/dist/components/drawer/index.d.ts +89 -43
  50. package/dist/components/drawer/index.js +1 -1
  51. package/dist/components/drawer/index.js.map +1 -1
  52. package/dist/components/drawer/styles.d.ts +50 -16
  53. package/dist/components/drawer/styles.js +1 -1
  54. package/dist/components/drawer/styles.js.map +1 -1
  55. package/dist/components/drawer/types.d.ts +154 -238
  56. package/dist/components/drawer/types.js +1 -1
  57. package/dist/components/drawer/types.js.map +1 -1
  58. package/dist/components/hotkey/index.d.ts +56 -0
  59. package/dist/components/hotkey/index.js +2 -0
  60. package/dist/components/hotkey/index.js.map +1 -0
  61. package/dist/components/hotkey/styles.d.ts +53 -0
  62. package/dist/components/hotkey/styles.js +2 -0
  63. package/dist/components/hotkey/styles.js.map +1 -0
  64. package/dist/components/hotkey/types.d.ts +8 -0
  65. package/dist/components/hotkey/types.js +2 -0
  66. package/dist/components/hotkey/types.js.map +1 -0
  67. package/dist/components/icon/index.d.ts +29 -0
  68. package/dist/components/icon/index.js.map +1 -1
  69. package/dist/components/input/index.d.ts +19 -0
  70. package/dist/components/input/index.js +1 -1
  71. package/dist/components/input/index.js.map +1 -1
  72. package/dist/components/input/styles.d.ts +2 -24
  73. package/dist/components/input/styles.js +1 -1
  74. package/dist/components/input/styles.js.map +1 -1
  75. package/dist/components/input/types.d.ts +1 -0
  76. package/dist/components/label/index.d.ts +19 -0
  77. package/dist/components/label/index.js.map +1 -1
  78. package/dist/components/menu/index.d.ts +69 -7
  79. package/dist/components/menu/index.js +1 -1
  80. package/dist/components/menu/index.js.map +1 -1
  81. package/dist/components/menu/styles.d.ts +19 -43
  82. package/dist/components/menu/styles.js +1 -1
  83. package/dist/components/menu/styles.js.map +1 -1
  84. package/dist/components/menu/types.d.ts +17 -15
  85. package/dist/components/options/index.d.ts +41 -0
  86. package/dist/components/options/index.js.map +1 -1
  87. package/dist/components/options/styles.d.ts +3 -3
  88. package/dist/components/options/styles.js +1 -1
  89. package/dist/components/options/styles.js.map +1 -1
  90. package/dist/components/popover/index.d.ts +36 -2
  91. package/dist/components/popover/index.js +1 -1
  92. package/dist/components/popover/index.js.map +1 -1
  93. package/dist/components/query-builder/index.d.ts +24 -0
  94. package/dist/components/query-builder/index.js.map +1 -1
  95. package/dist/components/query-builder/value-selector.js +1 -1
  96. package/dist/components/query-builder/value-selector.js.map +1 -1
  97. package/dist/components/radio/index.d.ts +31 -0
  98. package/dist/components/radio/index.js.map +1 -1
  99. package/dist/components/radio/styles.d.ts +3 -3
  100. package/dist/components/radio/styles.js +1 -1
  101. package/dist/components/radio/styles.js.map +1 -1
  102. package/dist/components/search-field/styles.js +1 -1
  103. package/dist/components/search-field/styles.js.map +1 -1
  104. package/dist/components/search-field/types.d.ts +1 -0
  105. package/dist/components/select-field/index.d.ts +67 -0
  106. package/dist/components/select-field/index.js +2 -0
  107. package/dist/components/select-field/index.js.map +1 -0
  108. package/dist/components/select-field/styles.d.ts +60 -0
  109. package/dist/components/select-field/styles.js +2 -0
  110. package/dist/components/select-field/styles.js.map +1 -0
  111. package/dist/components/select-field/types.d.ts +27 -0
  112. package/dist/components/select-field/types.js +2 -0
  113. package/dist/components/select-field/types.js.map +1 -0
  114. package/dist/components/slider/index.d.ts +36 -2
  115. package/dist/components/slider/index.js +1 -1
  116. package/dist/components/slider/index.js.map +1 -1
  117. package/dist/components/switch/index.d.ts +36 -0
  118. package/dist/components/switch/index.js +1 -1
  119. package/dist/components/switch/index.js.map +1 -1
  120. package/dist/components/switch/styles.d.ts +23 -21
  121. package/dist/components/switch/styles.js +1 -1
  122. package/dist/components/switch/styles.js.map +1 -1
  123. package/dist/components/switch/types.d.ts +1 -0
  124. package/dist/components/tabs/index.d.ts +46 -0
  125. package/dist/components/tabs/index.js.map +1 -1
  126. package/dist/components/text-area-field/index.d.ts +20 -0
  127. package/dist/components/text-area-field/index.js.map +1 -1
  128. package/dist/components/text-area-field/styles.d.ts +3 -3
  129. package/dist/components/text-area-field/styles.js +1 -1
  130. package/dist/components/text-area-field/styles.js.map +1 -1
  131. package/dist/components/text-field/index.d.ts +62 -0
  132. package/dist/components/text-field/index.js.map +1 -1
  133. package/dist/components/text-field/styles.d.ts +3 -3
  134. package/dist/components/text-field/types.d.ts +1 -0
  135. package/dist/components/tooltip/index.d.ts +42 -0
  136. package/dist/components/tooltip/index.js.map +1 -1
  137. package/dist/components/view-stack/events.d.ts +9 -0
  138. package/dist/components/view-stack/events.js +2 -0
  139. package/dist/components/view-stack/events.js.map +1 -0
  140. package/dist/components/view-stack/index.d.ts +31 -0
  141. package/dist/components/view-stack/index.js +2 -0
  142. package/dist/components/view-stack/index.js.map +1 -0
  143. package/dist/components/view-stack/types.d.ts +62 -0
  144. package/dist/components/view-stack/types.js +2 -0
  145. package/dist/components/view-stack/types.js.map +1 -0
  146. package/dist/index.css +20 -0
  147. package/dist/index.d.ts +24 -17
  148. package/dist/index.js +1 -1
  149. package/dist/lib/types.d.ts +6 -2
  150. package/dist/metafile-esm.json +1 -1
  151. package/dist/styles.css +1081 -676
  152. package/dist/variants/variants.css +6 -5
  153. package/package.json +11 -6
  154. package/dist/components/box/index.d.ts +0 -19
  155. package/dist/components/box/index.js +0 -2
  156. package/dist/components/box/index.js.map +0 -1
  157. package/dist/components/combobox/index.d.ts +0 -27
  158. package/dist/components/combobox/index.js +0 -2
  159. package/dist/components/combobox/index.js.map +0 -1
  160. package/dist/components/drawer/context.d.ts +0 -13
  161. package/dist/components/drawer/context.js +0 -2
  162. package/dist/components/drawer/context.js.map +0 -1
  163. package/dist/components/drawer/state.d.ts +0 -26
  164. package/dist/components/drawer/state.js +0 -2
  165. package/dist/components/drawer/state.js.map +0 -1
  166. package/dist/components/navigation-stack/index.d.ts +0 -20
  167. package/dist/components/navigation-stack/index.js +0 -2
  168. package/dist/components/navigation-stack/index.js.map +0 -1
  169. package/dist/components/navigation-stack/types.d.ts +0 -31
  170. /package/dist/components/{navigation-stack → combobox-field}/types.js +0 -0
  171. /package/dist/components/{navigation-stack → combobox-field}/types.js.map +0 -0
@@ -1,8 +1,8 @@
1
- @custom-variant color-info (&:where([data-color~="info"]));
2
- @custom-variant color-advisory (&:where([data-color~="advisory"]));
3
- @custom-variant color-normal (&:where([data-color~="normal"]));
4
- @custom-variant color-serious (&:where([data-color~="serious"]));
5
- @custom-variant color-critical (&:where([data-color~="critical"]));
1
+ @custom-variant color-info (&:where([data-color="info"]));
2
+ @custom-variant color-advisory (&:where([data-color="advisory"]));
3
+ @custom-variant color-normal (&:where([data-color="normal"]));
4
+ @custom-variant color-serious (&:where([data-color="serious"]));
5
+ @custom-variant color-critical (&:where([data-color="critical"]));
6
6
  @custom-variant placement-left (&:where([data-placement~="left"]));
7
7
  @custom-variant placement-right (&:where([data-placement~="right"]));
8
8
  @custom-variant placement-top (&:where([data-placement~="top"]));
@@ -51,6 +51,7 @@
51
51
  @custom-variant pending (&:where([data-pending]));
52
52
  @custom-variant empty (&:where([data-empty], :empty));
53
53
  @custom-variant focus-within (&:where([data-focus-within], :focus-within));
54
+ @custom-variant focus-visible-within (&:where(:has([data-focus-visible], :focus-visible)));
54
55
  @custom-variant hover (&:where([data-hovered], :hover));
55
56
  @custom-variant focus (&:where([data-focused], :focus));
56
57
  @custom-variant focus-visible (&:where([data-focus-visible], :focus-visible));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accelint/design-toolkit",
3
- "version": "2.5.0",
3
+ "version": "3.0.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -49,11 +49,14 @@
49
49
  }
50
50
  },
51
51
  "peerDependencies": {
52
- "@accelint/icons": "^2.0.2",
52
+ "@accelint/bus": "^1.0.0",
53
+ "@accelint/core": "^0.4.0",
54
+ "@accelint/icons": "^2.0.3",
53
55
  "@fontsource/roboto-flex": "^5.2.6",
54
56
  "@fontsource/roboto-mono": "^5.2.6",
55
57
  "@internationalized/date": "^3.8.2",
56
58
  "@radix-ui/react-avatar": "^1.1.10",
59
+ "@react-aria/interactions": "^3.25.3",
57
60
  "@react-aria/ssr": "^3.9.10",
58
61
  "@react-aria/utils": "^3.30.0",
59
62
  "@react-stately/color": "^3.9.0",
@@ -61,7 +64,6 @@
61
64
  "@react-stately/utils": "^3.10.8",
62
65
  "@react-types/overlays": "^3.9.0",
63
66
  "@react-types/shared": "^3.31.0",
64
- "@react-aria/interactions": "^3.25.3",
65
67
  "class-variance-authority": "^0.7.1",
66
68
  "client-only": "^0.0.1",
67
69
  "clsx": "^2.1.1",
@@ -73,6 +75,7 @@
73
75
  "tailwind-merge": "^3.3.1",
74
76
  "tailwind-variants": "^2.0.1",
75
77
  "tailwindcss": "^4.1.11",
78
+ "uuid": "^11.1.0",
76
79
  "zod": "^4.0.13"
77
80
  },
78
81
  "devDependencies": {
@@ -80,6 +83,7 @@
80
83
  "@fontsource/roboto-mono": "^5.2.6",
81
84
  "@internationalized/date": "^3.8.2",
82
85
  "@radix-ui/react-avatar": "^1.1.10",
86
+ "@react-aria/interactions": "^3.25.3",
83
87
  "@react-aria/ssr": "^3.9.10",
84
88
  "@react-aria/utils": "^3.30.0",
85
89
  "@react-stately/color": "^3.9.0",
@@ -103,7 +107,6 @@
103
107
  "@testing-library/react": "^16.3.0",
104
108
  "@testing-library/user-event": "^14.6.1",
105
109
  "@types/lodash": "^4.17.20",
106
- "@react-aria/interactions": "^3.25.3",
107
110
  "@types/node": "^24.1.0",
108
111
  "@types/react": "^19.1.9",
109
112
  "@types/react-dom": "^19.1.7",
@@ -126,13 +129,15 @@
126
129
  "tsup": "^8.5.0",
127
130
  "type-fest": "^4.41.0",
128
131
  "typescript": "^5.8.3",
132
+ "uuid": "^11.1.0",
129
133
  "vite": "^5.4.9",
130
134
  "vite-tsconfig-paths": "^5.1.4",
131
135
  "vitest": "^2.1.3",
132
136
  "zod": "^4.0.13",
133
137
  "@accelint/biome-config": "0.1.2",
134
- "@accelint/core": "0.2.2",
135
- "@accelint/icons": "2.0.2",
138
+ "@accelint/bus": "1.0.0",
139
+ "@accelint/core": "0.4.0",
140
+ "@accelint/icons": "2.0.3",
136
141
  "@accelint/typescript-config": "0.1.2",
137
142
  "@accelint/vitest-config": "0.1.3"
138
143
  },
@@ -1,19 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import react__default from 'react';
3
-
4
- interface BoxProps extends react__default.HTMLAttributes<HTMLDivElement> {
5
- as?: react__default.ElementType;
6
- /** When true, apply flex display */
7
- flex?: boolean;
8
- /** Flex direction: 'row' or 'col' */
9
- direction?: 'row' | 'col';
10
- /** Horizontal alignment in flex container */
11
- justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
12
- /** Vertical alignment in flex container */
13
- align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
14
- /** Gap between children (matches Tailwind's spacing scale) */
15
- gap?: number;
16
- }
17
- declare const Box: ({ as: Component, className, flex, direction, justify, align, gap, children, ...rest }: BoxProps) => react_jsx_runtime.JSX.Element;
18
-
19
- export { Box, type BoxProps };
@@ -1,2 +0,0 @@
1
- import {jsx}from'react/jsx-runtime';import {cx}from'class-variance-authority';const u=({as:r="div",className:o,flex:e,direction:a="row",justify:t,align:n,gap:s,children:c,...i})=>{const l=cx(e&&"flex",e&&(a==="col"?"flex-col":"flex-row"),t&&{start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"}[t],n&&{start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"}[n],s!==void 0&&`gap-${s}`,o);return jsx(r,{className:l,...i,children:c})};export{u as Box};//# sourceMappingURL=index.js.map
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/box/index.tsx"],"names":["Box","Component","className","flex","direction","justify","align","gap","children","rest","classes","cx","jsx"],"mappings":"oFA4BaA,CAAAA,CAAM,CAAC,CAClB,EAAA,CAAIC,CAAAA,CAAY,MAChB,SAAA,CAAAC,CAAAA,CACA,KAAAC,CAAAA,CACA,SAAA,CAAAC,EAAY,KAAA,CACZ,OAAA,CAAAC,EACA,KAAA,CAAAC,CAAAA,CACA,IAAAC,CAAAA,CACA,QAAA,CAAAC,EACA,GAAGC,CACL,IAAgB,CACd,MAAMC,EAAUC,EAAAA,CACdR,CAAAA,EAAQ,OACRA,CAAAA,GAASC,CAAAA,GAAc,MAAQ,UAAA,CAAa,UAAA,CAAA,CAC5CC,GACE,CACE,KAAA,CAAO,gBACP,MAAA,CAAQ,gBAAA,CACR,IAAK,aAAA,CACL,OAAA,CAAS,kBACT,MAAA,CAAQ,gBAAA,CACR,OAAQ,gBACV,CAAA,CAAEA,CAAO,CAAA,CACXC,CAAAA,EACE,CACE,KAAA,CAAO,aAAA,CACP,OAAQ,cAAA,CACR,GAAA,CAAK,YACL,OAAA,CAAS,eAAA,CACT,SAAU,gBACZ,CAAA,CAAEA,CAAK,CAAA,CACTC,CAAAA,GAAQ,QAAa,CAAA,IAAA,EAAOA,CAAG,GAC/BL,CACF,CAAA,CAEA,OACEU,GAAAA,CAACX,CAAAA,CAAA,CAAU,SAAA,CAAWS,CAAAA,CAAU,GAAGD,CAAAA,CAChC,QAAA,CAAAD,EACH,CAEJ","file":"index.js","sourcesContent":["import { cx } from 'class-variance-authority';\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport type React from 'react';\n\nexport interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {\n as?: React.ElementType;\n /** When true, apply flex display */\n flex?: boolean;\n /** Flex direction: 'row' or 'col' */\n direction?: 'row' | 'col';\n /** Horizontal alignment in flex container */\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';\n /** Vertical alignment in flex container */\n align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';\n /** Gap between children (matches Tailwind's spacing scale) */\n gap?: number;\n}\n\nexport const Box = ({\n as: Component = 'div',\n className,\n flex,\n direction = 'row',\n justify,\n align,\n gap,\n children,\n ...rest\n}: BoxProps) => {\n const classes = cx(\n flex && 'flex',\n flex && (direction === 'col' ? 'flex-col' : 'flex-row'),\n justify &&\n {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n }[justify],\n align &&\n {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n }[align],\n gap !== undefined && `gap-${gap}`,\n className,\n );\n\n return (\n <Component className={classes} {...rest}>\n {children}\n </Component>\n );\n};\n"]}
@@ -1,27 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as class_variance_authority_types from 'class-variance-authority/types';
3
- import { VariantProps } from 'class-variance-authority';
4
- import { ReactNode } from 'react';
5
- import { ComboBoxProps as ComboBoxProps$1, VirtualizerProps, ListLayoutOptions } from 'react-aria-components';
6
- import { OptionsDataItem } from '../options/types.js';
7
- import '../icon/types.js';
8
-
9
- declare const textFieldStyles: (props?: ({
10
- isDisabled?: boolean | null | undefined;
11
- isInvalid?: boolean | null | undefined;
12
- size?: "small" | "medium" | null | undefined;
13
- } & class_variance_authority_types.ClassProp) | undefined) => string;
14
- interface ComboBoxProps<T extends OptionsDataItem> extends Omit<VariantProps<typeof textFieldStyles>, 'isDisabled' | 'isInvalid' | 'isReadOnly'>, Omit<ComboBoxProps$1<T>, 'children'>, Pick<VirtualizerProps<ListLayoutOptions>, 'layoutOptions'> {
15
- className?: string;
16
- children: ReactNode | ((item: T) => ReactNode);
17
- description?: string;
18
- errorMessage?: string;
19
- label?: string;
20
- placeholder?: string;
21
- }
22
- declare function ComboBox<T extends OptionsDataItem>({ children, className, description, errorMessage, isDisabled, isInvalid, isReadOnly, label, placeholder, layoutOptions, size, ...props }: ComboBoxProps<T>): react_jsx_runtime.JSX.Element;
23
- declare namespace ComboBox {
24
- var displayName: string;
25
- }
26
-
27
- export { ComboBox, type ComboBoxProps };
@@ -1,2 +0,0 @@
1
- import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {cn}from'./../../lib/utils.js';import {ChevronDown}from'@accelint/icons';import {cva}from'class-variance-authority';import {ComboBox,Button,Text,Popover,Virtualizer,ListLayout,Input}from'react-aria-components';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {Options}from'../options/index.js';const S=cva(["block w-full rounded-medium py-xs pr-[32px] pl-s font-display outline outline-interactive","not-disabled:read-only:rounded-none not-disabled:read-only:p-0 not-disabled:read-only:outline-transparent not-disabled:read-only:hover:outline-transparent not-disabled:read-only:focus:outline-transparent"],{variants:{isDisabled:{true:"text-disabled outline-interactive-disabled placeholder:text-disabled",false:"text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight"},isInvalid:{true:"outline-serious"},size:{medium:"text-body-s",small:"text-body-xs"}},compoundVariants:[{isDisabled:true,isInvalid:true,className:"outline-interactive-disabled"}],defaultVariants:{size:"medium"}}),y=({className:a,isReadOnly:d=false,size:s="medium",...r})=>jsx(Input,{...r,className:({isDisabled:e,isInvalid:o})=>cn(S({isDisabled:e,isInvalid:o,size:s,className:a}))});y.displayName="ComboBox.Input";function D({children:a,className:d,description:s,errorMessage:r,isDisabled:e,isInvalid:o,isReadOnly:i,label:p,placeholder:b,layoutOptions:h,size:m="medium",...u}){const c=m==="small",A=!(c||o)||e,g=o&&!e&&!i,P=!c&&p;return jsx(ComboBox,{...u,isDisabled:e,isInvalid:o,isReadOnly:i,className:"flex flex-col gap-xs",children:({isDisabled:l,isOpen:v})=>jsxs(Fragment,{children:[P&&jsx(Label,{className:"empty:hidden",isDisabled:l,isRequired:u.isRequired,children:p}),jsxs("div",{className:"relative flex items-center",children:[jsx(y,{className:d,isReadOnly:i,placeholder:b,size:m}),jsx(Button,{className:cn(["fg-default-light absolute right-xs transform",l&&"fg-disabled",v&&"rotate-180",i&&"hidden"]),children:jsx(Icon,{size:"small",children:jsx(ChevronDown,{})})})]}),A&&jsx(Text,{className:cn(["fg-default-dark text-body-xs empty:hidden",l&&"fg-disabled"]),slot:"description",children:s}),g&&jsx(Text,{className:"fg-serious text-body-xs empty:hidden",slot:"errorMessage",children:r}),jsx(Popover,{className:"w-(--trigger-width)",children:jsx(Virtualizer,{layout:ListLayout,layoutOptions:h,children:jsx(Options,{children:a})})})]})})}D.displayName="ComboBox";export{D as ComboBox};//# sourceMappingURL=index.js.map
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/combobox/index.tsx"],"names":["N","isReadOnly","size","jsx","t","L","isInvalid","cn","n","Input","ComboBox","errorMessage","isDisabled","layoutOptions","shouldShowDescription","isSmall","shouldShowError","label","AriaComboBox","props","B","shouldShowLabel","jsxs","f","placeholder","AriaButton","O","Icon","ChevronDown","I","x","AriaText","V","Options","C","children","R"],"mappings":"mZAsCI,MAAA,CAAA,CAAAA,GAAA,CAAA,CAAA,6YAQM,CAAA,KAAA,CAAA,0GAKJ,CAAA,CAAM,SACI,CAAA,CAAA,IAAA,CAAA,iBACD,CAAA,CAAA,IAAA,CAAA,CAAA,MAGX,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AAA,CAAA,CAAA,CAAA,WAAA,CAAA,UAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { cn } from '@/lib/utils';\nimport { ChevronDown } from '@accelint/icons';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ReactNode } from 'react';\nimport {\n Button as AriaButton,\n ComboBox as AriaComboBox,\n type ComboBoxProps as AriaComboBoxProps,\n Input as AriaInput,\n type InputProps as AriaInputProps,\n ListLayout as AriaListLayout,\n type ListLayoutOptions as AriaListLayoutOptions,\n Popover as AriaPopover,\n Text as AriaText,\n Virtualizer as AriaVirtualizer,\n type VirtualizerProps as AriaVirtualizerProps,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\nimport { Options } from '../options';\nimport type { OptionsDataItem } from '../options/types';\n\nconst textFieldStyles = cva(\n [\n 'block w-full rounded-medium py-xs pr-[32px] pl-s font-display outline outline-interactive',\n 'not-disabled:read-only:rounded-none not-disabled:read-only:p-0 not-disabled:read-only:outline-transparent not-disabled:read-only:hover:outline-transparent not-disabled:read-only:focus:outline-transparent',\n ],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n ],\n defaultVariants: {\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textFieldStyles>,\n Omit<AriaInputProps, 'size'> {\n isReadOnly?: boolean;\n}\n\nconst Input = ({\n className,\n isReadOnly = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n return (\n <AriaInput\n {...props}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textFieldStyles({\n isDisabled,\n isInvalid,\n size,\n className,\n }),\n )\n }\n />\n );\n};\nInput.displayName = 'ComboBox.Input';\n\nexport interface ComboBoxProps<T extends OptionsDataItem>\n extends Omit<\n VariantProps<typeof textFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaComboBoxProps<T>, 'children'>,\n Pick<AriaVirtualizerProps<AriaListLayoutOptions>, 'layoutOptions'> {\n className?: string;\n children: ReactNode | ((item: T) => ReactNode);\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function ComboBox<T extends OptionsDataItem>({\n children,\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n layoutOptions,\n size = 'medium',\n ...props\n}: ComboBoxProps<T>) {\n const isSmall = size === 'small';\n const shouldShowDescription = !(isSmall || isInvalid) || isDisabled;\n const shouldShowError = isInvalid && !isDisabled && !isReadOnly;\n const shouldShowLabel = !isSmall && label;\n\n return (\n <AriaComboBox<T>\n {...props}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n className='flex flex-col gap-xs'\n >\n {({ isDisabled, isOpen }) => (\n <>\n {shouldShowLabel && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n >\n {label}\n </Label>\n )}\n <div className='relative flex items-center'>\n <Input\n className={className}\n isReadOnly={isReadOnly}\n placeholder={placeholder}\n size={size}\n />\n <AriaButton\n className={cn([\n 'fg-default-light absolute right-xs transform',\n isDisabled && 'fg-disabled',\n isOpen && 'rotate-180',\n isReadOnly && 'hidden',\n ])}\n >\n <Icon size='small'>\n <ChevronDown />\n </Icon>\n </AriaButton>\n </div>\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <AriaText\n className='fg-serious text-body-xs empty:hidden'\n slot='errorMessage'\n >\n {errorMessage}\n </AriaText>\n )}\n <AriaPopover className='w-(--trigger-width)'>\n <AriaVirtualizer\n layout={AriaListLayout}\n layoutOptions={layoutOptions}\n >\n <Options>{children}</Options>\n </AriaVirtualizer>\n </AriaPopover>\n </>\n )}\n </AriaComboBox>\n );\n}\nComboBox.displayName = 'ComboBox';\n"]}
@@ -1,13 +0,0 @@
1
- import * as react from 'react';
2
- import { DrawerContextValue, DrawersContextValue, DrawerState } from './types.js';
3
- import { Key } from '@react-types/shared';
4
-
5
- declare const DrawersContext: react.Context<DrawersContextValue | null>;
6
- declare const DrawerContext: react.Context<DrawerContextValue | null>;
7
- declare function useDrawerContext(): DrawerContextValue;
8
- declare function useDrawersContext(): DrawersContextValue;
9
- declare function useDrawersState(opts?: {
10
- onStateChange?: (drawerId: Key, state: DrawerState) => void;
11
- }): DrawersContextValue;
12
-
13
- export { DrawerContext, DrawersContext, useDrawerContext, useDrawersContext, useDrawersState };
@@ -1,2 +0,0 @@
1
- import {createContext,useContext,useState,useCallback,useMemo}from'react';import {createDefaultDrawerState,drawerStateReducer}from'./state.js';import {DrawerDefaults}from'./types.js';const g=createContext(null),b=createContext(null);function v(){const n=useContext(b);if(!n)throw new Error("useDrawerContext must be used within <Drawer.Provider>");return n}function A(){const n=useContext(g);if(!n)throw new Error("useDrawersContext must be used within <Drawer.Provider>");return n}function G(n){const[s,l]=useState({}),[w,I]=useState({}),D=useCallback((e,t)=>{const r=w[e];r&&(r.onOpenChange?.(t.isOpen),r.onStateChange?.(t)),n?.onStateChange?.(e,t);},[n?.onStateChange,w]),o=useCallback((e,t)=>{l(r=>{const u=r[e]||createDefaultDrawerState({id:e,selectedMenuItemId:DrawerDefaults.selectedMenuItemId,isOpen:DrawerDefaults.isOpen}),S=drawerStateReducer(u,t);return D(e,S),{...r,[e]:S}});},[D]),C=useCallback(e=>{o(e,{type:"TOGGLE"});},[o]),p=useCallback((e,t)=>{o(e,{type:"OPEN",menuItemId:t});},[o]),y=useCallback(e=>{o(e,{type:"CLOSE"});},[o]),d=useCallback((e,t)=>{o(e,{type:"SET_MENU_ID",menuItemId:t??""});},[o]),i=useCallback((e,t)=>e!==""&&typeof e<"u"&&t===e,[]),x=useCallback(e=>s[e]||createDefaultDrawerState({id:e,selectedMenuItemId:DrawerDefaults.selectedMenuItemId,isOpen:DrawerDefaults.isOpen}),[s]),m=useCallback((e,t)=>{I(r=>({...r,[e.id]:t||{}})),l(r=>{const u=r[e.id];return {...r,[e.id]:{...e,selectedMenuItemId:u?.selectedMenuItemId??e.selectedMenuItemId}}});},[]);return useMemo(()=>({drawerStates:s,toggleDrawer:C,openDrawer:p,closeDrawer:y,getDrawerState:x,registerDrawer:m,selectMenuItem:d,isSelectedMenuItem:i}),[s,C,p,y,x,m,d,i])}export{b as DrawerContext,g as DrawersContext,v as useDrawerContext,A as useDrawersContext,G as useDrawersState};//# sourceMappingURL=context.js.map
2
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/drawer/context.ts"],"names":["DrawerContext","createContext","f","ctx","useContext","K","drawerStates","setDrawerStates","callbacks","setCallbacks","useState","notifyCallbacks","useCallback","nextState","drawerCallbacks","opts","drawerId","action","prev","currentState","createDefaultDrawerState","O","c","DrawerDefaults","toggleDrawer","updateDrawerState","openDrawer","menuItemId","closeDrawer","selectMenuItem","isSelectedMenuItem","selectedMenuItemId","a","registerDrawer","initialState","useMemo","k","getDrawerState"],"mappings":"uLAiCiE,MAAI,CAAA,CAC/DA,cAAgBC,IAAyC,CAAA,CAAI,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AyBA,QAvBqBC,CAAAA,OAEjBC,OAAA,CAAA,KAAA,CAAA,2BAEA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,4BAEA,CAAA,CAAA,CAAA,cACA,CAAA,CAAA,CAAA,mCAKAZ,CAAAA,CACAE,EACAE,CAAAA,CACAS,CAAAA,CACAJ,EACAJ,CAAAA,CACAC,CACF,CACF,CAGF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","file":"context.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react';\nimport {\n type DrawerAction,\n createDefaultDrawerState,\n drawerStateReducer,\n} from './state';\nimport {\n type DrawerContextValue,\n DrawerDefaults,\n type DrawerState,\n type DrawersContextValue,\n type OnOpenChangeCallback,\n} from './types';\n\nimport type { Key } from '@react-types/shared';\n\nconst DrawersContext = createContext<DrawersContextValue | null>(null);\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nexport function useDrawerContext(): DrawerContextValue {\n const ctx = useContext(DrawerContext);\n\n if (!ctx) {\n throw new Error('useDrawerContext must be used within <Drawer.Provider>');\n }\n\n return ctx;\n}\n\nexport function useDrawersContext(): DrawersContextValue {\n const ctx = useContext(DrawersContext);\n\n if (!ctx) {\n throw new Error('useDrawersContext must be used within <Drawer.Provider>');\n }\n\n return ctx;\n}\n\ntype DrawerCallbacks = {\n onOpenChange?: OnOpenChangeCallback;\n onStateChange?: (state: DrawerState) => void;\n};\n\nexport function useDrawersState(opts?: {\n onStateChange?: (drawerId: Key, state: DrawerState) => void;\n}) {\n const [drawerStates, setDrawerStates] = useState<Record<Key, DrawerState>>(\n {},\n );\n const [callbacks, setCallbacks] = useState<Record<Key, DrawerCallbacks>>({});\n\n const notifyCallbacks = useCallback(\n (drawerId: Key, nextState: DrawerState) => {\n const drawerCallbacks = callbacks[drawerId];\n if (drawerCallbacks) {\n drawerCallbacks.onOpenChange?.(nextState.isOpen);\n drawerCallbacks.onStateChange?.(nextState);\n }\n opts?.onStateChange?.(drawerId, nextState);\n },\n [opts?.onStateChange, callbacks],\n );\n\n const updateDrawerState = useCallback(\n (drawerId: Key, action: DrawerAction) => {\n setDrawerStates((prev) => {\n const currentState =\n prev[drawerId] ||\n createDefaultDrawerState({\n id: drawerId,\n selectedMenuItemId: DrawerDefaults.selectedMenuItemId,\n isOpen: DrawerDefaults.isOpen,\n });\n const nextState = drawerStateReducer(currentState, action);\n\n notifyCallbacks(drawerId, nextState);\n\n return {\n ...prev,\n [drawerId]: nextState,\n };\n });\n },\n [notifyCallbacks],\n );\n\n const toggleDrawer = useCallback(\n (drawerId: Key) => {\n updateDrawerState(drawerId, { type: 'TOGGLE' });\n },\n [updateDrawerState],\n );\n\n const openDrawer = useCallback(\n (drawerId: Key, menuItemId?: Key) => {\n updateDrawerState(drawerId, { type: 'OPEN', menuItemId });\n },\n [updateDrawerState],\n );\n\n const closeDrawer = useCallback(\n (drawerId: Key) => {\n updateDrawerState(drawerId, { type: 'CLOSE' });\n },\n [updateDrawerState],\n );\n\n const selectMenuItem = useCallback(\n (drawerId: Key, menuItemId?: Key) => {\n updateDrawerState(drawerId, {\n type: 'SET_MENU_ID',\n menuItemId: menuItemId ?? '',\n });\n },\n [updateDrawerState],\n );\n\n const isSelectedMenuItem = useCallback(\n (selectedMenuItemId?: Key, menuItemId?: Key) => {\n return (\n selectedMenuItemId !== '' &&\n typeof selectedMenuItemId !== 'undefined' &&\n menuItemId === selectedMenuItemId\n );\n },\n [],\n );\n\n const getDrawerState = useCallback(\n (drawerId: Key): DrawerState => {\n return (\n drawerStates[drawerId] ||\n createDefaultDrawerState({\n id: drawerId,\n selectedMenuItemId: DrawerDefaults.selectedMenuItemId,\n isOpen: DrawerDefaults.isOpen,\n })\n );\n },\n [drawerStates],\n );\n\n const registerDrawer = useCallback(\n (initialState: DrawerState, drawerCallbacks?: DrawerCallbacks) => {\n setCallbacks((prev) => ({\n ...prev,\n [initialState.id]: drawerCallbacks || {},\n }));\n\n setDrawerStates((prev) => {\n const currentState = prev[initialState.id];\n return {\n ...prev,\n [initialState.id]: {\n ...initialState,\n selectedMenuItemId:\n currentState?.selectedMenuItemId ??\n initialState.selectedMenuItemId,\n },\n };\n });\n },\n [],\n );\n\n const contextValue = useMemo<DrawersContextValue>(\n () => ({\n drawerStates,\n toggleDrawer,\n openDrawer,\n closeDrawer,\n getDrawerState,\n registerDrawer,\n selectMenuItem,\n isSelectedMenuItem,\n }),\n [\n drawerStates,\n toggleDrawer,\n openDrawer,\n closeDrawer,\n getDrawerState,\n registerDrawer,\n selectMenuItem,\n isSelectedMenuItem,\n ],\n );\n\n return contextValue;\n}\n\nexport { DrawersContext, DrawerContext };\n"]}
@@ -1,26 +0,0 @@
1
- import { DrawerState } from './types.js';
2
- import { Key } from '@react-types/shared';
3
- import 'react';
4
-
5
- type DrawerAction = {
6
- type: 'TOGGLE';
7
- } | {
8
- type: 'OPEN';
9
- menuItemId?: Key;
10
- } | {
11
- type: 'CLOSE';
12
- } | {
13
- type: 'SET_MENU_ID';
14
- menuItemId?: Key;
15
- };
16
- /**
17
- * Default state for new drawers
18
- */
19
- declare const createDefaultDrawerState: ({ id, selectedMenuItemId, isOpen, }: {
20
- id: Key;
21
- selectedMenuItemId?: Key;
22
- isOpen?: boolean;
23
- }) => DrawerState;
24
- declare const drawerStateReducer: (state: DrawerState, action: DrawerAction) => DrawerState;
25
-
26
- export { type DrawerAction, createDefaultDrawerState, drawerStateReducer };
@@ -1,2 +0,0 @@
1
- import {DrawerDefaults}from'./types.js';const I=({id:e,selectedMenuItemId:t=DrawerDefaults.selectedMenuItemId,isOpen:n=DrawerDefaults.isOpen})=>({id:e,isOpen:n,selectedMenuItemId:t}),u=(e,t)=>{switch(t.type){case "TOGGLE":return {...e,isOpen:!e.isOpen,selectedMenuItemId:e.isOpen?void 0:e.selectedMenuItemId};case "OPEN":return {...e,isOpen:true,selectedMenuItemId:t.menuItemId};case "CLOSE":return {...e,isOpen:false,selectedMenuItemId:void 0};case "SET_MENU_ID":return {...e,selectedMenuItemId:t.menuItemId};default:return e}};export{I as createDefaultDrawerState,u as drawerStateReducer};//# sourceMappingURL=state.js.map
2
- //# sourceMappingURL=state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/drawer/state.ts"],"names":["id","DrawerDefaults","r","drawerStateReducer","state","action"],"mappings":"wCAwByC,MACvC,CAAA,CAAA,CAAAA,CAAAA,uBACqBC,CAAe,mCACpC,CAAA,OAAwB,CAAA,CAAAC,cAAA,CAAA,MAC1B,CAIoB,IAAEF,CAAAA,EAAI,CAAA,CAAA,CAAA,2BAA2B,CAExCG,EAAqB,CAChCC,CAAAA,CACAC,IACgB,CAChB,GAAA,CAAA,OAAe,CAAA,CAAA,MACR,KAAA,QACH,CAAA,OACKD,CAAAA,WACY,CAAA,CAAA,CAAA,CAAA,MACf,CAAA,kBAA0B,CAAA,CAAA,CAAA,MAAS,CAAA,MAAkB,CAAA,CAAA,CAAA,oBAGpD,KAAA,MACH,CAAA,OACKA,CAAAA,WAEH,CAAA,IAAA,CAAA,kBAA2B,CAAA,CAAA,CAAA,YAG1B,KAAA,OACH,CAAA,OACKA,IACH,CAAA,CAAA,MACA,yBAAoB,CAAA,QAGnB,KAAA,aACH,CAAA,OACKA,CAAAA,uBACwB,CAAA,CAAA,CAAA,UAG/B,CAAA,CAAA,QACE,OAEN,CAAA,CAAA","file":"state.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { DrawerDefaults, type DrawerState } from './types';\n\nimport type { Key } from '@react-types/shared';\n\nexport type DrawerAction =\n | { type: 'TOGGLE' }\n | { type: 'OPEN'; menuItemId?: Key }\n | { type: 'CLOSE' }\n | { type: 'SET_MENU_ID'; menuItemId?: Key };\n\n/**\n * Default state for new drawers\n */\nexport const createDefaultDrawerState = ({\n id,\n selectedMenuItemId = DrawerDefaults.selectedMenuItemId,\n isOpen = DrawerDefaults.isOpen,\n}: {\n id: Key;\n selectedMenuItemId?: Key;\n isOpen?: boolean;\n}): DrawerState => ({ id, isOpen, selectedMenuItemId });\n\nexport const drawerStateReducer = (\n state: DrawerState,\n action: DrawerAction,\n): DrawerState => {\n switch (action.type) {\n case 'TOGGLE':\n return {\n ...state,\n isOpen: !state.isOpen,\n selectedMenuItemId: state.isOpen ? undefined : state.selectedMenuItemId,\n };\n\n case 'OPEN':\n return {\n ...state,\n isOpen: true,\n selectedMenuItemId: action.menuItemId,\n };\n\n case 'CLOSE':\n return {\n ...state,\n isOpen: false,\n selectedMenuItemId: undefined,\n };\n\n case 'SET_MENU_ID':\n return {\n ...state,\n selectedMenuItemId: action.menuItemId,\n };\n\n default:\n return state;\n }\n};\n"]}
@@ -1,20 +0,0 @@
1
- import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { NavigationStackProps, NavigationStackViewProps, NavigationStackNavigateProps } from './types.js';
4
- import '@react-types/shared';
5
- import 'type-fest';
6
-
7
- declare const NavigationStack: {
8
- ({ children, defaultViewId, }: NavigationStackProps): react_jsx_runtime.JSX.Element;
9
- displayName: string;
10
- View: {
11
- ({ id, children }: NavigationStackViewProps): react.ReactNode;
12
- displayName: string;
13
- };
14
- Navigate: {
15
- ({ children, for: action, ...props }: NavigationStackNavigateProps): react_jsx_runtime.JSX.Element;
16
- displayName: string;
17
- };
18
- };
19
-
20
- export { NavigationStack };
@@ -1,2 +0,0 @@
1
- import {jsx}from'react/jsx-runtime';import'client-only';import {createContext,useState,useCallback,useMemo,useContext}from'react';import {PressResponder}from'@react-aria/interactions';import {Pressable}from'react-aria-components';const c=createContext({currentViewId:null,pushView:()=>{},popView:()=>{},clear:()=>{},canGoBack:false,viewStack:[]}),u=({id:i,children:t})=>useContext(c).currentViewId===i?t:null;u.displayName="NavigationStack.View";const S=({children:i,for:t,...a})=>{const e=useContext(c),o=useCallback(()=>{t==="back"?e.popView():t==="clear"?e.clear():e.pushView(t);},[t,e.popView,e.clear,e.pushView]);return jsx(PressResponder,{onPress:o,children:jsx(Pressable,{...a,children:i})})};S.displayName="NavigationStack.Navigate";const r=({children:i,defaultViewId:t})=>{const[a,e]=useState(t?[t]:[]),o=a[a.length-1]||null,v=a.length>1,l=useCallback(s=>{e(w=>[...w,s]);},[]),g=useCallback(()=>{e(s=>s.slice(0,-1));},[]),N=useCallback(()=>{e(t?[t]:[]);},[t]),V=useMemo(()=>({currentViewId:o,pushView:l,popView:g,clear:N,canGoBack:v,viewStack:a}),[o,v,a,l,g,N]);return jsx(c.Provider,{value:V,children:i})};r.displayName="NavigationStack",r.View=u,r.Navigate=S;export{r as NavigationStack};//# sourceMappingURL=index.js.map
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/navigation-stack/index.tsx"],"names":["NavigationStackContext","createContext","NavigationStackView","id","children","useContext","NavigationStackNavigate","action","props","context","handleOnPress","useCallback","jsx","PressResponder","Pressable","NavigationStack","defaultViewId","viewStack","setViewStack","useState","currentViewId","canGoBack","pushView","viewId","prev","popView","clear","contextValue","useMemo"],"mappings":"sOA+BA,MAAMA,CA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,IAAA,CAAOb,CAAAA,CACvBa,EAAgB,QAAA,CAAWT,CAAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\nimport 'client-only';\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react';\n\nimport { PressResponder } from '@react-aria/interactions';\nimport { Pressable } from 'react-aria-components';\nimport type {\n NavigationStackContextValue,\n NavigationStackNavigateProps,\n NavigationStackProps,\n NavigationStackViewProps,\n} from './types';\n\nconst NavigationStackContext = createContext<NavigationStackContextValue>({\n currentViewId: null,\n pushView: () => undefined,\n popView: () => undefined,\n clear: () => undefined,\n canGoBack: false,\n viewStack: [],\n});\n\nconst NavigationStackView = ({ id, children }: NavigationStackViewProps) => {\n const context = useContext(NavigationStackContext);\n const isActive = context.currentViewId === id;\n\n return isActive ? children : null;\n};\nNavigationStackView.displayName = 'NavigationStack.View';\n\nconst NavigationStackNavigate = ({\n children,\n for: action,\n ...props\n}: NavigationStackNavigateProps) => {\n const context = useContext(NavigationStackContext);\n const handleOnPress = useCallback(() => {\n if (action === 'back') {\n context.popView();\n } else if (action === 'clear') {\n context.clear();\n } else {\n context.pushView(action);\n }\n }, [action, context.popView, context.clear, context.pushView]);\n return (\n <PressResponder onPress={handleOnPress}>\n <Pressable {...props}>{children}</Pressable>\n </PressResponder>\n );\n};\nNavigationStackNavigate.displayName = 'NavigationStack.Navigate';\n\nexport const NavigationStack = ({\n children,\n defaultViewId,\n}: NavigationStackProps) => {\n const [viewStack, setViewStack] = useState<string[]>(\n defaultViewId ? [defaultViewId] : [],\n );\n const currentViewId = viewStack[viewStack.length - 1] || null;\n const canGoBack = viewStack.length > 1;\n\n const pushView = useCallback((viewId: string) => {\n setViewStack((prev) => [...prev, viewId]);\n }, []);\n const popView = useCallback(() => {\n setViewStack((prev) => prev.slice(0, -1));\n }, []);\n const clear = useCallback(() => {\n setViewStack(defaultViewId ? [defaultViewId] : []);\n }, [defaultViewId]);\n\n const contextValue = useMemo(\n () => ({\n currentViewId,\n pushView,\n popView,\n clear,\n canGoBack,\n viewStack,\n }),\n [currentViewId, canGoBack, viewStack, pushView, popView, clear],\n );\n\n return (\n <NavigationStackContext.Provider value={contextValue}>\n {children}\n </NavigationStackContext.Provider>\n );\n};\nNavigationStack.displayName = 'NavigationStack';\nNavigationStack.View = NavigationStackView;\nNavigationStack.Navigate = NavigationStackNavigate;\n"]}
@@ -1,31 +0,0 @@
1
- import { FocusableElement } from '@react-types/shared';
2
- import { RefAttributes, ReactNode, ReactElement, DOMAttributes, Key } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
-
5
- type NavigationStackProps = RefAttributes<HTMLDivElement> & {
6
- children?: ReactNode;
7
- defaultViewId?: string;
8
- className?: string;
9
- };
10
- type NavigationStackViewProps = RefAttributes<HTMLDivElement> & {
11
- id: string;
12
- children: ReactNode;
13
- };
14
- type NavigationStackNavigateProps = {
15
- children: ReactElement<DOMAttributes<FocusableElement>, string>;
16
- /**
17
- * The string is to be used as a childId. When for is a childId
18
- * navigate will push the childId onto the stack.
19
- * */
20
- for: LiteralUnion<'back' | 'clear', string>;
21
- };
22
- type NavigationStackContextValue = {
23
- currentViewId: Key | null;
24
- pushView: (viewId: string) => void;
25
- popView: () => void;
26
- clear: () => void;
27
- canGoBack: boolean;
28
- viewStack: string[];
29
- };
30
-
31
- export type { NavigationStackContextValue, NavigationStackNavigateProps, NavigationStackProps, NavigationStackViewProps };