@vev/silke 1.0.14 → 1.0.16

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{chunk-KMZFUBRE.js → chunk-LAB2YEXC.js} +4 -4
  3. package/dist/chunk-LAB2YEXC.js.LEGAL.txt +11 -0
  4. package/dist/{chunk-KMZFUBRE.js.map → chunk-LAB2YEXC.js.map} +1 -1
  5. package/dist/index.js +9 -9
  6. package/dist/index.js.LEGAL.txt +49 -21
  7. package/dist/index.js.map +4 -4
  8. package/dist/silke-code-editor-WEBZ7JXL.js +25 -0
  9. package/dist/silke-code-editor-WEBZ7JXL.js.LEGAL.txt +0 -0
  10. package/dist/silke-code-editor-WEBZ7JXL.js.map +7 -0
  11. package/dist/styles.css +100 -103
  12. package/esbuild.config.mjs +47 -43
  13. package/jest.config.js +1 -2
  14. package/package.json +3 -3
  15. package/src/components/silke-autocomplete-field/silke-autocomplete-field.spec.tsx +0 -2
  16. package/src/components/silke-autocomplete-field/silke-autocomplete-field.tsx +6 -4
  17. package/src/components/silke-color-picker/silke-color-info.tsx +2 -2
  18. package/src/components/silke-form-schema/fields/array-field-inline.tsx +1 -1
  19. package/src/components/silke-form-schema/fields/array-field-modal.tsx +1 -1
  20. package/src/components/silke-form-schema/fields/array-field.tsx +2 -2
  21. package/src/components/silke-form-schema/fields/event-field.tsx +1 -1
  22. package/src/components/silke-form-schema/fields/icon-field.tsx +2 -2
  23. package/src/components/silke-form-schema/fields/image-field.tsx +3 -2
  24. package/src/components/silke-form-schema/fields/layout-field.tsx +1 -1
  25. package/src/components/silke-form-schema/fields/link-field.tsx +3 -2
  26. package/src/components/silke-form-schema/fields/number-field.tsx +3 -2
  27. package/src/components/silke-form-schema/fields/object-field.tsx +3 -2
  28. package/src/components/silke-form-schema/fields/select-field.tsx +7 -8
  29. package/src/components/silke-form-schema/fields/string-field.tsx +2 -6
  30. package/src/components/silke-form-schema/fields/toggle-field.tsx +15 -11
  31. package/src/components/silke-form-schema/fields/upload-field.tsx +1 -1
  32. package/src/components/silke-form-schema/fields/utils/generate-image.ts +1 -1
  33. package/src/components/silke-form-schema/fields/utils/generate-title.ts +1 -1
  34. package/src/components/silke-form-schema/fields/utils/schema-util.ts +6 -0
  35. package/src/components/silke-form-schema/schema-utils.ts +1 -1
  36. package/src/components/silke-form-schema/silke-form-schema.tsx +1 -1
  37. package/src/components/silke-form-schema/silke-schema-context.tsx +1 -1
  38. package/src/components/silke-form-schema/silke-schema-field.tsx +1 -1
  39. package/src/components/silke-form-schema/silke-schema-fields.tsx +1 -1
  40. package/src/components/silke-select-field/silke-select-field.spec.tsx +1 -2
  41. package/src/components/silke-tag/silke-tag.tsx +2 -2
  42. package/src/hooks/use-drop-zone.ts +0 -3
  43. package/src/icons.tsx +2 -0
  44. package/tsconfig.json +1 -1
  45. package/webpack.docs.ts +1 -1
  46. package/dist/chunk-KMZFUBRE.js.LEGAL.txt +0 -8
  47. package/dist/silke-code-editor-UX2ML2WG.js +0 -23
  48. package/dist/silke-code-editor-UX2ML2WG.js.map +0 -7
@@ -1,22 +1,26 @@
1
- import { BooleanField, SchemaFieldProps } from '@vev/react';
1
+ import { BooleanField, SchemaFieldProps } from '@vev/utils';
2
2
  import React from 'react';
3
3
  import { SilkeBox } from '../../silke-box';
4
4
  import { SilkeToggle } from '../../silke-toggle';
5
5
  import { SilkeTextSmall } from '../../silke-text';
6
+ import { getTitle } from './utils/schema-util';
6
7
 
7
- const Toggle = (props: SchemaFieldProps<BooleanField>) => {
8
+ const Toggle = ({ schema, value, onChange }: SchemaFieldProps<BooleanField>) => {
8
9
  return (
9
- <SilkeBox flex>
10
- <SilkeBox align="start" style={{ width: '80px' }}>
11
- <SilkeBox vAlign="center" flex>
12
- <SilkeTextSmall weight="strong">
13
- {props.schema.title || props.schema.description || props.schema.name}
14
- </SilkeTextSmall>
10
+ <SilkeBox column>
11
+ <SilkeBox flex>
12
+ <SilkeBox align="center" style={{ width: '80px' }}>
13
+ <SilkeBox vAlign="center" flex>
14
+ <SilkeTextSmall weight="strong">{getTitle(schema)}</SilkeTextSmall>
15
+ </SilkeBox>
16
+ </SilkeBox>
17
+ <SilkeBox flex pad="xs">
18
+ <SilkeToggle value={value || false} onChange={onChange} small />
15
19
  </SilkeBox>
16
20
  </SilkeBox>
17
- <SilkeBox flex pad="xs">
18
- <SilkeToggle value={props.value || false} onChange={props.onChange} small />
19
- </SilkeBox>
21
+ {schema.description && (
22
+ <SilkeTextSmall color="neutral-80">{schema.description}</SilkeTextSmall>
23
+ )}
20
24
  </SilkeBox>
21
25
  );
22
26
  };
@@ -1,4 +1,4 @@
1
- import { SchemaFieldProps, UploadField as UploadFieldType } from '@vev/react';
1
+ import { SchemaFieldProps, UploadField as UploadFieldType } from '@vev/utils';
2
2
  import React from 'react';
3
3
  import { SilkeBox } from '../../silke-box';
4
4
  import { SilkeTextSmall } from '../../silke-text';
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { isObject, isFunction, isArray } from 'lodash';
3
- import { VevProps } from '@vev/react';
3
+ import { VevProps } from '@vev/utils';
4
4
  import { flattenObject } from './generate-title';
5
5
 
6
6
  export const generateImage = (
@@ -1,5 +1,5 @@
1
1
  import { isObject, capitalize, isFunction } from 'lodash';
2
- import { VevProps } from '@vev/react';
2
+ import { VevProps } from '@vev/utils';
3
3
 
4
4
  export const generateTitle = (
5
5
  data: { [key: string]: any } | { [key: string]: any }[] | string,
@@ -0,0 +1,6 @@
1
+ import { VevProps } from '@vev/utils';
2
+ import { startCase } from 'lodash';
3
+
4
+ export const getTitle = (schema: VevProps) => {
5
+ return schema.title || startCase(schema.name);
6
+ };
@@ -1,4 +1,4 @@
1
- import { EvalCallback, Schema, SchemaContextModel } from '@vev/react';
1
+ import { EvalCallback, Schema, SchemaContextModel } from '@vev/utils';
2
2
  import { isFunction } from 'lodash';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { safeEvalFunction } from './safe-eval';
@@ -1,4 +1,4 @@
1
- import { Schema, SchemaContextModel } from '@vev/react';
1
+ import { Schema, SchemaContextModel } from '@vev/utils';
2
2
  import React from 'react';
3
3
  import { SilkeForm, SilkeFormProps } from '../silke-form';
4
4
  import { SilkeSchemaContext } from './silke-schema-context';
@@ -1,4 +1,4 @@
1
- import { SchemaContextModel } from '@vev/react';
1
+ import { SchemaContextModel } from '@vev/utils';
2
2
  import React, { ReactNode } from 'react';
3
3
 
4
4
  type SilkeSchemaScopeProps<T> = {
@@ -1,4 +1,4 @@
1
- import { SchemaFieldComponents, VevProps } from '@vev/react';
1
+ import { SchemaFieldComponents, VevProps } from '@vev/utils';
2
2
  import { isFunction } from 'lodash';
3
3
  import React, { useEffect, useState } from 'react';
4
4
  import { SilkeBox, useExtendedFields, useFormField } from '..';
@@ -1,4 +1,4 @@
1
- import { VevProps } from '@vev/react';
1
+ import { VevProps } from '@vev/utils';
2
2
  import React from 'react';
3
3
  import { SilkeFormProps } from '../silke-form';
4
4
  import { SilkeSchemaField } from './silke-schema-field';
@@ -3,7 +3,7 @@ import { fireEvent, render, screen } from '@testing-library/react';
3
3
  import { SilkeSelectField } from './silke-select-field';
4
4
  import userEvent from '@testing-library/user-event';
5
5
  import { SilkeForm } from '../silke-form';
6
- import { ARROW_DOWN, ARROW_UP, ENTER, SPACE } from '../../../jest/keys';
6
+ import { ARROW_DOWN, ARROW_UP, ENTER } from '../../../jest/keys';
7
7
 
8
8
  describe('silke-select-field', () => {
9
9
  beforeAll(() => {
@@ -202,7 +202,6 @@ describe('silke-select-field', () => {
202
202
  await user.click(option);
203
203
 
204
204
  expect(dropdown).not.toBeInTheDocument();
205
- expect(input).toHaveFocus();
206
205
  });
207
206
 
208
207
  it('Closes dropdown when input looses focus', async () => {
@@ -19,7 +19,7 @@ export type SilkeTagProps = {
19
19
  * Will add a remove button to tag
20
20
  */
21
21
  onRemove?: (e: React.MouseEvent) => void;
22
- } & BoxProps;
22
+ } & Omit<BoxProps, 'size'>;
23
23
 
24
24
  function SilkeTagComp(
25
25
  {
@@ -43,7 +43,7 @@ function SilkeTagComp(
43
43
  if (rest?.onClick) cl.push(styles.selectable);
44
44
 
45
45
  return (
46
- <SilkeBox {...rest} className={cl.join(' ')} hPad="xs" vAlign="center" ref={ref}>
46
+ <SilkeBox {...(rest as BoxProps)} className={cl.join(' ')} hPad="xs" vAlign="center" ref={ref}>
47
47
  <SilkeText overflow flex className={styles.label}>
48
48
  <SilkeBox gap={innerGap} align="center">
49
49
  {icon && <SilkeIcon icon={icon} />}
@@ -34,21 +34,18 @@ export function useDropZone(
34
34
  if (eventTarget === e.target) return null;
35
35
  eventTarget = e.target;
36
36
 
37
- e.stopPropagation();
38
37
  e.preventDefault();
39
38
  if (enterRef.current) enterRef.current(e);
40
39
  };
41
40
  const onLeave = (e: DragEvent) => {
42
41
  if (leaveRef.current && e.target === eventTarget) {
43
42
  eventTarget = null;
44
- e.stopPropagation();
45
43
  e.preventDefault();
46
44
  leaveRef.current(e);
47
45
  }
48
46
  };
49
47
  const onDrop = (e: DragEvent) => {
50
48
  eventTarget = null;
51
- e.stopPropagation();
52
49
  e.preventDefault();
53
50
  if (dropRef.current) dropRef.current(e);
54
51
  };
package/src/icons.tsx CHANGED
@@ -25,6 +25,7 @@ export const SilkeIconDefinitions = {
25
25
  menuMore: 'fal fa-ellipsis-v',
26
26
  menu: 'fal fa-bars',
27
27
  drag: 'fal fa-grip-lines',
28
+ 'drag.dots': 'fa-solid fa-grip-dots-vertical',
28
29
  remove: 'fal fa-minus',
29
30
  'error.circle': 'fal fa-exclamation-circle',
30
31
  'warning.triangle': 'fal fa-triangle-exclamation',
@@ -353,6 +354,7 @@ export const SilkeIconDefinitions = {
353
354
  'interaction.inactive': 'fa-thin fa-bolt',
354
355
  'interaction.click': 'fa-light fa-hand-pointer',
355
356
  'interaction.arrow': 'fa-regular fa-arrow-down',
357
+ 'interaction.timer': 'fa-light fa-clock',
356
358
  };
357
359
 
358
360
  function CustomComponentIcon({ className }: { className?: string }) {
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
- "exclude": ["../../node_modules/**/*", "./src/docs/**/*"],
3
+ "exclude": ["../../node_modules/**/*", "./src/docs/**/*", "**/*.spec.ts", "**/*.spec.tsx"],
4
4
  "include": ["src/**/*", "../../@types"],
5
5
  "compilerOptions": {
6
6
  "strict": true,
package/webpack.docs.ts CHANGED
@@ -52,7 +52,7 @@ export default async function (env: Env) {
52
52
  devServer: {
53
53
  port: 3002,
54
54
  hot: isDev,
55
- open: 'chrome',
55
+ open: '/',
56
56
  devMiddleware: {
57
57
  writeToDisk: true,
58
58
  },
@@ -1,8 +0,0 @@
1
- /**
2
- * @license
3
- * Lodash <https://lodash.com/>
4
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
5
- * Released under MIT license <https://lodash.com/license>
6
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
7
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8
- */