@betterinternship/components 3.4.1 → 3.5.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 (146) hide show
  1. package/README.md +50 -38
  2. package/dist/brand-logos.d.ts +4 -0
  3. package/dist/brand-logos.js +13 -0
  4. package/dist/brand-logos.js.map +1 -0
  5. package/dist/components/accordion.js.map +1 -1
  6. package/dist/components/animated-count.js.map +1 -1
  7. package/dist/components/animated-shiny-text.js.map +1 -1
  8. package/dist/components/app-header.js.map +1 -1
  9. package/dist/components/autocomplete.d.ts +1 -2
  10. package/dist/components/autocomplete.js +75 -64
  11. package/dist/components/autocomplete.js.map +1 -1
  12. package/dist/components/avatar.js.map +1 -1
  13. package/dist/components/badge.js.map +1 -1
  14. package/dist/components/banner.js.map +1 -1
  15. package/dist/components/button.js.map +1 -1
  16. package/dist/components/calendar.js.map +1 -1
  17. package/dist/components/card.js.map +1 -1
  18. package/dist/components/carousel.js.map +1 -1
  19. package/dist/components/checkbox-field.d.ts +18 -0
  20. package/dist/components/checkbox-field.js +25 -0
  21. package/dist/components/checkbox-field.js.map +1 -0
  22. package/dist/components/checkbox-group.d.ts +33 -0
  23. package/dist/components/checkbox-group.js +43 -0
  24. package/dist/components/checkbox-group.js.map +1 -0
  25. package/dist/components/checkbox.d.ts +1 -1
  26. package/dist/components/checkbox.js +6 -2
  27. package/dist/components/checkbox.js.map +1 -1
  28. package/dist/components/chip-select.d.ts +11 -2
  29. package/dist/components/chip-select.js +9 -4
  30. package/dist/components/chip-select.js.map +1 -1
  31. package/dist/components/collapsible.js.map +1 -1
  32. package/dist/components/context-menu.js.map +1 -1
  33. package/dist/components/{form-date-picker.d.ts → date-picker.d.ts} +11 -8
  34. package/dist/components/date-picker.js +57 -0
  35. package/dist/components/date-picker.js.map +1 -0
  36. package/dist/components/dialog.js.map +1 -1
  37. package/dist/components/divider.js.map +1 -1
  38. package/dist/components/dot-matrix.js.map +1 -1
  39. package/dist/components/dropdown-menu.js.map +1 -1
  40. package/dist/components/dropdown.js +7 -2
  41. package/dist/components/dropdown.js.map +1 -1
  42. package/dist/components/error.js.map +1 -1
  43. package/dist/components/fab.js.map +1 -1
  44. package/dist/components/file-upload.js.map +1 -1
  45. package/dist/components/filter-chip.js.map +1 -1
  46. package/dist/components/form-field.d.ts +60 -5
  47. package/dist/components/form-field.js +55 -5
  48. package/dist/components/form-field.js.map +1 -1
  49. package/dist/components/hover-card.js.map +1 -1
  50. package/dist/components/input-otp.js.map +1 -1
  51. package/dist/components/input.js +3 -1
  52. package/dist/components/input.js.map +1 -1
  53. package/dist/components/label.js.map +1 -1
  54. package/dist/components/loader.js.map +1 -1
  55. package/dist/components/magnetic-button.js.map +1 -1
  56. package/dist/components/messages.js.map +1 -1
  57. package/dist/components/mobile-sheet-portal.js.map +1 -1
  58. package/dist/components/{form-month-picker.d.ts → month-picker.d.ts} +6 -6
  59. package/dist/components/month-picker.js +57 -0
  60. package/dist/components/month-picker.js.map +1 -0
  61. package/dist/components/option-list.js.map +1 -1
  62. package/dist/components/page-header.js.map +1 -1
  63. package/dist/components/paginator.js.map +1 -1
  64. package/dist/components/popover.js.map +1 -1
  65. package/dist/components/progress.js.map +1 -1
  66. package/dist/components/radio-group.d.ts +11 -1
  67. package/dist/components/radio-group.js +17 -4
  68. package/dist/components/radio-group.js.map +1 -1
  69. package/dist/components/select.js +38 -2
  70. package/dist/components/select.js.map +1 -1
  71. package/dist/components/sheet.d.ts +1 -1
  72. package/dist/components/sheet.js.map +1 -1
  73. package/dist/components/skeleton.js.map +1 -1
  74. package/dist/components/slider.js.map +1 -1
  75. package/dist/components/sonner-toast.js +133 -133
  76. package/dist/components/sonner-toast.js.map +1 -1
  77. package/dist/components/stepper.js.map +1 -1
  78. package/dist/components/switch.d.ts +1 -1
  79. package/dist/components/switch.js +4 -1
  80. package/dist/components/switch.js.map +1 -1
  81. package/dist/components/table.js +5 -5
  82. package/dist/components/table.js.map +1 -1
  83. package/dist/components/tabs.js.map +1 -1
  84. package/dist/components/textarea.d.ts +1 -1
  85. package/dist/components/textarea.js +3 -1
  86. package/dist/components/textarea.js.map +1 -1
  87. package/dist/components/time-input.d.ts +9 -0
  88. package/dist/components/time-input.js +65 -0
  89. package/dist/components/time-input.js.map +1 -0
  90. package/dist/components/timeline.js.map +1 -1
  91. package/dist/components/toggle.js.map +1 -1
  92. package/dist/components/tooltip.js.map +1 -1
  93. package/dist/hooks/use-detect-click-outside.js.map +1 -1
  94. package/dist/hooks/use-field-focus.d.ts +1 -1
  95. package/dist/hooks/use-field-focus.js +1 -1
  96. package/dist/hooks/use-field-focus.js.map +1 -1
  97. package/dist/hooks/use-mobile-sheet-viewport.js.map +1 -1
  98. package/dist/hooks/use-mobile.js.map +1 -1
  99. package/dist/hooks/use-resource-table.js.map +1 -1
  100. package/dist/hooks/useMQJob.js.map +1 -1
  101. package/dist/index.d.ts +9 -12
  102. package/dist/index.js +8 -11
  103. package/dist/index.js.map +1 -1
  104. package/dist/lib/interaction-styles.js.map +1 -1
  105. package/dist/logos/base/betterinternship.svg.js +4 -0
  106. package/dist/logos/base/betterinternship.svg.js.map +1 -0
  107. package/dist/logos/black_fill/betterinternship_black.svg.js +4 -0
  108. package/dist/logos/black_fill/betterinternship_black.svg.js.map +1 -0
  109. package/dist/logos/circle/betterinternship_circle.svg.js +4 -0
  110. package/dist/logos/circle/betterinternship_circle.svg.js.map +1 -0
  111. package/dist/logos/white_fill/betterinternship_white.svg.js +4 -0
  112. package/dist/logos/white_fill/betterinternship_white.svg.js.map +1 -0
  113. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +54 -2
  114. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
  115. package/dist/utils.js +11 -1
  116. package/dist/utils.js.map +1 -1
  117. package/package.json +317 -330
  118. package/theme.css +414 -414
  119. package/theme.legacy.css +84 -84
  120. package/dist/components/form-checkbox-group.d.ts +0 -31
  121. package/dist/components/form-checkbox-group.js +0 -30
  122. package/dist/components/form-checkbox-group.js.map +0 -1
  123. package/dist/components/form-checkbox.d.ts +0 -15
  124. package/dist/components/form-checkbox.js +0 -15
  125. package/dist/components/form-checkbox.js.map +0 -1
  126. package/dist/components/form-date-picker.js +0 -56
  127. package/dist/components/form-date-picker.js.map +0 -1
  128. package/dist/components/form-input.d.ts +0 -11
  129. package/dist/components/form-input.js +0 -13
  130. package/dist/components/form-input.js.map +0 -1
  131. package/dist/components/form-month-picker.js +0 -56
  132. package/dist/components/form-month-picker.js.map +0 -1
  133. package/dist/components/form-radio.d.ts +0 -15
  134. package/dist/components/form-radio.js +0 -20
  135. package/dist/components/form-radio.js.map +0 -1
  136. package/dist/components/form-textarea.d.ts +0 -11
  137. package/dist/components/form-textarea.js +0 -12
  138. package/dist/components/form-textarea.js.map +0 -1
  139. package/dist/components/form.d.ts +0 -24
  140. package/dist/components/form.js +0 -71
  141. package/dist/components/form.js.map +0 -1
  142. package/dist/components/time-input-native.d.ts +0 -14
  143. package/dist/components/time-input-native.js +0 -62
  144. package/dist/components/time-input-native.js.map +0 -1
  145. package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -706
  146. package/dist/node_modules/react-hook-form/dist/index.esm.js.map +0 -1
package/README.md CHANGED
@@ -1,45 +1,57 @@
1
- # Package.Components
2
-
1
+ # Package.Components
2
+
3
3
  Contains common components shared between the different interfaces of the site.
4
4
 
5
- ## Running the playground
6
-
7
- This package comes with a simple React app that you can use to test components. It runs on `localhost:5173` in your browser.
8
-
9
- Run the playground:
10
-
11
- ```bash
12
- npm run dev:playground
13
- ```
14
-
15
- ## Checking the playground
16
-
17
- Run the documentation audit and review type check:
5
+ ## Brand logos
18
6
 
19
- ```bash
20
- npm --prefix playground run check:docs
21
- npm --prefix playground run check:review
22
- ```
23
-
24
- ## Updating the package
7
+ Import `biLogo`, `biLogoCircle`, `biLogoBlack`, or `biLogoWhite` from the package
8
+ root. Each is a ready-to-use image URL made from the original SVG in `src/logos/`.
9
+ `biLogo` is the transparent, full-color mark.
25
10
 
26
- 1. Build the package:
11
+ ```tsx
12
+ import { biLogo } from '@betterinternship/components';
27
13
 
28
- ```bash
29
- npm run build
14
+ <img src={biLogo} alt="BetterInternship" />;
30
15
  ```
31
16
 
32
- 2. Commit the build:
33
-
34
- ```bash
35
- git add .
36
- git commit -m "<follow conventional commits, k thanks>"
37
- git push
38
- ```
39
-
40
- 3. Update the version and publish the package to NPM:
41
-
42
- ```bash
43
- npm version <major|minor|patch>
44
- npm publish
45
- ```
17
+ ## Running the playground
18
+
19
+ This package comes with a simple React app that you can use to test components. It runs on `localhost:5173` in your browser.
20
+
21
+ Run the playground:
22
+
23
+ ```bash
24
+ npm run dev:playground
25
+ ```
26
+
27
+ ## Checking the playground
28
+
29
+ Run the documentation audit and review type check:
30
+
31
+ ```bash
32
+ npm --prefix playground run check:docs
33
+ npm --prefix playground run check:review
34
+ ```
35
+
36
+ ## Updating the package
37
+
38
+ 1. Build the package:
39
+
40
+ ```bash
41
+ npm run build
42
+ ```
43
+
44
+ 2. Commit the build:
45
+
46
+ ```bash
47
+ git add .
48
+ git commit -m "<follow conventional commits, k thanks>"
49
+ git push
50
+ ```
51
+
52
+ 3. Update the version and publish the package to NPM:
53
+
54
+ ```bash
55
+ npm version <major|minor|patch>
56
+ npm publish
57
+ ```
@@ -0,0 +1,4 @@
1
+ export declare const biLogo: string;
2
+ export declare const biLogoCircle: string;
3
+ export declare const biLogoBlack: string;
4
+ export declare const biLogoWhite: string;
@@ -0,0 +1,13 @@
1
+ import baseLogo from './logos/base/betterinternship.svg.js';
2
+ import circleLogo from './logos/circle/betterinternship_circle.svg.js';
3
+ import blackLogo from './logos/black_fill/betterinternship_black.svg.js';
4
+ import whiteLogo from './logos/white_fill/betterinternship_white.svg.js';
5
+
6
+ // Rollup embeds the original SVGs as data URLs in the published package.
7
+ const biLogo = baseLogo;
8
+ const biLogoCircle = circleLogo;
9
+ const biLogoBlack = blackLogo;
10
+ const biLogoWhite = whiteLogo;
11
+
12
+ export { biLogo, biLogoBlack, biLogoCircle, biLogoWhite };
13
+ //# sourceMappingURL=brand-logos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-logos.js","sources":["../src/brand-logos.ts"],"sourcesContent":["import baseLogo from './logos/base/betterinternship.svg';\nimport circleLogo from './logos/circle/betterinternship_circle.svg';\nimport blackLogo from './logos/black_fill/betterinternship_black.svg';\nimport whiteLogo from './logos/white_fill/betterinternship_white.svg';\n\n// Rollup embeds the original SVGs as data URLs in the published package.\nexport const biLogo: string = baseLogo;\nexport const biLogoCircle: string = circleLogo;\nexport const biLogoBlack: string = blackLogo;\nexport const biLogoWhite: string = whiteLogo;\n"],"names":[],"mappings":";;;;;AAKA;AACO,MAAM,MAAM,GAAW;AACvB,MAAM,YAAY,GAAW;AAC7B,MAAM,WAAW,GAAW;AAC5B,MAAM,WAAW,GAAW;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.js","sources":["../../src/components/accordion.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\ntype AccordionProps =\n | React.ComponentProps<typeof AccordionPrimitive.Root>\n | (Omit<Extract<React.ComponentProps<typeof AccordionPrimitive.Root>, { type: 'multiple' }>, 'type'> & {\n /** Multiple sections can be open by default. */\n type?: 'multiple';\n });\n\nfunction Accordion(props: AccordionProps) {\n if (props.type === 'single') {\n return <AccordionPrimitive.Root data-slot=\"accordion\" {...props} />;\n }\n return <AccordionPrimitive.Root data-slot=\"accordion\" {...props} type=\"multiple\" />;\n}\n\nfunction AccordionItem({\n className,\n ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Item>) {\n return (\n <AccordionPrimitive.Item\n data-slot=\"accordion-item\"\n className={cn('border-b border-border last:border-b-0', className)}\n {...props}\n />\n );\n}\n\nfunction AccordionTrigger({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {\n return (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n data-slot=\"accordion-trigger\"\n className={cn(\n 'group/accordion focus-visible:outline-ring flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-control-lg py-4 text-left text-sm font-medium transition-colors duration-state ease-out-strong pointer-fine:hover:text-primary-hover focus-visible:outline-3 focus-visible:outline-offset-4 disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronDownIcon className=\"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-[color,transform] duration-state ease-out-strong pointer-fine:group-hover/accordion:text-primary-hover group-data-[state=open]/accordion:rotate-180 motion-safe:pointer-fine:group-data-[state=closed]/accordion:group-hover/accordion:-rotate-45 motion-safe:pointer-fine:group-data-[state=open]/accordion:group-hover/accordion:rotate-[225deg] motion-reduce:transition-none\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n}\n\nfunction AccordionContent({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Content>) {\n return (\n <AccordionPrimitive.Content\n data-slot=\"accordion-content\"\n className=\"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-base\"\n {...props}\n >\n <div className={cn('pt-0 pb-4', className)}>{children}</div>\n </AccordionPrimitive.Content>\n );\n}\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;AAaA,SAAS,SAAS,CAAC,KAAqB,EAAA;AACtC,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC3B,OAAOA,GAAA,CAAC,kBAAkB,CAAC,IAAI,iBAAW,WAAW,EAAA,GAAK,KAAK,EAAA,CAAI;IACrE;AACA,IAAA,OAAOA,GAAA,CAAC,kBAAkB,CAAC,IAAI,EAAA,EAAA,WAAA,EAAW,WAAW,EAAA,GAAK,KAAK,EAAE,IAAI,EAAC,UAAU,GAAG;AACrF;AAEA,SAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EAC6C,EAAA;IACrD,QACEA,IAAC,kBAAkB,CAAC,IAAI,EAAA,EAAA,WAAA,EACZ,gBAAgB,EAC1B,SAAS,EAAE,EAAE,CAAC,wCAAwC,EAAE,SAAS,CAAC,KAC9D,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACgD,EAAA;AACxD,IAAA,QACEA,GAAA,CAAC,kBAAkB,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,MAAM,EAAA,QAAA,EACzCC,IAAA,CAAC,kBAAkB,CAAC,OAAO,iBACf,mBAAmB,EAC7B,SAAS,EAAE,EAAE,CACX,4XAA4X,EAC5X,SAAS,CACV,KACG,KAAK,EAAA,QAAA,EAAA,CAER,QAAQ,EACTD,GAAA,CAAC,eAAe,EAAA,EAAC,SAAS,EAAC,ucAAuc,GAAG,CAAA,EAAA,CAC1c,EAAA,CACH;AAEhC;AAEA,SAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACgD,EAAA;AACxD,IAAA,QACEA,GAAA,CAAC,kBAAkB,CAAC,OAAO,EAAA,EAAA,WAAA,EACf,mBAAmB,EAC7B,SAAS,EAAC,6GAA6G,EAAA,GACnH,KAAK,EAAA,QAAA,EAETA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO,EAAA,CACjC;AAEjC;;;;"}
1
+ {"version":3,"file":"accordion.js","sources":["../../src/components/accordion.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\r\nimport { ChevronDownIcon } from 'lucide-react';\r\n\r\nimport { cn } from '@/utils';\r\n\r\ntype AccordionProps =\r\n | React.ComponentProps<typeof AccordionPrimitive.Root>\r\n | (Omit<Extract<React.ComponentProps<typeof AccordionPrimitive.Root>, { type: 'multiple' }>, 'type'> & {\r\n /** Multiple sections can be open by default. */\r\n type?: 'multiple';\r\n });\r\n\r\nfunction Accordion(props: AccordionProps) {\r\n if (props.type === 'single') {\r\n return <AccordionPrimitive.Root data-slot=\"accordion\" {...props} />;\r\n }\r\n return <AccordionPrimitive.Root data-slot=\"accordion\" {...props} type=\"multiple\" />;\r\n}\r\n\r\nfunction AccordionItem({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof AccordionPrimitive.Item>) {\r\n return (\r\n <AccordionPrimitive.Item\r\n data-slot=\"accordion-item\"\r\n className={cn('border-b border-border last:border-b-0', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction AccordionTrigger({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {\r\n return (\r\n <AccordionPrimitive.Header className=\"flex\">\r\n <AccordionPrimitive.Trigger\r\n data-slot=\"accordion-trigger\"\r\n className={cn(\r\n 'group/accordion focus-visible:outline-ring flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-control-lg py-4 text-left text-sm font-medium transition-colors duration-state ease-out-strong pointer-fine:hover:text-primary-hover focus-visible:outline-3 focus-visible:outline-offset-4 disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none',\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ChevronDownIcon className=\"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-[color,transform] duration-state ease-out-strong pointer-fine:group-hover/accordion:text-primary-hover group-data-[state=open]/accordion:rotate-180 motion-safe:pointer-fine:group-data-[state=closed]/accordion:group-hover/accordion:-rotate-45 motion-safe:pointer-fine:group-data-[state=open]/accordion:group-hover/accordion:rotate-[225deg] motion-reduce:transition-none\" />\r\n </AccordionPrimitive.Trigger>\r\n </AccordionPrimitive.Header>\r\n );\r\n}\r\n\r\nfunction AccordionContent({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof AccordionPrimitive.Content>) {\r\n return (\r\n <AccordionPrimitive.Content\r\n data-slot=\"accordion-content\"\r\n className=\"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-base\"\r\n {...props}\r\n >\r\n <div className={cn('pt-0 pb-4', className)}>{children}</div>\r\n </AccordionPrimitive.Content>\r\n );\r\n}\r\n\r\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\r\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;AAaA,SAAS,SAAS,CAAC,KAAqB,EAAA;AACtC,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC3B,OAAOA,GAAA,CAAC,kBAAkB,CAAC,IAAI,iBAAW,WAAW,EAAA,GAAK,KAAK,EAAA,CAAI;IACrE;AACA,IAAA,OAAOA,GAAA,CAAC,kBAAkB,CAAC,IAAI,EAAA,EAAA,WAAA,EAAW,WAAW,EAAA,GAAK,KAAK,EAAE,IAAI,EAAC,UAAU,GAAG;AACrF;AAEA,SAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EAC6C,EAAA;IACrD,QACEA,IAAC,kBAAkB,CAAC,IAAI,EAAA,EAAA,WAAA,EACZ,gBAAgB,EAC1B,SAAS,EAAE,EAAE,CAAC,wCAAwC,EAAE,SAAS,CAAC,KAC9D,KAAK,EAAA,CACT;AAEN;AAEA,SAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACgD,EAAA;AACxD,IAAA,QACEA,GAAA,CAAC,kBAAkB,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,MAAM,EAAA,QAAA,EACzCC,IAAA,CAAC,kBAAkB,CAAC,OAAO,iBACf,mBAAmB,EAC7B,SAAS,EAAE,EAAE,CACX,4XAA4X,EAC5X,SAAS,CACV,KACG,KAAK,EAAA,QAAA,EAAA,CAER,QAAQ,EACTD,GAAA,CAAC,eAAe,EAAA,EAAC,SAAS,EAAC,ucAAuc,GAAG,CAAA,EAAA,CAC1c,EAAA,CACH;AAEhC;AAEA,SAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACgD,EAAA;AACxD,IAAA,QACEA,GAAA,CAAC,kBAAkB,CAAC,OAAO,EAAA,EAAA,WAAA,EACf,mBAAmB,EAC7B,SAAS,EAAC,6GAA6G,EAAA,GACnH,KAAK,EAAA,QAAA,EAETA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAO,EAAA,CACjC;AAEjC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"animated-count.js","sources":["../../src/components/animated-count.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport { AnimatePresence, motion, useReducedMotion } from 'framer-motion';\n\n/** A number that rolls up or down when its value changes. */\nexport const AnimatedCount = ({ value }: { value: number }) => {\n const reduceMotion = useReducedMotion();\n const previous = useRef(value);\n const direction = value >= previous.current ? 1 : -1;\n\n useEffect(() => {\n previous.current = value;\n }, [value]);\n\n return (\n <span className=\"relative inline-flex justify-center overflow-hidden tabular-nums\">\n <span className={reduceMotion ? undefined : 'invisible'}>{value}</span>\n {!reduceMotion && (\n <span aria-hidden=\"true\">\n <AnimatePresence initial={false} custom={direction}>\n <motion.span\n key={value}\n className=\"absolute inset-0 flex items-center justify-center\"\n initial={{ y: `${direction * 100}%`, opacity: 0 }}\n animate={{ y: '0%', opacity: 1 }}\n variants={{ exit: (exitDirection: number) => ({ y: `${exitDirection * -100}%`, opacity: 0 }) }}\n exit=\"exit\"\n transition={{ duration: 0.18, ease: 'easeOut' }}\n >\n {value}\n </motion.span>\n </AnimatePresence>\n </span>\n )}\n </span>\n );\n};\n\nexport default AnimatedCount;\n"],"names":[],"mappings":";;;;;AAKA;;AAEE;AACA;AACA;;AAGE;AACF;AAEA;AAsBF;;"}
1
+ {"version":3,"file":"animated-count.js","sources":["../../src/components/animated-count.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useEffect, useRef } from 'react';\r\nimport { AnimatePresence, motion, useReducedMotion } from 'framer-motion';\r\n\r\n/** A number that rolls up or down when its value changes. */\r\nexport const AnimatedCount = ({ value }: { value: number }) => {\r\n const reduceMotion = useReducedMotion();\r\n const previous = useRef(value);\r\n const direction = value >= previous.current ? 1 : -1;\r\n\r\n useEffect(() => {\r\n previous.current = value;\r\n }, [value]);\r\n\r\n return (\r\n <span className=\"relative inline-flex justify-center overflow-hidden tabular-nums\">\r\n <span className={reduceMotion ? undefined : 'invisible'}>{value}</span>\r\n {!reduceMotion && (\r\n <span aria-hidden=\"true\">\r\n <AnimatePresence initial={false} custom={direction}>\r\n <motion.span\r\n key={value}\r\n className=\"absolute inset-0 flex items-center justify-center\"\r\n initial={{ y: `${direction * 100}%`, opacity: 0 }}\r\n animate={{ y: '0%', opacity: 1 }}\r\n variants={{ exit: (exitDirection: number) => ({ y: `${exitDirection * -100}%`, opacity: 0 }) }}\r\n exit=\"exit\"\r\n transition={{ duration: 0.18, ease: 'easeOut' }}\r\n >\r\n {value}\r\n </motion.span>\r\n </AnimatePresence>\r\n </span>\r\n )}\r\n </span>\r\n );\r\n};\r\n\r\nexport default AnimatedCount;\r\n"],"names":[],"mappings":";;;;;AAKA;;AAEE;AACA;AACA;;AAGE;AACF;AAEA;AAsBF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"animated-shiny-text.js","sources":["../../src/components/animated-shiny-text.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from \"react\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport { cn } from \"@/utils\";\n\nexport function AnimatedShinyText({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n const reduceMotion = useReducedMotion();\n\n return (\n <motion.span\n className={cn(\n \"inline-block bg-[linear-gradient(110deg,rgba(15,23,42,0.9)_0%,rgba(15,23,42,0.9)_42%,rgba(255,255,255,0.75)_50%,rgba(15,23,42,0.9)_58%,rgba(15,23,42,0.9)_100%)] bg-[length:200%_100%] bg-clip-text align-baseline text-transparent motion-reduce:bg-none motion-reduce:text-slate-900\",\n className,\n )}\n initial={false}\n animate={reduceMotion ? { backgroundPosition: '0% 0%' } : { backgroundPosition: ['200% 0%', '-200% 0%'] }}\n transition={reduceMotion ? { duration: 0 } : { duration: 4, ease: 'linear', repeat: Infinity }}\n >\n {children}\n </motion.span>\n );\n}\n"],"names":[],"mappings":";;;;;;AAaE;AAEA;AAaF;;"}
1
+ {"version":3,"file":"animated-shiny-text.js","sources":["../../src/components/animated-shiny-text.tsx"],"sourcesContent":["'use client';\r\n\r\nimport type { ReactNode } from \"react\";\r\nimport { motion, useReducedMotion } from \"framer-motion\";\r\nimport { cn } from \"@/utils\";\r\n\r\nexport function AnimatedShinyText({\r\n children,\r\n className,\r\n}: {\r\n children: ReactNode;\r\n className?: string;\r\n}) {\r\n const reduceMotion = useReducedMotion();\r\n\r\n return (\r\n <motion.span\r\n className={cn(\r\n \"inline-block bg-[linear-gradient(110deg,rgba(15,23,42,0.9)_0%,rgba(15,23,42,0.9)_42%,rgba(255,255,255,0.75)_50%,rgba(15,23,42,0.9)_58%,rgba(15,23,42,0.9)_100%)] bg-[length:200%_100%] bg-clip-text align-baseline text-transparent motion-reduce:bg-none motion-reduce:text-slate-900\",\r\n className,\r\n )}\r\n initial={false}\r\n animate={reduceMotion ? { backgroundPosition: '0% 0%' } : { backgroundPosition: ['200% 0%', '-200% 0%'] }}\r\n transition={reduceMotion ? { duration: 0 } : { duration: 4, ease: 'linear', repeat: Infinity }}\r\n >\r\n {children}\r\n </motion.span>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;;;AAaE;AAEA;AAaF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"app-header.js","sources":["../../src/components/app-header.tsx"],"sourcesContent":["'use client';\n\nimport Link from 'next/link';\nimport Image from 'next/image';\nimport { usePathname, useRouter } from 'next/navigation';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n} from '@/components/dropdown-menu';\nimport { Button } from '@/components/button';\nimport { Divider } from '@/components/divider';\nimport { cn } from '@/utils';\nimport {\n LogOut,\n Menu,\n Search,\n X,\n UserRound,\n ChevronDown,\n ChevronRight,\n Handshake,\n Mail,\n History,\n FileText,\n Users,\n LayoutDashboard,\n FileSignature,\n GraduationCap,\n Building2,\n SearchCheck,\n} from 'lucide-react';\nimport { useState, useEffect } from 'react';\nimport type { ReactNode } from 'react';\nimport type { LucideIcon } from 'lucide-react';\n\nexport interface NavItem {\n href: string;\n label: string;\n badge?: number;\n icon?: LucideIcon;\n}\n\ninterface AppHeaderProps {\n /** Optional site name. */\n siteName?: string;\n homeHref: string;\n nav: NavItem[];\n /** Optional desktop links displayed next to the brand. */\n links?: NavItem[];\n userPrimary?: string;\n userSecondary?: string;\n logout: () => Promise<unknown>;\n postLogoutPath: string;\n profileHref?: string;\n userAvatarUrl?: string | null;\n accountNav?: NavItem[];\n /** Overrides the hardcoded \"Partners\" brand text. */\n brand?: string;\n /** Overrides the hardcoded \"/betterinternship-logo.png\" logo path. */\n logoPath?: string;\n /** Extra controls rendered next to the nav (desktop) and inside the drawer (mobile). */\n actions?: ReactNode;\n /**\n * Inline search control rendered in the header's center region on desktop\n * (`md` and up only). Purely a layout slot — the consumer owns all search\n * state and behavior. For mobile, pair with `onSearchClick`.\n */\n search?: ReactNode;\n /**\n * When set, renders a search icon button on mobile immediately left of the\n * hamburger. Typically opens a full-screen search overlay owned by the\n * consumer.\n */\n onSearchClick?: () => void;\n /**\n * Set to false to hide the mobile hamburger button and its side drawer\n * entirely — for consumers that provide their own mobile navigation (e.g.\n * a bottom tab bar) and don't want the nav/profile/logout items duplicated.\n * Defaults to true.\n */\n showMobileMenu?: boolean;\n}\n\nfunction labelIcon(label: string): LucideIcon {\n const map: Record<string, LucideIcon> = {\n Partners: Handshake,\n Invites: Mail,\n Invitations: Mail,\n Accounts: Users,\n 'Activity Log': History,\n 'MOA Templates': FileText,\n Universities: GraduationCap,\n Companies: Building2,\n 'Company Reviews': SearchCheck,\n 'Request MOA': FileSignature,\n Dashboard: LayoutDashboard,\n };\n return map[label] ?? Handshake;\n}\n\nexport function AppHeader({\n siteName,\n homeHref,\n nav,\n links = [],\n userPrimary,\n userSecondary,\n logout: logoutFn,\n postLogoutPath,\n profileHref,\n userAvatarUrl,\n accountNav = [],\n brand = 'Partners',\n logoPath = '/betterinternship-logo.png',\n actions,\n search,\n onSearchClick,\n showMobileMenu = true,\n}: AppHeaderProps) {\n const pathname = usePathname() ?? '';\n const router = useRouter();\n const queryClient = useQueryClient();\n const [isDrawerOpen, setIsDrawerOpen] = useState(false);\n\n useEffect(() => {\n setIsDrawerOpen(false);\n }, [pathname]);\n\n useEffect(() => {\n document.body.style.overflow = isDrawerOpen ? 'hidden' : '';\n return () => {\n document.body.style.overflow = '';\n };\n }, [isDrawerOpen]);\n\n const logout = useMutation({\n mutationFn: logoutFn,\n onSettled: () => {\n queryClient.clear();\n router.replace(postLogoutPath);\n },\n });\n\n const isActive = (href: string) =>\n pathname === href || pathname.startsWith(`${href}/`);\n\n return (\n <header className=\"sticky top-0 z-40 w-full bg-white\">\n <div className=\"flex min-h-[76px] w-full items-center gap-7 px-4 md:px-6 max-md:min-h-[72px] max-md:gap-3 max-md:py-3\">\n {/* Brand */}\n <Link\n href={homeHref}\n aria-label={brand}\n className=\"inline-flex shrink-0 items-center gap-3 text-lg font-[750] leading-[1.5] tracking-[-.0375rem] text-landing-navy focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue max-md:gap-1.5 max-md:text-base\"\n >\n <div className=\"flex items-center gap-3 max-md:gap-1.5\">\n <Image\n src={logoPath}\n alt=\"\"\n width={24}\n height={24}\n className=\"flex-none\"\n />\n {/* Wordmark hides below md — the logo carries the link, which keeps\n its name via the aria-label above. */}\n <div className=\"hidden items-center md:flex\">\n <span>\n {brand}\n </span>\n {siteName && (\n <>\n <span\n className=\"mx-2.5 h-4 w-px bg-gray-300\"\n aria-hidden=\"true\"\n />\n <span className=\"font-display font-normal text-gray-500\">\n {siteName}\n </span>\n </>\n )}\n </div>\n </div>\n </Link>\n\n {links.length > 0 && (\n <nav aria-label=\"Resources\" className=\"hidden shrink-0 items-center gap-4 text-sm font-[550] text-landing-nav md:flex xl:gap-7\">\n {links.map((item) => (\n <Link\n key={item.href}\n href={item.href}\n aria-current={isActive(item.href) ? 'page' : undefined}\n className=\"flex min-h-11 items-center rounded-sm text-landing-nav transition-colors duration-[180ms] hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue aria-[current=page]:text-landing-blue\"\n >\n {item.label}\n </Link>\n ))}\n </nav>\n )}\n\n {/* Desktop center: inline search slot. The empty div doubles as the\n spacer that keeps the right cluster right-aligned when no search\n is passed. */}\n <div className=\"hidden min-w-0 flex-1 md:flex md:items-center\">\n {search}\n </div>\n\n {/* Desktop right side: nav buttons + user */}\n <div className=\"ml-auto hidden shrink-0 items-center gap-1 md:flex\">\n {nav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Button\n key={item.href}\n variant=\"ghost\"\n className={cn(\n 'relative min-h-12 min-w-0 flex-col items-center justify-center gap-1 rounded-[.33em] px-3 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\n isActive(item.href)\n ? 'text-landing-blue'\n : '',\n )}\n onClick={() => router.push(item.href)}\n >\n <Icon className=\"h-6! w-6!\" strokeWidth={1.7} />\n <span className=\"text-xs\">{item.label}</span>\n {!!item.badge && (\n <span className=\"absolute -top-0.5 right-5.5 inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\n {item.badge}\n </span>\n )}\n </Button>\n );\n })}\n\n {actions}\n\n {/* User dropdown */}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n className={cn(\n 'group min-h-12 w-20 flex-col items-center justify-center gap-1 rounded-[.33em] px-2 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\n (profileHref && isActive(profileHref)) ||\n accountNav.some((item) => isActive(item.href))\n ? 'text-landing-blue'\n : '',\n )}\n >\n <div className=\"flex h-6 w-6 items-center justify-center overflow-hidden rounded-full bg-gray-100\">\n {userAvatarUrl ? (\n <img\n src={userAvatarUrl}\n alt=\"\"\n className=\"h-full w-full object-contain\"\n />\n ) : (\n <UserRound className=\"h-5 w-5 text-gray-500\" />\n )}\n </div>\n <div className=\"flex items-center gap-0.5\">\n <span className=\"text-xs\">Account</span>\n <ChevronDown className=\"h-3! w-3! transition-transform group-data-[state=open]:rotate-180\" />\n </div>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-max min-w-44\">\n {userPrimary && (\n <div className=\"px-2 py-1.5\">\n <div className=\"text-center text-sm font-medium\">\n {userPrimary}\n </div>\n {userSecondary && (\n <div className=\"text-muted-foreground text-center text-xs\">\n {userSecondary}\n </div>\n )}\n </div>\n )}\n <DropdownMenuSeparator />\n {profileHref && (\n <DropdownMenuItem asChild>\n <Link href={profileHref}>\n <UserRound className=\"h-4 w-4\" />\n Profile\n </Link>\n </DropdownMenuItem>\n )}\n {accountNav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <DropdownMenuItem key={item.href} asChild>\n <Link href={item.href}>\n <Icon className=\"h-4 w-4\" />\n {item.label}\n </Link>\n </DropdownMenuItem>\n );\n })}\n {(profileHref || accountNav.length > 0) && (\n <DropdownMenuSeparator />\n )}\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={logout.isPending}\n onClick={() => logout.mutate()}\n >\n <LogOut className=\"h-4 w-4\" />\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n\n {/* Mobile: search trigger + hamburger */}\n <div className=\"flex items-center gap-1 md:hidden\">\n {onSearchClick && (\n <button\n type=\"button\"\n aria-label=\"Search\"\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\n onClick={onSearchClick}\n >\n <Search className=\"h-5 w-5\" />\n </button>\n )}\n {showMobileMenu && (\n <button\n type=\"button\"\n aria-label={isDrawerOpen ? 'Close menu' : 'Open menu'}\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\n onClick={() => setIsDrawerOpen(!isDrawerOpen)}\n >\n {isDrawerOpen ? (\n <X className=\"h-5 w-5\" />\n ) : (\n <Menu className=\"h-5 w-5\" />\n )}\n </button>\n )}\n </div>\n </div>\n\n {/* Mobile right drawer */}\n {showMobileMenu && isDrawerOpen && (\n <div\n className=\"fixed inset-0 z-[30] duration-200 md:hidden\"\n onClick={() => setIsDrawerOpen(false)}\n />\n )}\n\n {showMobileMenu && (\n <div\n className={cn(\n 'fixed top-0 right-0 z-[31] h-[100svh] w-full max-w-[92%] border-l border-border bg-white shadow-xl sm:max-w-[420px] md:hidden',\n 'transition-transform duration-250 ease-out',\n isDrawerOpen ? 'translate-x-0' : 'translate-x-full',\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Mobile menu\"\n >\n <div className=\"flex h-full flex-col\">\n <div className=\"mt-1 flex items-center justify-between border-b px-4 py-3\">\n <div className=\"flex items-center gap-2\">\n <Image\n src={logoPath}\n alt=\"\"\n width={25}\n height={25}\n className=\"h-6 w-6 rounded object-contain\"\n />\n <span className=\"text-sm font-semibold\">{brand}</span>\n <span className=\"rounded border border-border bg-gray-50 px-1 py-0 text-xs font-medium text-gray-400 leading-none\">\n {siteName}\n </span>\n </div>\n <button\n type=\"button\"\n aria-label=\"Close menu\"\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-md transition-colors hover:bg-gray-100\"\n onClick={() => setIsDrawerOpen(false)}\n >\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n\n <div className=\"flex-1 overflow-y-auto p-4\">\n {userPrimary && (\n <div className=\"flex items-center gap-2 pb-2\">\n <UserRound className=\"h-5 w-5 text-gray-500\" />\n <span className=\"text-sm font-semibold text-gray-900\">\n {userPrimary}\n </span>\n </div>\n )}\n\n <Divider className=\"my-4\" />\n\n {actions && <div className=\"mb-2\">{actions}</div>}\n\n <nav className=\"flex flex-col gap-option-gap\">\n {nav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Link\n key={item.href}\n href={item.href}\n className=\"block w-full\"\n >\n <button className=\"flex min-h-option-row w-full items-center justify-between rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\n <div className=\"flex items-center gap-2\">\n <Icon className=\"h-4 w-4 text-muted-foreground\" />\n <span>{item.label}</span>\n {!!item.badge && (\n <span className=\"inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\n !\n </span>\n )}\n </div>\n <ChevronRight className=\"h-4 w-4 text-muted-foreground/60\" />\n </button>\n </Link>\n );\n })}\n </nav>\n </div>\n\n <div className=\"mt-auto flex flex-col gap-option-gap border-t border-border px-4 py-3\">\n {profileHref && (\n <Link href={profileHref} className=\"block w-full\">\n <button className=\"flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\n <UserRound className=\"h-4 w-4\" />\n Profile\n </button>\n </Link>\n )}\n {accountNav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Link\n key={item.href}\n href={item.href}\n className=\"block w-full\"\n >\n <button className=\"flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\n <Icon className=\"h-4 w-4\" />\n {item.label}\n </button>\n </Link>\n );\n })}\n <button\n onClick={() => logout.mutate()}\n disabled={logout.isPending}\n className=\"flex min-h-option-row w-full items-center justify-center gap-2 rounded-control-sm px-option-x py-2 font-medium text-destructive transition-colors hover:bg-destructive/10\"\n >\n <LogOut className=\"h-4 w-4\" />\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\n </button>\n </div>\n </div>\n </div>\n )}\n </header>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuFA;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEF;AACF;AAEM;AAmBJ;AACA;AACA;;;;AAKA;;AAGE;AACA;;AAEA;AACF;;AAGE;;;AAGE;;AAEH;AAED;AAGA;AA+DU;AACA;AAOQ;AACA;AAaV;AAYU;AACA;AACA;AA2CJ;AACA;AAQF;AAyGI;AACA;;AAkCF;AACA;;AA2BhB;;"}
1
+ {"version":3,"file":"app-header.js","sources":["../../src/components/app-header.tsx"],"sourcesContent":["'use client';\r\n\r\nimport Link from 'next/link';\r\nimport Image from 'next/image';\r\nimport { usePathname, useRouter } from 'next/navigation';\r\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\r\nimport {\r\n DropdownMenu,\r\n DropdownMenuTrigger,\r\n DropdownMenuContent,\r\n DropdownMenuItem,\r\n DropdownMenuSeparator,\r\n} from '@/components/dropdown-menu';\r\nimport { Button } from '@/components/button';\r\nimport { Divider } from '@/components/divider';\r\nimport { cn } from '@/utils';\r\nimport {\r\n LogOut,\r\n Menu,\r\n Search,\r\n X,\r\n UserRound,\r\n ChevronDown,\r\n ChevronRight,\r\n Handshake,\r\n Mail,\r\n History,\r\n FileText,\r\n Users,\r\n LayoutDashboard,\r\n FileSignature,\r\n GraduationCap,\r\n Building2,\r\n SearchCheck,\r\n} from 'lucide-react';\r\nimport { useState, useEffect } from 'react';\r\nimport type { ReactNode } from 'react';\r\nimport type { LucideIcon } from 'lucide-react';\r\n\r\nexport interface NavItem {\r\n href: string;\r\n label: string;\r\n badge?: number;\r\n icon?: LucideIcon;\r\n}\r\n\r\ninterface AppHeaderProps {\r\n /** Optional site name. */\r\n siteName?: string;\r\n homeHref: string;\r\n nav: NavItem[];\r\n /** Optional desktop links displayed next to the brand. */\r\n links?: NavItem[];\r\n userPrimary?: string;\r\n userSecondary?: string;\r\n logout: () => Promise<unknown>;\r\n postLogoutPath: string;\r\n profileHref?: string;\r\n userAvatarUrl?: string | null;\r\n accountNav?: NavItem[];\r\n /** Overrides the hardcoded \"Partners\" brand text. */\r\n brand?: string;\r\n /** Overrides the hardcoded \"/betterinternship-logo.png\" logo path. */\r\n logoPath?: string;\r\n /** Extra controls rendered next to the nav (desktop) and inside the drawer (mobile). */\r\n actions?: ReactNode;\r\n /**\r\n * Inline search control rendered in the header's center region on desktop\r\n * (`md` and up only). Purely a layout slot — the consumer owns all search\r\n * state and behavior. For mobile, pair with `onSearchClick`.\r\n */\r\n search?: ReactNode;\r\n /**\r\n * When set, renders a search icon button on mobile immediately left of the\r\n * hamburger. Typically opens a full-screen search overlay owned by the\r\n * consumer.\r\n */\r\n onSearchClick?: () => void;\r\n /**\r\n * Set to false to hide the mobile hamburger button and its side drawer\r\n * entirely — for consumers that provide their own mobile navigation (e.g.\r\n * a bottom tab bar) and don't want the nav/profile/logout items duplicated.\r\n * Defaults to true.\r\n */\r\n showMobileMenu?: boolean;\r\n}\r\n\r\nfunction labelIcon(label: string): LucideIcon {\r\n const map: Record<string, LucideIcon> = {\r\n Partners: Handshake,\r\n Invites: Mail,\r\n Invitations: Mail,\r\n Accounts: Users,\r\n 'Activity Log': History,\r\n 'MOA Templates': FileText,\r\n Universities: GraduationCap,\r\n Companies: Building2,\r\n 'Company Reviews': SearchCheck,\r\n 'Request MOA': FileSignature,\r\n Dashboard: LayoutDashboard,\r\n };\r\n return map[label] ?? Handshake;\r\n}\r\n\r\nexport function AppHeader({\r\n siteName,\r\n homeHref,\r\n nav,\r\n links = [],\r\n userPrimary,\r\n userSecondary,\r\n logout: logoutFn,\r\n postLogoutPath,\r\n profileHref,\r\n userAvatarUrl,\r\n accountNav = [],\r\n brand = 'Partners',\r\n logoPath = '/betterinternship-logo.png',\r\n actions,\r\n search,\r\n onSearchClick,\r\n showMobileMenu = true,\r\n}: AppHeaderProps) {\r\n const pathname = usePathname() ?? '';\r\n const router = useRouter();\r\n const queryClient = useQueryClient();\r\n const [isDrawerOpen, setIsDrawerOpen] = useState(false);\r\n\r\n useEffect(() => {\r\n setIsDrawerOpen(false);\r\n }, [pathname]);\r\n\r\n useEffect(() => {\r\n document.body.style.overflow = isDrawerOpen ? 'hidden' : '';\r\n return () => {\r\n document.body.style.overflow = '';\r\n };\r\n }, [isDrawerOpen]);\r\n\r\n const logout = useMutation({\r\n mutationFn: logoutFn,\r\n onSettled: () => {\r\n queryClient.clear();\r\n router.replace(postLogoutPath);\r\n },\r\n });\r\n\r\n const isActive = (href: string) =>\r\n pathname === href || pathname.startsWith(`${href}/`);\r\n\r\n return (\r\n <header className=\"sticky top-0 z-40 w-full bg-white\">\r\n <div className=\"flex min-h-[76px] w-full items-center gap-7 px-4 md:px-6 max-md:min-h-[72px] max-md:gap-3 max-md:py-3\">\r\n {/* Brand */}\r\n <Link\r\n href={homeHref}\r\n aria-label={brand}\r\n className=\"inline-flex shrink-0 items-center gap-3 text-lg font-[750] leading-[1.5] tracking-[-.0375rem] text-landing-navy focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue max-md:gap-1.5 max-md:text-base\"\r\n >\r\n <div className=\"flex items-center gap-3 max-md:gap-1.5\">\r\n <Image\r\n src={logoPath}\r\n alt=\"\"\r\n width={24}\r\n height={24}\r\n className=\"flex-none\"\r\n />\r\n {/* Wordmark hides below md — the logo carries the link, which keeps\r\n its name via the aria-label above. */}\r\n <div className=\"hidden items-center md:flex\">\r\n <span>\r\n {brand}\r\n </span>\r\n {siteName && (\r\n <>\r\n <span\r\n className=\"mx-2.5 h-4 w-px bg-gray-300\"\r\n aria-hidden=\"true\"\r\n />\r\n <span className=\"font-display font-normal text-gray-500\">\r\n {siteName}\r\n </span>\r\n </>\r\n )}\r\n </div>\r\n </div>\r\n </Link>\r\n\r\n {links.length > 0 && (\r\n <nav aria-label=\"Resources\" className=\"hidden shrink-0 items-center gap-4 text-sm font-[550] text-landing-nav md:flex xl:gap-7\">\r\n {links.map((item) => (\r\n <Link\r\n key={item.href}\r\n href={item.href}\r\n aria-current={isActive(item.href) ? 'page' : undefined}\r\n className=\"flex min-h-11 items-center rounded-sm text-landing-nav transition-colors duration-[180ms] hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue aria-[current=page]:text-landing-blue\"\r\n >\r\n {item.label}\r\n </Link>\r\n ))}\r\n </nav>\r\n )}\r\n\r\n {/* Desktop center: inline search slot. The empty div doubles as the\r\n spacer that keeps the right cluster right-aligned when no search\r\n is passed. */}\r\n <div className=\"hidden min-w-0 flex-1 md:flex md:items-center\">\r\n {search}\r\n </div>\r\n\r\n {/* Desktop right side: nav buttons + user */}\r\n <div className=\"ml-auto hidden shrink-0 items-center gap-1 md:flex\">\r\n {nav.map((item) => {\r\n const Icon = item.icon ?? labelIcon(item.label);\r\n return (\r\n <Button\r\n key={item.href}\r\n variant=\"ghost\"\r\n className={cn(\r\n 'relative min-h-12 min-w-0 flex-col items-center justify-center gap-1 rounded-[.33em] px-3 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\r\n isActive(item.href)\r\n ? 'text-landing-blue'\r\n : '',\r\n )}\r\n onClick={() => router.push(item.href)}\r\n >\r\n <Icon className=\"h-6! w-6!\" strokeWidth={1.7} />\r\n <span className=\"text-xs\">{item.label}</span>\r\n {!!item.badge && (\r\n <span className=\"absolute -top-0.5 right-5.5 inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\r\n {item.badge}\r\n </span>\r\n )}\r\n </Button>\r\n );\r\n })}\r\n\r\n {actions}\r\n\r\n {/* User dropdown */}\r\n <DropdownMenu>\r\n <DropdownMenuTrigger asChild>\r\n <Button\r\n variant=\"ghost\"\r\n className={cn(\r\n 'group min-h-12 w-20 flex-col items-center justify-center gap-1 rounded-[.33em] px-2 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\r\n (profileHref && isActive(profileHref)) ||\r\n accountNav.some((item) => isActive(item.href))\r\n ? 'text-landing-blue'\r\n : '',\r\n )}\r\n >\r\n <div className=\"flex h-6 w-6 items-center justify-center overflow-hidden rounded-full bg-gray-100\">\r\n {userAvatarUrl ? (\r\n <img\r\n src={userAvatarUrl}\r\n alt=\"\"\r\n className=\"h-full w-full object-contain\"\r\n />\r\n ) : (\r\n <UserRound className=\"h-5 w-5 text-gray-500\" />\r\n )}\r\n </div>\r\n <div className=\"flex items-center gap-0.5\">\r\n <span className=\"text-xs\">Account</span>\r\n <ChevronDown className=\"h-3! w-3! transition-transform group-data-[state=open]:rotate-180\" />\r\n </div>\r\n </Button>\r\n </DropdownMenuTrigger>\r\n <DropdownMenuContent align=\"end\" className=\"w-max min-w-44\">\r\n {userPrimary && (\r\n <div className=\"px-2 py-1.5\">\r\n <div className=\"text-center text-sm font-medium\">\r\n {userPrimary}\r\n </div>\r\n {userSecondary && (\r\n <div className=\"text-muted-foreground text-center text-xs\">\r\n {userSecondary}\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n <DropdownMenuSeparator />\r\n {profileHref && (\r\n <DropdownMenuItem asChild>\r\n <Link href={profileHref}>\r\n <UserRound className=\"h-4 w-4\" />\r\n Profile\r\n </Link>\r\n </DropdownMenuItem>\r\n )}\r\n {accountNav.map((item) => {\r\n const Icon = item.icon ?? labelIcon(item.label);\r\n return (\r\n <DropdownMenuItem key={item.href} asChild>\r\n <Link href={item.href}>\r\n <Icon className=\"h-4 w-4\" />\r\n {item.label}\r\n </Link>\r\n </DropdownMenuItem>\r\n );\r\n })}\r\n {(profileHref || accountNav.length > 0) && (\r\n <DropdownMenuSeparator />\r\n )}\r\n <DropdownMenuItem\r\n variant=\"destructive\"\r\n disabled={logout.isPending}\r\n onClick={() => logout.mutate()}\r\n >\r\n <LogOut className=\"h-4 w-4\" />\r\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\r\n </DropdownMenuItem>\r\n </DropdownMenuContent>\r\n </DropdownMenu>\r\n </div>\r\n\r\n {/* Mobile: search trigger + hamburger */}\r\n <div className=\"flex items-center gap-1 md:hidden\">\r\n {onSearchClick && (\r\n <button\r\n type=\"button\"\r\n aria-label=\"Search\"\r\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\r\n onClick={onSearchClick}\r\n >\r\n <Search className=\"h-5 w-5\" />\r\n </button>\r\n )}\r\n {showMobileMenu && (\r\n <button\r\n type=\"button\"\r\n aria-label={isDrawerOpen ? 'Close menu' : 'Open menu'}\r\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\r\n onClick={() => setIsDrawerOpen(!isDrawerOpen)}\r\n >\r\n {isDrawerOpen ? (\r\n <X className=\"h-5 w-5\" />\r\n ) : (\r\n <Menu className=\"h-5 w-5\" />\r\n )}\r\n </button>\r\n )}\r\n </div>\r\n </div>\r\n\r\n {/* Mobile right drawer */}\r\n {showMobileMenu && isDrawerOpen && (\r\n <div\r\n className=\"fixed inset-0 z-[30] duration-200 md:hidden\"\r\n onClick={() => setIsDrawerOpen(false)}\r\n />\r\n )}\r\n\r\n {showMobileMenu && (\r\n <div\r\n className={cn(\r\n 'fixed top-0 right-0 z-[31] h-[100svh] w-full max-w-[92%] border-l border-border bg-white shadow-xl sm:max-w-[420px] md:hidden',\r\n 'transition-transform duration-250 ease-out',\r\n isDrawerOpen ? 'translate-x-0' : 'translate-x-full',\r\n )}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-label=\"Mobile menu\"\r\n >\r\n <div className=\"flex h-full flex-col\">\r\n <div className=\"mt-1 flex items-center justify-between border-b px-4 py-3\">\r\n <div className=\"flex items-center gap-2\">\r\n <Image\r\n src={logoPath}\r\n alt=\"\"\r\n width={25}\r\n height={25}\r\n className=\"h-6 w-6 rounded object-contain\"\r\n />\r\n <span className=\"text-sm font-semibold\">{brand}</span>\r\n <span className=\"rounded border border-border bg-gray-50 px-1 py-0 text-xs font-medium text-gray-400 leading-none\">\r\n {siteName}\r\n </span>\r\n </div>\r\n <button\r\n type=\"button\"\r\n aria-label=\"Close menu\"\r\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-md transition-colors hover:bg-gray-100\"\r\n onClick={() => setIsDrawerOpen(false)}\r\n >\r\n <X className=\"h-5 w-5\" />\r\n </button>\r\n </div>\r\n\r\n <div className=\"flex-1 overflow-y-auto p-4\">\r\n {userPrimary && (\r\n <div className=\"flex items-center gap-2 pb-2\">\r\n <UserRound className=\"h-5 w-5 text-gray-500\" />\r\n <span className=\"text-sm font-semibold text-gray-900\">\r\n {userPrimary}\r\n </span>\r\n </div>\r\n )}\r\n\r\n <Divider className=\"my-4\" />\r\n\r\n {actions && <div className=\"mb-2\">{actions}</div>}\r\n\r\n <nav className=\"flex flex-col gap-option-gap\">\r\n {nav.map((item) => {\r\n const Icon = item.icon ?? labelIcon(item.label);\r\n return (\r\n <Link\r\n key={item.href}\r\n href={item.href}\r\n className=\"block w-full\"\r\n >\r\n <button className=\"flex min-h-option-row w-full items-center justify-between rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\r\n <div className=\"flex items-center gap-2\">\r\n <Icon className=\"h-4 w-4 text-muted-foreground\" />\r\n <span>{item.label}</span>\r\n {!!item.badge && (\r\n <span className=\"inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\r\n !\r\n </span>\r\n )}\r\n </div>\r\n <ChevronRight className=\"h-4 w-4 text-muted-foreground/60\" />\r\n </button>\r\n </Link>\r\n );\r\n })}\r\n </nav>\r\n </div>\r\n\r\n <div className=\"mt-auto flex flex-col gap-option-gap border-t border-border px-4 py-3\">\r\n {profileHref && (\r\n <Link href={profileHref} className=\"block w-full\">\r\n <button className=\"flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\r\n <UserRound className=\"h-4 w-4\" />\r\n Profile\r\n </button>\r\n </Link>\r\n )}\r\n {accountNav.map((item) => {\r\n const Icon = item.icon ?? labelIcon(item.label);\r\n return (\r\n <Link\r\n key={item.href}\r\n href={item.href}\r\n className=\"block w-full\"\r\n >\r\n <button className=\"flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\r\n <Icon className=\"h-4 w-4\" />\r\n {item.label}\r\n </button>\r\n </Link>\r\n );\r\n })}\r\n <button\r\n onClick={() => logout.mutate()}\r\n disabled={logout.isPending}\r\n className=\"flex min-h-option-row w-full items-center justify-center gap-2 rounded-control-sm px-option-x py-2 font-medium text-destructive transition-colors hover:bg-destructive/10\"\r\n >\r\n <LogOut className=\"h-4 w-4\" />\r\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n </header>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuFA;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEF;AACF;AAEM;AAmBJ;AACA;AACA;;;;AAKA;;AAGE;AACA;;AAEA;AACF;;AAGE;;;AAGE;;AAEH;AAED;AAGA;AA+DU;AACA;AAOQ;AACA;AAaV;AAYU;AACA;AACA;AA2CJ;AACA;AAQF;AAyGI;AACA;;AAkCF;AACA;;AA2BhB;;"}
@@ -7,12 +7,11 @@ export interface IAutocompleteOption<ID extends number | string> {
7
7
  }
8
8
  type MobileDropdownMode = "sheet" | "inline";
9
9
  type InputIcons = boolean | "search" | "dropdown";
10
+ /** Unlabelled: put it in a `FormField` for a label. */
10
11
  type AutocompleteCommonProps<ID extends number | string> = {
11
- required?: boolean;
12
12
  options: IAutocompleteOption<ID>[];
13
13
  placeholder?: string;
14
14
  className?: string;
15
- label?: React.ReactNode;
16
15
  props?: any[];
17
16
  /** Allow a user to add their own text. Custom values are strings. */
18
17
  allowCustomValue?: boolean;
@@ -5,7 +5,7 @@ import { Input } from './input.js';
5
5
  import { useDetectClickOutside } from '../hooks/use-detect-click-outside.js';
6
6
  import { cn } from '../utils.js';
7
7
  import { X, ChevronDown, PlusCircleIcon, Search } from 'lucide-react';
8
- import { Label } from './label.js';
8
+ import { useFormFieldControl, FormFieldReset, useFormField } from './form-field.js';
9
9
  import { Button } from './button.js';
10
10
  import { CheckboxVisual } from './checkbox.js';
11
11
  import { Sheet, SheetContent, SheetTitle } from './sheet.js';
@@ -16,7 +16,7 @@ import { useFieldFocus, fieldFocusOutlineClassName, fieldInteractionClassName, F
16
16
  /* -------------------------------------------------------
17
17
  * Base component (array-based). Single uses length 0..1.
18
18
  * -----------------------------------------------------*/
19
- function AutocompleteBase({ required, options, value = [], setter, placeholder, className, multiple = true, label, labelAddon, allowCustomValue = false, preserveOptionOrder = false, emptyText = "No matching options", mobileDropdownMode = "sheet", inputIcons = false, ...props }) {
19
+ function AutocompleteBase({ options, value = [], setter, placeholder, className, multiple = true, allowCustomValue = false, preserveOptionOrder = false, emptyText = "No matching options", mobileDropdownMode = "sheet", inputIcons = false, ...props }) {
20
20
  const [query, setQuery] = useState("");
21
21
  const [isOpen, setIsOpen] = useState(false);
22
22
  const [dropdownMaxHeight, setDropdownMaxHeight] = useState();
@@ -37,7 +37,12 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
37
37
  const lastSelectionRef = useRef(0);
38
38
  // Show the Button focus outline only for keyboard focus, not clicks.
39
39
  const { keyboardFocus, focusProps: fieldFocusProps } = useFieldFocus();
40
- const inputId = useId();
40
+ // Inside a FormField the input takes the field's id and links; its label names the sheet.
41
+ const field = useFormFieldControl({});
42
+ const { id: fieldId, ...fieldAria } = field;
43
+ const generatedId = useId();
44
+ const inputId = fieldId ?? generatedId;
45
+ const fieldLabel = useFormFieldLabel();
41
46
  const flatOptions = useMemo(() => options.flatMap((option) => option.children?.length ? option.children : [option]), [options]);
42
47
  const findExactOption = (value) => {
43
48
  const normalizedValue = value.trim().toLowerCase();
@@ -213,9 +218,11 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
213
218
  return (jsxs("div", { className: cn("relative w-full overflow-visible", className), ref: (node) => {
214
219
  rootRef.current = node;
215
220
  clickOutsideRef.current = node;
216
- }, children: [label ? (jsx(Label, { label: label, required: required, labelAddon: labelAddon })) : null, multiple ? (
221
+ }, children: [multiple ? (
217
222
  // ---------- MULTI: chips inline inside the box ----------
218
- jsxs("div", { className: cn("relative flex min-h-form-control w-full flex-wrap items-center gap-1 rounded-control-lg border border-input bg-background px-[0.75em] pr-10 hover:border-input-hover", fieldClassName), ...fieldFocusProps, onClick: () => {
223
+ jsxs("div", { className: cn(
224
+ // text-base keeps the 0.75em padding at 12px, like the single input.
225
+ "relative flex min-h-form-control w-full flex-wrap items-center gap-1 rounded-control-lg border border-input bg-background px-[0.75em] pr-10 text-base text-foreground hover:border-input-hover", "has-[input[aria-invalid=true]]:border-destructive has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50", fieldClassName), ...fieldFocusProps, onClick: () => {
219
226
  setIsOpen(true);
220
227
  if (!suppressMobileKeyboard) {
221
228
  inputRef.current?.focus();
@@ -223,7 +230,7 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
223
230
  }, children: [(value ?? []).map((id) => {
224
231
  const label = flatOptions.find((o) => o.id === id)?.name ?? String(id);
225
232
  return (jsxs("span", { className: "my-0.5 flex items-center gap-1 rounded-control-sm border border-input bg-muted px-2 text-xs", children: [label, jsx(Button, { type: "button", variant: "ghost", size: "xs", className: "ml-1 h-5 min-h-0 w-5 p-0 hover:bg-muted", onClick: (event) => { event.stopPropagation(); removeAt(id); }, "aria-label": `Remove ${label}`, children: jsx(X, { className: "h-3.5 w-3.5" }) })] }, String(id)));
226
- }), jsx("input", { id: inputId, ref: inputRef, value: query, onChange: (e) => {
233
+ }), jsx("input", { id: inputId, ...fieldAria, ref: inputRef, value: query, onChange: (e) => {
227
234
  setQuery(e.target.value);
228
235
  setIsOpen(true);
229
236
  }, onBlur: () => {
@@ -243,9 +250,9 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
243
250
  }
244
251
  }, 150);
245
252
  }, onKeyDown: onMultiKeyDown, onFocus: () => { if (!useMobileSheet)
246
- setIsOpen(true); }, readOnly: suppressMobileKeyboard, placeholder: (value?.length ?? 0) === 0 ? placeholder : "", className: cn("h-[calc(var(--spacing-form-control)-2px)] min-w-[8ch] flex-1 border-none bg-transparent p-0 text-base outline-none focus:ring-0", "placeholder:text-muted-foreground/40"), ...props }), jsx(ChevronDown, { className: cn("pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none", isOpen && "rotate-180"), "aria-hidden": "true" })] })) : (
253
+ setIsOpen(true); }, readOnly: suppressMobileKeyboard, placeholder: (value?.length ?? 0) === 0 ? placeholder : "", className: cn("h-[calc(var(--spacing-form-control)-2px)] min-w-[8ch] flex-1 border-none bg-transparent p-0 text-base outline-none focus:ring-0 disabled:cursor-not-allowed", "placeholder:text-muted-foreground/40"), ...props }), jsx(ChevronDown, { className: cn("pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none", isOpen && "rotate-180"), "aria-hidden": "true" })] })) : (
247
254
  // ---------- SINGLE: regular input ----------
248
- decorateSingleInput(jsx(Input, { id: inputId, value: singleDisplay || query, className: cn("border-input", inputIcons === "search" || inputIcons === "dropdown" ? "pr-10" : inputIcons && "px-10"), placeholder: placeholder, readOnly: suppressMobileKeyboard, onChange: (e) => {
255
+ decorateSingleInput(jsx(Input, { id: inputId, ...fieldAria, value: singleDisplay || query, className: cn("border-input", inputIcons === "search" || inputIcons === "dropdown" ? "pr-10" : inputIcons && "px-10"), placeholder: placeholder, readOnly: suppressMobileKeyboard, onChange: (e) => {
249
256
  const nextQuery = e.target.value;
250
257
  if ((value?.length ?? 0) > 0) {
251
258
  setter([]);
@@ -288,7 +295,7 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
288
295
  } }))), isOpen && (jsx(Sheet, { open: useMobileSheet && isOpen, onOpenChange: next => { if (!next) {
289
296
  setQuery('');
290
297
  setIsOpen(false);
291
- } }, children: jsxs(OptionsSurface, { ...sheetProps, ref: useMobileSheet ? sheetRef : undefined, role: useMobileSheet ? "dialog" : undefined, "aria-modal": useMobileSheet ? true : undefined, "aria-label": useMobileSheet ? (typeof label === "string" ? label : "Choose options") : undefined, className: cn("bg-background text-sm shadow-card border border-border", useMobileSheet
298
+ } }, children: jsx(OptionsSurface, { ...sheetProps, ref: useMobileSheet ? sheetRef : undefined, role: useMobileSheet ? "dialog" : undefined, "aria-modal": useMobileSheet ? true : undefined, "aria-label": useMobileSheet ? (fieldLabel ?? "Choose options") : undefined, className: cn("bg-background text-sm shadow-card border border-border", useMobileSheet
292
299
  ? "fixed left-0 right-0 z-(--z-popover) flex flex-col gap-0 overflow-hidden rounded-t-control-lg border-b-0 p-0"
293
300
  : "absolute left-0 right-0 z-50 mt-1 max-h-[400px] overflow-y-auto overscroll-contain rounded-control-lg"), style: useMobileSheet
294
301
  ? {
@@ -305,72 +312,76 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
305
312
  marginBottom: 4,
306
313
  }),
307
314
  }
308
- : undefined, children: [useMobileSheet && (jsxs("div", { className: "shrink-0 px-4 pb-3 pt-4", children: [jsxs("div", { className: "mb-3 flex items-center justify-between gap-4", children: [jsx(SheetTitle, { className: "text-base font-semibold text-foreground", children: label || "Choose options" }), jsx("button", { ref: sheetCloseRef, type: "button", "aria-label": "Close options", className: "-mr-3 flex h-11 w-11 shrink-0 items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted", onClick: () => { setQuery(""); setIsOpen(false); }, children: jsx(X, { className: "h-5 w-5", "aria-hidden": "true" }) })] }), jsx(Input, { ref: sheetInputRef, "aria-label": typeof label === "string" ? `Search ${label}` : "Search options", value: query, placeholder: placeholder ?? "Search", className: "h-10 min-h-10 max-h-none text-base", onChange: (e) => {
309
- setQuery(e.target.value);
310
- setIsOpen(true);
311
- if ((value?.length ?? 0) > 0 && !multiple) {
312
- setter([]);
313
- }
314
- }, onKeyDown: (e) => {
315
- if (multiple) {
316
- onMultiKeyDown(e);
317
- return;
318
- }
319
- if (e.key === "Enter" && resolveQuerySelection(query)) {
320
- setIsOpen(false);
321
- e.preventDefault();
322
- }
323
- if (e.key === "Escape") {
324
- setIsOpen(false);
325
- }
326
- } })] })), jsxs("ul", { className: cn("flex flex-col gap-option-gap p-option-inset", useMobileSheet && "min-h-0 flex-1 overflow-y-auto overscroll-contain"), children: [allowCustomValue && (jsx("li", { className: "pointer-events-none px-option-x pb-1 pt-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Suggestions" })), filtered.length ? (filtered.map((option, index) => {
327
- const active = selectedSet.has(option.id);
328
- const group = options.find((item) => item.children?.some((child) => child.id === option.id));
329
- const firstInGroup = group && !filtered.slice(0, index).some((item) => group.children?.some((child) => child.id === item.id));
330
- return (jsxs(Fragment, { children: [firstInGroup && group && (jsx("li", { children: multiple ? (jsxs("button", { type: "button", "aria-pressed": group.children.every((child) => selectedSet.has(child.id)), className: "flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm font-medium text-foreground transition-colors hover:bg-muted max-md:min-h-11", onClick: () => {
331
- const ids = group.children.map((child) => child.id);
332
- const next = new Set(value ?? []);
333
- const allSelected = ids.every((id) => next.has(id));
334
- ids.forEach((id) => allSelected ? next.delete(id) : next.add(id));
335
- setter(Array.from(next));
336
- }, children: [jsx(CheckboxVisual, { checked: group.children.every((child) => selectedSet.has(child.id)) ? true : group.children.some((child) => selectedSet.has(child.id)) ? 'indeterminate' : false }), group.name] })) : jsx("div", { className: "px-option-x py-2 text-sm font-medium text-foreground", children: group.name }) })), jsx("li", { children: jsxs("button", { type: "button", "aria-pressed": multiple ? active : undefined, onClick: () => {
337
- toggle(option.id);
338
- if (multiple) {
339
- // keep open for rapid multi-pick
340
- setQuery("");
341
- if (!useMobileSheet) {
342
- inputRef.current?.focus();
343
- }
344
- }
345
- else {
346
- setQuery("");
347
- setIsOpen(false);
348
- }
349
- }, className: cn("flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-muted", useMobileSheet && "min-h-12", group && "pl-8", active && "bg-primary-tint"), children: [multiple ? (jsx(CheckboxVisual, { checked: active })) : null, option.name] }) })] }, String(option.id)));
350
- })) : (!allowCustomValue || !query.trim() ? (jsx("li", { className: "px-option-x py-2 text-sm text-muted-foreground", children: emptyText })) : null), allowCustomValue && query.trim() && !findExactOption(query) && (jsx("li", { children: jsxs("button", { type: "button", className: "flex min-h-11 w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 text-left text-sm text-primary transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary", onMouseDown: (event) => event.preventDefault(), onClick: () => {
351
- const text = query.trim();
315
+ : undefined, children: jsxs(FormFieldReset, { children: [useMobileSheet && (jsxs("div", { className: "shrink-0 px-4 pb-3 pt-4", children: [jsxs("div", { className: "mb-3 flex items-center justify-between gap-4", children: [jsx(SheetTitle, { className: "text-base font-semibold text-foreground", children: fieldLabel ?? "Choose options" }), jsx("button", { ref: sheetCloseRef, type: "button", "aria-label": "Close options", className: "-mr-3 flex h-11 w-11 shrink-0 items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted", onClick: () => { setQuery(""); setIsOpen(false); }, children: jsx(X, { className: "h-5 w-5", "aria-hidden": "true" }) })] }), jsx(Input, { ref: sheetInputRef, "aria-label": fieldLabel ? `Search ${fieldLabel}` : "Search options", value: query, placeholder: placeholder ?? "Search", className: "h-10 min-h-10 max-h-none text-base", onChange: (e) => {
316
+ setQuery(e.target.value);
317
+ setIsOpen(true);
318
+ if ((value?.length ?? 0) > 0 && !multiple) {
319
+ setter([]);
320
+ }
321
+ }, onKeyDown: (e) => {
352
322
  if (multiple) {
353
- setter(Array.from(new Set([...(value ?? []), text])));
354
- setQuery("");
323
+ onMultiKeyDown(e);
324
+ return;
355
325
  }
356
- else {
357
- resolveQuerySelection(text);
326
+ if (e.key === "Enter" && resolveQuerySelection(query)) {
358
327
  setIsOpen(false);
328
+ e.preventDefault();
359
329
  }
360
- }, children: [jsx(PlusCircleIcon, { className: "h-4 w-4", "aria-hidden": "true" }), "Add \u201C", query.trim(), "\u201D"] }) }))] }), useMobileSheet && multiple && (jsx("div", { className: "shrink-0 border-t border-border bg-background px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", children: jsx(Button, { type: "button", variant: "outline", className: "min-h-11 w-full", onClick: () => {
361
- setQuery("");
362
- setIsOpen(false);
363
- }, children: "Done" }) }))] }) }))] }));
330
+ if (e.key === "Escape") {
331
+ setIsOpen(false);
332
+ }
333
+ } })] })), jsxs("ul", { className: cn("flex flex-col gap-option-gap p-option-inset", useMobileSheet && "min-h-0 flex-1 overflow-y-auto overscroll-contain"), children: [allowCustomValue && (jsx("li", { className: "pointer-events-none px-option-x pb-1 pt-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Suggestions" })), filtered.length ? (filtered.map((option, index) => {
334
+ const active = selectedSet.has(option.id);
335
+ const group = options.find((item) => item.children?.some((child) => child.id === option.id));
336
+ const firstInGroup = group && !filtered.slice(0, index).some((item) => group.children?.some((child) => child.id === item.id));
337
+ return (jsxs(Fragment, { children: [firstInGroup && group && (jsx("li", { children: multiple ? (jsxs("button", { type: "button", "aria-pressed": group.children.every((child) => selectedSet.has(child.id)), className: "flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm font-medium text-foreground transition-colors hover:bg-muted max-md:min-h-11", onClick: () => {
338
+ const ids = group.children.map((child) => child.id);
339
+ const next = new Set(value ?? []);
340
+ const allSelected = ids.every((id) => next.has(id));
341
+ ids.forEach((id) => allSelected ? next.delete(id) : next.add(id));
342
+ setter(Array.from(next));
343
+ }, children: [jsx(CheckboxVisual, { checked: group.children.every((child) => selectedSet.has(child.id)) ? true : group.children.some((child) => selectedSet.has(child.id)) ? 'indeterminate' : false }), group.name] })) : jsx("div", { className: "px-option-x py-2 text-sm font-medium text-foreground", children: group.name }) })), jsx("li", { children: jsxs("button", { type: "button", "aria-pressed": multiple ? active : undefined, onClick: () => {
344
+ toggle(option.id);
345
+ if (multiple) {
346
+ // keep open for rapid multi-pick
347
+ setQuery("");
348
+ if (!useMobileSheet) {
349
+ inputRef.current?.focus();
350
+ }
351
+ }
352
+ else {
353
+ setQuery("");
354
+ setIsOpen(false);
355
+ }
356
+ }, className: cn("flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-muted", useMobileSheet && "min-h-12", group && "pl-8", active && "bg-primary-tint"), children: [multiple ? (jsx(CheckboxVisual, { checked: active })) : null, option.name] }) })] }, String(option.id)));
357
+ })) : (!allowCustomValue || !query.trim() ? (jsx("li", { className: "px-option-x py-2 text-sm text-muted-foreground", children: emptyText })) : null), allowCustomValue && query.trim() && !findExactOption(query) && (jsx("li", { children: jsxs("button", { type: "button", className: "flex min-h-11 w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 text-left text-sm text-primary transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary", onMouseDown: (event) => event.preventDefault(), onClick: () => {
358
+ const text = query.trim();
359
+ if (multiple) {
360
+ setter(Array.from(new Set([...(value ?? []), text])));
361
+ setQuery("");
362
+ }
363
+ else {
364
+ resolveQuerySelection(text);
365
+ setIsOpen(false);
366
+ }
367
+ }, children: [jsx(PlusCircleIcon, { className: "h-4 w-4", "aria-hidden": "true" }), "Add \u201C", query.trim(), "\u201D"] }) }))] }), useMobileSheet && multiple && (jsx("div", { className: "shrink-0 border-t border-border bg-background px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", children: jsx(Button, { type: "button", variant: "outline", className: "min-h-11 w-full", onClick: () => {
368
+ setQuery("");
369
+ setIsOpen(false);
370
+ }, children: "Done" }) }))] }) }) }))] }));
364
371
  }
365
372
  const Autocomplete = (config) => {
366
- const { required, options, placeholder, className, label, props, allowCustomValue = false, preserveOptionOrder = false, emptyText, mobileDropdownMode, inputIcons } = config;
367
- return (jsx(AutocompleteBase, { required: required, options: options, multiple: config.multiple === true, value: config.multiple === true ? config.value ?? [] : config.value != null ? [config.value] : [], setter: (arr) => {
373
+ const { options, placeholder, className, props, allowCustomValue = false, preserveOptionOrder = false, emptyText, mobileDropdownMode, inputIcons } = config;
374
+ return (jsx(AutocompleteBase, { options: options, multiple: config.multiple === true, value: config.multiple === true ? config.value ?? [] : config.value != null ? [config.value] : [], setter: (arr) => {
368
375
  if (config.multiple === true)
369
376
  config.setter(arr);
370
377
  else
371
378
  config.setter(arr[0] ?? null);
372
- }, placeholder: placeholder, className: className, label: label, allowCustomValue: allowCustomValue, preserveOptionOrder: preserveOptionOrder, emptyText: emptyText, mobileDropdownMode: mobileDropdownMode, inputIcons: inputIcons, ...props }));
379
+ }, placeholder: placeholder, className: className, allowCustomValue: allowCustomValue, preserveOptionOrder: preserveOptionOrder, emptyText: emptyText, mobileDropdownMode: mobileDropdownMode, inputIcons: inputIcons, ...props }));
373
380
  };
381
+ /** The surrounding FormField's label, when it is plain text. */
382
+ function useFormFieldLabel() {
383
+ return useFormField()?.labelText;
384
+ }
374
385
 
375
386
  export { Autocomplete };
376
387
  //# sourceMappingURL=autocomplete.js.map