@abuzareal/contour-ui 0.1.2 → 0.2.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 (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CODE_OF_CONDUCT.md +5 -0
  3. package/CONTRIBUTING.md +15 -0
  4. package/NEXTJS.md +51 -0
  5. package/README.md +58 -6
  6. package/RELEASING.md +14 -40
  7. package/SECURITY.md +1 -1
  8. package/dist/components/hero/SceneBoundary.js +1 -0
  9. package/dist/components/hero/Sculpture.js +6 -4
  10. package/dist/components/three/ObjectStudy.js +7 -3
  11. package/dist/components/ui/Alert.js +1 -0
  12. package/dist/components/ui/BrandMark.js +1 -0
  13. package/dist/components/ui/Checkbox.js +1 -0
  14. package/dist/components/ui/CountUp.js +1 -0
  15. package/dist/components/ui/DataTable.js +1 -0
  16. package/dist/components/ui/Dialog.js +1 -0
  17. package/dist/components/ui/DropdownMenu.d.ts +7 -1
  18. package/dist/components/ui/DropdownMenu.js +62 -14
  19. package/dist/components/ui/FlipCard.js +1 -0
  20. package/dist/components/ui/Magnetic.js +1 -0
  21. package/dist/components/ui/Pagination.js +1 -0
  22. package/dist/components/ui/Popover.d.ts +4 -1
  23. package/dist/components/ui/Popover.js +7 -5
  24. package/dist/components/ui/RadioGroup.js +1 -0
  25. package/dist/components/ui/Reveal.js +1 -0
  26. package/dist/components/ui/ScrollProgress.js +1 -0
  27. package/dist/components/ui/SegmentedControl.js +1 -0
  28. package/dist/components/ui/SelectField.d.ts +11 -1
  29. package/dist/components/ui/SelectField.js +6 -4
  30. package/dist/components/ui/Slider.js +1 -0
  31. package/dist/components/ui/Switch.js +1 -0
  32. package/dist/components/ui/Tabs.d.ts +4 -1
  33. package/dist/components/ui/Tabs.js +12 -5
  34. package/dist/components/ui/Tag.js +1 -0
  35. package/dist/components/ui/TextArea.d.ts +8 -1
  36. package/dist/components/ui/TextArea.js +21 -7
  37. package/dist/components/ui/TextField.d.ts +10 -1
  38. package/dist/components/ui/TextField.js +17 -6
  39. package/dist/components/ui/ThemeToggle.js +1 -0
  40. package/dist/components/ui/TiltCard.js +1 -0
  41. package/dist/components/ui/ToastProvider.js +1 -0
  42. package/dist/components/ui/Tooltip.js +1 -0
  43. package/dist/fonts/dm-mono-LICENSE.txt +93 -0
  44. package/dist/fonts/dm-mono-latin-400-normal.woff2 +0 -0
  45. package/dist/fonts/dm-sans-LICENSE.txt +93 -0
  46. package/dist/fonts/dm-sans-latin-wght-normal.woff2 +0 -0
  47. package/dist/fonts/space-grotesk-LICENSE.txt +93 -0
  48. package/dist/fonts/space-grotesk-latin-wght-normal.woff2 +0 -0
  49. package/dist/fonts-latin.css +3 -3
  50. package/dist/hooks/useClipboardCopy.js +1 -0
  51. package/dist/hooks/useControlRef.d.ts +6 -0
  52. package/dist/hooks/useControlRef.js +13 -0
  53. package/dist/hooks/useDismiss.js +1 -0
  54. package/dist/hooks/useFormReset.d.ts +3 -0
  55. package/dist/hooks/useFormReset.js +31 -0
  56. package/dist/hooks/useHeaderScroll.js +1 -0
  57. package/dist/hooks/useIdleTrigger.js +1 -0
  58. package/dist/hooks/useInitialHashScroll.js +1 -0
  59. package/dist/hooks/useMobileMenu.js +1 -0
  60. package/dist/hooks/useMotionPreference.js +1 -0
  61. package/dist/hooks/useOpenState.d.ts +2 -0
  62. package/dist/hooks/useOpenState.js +15 -0
  63. package/dist/hooks/usePrintPreparation.js +1 -0
  64. package/dist/hooks/useScrollSpy.js +1 -0
  65. package/dist/hooks/useSmoothScroll.js +1 -0
  66. package/dist/hooks/useTheme.js +1 -0
  67. package/dist/hooks/useThreeStage.d.ts +4 -0
  68. package/dist/hooks/useThreeStage.js +165 -128
  69. package/dist/hooks/useToast.js +1 -0
  70. package/package.json +17 -8
@@ -10,4 +10,14 @@ export type SelectFieldProps = SelectHTMLAttributes<HTMLSelectElement> & {
10
10
  error?: string;
11
11
  placeholder?: string;
12
12
  };
13
- export default function SelectField({ id: providedId, "aria-describedby": describedBy, label, options, hint, error, placeholder, ...rest }: SelectFieldProps): import("react").JSX.Element;
13
+ declare const SelectField: import("react").ForwardRefExoticComponent<SelectHTMLAttributes<HTMLSelectElement> & {
14
+ label: string;
15
+ options: {
16
+ value: string;
17
+ label: string;
18
+ }[];
19
+ hint?: string;
20
+ error?: string;
21
+ placeholder?: string;
22
+ } & import("react").RefAttributes<HTMLSelectElement>>;
23
+ export default SelectField;
@@ -1,13 +1,15 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Native select styled as an underlined field with a chevron. */
3
- import { useId } from "react";
4
+ import { forwardRef, useId } from "react";
4
5
  import { ChevronDown } from "lucide-react";
5
6
  import { fieldDescribedBy } from "../../lib/a11y.js";
6
7
  import Field from "./Field.js";
7
- export default function SelectField({ id: providedId, "aria-describedby": describedBy, label, options, hint, error, placeholder, ...rest }) {
8
+ const SelectField = forwardRef(function SelectField({ id: providedId, "aria-describedby": describedBy, label, options, hint, error, placeholder, ...rest }, ref) {
8
9
  const generatedId = useId();
9
10
  const id = providedId ?? generatedId;
10
- return (_jsx(Field, { id: id, label: label, hint: hint, error: error, required: rest.required, disabled: rest.disabled, children: _jsxs("div", { className: "field-control field-select", children: [_jsxs("select", { ...rest, id: id, "aria-invalid": error ? true : undefined, "aria-describedby": [describedBy, fieldDescribedBy(id, hint, error)]
11
+ return (_jsx(Field, { id: id, label: label, hint: hint, error: error, required: rest.required, disabled: rest.disabled, children: _jsxs("div", { className: "field-control field-select", children: [_jsxs("select", { ...rest, ref: ref, id: id, "aria-invalid": error ? true : rest["aria-invalid"], "aria-describedby": [describedBy, fieldDescribedBy(id, hint, error)]
11
12
  .filter(Boolean)
12
13
  .join(" ") || undefined, children: [placeholder && (_jsx("option", { value: "", disabled: true, children: placeholder })), options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value)))] }), _jsx(ChevronDown, { className: "field-chevron", size: 16, "aria-hidden": "true" })] }) }));
13
- }
14
+ });
15
+ export default SelectField;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Range slider with a filled acid track and a live value readout. */
3
4
  import { useId } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** On/off switch (role="switch") with a pill track that fills acid when on. */
3
4
  import { useId } from "react";
@@ -9,5 +9,8 @@ export type TabsProps = {
9
9
  label: string;
10
10
  tabs: TabItem[];
11
11
  defaultTabId?: string;
12
+ /** Controlled selection. The caller must update this after onTabChange. */
13
+ activeTabId?: string;
14
+ onTabChange?: (id: string) => void;
12
15
  };
13
- export default function Tabs({ label, tabs, defaultTabId }: TabsProps): import("react").JSX.Element;
16
+ export default function Tabs({ label, tabs, defaultTabId, activeTabId, onTabChange, }: TabsProps): import("react").JSX.Element;
@@ -1,13 +1,14 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Tabs with a sliding underline indicator, arrow-key navigation, and linked panels. */
3
4
  import { useId, useLayoutEffect, useRef, useState, } from "react";
4
5
  import { nextIndexForKey } from "../../lib/keyboard.js";
5
- export default function Tabs({ label, tabs, defaultTabId }) {
6
+ export default function Tabs({ label, tabs, defaultTabId, activeTabId, onTabChange, }) {
6
7
  const baseId = useId();
7
8
  const [activeId, setActiveId] = useState(defaultTabId ?? tabs[0]?.id ?? "");
8
9
  const [indicator, setIndicator] = useState({ left: 0, width: 0 });
9
10
  const tabRefs = useRef([]);
10
- const activeIndex = Math.max(0, tabs.findIndex((tab) => tab.id === activeId));
11
+ const activeIndex = Math.max(0, tabs.findIndex((tab) => tab.id === (activeTabId ?? activeId)));
11
12
  const selectedId = tabs[activeIndex]?.id;
12
13
  useLayoutEffect(() => {
13
14
  const measure = () => {
@@ -18,9 +19,11 @@ export default function Tabs({ label, tabs, defaultTabId }) {
18
19
  measure();
19
20
  window.addEventListener("resize", measure);
20
21
  return () => window.removeEventListener("resize", measure);
21
- }, [activeIndex]);
22
+ }, [activeIndex, tabs]);
22
23
  const select = (index) => {
23
- setActiveId(tabs[index].id);
24
+ if (activeTabId === undefined)
25
+ setActiveId(tabs[index].id);
26
+ onTabChange?.(tabs[index].id);
24
27
  tabRefs.current[index]?.focus();
25
28
  };
26
29
  return (_jsxs("div", { className: "tabs", children: [_jsx("div", { className: "tabs-list", role: "tablist", "aria-label": label, style: {
@@ -30,7 +33,11 @@ export default function Tabs({ label, tabs, defaultTabId }) {
30
33
  const selected = tab.id === selectedId;
31
34
  return (_jsx("button", { ref: (element) => {
32
35
  tabRefs.current[index] = element;
33
- }, id: `${baseId}-tab-${tab.id}`, type: "button", role: "tab", "aria-selected": selected, "aria-controls": `${baseId}-panel-${tab.id}`, tabIndex: selected ? 0 : -1, className: "tabs-tab", onClick: () => setActiveId(tab.id), onKeyDown: (event) => {
36
+ }, id: `${baseId}-tab-${tab.id}`, type: "button", role: "tab", "aria-selected": selected, "aria-controls": `${baseId}-panel-${tab.id}`, tabIndex: selected ? 0 : -1, className: "tabs-tab", onClick: () => {
37
+ if (activeTabId === undefined)
38
+ setActiveId(tab.id);
39
+ onTabChange?.(tab.id);
40
+ }, onKeyDown: (event) => {
34
41
  const next = nextIndexForKey(event.key, index, tabs.length);
35
42
  if (next === null)
36
43
  return;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Mono "+ tag" label (as in project notes); becomes a removable chip when given onRemove. */
3
4
  import { X } from "lucide-react";
@@ -7,4 +7,11 @@ export type TextAreaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
7
7
  /** Grows with its content instead of scrolling. */
8
8
  autoResize?: boolean;
9
9
  };
10
- export default function TextArea({ id: providedId, "aria-describedby": describedBy, label, hint, error, autoResize, maxLength, onChange, rows, ...rest }: TextAreaProps): import("react").JSX.Element;
10
+ declare const TextArea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & {
11
+ label: string;
12
+ hint?: string;
13
+ error?: string;
14
+ /** Grows with its content instead of scrolling. */
15
+ autoResize?: boolean;
16
+ } & import("react").RefAttributes<HTMLTextAreaElement>>;
17
+ export default TextArea;
@@ -1,12 +1,15 @@
1
+ "use client";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  /** Multi-line text input with optional auto-resize and character counter. */
3
- import { useId, useLayoutEffect, useRef, useState, } from "react";
4
+ import { forwardRef, useId, useLayoutEffect, useState, } from "react";
4
5
  import { fieldDescribedBy } from "../../lib/a11y.js";
5
6
  import Field from "./Field.js";
6
- export default function TextArea({ id: providedId, "aria-describedby": describedBy, label, hint, error, autoResize = false, maxLength, onChange, rows = 3, ...rest }) {
7
+ import useControlRef from "../../hooks/useControlRef.js";
8
+ import useFormReset from "../../hooks/useFormReset.js";
9
+ const TextArea = forwardRef(function TextArea({ id: providedId, "aria-describedby": describedBy, label, hint, error, autoResize = false, maxLength, onChange, rows = 3, ...rest }, forwardedRef) {
7
10
  const generatedId = useId();
8
11
  const id = providedId ?? generatedId;
9
- const ref = useRef(null);
12
+ const { ref, attach } = useControlRef(forwardedRef);
10
13
  const [length, setLength] = useState(String(rest.value ?? rest.defaultValue ?? "").length);
11
14
  const fitContent = () => {
12
15
  const element = ref.current;
@@ -16,13 +19,24 @@ export default function TextArea({ id: providedId, "aria-describedby": described
16
19
  element.style.height = `${element.scrollHeight}px`;
17
20
  };
18
21
  useLayoutEffect(fitContent);
19
- return (_jsx(Field, { id: id, label: label, hint: hint, error: error, required: rest.required, disabled: rest.disabled, counter: maxLength
22
+ useFormReset(ref, () => {
23
+ setLength(ref.current?.value.length ?? 0);
24
+ fitContent();
25
+ });
26
+ return (_jsx(Field, { id: id, label: label, hint: hint, error: error, required: rest.required, disabled: rest.disabled, counter: maxLength !== undefined
20
27
  ? `${rest.value !== undefined ? String(rest.value).length : length}/${maxLength}`
21
- : undefined, children: _jsx("div", { className: "field-control", children: _jsx("textarea", { ...rest, ref: ref, id: id, rows: rows, maxLength: maxLength, "data-auto-resize": autoResize || undefined, "aria-invalid": error ? true : undefined, "aria-describedby": [describedBy, fieldDescribedBy(id, hint, error)]
28
+ : undefined, children: _jsx("div", { className: "field-control", children: _jsx("textarea", { ...rest, ref: attach, id: id, rows: rows, maxLength: maxLength, "data-auto-resize": autoResize || undefined, "aria-invalid": error ? true : rest["aria-invalid"], "aria-describedby": [describedBy, fieldDescribedBy(id, hint, error)]
22
29
  .filter(Boolean)
23
- .join(" ") || undefined, onChange: (event) => {
30
+ .join(" ") || undefined,
31
+ // Native input also runs when React deduplicates a repeated value after form.reset().
32
+ onInput: (event) => {
33
+ setLength(event.currentTarget.value.length);
34
+ fitContent();
35
+ rest.onInput?.(event);
36
+ }, onChange: (event) => {
24
37
  setLength(event.target.value.length);
25
38
  fitContent();
26
39
  onChange?.(event);
27
40
  } }) }) }));
28
- }
41
+ });
42
+ export default TextArea;
@@ -9,4 +9,13 @@ export type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {
9
9
  /** Content after the input, e.g. a unit or an icon button. */
10
10
  trailing?: ReactNode;
11
11
  };
12
- export default function TextField({ id: providedId, "aria-describedby": describedBy, label, hint, error, hideLabel, leadingIcon, trailing, maxLength, onChange, ...rest }: TextFieldProps): import("react").JSX.Element;
12
+ declare const TextField: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
13
+ label: string;
14
+ hint?: string;
15
+ error?: string;
16
+ hideLabel?: boolean;
17
+ leadingIcon?: ReactNode;
18
+ /** Content after the input, e.g. a unit or an icon button. */
19
+ trailing?: ReactNode;
20
+ } & import("react").RefAttributes<HTMLInputElement>>;
21
+ export default TextField;
@@ -1,18 +1,29 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Single-line text input with underline styling, optional icon/adornment, and character counter. */
3
- import { useId, useState, } from "react";
4
+ import { forwardRef, useId, useState, } from "react";
4
5
  import { fieldDescribedBy } from "../../lib/a11y.js";
5
6
  import Field from "./Field.js";
6
- export default function TextField({ id: providedId, "aria-describedby": describedBy, label, hint, error, hideLabel, leadingIcon, trailing, maxLength, onChange, ...rest }) {
7
+ import useControlRef from "../../hooks/useControlRef.js";
8
+ import useFormReset from "../../hooks/useFormReset.js";
9
+ const TextField = forwardRef(function TextField({ id: providedId, "aria-describedby": describedBy, label, hint, error, hideLabel, leadingIcon, trailing, maxLength, onChange, ...rest }, forwardedRef) {
10
+ const { ref, attach } = useControlRef(forwardedRef);
7
11
  const generatedId = useId();
8
12
  const id = providedId ?? generatedId;
9
13
  const [length, setLength] = useState(String(rest.value ?? rest.defaultValue ?? "").length);
10
- return (_jsx(Field, { id: id, label: label, hint: hint, error: error, required: rest.required, hideLabel: hideLabel, disabled: rest.disabled, counter: maxLength
14
+ useFormReset(ref, () => setLength(ref.current?.value.length ?? 0));
15
+ return (_jsx(Field, { id: id, label: label, hint: hint, error: error, required: rest.required, hideLabel: hideLabel, disabled: rest.disabled, counter: maxLength !== undefined
11
16
  ? `${rest.value !== undefined ? String(rest.value).length : length}/${maxLength}`
12
- : undefined, children: _jsxs("div", { className: "field-control", children: [leadingIcon && _jsx("span", { className: "field-icon", children: leadingIcon }), _jsx("input", { ...rest, id: id, maxLength: maxLength, "aria-invalid": error ? true : undefined, "aria-describedby": [describedBy, fieldDescribedBy(id, hint, error)]
17
+ : undefined, children: _jsxs("div", { className: "field-control", children: [leadingIcon && _jsx("span", { className: "field-icon", children: leadingIcon }), _jsx("input", { ...rest, ref: attach, id: id, maxLength: maxLength, "aria-invalid": error ? true : rest["aria-invalid"], "aria-describedby": [describedBy, fieldDescribedBy(id, hint, error)]
13
18
  .filter(Boolean)
14
- .join(" ") || undefined, onChange: (event) => {
19
+ .join(" ") || undefined,
20
+ // Native input also runs when React deduplicates a repeated value after form.reset().
21
+ onInput: (event) => {
22
+ setLength(event.currentTarget.value.length);
23
+ rest.onInput?.(event);
24
+ }, onChange: (event) => {
15
25
  setLength(event.target.value.length);
16
26
  onChange?.(event);
17
27
  } }), trailing && _jsx("span", { className: "field-trailing", children: trailing })] }) }));
18
- }
28
+ });
29
+ export default TextField;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Header button that switches between the light and dark themes. */
3
4
  import { Moon, Sun } from "lucide-react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Card that tilts in 3D toward a fine pointer with a moving glare highlight. */
3
4
  import { useRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Renders queued toasts in a polite live region; each auto-dismisses unless hovered or focused. */
3
4
  import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /** Ink tooltip shown on hover or focus, dismissible with Escape, described via aria-describedby. */
3
4
  import { cloneElement, useId, useState } from "react";
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-LightItalic.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-Regular.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-Italic.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-Medium.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono) DMMono-MediumItalic.ttf: Copyright 2020 The DM Mono Project Authors (https://www.github.com/googlefonts/dm-mono)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts) DMSans-Italic[opsz,wght].ttf: Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -4,7 +4,7 @@
4
4
  font-style: normal;
5
5
  font-display: swap;
6
6
  font-weight: 100 1000;
7
- src: url(@fontsource-variable/dm-sans/files/dm-sans-latin-wght-normal.woff2)
7
+ src: url("./fonts/dm-sans-latin-wght-normal.woff2")
8
8
  format("woff2-variations");
9
9
  unicode-range:
10
10
  U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
@@ -17,7 +17,7 @@
17
17
  font-style: normal;
18
18
  font-display: swap;
19
19
  font-weight: 300 700;
20
- src: url(@fontsource-variable/space-grotesk/files/space-grotesk-latin-wght-normal.woff2)
20
+ src: url("./fonts/space-grotesk-latin-wght-normal.woff2")
21
21
  format("woff2-variations");
22
22
  unicode-range:
23
23
  U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
@@ -30,6 +30,6 @@
30
30
  font-style: normal;
31
31
  font-display: swap;
32
32
  font-weight: 400;
33
- src: url(@fontsource/dm-mono/files/dm-mono-latin-400-normal.woff2)
33
+ src: url("./fonts/dm-mono-latin-400-normal.woff2")
34
34
  format("woff2");
35
35
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Copies text to the clipboard and reports the outcome, resetting after a few seconds. */
2
3
  import { useCallback, useEffect, useRef, useState } from "react";
3
4
  const resetDelay = 4000;
@@ -0,0 +1,6 @@
1
+ import { type ForwardedRef } from "react";
2
+ /** Expose the native control while retaining an internal ref for reset/size behavior. */
3
+ export default function useControlRef<T extends HTMLElement>(forwarded: ForwardedRef<T>): {
4
+ ref: import("react").MutableRefObject<T | null>;
5
+ attach: import("react").MutableRefObject<T | null>;
6
+ };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { useImperativeHandle, useRef } from "react";
3
+ /** Expose the native control while retaining an internal ref for reset/size behavior. */
4
+ export default function useControlRef(forwarded) {
5
+ const ref = useRef(null);
6
+ useImperativeHandle(forwarded, () => {
7
+ const element = ref.current;
8
+ if (!element)
9
+ throw new Error("The field control must be mounted before exposing its ref.");
10
+ return element;
11
+ });
12
+ return { ref, attach: ref };
13
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /** Calls onDismiss on Escape or a pointer press outside the container while `active`. */
2
3
  import { useEffect } from "react";
3
4
  export default function useDismiss(container, active, onDismiss) {
@@ -0,0 +1,3 @@
1
+ import { type RefObject } from "react";
2
+ /** Native reset fires before the browser restores default values. */
3
+ export default function useFormReset<T extends HTMLInputElement | HTMLTextAreaElement>(ref: RefObject<T | null>, sync: () => void): void;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { useEffect, useLayoutEffect, useRef } from "react";
3
+ /** Native reset fires before the browser restores default values. */
4
+ export default function useFormReset(ref, sync) {
5
+ const synchronize = useRef(sync);
6
+ useLayoutEffect(() => {
7
+ synchronize.current = sync;
8
+ });
9
+ useEffect(() => {
10
+ const element = ref.current;
11
+ if (!element)
12
+ return;
13
+ let timer;
14
+ const reset = (event) => {
15
+ if (!element.form || event.target !== element.form)
16
+ return;
17
+ clearTimeout(timer);
18
+ // A microtask can run before the reset default action for browser-originated
19
+ // events. A task observes the restored value and later preventDefault calls.
20
+ timer = setTimeout(() => {
21
+ if (!event.defaultPrevented)
22
+ synchronize.current();
23
+ }, 0);
24
+ };
25
+ element.ownerDocument.addEventListener("reset", reset, true);
26
+ return () => {
27
+ clearTimeout(timer);
28
+ element.ownerDocument.removeEventListener("reset", reset, true);
29
+ };
30
+ }, [ref]);
31
+ }