@planningcenter/doxy-web
Advanced tools
Comparing version 2.2.0-rc.1 to 2.2.0-rc.2
import React from "react"; | ||
export interface NumberSpinnerProps { | ||
disabled?: boolean; | ||
initialValue?: number; | ||
min?: number; | ||
max?: number; | ||
max: number; | ||
name?: string; | ||
onChange?: (arg0: number) => void; | ||
onChange: (arg0: number) => void; | ||
size?: "sm" | "md"; | ||
step?: number; | ||
value: number; | ||
} | ||
export declare const NumberSpinner: React.FC<NumberSpinnerProps>; | ||
export declare const NumberSpinner: ({ disabled, min, max, name, onChange, size, value, }: NumberSpinnerProps) => React.JSX.Element; |
@@ -9,3 +9,3 @@ import "./scss/doxy-web.scss"; | ||
export * from "./components/Image/"; | ||
export * from "./components/NumberSpinner"; | ||
export * from "./components/NumberSpinner/"; | ||
export * from "./components/Select/"; | ||
@@ -12,0 +12,0 @@ export * from "./components/Subheading/"; |
@@ -284,24 +284,20 @@ import React, { useState, forwardRef } from 'react'; | ||
disabled = false, | ||
initialValue = 0, | ||
min = 0, | ||
max = 100, | ||
name = "numberSpinner", | ||
onChange = undefined, | ||
max, | ||
name = "number-spinner", | ||
onChange, | ||
size = "md", | ||
step = 1 | ||
value | ||
} = _ref; | ||
const [value, setValue] = useState(initialValue || min); | ||
const [focus, setFocus] = useState(false); | ||
const handleKeyDown = e => { | ||
if (e.code === "ArrowUp" || e.code === "ArrowRight") handleIncrement(); | ||
if (e.code === "ArrowDown" || e.code === "ArrowLeft") handleDecrement(); | ||
if (e.key === "ArrowUp" || e.key === "ArrowRight") handleIncrement(); | ||
if (e.key === "ArrowDown" || e.key === "ArrowLeft") handleDecrement(); | ||
}; | ||
const handleDecrement = () => { | ||
const newValue = value === min ? value : value - step; | ||
setValue(newValue); | ||
const newValue = value === min ? value : value - 1; | ||
if (!!onChange) onChange(newValue); | ||
}; | ||
const handleIncrement = () => { | ||
const newValue = value === max ? value : value + step; | ||
setValue(newValue); | ||
const newValue = value === max ? value : value + 1; | ||
if (!!onChange) onChange(newValue); | ||
@@ -327,6 +323,6 @@ }; | ||
disabled: disabled, | ||
max: max.toString(), | ||
min: min.toString(), | ||
step: step.toString(), | ||
value: value.toString(), | ||
max: max, | ||
min: min, | ||
step: "1", | ||
value: value, | ||
onChange: () => {}, | ||
@@ -333,0 +329,0 @@ onWheel: e => e.target.blur(), |
@@ -293,24 +293,20 @@ 'use strict'; | ||
disabled = false, | ||
initialValue = 0, | ||
min = 0, | ||
max = 100, | ||
name = "numberSpinner", | ||
onChange = undefined, | ||
max, | ||
name = "number-spinner", | ||
onChange, | ||
size = "md", | ||
step = 1 | ||
value | ||
} = _ref; | ||
const [value, setValue] = React.useState(initialValue || min); | ||
const [focus, setFocus] = React.useState(false); | ||
const handleKeyDown = e => { | ||
if (e.code === "ArrowUp" || e.code === "ArrowRight") handleIncrement(); | ||
if (e.code === "ArrowDown" || e.code === "ArrowLeft") handleDecrement(); | ||
if (e.key === "ArrowUp" || e.key === "ArrowRight") handleIncrement(); | ||
if (e.key === "ArrowDown" || e.key === "ArrowLeft") handleDecrement(); | ||
}; | ||
const handleDecrement = () => { | ||
const newValue = value === min ? value : value - step; | ||
setValue(newValue); | ||
const newValue = value === min ? value : value - 1; | ||
if (!!onChange) onChange(newValue); | ||
}; | ||
const handleIncrement = () => { | ||
const newValue = value === max ? value : value + step; | ||
setValue(newValue); | ||
const newValue = value === max ? value : value + 1; | ||
if (!!onChange) onChange(newValue); | ||
@@ -336,6 +332,6 @@ }; | ||
disabled: disabled, | ||
max: max.toString(), | ||
min: min.toString(), | ||
step: step.toString(), | ||
value: value.toString(), | ||
max: max, | ||
min: min, | ||
step: "1", | ||
value: value, | ||
onChange: () => {}, | ||
@@ -342,0 +338,0 @@ onWheel: e => e.target.blur(), |
{ | ||
"name": "@planningcenter/doxy-web", | ||
"version": "2.2.0-rc.1", | ||
"version": "2.2.0-rc.2", | ||
"description": "Doxy for Church Center Web", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
585781
11666