Comparing version 1.5.1 to 1.5.2
@@ -9,2 +9,3 @@ import React, { MouseEventHandler } from 'react'; | ||
isLoading?: boolean; | ||
htmlType?: 'button' | 'submit'; | ||
prefixIcon?: React.ReactElement; | ||
@@ -11,0 +12,0 @@ suffixIcon?: React.ReactElement; |
@@ -13,3 +13,3 @@ "use strict"; | ||
var _b, _c; | ||
var children = _a.children, _d = _a.type, type = _d === void 0 ? 'primary' : _d, onClick = _a.onClick, className = _a.className, isDisabled = _a.isDisabled, isLoading = _a.isLoading, prefixIcon = _a.prefixIcon, suffixIcon = _a.suffixIcon, name = _a.name; | ||
var children = _a.children, _d = _a.type, type = _d === void 0 ? 'primary' : _d, onClick = _a.onClick, className = _a.className, isDisabled = _a.isDisabled, isLoading = _a.isLoading, _e = _a.htmlType, htmlType = _e === void 0 ? 'button' : _e, prefixIcon = _a.prefixIcon, suffixIcon = _a.suffixIcon, name = _a.name; | ||
var buttonClassNames = classnames_1.default(css_reset_module_css_1.default.ventura, Button_module_css_1.default.button, (_b = {}, | ||
@@ -23,3 +23,5 @@ _b[Button_module_css_1.default.typePrimary] = type === 'primary', | ||
_c)); | ||
return (react_1.default.createElement("button", { disabled: isDisabled || isLoading, className: buttonClassNames, type: "button", onClick: isLoading || suffixIcon ? undefined : onClick, "data-testid": "button-" + name }, | ||
return ( | ||
// eslint-disable-next-line react/button-has-type | ||
react_1.default.createElement("button", { disabled: isDisabled || isLoading, className: buttonClassNames, type: htmlType, onClick: isLoading || suffixIcon ? undefined : onClick, name: name, "data-testid": "button-" + name }, | ||
isLoading ? react_1.default.createElement(Spinner_1.default, { className: Button_module_css_1.default.spinner }) : prefixIcon, | ||
@@ -26,0 +28,0 @@ react_1.default.createElement("span", { className: labelClassNames }, children), |
@@ -10,3 +10,3 @@ import React from 'react'; | ||
children: React.ReactNode; | ||
defaultValue?: RadioContext['selectedValue']; | ||
value?: RadioContext['selectedValue']; | ||
name: string; | ||
@@ -13,0 +13,0 @@ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void; |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -13,3 +6,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var react_1 = __importStar(require("react")); | ||
var react_1 = __importDefault(require("react")); | ||
var classnames_1 = __importDefault(require("classnames")); | ||
@@ -20,6 +13,4 @@ var css_reset_module_css_1 = __importDefault(require("../../../css-reset.module.css")); | ||
var RadioGroup = function (_a) { | ||
var children = _a.children, defaultValue = _a.defaultValue, onChange = _a.onChange, name = _a.name, groupRef = _a.groupRef, className = _a.className; | ||
var _b = react_1.useState(defaultValue), selectedValue = _b[0], setSelectedValue = _b[1]; | ||
var children = _a.children, value = _a.value, onChange = _a.onChange, name = _a.name, groupRef = _a.groupRef, className = _a.className; | ||
var onRadioItemChange = function (e) { | ||
setSelectedValue(e.target.value); | ||
if (onChange) { | ||
@@ -30,3 +21,4 @@ onChange(e); | ||
var mergedClassNames = classnames_1.default(css_reset_module_css_1.default.ventura, RadioGroup_module_css_1.default.group, className); | ||
return (react_1.default.createElement(exports.radioContext.Provider, { value: { selectedValue: selectedValue, onChange: onRadioItemChange, name: name, groupRef: groupRef } }, | ||
var radioContextValues = { selectedValue: value, onChange: onRadioItemChange, name: name, groupRef: groupRef }; | ||
return (react_1.default.createElement(exports.radioContext.Provider, { value: radioContextValues }, | ||
react_1.default.createElement("div", { className: mergedClassNames }, children))); | ||
@@ -33,0 +25,0 @@ }; |
{ | ||
"name": "ventura", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"repository": "git@github.com:kodiak-packages/ventura.git", | ||
@@ -5,0 +5,0 @@ "author": "Kodiak", |
@@ -5,3 +5,3 @@ TODO: Display logo | ||
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kodiak-packages/ventura/Test%20and%20lint/master?label=CI%20test%2Flint) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kodiak-packages/ventura/Build%20and%20release/master?label=CI%20build%2Frelease) ![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/kodiak-packages/ventura) ![npm](https://img.shields.io/npm/v/ventura) ![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) | ||
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kodiak-packages/ventura/Test%20and%20lint/master?label=CI%20test%2Flint) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kodiak-packages/ventura/Build%20and%20release/master?label=CI%20build%2Frelease) [![codecov](https://codecov.io/gh/kodiak-packages/ventura/branch/master/graph/badge.svg?token=2CWDA87EE2)](https://codecov.io/gh/kodiak-packages/bloodhound) ![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/kodiak-packages/ventura) ![npm](https://img.shields.io/npm/v/ventura) ![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) | ||
@@ -39,3 +39,2 @@ A lightweight, themable react component library from 2020 | ||
const MyComponent = () => { | ||
return <Button>Click me</Button>; | ||
@@ -42,0 +41,0 @@ }; |
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
47259
739
53