@datalayer/primer-addons 0.0.7 → 0.0.9

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/lib/App.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./App.css";
2
3
  declare const App: () => JSX.Element;
3
4
  export default App;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { FlashProps } from "@primer/react";
3
+ type CloseableFlashProps = FlashProps;
4
+ export declare const CloseableFlash: React.FC<CloseableFlashProps>;
5
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Box, Flash } from "@primer/react";
4
+ import { XIcon } from "@primer/octicons-react";
5
+ export const CloseableFlash = (props) => {
6
+ const [isVisible, setIsVisible] = useState(true);
7
+ const handleClose = () => {
8
+ setIsVisible(false);
9
+ };
10
+ if (!isVisible) {
11
+ return null;
12
+ }
13
+ return (_jsx(Flash, { ...props, children: _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [_jsx(Box, { children: props.children }), _jsx(Box, { onClick: handleClose, sx: { cursor: "pointer" }, children: _jsx(XIcon, { size: 20 }) })] }) }));
14
+ };
@@ -1,8 +1,8 @@
1
1
  interface CommonProps {
2
- name: string;
3
- id: string;
4
- min: number;
5
- max: number;
2
+ name?: string;
3
+ id?: string;
4
+ min?: number;
5
+ max?: number;
6
6
  label?: string;
7
7
  value?: number;
8
8
  displayValue?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
3
  import { useTheme, Box, CounterLabel, FormControl } from "@primer/react";
4
- export const Slider = ({ name = "slider", id = "slider", min, max, value, label, step = 1, markers = false, displayValue = true, disabled = false, orientation = "horizontal", width = "200px", onChange, }) => {
4
+ export const Slider = ({ name = "slider", id = "slider", min = 0, max = 10, value = 5, label = "label", step = 1, markers = false, displayValue = true, disabled = false, orientation = "horizontal", width = "200px", onChange, }) => {
5
5
  const { colorMode } = useTheme();
6
6
  const defaultValue = max < min ? min : min + (max - min) / 2;
7
7
  const [sliderVal, setSliderVal] = useState(defaultValue);
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from "./components/closeableflash/CloseableFlash";
1
2
  export * from "./components/slider/Slider";
2
3
  export * from "./components/toolbar/Toolbar";
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
+ export * from "./components/closeableflash/CloseableFlash";
1
2
  export * from "./components/slider/Slider";
2
3
  export * from "./components/toolbar/Toolbar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/primer-addons",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "license": "BSD-3-Clause",
5
5
  "scripts": {
6
6
  "dev": "vite",