@kolkrabbi/kol-icons 0.59.0 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/Icon.jsx +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-icons",
3
- "version": "0.59.0",
3
+ "version": "0.60.0",
4
4
  "description": "The icon loader and icon sets",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,4 +37,4 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  }
40
- }
40
+ }
package/src/Icon.jsx CHANGED
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @param {Object} props
8
8
  * @param {string} props.name - Icon name (matches SVG filename without extension)
9
+ * @param {'outline'|'solid'} props.variant - solid renders the name's `-solid` twin when it ships one (default: outline)
9
10
  * @param {number|string} props.size - Icon size (default: 16)
10
11
  * @param {string} props.className - Additional classes
11
12
  * @param {Object} props.style - Inline styles
@@ -154,13 +155,24 @@ const applySizeToMarkup = (markup, sizeValue) => {
154
155
  })
155
156
  }
156
157
 
158
+ /* VARIANT (2026-11-01, user: "ONE cloud storm component with said variants"): a solid twin is the outline's
159
+ * `variant="solid"` — `<Icon name="cloud-storm" variant="solid" />` renders `cloud-storm-solid`. A name with no
160
+ * solid twin renders its outline, so a variant never blanks an icon. The `-solid` names keep resolving. */
161
+ const withVariant = (name, variant) => {
162
+ if (variant !== 'solid' || !name || name.endsWith('-solid')) return name
163
+ const solid = `${RENAMED_ICONS[name] ?? name}-solid`
164
+ return setOf(solid) || CUSTOM[solid] ? solid : name
165
+ }
166
+
157
167
  const Icon = ({
158
- name,
168
+ name: baseName,
169
+ variant = 'outline',
159
170
  size = 16,
160
171
  className = '',
161
172
  style = {},
162
173
  children
163
174
  }) => {
175
+ const name = withVariant(baseName, variant)
164
176
  const ready = useIconsReady(RENAMED_ICONS[name] ?? name)
165
177
 
166
178
  // If children are provided, render directly (for custom icons)