@slurp-ui/react 1.1.1 → 1.3.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 (207) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/AvatarGroup/AvatarGroup.d.ts +26 -0
  3. package/dist/AvatarGroup/AvatarGroup.js +46 -0
  4. package/dist/AvatarGroup/AvatarGroup.js.map +1 -0
  5. package/dist/AvatarGroup/index.d.ts +3 -0
  6. package/dist/AvatarGroup/index.js +2 -0
  7. package/dist/Bloom/Bloom.js +3 -2
  8. package/dist/Bloom/Bloom.js.map +1 -1
  9. package/dist/Calendar/Calendar.d.ts +42 -0
  10. package/dist/Calendar/Calendar.js +178 -0
  11. package/dist/Calendar/Calendar.js.map +1 -0
  12. package/dist/Calendar/dates.d.ts +3 -0
  13. package/dist/Calendar/dates.js +46 -0
  14. package/dist/Calendar/dates.js.map +1 -0
  15. package/dist/Calendar/index.d.ts +3 -0
  16. package/dist/Calendar/index.js +2 -0
  17. package/dist/Carousel/Carousel.js +2 -0
  18. package/dist/Carousel/Carousel.js.map +1 -1
  19. package/dist/Choice/Choice.js +2 -0
  20. package/dist/Choice/Choice.js.map +1 -1
  21. package/dist/Code/Code.d.ts +38 -0
  22. package/dist/Code/Code.js +82 -0
  23. package/dist/Code/Code.js.map +1 -0
  24. package/dist/Code/index.d.ts +3 -0
  25. package/dist/Code/index.js +2 -0
  26. package/dist/Compare/Compare.d.ts +23 -0
  27. package/dist/Compare/Compare.js +61 -0
  28. package/dist/Compare/Compare.js.map +1 -0
  29. package/dist/Compare/index.d.ts +3 -0
  30. package/dist/Compare/index.js +2 -0
  31. package/dist/Consent/Consent.d.ts +30 -0
  32. package/dist/Consent/Consent.js +70 -0
  33. package/dist/Consent/Consent.js.map +1 -0
  34. package/dist/Consent/index.d.ts +3 -0
  35. package/dist/Consent/index.js +2 -0
  36. package/dist/Contents/Contents.d.ts +35 -0
  37. package/dist/Contents/Contents.js +63 -0
  38. package/dist/Contents/Contents.js.map +1 -0
  39. package/dist/Contents/index.d.ts +3 -0
  40. package/dist/Contents/index.js +2 -0
  41. package/dist/DateField/DateField.d.ts +29 -0
  42. package/dist/DateField/DateField.js +118 -0
  43. package/dist/DateField/DateField.js.map +1 -0
  44. package/dist/DateField/index.d.ts +3 -0
  45. package/dist/DateField/index.js +2 -0
  46. package/dist/Dialog/Dialog.d.ts +2 -0
  47. package/dist/Dialog/Dialog.js +89 -30
  48. package/dist/Dialog/Dialog.js.map +1 -1
  49. package/dist/Dock/Dock.d.ts +5 -0
  50. package/dist/Dock/Dock.js +13 -2
  51. package/dist/Dock/Dock.js.map +1 -1
  52. package/dist/ErrorSummary/ErrorSummary.d.ts +26 -0
  53. package/dist/ErrorSummary/ErrorSummary.js +68 -0
  54. package/dist/ErrorSummary/ErrorSummary.js.map +1 -0
  55. package/dist/ErrorSummary/index.d.ts +3 -0
  56. package/dist/ErrorSummary/index.js +2 -0
  57. package/dist/FileDrop/FileDrop.d.ts +34 -0
  58. package/dist/FileDrop/FileDrop.js +145 -0
  59. package/dist/FileDrop/FileDrop.js.map +1 -0
  60. package/dist/FileDrop/index.d.ts +3 -0
  61. package/dist/FileDrop/index.js +2 -0
  62. package/dist/Filters/Filters.js +2 -0
  63. package/dist/Filters/Filters.js.map +1 -1
  64. package/dist/Footer/Footer.d.ts +37 -0
  65. package/dist/Footer/Footer.js +63 -0
  66. package/dist/Footer/Footer.js.map +1 -0
  67. package/dist/Footer/index.d.ts +3 -0
  68. package/dist/Footer/index.js +2 -0
  69. package/dist/Hairline/Hairline.d.ts +16 -0
  70. package/dist/Hairline/Hairline.js +23 -0
  71. package/dist/Hairline/Hairline.js.map +1 -0
  72. package/dist/Hairline/index.d.ts +3 -0
  73. package/dist/Hairline/index.js +2 -0
  74. package/dist/Hint/Hint.js +20 -1
  75. package/dist/Hint/Hint.js.map +1 -1
  76. package/dist/Kbd/Kbd.d.ts +7 -0
  77. package/dist/Kbd/Kbd.js +20 -0
  78. package/dist/Kbd/Kbd.js.map +1 -0
  79. package/dist/Kbd/index.d.ts +3 -0
  80. package/dist/Kbd/index.js +2 -0
  81. package/dist/Lightbox/Lightbox.d.ts +30 -0
  82. package/dist/Lightbox/Lightbox.js +74 -0
  83. package/dist/Lightbox/Lightbox.js.map +1 -0
  84. package/dist/Lightbox/index.d.ts +3 -0
  85. package/dist/Lightbox/index.js +2 -0
  86. package/dist/ListRow/ListRow.d.ts +5 -1
  87. package/dist/ListRow/ListRow.js +5 -1
  88. package/dist/ListRow/ListRow.js.map +1 -1
  89. package/dist/Media/Media.d.ts +28 -0
  90. package/dist/Media/Media.js +65 -0
  91. package/dist/Media/Media.js.map +1 -0
  92. package/dist/Media/index.d.ts +3 -0
  93. package/dist/Media/index.js +2 -0
  94. package/dist/Menu/Menu.d.ts +13 -0
  95. package/dist/Menu/Menu.js +43 -11
  96. package/dist/Menu/Menu.js.map +1 -1
  97. package/dist/Menu/index.d.ts +2 -2
  98. package/dist/Menu/index.js +1 -1
  99. package/dist/MultiSuggest/MultiSuggest.d.ts +39 -0
  100. package/dist/MultiSuggest/MultiSuggest.js +267 -0
  101. package/dist/MultiSuggest/MultiSuggest.js.map +1 -0
  102. package/dist/MultiSuggest/index.d.ts +3 -0
  103. package/dist/MultiSuggest/index.js +2 -0
  104. package/dist/Notice/Notice.js +2 -0
  105. package/dist/Notice/Notice.js.map +1 -1
  106. package/dist/NumberField/NumberField.d.ts +32 -0
  107. package/dist/NumberField/NumberField.js +126 -0
  108. package/dist/NumberField/NumberField.js.map +1 -0
  109. package/dist/NumberField/index.d.ts +3 -0
  110. package/dist/NumberField/index.js +2 -0
  111. package/dist/PageNav/PageNav.d.ts +25 -0
  112. package/dist/PageNav/PageNav.js +57 -0
  113. package/dist/PageNav/PageNav.js.map +1 -0
  114. package/dist/PageNav/index.d.ts +3 -0
  115. package/dist/PageNav/index.js +2 -0
  116. package/dist/Pages/Pages.js +2 -0
  117. package/dist/Pages/Pages.js.map +1 -1
  118. package/dist/PinField/PinField.d.ts +26 -0
  119. package/dist/PinField/PinField.js +73 -0
  120. package/dist/PinField/PinField.js.map +1 -0
  121. package/dist/PinField/index.d.ts +3 -0
  122. package/dist/PinField/index.js +2 -0
  123. package/dist/Prose/Prose.d.ts +15 -0
  124. package/dist/Prose/Prose.js +25 -0
  125. package/dist/Prose/Prose.js.map +1 -0
  126. package/dist/Prose/index.d.ts +3 -0
  127. package/dist/Prose/index.js +2 -0
  128. package/dist/Quote/Quote.d.ts +19 -0
  129. package/dist/Quote/Quote.js +52 -0
  130. package/dist/Quote/Quote.js.map +1 -0
  131. package/dist/Quote/index.d.ts +3 -0
  132. package/dist/Quote/index.js +2 -0
  133. package/dist/Rail/Rail.d.ts +37 -0
  134. package/dist/Rail/Rail.js +61 -0
  135. package/dist/Rail/Rail.js.map +1 -0
  136. package/dist/Rail/index.d.ts +3 -0
  137. package/dist/Rail/index.js +2 -0
  138. package/dist/Rating/Rating.js +2 -0
  139. package/dist/Rating/Rating.js.map +1 -1
  140. package/dist/Search/Search.js +2 -0
  141. package/dist/Search/Search.js.map +1 -1
  142. package/dist/SecretField/SecretField.d.ts +17 -0
  143. package/dist/SecretField/SecretField.js +59 -0
  144. package/dist/SecretField/SecretField.js.map +1 -0
  145. package/dist/SecretField/index.d.ts +3 -0
  146. package/dist/SecretField/index.js +2 -0
  147. package/dist/Settings/Settings.js +2 -0
  148. package/dist/Settings/Settings.js.map +1 -1
  149. package/dist/Sheet/Sheet.d.ts +8 -3
  150. package/dist/Sheet/Sheet.js +1 -1
  151. package/dist/Sheet/Sheet.js.map +1 -1
  152. package/dist/Sheet/index.d.ts +2 -2
  153. package/dist/SkipLink/SkipLink.d.ts +22 -0
  154. package/dist/SkipLink/SkipLink.js +32 -0
  155. package/dist/SkipLink/SkipLink.js.map +1 -0
  156. package/dist/SkipLink/index.d.ts +3 -0
  157. package/dist/SkipLink/index.js +2 -0
  158. package/dist/SlurpProvider/SlurpProvider.d.ts +7 -1
  159. package/dist/SlurpProvider/SlurpProvider.js +14 -6
  160. package/dist/SlurpProvider/SlurpProvider.js.map +1 -1
  161. package/dist/Steps/Steps.js +2 -0
  162. package/dist/Steps/Steps.js.map +1 -1
  163. package/dist/Suggest/Suggest.js +2 -0
  164. package/dist/Suggest/Suggest.js.map +1 -1
  165. package/dist/Table/Table.d.ts +12 -0
  166. package/dist/Table/Table.js +56 -10
  167. package/dist/Table/Table.js.map +1 -1
  168. package/dist/Tag/Tag.d.ts +14 -0
  169. package/dist/Tag/Tag.js +26 -0
  170. package/dist/Tag/Tag.js.map +1 -0
  171. package/dist/Tag/index.d.ts +3 -0
  172. package/dist/Tag/index.js +2 -0
  173. package/dist/Timeline/Timeline.d.ts +23 -0
  174. package/dist/Timeline/Timeline.js +49 -0
  175. package/dist/Timeline/Timeline.js.map +1 -0
  176. package/dist/Timeline/index.d.ts +3 -0
  177. package/dist/Timeline/index.js +2 -0
  178. package/dist/Toast/Toast.js +31 -7
  179. package/dist/Toast/Toast.js.map +1 -1
  180. package/dist/Tree/Tree.d.ts +24 -0
  181. package/dist/Tree/Tree.js +113 -0
  182. package/dist/Tree/Tree.js.map +1 -0
  183. package/dist/Tree/index.d.ts +3 -0
  184. package/dist/Tree/index.js +2 -0
  185. package/dist/index.d.ts +63 -8
  186. package/dist/index.js +31 -2
  187. package/dist/internal/labels.js +12 -0
  188. package/dist/internal/labels.js.map +1 -0
  189. package/dist/lib/labels.d.ts +210 -0
  190. package/dist/lib/labels.js +139 -0
  191. package/dist/lib/labels.js.map +1 -0
  192. package/dist/lib/theme.d.ts +134 -4
  193. package/dist/lib/theme.js.map +1 -1
  194. package/dist/styles.css +1912 -138
  195. package/dist/tokens.css +9 -0
  196. package/dist/utils/focus.d.ts +1 -1
  197. package/dist/utils/focus.js +2 -2
  198. package/dist/utils/focus.js.map +1 -1
  199. package/dist/utils/index.d.ts +3 -1
  200. package/dist/utils/index.js +3 -1
  201. package/dist/utils/useClipboard.d.ts +14 -0
  202. package/dist/utils/useClipboard.js +30 -0
  203. package/dist/utils/useClipboard.js.map +1 -0
  204. package/dist/utils/useScrollSpy.d.ts +14 -0
  205. package/dist/utils/useScrollSpy.js +27 -0
  206. package/dist/utils/useScrollSpy.js.map +1 -0
  207. package/package.json +5 -5
@@ -0,0 +1,26 @@
1
+
2
+ import { PolymorphicProps } from "../lib/polymorphic.js";
3
+ import { ElementType, ReactNode } from "react";
4
+ export interface ErrorSummaryLabels {
5
+ /** The title, from the number of errors. */
6
+ title: (count: number) => string;
7
+ }
8
+ export declare const ERRORSUMMARY_LABELS: ErrorSummaryLabels;
9
+ export interface ErrorSummaryItem {
10
+ /** id of the field's input: the link goes there and focuses it. */
11
+ id: string;
12
+ message: ReactNode;
13
+ }
14
+ export interface ErrorSummaryOwnProps {
15
+ errors: readonly ErrorSummaryItem[];
16
+ /** Move focus to the summary when errors appear (after a submit). Default true. */
17
+ focusOnShow?: boolean;
18
+ labels?: Partial<ErrorSummaryLabels>;
19
+ }
20
+ export type ErrorSummaryProps<E extends ElementType = 'div'> = PolymorphicProps<E, ErrorSummaryOwnProps>;
21
+ /**
22
+ * The errors of a long form, at its top after a submit: a title with the count and one link per error that takes you to
23
+ * the field. It takes focus when it appears, so a screen reader reads it first. Each field still shows its own error.
24
+ */
25
+ export declare function ErrorSummary<E extends ElementType = 'div'>(props: ErrorSummaryProps<E>): import("react").JSX.Element | null;
26
+ //# sourceMappingURL=ErrorSummary.d.ts.map
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { useLabels } from "../internal/labels.js";
3
+ import { cx } from "../utils/src/index.js";
4
+ import { useAnimationRoot } from "../internal/animation.js";
5
+ import { useCss, useThemeProps } from "../internal/styled.js";
6
+ import { useEffect, useId } from "react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { ErrorIcon } from "@slurp-ui/icons";
9
+ // src/ErrorSummary/ErrorSummary.tsx
10
+ const ERRORSUMMARY_LABELS = { title: (n) => n === 1 ? "C’è un errore da correggere" : `Ci sono ${n} errori da correggere` };
11
+ /**
12
+ * The errors of a long form, at its top after a submit: a title with the count and one link per error that takes you to
13
+ * the field. It takes focus when it appears, so a screen reader reads it first. Each field still shows its own error.
14
+ */
15
+ function ErrorSummary(props) {
16
+ const { as, css, className, errors, focusOnShow = true, labels: labelsProp, ...rest } = useThemeProps("ErrorSummary", props);
17
+ const labels = {
18
+ ...ERRORSUMMARY_LABELS,
19
+ ...useLabels("ErrorSummary"),
20
+ ...labelsProp
21
+ };
22
+ const id = useId();
23
+ const Root = as ?? "div";
24
+ const styled = useCss("ErrorSummary", "root", css);
25
+ const root = useAnimationRoot(rest);
26
+ const key = errors.map((e) => e.id).join(" ");
27
+ useEffect(() => {
28
+ if (focusOnShow && key) document.getElementById(id)?.focus();
29
+ }, [
30
+ focusOnShow,
31
+ key,
32
+ id
33
+ ]);
34
+ if (!errors.length) return null;
35
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [styled.style, /* @__PURE__ */ jsxs(Root, {
36
+ id,
37
+ className: cx("slurp-error-summary", styled.className, className),
38
+ role: "alert",
39
+ tabIndex: -1,
40
+ "aria-labelledby": `${id}-title`,
41
+ ...root,
42
+ children: [/* @__PURE__ */ jsxs("p", {
43
+ className: "slurp-error-summary-title",
44
+ id: `${id}-title`,
45
+ children: [/* @__PURE__ */ jsx(ErrorIcon, {
46
+ size: 20,
47
+ "aria-hidden": true
48
+ }), labels.title(errors.length)]
49
+ }), /* @__PURE__ */ jsx("ul", {
50
+ className: "slurp-error-summary-list",
51
+ children: errors.map((e) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
52
+ className: "slurp-error-summary-link",
53
+ href: `#${e.id}`,
54
+ onClick: (event) => {
55
+ const field = document.getElementById(e.id);
56
+ if (!field) return;
57
+ event.preventDefault();
58
+ field.focus();
59
+ field.scrollIntoView({ block: "center" });
60
+ },
61
+ children: e.message
62
+ }) }, e.id))
63
+ })]
64
+ })] });
65
+ }
66
+ export { ERRORSUMMARY_LABELS, ErrorSummary };
67
+
68
+ //# sourceMappingURL=ErrorSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorSummary.js","names":[],"sources":["../../src/ErrorSummary/ErrorSummary.tsx"],"sourcesContent":["import { ErrorIcon } from '@slurp-ui/icons';\nimport { cx } from '@slurp-ui/utils';\nimport { useEffect, useId, type ElementType, type ReactNode } from 'react';\n\nimport { useAnimationRoot } from '../internal/animation';\nimport { useLabels } from '../internal/labels';\nimport { useCss, useThemeProps } from '../internal/styled';\nimport type { PolymorphicProps } from '../lib/polymorphic';\n\nexport interface ErrorSummaryLabels {\n /** The title, from the number of errors. */\n title: (count: number) => string;\n}\n\nexport const ERRORSUMMARY_LABELS: ErrorSummaryLabels = {\n title: (n) => (n === 1 ? 'C’è un errore da correggere' : `Ci sono ${n} errori da correggere`),\n};\n\nexport interface ErrorSummaryItem {\n /** id of the field's input: the link goes there and focuses it. */\n id: string;\n message: ReactNode;\n}\n\nexport interface ErrorSummaryOwnProps {\n errors: readonly ErrorSummaryItem[];\n /** Move focus to the summary when errors appear (after a submit). Default true. */\n focusOnShow?: boolean;\n labels?: Partial<ErrorSummaryLabels>;\n}\n\nexport type ErrorSummaryProps<E extends ElementType = 'div'> = PolymorphicProps<\n E,\n ErrorSummaryOwnProps\n>;\n\n/**\n * The errors of a long form, at its top after a submit: a title with the count and one link per error that takes you to\n * the field. It takes focus when it appears, so a screen reader reads it first. Each field still shows its own error.\n */\nexport function ErrorSummary<E extends ElementType = 'div'>(props: ErrorSummaryProps<E>) {\n const {\n as,\n css,\n className,\n errors,\n focusOnShow = true,\n labels: labelsProp,\n ...rest\n } = useThemeProps('ErrorSummary', props as ErrorSummaryProps);\n const labels = { ...ERRORSUMMARY_LABELS, ...useLabels('ErrorSummary'), ...labelsProp };\n const id = useId();\n const Root = (as ?? 'div') as ElementType;\n const styled = useCss('ErrorSummary', 'root', css);\n const root = useAnimationRoot(rest);\n const key = errors.map((e) => e.id).join(' ');\n useEffect(() => {\n if (focusOnShow && key) document.getElementById(id)?.focus();\n }, [focusOnShow, key, id]);\n if (!errors.length) return null;\n return (\n <>\n {styled.style}\n <Root\n id={id}\n className={cx('slurp-error-summary', styled.className, className)}\n role=\"alert\"\n tabIndex={-1}\n aria-labelledby={`${id}-title`}\n {...root}\n >\n <p className=\"slurp-error-summary-title\" id={`${id}-title`}>\n <ErrorIcon size={20} aria-hidden />\n {labels.title(errors.length)}\n </p>\n <ul className=\"slurp-error-summary-list\">\n {errors.map((e) => (\n <li key={e.id}>\n <a\n className=\"slurp-error-summary-link\"\n href={`#${e.id}`}\n onClick={(event) => {\n const field = document.getElementById(e.id);\n if (!field) return;\n event.preventDefault();\n field.focus();\n field.scrollIntoView({ block: 'center' });\n }}\n >\n {e.message}\n </a>\n </li>\n ))}\n </ul>\n </Root>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAcA,MAAa,sBAA0C,EACrD,QAAQ,MAAO,MAAM,IAAI,gCAAgC,WAAW,EAAE,uBACxE;;;;;AAwBA,SAAgB,aAA4C,OAA6B;CACvF,MAAM,EACJ,IACA,KACA,WACA,QACA,cAAc,MACd,QAAQ,YACR,GAAG,SACD,cAAc,gBAAgB,KAA0B;CAC5D,MAAM,SAAS;EAAE,GAAG;EAAqB,GAAG,UAAU,cAAc;EAAG,GAAG;CAAW;CACrF,MAAM,KAAK,MAAM;CACjB,MAAM,OAAQ,MAAM;CACpB,MAAM,SAAS,OAAO,gBAAgB,QAAQ,GAAG;CACjD,MAAM,OAAO,iBAAiB,IAAI;CAClC,MAAM,MAAM,OAAO,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG;CAC5C,gBAAgB;EACd,IAAI,eAAe,KAAK,SAAS,eAAe,EAAE,CAAC,EAAE,MAAM;CAC7D,GAAG;EAAC;EAAa;EAAK;CAAE,CAAC;CACzB,IAAI,CAAC,OAAO,QAAQ,OAAO;CAC3B,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,OAAO,OACR,qBAAC,MAAD;EACM;EACJ,WAAW,GAAG,uBAAuB,OAAO,WAAW,SAAS;EAChE,MAAK;EACL,UAAU;EACV,mBAAiB,GAAG,GAAG;EACvB,GAAI;EANN,UAAA,CAQE,qBAAC,KAAD;GAAG,WAAU;GAA4B,IAAI,GAAG,GAAG;GAAnD,UAAA,CACE,oBAAC,WAAD;IAAW,MAAM;IAAI,eAAA;GAAa,CAAA,GACjC,OAAO,MAAM,OAAO,MAAM,CAC1B;EACH,CAAA,GAAA,oBAAC,MAAD;GAAI,WAAU;GACX,UAAA,OAAO,KAAK,MACX,oBAAC,MAAD,EAAA,UACE,oBAAC,KAAD;IACE,WAAU;IACV,MAAM,IAAI,EAAE;IACZ,UAAU,UAAU;KAClB,MAAM,QAAQ,SAAS,eAAe,EAAE,EAAE;KAC1C,IAAI,CAAC,OAAO;KACZ,MAAM,eAAe;KACrB,MAAM,MAAM;KACZ,MAAM,eAAe,EAAE,OAAO,SAAS,CAAC;IAC1C;IAEC,UAAA,EAAE;GACF,CAAA,EACD,GAdK,EAAE,EAcP,CACL;EACC,CAAA,CACA;CACN,CAAA,CAAA,EAAA,CAAA;AAEN"}
@@ -0,0 +1,3 @@
1
+
2
+ import { ERRORSUMMARY_LABELS, ErrorSummary, ErrorSummaryItem, ErrorSummaryLabels, ErrorSummaryProps } from "./ErrorSummary.js";
3
+ export { ERRORSUMMARY_LABELS, ErrorSummary, type ErrorSummaryItem, type ErrorSummaryLabels, type ErrorSummaryProps, ErrorSummary as default };
@@ -0,0 +1,2 @@
1
+
2
+ export { ERRORSUMMARY_LABELS, ErrorSummary, ErrorSummary as default } from "./ErrorSummary.js";
@@ -0,0 +1,34 @@
1
+
2
+ import { PolymorphicProps } from "../lib/polymorphic.js";
3
+ import { ElementType, ReactNode } from "react";
4
+ export interface FileDropLabels {
5
+ /** The button that opens the file picker. */
6
+ browse: string;
7
+ /** Beside it: you can drop files too. */
8
+ drop: string;
9
+ /** Name of each remove button. */
10
+ remove: (name: string) => string;
11
+ }
12
+ export declare const FILEDROP_LABELS: FileDropLabels;
13
+ export interface FileDropOwnProps {
14
+ label: ReactNode;
15
+ hint?: ReactNode;
16
+ value?: File[];
17
+ defaultValue?: File[];
18
+ onValueChange?: (files: File[]) => void;
19
+ /** `accept` of the input ("image/*,.pdf"). */
20
+ accept?: string;
21
+ /** Default true. */
22
+ multiple?: boolean;
23
+ disabled?: boolean;
24
+ /** Upload progress by file name, 0–100: a bar under each file. */
25
+ progress?: Record<string, number>;
26
+ labels?: Partial<FileDropLabels>;
27
+ }
28
+ export type FileDropProps<E extends ElementType = 'div'> = PolymorphicProps<E, FileDropOwnProps>;
29
+ /**
30
+ * Files to upload: a drop area with a real file input (so the keyboard and the system picker work), then the list of
31
+ * chosen files with their size, a remove button and, while uploading, their progress.
32
+ */
33
+ export declare function FileDrop<E extends ElementType = 'div'>(props: FileDropProps<E>): import("react").JSX.Element;
34
+ //# sourceMappingURL=FileDrop.d.ts.map
@@ -0,0 +1,145 @@
1
+ "use client";
2
+ import { useLabels } from "../internal/labels.js";
3
+ import { cx } from "../utils/src/index.js";
4
+ import { useAnimationRoot } from "../internal/animation.js";
5
+ import { useCss, useThemeProps } from "../internal/styled.js";
6
+ import { Bubble } from "../Bubble/Bubble.js";
7
+ import { useControlled } from "../utils/useControlled.js";
8
+ import { Progress } from "../Progress/Progress.js";
9
+ import { useId, useState } from "react";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
+ import { CloseIcon, UploadIcon } from "@slurp-ui/icons";
12
+ // src/FileDrop/FileDrop.tsx
13
+ const FILEDROP_LABELS = {
14
+ browse: "Scegli i file",
15
+ drop: "oppure trascinali qui",
16
+ remove: (name) => `Rimuovi ${name}`
17
+ };
18
+ const size = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1024 ** 2 ? `${Math.round(bytes / 1024)} KB` : `${(bytes / 1024 ** 2).toFixed(1)} MB`;
19
+ /**
20
+ * Files to upload: a drop area with a real file input (so the keyboard and the system picker work), then the list of
21
+ * chosen files with their size, a remove button and, while uploading, their progress.
22
+ */
23
+ function FileDrop(props) {
24
+ const { as, css, className, label, hint, value: valueProp, defaultValue = [], onValueChange, accept, multiple = true, disabled = false, progress, labels: labelsProp, ...rest } = useThemeProps("FileDrop", props);
25
+ const labels = {
26
+ ...FILEDROP_LABELS,
27
+ ...useLabels("FileDrop"),
28
+ ...labelsProp
29
+ };
30
+ const [files, setFiles] = useControlled({
31
+ value: valueProp,
32
+ defaultValue,
33
+ onChange: onValueChange
34
+ });
35
+ const [over, setOver] = useState(false);
36
+ const id = useId();
37
+ const Root = as ?? "div";
38
+ const styled = useCss("FileDrop", "root", css);
39
+ const root = useAnimationRoot(rest);
40
+ const add = (list) => {
41
+ if (!list?.length) return;
42
+ const picked = [...list];
43
+ setFiles(multiple ? [...files, ...picked] : picked.slice(0, 1));
44
+ };
45
+ const drop = (e) => {
46
+ e.preventDefault();
47
+ setOver(false);
48
+ if (!disabled) add(e.dataTransfer.files);
49
+ };
50
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [styled.style, /* @__PURE__ */ jsxs(Root, {
51
+ className: cx("slurp-file-drop", styled.className, className),
52
+ "data-disabled": disabled || void 0,
53
+ ...root,
54
+ children: [
55
+ /* @__PURE__ */ jsx("span", {
56
+ className: "slurp-field-label",
57
+ id: `${id}-label`,
58
+ children: label
59
+ }),
60
+ /* @__PURE__ */ jsxs("div", {
61
+ className: "slurp-file-drop-area",
62
+ "data-over": over || void 0,
63
+ onDragOver: (e) => {
64
+ e.preventDefault();
65
+ if (!disabled) setOver(true);
66
+ },
67
+ onDragLeave: () => setOver(false),
68
+ onDrop: drop,
69
+ children: [
70
+ /* @__PURE__ */ jsx(UploadIcon, {
71
+ size: 24,
72
+ "aria-hidden": true
73
+ }),
74
+ /* @__PURE__ */ jsx("label", {
75
+ className: "slurp-file-drop-browse",
76
+ htmlFor: `${id}-input`,
77
+ children: labels.browse
78
+ }),
79
+ /* @__PURE__ */ jsx("span", {
80
+ className: "slurp-file-drop-hint",
81
+ children: labels.drop
82
+ }),
83
+ /* @__PURE__ */ jsx("input", {
84
+ id: `${id}-input`,
85
+ className: "slurp-visually-hidden",
86
+ type: "file",
87
+ accept,
88
+ multiple,
89
+ disabled,
90
+ "aria-labelledby": `${id}-label ${id}-input-label`,
91
+ "aria-describedby": hint != null ? `${id}-hint` : void 0,
92
+ onChange: (e) => {
93
+ add(e.target.files);
94
+ e.target.value = "";
95
+ }
96
+ }),
97
+ /* @__PURE__ */ jsx("span", {
98
+ id: `${id}-input-label`,
99
+ hidden: true,
100
+ children: labels.browse
101
+ })
102
+ ]
103
+ }),
104
+ hint != null && /* @__PURE__ */ jsx("p", {
105
+ className: "slurp-field-hint",
106
+ id: `${id}-hint`,
107
+ children: hint
108
+ }),
109
+ files.length > 0 && /* @__PURE__ */ jsx("ul", {
110
+ className: "slurp-file-drop-list",
111
+ "aria-labelledby": `${id}-label`,
112
+ children: files.map((file, i) => /* @__PURE__ */ jsxs("li", {
113
+ className: "slurp-file-drop-file",
114
+ children: [
115
+ /* @__PURE__ */ jsx("span", {
116
+ className: "slurp-file-drop-name",
117
+ children: file.name
118
+ }),
119
+ /* @__PURE__ */ jsx("span", {
120
+ className: "slurp-file-drop-size",
121
+ children: size(file.size)
122
+ }),
123
+ /* @__PURE__ */ jsx(Bubble, {
124
+ appearance: "plain",
125
+ tone: "neutral",
126
+ size: "sm",
127
+ label: labels.remove(file.name),
128
+ disabled,
129
+ onClick: () => setFiles(files.filter((_, j) => j !== i)),
130
+ children: /* @__PURE__ */ jsx(CloseIcon, { size: 18 })
131
+ }),
132
+ progress?.[file.name] !== void 0 && /* @__PURE__ */ jsx(Progress, {
133
+ className: "slurp-file-drop-progress",
134
+ value: progress[file.name],
135
+ label: file.name
136
+ })
137
+ ]
138
+ }, `${file.name}-${i}`))
139
+ })
140
+ ]
141
+ })] });
142
+ }
143
+ export { FILEDROP_LABELS, FileDrop };
144
+
145
+ //# sourceMappingURL=FileDrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileDrop.js","names":[],"sources":["../../src/FileDrop/FileDrop.tsx"],"sourcesContent":["import { CloseIcon, UploadIcon } from '@slurp-ui/icons';\nimport { cx } from '@slurp-ui/utils';\nimport {\n useId,\n useState,\n type ChangeEvent,\n type DragEvent,\n type ElementType,\n type ReactNode,\n} from 'react';\n\nimport { Bubble } from '../Bubble/Bubble';\nimport { useAnimationRoot } from '../internal/animation';\nimport { useLabels } from '../internal/labels';\nimport { useCss, useThemeProps } from '../internal/styled';\nimport type { PolymorphicProps } from '../lib/polymorphic';\nimport { Progress } from '../Progress/Progress';\nimport { useControlled } from '../utils/useControlled';\n\nexport interface FileDropLabels {\n /** The button that opens the file picker. */\n browse: string;\n /** Beside it: you can drop files too. */\n drop: string;\n /** Name of each remove button. */\n remove: (name: string) => string;\n}\n\nexport const FILEDROP_LABELS: FileDropLabels = {\n browse: 'Scegli i file',\n drop: 'oppure trascinali qui',\n remove: (name) => `Rimuovi ${name}`,\n};\n\nexport interface FileDropOwnProps {\n label: ReactNode;\n hint?: ReactNode;\n value?: File[];\n defaultValue?: File[];\n onValueChange?: (files: File[]) => void;\n /** `accept` of the input (\"image/*,.pdf\"). */\n accept?: string;\n /** Default true. */\n multiple?: boolean;\n disabled?: boolean;\n /** Upload progress by file name, 0–100: a bar under each file. */\n progress?: Record<string, number>;\n labels?: Partial<FileDropLabels>;\n}\n\nexport type FileDropProps<E extends ElementType = 'div'> = PolymorphicProps<E, FileDropOwnProps>;\n\nconst size = (bytes: number) =>\n bytes < 1024\n ? `${bytes} B`\n : bytes < 1024 ** 2\n ? `${Math.round(bytes / 1024)} KB`\n : `${(bytes / 1024 ** 2).toFixed(1)} MB`;\n\n/**\n * Files to upload: a drop area with a real file input (so the keyboard and the system picker work), then the list of\n * chosen files with their size, a remove button and, while uploading, their progress.\n */\nexport function FileDrop<E extends ElementType = 'div'>(props: FileDropProps<E>) {\n const {\n as,\n css,\n className,\n label,\n hint,\n value: valueProp,\n defaultValue = [],\n onValueChange,\n accept,\n multiple = true,\n disabled = false,\n progress,\n labels: labelsProp,\n ...rest\n } = useThemeProps('FileDrop', props as FileDropProps);\n const labels = { ...FILEDROP_LABELS, ...useLabels('FileDrop'), ...labelsProp };\n const [files, setFiles] = useControlled({\n value: valueProp,\n defaultValue,\n onChange: onValueChange,\n });\n const [over, setOver] = useState(false);\n const id = useId();\n const Root = (as ?? 'div') as ElementType;\n const styled = useCss('FileDrop', 'root', css);\n const root = useAnimationRoot(rest);\n const add = (list: FileList | null) => {\n if (!list?.length) return;\n const picked = [...list];\n setFiles(multiple ? [...files, ...picked] : picked.slice(0, 1));\n };\n const drop = (e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n setOver(false);\n if (!disabled) add(e.dataTransfer.files);\n };\n return (\n <>\n {styled.style}\n <Root\n className={cx('slurp-file-drop', styled.className, className)}\n data-disabled={disabled || undefined}\n {...root}\n >\n <span className=\"slurp-field-label\" id={`${id}-label`}>\n {label}\n </span>\n <div\n className=\"slurp-file-drop-area\"\n data-over={over || undefined}\n onDragOver={(e) => {\n e.preventDefault();\n if (!disabled) setOver(true);\n }}\n onDragLeave={() => setOver(false)}\n onDrop={drop}\n >\n <UploadIcon size={24} aria-hidden />\n <label className=\"slurp-file-drop-browse\" htmlFor={`${id}-input`}>\n {labels.browse}\n </label>\n <span className=\"slurp-file-drop-hint\">{labels.drop}</span>\n <input\n id={`${id}-input`}\n className=\"slurp-visually-hidden\"\n type=\"file\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n aria-labelledby={`${id}-label ${id}-input-label`}\n aria-describedby={hint != null ? `${id}-hint` : undefined}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n add(e.target.files);\n e.target.value = '';\n }}\n />\n <span id={`${id}-input-label`} hidden>\n {labels.browse}\n </span>\n </div>\n {hint != null && (\n <p className=\"slurp-field-hint\" id={`${id}-hint`}>\n {hint}\n </p>\n )}\n {files.length > 0 && (\n <ul className=\"slurp-file-drop-list\" aria-labelledby={`${id}-label`}>\n {files.map((file, i) => (\n <li key={`${file.name}-${i}`} className=\"slurp-file-drop-file\">\n <span className=\"slurp-file-drop-name\">{file.name}</span>\n <span className=\"slurp-file-drop-size\">{size(file.size)}</span>\n <Bubble\n appearance=\"plain\"\n tone=\"neutral\"\n size=\"sm\"\n label={labels.remove(file.name)}\n disabled={disabled}\n onClick={() => setFiles(files.filter((_, j) => j !== i))}\n >\n <CloseIcon size={18} />\n </Bubble>\n {progress?.[file.name] !== undefined && (\n <Progress\n className=\"slurp-file-drop-progress\"\n value={progress[file.name]}\n label={file.name}\n />\n )}\n </li>\n ))}\n </ul>\n )}\n </Root>\n </>\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+
2
+ import { FILEDROP_LABELS, FileDrop, FileDropLabels, FileDropProps } from "./FileDrop.js";
3
+ export { FILEDROP_LABELS, FileDrop, type FileDropLabels, type FileDropProps, FileDrop as default };
@@ -0,0 +1,2 @@
1
+
2
+ export { FILEDROP_LABELS, FileDrop, FileDrop as default } from "./FileDrop.js";
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { useLabels } from "../internal/labels.js";
2
3
  import { cx } from "../utils/src/index.js";
3
4
  import { useAnimationRoot } from "../internal/animation.js";
4
5
  import { useCss, useThemeProps } from "../internal/styled.js";
@@ -18,6 +19,7 @@ function FiltersRoot(props) {
18
19
  const { as, css, className, onReset, active = 0, labels: labelsProp, children, ...rest } = useThemeProps("Filters", props);
19
20
  const labels = {
20
21
  ...FILTERS_LABELS,
22
+ ...useLabels("Filters"),
21
23
  ...labelsProp
22
24
  };
23
25
  const Root = as ?? "div";
@@ -1 +1 @@
1
- {"version":3,"file":"Filters.js","names":[],"sources":["../../src/Filters/Filters.tsx"],"sourcesContent":["import { ResetIcon } from '@slurp-ui/icons';\nimport { cx } from '@slurp-ui/utils';\nimport { useId, type ElementType, type ReactNode } from 'react';\n\nimport { useAnimationRoot } from '../internal/animation';\nimport { useCss, useThemeProps } from '../internal/styled';\nimport type { PolymorphicProps } from '../lib/polymorphic';\n\nexport interface FiltersLabels {\n title: string;\n reset: string;\n}\n\nexport const FILTERS_LABELS: FiltersLabels = { title: 'Filtri', reset: 'Azzera filtri' };\n\nexport interface FiltersOwnProps {\n /** Clears every filter. Off (muted outline) when nothing is active. */\n onReset?: () => void;\n /** How many filters are active: the reset is disabled at 0. */\n active?: number;\n labels?: Partial<FiltersLabels>;\n /** Filters.Group elements. */\n children?: ReactNode;\n}\n\nexport type FiltersProps<E extends ElementType = 'div'> = PolymorphicProps<E, FiltersOwnProps>;\n\n/**\n * Filter panel content (in the Dock's panel or a Sheet): a title, \"Azzera filtri\" at the top right, then groups of\n * chips.\n */\nfunction FiltersRoot<E extends ElementType = 'div'>(props: FiltersProps<E>) {\n const {\n as,\n css,\n className,\n onReset,\n active = 0,\n labels: labelsProp,\n children,\n ...rest\n } = useThemeProps('Filters', props as FiltersProps);\n const labels = { ...FILTERS_LABELS, ...labelsProp };\n const Root = (as ?? 'div') as ElementType;\n const styled = useCss('Filters', 'root', css);\n const root = useAnimationRoot(rest);\n return (\n <>\n {styled.style}\n <Root className={cx('slurp-filters', styled.className, className)} {...root}>\n <div className=\"slurp-filters-head\">\n <h2 className=\"slurp-filters-title\">{labels.title}</h2>\n {onReset && (\n <button\n type=\"button\"\n className=\"slurp-filters-reset\"\n disabled={active === 0}\n onClick={onReset}\n >\n <ResetIcon size={16} />\n {labels.reset}\n </button>\n )}\n </div>\n {children}\n </Root>\n </>\n );\n}\n\nexport interface FiltersGroupProps {\n /** Name of the group (\"Condizione\"). */\n label: ReactNode;\n /** Chips. */\n children?: ReactNode;\n className?: string;\n}\n\n/** A group of filter chips with its name (a fieldset and legend). */\nfunction FiltersGroup({ label, children, className }: FiltersGroupProps) {\n const id = useId();\n return (\n <div role=\"group\" aria-labelledby={id} className={cx('slurp-filters-group', className)}>\n <span id={id} className=\"slurp-filters-legend\">\n {label}\n </span>\n <div className=\"slurp-filters-chips\">{children}</div>\n </div>\n );\n}\n\nexport const Filters = Object.assign(FiltersRoot, { Group: FiltersGroup });\nexport { FiltersGroup };\n"],"mappings":";;;;;;;;AAaA,MAAa,iBAAgC;CAAE,OAAO;CAAU,OAAO;AAAgB;;;;;AAkBvF,SAAS,YAA2C,OAAwB;CAC1E,MAAM,EACJ,IACA,KACA,WACA,SACA,SAAS,GACT,QAAQ,YACR,UACA,GAAG,SACD,cAAc,WAAW,KAAqB;CAClD,MAAM,SAAS;EAAE,GAAG;EAAgB,GAAG;CAAW;CAClD,MAAM,OAAQ,MAAM;CACpB,MAAM,SAAS,OAAO,WAAW,QAAQ,GAAG;CAC5C,MAAM,OAAO,iBAAiB,IAAI;CAClC,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,OAAO,OACR,qBAAC,MAAD;EAAM,WAAW,GAAG,iBAAiB,OAAO,WAAW,SAAS;EAAG,GAAI;EAAvE,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IAAuB,UAAA,OAAO;GAAU,CAAA,GACrD,WACC,qBAAC,UAAD;IACE,MAAK;IACL,WAAU;IACV,UAAU,WAAW;IACrB,SAAS;IAJX,UAAA,CAME,oBAAC,WAAD,EAAW,MAAM,GAAK,CAAA,GACrB,OAAO,KACF;GAEP,CAAA,CAAA;EACJ,CAAA,GAAA,QACG;CACN,CAAA,CAAA,EAAA,CAAA;AAEN;;AAWA,SAAS,aAAa,EAAE,OAAO,UAAU,aAAgC;CACvE,MAAM,KAAK,MAAM;CACjB,OACE,qBAAC,OAAD;EAAK,MAAK;EAAQ,mBAAiB;EAAI,WAAW,GAAG,uBAAuB,SAAS;EAArF,UAAA,CACE,oBAAC,QAAD;GAAU;GAAI,WAAU;GACrB,UAAA;EACG,CAAA,GACN,oBAAC,OAAD;GAAK,WAAU;GAAuB;EAAc,CAAA,CACjD;;AAET;AAEA,MAAa,UAAU,OAAO,OAAO,aAAa,EAAE,OAAO,aAAa,CAAC"}
1
+ {"version":3,"file":"Filters.js","names":[],"sources":["../../src/Filters/Filters.tsx"],"sourcesContent":["import { ResetIcon } from '@slurp-ui/icons';\nimport { cx } from '@slurp-ui/utils';\nimport { useId, type ElementType, type ReactNode } from 'react';\n\nimport { useLabels } from '../internal/labels';\nimport { useAnimationRoot } from '../internal/animation';\nimport { useCss, useThemeProps } from '../internal/styled';\nimport type { PolymorphicProps } from '../lib/polymorphic';\n\nexport interface FiltersLabels {\n title: string;\n reset: string;\n}\n\nexport const FILTERS_LABELS: FiltersLabels = { title: 'Filtri', reset: 'Azzera filtri' };\n\nexport interface FiltersOwnProps {\n /** Clears every filter. Off (muted outline) when nothing is active. */\n onReset?: () => void;\n /** How many filters are active: the reset is disabled at 0. */\n active?: number;\n labels?: Partial<FiltersLabels>;\n /** Filters.Group elements. */\n children?: ReactNode;\n}\n\nexport type FiltersProps<E extends ElementType = 'div'> = PolymorphicProps<E, FiltersOwnProps>;\n\n/**\n * Filter panel content (in the Dock's panel or a Sheet): a title, \"Azzera filtri\" at the top right, then groups of\n * chips.\n */\nfunction FiltersRoot<E extends ElementType = 'div'>(props: FiltersProps<E>) {\n const {\n as,\n css,\n className,\n onReset,\n active = 0,\n labels: labelsProp,\n children,\n ...rest\n } = useThemeProps('Filters', props as FiltersProps);\n const labels = { ...FILTERS_LABELS, ...useLabels('Filters'), ...labelsProp };\n const Root = (as ?? 'div') as ElementType;\n const styled = useCss('Filters', 'root', css);\n const root = useAnimationRoot(rest);\n return (\n <>\n {styled.style}\n <Root className={cx('slurp-filters', styled.className, className)} {...root}>\n <div className=\"slurp-filters-head\">\n <h2 className=\"slurp-filters-title\">{labels.title}</h2>\n {onReset && (\n <button\n type=\"button\"\n className=\"slurp-filters-reset\"\n disabled={active === 0}\n onClick={onReset}\n >\n <ResetIcon size={16} />\n {labels.reset}\n </button>\n )}\n </div>\n {children}\n </Root>\n </>\n );\n}\n\nexport interface FiltersGroupProps {\n /** Name of the group (\"Condizione\"). */\n label: ReactNode;\n /** Chips. */\n children?: ReactNode;\n className?: string;\n}\n\n/** A group of filter chips with its name (a fieldset and legend). */\nfunction FiltersGroup({ label, children, className }: FiltersGroupProps) {\n const id = useId();\n return (\n <div role=\"group\" aria-labelledby={id} className={cx('slurp-filters-group', className)}>\n <span id={id} className=\"slurp-filters-legend\">\n {label}\n </span>\n <div className=\"slurp-filters-chips\">{children}</div>\n </div>\n );\n}\n\nexport const Filters = Object.assign(FiltersRoot, { Group: FiltersGroup });\nexport { FiltersGroup };\n"],"mappings":";;;;;;;;;AAcA,MAAa,iBAAgC;CAAE,OAAO;CAAU,OAAO;AAAgB;;;;;AAkBvF,SAAS,YAA2C,OAAwB;CAC1E,MAAM,EACJ,IACA,KACA,WACA,SACA,SAAS,GACT,QAAQ,YACR,UACA,GAAG,SACD,cAAc,WAAW,KAAqB;CAClD,MAAM,SAAS;EAAE,GAAG;EAAgB,GAAG,UAAU,SAAS;EAAG,GAAG;CAAW;CAC3E,MAAM,OAAQ,MAAM;CACpB,MAAM,SAAS,OAAO,WAAW,QAAQ,GAAG;CAC5C,MAAM,OAAO,iBAAiB,IAAI;CAClC,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,OAAO,OACR,qBAAC,MAAD;EAAM,WAAW,GAAG,iBAAiB,OAAO,WAAW,SAAS;EAAG,GAAI;EAAvE,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IAAuB,UAAA,OAAO;GAAU,CAAA,GACrD,WACC,qBAAC,UAAD;IACE,MAAK;IACL,WAAU;IACV,UAAU,WAAW;IACrB,SAAS;IAJX,UAAA,CAME,oBAAC,WAAD,EAAW,MAAM,GAAK,CAAA,GACrB,OAAO,KACF;GAEP,CAAA,CAAA;EACJ,CAAA,GAAA,QACG;CACN,CAAA,CAAA,EAAA,CAAA;AAEN;;AAWA,SAAS,aAAa,EAAE,OAAO,UAAU,aAAgC;CACvE,MAAM,KAAK,MAAM;CACjB,OACE,qBAAC,OAAD;EAAK,MAAK;EAAQ,mBAAiB;EAAI,WAAW,GAAG,uBAAuB,SAAS;EAArF,UAAA,CACE,oBAAC,QAAD;GAAU;GAAI,WAAU;GACrB,UAAA;EACG,CAAA,GACN,oBAAC,OAAD;GAAK,WAAU;GAAuB;EAAc,CAAA,CACjD;;AAET;AAEA,MAAa,UAAU,OAAO,OAAO,aAAa,EAAE,OAAO,aAAa,CAAC"}
@@ -0,0 +1,37 @@
1
+
2
+ import { PolymorphicProps } from "../lib/polymorphic.js";
3
+ import { ElementType, ReactNode } from "react";
4
+ export interface FooterOwnProps {
5
+ /** Groups of links (`Footer.Group`), then `Footer.Bottom`. */
6
+ children?: ReactNode;
7
+ }
8
+ export type FooterProps<E extends ElementType = 'footer'> = PolymorphicProps<E, FooterOwnProps>;
9
+ /**
10
+ * The foot of a site: groups of links in columns and a bottom line (legal, version, language). The Dock replaces the
11
+ * header, not the footer.
12
+ */
13
+ declare function FooterRoot<E extends ElementType = 'footer'>(props: FooterProps<E>): import("react").JSX.Element;
14
+ export interface FooterGroupProps {
15
+ /** Shown as an eyebrow above the links, and names the list. */
16
+ title: ReactNode;
17
+ children?: ReactNode;
18
+ className?: string;
19
+ }
20
+ /** A column of links under a title. */
21
+ declare function FooterGroup({ title, children, className }: FooterGroupProps): import("react").JSX.Element;
22
+ export type FooterLinkProps<E extends ElementType = 'a'> = PolymorphicProps<E>;
23
+ /** A link of a group; `as` renders your router's link. */
24
+ declare function FooterLink<E extends ElementType = 'a'>(props: FooterLinkProps<E>): import("react").JSX.Element;
25
+ /** The bottom line: small print, version, language. */
26
+ declare function FooterBottom({ children, className }: {
27
+ children?: ReactNode;
28
+ className?: string;
29
+ }): import("react").JSX.Element;
30
+ type FooterComponent = typeof FooterRoot & {
31
+ Group: typeof FooterGroup;
32
+ Link: typeof FooterLink;
33
+ Bottom: typeof FooterBottom;
34
+ };
35
+ export declare const Footer: FooterComponent;
36
+ export { FooterBottom, FooterGroup, FooterLink };
37
+ //# sourceMappingURL=Footer.d.ts.map
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import { cx } from "../utils/src/index.js";
3
+ import { useAnimationRoot } from "../internal/animation.js";
4
+ import { useCss, useThemeProps } from "../internal/styled.js";
5
+ import { useId } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ // src/Footer/Footer.tsx
8
+ /**
9
+ * The foot of a site: groups of links in columns and a bottom line (legal, version, language). The Dock replaces the
10
+ * header, not the footer.
11
+ */
12
+ function FooterRoot(props) {
13
+ const { as, css, className, children, ...rest } = useThemeProps("Footer", props);
14
+ const Root = as ?? "footer";
15
+ const styled = useCss("Footer", "root", css);
16
+ const root = useAnimationRoot(rest);
17
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [styled.style, /* @__PURE__ */ jsx(Root, {
18
+ className: cx("slurp-footer", styled.className, className),
19
+ ...root,
20
+ children
21
+ })] });
22
+ }
23
+ /** A column of links under a title. */
24
+ function FooterGroup({ title, children, className }) {
25
+ const id = useId();
26
+ return /* @__PURE__ */ jsxs("div", {
27
+ className: cx("slurp-footer-group", className),
28
+ children: [/* @__PURE__ */ jsx("p", {
29
+ className: "slurp-footer-title",
30
+ id,
31
+ children: title
32
+ }), /* @__PURE__ */ jsx("ul", {
33
+ className: "slurp-footer-list",
34
+ "aria-labelledby": id,
35
+ children
36
+ })]
37
+ });
38
+ }
39
+ /** A link of a group; `as` renders your router's link. */
40
+ function FooterLink(props) {
41
+ const { as, css: _css, className, ...rest } = props;
42
+ const Root = as ?? "a";
43
+ const root = useAnimationRoot(rest);
44
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Root, {
45
+ className: cx("slurp-footer-link", className),
46
+ ...root
47
+ }) });
48
+ }
49
+ /** The bottom line: small print, version, language. */
50
+ function FooterBottom({ children, className }) {
51
+ return /* @__PURE__ */ jsx("div", {
52
+ className: cx("slurp-footer-bottom", className),
53
+ children
54
+ });
55
+ }
56
+ const Footer = Object.assign(FooterRoot, {
57
+ Group: FooterGroup,
58
+ Link: FooterLink,
59
+ Bottom: FooterBottom
60
+ });
61
+ export { Footer, FooterBottom, FooterGroup, FooterLink };
62
+
63
+ //# sourceMappingURL=Footer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Footer.js","names":[],"sources":["../../src/Footer/Footer.tsx"],"sourcesContent":["import { cx } from '@slurp-ui/utils';\nimport { useId, type ElementType, type ReactNode } from 'react';\n\nimport { useAnimationRoot } from '../internal/animation';\nimport { useCss, useThemeProps } from '../internal/styled';\nimport type { PolymorphicProps } from '../lib/polymorphic';\n\nexport interface FooterOwnProps {\n /** Groups of links (`Footer.Group`), then `Footer.Bottom`. */\n children?: ReactNode;\n}\n\nexport type FooterProps<E extends ElementType = 'footer'> = PolymorphicProps<E, FooterOwnProps>;\n\n/**\n * The foot of a site: groups of links in columns and a bottom line (legal, version, language). The Dock replaces the\n * header, not the footer.\n */\nfunction FooterRoot<E extends ElementType = 'footer'>(props: FooterProps<E>) {\n const { as, css, className, children, ...rest } = useThemeProps('Footer', props as FooterProps);\n const Root = (as ?? 'footer') as ElementType;\n const styled = useCss('Footer', 'root', css);\n const root = useAnimationRoot(rest);\n return (\n <>\n {styled.style}\n <Root className={cx('slurp-footer', styled.className, className)} {...root}>\n {children}\n </Root>\n </>\n );\n}\n\nexport interface FooterGroupProps {\n /** Shown as an eyebrow above the links, and names the list. */\n title: ReactNode;\n children?: ReactNode;\n className?: string;\n}\n\n/** A column of links under a title. */\nfunction FooterGroup({ title, children, className }: FooterGroupProps) {\n const id = useId();\n return (\n <div className={cx('slurp-footer-group', className)}>\n <p className=\"slurp-footer-title\" id={id}>\n {title}\n </p>\n <ul className=\"slurp-footer-list\" aria-labelledby={id}>\n {children}\n </ul>\n </div>\n );\n}\n\nexport type FooterLinkProps<E extends ElementType = 'a'> = PolymorphicProps<E>;\n\n/** A link of a group; `as` renders your router's link. */\nfunction FooterLink<E extends ElementType = 'a'>(props: FooterLinkProps<E>) {\n const { as, css: _css, className, ...rest } = props as FooterLinkProps;\n const Root = (as ?? 'a') as ElementType;\n const root = useAnimationRoot(rest);\n return (\n <li>\n <Root className={cx('slurp-footer-link', className)} {...root} />\n </li>\n );\n}\n\n/** The bottom line: small print, version, language. */\nfunction FooterBottom({ children, className }: { children?: ReactNode; className?: string }) {\n return <div className={cx('slurp-footer-bottom', className)}>{children}</div>;\n}\n\ntype FooterComponent = typeof FooterRoot & {\n Group: typeof FooterGroup;\n Link: typeof FooterLink;\n Bottom: typeof FooterBottom;\n};\n\nexport const Footer = Object.assign(FooterRoot, {\n Group: FooterGroup,\n Link: FooterLink,\n Bottom: FooterBottom,\n}) as FooterComponent;\nexport { FooterBottom, FooterGroup, FooterLink };\n"],"mappings":";;;;;;;;;;;AAkBA,SAAS,WAA6C,OAAuB;CAC3E,MAAM,EAAE,IAAI,KAAK,WAAW,UAAU,GAAG,SAAS,cAAc,UAAU,KAAoB;CAC9F,MAAM,OAAQ,MAAM;CACpB,MAAM,SAAS,OAAO,UAAU,QAAQ,GAAG;CAC3C,MAAM,OAAO,iBAAiB,IAAI;CAClC,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,OAAO,OACR,oBAAC,MAAD;EAAM,WAAW,GAAG,gBAAgB,OAAO,WAAW,SAAS;EAAG,GAAI;EACnE;CACG,CAAA,CACN,EAAA,CAAA;AAEN;;AAUA,SAAS,YAAY,EAAE,OAAO,UAAU,aAA+B;CACrE,MAAM,KAAK,MAAM;CACjB,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,sBAAsB,SAAS;EAAlD,UAAA,CACE,oBAAC,KAAD;GAAG,WAAU;GAAyB;GACnC,UAAA;EACA,CAAA,GACH,oBAAC,MAAD;GAAI,WAAU;GAAoB,mBAAiB;GAChD;EACC,CAAA,CACD;;AAET;;AAKA,SAAS,WAAwC,OAA2B;CAC1E,MAAM,EAAE,IAAI,KAAK,MAAM,WAAW,GAAG,SAAS;CAC9C,MAAM,OAAQ,MAAM;CACpB,MAAM,OAAO,iBAAiB,IAAI;CAClC,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,MAAD;EAAM,WAAW,GAAG,qBAAqB,SAAS;EAAG,GAAI;CAAO,CAAA,EAC9D,CAAA;AAER;;AAGA,SAAS,aAAa,EAAE,UAAU,aAA2D;CAC3F,OAAO,oBAAC,OAAD;EAAK,WAAW,GAAG,uBAAuB,SAAS;EAAI;CAAc,CAAA;AAC9E;AAQA,MAAa,SAAS,OAAO,OAAO,YAAY;CAC9C,OAAO;CACP,MAAM;CACN,QAAQ;AACV,CAAC"}
@@ -0,0 +1,3 @@
1
+
2
+ import { Footer, FooterBottom, FooterGroup, FooterGroupProps, FooterLink, FooterLinkProps, FooterProps } from "./Footer.js";
3
+ export { Footer, FooterBottom, FooterGroup, type FooterGroupProps, FooterLink, type FooterLinkProps, type FooterProps, Footer as default };
@@ -0,0 +1,2 @@
1
+
2
+ export { Footer, FooterBottom, FooterGroup, FooterLink, Footer as default } from "./Footer.js";
@@ -0,0 +1,16 @@
1
+
2
+ import { PolymorphicProps } from "../lib/polymorphic.js";
3
+ import { ElementType } from "react";
4
+ export interface HairlineOwnProps {
5
+ /** Default `horizontal`. A vertical hairline takes the height of its row. */
6
+ orientation?: 'horizontal' | 'vertical';
7
+ /**
8
+ * Default true: a visual rhythm only, hidden from assistive tech. Set false when it separates two sections in
9
+ * meaning (then it is announced as a separator).
10
+ */
11
+ decorative?: boolean;
12
+ }
13
+ export type HairlineProps<E extends ElementType = 'hr'> = PolymorphicProps<E, HairlineOwnProps>;
14
+ /** A 1px line in the `line` colour, to separate groups where space alone is not enough. */
15
+ export declare function Hairline<E extends ElementType = 'hr'>(props: HairlineProps<E>): import("react").JSX.Element;
16
+ //# sourceMappingURL=Hairline.d.ts.map
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { cx } from "../utils/src/index.js";
3
+ import { useAnimationRoot } from "../internal/animation.js";
4
+ import { useCss, useThemeProps } from "../internal/styled.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ // src/Hairline/Hairline.tsx
7
+ /** A 1px line in the `line` colour, to separate groups where space alone is not enough. */
8
+ function Hairline(props) {
9
+ const { as, css, className, orientation = "horizontal", decorative = true, ...rest } = useThemeProps("Hairline", props);
10
+ const Root = as ?? "hr";
11
+ const styled = useCss("Hairline", "root", css);
12
+ const root = useAnimationRoot(rest);
13
+ return /* @__PURE__ */ jsxs(Fragment, { children: [styled.style, /* @__PURE__ */ jsx(Root, {
14
+ className: cx("slurp-hairline", styled.className, className),
15
+ "data-orientation": orientation,
16
+ "aria-hidden": decorative || void 0,
17
+ "aria-orientation": !decorative && orientation === "vertical" ? "vertical" : void 0,
18
+ ...root
19
+ })] });
20
+ }
21
+ export { Hairline };
22
+
23
+ //# sourceMappingURL=Hairline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hairline.js","names":[],"sources":["../../src/Hairline/Hairline.tsx"],"sourcesContent":["import { cx } from '@slurp-ui/utils';\nimport type { ElementType } from 'react';\n\nimport { useAnimationRoot } from '../internal/animation';\nimport { useCss, useThemeProps } from '../internal/styled';\nimport type { PolymorphicProps } from '../lib/polymorphic';\n\nexport interface HairlineOwnProps {\n /** Default `horizontal`. A vertical hairline takes the height of its row. */\n orientation?: 'horizontal' | 'vertical';\n /**\n * Default true: a visual rhythm only, hidden from assistive tech. Set false when it separates two sections in\n * meaning (then it is announced as a separator).\n */\n decorative?: boolean;\n}\n\nexport type HairlineProps<E extends ElementType = 'hr'> = PolymorphicProps<E, HairlineOwnProps>;\n\n/** A 1px line in the `line` colour, to separate groups where space alone is not enough. */\nexport function Hairline<E extends ElementType = 'hr'>(props: HairlineProps<E>) {\n const {\n as,\n css,\n className,\n orientation = 'horizontal',\n decorative = true,\n ...rest\n } = useThemeProps('Hairline', props as HairlineProps);\n const Root = (as ?? 'hr') as ElementType;\n const styled = useCss('Hairline', 'root', css);\n const root = useAnimationRoot(rest);\n return (\n <>\n {styled.style}\n <Root\n className={cx('slurp-hairline', styled.className, className)}\n data-orientation={orientation}\n aria-hidden={decorative || undefined}\n aria-orientation={!decorative && orientation === 'vertical' ? 'vertical' : undefined}\n {...root}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;AAoBA,SAAgB,SAAuC,OAAyB;CAC9E,MAAM,EACJ,IACA,KACA,WACA,cAAc,cACd,aAAa,MACb,GAAG,SACD,cAAc,YAAY,KAAsB;CACpD,MAAM,OAAQ,MAAM;CACpB,MAAM,SAAS,OAAO,YAAY,QAAQ,GAAG;CAC7C,MAAM,OAAO,iBAAiB,IAAI;CAClC,OACE,qBAAA,UAAA,EAAA,UAAA,CACG,OAAO,OACR,oBAAC,MAAD;EACE,WAAW,GAAG,kBAAkB,OAAO,WAAW,SAAS;EAC3D,oBAAkB;EAClB,eAAa,cAAc,KAAA;EAC3B,oBAAkB,CAAC,cAAc,gBAAgB,aAAa,aAAa,KAAA;EAC3E,GAAI;CACL,CAAA,CACD,EAAA,CAAA;AAEN"}
@@ -0,0 +1,3 @@
1
+
2
+ import { Hairline, HairlineProps } from "./Hairline.js";
3
+ export { Hairline, type HairlineProps, Hairline as default };
@@ -0,0 +1,2 @@
1
+
2
+ export { Hairline, Hairline as default } from "./Hairline.js";
package/dist/Hint/Hint.js CHANGED
@@ -7,6 +7,14 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  // src/Hint/Hint.tsx
8
8
  const GAP = 8;
9
9
  const EDGE = 8;
10
+ /** After a hint closes, the next one within this window (ms) shows at once and without its entrance. */
11
+ const WARM_MS = 300;
12
+ /** Shared by every Hint: moving along a row of icons, only the first hint waits. */
13
+ const warm = {
14
+ open: 0,
15
+ until: 0
16
+ };
17
+ const isWarm = () => warm.open > 0 || Date.now() < warm.until;
10
18
  /**
11
19
  * Tooltip: shows on hover (after `delay`) and on focus, hides on Escape, blur or leave; it stays while the pointer is
12
20
  * over it (WCAG 1.4.13). Linked to the trigger with aria-describedby. Rendered in the top layer (popover).
@@ -15,6 +23,7 @@ function Hint(props) {
15
23
  const { content, children, placement = "top", delay = 400, className, css } = useThemeProps("Hint", props);
16
24
  const id = useId();
17
25
  const [open, setOpen] = useState(false);
26
+ const [instant, setInstant] = useState(false);
18
27
  const [side, setSide] = useState(placement);
19
28
  const trigger = useRef(null);
20
29
  const tip = useRef(null);
@@ -27,13 +36,20 @@ function Hint(props) {
27
36
  clearTimeout(timer.current);
28
37
  timer.current = setTimeout(fn, ms);
29
38
  };
30
- const show = (now) => later(() => setOpen(true), now ? 0 : delay);
39
+ const show = (now) => {
40
+ const skip = isWarm();
41
+ later(() => {
42
+ setInstant(skip);
43
+ setOpen(true);
44
+ }, now || skip ? 0 : delay);
45
+ };
31
46
  const hide = () => later(() => setOpen(false), 100);
32
47
  useEffect(() => () => clearTimeout(timer.current), []);
33
48
  useLayoutEffect(() => {
34
49
  const el = tip.current;
35
50
  const anchor = trigger.current;
36
51
  if (!open || !el || !anchor) return;
52
+ warm.open++;
37
53
  el.showPopover?.();
38
54
  const place = () => {
39
55
  const a = anchor.getBoundingClientRect();
@@ -60,6 +76,8 @@ function Hint(props) {
60
76
  removeEventListener("scroll", place, true);
61
77
  removeEventListener("resize", place);
62
78
  el.hidePopover?.();
79
+ warm.open--;
80
+ warm.until = Date.now() + WARM_MS;
63
81
  };
64
82
  }, [open, placement]);
65
83
  const triggerElement = isValidElement(child) ? cloneElement(child, {
@@ -92,6 +110,7 @@ function Hint(props) {
92
110
  popover: "manual",
93
111
  className: cx("slurp-hint", styled.className, className),
94
112
  "data-open": open || void 0,
113
+ "data-instant": open && instant || void 0,
95
114
  "data-side": side,
96
115
  onPointerEnter: () => clearTimeout(timer.current),
97
116
  onPointerLeave: hide,