@swan-io/lake 1.6.0 → 1.7.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": "@swan-io/lake",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "engines": {
5
5
  "node": ">=14.0.0",
6
6
  "yarn": "^1.20.0"
@@ -27,7 +27,7 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@popperjs/core": "^2.11.6",
30
- "@swan-io/boxed": "^0.12.1",
30
+ "@swan-io/boxed": "^0.13.0",
31
31
  "@swan-io/chicane": "^1.3.4",
32
32
  "dayjs": "^1.11.7",
33
33
  "polished": "^4.2.2",
@@ -193,6 +193,10 @@ function FilterInput({ label, initialValue = "", noValueText, submitText, autoOp
193
193
  };
194
194
  return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: value === "" ? noValueText : value }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsxs(View, { style: [styles.dropdown, styles.inputContent], children: [_jsx(Field, { name: "input", children: ({ error, value, onChange }) => (_jsx(LakeLabel, { label: label, render: id => (_jsx(LakeTextInput, { nativeID: id, error: error, style: styles.input, placeholder: placeholder, value: value, onChangeText: onChange })) })) }), _jsx(LakeButton, { size: "small", color: "current", onPress: onSubmit, children: submitText })] }) })] }));
195
195
  }
196
+ function FilterBooleanTag({ children, onAdd, onPressRemove }) {
197
+ useEffect(onAdd, []); // eslint-disable-line react-hooks/exhaustive-deps
198
+ return (_jsx(Tag, { color: "current", onPressRemove: onPressRemove, children: children }));
199
+ }
196
200
  const getFilterValue = (_type, filters, name) => filters[name];
197
201
  export const FiltersStack = ({ filters, openedFilters, definition, onChangeOpened, onChangeFilters, }) => {
198
202
  const previousOpened = usePreviousValue(openedFilters);
@@ -224,7 +228,9 @@ export const FiltersStack = ({ filters, openedFilters, definition, onChangeOpene
224
228
  onChangeFilters({ ...filters, [filterName]: undefined });
225
229
  onChangeOpened(openedFilters.filter(f => f !== filterName));
226
230
  } })))
227
- .with({ type: "boolean" }, ({ label }) => (_jsx(Tag, { color: "current", onPressRemove: () => {
231
+ .with({ type: "boolean" }, ({ label }) => (_jsx(FilterBooleanTag, { onAdd: () => {
232
+ onChangeFilters({ ...filters, [filterName]: true });
233
+ }, onPressRemove: () => {
228
234
  onChangeFilters({ ...filters, [filterName]: undefined });
229
235
  onChangeOpened(openedFilters.filter(f => f !== filterName));
230
236
  }, children: label })))