tabler / tabler-icons

A set of over 5500 free MIT-licensed high-quality SVG icons for you to use in your web projects.
https://tabler.io/icons
MIT License
18.03k stars 898 forks source link

[v3.1.0] @tabler/icons-vue lacks the default stroke-width #1067

Closed fisschl closed 3 months ago

fisschl commented 6 months ago

If I don't pass stroke-width on the Vue component, in the createVueComponent function, the stroke-width option will be overwritten as undefined.

This causes the stroke-width option set in defaultAttributes.ts to not take effect.

import { h } from 'vue';
import defaultAttributes from './defaultAttributes';
import type { Icon, IconNode, IconProps } from './types';

const createVueComponent =
  (
    type: 'outline' | 'filled',
    iconName: string,
    iconNamePascal: string,
    iconNode: IconNode,
  ): Icon =>
  ({ size, color = 'currentColor', class: classes, stroke, ...rest }: IconProps, { attrs, slots }) => {
    return h(
      'svg',
      {
        ...defaultAttributes[type],
        width: size,
        height: size,
        ...attrs,
        class: ['tabler-icon', `tabler-icon-${iconName}`],
        ...(type === 'filled'
          ? {
              fill: color,
            }
          : {
              'stroke-width': stroke,
              stroke: color,
            }),
        ...rest,
      },
      [...iconNode.map((child) => h(...child)), ...(slots.default ? [slots.default()] : [])],
    );
  };

export default createVueComponent;
andrey-hohlov commented 4 months ago

Still actual in v3.5 This issue blocks for us upgrade from v2.

Also actual for size prop (should be 24 by default).