File size: 935 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import { makeElement, toWritableStores } from '../../internal/helpers/index.js';
const defaults = {
orientation: 'horizontal',
decorative: false,
};
export const createSeparator = (props) => {
const withDefaults = { ...defaults, ...props };
const options = toWritableStores(withDefaults);
const { orientation, decorative } = options;
const root = makeElement('separator', {
stores: [orientation, decorative],
returned: ([$orientation, $decorative]) => {
const ariaOrientation = $orientation === 'vertical' ? $orientation : undefined;
return {
role: $decorative ? 'none' : 'separator',
'aria-orientation': ariaOrientation,
'aria-hidden': $decorative,
'data-orientation': $orientation,
};
},
});
return {
elements: {
root,
},
options,
};
};
|