Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
545257b
feat(CounterField): component boilerplate
HaykKirakosyanSoft Oct 29, 2025
99fccd6
feat: adding some UI parts
HaykKirakosyanSoft Oct 31, 2025
9804c29
feat: working on component stories
HaykKirakosyanSoft Nov 3, 2025
e3db389
feat: working on component styles
HaykKirakosyanSoft Nov 3, 2025
d52615c
feat: adding logic
HaykKirakosyanSoft Nov 3, 2025
9df68c3
feat: adding tests and controlled/uncontrolled logics
HaykKirakosyanSoft Nov 5, 2025
3e0a47f
fix: fixed the conflicts
HaykKirakosyanSoft Nov 7, 2025
70c75b5
fix(CounterField): removed all the comments from .scss file
HaykKirakosyanSoft Nov 12, 2025
5ec5da9
fix(CounterField): removed all unnecessary designs
HaykKirakosyanSoft Nov 12, 2025
a8329ec
fix(CounterField): fixed the aria-labels
HaykKirakosyanSoft Nov 12, 2025
ad823d4
fix(CounterField): corrected onBlur,onFocus names,and removed tabIndex
HaykKirakosyanSoft Nov 12, 2025
847eb78
fix(CounterField): added //Components comment and moved export to the…
HaykKirakosyanSoft Nov 12, 2025
883a2bf
fix(CounterField): added max logic for consistent API
HaykKirakosyanSoft Nov 12, 2025
70888e8
fix(CounterField): removed spaces and wrapper
HaykKirakosyanSoft Nov 12, 2025
e9812aa
fix(CounterField): removed React namespace and number type
HaykKirakosyanSoft Nov 12, 2025
6e0551c
fix(CounterField): removed the tests for tabIndex
HaykKirakosyanSoft Nov 13, 2025
fa76b7a
Merge branch 'release/3.0.0' of github.com:softconstruct/gene-ui-comp…
GaroGabrielyan Nov 20, 2025
53a3b4e
fix(CounterField): removed unused styles
HaykKirakosyanSoft Nov 21, 2025
8c78b33
Merge branch 'feature/add-counter-field-component' of github.com:soft…
HaykKirakosyanSoft Nov 21, 2025
aa3d426
fix(CounterField): removed comments from test.tsx
HaykKirakosyanSoft Nov 21, 2025
11613e0
feat(CounterField): label onclick activates the input
HaykKirakosyanSoft Nov 21, 2025
f7952e6
fix(CounterField): removed readonly prop
HaykKirakosyanSoft Nov 21, 2025
2835aa1
Merge remote-tracking branch 'origin/release/3.0.0' into feature/add-…
HaykKirakosyanSoft Dec 15, 2025
ccac926
feat(CounterField): removed min,max props and corresponding logic
HaykKirakosyanSoft Dec 15, 2025
2dbf5c5
feat(CounterField): refactored code to work correctly with non numeri…
HaykKirakosyanSoft Dec 18, 2025
41095b0
feat(CounterField): refactored controlled story
HaykKirakosyanSoft Dec 22, 2025
574994f
feat(CounterField): updated the stories accordingly to new changes
HaykKirakosyanSoft Dec 23, 2025
2406d21
Merge branch 'release/3.0.0' of github.com:softconstruct/gene-ui-comp…
GaroGabrielyan Dec 25, 2025
8ad5eea
feat(CounterField): added readOnly prop and tests to the component
HaykKirakosyanSoft Jan 5, 2026
832a589
Merge branch 'feature/add-counter-field-component' of github.com:soft…
HaykKirakosyanSoft Jan 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/components/molecules/CounterField/CounterField.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.counterField {
$this: &;

display: flex;
flex-direction: column;
align-items: flex-start;
gap: var(--guit-ref-spacing-3xsmall);

&__inputContainer {
display: flex;
gap: var(--guit-ref-spacing-xsmall);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no token for this gap , please clarify with designer

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw it on figma, also when you remove this token the gap between label,buttons and input breaks.

width: 100%;
}

&__input {
width: 8rem;
}

&__infoContainer {
display: flex;
width: 100%;
}

&_readOnly {
pointer-events: none;
}
}
77 changes: 77 additions & 0 deletions src/components/molecules/CounterField/CounterField.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React, { ChangeEvent, FC, MouseEvent, useState } from "react";
import { Meta, StoryObj } from "@storybook/react";

// Components
import CounterField, { ICounterFieldProps } from "@components/molecules/CounterField/CounterField";

// Helpers
import { args, propCategory } from "../../../../stories/assets/storybook.globals";

const meta: Meta<ICounterFieldProps> = {
title: "Molecules/CounterField",
component: CounterField,
argTypes: {
value: args({ control: "text", ...propCategory.states }),
defaultValue: args({ control: "number", ...propCategory.states }),
disabled: args({ control: "boolean", ...propCategory.states }),
readOnly: args({ control: "boolean", ...propCategory.states }),
ariaLabelIncrement: args({ control: "text", ...propCategory.others }),
ariaLabelDecrement: args({ control: "text", ...propCategory.others }),
step: args({ control: "number", defaultValue: 1, ...propCategory.validation }),
size: args({ control: "select", ...propCategory.appearance }),
status: args({ control: "select", ...propCategory.appearance }),
className: args({ control: "false", ...propCategory.appearance }),
label: args({ control: "text", ...propCategory.content }),
infoText: args({ control: "text", ...propCategory.content }),
helperText: args({ control: "text", ...propCategory.content }),
required: args({ control: "boolean", ...propCategory.states }),
onChange: args({ control: "false", ...propCategory.action }),
onInputBlur: args({ control: "false", ...propCategory.action }),
onInputFocus: args({ control: "false", ...propCategory.action })
},

args: {
defaultValue: 0,
step: 1,
size: "medium",
status: "rest",
label: "Label",
helperText: "Helper text",
required: true
}
};

export default meta;

type Story = StoryObj<ICounterFieldProps>;

const Template: FC<ICounterFieldProps> = ({ ...props }) => <CounterField {...props} />;

export const Default: Story = {
render: ({ ...props }) => <Template {...props} />,
argTypes: { value: args({ control: "false", ...propCategory.states }) }
};

const ControlledTemplate: FC<ICounterFieldProps> = ({ value, onChange, ...props }) => {
const isControlled = value !== undefined;
const displayValue = isControlled ? value : "0";
const [internalStringValue, setInternalStringValue] = useState(displayValue);

const handleChange = (
newValueString: string,
event: ChangeEvent<HTMLInputElement> | MouseEvent<HTMLButtonElement>
) => {
setInternalStringValue(newValueString);
onChange?.(newValueString, event);
};

return <CounterField {...props} value={internalStringValue} onChange={handleChange} />;
};

export const Controlled: Story = {
render: (props) => <ControlledTemplate {...props} />,
args: {
helperText: "Controlled Counter"
},
argTypes: { defaultValue: args({ control: "false", ...propCategory.states }) }
};
Loading
Loading