UNPKG

glide-design-system

Version:

Glide design system is an open-source React component library. It offers numerous benefits that make them essential tools for design and development teams.

208 lines (196 loc) 4.37 kB
import React from "react"; // import { storiesOf } from "@storybook/react"; import { Number } from "../../lib"; export default { title: "Components/Number", component: Number, tags: ["autodocs"], argTypes: { disabled: { control: "boolean", description: "Disables the number component, making it uninteractive.", }, onChange: { action: "changed", description: "Function to handle changes in the text field input.eg (onChange=(value)=>{consoloe.log(value)})", }, value: { control: "text", description: "Value of the text field input field.", }, label: { control: "text", description: "Label of the text field input field.", }, required: { control: "boolean", description: "Specifies if the fields are required.", }, name: { control: "", description: "The name attribute for the number field.", }, style: { control: "object", description: "Additional CSS styles to apply to the number component for custom styling.", }, className: { control: "object", description: "Additional CSS class names to apply to the number component for custom styling.", }, placeholder: { control: "text", description: "Place holder of the text field input field.", }, width: { control: "text", description: "Width of the text field input field.", }, height: { control: "text", description: "Height holder of the text field input field.", }, }, parameters: { docs: { description: { component: "The Number field component is used to display and manage number input fields. It accepts various props for customization, including onChange, required, label, value, Place Holders and disabled", }, }, }, }; const Template = ({ onChange, required, label, value, disabled, placeHolder, style, height, width, }) => { return ( <Number onChange={onChange} required={required} label={label} value={value} disabled={disabled} placeHolder={placeHolder} style={style} width={width} height={height} /> ); }; export const Default = Template.bind({}); Default.args = { onChange: function (event) { return event; }, required: false, label: "Enter Number", }; Default.parameters = { docs: { description: { story: "This story demonstrates the Number component with default configuration.", }, }, }; export const Required = Template.bind({}); Required.args = { required: true, label: "Enter Number", }; Required.parameters = { docs: { description: { story: "This example shows how to use number component with required property.", }, }, }; export const Style = Template.bind({}); Style.args = { style: { width: "250px" }, label: "Enter Number", }; Style.parameters = { docs: { description: { story: "This example shows how to use number component with custom style.", }, }, }; export const Disabled = Template.bind({}); Disabled.args = { disabled: true, value: "8", }; Disabled.parameters = { docs: { description: { story: "This example shows how to use number component with disabled property.", }, }, }; export const Label = Template.bind({}); Label.args = { label: "Number Label", }; Label.parameters = { docs: { description: { story: "This example shows how to use number component with custom label.", }, }, }; export const Value = Template.bind({}); Value.args = { label: "Number", value: "9", }; Value.parameters = { docs: { description: { story: "This example shows how to use number component with value property.", }, }, }; export const Width = Template.bind({}); Width.args = { label: "Number", width: "200px", }; Width.parameters = { docs: { description: { story: "This example shows how to use number component with custom width.", }, }, }; export const Height = Template.bind({}); Height.args = { label: "Number", height: "50px", }; Height.parameters = { docs: { description: { story: "This example shows how to use number component with custom height.", }, }, };