@kazee-ds/react 0.5.0 → 0.5.2
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/README.md +28 -0
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/types/Toast.d.ts +8 -2
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @kazee-ds/react
|
|
2
|
+
|
|
3
|
+
Accessible Kazee React components, including Toast, built on React Aria Components. Requires React/React DOM 19+ and ESM.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Public npm installation requires no read token or login. Preserve the application's package manager and lockfile.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install --save-exact @kazee-ds/react@0.5.2 @kazee-ds/styles@0.5.2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Button } from '@kazee-ds/react';
|
|
17
|
+
import '@kazee-ds/styles/index.css';
|
|
18
|
+
|
|
19
|
+
export function Example() {
|
|
20
|
+
return <Button onPress={() => console.log('Saved')}>Save</Button>;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Import the stylesheet once globally. React/Vue/styles are version `0.5.2`; tokens and consumer lint remain `0.4.1`. Check the [version matrix](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/versions.md) for release availability. Read installed public types before using an API from a newer Storybook or MCP catalog.
|
|
25
|
+
|
|
26
|
+
[Installation](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/installation.md) ? [Public Storybook](https://kazee-design-system-023417.gitlab.io) ? [Consumer lint](https://gitlab.com/kazee.indonesia/kazee-design-system/-/blob/main/docs/consumer-lint.md)
|
|
27
|
+
|
|
28
|
+
License: UNLICENSED. Public distribution does not grant an open-source license.
|
package/dist/index.js
CHANGED
|
@@ -3056,7 +3056,7 @@ var QueueAdapter = class extends UNSTABLE_ToastQueue {
|
|
|
3056
3056
|
}
|
|
3057
3057
|
};
|
|
3058
3058
|
var ToastContext = createContext(null);
|
|
3059
|
-
function ToastProvider({ children, manager: suppliedManager, placement = "bottom-end", label = "Notifikasi / Notifications", closeLabel = "Tutup notifikasi / Close notification", hotkey = ["Alt", "t"], dir = "ltr", showProgress = false, swipeThreshold = 50, renderToast }) {
|
|
3059
|
+
function ToastProvider({ children, manager: suppliedManager, placement = "bottom-end", label = "Notifikasi / Notifications", closeLabel = "Tutup notifikasi / Close notification", hotkey = ["Alt", "t"], dir = "ltr", showProgress = false, showCloseButton = false, swipeThreshold = 50, renderToast }) {
|
|
3060
3060
|
const [ownedManager] = useState(() => createToastManager());
|
|
3061
3061
|
const manager = suppliedManager ?? ownedManager;
|
|
3062
3062
|
const queue = useMemo(() => new QueueAdapter(manager), [manager]);
|
|
@@ -3186,6 +3186,7 @@ function ToastProvider({ children, manager: suppliedManager, placement = "bottom
|
|
|
3186
3186
|
placement,
|
|
3187
3187
|
dir,
|
|
3188
3188
|
showProgress,
|
|
3189
|
+
showCloseButton,
|
|
3189
3190
|
swipeThreshold,
|
|
3190
3191
|
restoreFocus: () => {
|
|
3191
3192
|
const next = region.current?.querySelector(".toast[data-state=\"open\"]");
|
|
@@ -3238,12 +3239,14 @@ function Indicator({ entry }) {
|
|
|
3238
3239
|
}), /* @__PURE__ */ jsx("path", { d: "M12 10v7m0-11v1" })] })
|
|
3239
3240
|
});
|
|
3240
3241
|
}
|
|
3241
|
-
function Toast({ entry, indicator, children, className }) {
|
|
3242
|
+
function Toast({ entry, indicator, children, className, showCloseButton: closeOverride, showProgress: progressOverride }) {
|
|
3242
3243
|
const actionDescriptionId = useId();
|
|
3243
3244
|
const cancelDescriptionId = useId();
|
|
3244
3245
|
const context = useContext(ToastContext);
|
|
3245
3246
|
if (!context) throw new Error("Toast must be used within a ToastProvider region.");
|
|
3246
|
-
const { manager, closeLabel, placement, dir,
|
|
3247
|
+
const { manager, closeLabel, placement, dir, swipeThreshold, restoreFocus } = context;
|
|
3248
|
+
const showCloseButton = closeOverride ?? context.showCloseButton;
|
|
3249
|
+
const showProgress = progressOverride ?? context.showProgress;
|
|
3247
3250
|
const ref = useRef(null);
|
|
3248
3251
|
const drag = useRef(null);
|
|
3249
3252
|
const [offset, setOffset] = useState(0);
|
|
@@ -3338,6 +3341,7 @@ function Toast({ entry, indicator, children, className }) {
|
|
|
3338
3341
|
className: `toast${className ? ` ${className}` : ""}`,
|
|
3339
3342
|
"data-toast-id": entry.id,
|
|
3340
3343
|
"data-tone": entry.tone,
|
|
3344
|
+
"data-has-close": showCloseButton || void 0,
|
|
3341
3345
|
"data-loading": entry.isLoading || void 0,
|
|
3342
3346
|
"data-state": entry.state,
|
|
3343
3347
|
"data-placement": placement,
|
|
@@ -3403,7 +3407,7 @@ function Toast({ entry, indicator, children, className }) {
|
|
|
3403
3407
|
})
|
|
3404
3408
|
]
|
|
3405
3409
|
}),
|
|
3406
|
-
/* @__PURE__ */ jsx(Button$5, {
|
|
3410
|
+
showCloseButton && /* @__PURE__ */ jsx(Button$5, {
|
|
3407
3411
|
slot: "close",
|
|
3408
3412
|
className: "toast__close",
|
|
3409
3413
|
"aria-label": closeLabel,
|