Skip to content

Commit

Permalink
Release 0.0.110
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jun 26, 2024
1 parent 335a5eb commit dd201e7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@surfnet/sds",
"version": "0.0.109",
"version": "0.0.110",
"description": "SURF Design System for React",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/components/EmailInput/EmailInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const Template: StoryFn<typeof EmailInput> = (args) => <EmailInput {...args} />;
export const DefaultTemplate = Template.bind({});
// More on args: https://storybook.js.org/docs/react/writing-stories/args
DefaultTemplate.args = {
error: false
error: false,
required: true
};

export const ErrorTemplate = Template.bind({});
Expand Down
7 changes: 4 additions & 3 deletions src/components/EmailInput/EmailInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export interface EmailInputProps {
inviteesPlaceholder?: string,
pinnedEmails?: Array<string>,
error?: boolean,
validateExistingMails?: boolean
validateExistingMails?: boolean,
required?: boolean
}

const EmailInput = (props: EmailInputProps) => {
Expand Down Expand Up @@ -106,10 +107,10 @@ const EmailInput = (props: EmailInputProps) => {
setEmailErrors([]);
props.removeMail(mail)(e);
}

const required = props.required || false;
return (
<div className={`sds--email-input ${props.error ? "error" : ""}`}>
<label htmlFor={props.name}>{props.name}
<label htmlFor={props.name}>{props.name}{required && <sup className="required">*</sup>}
{props.inviteesMessagesTooltip && <Tooltip
tip={props.inviteesMessagesTooltip}/>}
</label>
Expand Down
3 changes: 2 additions & 1 deletion src/components/RadioOptions/RadioOptions.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ MultipleOptions.args = {
tooltip: "Lorum Ipsum",
isMultiple: true,
labels: ["option1", "option2", "option3", "option4"],
labelResolver: (label: string) => label.toUpperCase()
labelResolver: (label: string) => label.toUpperCase(),
required: true
};

export const MultipleOptionsColumn = Template.bind({});
Expand Down
30 changes: 16 additions & 14 deletions src/components/RadioOptions/RadioOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ import Tooltip from "../Tooltip/index";
import RadioOptionsOrientation from "./RadioOptionsOrientation";

export interface RadioOptionsProps {
trueLabel: string;
falseLabel: string;
label: string;
name: string;
onChange: ChangeEventHandler;
value: boolean | string | null;
tooltip?: string;
disabled?: boolean;
isMultiple?: boolean;
reverse?: boolean;
labels?: Array<string>;
labelResolver?: Function;
orientation?: RadioOptionsOrientation;
trueLabel: string,
falseLabel: string,
label: string,
name: string,
onChange: ChangeEventHandler,
value: boolean | string | null,
tooltip?: string,
disabled?: boolean,
isMultiple?: boolean,
reverse?: boolean,
labels?: Array<string>,
labelResolver?: Function,
orientation?: RadioOptionsOrientation,
required?: boolean
}

const RadioOptions = (props: RadioOptionsProps) => {
Expand All @@ -32,10 +33,11 @@ const RadioOptions = (props: RadioOptionsProps) => {
const orientation = props.orientation || RadioOptionsOrientation.row;
const reverse = props.reverse || false;
const labels = isMultiple ? (props.labels && props.labels) : reverse ? [props.trueLabel, props.falseLabel] : [props.falseLabel, props.trueLabel];
const required = props.required || false;
return (
<div className="sds--radio-options">
<label htmlFor={`${props.name}`} className={"sds--tooltip-parent"}>
<span>{props.label}</span>
<span>{props.label}{required && <sup className="required">*</sup>}</span>
{props.tooltip && <Tooltip tip={props.tooltip}/>}
</label>
<div className={`sds--text-field-container ${orientation}`}>
Expand Down

0 comments on commit dd201e7

Please sign in to comment.