-
Notifications
You must be signed in to change notification settings - Fork 1
IBX-10156: Inputs foundation #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e01ad17
5facc22
008000d
fe64203
da1ce17
d1e6d84
f3d3c61
45def45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| @use 'sass:map'; | ||
| @use 'functions' as *; | ||
| @use 'variables' as *; | ||
|
|
||
| $helper-text-types: ( | ||
| 'default': $color-neutral-160, | ||
| 'error': $color-error-80, | ||
| ); | ||
|
|
||
| .ids-helper-text { | ||
| $self: &; | ||
|
|
||
| font-size: $text-font-size-m; | ||
| color: #{map.get($helper-text-types, 'default')}; | ||
| display: flex; | ||
|
|
||
| &__icon-wrapper { | ||
| display: flex; | ||
| align-items: center; | ||
| height: $text-font-size-m * $base-line-height; | ||
| padding-right: calculateRem(4px); | ||
| } | ||
|
|
||
| @each $name, $color in $helper-text-types { | ||
| &--#{$name} { | ||
| color: $color; | ||
|
|
||
| #{$self}__icon { | ||
| fill: $color; | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| @use 'sass:map'; | ||
| @use 'functions' as *; | ||
| @use 'variables' as *; | ||
| @use 'mixins/icons' as mixins; | ||
|
|
||
| $input-sizes: ( | ||
| 'small': ( | ||
| 'font-size': $text-font-size-s, | ||
| 'padding': calculateRem(7px) calculateRem(16px) calculateRem(7px), | ||
| ), | ||
| 'medium': ( | ||
| 'font-size': $text-font-size-m, | ||
| 'padding': calculateRem(9px) calculateRem(16px) calculateRem(10px), | ||
| ), | ||
| ); | ||
|
|
||
| .ids-input { | ||
| border-radius: $border-radius-medium; | ||
| background: var(--ids-input-default-bg-color, #{$color-neutral-10}); | ||
| border: calculateRem(1px) solid var(--ids-input-default-border-color, #{$color-neutral-80}); | ||
| color: var(--ids-input-default-text-color, #{$color-neutral-240}); | ||
| outline: 0; | ||
|
|
||
| @each $name, $properties in $input-sizes { | ||
| &--#{$name} { | ||
| font-size: map.get($properties, 'font-size'); | ||
| padding: map.get($properties, 'padding'); | ||
| } | ||
| } | ||
|
|
||
| &.ids-input--error { | ||
| background: var(--ids-input-error-bg-color, #{$color-error-20}); | ||
| border-color: var(--ids-input-error-border-color, #{$color-error-80}); | ||
| color: var(--ids-input-error-text-color, #{$color-error-90}); | ||
| } | ||
|
|
||
| &.ids-input--disabled, | ||
| &.disabled, | ||
| &[disabled], | ||
| &:disabled { | ||
| color: var(--ids-input-disabled-text-color, #{$color-neutral-150}); | ||
| background: var(--ids-input-disabled-bg-color, #{$color-neutral-40}); | ||
| border-color: var(--ids-input-disabled-border-color, #{$color-neutral-80}); | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| &:hover { | ||
| border-color: var(--ids-input-hover-border-color, #{$color-primary-80}); | ||
| } | ||
|
|
||
| &:active { | ||
| border-color: var(--ids-input-active-border-color, #{$color-primary-90}); | ||
| } | ||
|
|
||
| &:focus { | ||
| border-color: var(--ids-input-focus-border-color, #{$color-primary-80}); | ||
| box-shadow: var(--ids-input-focus-box-shadow, #{$box-shadow-focus-primary}); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| @use 'variables' as *; | ||
|
|
||
| .ids-label { | ||
| font-size: $text-font-size-s; | ||
| color: var(--ids-label-default-text-color, #{$color-neutral-160}); | ||
|
|
||
| &--required { | ||
| &::after { | ||
| content: '*'; | ||
| } | ||
| } | ||
|
|
||
| &--error { | ||
| color: var(--ids-label-error-text-color, #{$color-error-80}); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| @use 'functions/calculate.rem' as *; | ||
| @use 'variables'; | ||
| @use 'variables' as *; | ||
|
|
||
| html { | ||
| font-size: $base-font-size; | ||
| line-height: 1.5; | ||
| line-height: $base-line-height; | ||
| letter-spacing: calculateRem(0.12px); | ||
| } | ||
|
|
||
| body { | ||
| font-family: variables.$font-family; | ||
| font-family: $font-family; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,8 +2,16 @@ | |||||
| @forward 'variables/shadows'; | ||||||
| @forward 'variables/typography'; | ||||||
|
|
||||||
| @use 'functions/calculate.rem' as *; | ||||||
|
|
||||||
| // Ibexa transition function | ||||||
| $admin-transition: cubic-bezier(0.25, 0.8, 0.25, 1) !default; | ||||||
| $admin-transition-duration: 0.4s !default; | ||||||
| $transition-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default; | ||||||
| $transition-duration: 0.4s !default; | ||||||
|
|
||||||
| // Root variables | ||||||
| $base-line-height: 1.5 !default; | ||||||
|
|
||||||
| // Various component variables | ||||||
| $border-radius-medium: calculateRem(8px) !default; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have font sizes with shortcut like
Suggested change
|
||||||
|
|
||||||
| $assets-base-path: '/' !default; | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,6 @@ | |
| @use 'expander'; | ||
| @use 'fonts'; | ||
| @use 'icons'; | ||
| @use 'input'; | ||
| @use 'label'; | ||
| @use 'helper-text'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,17 @@ | ||
| { | ||
| "presets": ["@babel/preset-env", "@babel/preset-typescript", "@babel/preset-react"], | ||
| "plugins": [], | ||
| "ignore": ["**/*.stories.ts", "**/*.stories.tsx", "**/*.types.ts"] | ||
| "presets": ["@babel/preset-env", "@babel/preset-typescript", "@babel/preset-react"], | ||
| "plugins": [ | ||
| [ | ||
| "module-resolver", | ||
| { | ||
| "root": ["./"], | ||
| "alias": { | ||
| "@ids-context": "./packages/components/src/context", | ||
| "@ids-internal": "./packages/components/src/internal", | ||
| "@ids-types": "./types" | ||
| } | ||
| } | ||
| ] | ||
| ], | ||
| "ignore": ["**/*.stories.ts", "**/*.stories.tsx", "**/*.types.ts"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| import { ReactNode } from 'react'; | ||
|
|
||
| export const BUTTON_TYPE_VALUES = ['primary', 'secondary', 'tertiary', 'black-secondary', 'black-tertiary'] as const; | ||
| import { BaseComponentAriaAttributes } from '@ids-types/general'; | ||
|
|
||
| export const BUTTON_SIZE_VALUES = ['large', 'small', 'extra-small'] as const; | ||
| export const BUTTON_TYPE_VALUES = ['primary', 'secondary', 'tertiary', 'black-secondary', 'black-tertiary'] as const; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it safe to use color names
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ida addressed it in design, but it will be done in another task, you know... out of scope ;) |
||
|
|
||
| interface ButtonSharedProps { | ||
| export type ButtonSizeType = (typeof BUTTON_SIZE_VALUES)[number]; | ||
| export type ButtonTypesType = (typeof BUTTON_TYPE_VALUES)[number]; | ||
| interface ButtonSharedProps extends BaseComponentAriaAttributes { | ||
| onClick: React.MouseEventHandler<HTMLButtonElement>; | ||
| type?: (typeof BUTTON_TYPE_VALUES)[number]; | ||
| size?: (typeof BUTTON_SIZE_VALUES)[number]; | ||
| disabled?: boolean; | ||
| extraClasses?: string; | ||
| extraAria?: Record<`aria-${string}`, boolean | number | string>; | ||
| size?: ButtonSizeType; | ||
| type?: ButtonTypesType; | ||
| } | ||
|
|
||
| interface ButtonHTMLProps extends ButtonSharedProps { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import React from 'react'; | ||
|
|
||
| import type { Meta, StoryObj } from '@storybook/react'; | ||
|
|
||
| import { HELPER_TEXT_TYPE_VALUES } from './HelperText.types'; | ||
| import HelperText from './HelperText'; | ||
|
|
||
| const meta: Meta<typeof HelperText> = { | ||
| component: HelperText, | ||
| parameters: { | ||
| layout: 'centered', | ||
| }, | ||
| tags: ['autodocs'], | ||
| argTypes: { | ||
| type: { | ||
| control: 'select', | ||
| options: Object.values(HELPER_TEXT_TYPE_VALUES), | ||
| }, | ||
| extraClasses: { | ||
| control: 'text', | ||
| }, | ||
| title: { | ||
| control: 'text', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof HelperText>; | ||
|
|
||
| export const Default: Story = { | ||
| name: 'Default', | ||
| args: { | ||
| children: 'Lorem Ipsum', | ||
| }, | ||
| }; | ||
|
|
||
| export const withHTML: Story = { | ||
| name: 'With HTML', | ||
| args: { | ||
| children: ( | ||
| <> | ||
| <b>Lorem</b> | ||
| <br /> | ||
| <u>Ipsum</u> | ||
| </> | ||
| ), | ||
| }, | ||
| }; | ||
|
|
||
| export const Error: Story = { | ||
| name: 'Error', | ||
| args: { | ||
| children: 'Lorem Ipsum', | ||
| type: 'error', | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding all animation times to variables? We have values 1s, 0.4s and 0.3s and only 0.4s is a variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, Ida has to look into this topic what are recomendations and what transition times we need