@kolkrabbi/kol-component 0.211.0 → 0.212.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.211.0",
3
+ "version": "0.212.0",
4
4
  "description": "KOL design-system components \u2014 atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,6 +42,8 @@ import IconFrame from '../atoms/IconFrame.jsx'
42
42
  * `headerActions` is the left group beside search and was never that)
43
43
  * @param {Function} props.onFilterChange — optional callback when filters change
44
44
  * @param {Array} props.mutuallyExclusiveFilters — filter keys that should be mutually exclusive
45
+ * @param {string[]} props.initialFilters — chips active on FIRST paint, as `"<groupKey>:<value>"`
46
+ * (e.g. `['kind:preset']`). Initial only: the component owns the set after that
45
47
  * @param {Array} props.customFilterKeys — filter keys handled by renderItem, not by ContentFilters
46
48
  * @param {ElementType} props.iconComponent — icon seam (defaults to DS Icon; needs `filter` + `search`)
47
49
  *
@@ -74,6 +76,7 @@ const ContentFilters = ({
74
76
  totalCount,
75
77
  titleIcon,
76
78
  filterGroups = [],
79
+ initialFilters,
77
80
  renderItem,
78
81
  viewModeOptions,
79
82
  viewMode: viewModeProp,
@@ -147,7 +150,14 @@ const ContentFilters = ({
147
150
  /* Icon seam — consumers on a local icon shelf pass their own component
148
151
  * rather than being forced onto the DS set. Needs `filter` + `search`. */
149
152
  const IconSeam = iconComponent || Icon
150
- const [activeFilters, setActiveFilters] = useState(new Set())
153
+ /* SEEDED, not controlled (FilesDialog, kol-fxr 2026-09-04). A consumer that
154
+ * opens onto one chip — the files dialog opens on `preset` — had no way to
155
+ * say so: the set started empty and the first paint showed everything. An
156
+ * INITIAL value, not a controlled prop, because the filters are this
157
+ * component's own state everywhere else and a half-controlled set is two
158
+ * sources of truth. Entries are `"<groupKey>:<value>"`, the same strings the
159
+ * chips toggle. */
160
+ const [activeFilters, setActiveFilters] = useState(() => new Set(initialFilters))
151
161
  const [isExpanded, setIsExpanded] = useState(false)
152
162
  const [internalViewMode, setInternalViewMode] = useState(defaultViewMode ?? viewModeOptions?.[0]?.value)
153
163
  const viewMode = viewModeProp !== undefined ? viewModeProp : internalViewMode