@nexub/react 4.3.0 → 4.4.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.
- package/accessibility.json +34 -1
- package/dist/components/FloatingInput/FloatingInput.d.ts +6 -0
- package/dist/components/FloatingInput/FloatingInput.js +30 -0
- package/dist/components/FloatingInput/index.d.ts +2 -0
- package/dist/components/FloatingInput/index.js +4 -0
- package/dist/components/ScrollProgress/ScrollProgress.d.ts +3 -0
- package/dist/components/ScrollProgress/ScrollProgress.js +8 -0
- package/dist/components/ScrollProgress/index.d.ts +2 -0
- package/dist/components/ScrollProgress/index.js +4 -0
- package/dist/components/SharedElement/SharedElement.d.ts +9 -0
- package/dist/components/SharedElement/SharedElement.js +21 -0
- package/dist/components/SharedElement/index.d.ts +2 -0
- package/dist/components/SharedElement/index.js +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -6
package/accessibility.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.4.0",
|
|
3
3
|
"standard": "WCAG 2.2 Level AA",
|
|
4
4
|
"method": {
|
|
5
5
|
"automated": "axe-core rules tagged wcag2a, wcag2aa, wcag21a, wcag21aa and wcag22aa, run on every Storybook story in light and dark on every pull request; a new violation fails the build.",
|
|
@@ -382,6 +382,17 @@
|
|
|
382
382
|
"keyboard": [],
|
|
383
383
|
"screenReader": []
|
|
384
384
|
},
|
|
385
|
+
{
|
|
386
|
+
"slug": "floating-input",
|
|
387
|
+
"name": "Floating Input",
|
|
388
|
+
"package": "@nexub/react",
|
|
389
|
+
"automated": "pass",
|
|
390
|
+
"exceptions": [],
|
|
391
|
+
"keyboard": [],
|
|
392
|
+
"screenReader": [
|
|
393
|
+
"A real `<label>` tied to the input, so the name never disappears."
|
|
394
|
+
]
|
|
395
|
+
},
|
|
385
396
|
{
|
|
386
397
|
"slug": "form-field",
|
|
387
398
|
"name": "Form Field",
|
|
@@ -730,6 +741,17 @@
|
|
|
730
741
|
"keyboard": [],
|
|
731
742
|
"screenReader": []
|
|
732
743
|
},
|
|
744
|
+
{
|
|
745
|
+
"slug": "scroll-progress",
|
|
746
|
+
"name": "Scroll Progress",
|
|
747
|
+
"package": "@nexub/react",
|
|
748
|
+
"automated": "pass",
|
|
749
|
+
"exceptions": [],
|
|
750
|
+
"keyboard": [],
|
|
751
|
+
"screenReader": [
|
|
752
|
+
"Decorative (`aria-hidden`); hidden under reduced motion and where scroll-driven animations are not supported."
|
|
753
|
+
]
|
|
754
|
+
},
|
|
733
755
|
{
|
|
734
756
|
"slug": "search-input",
|
|
735
757
|
"name": "Search Input",
|
|
@@ -766,6 +788,17 @@
|
|
|
766
788
|
"keyboard": [],
|
|
767
789
|
"screenReader": []
|
|
768
790
|
},
|
|
791
|
+
{
|
|
792
|
+
"slug": "shared-element",
|
|
793
|
+
"name": "Shared Element",
|
|
794
|
+
"package": "@nexub/react",
|
|
795
|
+
"automated": "pass",
|
|
796
|
+
"exceptions": [],
|
|
797
|
+
"keyboard": [],
|
|
798
|
+
"screenReader": [
|
|
799
|
+
"Visual only: run the change in `startViewTransition()` and move focus to the new view as usual."
|
|
800
|
+
]
|
|
801
|
+
},
|
|
769
802
|
{
|
|
770
803
|
"slug": "sheet",
|
|
771
804
|
"name": "Sheet",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface FloatingInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'placeholder'> {
|
|
3
|
+
/** Always visible: inside the field when empty, above the value otherwise. */
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const FloatingInput: React.ForwardRefExoticComponent<FloatingInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
const FloatingInput = React.forwardRef(
|
|
5
|
+
({ label, id, className, ...props }, ref) => {
|
|
6
|
+
const auto = React.useId();
|
|
7
|
+
const inputId = id ?? auto;
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("nx-float-field relative", className), children: [
|
|
9
|
+
/* @__PURE__ */ jsx(
|
|
10
|
+
"input",
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
id: inputId,
|
|
14
|
+
placeholder: " ",
|
|
15
|
+
className: cn(
|
|
16
|
+
"h-14 w-full rounded-shape-field border border-[var(--color-outline)] bg-[var(--color-surface)] px-4 pt-5 text-body-md text-[var(--color-on-surface)]",
|
|
17
|
+
"outline-none transition-[border-color,box-shadow] focus-visible:border-[var(--color-primary)] focus-visible:shadow-[0_0_0_1px_var(--color-primary)]",
|
|
18
|
+
"aria-[invalid=true]:border-[var(--color-error)] disabled:cursor-not-allowed disabled:border-[var(--color-outline-variant)] disabled:text-[var(--color-text-disabled)]"
|
|
19
|
+
),
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ jsx("label", { htmlFor: inputId, children: label })
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
FloatingInput.displayName = "FloatingInput";
|
|
28
|
+
export {
|
|
29
|
+
FloatingInput
|
|
30
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
const ScrollProgress = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, "aria-hidden": "true", className: cn("nx-scroll-progress", className), ...props }));
|
|
5
|
+
ScrollProgress.displayName = "ScrollProgress";
|
|
6
|
+
export {
|
|
7
|
+
ScrollProgress
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SharedElementProps {
|
|
3
|
+
/** Same name on both sides of the transition, e.g. `avatar-${user.id}`. */
|
|
4
|
+
name: string;
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
}
|
|
7
|
+
/** Turns any string into a valid <custom-ident> for view-transition-name. */
|
|
8
|
+
export declare const transitionName: (name: string) => string;
|
|
9
|
+
export declare function SharedElement({ name, children }: SharedElementProps): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
const transitionName = (name) => `nx-${name.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
6
|
+
function SharedElement({ name, children }) {
|
|
7
|
+
const ref = React.useRef(null);
|
|
8
|
+
React.useLayoutEffect(() => {
|
|
9
|
+
const el = ref.current;
|
|
10
|
+
if (!el) return;
|
|
11
|
+
el.style.setProperty("view-transition-name", transitionName(name));
|
|
12
|
+
return () => {
|
|
13
|
+
el.style.removeProperty("view-transition-name");
|
|
14
|
+
};
|
|
15
|
+
}, [name]);
|
|
16
|
+
return /* @__PURE__ */ jsx(Slot, { ref, children });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
SharedElement,
|
|
20
|
+
transitionName
|
|
21
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,12 @@ export type { NumberInputProps } from './components/NumberInput/index.js';
|
|
|
36
36
|
export { MoneyInput } from './components/MoneyInput/index.js';
|
|
37
37
|
export type { MoneyInputProps } from './components/MoneyInput/index.js';
|
|
38
38
|
export { Amount } from './components/Amount/index.js';
|
|
39
|
+
export { SharedElement, transitionName } from './components/SharedElement/index.js';
|
|
40
|
+
export type { SharedElementProps } from './components/SharedElement/index.js';
|
|
41
|
+
export { ScrollProgress } from './components/ScrollProgress/index.js';
|
|
42
|
+
export type { ScrollProgressProps } from './components/ScrollProgress/index.js';
|
|
43
|
+
export { FloatingInput } from './components/FloatingInput/index.js';
|
|
44
|
+
export type { FloatingInputProps } from './components/FloatingInput/index.js';
|
|
39
45
|
export { Celebrate } from './components/Celebrate/index.js';
|
|
40
46
|
export type { CelebrateProps } from './components/Celebrate/index.js';
|
|
41
47
|
export { Aurora } from './components/Aurora/index.js';
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,9 @@ import { Textarea, textareaVariants } from "./components/Textarea/index.js";
|
|
|
21
21
|
import { NumberInput } from "./components/NumberInput/index.js";
|
|
22
22
|
import { MoneyInput } from "./components/MoneyInput/index.js";
|
|
23
23
|
import { Amount } from "./components/Amount/index.js";
|
|
24
|
+
import { SharedElement, transitionName } from "./components/SharedElement/index.js";
|
|
25
|
+
import { ScrollProgress } from "./components/ScrollProgress/index.js";
|
|
26
|
+
import { FloatingInput } from "./components/FloatingInput/index.js";
|
|
24
27
|
import { Celebrate } from "./components/Celebrate/index.js";
|
|
25
28
|
import { Aurora } from "./components/Aurora/index.js";
|
|
26
29
|
import { BarChart, LineChart, DonutChart, Sparkline, ChartLegend, niceMax, niceDomain } from "./components/Chart/index.js";
|
|
@@ -164,6 +167,7 @@ export {
|
|
|
164
167
|
Flag,
|
|
165
168
|
Flex,
|
|
166
169
|
Float,
|
|
170
|
+
FloatingInput,
|
|
167
171
|
FormError,
|
|
168
172
|
FormField,
|
|
169
173
|
GradientDivider,
|
|
@@ -204,11 +208,13 @@ export {
|
|
|
204
208
|
Reveal,
|
|
205
209
|
Scale,
|
|
206
210
|
ScrollArea,
|
|
211
|
+
ScrollProgress,
|
|
207
212
|
SearchInput,
|
|
208
213
|
Section,
|
|
209
214
|
SegmentedControl,
|
|
210
215
|
Select,
|
|
211
216
|
Separator,
|
|
217
|
+
SharedElement,
|
|
212
218
|
Sheet,
|
|
213
219
|
Sidebar,
|
|
214
220
|
Skeleton,
|
|
@@ -274,6 +280,7 @@ export {
|
|
|
274
280
|
textareaVariants,
|
|
275
281
|
toast,
|
|
276
282
|
toggleVariants,
|
|
283
|
+
transitionName,
|
|
277
284
|
useControllableState,
|
|
278
285
|
useDisclosure,
|
|
279
286
|
useIsomorphicLayoutEffect,
|