Skip to content

Commit a8dd938

Browse files
feat: batch up for components (#3292)
1 parent 4e20663 commit a8dd938

File tree

13 files changed

+57
-12
lines changed

13 files changed

+57
-12
lines changed

apps/preview/next/pages/showcases/Breadcrumbs/Breadcrumbs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function Showcase() {
2626

2727
return (
2828
<nav className="inline-flex font-normal font-body typography-text-sm">
29-
<ol className="flex items-center w-auto leading-none group md:flex-wrap">
29+
<ol className="flex items-center w-auto leading-none md:flex-wrap">
3030
<li className="flex items-center sm:hidden text-neutral-500">
3131
<SfDropdown
3232
trigger={

apps/preview/nuxt/pages/showcases/Breadcrumbs/Breadcrumbs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<nav class="inline-flex items-center text-sm font-normal font-body">
3-
<ol class="flex w-auto leading-none group md:flex-wrap">
3+
<ol class="flex w-auto leading-none md:flex-wrap">
44
<li class="flex items-center sm:hidden text-neutral-500">
55
<SfDropdown v-model="dropdownOpened" strategy="absolute" placement="bottom-start" @update:model-value="close">
66
<template #trigger>

packages/sfui/frameworks/react/components/SfAccordionItem/SfAccordionItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import classNames from 'classnames';
55
import type { SfAccordionItemProps } from '@storefront-ui/react';
66

77
const SfAccordionItem = forwardRef<HTMLDetailsElement, SfAccordionItemProps>((props, ref) => {
8-
const { open, onToggle, children, summary, summaryClassName, ...attributes } = props;
8+
const { open, onToggle, children, summary, summaryClassName, summaryAttrs, ...attributes } = props;
99

1010
const handleClick = (event: MouseEvent<HTMLElement>) => {
1111
event.preventDefault();
@@ -15,6 +15,7 @@ const SfAccordionItem = forwardRef<HTMLDetailsElement, SfAccordionItemProps>((pr
1515
return (
1616
<details ref={ref} open={open} data-testid="accordion-item" {...attributes}>
1717
<summary
18+
{...summaryAttrs}
1819
onClick={handleClick}
1920
className={classNames(
2021
summaryClassName,
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import type { ReactNode, PropsWithChildren, DetailsHTMLAttributes } from 'react';
1+
import type { ReactNode, PropsWithChildren, DetailsHTMLAttributes, HTMLAttributes } from 'react';
22

33
export interface SfAccordionItemProps
44
extends Omit<DetailsHTMLAttributes<HTMLDetailsElement>, 'onToggle'>,
55
PropsWithChildren {
66
onToggle?: (isOpen: boolean) => void;
77
summary?: ReactNode;
88
summaryClassName?: string;
9+
summaryAttrs?: HTMLAttributes<HTMLElement>;
910
}

packages/sfui/frameworks/react/components/SfDropdown/SfDropdown.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ import { useDropdown } from '@storefront-ui/react';
44
import type { SfDropdownProps } from '@storefront-ui/react';
55

66
export default function SfDropdown(props: SfDropdownProps) {
7-
const { children, trigger, open: isOpen = false, className, style: containerStyle, ...dropdownOptions } = props;
7+
const {
8+
children,
9+
trigger,
10+
open: isOpen = false,
11+
className,
12+
style: containerStyle,
13+
wrapperClass,
14+
...dropdownOptions
15+
} = props;
816
const { refs, style: dropdownStyle } = useDropdown({ isOpen, ...dropdownOptions });
917

1018
return (
@@ -16,7 +24,13 @@ export default function SfDropdown(props: SfDropdownProps) {
1624
>
1725
{trigger}
1826
{isOpen && (
19-
<div ref={refs.setFloating} style={dropdownStyle} aria-hidden={!isOpen} data-testid="dropdown-content">
27+
<div
28+
ref={refs.setFloating}
29+
style={dropdownStyle}
30+
aria-hidden={!isOpen}
31+
data-testid="dropdown-content"
32+
className={wrapperClass}
33+
>
2034
{children}
2135
</div>
2236
)}

packages/sfui/frameworks/react/components/SfDropdown/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import type { UseDropdownOptions, PropsWithStyle } from '@storefront-ui/react';
44
export interface SfDropdownProps extends Omit<UseDropdownOptions, 'isOpen'>, PropsWithStyle, PropsWithChildren {
55
open?: boolean;
66
trigger: ReactNode;
7+
wrapperClass?: string;
78
}

packages/sfui/frameworks/react/components/SfListItem/SfListItem.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const SfListItem = polymorphicForwardRef<typeof defaultListItemTag, SfListItemPr
2222
as,
2323
childrenTag,
2424
children,
25+
prefixClassName,
26+
suffixClassName,
2527
...attributes
2628
} = props;
2729

@@ -45,11 +47,15 @@ const SfListItem = polymorphicForwardRef<typeof defaultListItemTag, SfListItemPr
4547
{...attributes}
4648
>
4749
{slotPrefix && (
48-
<ChildrenTag className={disabled ? 'text-disabled-500' : 'text-neutral-500'}>{slotPrefix}</ChildrenTag>
50+
<ChildrenTag className={classNames(disabled ? 'text-disabled-500' : 'text-neutral-500', prefixClassName)}>
51+
{slotPrefix}
52+
</ChildrenTag>
4953
)}
5054
<ChildrenTag className="flex flex-col w-full min-w-0">{children}</ChildrenTag>
5155
{slotSuffix && (
52-
<ChildrenTag className={disabled ? 'text-disabled-500' : 'text-neutral-500'}>{slotSuffix}</ChildrenTag>
56+
<ChildrenTag className={classNames(disabled ? 'text-disabled-500' : 'text-neutral-500', suffixClassName)}>
57+
{slotSuffix}
58+
</ChildrenTag>
5359
)}
5460
</Tag>
5561
);

packages/sfui/frameworks/react/components/SfListItem/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ export interface SfListItemProps extends PropsWithChildren, PropsWithStyle {
1111
slotPrefix?: ReactNode;
1212
role?: string;
1313
childrenTag?: ElementType;
14+
prefixClassName?: string;
15+
suffixClassName?: string;
1416
}

packages/sfui/frameworks/react/hooks/useTooltip/useTooltip.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export function useTooltip(options?: UseTooltipOptions) {
7676
floating: floatingStyle,
7777
arrow: arrowStyle(),
7878
},
79+
middlewareData,
7980
isOpen,
8081
open,
8182
close,

packages/sfui/frameworks/vue/components/SfAccordionItem/SfAccordionItem.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<script lang="ts" setup>
22
import { ClassProp } from '@storefront-ui/vue';
3+
import { type HTMLAttributes, type PropType } from 'vue';
34
45
defineProps({
56
modelValue: {
67
type: Boolean,
78
default: false,
89
},
910
summaryClass: ClassProp,
11+
summaryAttrs: {
12+
type: Object as PropType<HTMLAttributes>,
13+
default: () => ({}),
14+
},
1015
});
1116
1217
defineEmits<{
@@ -19,6 +24,7 @@ defineEmits<{
1924
<template>
2025
<details :open="modelValue" data-testid="accordion-item">
2126
<summary
27+
v-bind="summaryAttrs"
2228
:class="[
2329
summaryClass,
2430
'list-none [&::-webkit-details-marker]:hidden cursor-pointer focus-visible:outline focus-visible:outline-offset focus-visible:rounded-sm',

0 commit comments

Comments
 (0)