@pixelated-tech/components 3.7.4 → 3.7.5

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.
@@ -123,4 +123,85 @@ form span {
123
123
 
124
124
  .tooltip-text-item:last-child {
125
125
  margin-bottom: 0;
126
+ }
127
+
128
+ /* ========================================
129
+ ============= TAG INPUT ============
130
+ ======================================== */
131
+
132
+ .form-tag-input {
133
+ margin: 5px 0;
134
+ }
135
+
136
+ .tag-container {
137
+ display: flex;
138
+ flex-wrap: wrap;
139
+ align-items: center;
140
+ min-height: 40px;
141
+ padding: 5px;
142
+ border: 1px solid #CCC;
143
+ border-radius: 5px;
144
+ background-color: #FFF;
145
+ gap: 5px;
146
+ }
147
+
148
+ .tag-container:focus-within {
149
+ border-color: #0C0;
150
+ box-shadow: 0 0 5px 2px #CCC;
151
+ }
152
+
153
+ .tag-chip {
154
+ display: inline-flex;
155
+ align-items: center;
156
+ background-color: #eee;
157
+ padding: 4px 8px;
158
+ border-radius: 10px;
159
+ border: 1px solid #bbb;
160
+ white-space: nowrap;
161
+ }
162
+
163
+ .tag-remove {
164
+ background: none;
165
+ border: none;
166
+ color: #1565c0;
167
+ cursor: pointer;
168
+ font-size: 1.2em;
169
+ line-height: 1;
170
+ padding: 0;
171
+ margin-left: 4px;
172
+ border-radius: 50%;
173
+ width: 16px;
174
+ height: 16px;
175
+ display: flex;
176
+ align-items: center;
177
+ justify-content: center;
178
+ transition: background-color 0.2s;
179
+ }
180
+
181
+ .tag-remove:hover {
182
+ background-color: rgba(21, 101, 192, 0.1);
183
+ }
184
+
185
+ .tag-remove:disabled {
186
+ cursor: not-allowed;
187
+ opacity: 0.5;
188
+ }
189
+
190
+ .tag-input {
191
+ flex: 1;
192
+ min-width: 120px;
193
+ border: none;
194
+ outline: none;
195
+ padding: 4px 8px;
196
+ font-size: 1.1em;
197
+ font-family: Verdana, Geneva, sans-serif;
198
+ background: transparent;
199
+ }
200
+
201
+ .tag-input:focus {
202
+ outline: none;
203
+ }
204
+
205
+ .tag-input::placeholder {
206
+ color: #999;
126
207
  }
@@ -372,6 +372,92 @@ export function FormDataList(props) {
372
372
  }
373
373
  return (_jsx("datalist", { id: props.id, children: options }));
374
374
  }
375
+ FormTagInput.propTypes = {
376
+ id: PropTypes.string.isRequired,
377
+ name: PropTypes.string,
378
+ defaultValue: PropTypes.arrayOf(PropTypes.string),
379
+ value: PropTypes.arrayOf(PropTypes.string),
380
+ placeholder: PropTypes.string,
381
+ autoComplete: PropTypes.string,
382
+ // flag attributes
383
+ disabled: PropTypes.string,
384
+ readOnly: PropTypes.string,
385
+ required: PropTypes.string,
386
+ // ----- for calculations
387
+ display: PropTypes.string,
388
+ label: PropTypes.string,
389
+ tooltip: PropTypes.string,
390
+ className: PropTypes.string,
391
+ validate: PropTypes.string,
392
+ onChange: PropTypes.func,
393
+ };
394
+ export function FormTagInput(props) {
395
+ const [inputValue, setInputValue] = useState('');
396
+ const [internalTags, setInternalTags] = useState(Array.isArray(props.defaultValue) ? props.defaultValue.filter((tag) => tag != null) : []);
397
+ const { formValidate, handleBlur } = useFormComponent(props);
398
+ const { validateField } = useFormValidation();
399
+ // Determine if component is controlled or uncontrolled
400
+ const isControlled = props.value !== undefined;
401
+ // Get current tags array - use props.value if controlled, otherwise internal state
402
+ const currentTags = isControlled
403
+ ? (Array.isArray(props.value) ? props.value.filter((tag) => tag != null) : [])
404
+ : internalTags;
405
+ // Handle adding a new tag
406
+ const addTag = (tag) => {
407
+ const trimmedTag = tag.trim();
408
+ if (trimmedTag && !currentTags.includes(trimmedTag)) {
409
+ const newTags = [...currentTags, trimmedTag];
410
+ // Always call onChange if provided (for external updates)
411
+ if (props.onChange) {
412
+ props.onChange(newTags);
413
+ }
414
+ if (!isControlled) {
415
+ // Uncontrolled mode: update internal state
416
+ setInternalTags(newTags);
417
+ }
418
+ // Trigger form validation
419
+ if (props.id) {
420
+ validateField(props.id, true, []);
421
+ }
422
+ }
423
+ setInputValue('');
424
+ };
425
+ // Handle removing a tag
426
+ const removeTag = (tagToRemove) => {
427
+ const newTags = currentTags.filter(tag => tag !== tagToRemove);
428
+ // Always call onChange if provided (for external updates)
429
+ if (props.onChange) {
430
+ props.onChange(newTags);
431
+ }
432
+ if (!isControlled) {
433
+ // Uncontrolled mode: update internal state
434
+ setInternalTags(newTags);
435
+ }
436
+ // Trigger form validation
437
+ if (props.id) {
438
+ validateField(props.id, true, []);
439
+ }
440
+ };
441
+ // Handle input key events
442
+ const handleKeyDown = (event) => {
443
+ if (event.key === 'Enter' || event.key === ',') {
444
+ event.preventDefault();
445
+ addTag(inputValue);
446
+ }
447
+ else if (event.key === 'Backspace' && inputValue === '' && currentTags.length > 0) {
448
+ // Remove last tag on backspace when input is empty
449
+ const lastTag = currentTags[currentTags.length - 1];
450
+ if (lastTag) {
451
+ removeTag(lastTag);
452
+ }
453
+ }
454
+ };
455
+ // Handle input change
456
+ const handleInputChange = (event) => {
457
+ setInputValue(event.target.value);
458
+ };
459
+ return (_jsxs("div", { className: `form-tag-input ${props.className || ''}`, children: [_jsx(FormLabel, { id: props.id, label: props.label }, "label-" + props.id), props.tooltip ? _jsx(FormTooltip, { id: props.id, text: [props.tooltip] }) : "", props.display === "vertical" ? formValidate : "", _jsxs("div", { className: "tag-container", children: [currentTags.map((tag, index) => (_jsxs("span", { className: "tag-chip", children: [tag, _jsx("button", { type: "button", className: "tag-remove", onClick: () => removeTag(tag), "aria-label": `Remove ${tag}`, disabled: props.disabled === 'disabled', children: "\u00D7" })] }, index))), _jsx("input", { type: "text", id: props.id, name: props.name || undefined, value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: props.placeholder || "Add tag...", autoComplete: props.autoComplete || undefined, disabled: props.disabled === 'disabled', readOnly: props.readOnly === 'readOnly', required: props.required === 'required', className: "tag-input", "aria-label": "Add new tag" })] }), props.display !== "vertical" ? formValidate : ""] }));
460
+ }
375
461
  FormFieldset.propTypes = {};
376
462
  export function FormFieldset(props) {
377
463
  return (_jsx(_Fragment, {}));
@@ -358,6 +358,18 @@
358
358
  "tooltip": "Please enter your comments"
359
359
  }
360
360
  },
361
+ {
362
+ "component" : "FormTagInput",
363
+ "props" : {
364
+ "id" : "tags",
365
+ "name" : "tags",
366
+ "defaultValue" : ["react", "javascript"],
367
+ "display" : "horizontal",
368
+ "label" : "Tags : ",
369
+ "placeholder" : "Add tags...",
370
+ "tooltip" : "Add tags by typing and pressing Enter or comma"
371
+ }
372
+ },
361
373
  {
362
374
  "component" : "FormButton",
363
375
  "props" : {
@@ -194,6 +194,27 @@ export declare namespace FormDataList {
194
194
  items: PropTypes.Requireable<any[]>;
195
195
  };
196
196
  }
197
+ export type FormTagInputType = InferProps<typeof FormTagInput.propTypes>;
198
+ export declare function FormTagInput(props: FormTagInputType): import("react/jsx-runtime").JSX.Element;
199
+ export declare namespace FormTagInput {
200
+ var propTypes: {
201
+ id: PropTypes.Validator<string>;
202
+ name: PropTypes.Requireable<string>;
203
+ defaultValue: PropTypes.Requireable<(string | null | undefined)[]>;
204
+ value: PropTypes.Requireable<(string | null | undefined)[]>;
205
+ placeholder: PropTypes.Requireable<string>;
206
+ autoComplete: PropTypes.Requireable<string>;
207
+ disabled: PropTypes.Requireable<string>;
208
+ readOnly: PropTypes.Requireable<string>;
209
+ required: PropTypes.Requireable<string>;
210
+ display: PropTypes.Requireable<string>;
211
+ label: PropTypes.Requireable<string>;
212
+ tooltip: PropTypes.Requireable<string>;
213
+ className: PropTypes.Requireable<string>;
214
+ validate: PropTypes.Requireable<string>;
215
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
216
+ };
217
+ }
197
218
  export type FormFieldsetType = InferProps<typeof FormFieldset.propTypes>;
198
219
  export declare function FormFieldset(props: FormFieldsetType): import("react/jsx-runtime").JSX.Element;
199
220
  export declare namespace FormFieldset {
@@ -1 +1 @@
1
- {"version":3,"file":"formcomponents.d.ts","sourceRoot":"","sources":["../../../../../src/components/sitebuilder/form/formcomponents.tsx"],"names":[],"mappings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CAAC,CAAC;AACzE,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,2CAInD;yBAJe,YAAY;;;AAO5B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
@@ -4,14 +4,14 @@ declare namespace _default {
4
4
  export let decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
5
5
  }
6
6
  export default _default;
7
- export namespace BasicSplitScroll {
7
+ export namespace SplitScroll_Basic {
8
8
  function render(): import("react/jsx-runtime").JSX.Element;
9
9
  }
10
- export namespace ProductShowcase {
10
+ export namespace SplitScroll_ProductShowcase {
11
11
  export function render_1(): import("react/jsx-runtime").JSX.Element;
12
12
  export { render_1 as render };
13
13
  }
14
- export namespace MinimalSplitScroll {
14
+ export namespace SplitScroll_Minimal {
15
15
  export function render_2(): import("react/jsx-runtime").JSX.Element;
16
16
  export { render_2 as render };
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelated-tech/components",
3
- "version": "3.7.4",
3
+ "version": "3.7.5",
4
4
  "private": false,
5
5
  "author": {
6
6
  "name": "Pixelated Technologies",
@@ -1,19 +0,0 @@
1
- declare namespace _default {
2
- export let title: string;
3
- export { SplitScroll as component };
4
- export let decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
5
- }
6
- export default _default;
7
- export namespace BasicSplitScroll {
8
- function render(): import("react/jsx-runtime").JSX.Element;
9
- }
10
- export namespace ProductShowcase {
11
- export function render_1(): import("react/jsx-runtime").JSX.Element;
12
- export { render_1 as render };
13
- }
14
- export namespace MinimalSplitScroll {
15
- export function render_2(): import("react/jsx-runtime").JSX.Element;
16
- export { render_2 as render };
17
- }
18
- import { SplitScroll } from '@/components/general/splitscroll';
19
- //# sourceMappingURL=lookbook.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lookbook.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/lookbook/lookbook.stories.js"],"names":[],"mappings":";;;;;;;IA4BS,2DAwGP;;;IAIO,oEAyFP;;;;IAIO,oEAuBP;;;4BA3P0B,kCAAkC"}