@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.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
- export { i as fields } from './index-C1wa8N9L.cjs';
4
+ export { i as fields } from './index-_mVyhd0I.cjs';
5
5
 
6
6
  declare const buttonVariants: (props?: ({
7
7
  variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
- export { i as fields } from './index-C1wa8N9L.js';
4
+ export { i as fields } from './index-_mVyhd0I.js';
5
5
 
6
6
  declare const buttonVariants: (props?: ({
7
7
  variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
package/dist/index.js CHANGED
@@ -116,6 +116,7 @@ function _unsupported_iterable_to_array(o, minLen) {
116
116
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
117
117
  }
118
118
  import * as React4 from 'react';
119
+ import { createContext, useContext } from 'react';
119
120
  import { Slot } from '@radix-ui/react-slot';
120
121
  var __defProp = Object.defineProperty;
121
122
  var __export = function(target, all) {
@@ -4854,21 +4855,36 @@ function Button(_param) {
4854
4855
  // src/components/fields/index.tsx
4855
4856
  var fields_exports = {};
4856
4857
  __export(fields_exports, {
4858
+ InferredTypesContext: function() {
4859
+ return InferredTypesContext;
4860
+ },
4857
4861
  Input: function() {
4858
4862
  return Input;
4859
4863
  },
4860
4864
  NestedFieldProvider: function() {
4861
4865
  return NestedFieldProvider;
4862
4866
  },
4867
+ OPERATORS_BY_TYPE: function() {
4868
+ return OPERATORS_BY_TYPE;
4869
+ },
4863
4870
  Select: function() {
4864
4871
  return Select;
4865
4872
  },
4866
4873
  TemplateFieldProvider: function() {
4867
4874
  return TemplateFieldProvider;
4868
4875
  },
4876
+ getOperatorsForType: function() {
4877
+ return getOperatorsForType;
4878
+ },
4879
+ parseInferSyntax: function() {
4880
+ return parseInferSyntax;
4881
+ },
4869
4882
  useFieldPath: function() {
4870
4883
  return useFieldPath;
4871
4884
  },
4885
+ useInferredTypes: function() {
4886
+ return useInferredTypes;
4887
+ },
4872
4888
  useIsInTemplateFieldProvider: function() {
4873
4889
  return useIsInTemplateFieldProvider;
4874
4890
  },
@@ -5105,5 +5121,120 @@ function NestedFieldProvider(param) {
5105
5121
  var children = param.children;
5106
5122
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
5107
5123
  }
5124
+ var InferredTypesContext = createContext(null);
5125
+ function useInferredTypes() {
5126
+ return useContext(InferredTypesContext);
5127
+ }
5128
+ function parseInferSyntax(expectedType) {
5129
+ var _match_;
5130
+ if (!expectedType || !expectedType.startsWith("$infer<")) {
5131
+ return {
5132
+ mode: "normal"
5133
+ };
5134
+ }
5135
+ var match = expectedType.match(/^\$infer<(.+)>$/);
5136
+ if (!match) {
5137
+ return {
5138
+ mode: "normal"
5139
+ };
5140
+ }
5141
+ var content = ((_match_ = match[1]) === null || _match_ === void 0 ? void 0 : _match_.trim()) || "";
5142
+ if (!content.includes("|") && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(content)) {
5143
+ return {
5144
+ mode: "subscribe",
5145
+ subscribeToField: content
5146
+ };
5147
+ }
5148
+ var allowedTypes = content.split("|").map(function(t) {
5149
+ return t.trim();
5150
+ }).filter(Boolean);
5151
+ return {
5152
+ mode: "publish",
5153
+ allowedTypes: allowedTypes
5154
+ };
5155
+ }
5156
+ var OPERATORS_BY_TYPE = {
5157
+ string: [
5158
+ {
5159
+ value: "==",
5160
+ label: "equals (==)"
5161
+ },
5162
+ {
5163
+ value: "!=",
5164
+ label: "not equals (!=)"
5165
+ },
5166
+ {
5167
+ value: "contains",
5168
+ label: "contains"
5169
+ },
5170
+ {
5171
+ value: "startsWith",
5172
+ label: "starts with"
5173
+ },
5174
+ {
5175
+ value: "endsWith",
5176
+ label: "ends with"
5177
+ }
5178
+ ],
5179
+ number: [
5180
+ {
5181
+ value: "==",
5182
+ label: "equals (==)"
5183
+ },
5184
+ {
5185
+ value: "!=",
5186
+ label: "not equals (!=)"
5187
+ },
5188
+ {
5189
+ value: "<",
5190
+ label: "less than (<)"
5191
+ },
5192
+ {
5193
+ value: ">",
5194
+ label: "greater than (>)"
5195
+ },
5196
+ {
5197
+ value: "<=",
5198
+ label: "less than or equal (<=)"
5199
+ },
5200
+ {
5201
+ value: ">=",
5202
+ label: "greater than or equal (>=)"
5203
+ }
5204
+ ],
5205
+ boolean: [
5206
+ {
5207
+ value: "==",
5208
+ label: "equals (==)"
5209
+ },
5210
+ {
5211
+ value: "!=",
5212
+ label: "not equals (!=)"
5213
+ }
5214
+ ],
5215
+ any: [
5216
+ {
5217
+ value: "==",
5218
+ label: "equals (==)"
5219
+ },
5220
+ {
5221
+ value: "!=",
5222
+ label: "not equals (!=)"
5223
+ }
5224
+ ]
5225
+ };
5226
+ function getOperatorsForType(type) {
5227
+ var _OPERATORS_BY_TYPE_type, _ref;
5228
+ 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 : [
5229
+ {
5230
+ value: "==",
5231
+ label: "equals (==)"
5232
+ },
5233
+ {
5234
+ value: "!=",
5235
+ label: "not equals (!=)"
5236
+ }
5237
+ ];
5238
+ }
5108
5239
  export { Button, buttonVariants, fields_exports as fields }; //# sourceMappingURL=index.js.map
5109
5240
  //# sourceMappingURL=index.js.map