-
Notifications
You must be signed in to change notification settings - Fork 3
Fix: correction for responsive variables in box and stack #246
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
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,43 +40,43 @@ export function Box({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isFullWidth = true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }: IBoxProps): React.ReactElement { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const height = props.height ?? props.heightResponsive?.base ?? (props.isFullHeight ? '100%' : 'auto'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const width = props.width ?? props.widthResponsive?.base ?? (isFullWidth ? '100%' : 'auto'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const height = props.height ?? props.heightResponsive?.base ?? (props.isFullHeight ? '100%' : undefined); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const width = props.width ?? props.widthResponsive?.base ?? (isFullWidth ? '100%' : undefined); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const blockType = width === '100%' ? 'block' : 'flex'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const combinedStyles: React.CSSProperties = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props.style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // @ts-expect-error CSS custom properties are valid but not in CSSProperties type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-display': blockType, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width': width, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-sm': props.widthResponsive?.small, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-md': props.widthResponsive?.medium, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-lg': props.widthResponsive?.large, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-xl': props.widthResponsive?.extraLarge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height': height, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-sm': props.heightResponsive?.small, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-md': props.heightResponsive?.medium, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-lg': props.heightResponsive?.large, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-xl': props.heightResponsive?.extraLarge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width': props.maxWidth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-sm': props.maxWidthResponsive?.small, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-md': props.maxWidthResponsive?.medium, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-lg': props.maxWidthResponsive?.large, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-xl': props.maxWidthResponsive?.extraLarge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height': props.maxHeight, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-sm': props.maxHeightResponsive?.small, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-md': props.maxHeightResponsive?.medium, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-lg': props.maxHeightResponsive?.large, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-xl': props.maxHeightResponsive?.extraLarge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width': props.minWidth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-sm': props.minWidthResponsive?.small, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-md': props.minWidthResponsive?.medium, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-lg': props.minWidthResponsive?.large, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-xl': props.minWidthResponsive?.extraLarge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height': props.minHeight, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-sm': props.minHeightResponsive?.small, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-md': props.minHeightResponsive?.medium, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-lg': props.minHeightResponsive?.large, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-xl': props.minHeightResponsive?.extraLarge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width': width ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-sm': props.widthResponsive?.small ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-md': props.widthResponsive?.medium ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-lg': props.widthResponsive?.large ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-xl': props.widthResponsive?.extraLarge ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height': height ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-sm': props.heightResponsive?.small ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-md': props.heightResponsive?.medium ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-lg': props.heightResponsive?.large ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-height-xl': props.heightResponsive?.extraLarge ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width': props.maxWidth ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-sm': props.maxWidthResponsive?.small ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-md': props.maxWidthResponsive?.medium ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-lg': props.maxWidthResponsive?.large ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-width-xl': props.maxWidthResponsive?.extraLarge ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height': props.maxHeight ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-sm': props.maxHeightResponsive?.small ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-md': props.maxHeightResponsive?.medium ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-lg': props.maxHeightResponsive?.large ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-max-height-xl': props.maxHeightResponsive?.extraLarge ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width': props.minWidth ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-sm': props.minWidthResponsive?.small ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-md': props.minWidthResponsive?.medium ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-lg': props.minWidthResponsive?.large ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-width-xl': props.minWidthResponsive?.extraLarge ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height': props.minHeight ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-sm': props.minHeightResponsive?.small ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-md': props.minHeightResponsive?.medium ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-lg': props.minHeightResponsive?.large ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-min-height-xl': props.minHeightResponsive?.extraLarge ?? 'initial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+79
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| '--kiba-box-width-sm': props.widthResponsive?.small ?? 'initial', | |
| '--kiba-box-width-md': props.widthResponsive?.medium ?? 'initial', | |
| '--kiba-box-width-lg': props.widthResponsive?.large ?? 'initial', | |
| '--kiba-box-width-xl': props.widthResponsive?.extraLarge ?? 'initial', | |
| '--kiba-box-height': height ?? 'initial', | |
| '--kiba-box-height-sm': props.heightResponsive?.small ?? 'initial', | |
| '--kiba-box-height-md': props.heightResponsive?.medium ?? 'initial', | |
| '--kiba-box-height-lg': props.heightResponsive?.large ?? 'initial', | |
| '--kiba-box-height-xl': props.heightResponsive?.extraLarge ?? 'initial', | |
| '--kiba-box-max-width': props.maxWidth ?? 'initial', | |
| '--kiba-box-max-width-sm': props.maxWidthResponsive?.small ?? 'initial', | |
| '--kiba-box-max-width-md': props.maxWidthResponsive?.medium ?? 'initial', | |
| '--kiba-box-max-width-lg': props.maxWidthResponsive?.large ?? 'initial', | |
| '--kiba-box-max-width-xl': props.maxWidthResponsive?.extraLarge ?? 'initial', | |
| '--kiba-box-max-height': props.maxHeight ?? 'initial', | |
| '--kiba-box-max-height-sm': props.maxHeightResponsive?.small ?? 'initial', | |
| '--kiba-box-max-height-md': props.maxHeightResponsive?.medium ?? 'initial', | |
| '--kiba-box-max-height-lg': props.maxHeightResponsive?.large ?? 'initial', | |
| '--kiba-box-max-height-xl': props.maxHeightResponsive?.extraLarge ?? 'initial', | |
| '--kiba-box-min-width': props.minWidth ?? 'initial', | |
| '--kiba-box-min-width-sm': props.minWidthResponsive?.small ?? 'initial', | |
| '--kiba-box-min-width-md': props.minWidthResponsive?.medium ?? 'initial', | |
| '--kiba-box-min-width-lg': props.minWidthResponsive?.large ?? 'initial', | |
| '--kiba-box-min-width-xl': props.minWidthResponsive?.extraLarge ?? 'initial', | |
| '--kiba-box-min-height': props.minHeight ?? 'initial', | |
| '--kiba-box-min-height-sm': props.minHeightResponsive?.small ?? 'initial', | |
| '--kiba-box-min-height-md': props.minHeightResponsive?.medium ?? 'initial', | |
| '--kiba-box-min-height-lg': props.minHeightResponsive?.large ?? 'initial', | |
| '--kiba-box-min-height-xl': props.minHeightResponsive?.extraLarge ?? 'initial', | |
| '--kiba-box-width-sm': props.widthResponsive?.small ?? 'var(--kiba-unset)', | |
| '--kiba-box-width-md': props.widthResponsive?.medium ?? 'var(--kiba-unset)', | |
| '--kiba-box-width-lg': props.widthResponsive?.large ?? 'var(--kiba-unset)', | |
| '--kiba-box-width-xl': props.widthResponsive?.extraLarge ?? 'var(--kiba-unset)', | |
| '--kiba-box-height': height ?? 'initial', | |
| '--kiba-box-height-sm': props.heightResponsive?.small ?? 'var(--kiba-unset)', | |
| '--kiba-box-height-md': props.heightResponsive?.medium ?? 'var(--kiba-unset)', | |
| '--kiba-box-height-lg': props.heightResponsive?.large ?? 'var(--kiba-unset)', | |
| '--kiba-box-height-xl': props.heightResponsive?.extraLarge ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-width': props.maxWidth ?? 'initial', | |
| '--kiba-box-max-width-sm': props.maxWidthResponsive?.small ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-width-md': props.maxWidthResponsive?.medium ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-width-lg': props.maxWidthResponsive?.large ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-width-xl': props.maxWidthResponsive?.extraLarge ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-height': props.maxHeight ?? 'initial', | |
| '--kiba-box-max-height-sm': props.maxHeightResponsive?.small ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-height-md': props.maxHeightResponsive?.medium ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-height-lg': props.maxHeightResponsive?.large ?? 'var(--kiba-unset)', | |
| '--kiba-box-max-height-xl': props.maxHeightResponsive?.extraLarge ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-width': props.minWidth ?? 'initial', | |
| '--kiba-box-min-width-sm': props.minWidthResponsive?.small ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-width-md': props.minWidthResponsive?.medium ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-width-lg': props.minWidthResponsive?.large ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-width-xl': props.minWidthResponsive?.extraLarge ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-height': props.minHeight ?? 'initial', | |
| '--kiba-box-min-height-sm': props.minHeightResponsive?.small ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-height-md': props.minHeightResponsive?.medium ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-height-lg': props.minHeightResponsive?.large ?? 'var(--kiba-unset)', | |
| '--kiba-box-min-height-xl': props.minHeightResponsive?.extraLarge ?? 'var(--kiba-unset)', |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,41 +88,41 @@ | |
| &.scrollableVertically { overflow-y: auto; } | ||
| &.scrollableHorizontally { overflow-x: auto; } | ||
|
|
||
| // Responsive breakpoints | ||
| // Responsive breakpoints - only use responsive variables if explicitly set (not initial) | ||
| @include screen-small { | ||
| width: var(--kiba-box-width-sm, var(--kiba-box-width, 100%)); | ||
| height: var(--kiba-box-height-sm, var(--kiba-box-height, auto)); | ||
| max-width: var(--kiba-box-max-width-sm, var(--kiba-box-max-width)); | ||
| max-height: var(--kiba-box-max-height-sm, var(--kiba-box-max-height)); | ||
| min-width: var(--kiba-box-min-width-sm, var(--kiba-box-min-width)); | ||
| min-height: var(--kiba-box-min-height-sm, var(--kiba-box-min-height)); | ||
| max-width: var(--kiba-box-max-width-sm, var(--kiba-box-max-width, none)); | ||
| max-height: var(--kiba-box-max-height-sm, var(--kiba-box-max-height, none)); | ||
|
Comment on lines
+91
to
+96
|
||
| min-width: var(--kiba-box-min-width-sm, var(--kiba-box-min-width, 0)); | ||
| min-height: var(--kiba-box-min-height-sm, var(--kiba-box-min-height, 0)); | ||
| } | ||
|
|
||
| @include screen-medium { | ||
| width: var(--kiba-box-width-md, var(--kiba-box-width-sm, var(--kiba-box-width, 100%))); | ||
| height: var(--kiba-box-height-md, var(--kiba-box-height-sm, var(--kiba-box-height, auto))); | ||
| max-width: var(--kiba-box-max-width-md, var(--kiba-box-max-width-sm, var(--kiba-box-max-width))); | ||
| max-height: var(--kiba-box-max-height-md, var(--kiba-box-max-height-sm, var(--kiba-box-max-height))); | ||
| min-width: var(--kiba-box-min-width-md, var(--kiba-box-min-width-sm, var(--kiba-box-min-width))); | ||
| min-height: var(--kiba-box-min-height-md, var(--kiba-box-min-height-sm, var(--kiba-box-min-height))); | ||
| max-width: var(--kiba-box-max-width-md, var(--kiba-box-max-width-sm, var(--kiba-box-max-width, none))); | ||
| max-height: var(--kiba-box-max-height-md, var(--kiba-box-max-height-sm, var(--kiba-box-max-height, none))); | ||
| min-width: var(--kiba-box-min-width-md, var(--kiba-box-min-width-sm, var(--kiba-box-min-width, 0))); | ||
| min-height: var(--kiba-box-min-height-md, var(--kiba-box-min-height-sm, var(--kiba-box-min-height, 0))); | ||
| } | ||
|
|
||
| @include screen-large { | ||
| width: var(--kiba-box-width-lg, var(--kiba-box-width-md, var(--kiba-box-width-sm, var(--kiba-box-width, 100%)))); | ||
| height: var(--kiba-box-height-lg, var(--kiba-box-height-md, var(--kiba-box-height-sm, var(--kiba-box-height, auto)))); | ||
| max-width: var(--kiba-box-max-width-lg, var(--kiba-box-max-width-md, var(--kiba-box-max-width-sm, var(--kiba-box-max-width)))); | ||
| max-height: var(--kiba-box-max-height-lg, var(--kiba-box-max-height-md, var(--kiba-box-max-height-sm, var(--kiba-box-max-height)))); | ||
| min-width: var(--kiba-box-min-width-lg, var(--kiba-box-min-width-md, var(--kiba-box-min-width-sm, var(--kiba-box-min-width)))); | ||
| min-height: var(--kiba-box-min-height-lg, var(--kiba-box-min-height-md, var(--kiba-box-min-height-sm, var(--kiba-box-min-height)))); | ||
| max-width: var(--kiba-box-max-width-lg, var(--kiba-box-max-width-md, var(--kiba-box-max-width-sm, var(--kiba-box-max-width, none)))); | ||
| max-height: var(--kiba-box-max-height-lg, var(--kiba-box-max-height-md, var(--kiba-box-max-height-sm, var(--kiba-box-max-height, none)))); | ||
| min-width: var(--kiba-box-min-width-lg, var(--kiba-box-min-width-md, var(--kiba-box-min-width-sm, var(--kiba-box-min-width, 0)))); | ||
| min-height: var(--kiba-box-min-height-lg, var(--kiba-box-min-height-md, var(--kiba-box-min-height-sm, var(--kiba-box-min-height, 0)))); | ||
| } | ||
|
|
||
| @include screen-extra-large { | ||
| width: var(--kiba-box-width-xl, var(--kiba-box-width-lg, var(--kiba-box-width-md, var(--kiba-box-width-sm, var(--kiba-box-width, 100%))))); | ||
| height: var(--kiba-box-height-xl, var(--kiba-box-height-lg, var(--kiba-box-height-md, var(--kiba-box-height-sm, var(--kiba-box-height, auto))))); | ||
| max-width: var(--kiba-box-max-width-xl, var(--kiba-box-max-width-lg, var(--kiba-box-max-width-md, var(--kiba-box-max-width-sm, var(--kiba-box-max-width))))); | ||
| max-height: var(--kiba-box-max-height-xl, var(--kiba-box-max-height-lg, var(--kiba-box-max-height-md, var(--kiba-box-max-height-sm, var(--kiba-box-max-height))))); | ||
| min-width: var(--kiba-box-min-width-xl, var(--kiba-box-min-width-lg, var(--kiba-box-min-width-md, var(--kiba-box-min-width-sm, var(--kiba-box-min-width))))); | ||
| min-height: var(--kiba-box-min-height-xl, var(--kiba-box-min-height-lg, var(--kiba-box-min-height-md, var(--kiba-box-min-height-sm, var(--kiba-box-min-height))))); | ||
| max-width: var(--kiba-box-max-width-xl, var(--kiba-box-max-width-lg, var(--kiba-box-max-width-md, var(--kiba-box-max-width-sm, var(--kiba-box-max-width, none))))); | ||
| max-height: var(--kiba-box-max-height-xl, var(--kiba-box-max-height-lg, var(--kiba-box-max-height-md, var(--kiba-box-max-height-sm, var(--kiba-box-max-height, none))))); | ||
| min-width: var(--kiba-box-min-width-xl, var(--kiba-box-min-width-lg, var(--kiba-box-min-width-md, var(--kiba-box-min-width-sm, var(--kiba-box-min-width, 0))))); | ||
| min-height: var(--kiba-box-min-height-xl, var(--kiba-box-min-height-lg, var(--kiba-box-min-height-md, var(--kiba-box-min-height-sm, var(--kiba-box-min-height, 0))))); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,22 +14,23 @@ export const responsiveValueToCss = <FieldType>( | |
| field: ResponsiveField<FieldType> | null | undefined, | ||
| variablePrefix: string, | ||
| converter: CssConverter<FieldType> = identityConverter, | ||
| shouldResetInheritance = false, | ||
| ): Record<string, string> => { | ||
| if (!field) { | ||
| if (shouldResetInheritance) { | ||
| return { | ||
| [`${variablePrefix}-small`]: 'initial', | ||
| [`${variablePrefix}-medium`]: 'initial', | ||
| [`${variablePrefix}-large`]: 'initial', | ||
| [`${variablePrefix}-extraLarge`]: 'initial', | ||
| }; | ||
| } | ||
| return {}; | ||
| } | ||
| const result: Record<string, string> = {}; | ||
| if (field.small !== undefined) { | ||
| result[`${variablePrefix}-small`] = converter(field.small); | ||
| } | ||
| if (field.medium !== undefined) { | ||
| result[`${variablePrefix}-medium`] = converter(field.medium); | ||
| } | ||
| if (field.large !== undefined) { | ||
| result[`${variablePrefix}-large`] = converter(field.large); | ||
| } | ||
| if (field.extraLarge !== undefined) { | ||
| result[`${variablePrefix}-extraLarge`] = converter(field.extraLarge); | ||
| } | ||
| result[`${variablePrefix}-small`] = field.small !== undefined ? converter(field.small) : 'initial'; | ||
| result[`${variablePrefix}-medium`] = field.medium !== undefined ? converter(field.medium) : 'initial'; | ||
| result[`${variablePrefix}-large`] = field.large !== undefined ? converter(field.large) : 'initial'; | ||
| result[`${variablePrefix}-extraLarge`] = field.extraLarge !== undefined ? converter(field.extraLarge) : 'initial'; | ||
|
Comment on lines
+20
to
+34
|
||
| return result; | ||
| }; | ||
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.
With
shouldResetInheritanceset totrue,responsiveValueToCsscurrently emits breakpoint variables with the value'initial'when the responsive prop is undefined. Becausestack/styles.scssusesvar(--kiba-stack-*-small, var(--kiba-stack-*-base, ...)), this will force breakpoints to use CSS-wide keywordinitialinstead of falling back to the*-basevariables.Concrete impact: a default vertical stack will become
flex-direction: initial(i.e.row) atscreen-smalland above, andjustify-content: initial(typicallyflex-start) instead of the configured base value.This should be switched to a value that makes the custom property invalid (so the
var()fallback is taken), or tovar(--kiba-stack-*-base)as the default emitted value for missing breakpoints.