@process.co/ui 0.0.6 → 0.0.7

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.
@@ -110,7 +110,7 @@ function _interopNamespace(e) {
110
110
  return Object.freeze(n);
111
111
  }
112
112
  var React3__namespace = /*#__PURE__*/ _interopNamespace(React3);
113
- // src/components/fields/Input.tsx
113
+ // src/components/fields/index.tsx
114
114
  // ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
115
115
  function r(e) {
116
116
  var t, f, n = "";
@@ -4987,11 +4987,131 @@ function NestedFieldProvider(param) {
4987
4987
  var children = param.children;
4988
4988
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
4989
4989
  }
4990
+ var InferredTypesContext = React3.createContext(null);
4991
+ function useInferredTypes() {
4992
+ return React3.useContext(InferredTypesContext);
4993
+ }
4994
+ function parseInferSyntax(expectedType) {
4995
+ var _match_;
4996
+ if (!expectedType || !expectedType.startsWith("$infer<")) {
4997
+ return {
4998
+ mode: "normal"
4999
+ };
5000
+ }
5001
+ var match = expectedType.match(/^\$infer<(.+)>$/);
5002
+ if (!match) {
5003
+ return {
5004
+ mode: "normal"
5005
+ };
5006
+ }
5007
+ var content = ((_match_ = match[1]) === null || _match_ === void 0 ? void 0 : _match_.trim()) || "";
5008
+ if (!content.includes("|") && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(content)) {
5009
+ return {
5010
+ mode: "subscribe",
5011
+ subscribeToField: content
5012
+ };
5013
+ }
5014
+ var allowedTypes = content.split("|").map(function(t) {
5015
+ return t.trim();
5016
+ }).filter(Boolean);
5017
+ return {
5018
+ mode: "publish",
5019
+ allowedTypes: allowedTypes
5020
+ };
5021
+ }
5022
+ var OPERATORS_BY_TYPE = {
5023
+ string: [
5024
+ {
5025
+ value: "==",
5026
+ label: "equals (==)"
5027
+ },
5028
+ {
5029
+ value: "!=",
5030
+ label: "not equals (!=)"
5031
+ },
5032
+ {
5033
+ value: "contains",
5034
+ label: "contains"
5035
+ },
5036
+ {
5037
+ value: "startsWith",
5038
+ label: "starts with"
5039
+ },
5040
+ {
5041
+ value: "endsWith",
5042
+ label: "ends with"
5043
+ }
5044
+ ],
5045
+ number: [
5046
+ {
5047
+ value: "==",
5048
+ label: "equals (==)"
5049
+ },
5050
+ {
5051
+ value: "!=",
5052
+ label: "not equals (!=)"
5053
+ },
5054
+ {
5055
+ value: "<",
5056
+ label: "less than (<)"
5057
+ },
5058
+ {
5059
+ value: ">",
5060
+ label: "greater than (>)"
5061
+ },
5062
+ {
5063
+ value: "<=",
5064
+ label: "less than or equal (<=)"
5065
+ },
5066
+ {
5067
+ value: ">=",
5068
+ label: "greater than or equal (>=)"
5069
+ }
5070
+ ],
5071
+ boolean: [
5072
+ {
5073
+ value: "==",
5074
+ label: "equals (==)"
5075
+ },
5076
+ {
5077
+ value: "!=",
5078
+ label: "not equals (!=)"
5079
+ }
5080
+ ],
5081
+ any: [
5082
+ {
5083
+ value: "==",
5084
+ label: "equals (==)"
5085
+ },
5086
+ {
5087
+ value: "!=",
5088
+ label: "not equals (!=)"
5089
+ }
5090
+ ]
5091
+ };
5092
+ function getOperatorsForType(type) {
5093
+ var _OPERATORS_BY_TYPE_type, _ref;
5094
+ return (_ref = (_OPERATORS_BY_TYPE_type = OPERATORS_BY_TYPE[type]) !== null && _OPERATORS_BY_TYPE_type !== void 0 ? _OPERATORS_BY_TYPE_type : OPERATORS_BY_TYPE.any) !== null && _ref !== void 0 ? _ref : [
5095
+ {
5096
+ value: "==",
5097
+ label: "equals (==)"
5098
+ },
5099
+ {
5100
+ value: "!=",
5101
+ label: "not equals (!=)"
5102
+ }
5103
+ ];
5104
+ }
5105
+ exports.InferredTypesContext = InferredTypesContext;
4990
5106
  exports.Input = Input;
4991
5107
  exports.NestedFieldProvider = NestedFieldProvider;
5108
+ exports.OPERATORS_BY_TYPE = OPERATORS_BY_TYPE;
4992
5109
  exports.Select = Select;
4993
5110
  exports.TemplateFieldProvider = TemplateFieldProvider;
5111
+ exports.getOperatorsForType = getOperatorsForType;
5112
+ exports.parseInferSyntax = parseInferSyntax;
4994
5113
  exports.useFieldPath = useFieldPath;
5114
+ exports.useInferredTypes = useInferredTypes;
4995
5115
  exports.useIsInTemplateFieldProvider = useIsInTemplateFieldProvider;
4996
5116
  exports.useTemplateFieldContext = useTemplateFieldContext; //# sourceMappingURL=index.cjs.map
4997
5117
  //# sourceMappingURL=index.cjs.map