@hammerstone/refine-react
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -111,3 +111,3 @@ var __create = Object.create; | ||
// src/components/query-builder/query-builder.tsx | ||
var import_react9 = __toESM(require("react")); | ||
var import_react19 = __toESM(require("react")); | ||
@@ -361,3 +361,3 @@ // ../core/dist/index.mjs | ||
// src/components/condition/condition.tsx | ||
var import_react3 = require("react"); | ||
var import_react3 = __toESM(require("react")); | ||
var Condition = ({ condition }) => { | ||
@@ -375,24 +375,24 @@ var _a, _b; | ||
}, [selectedClause == null ? void 0 : selectedClause.component]); | ||
return /* @__PURE__ */ React.createElement(ClauseProvider, { | ||
return /* @__PURE__ */ import_react3.default.createElement(ClauseProvider, { | ||
value: selectedClause | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "condition", | ||
"data-testid": "refine-condition" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select", | ||
value: condition.id, | ||
onChange: (conditionId) => criterion2.updateCondition(conditionId) | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select.button" | ||
}, condition.display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, condition.display), /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select.listbox" | ||
}, conditions.map((condition2) => /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, conditions.map((condition2) => /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
key: condition2.id, | ||
name: "select.listbox.item", | ||
value: condition2.id | ||
}, condition2.display))))), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, condition2.display))))), /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select", | ||
@@ -403,11 +403,11 @@ value: selectedClause.id, | ||
}) | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select.button" | ||
}, selectedClause.display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, selectedClause.display), /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
name: "select.listbox" | ||
}, condition.meta.clauses.map((clause) => /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, condition.meta.clauses.map((clause) => /* @__PURE__ */ import_react3.default.createElement(FlavorItem, { | ||
key: clause.id, | ||
name: "select.listbox.item", | ||
value: clause.id | ||
}, clause.display))))), hasInput && /* @__PURE__ */ React.createElement(InputProvider, { | ||
}, clause.display))))), hasInput && /* @__PURE__ */ import_react3.default.createElement(InputProvider, { | ||
value: { | ||
@@ -420,5 +420,5 @@ display: selectedClause.display, | ||
} | ||
}, !!InputComponent && /* @__PURE__ */ React.createElement("div", { | ||
}, !!InputComponent && /* @__PURE__ */ import_react3.default.createElement("div", { | ||
"data-testid": "refine-input" | ||
}, /* @__PURE__ */ React.createElement(InputComponent, null))))); | ||
}, /* @__PURE__ */ import_react3.default.createElement(InputComponent, null))))); | ||
}; | ||
@@ -437,2 +437,3 @@ | ||
// src/components/criterion/criterion.tsx | ||
var import_react4 = __toESM(require("react")); | ||
var Criterion = ({ index }) => { | ||
@@ -448,3 +449,3 @@ var _b; | ||
const condition = useCondition(criterion2.condition_id); | ||
return /* @__PURE__ */ React.createElement(CriterionProvider, { | ||
return /* @__PURE__ */ import_react4.default.createElement(CriterionProvider, { | ||
value: __spreadValues({ | ||
@@ -456,12 +457,12 @@ updateCondition: (conditionId) => blueprint.replaceCriterion(criterion2.position, { | ||
}, criterion2) | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react4.default.createElement(FlavorItem, { | ||
name: "criterion", | ||
"data-testid": "refine-criterion" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react4.default.createElement(FlavorItem, { | ||
name: "criterion.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react4.default.createElement(FlavorItem, { | ||
name: "criterion.removeCriterionButton", | ||
"data-testid": "refine-remove-criterion", | ||
onClick: () => blueprint.removeCriterion(criterion2.position) | ||
}, /* @__PURE__ */ React.createElement("svg", { | ||
}, /* @__PURE__ */ import_react4.default.createElement("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -472,13 +473,13 @@ style: { width: "1.25rem", height: "1.25rem" }, | ||
"aria-hidden": "true" | ||
}, /* @__PURE__ */ React.createElement("path", { | ||
}, /* @__PURE__ */ import_react4.default.createElement("path", { | ||
fillRule: "evenodd", | ||
d: "M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z", | ||
clipRule: "evenodd" | ||
})), /* @__PURE__ */ React.createElement(Label, { | ||
})), /* @__PURE__ */ import_react4.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, "Remove Criterion")), /* @__PURE__ */ React.createElement(Condition, { | ||
}, "Remove Criterion")), /* @__PURE__ */ import_react4.default.createElement(Condition, { | ||
condition | ||
})), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
})), /* @__PURE__ */ import_react4.default.createElement(FlavorItem, { | ||
name: "criterion.errors" | ||
}, errors.map((error) => /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, errors.map((error) => /* @__PURE__ */ import_react4.default.createElement(FlavorItem, { | ||
key: error.id, | ||
@@ -490,7 +491,7 @@ name: "criterion.errors.error" | ||
// src/components/criterion/use-criterion.ts | ||
var import_react4 = require("react"); | ||
var CriterionContext = (0, import_react4.createContext)(null); | ||
var import_react5 = require("react"); | ||
var CriterionContext = (0, import_react5.createContext)(null); | ||
var CriterionProvider = CriterionContext.Provider; | ||
var useCriterion = () => { | ||
const criterion2 = (0, import_react4.useContext)(CriterionContext); | ||
const criterion2 = (0, import_react5.useContext)(CriterionContext); | ||
if (!criterion2) { | ||
@@ -503,2 +504,3 @@ throw new Error(`useCriterion can only be used within a CriterionProvider.`); | ||
// src/components/criterion-group/criterion-group.tsx | ||
var import_react6 = __toESM(require("react")); | ||
var CriterionGroup = ({ index, criteria }) => { | ||
@@ -508,3 +510,3 @@ const { blueprint, groupedBlueprint } = useQueryBuilder(); | ||
const addCriterion = () => blueprint.insertCriterion(group[group.length - 1].position); | ||
return /* @__PURE__ */ React.createElement(CriterionGroupProvider, { | ||
return /* @__PURE__ */ import_react6.default.createElement(CriterionGroupProvider, { | ||
value: { | ||
@@ -514,15 +516,15 @@ index, | ||
} | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react6.default.createElement(FlavorItem, { | ||
name: "group", | ||
"data-testid": "refine-criterion-group" | ||
}, criteria.map((criterion2, index2) => /* @__PURE__ */ React.createElement(Criterion, { | ||
}, criteria.map((criterion2, index2) => /* @__PURE__ */ import_react6.default.createElement(Criterion, { | ||
key: index2, | ||
index: index2 | ||
})), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
})), /* @__PURE__ */ import_react6.default.createElement(FlavorItem, { | ||
name: "group.addCriterionButton", | ||
"data-testid": "refine-add-criterion", | ||
onClick: () => addCriterion() | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react6.default.createElement(FlavorItem, { | ||
name: "group.addCriterionButton.icon" | ||
}, /* @__PURE__ */ React.createElement("svg", { | ||
}, /* @__PURE__ */ import_react6.default.createElement("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -533,7 +535,7 @@ viewBox: "0 0 20 20", | ||
"aria-hidden": "true" | ||
}, /* @__PURE__ */ React.createElement("path", { | ||
}, /* @__PURE__ */ import_react6.default.createElement("path", { | ||
fillRule: "evenodd", | ||
d: "M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z", | ||
clipRule: "evenodd" | ||
}))), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}))), /* @__PURE__ */ import_react6.default.createElement(FlavorItem, { | ||
name: "group.addCriterionButton.text" | ||
@@ -544,7 +546,7 @@ }, "And")))); | ||
// src/components/criterion-group/use-criterion-group.ts | ||
var import_react5 = require("react"); | ||
var CriterionGroupContext = (0, import_react5.createContext)(null); | ||
var import_react7 = require("react"); | ||
var CriterionGroupContext = (0, import_react7.createContext)(null); | ||
var CriterionGroupProvider = CriterionGroupContext.Provider; | ||
var useCriterionGroup = () => { | ||
const criterionGroup = (0, import_react5.useContext)(CriterionGroupContext); | ||
const criterionGroup = (0, import_react7.useContext)(CriterionGroupContext); | ||
if (!criterionGroup) { | ||
@@ -557,3 +559,3 @@ throw new Error(`useCriterionGroup can only be used within a CriterionGroupProvider.`); | ||
// src/components/flavor-item/flavor-item.tsx | ||
var import_react6 = __toESM(require("react")); | ||
var import_react8 = __toESM(require("react")); | ||
@@ -581,3 +583,3 @@ // src/components/flavor-item/use-flavor-item.ts | ||
const { component: Component, className, style } = useFlavorItem(name); | ||
return /* @__PURE__ */ import_react6.default.createElement(Component, __spreadProps(__spreadValues({}, props), { | ||
return /* @__PURE__ */ import_react8.default.createElement(Component, __spreadProps(__spreadValues({}, props), { | ||
className: typeof className === "function" ? className({}) : className, | ||
@@ -589,7 +591,8 @@ style: typeof style === "function" ? style({}) : style | ||
// src/components/inputs/date/date-input.tsx | ||
var import_react9 = __toESM(require("react")); | ||
var DateInput = () => { | ||
const { display, value, onChange } = useInput(); | ||
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label, { | ||
return /* @__PURE__ */ import_react9.default.createElement("div", null, /* @__PURE__ */ import_react9.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, display), /* @__PURE__ */ import_react9.default.createElement(FlavorItem, { | ||
name: "inputs.date", | ||
@@ -602,15 +605,16 @@ value, | ||
// src/components/inputs/double-date/double-date-input.tsx | ||
var import_react10 = __toESM(require("react")); | ||
var DoubleDateInput = () => { | ||
const { display, date1, date2, onChange } = useInput(); | ||
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label, { | ||
return /* @__PURE__ */ import_react10.default.createElement("div", null, /* @__PURE__ */ import_react10.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, display), /* @__PURE__ */ import_react10.default.createElement(FlavorItem, { | ||
name: "inputs.date.double.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react10.default.createElement(FlavorItem, { | ||
name: "inputs.date.double", | ||
value: date1, | ||
onChange: (event) => onChange({ date1: event.target.value }) | ||
}), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}), /* @__PURE__ */ import_react10.default.createElement(FlavorItem, { | ||
name: "inputs.date.double.joiner" | ||
}, "and"), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, "and"), /* @__PURE__ */ import_react10.default.createElement(FlavorItem, { | ||
name: "inputs.date.double", | ||
@@ -623,7 +627,8 @@ value: date2, | ||
// src/components/inputs/number/number-input.tsx | ||
var import_react11 = __toESM(require("react")); | ||
var NumberInput = () => { | ||
const { display, value, onChange } = useInput(); | ||
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label, { | ||
return /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, display), /* @__PURE__ */ import_react11.default.createElement(FlavorItem, { | ||
name: "inputs.number", | ||
@@ -636,15 +641,16 @@ value, | ||
// src/components/inputs/double-number/double-number-input.tsx | ||
var import_react12 = __toESM(require("react")); | ||
var DoubleNumberInput = () => { | ||
const { display, value1, value2, onChange } = useInput(); | ||
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label, { | ||
return /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, display), /* @__PURE__ */ import_react12.default.createElement(FlavorItem, { | ||
name: "inputs.number.double.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react12.default.createElement(FlavorItem, { | ||
name: "inputs.number.double", | ||
value: value1, | ||
onChange: (event) => onChange({ value1: event.target.value }) | ||
}), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}), /* @__PURE__ */ import_react12.default.createElement(FlavorItem, { | ||
name: "inputs.number.double.joiner" | ||
}, "and"), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, "and"), /* @__PURE__ */ import_react12.default.createElement(FlavorItem, { | ||
name: "inputs.number.double", | ||
@@ -656,2 +662,5 @@ value: value2, | ||
// src/components/inputs/option/option-input.tsx | ||
var import_react13 = __toESM(require("react")); | ||
// src/utils/utils.ts | ||
@@ -682,9 +691,3 @@ var import_deepmerge = __toESM(require("deepmerge")); | ||
var OptionInput = () => { | ||
const { | ||
display, | ||
options, | ||
multiple = false, | ||
value, | ||
onChange | ||
} = useInput(); | ||
const { display, options, multiple = false, value, onChange } = useInput(); | ||
if (!options) { | ||
@@ -694,7 +697,7 @@ throw new Error(`No options provided to OptionInput.`); | ||
console.log("value:", value); | ||
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label, { | ||
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, display), /* @__PURE__ */ import_react13.default.createElement(FlavorItem, { | ||
name: "select.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react13.default.createElement(FlavorItem, { | ||
name: "select", | ||
@@ -709,3 +712,3 @@ value: multiple ? valueToArray(value) : value, | ||
multiple | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react13.default.createElement(FlavorItem, { | ||
name: "select.button" | ||
@@ -715,5 +718,5 @@ }, valueToArray(value).map((value2) => { | ||
return (_a = options.find((option) => option.id === value2)) == null ? void 0 : _a.display; | ||
}).filter(Boolean).join(", ")), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}).filter(Boolean).join(", ")), /* @__PURE__ */ import_react13.default.createElement(FlavorItem, { | ||
name: "select.listbox" | ||
}, options.map((option) => /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, options.map((option) => /* @__PURE__ */ import_react13.default.createElement(FlavorItem, { | ||
key: option.id, | ||
@@ -726,2 +729,3 @@ name: "select.listbox.item", | ||
// src/components/inputs/relative-date/relative-date-input.tsx | ||
var import_react14 = __toESM(require("react")); | ||
var RelativeDateInput = () => { | ||
@@ -732,35 +736,35 @@ const { | ||
const { display, amount, unit, modifier, onChange } = useInput(); | ||
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label, { | ||
return /* @__PURE__ */ import_react14.default.createElement("div", null, /* @__PURE__ */ import_react14.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, display), /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "inputs.date.relative.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "inputs.date.relative", | ||
value: amount, | ||
onChange: (event) => onChange({ amount: event.target.value }) | ||
}), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}), /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select", | ||
value: unit, | ||
onChange: (value) => onChange({ unit: arrayToValue(value) }) | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select.button" | ||
}, units.find(({ id }) => unit === id)), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, units.find(({ id }) => unit === id)), /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select.listbox" | ||
}, units.map((unit2) => /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, units.map((unit2) => /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
key: unit2.id, | ||
name: "select.listbox.item", | ||
value: unit2.id | ||
}, unit2.display))))), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, unit2.display))))), /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select.wrapper" | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select", | ||
value: modifier, | ||
onChange: (value) => onChange({ modifier: arrayToValue(value) }) | ||
}, /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select.button" | ||
}, modifiers.find(({ id }) => modifier === id)), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, modifiers.find(({ id }) => modifier === id)), /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
name: "select.listbox" | ||
}, modifiers.map((modifier2) => /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, modifiers.map((modifier2) => /* @__PURE__ */ import_react14.default.createElement(FlavorItem, { | ||
key: modifier2.id, | ||
@@ -773,7 +777,8 @@ name: "select.listbox.item", | ||
// src/components/inputs/text/text-input.tsx | ||
var import_react15 = __toESM(require("react")); | ||
var TextInput = () => { | ||
const { display, value, onChange } = useInput(); | ||
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Label, { | ||
return /* @__PURE__ */ import_react15.default.createElement("div", null, /* @__PURE__ */ import_react15.default.createElement(Label, { | ||
screenReaderOnly: true | ||
}, display), /* @__PURE__ */ React.createElement(FlavorItem, { | ||
}, display), /* @__PURE__ */ import_react15.default.createElement(FlavorItem, { | ||
name: "inputs.text", | ||
@@ -786,7 +791,7 @@ value, | ||
// src/components/inputs/use-input.ts | ||
var import_react7 = require("react"); | ||
var InputContext = (0, import_react7.createContext)(null); | ||
var import_react16 = require("react"); | ||
var InputContext = (0, import_react16.createContext)(null); | ||
var InputProvider = InputContext.Provider; | ||
var useInput = () => { | ||
const input = (0, import_react7.useContext)(InputContext); | ||
const input = (0, import_react16.useContext)(InputContext); | ||
if (!input) { | ||
@@ -810,2 +815,3 @@ throw new Error(`useInput can only be used within a InputProvider.`); | ||
// src/components/label/label.tsx | ||
var import_react17 = __toESM(require("react")); | ||
var srOnly = { | ||
@@ -823,12 +829,4 @@ position: "absolute", | ||
var Label = (_a) => { | ||
var _b = _a, { | ||
screenReaderOnly = false, | ||
children, | ||
style | ||
} = _b, props = __objRest(_b, [ | ||
"screenReaderOnly", | ||
"children", | ||
"style" | ||
]); | ||
return /* @__PURE__ */ React.createElement("label", __spreadProps(__spreadValues({}, props), { | ||
var _b = _a, { screenReaderOnly = false, children, style } = _b, props = __objRest(_b, ["screenReaderOnly", "children", "style"]); | ||
return /* @__PURE__ */ import_react17.default.createElement("label", __spreadProps(__spreadValues({}, props), { | ||
style: __spreadValues(__spreadValues({}, style), screenReaderOnly ? srOnly : {}) | ||
@@ -839,6 +837,6 @@ }), children); | ||
// src/flavors/base.tsx | ||
var import_react8 = __toESM(require("react")); | ||
var import_react18 = __toESM(require("react")); | ||
var baseFlavor = { | ||
group: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)), | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)), | ||
wrapper: { | ||
@@ -848,10 +846,10 @@ component: (props) => null | ||
addCriterionButton: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("button", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("button", __spreadValues({ | ||
type: "button" | ||
}, props)), | ||
icon: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", __spreadValues({}, props)) | ||
}, | ||
text: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", __spreadValues({}, props)) | ||
} | ||
@@ -861,3 +859,3 @@ } | ||
addGroupButton: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("button", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("button", __spreadValues({ | ||
type: "button" | ||
@@ -867,8 +865,8 @@ }, props)) | ||
criterion: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)), | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)), | ||
wrapper: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)) | ||
}, | ||
removeCriterionButton: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("button", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("button", __spreadValues({ | ||
type: "button" | ||
@@ -878,5 +876,5 @@ }, props)) | ||
errors: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("ul", __spreadValues({}, props)), | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("ul", __spreadValues({}, props)), | ||
error: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("li", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("li", __spreadValues({}, props)) | ||
} | ||
@@ -886,3 +884,3 @@ } | ||
condition: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)) | ||
}, | ||
@@ -892,3 +890,3 @@ select: { | ||
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]); | ||
return /* @__PURE__ */ import_react8.default.createElement("select", __spreadProps(__spreadValues({}, props), { | ||
return /* @__PURE__ */ import_react18.default.createElement("select", __spreadProps(__spreadValues({}, props), { | ||
onChange: (event) => onChange(event.target.value) | ||
@@ -898,3 +896,3 @@ })); | ||
wrapper: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)) | ||
}, | ||
@@ -964,34 +962,34 @@ customOptions: { | ||
date: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("input", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("input", __spreadValues({ | ||
type: "date" | ||
}, props)), | ||
double: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("input", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("input", __spreadValues({ | ||
type: "date" | ||
}, props)), | ||
wrapper: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)) | ||
}, | ||
joiner: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", __spreadValues({}, props)) | ||
} | ||
}, | ||
relative: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("input", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("input", __spreadValues({ | ||
type: "number" | ||
}, props)), | ||
wrapper: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)) | ||
} | ||
}, | ||
calendar: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", null, "TODO: implement me"), | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", null, "TODO: implement me"), | ||
icon: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", null, "TODO: implement me") | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", null, "TODO: implement me") | ||
} | ||
}, | ||
error: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", null, "TODO: implement me"), | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", null, "TODO: implement me"), | ||
icon: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", null, "TODO: implement me") | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", null, "TODO: implement me") | ||
} | ||
@@ -1001,14 +999,14 @@ } | ||
number: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("input", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("input", __spreadValues({ | ||
type: "number" | ||
}, props)), | ||
double: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("input", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("input", __spreadValues({ | ||
type: "number" | ||
}, props)), | ||
wrapper: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("div", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("div", __spreadValues({}, props)) | ||
}, | ||
joiner: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("span", __spreadValues({}, props)) | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("span", __spreadValues({}, props)) | ||
} | ||
@@ -1018,3 +1016,3 @@ } | ||
text: { | ||
component: (props) => /* @__PURE__ */ import_react8.default.createElement("input", __spreadValues({ | ||
component: (props) => /* @__PURE__ */ import_react18.default.createElement("input", __spreadValues({ | ||
type: "text" | ||
@@ -1029,3 +1027,3 @@ }, props)) | ||
var useRerender = () => { | ||
const [, rerender] = (0, import_react9.useReducer)(() => null, null); | ||
const [, rerender] = (0, import_react19.useReducer)(() => null, null); | ||
return rerender; | ||
@@ -1041,3 +1039,3 @@ }; | ||
const rerender = useRerender(); | ||
const { blueprint, flavor } = (0, import_react9.useMemo)(() => { | ||
const { blueprint, flavor } = (0, import_react19.useMemo)(() => { | ||
const blueprint2 = new BlueprintStore(initialBlueprint, conditions, (blueprint3) => { | ||
@@ -1050,3 +1048,3 @@ onChange == null ? void 0 : onChange(blueprint3); | ||
}, []); | ||
return /* @__PURE__ */ import_react9.default.createElement(QueryBuilderProvider, { | ||
return /* @__PURE__ */ import_react19.default.createElement(QueryBuilderProvider, { | ||
value: { | ||
@@ -1059,9 +1057,9 @@ blueprint, | ||
} | ||
}, /* @__PURE__ */ import_react9.default.createElement("div", { | ||
}, /* @__PURE__ */ import_react19.default.createElement("div", { | ||
"data-testid": "refine-query-builder" | ||
}, blueprint.groupedBlueprint().map((criteria, index) => /* @__PURE__ */ import_react9.default.createElement(CriterionGroup, { | ||
}, blueprint.groupedBlueprint().map((criteria, index) => /* @__PURE__ */ import_react19.default.createElement(CriterionGroup, { | ||
key: index, | ||
criteria, | ||
index | ||
})), /* @__PURE__ */ import_react9.default.createElement(FlavorItem, { | ||
})), /* @__PURE__ */ import_react19.default.createElement(FlavorItem, { | ||
name: "addGroupButton", | ||
@@ -1074,7 +1072,7 @@ "data-testid": "refine-add-criterion-group", | ||
// src/components/query-builder/use-query-builder.tsx | ||
var import_react10 = require("react"); | ||
var QueryBuilderContext = (0, import_react10.createContext)(null); | ||
var import_react20 = require("react"); | ||
var QueryBuilderContext = (0, import_react20.createContext)(null); | ||
var QueryBuilderProvider = QueryBuilderContext.Provider; | ||
var useQueryBuilder = () => { | ||
const context = (0, import_react10.useContext)(QueryBuilderContext); | ||
const context = (0, import_react20.useContext)(QueryBuilderContext); | ||
if (!context) { | ||
@@ -1081,0 +1079,0 @@ throw new Error(`useQueryBuilder can only be used within a QueryBuilderProvider`); |
{ | ||
"name": "@hammerstone/refine-react", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.mjs", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122405
3494