@vev/silke 1.0.27 → 1.0.28

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.
@@ -2,5 +2,6 @@ import { NumberField as NumberFieldType, SchemaFieldProps } from '@vev/utils';
2
2
  import React from 'react';
3
3
  declare const NumberField: (props: SchemaFieldProps<Omit<NumberFieldType, "format">> & {
4
4
  format?: string;
5
+ noLabel?: boolean;
5
6
  }) => React.JSX.Element;
6
7
  export default NumberField;
@@ -1,13 +1,16 @@
1
1
  import { Schema, SchemaContextModel } from '@vev/utils';
2
2
  import React from 'react';
3
3
  import { SilkeFormProps } from '../silke-form';
4
+ import { SilkeTextFieldOutlineProps } from '../silke-text-field/silke-text-field-outline';
4
5
  type SilkeFormSchemaProps<T extends {
5
6
  [key: string]: any;
6
7
  }> = {
7
8
  schema: Schema;
8
9
  context: SchemaContextModel;
10
+ leftLabel?: boolean;
11
+ inline?: SilkeTextFieldOutlineProps['inline'];
9
12
  } & SilkeFormProps<T>;
10
13
  export declare function SilkeFormSchema<T extends {
11
14
  [key: string]: any;
12
- }>({ schema, value, context, ...rest }: SilkeFormSchemaProps<T>): React.JSX.Element;
15
+ }>({ schema, value, context, inline, ...rest }: SilkeFormSchemaProps<T>): React.JSX.Element;
13
16
  export {};
@@ -17,7 +17,7 @@ export type SilkeTextFieldOutlineProps = {
17
17
  hAlign?: BoxProps['hAlign'];
18
18
  vAlign?: BoxProps['vAlign'];
19
19
  /** Inline will add the label before the input field */
20
- inline?: boolean | 'label-inside';
20
+ inline?: boolean | 'label-inside' | 'label-left';
21
21
  /** Field required input (if string the string will be used as error msg) */
22
22
  /** Helpful tip or explanation of function of the field */
23
23
  help?: React.ReactNode;
@@ -19,6 +19,7 @@ export declare const SilkeIconDefinitions: {
19
19
  'cloud.check': string;
20
20
  'cloud.slash': string;
21
21
  ai: string;
22
+ sparkles: string;
22
23
  compare: string;
23
24
  menuMore: string;
24
25
  menu: string;
@@ -278,6 +279,7 @@ export declare const SilkeIconDefinitions: {
278
279
  'text.row.remove': typeof TableRowRemove;
279
280
  adobe: string;
280
281
  facebook: string;
282
+ 'x.twitter': string;
281
283
  instagram: string;
282
284
  youtube: string;
283
285
  microsoft: string;
package/dist/styles.css CHANGED
@@ -1112,6 +1112,58 @@ div[data-shadow=level4] {
1112
1112
  content: "";
1113
1113
  z-index: 1;
1114
1114
  }
1115
+ .styles_image_11233b422c {
1116
+ width: 24px;
1117
+ height: 24px;
1118
+ -o-object-fit: cover;
1119
+ object-fit: cover;
1120
+ border-radius: 4px;
1121
+ margin-right: 10px;
1122
+ background: #333;
1123
+ text-align: center;
1124
+ vertical-align: middle;
1125
+ display: flex;
1126
+ justify-content: center;
1127
+ align-items: center;
1128
+ }
1129
+
1130
+ .styles_icon_11233b422c {
1131
+ width: 24px;
1132
+ height: 24px;
1133
+ }
1134
+
1135
+ .styles_arrayItem_11233b422c {
1136
+ padding: 4px 0;
1137
+ border-radius: 4px;
1138
+ }
1139
+ .styles_arrayItem_11233b422c:hover {
1140
+ background-color: var(--neutral-20);
1141
+ }
1142
+ .styles_arrayItem_11233b422c:hover .styles_arrayItemButtons_11233b422c {
1143
+ opacity: 1;
1144
+ }
1145
+ .styles_arrayItem_11233b422c .styles_arrayItemButtons_11233b422c {
1146
+ opacity: 0;
1147
+ transition: opacity 400ms;
1148
+ margin-right: 10px;
1149
+ }
1150
+
1151
+ .styles_imageField__actions_11233b422c {
1152
+ position: absolute;
1153
+ bottom: 0;
1154
+ left: 0;
1155
+ right: 0;
1156
+ background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
1157
+ }
1158
+
1159
+ .styles_arrayFieldModal_11233b422c {
1160
+ width: 256px;
1161
+ border-radius: 8px;
1162
+ border-right: 1px solid var(--color-neutral-0);
1163
+ padding-bottom: 16px;
1164
+ max-height: 100vh;
1165
+ overflow: auto;
1166
+ }
1115
1167
  .silke-autocomplete-field_root_bc5daf4479 {
1116
1168
  cursor: pointer;
1117
1169
  -webkit-user-select: none;
@@ -1173,58 +1225,6 @@ div[data-shadow=level4] {
1173
1225
  .silke-autocomplete-field_arrow_bc5daf4479 i {
1174
1226
  font-size: 10px !important;
1175
1227
  }
1176
- .styles_image_11233b422c {
1177
- width: 24px;
1178
- height: 24px;
1179
- -o-object-fit: cover;
1180
- object-fit: cover;
1181
- border-radius: 4px;
1182
- margin-right: 10px;
1183
- background: #333;
1184
- text-align: center;
1185
- vertical-align: middle;
1186
- display: flex;
1187
- justify-content: center;
1188
- align-items: center;
1189
- }
1190
-
1191
- .styles_icon_11233b422c {
1192
- width: 24px;
1193
- height: 24px;
1194
- }
1195
-
1196
- .styles_arrayItem_11233b422c {
1197
- padding: 4px 0;
1198
- border-radius: 4px;
1199
- }
1200
- .styles_arrayItem_11233b422c:hover {
1201
- background-color: var(--neutral-20);
1202
- }
1203
- .styles_arrayItem_11233b422c:hover .styles_arrayItemButtons_11233b422c {
1204
- opacity: 1;
1205
- }
1206
- .styles_arrayItem_11233b422c .styles_arrayItemButtons_11233b422c {
1207
- opacity: 0;
1208
- transition: opacity 400ms;
1209
- margin-right: 10px;
1210
- }
1211
-
1212
- .styles_imageField__actions_11233b422c {
1213
- position: absolute;
1214
- bottom: 0;
1215
- left: 0;
1216
- right: 0;
1217
- background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
1218
- }
1219
-
1220
- .styles_arrayFieldModal_11233b422c {
1221
- width: 256px;
1222
- border-radius: 8px;
1223
- border-right: 1px solid var(--color-neutral-0);
1224
- padding-bottom: 16px;
1225
- max-height: 100vh;
1226
- overflow: auto;
1227
- }
1228
1228
  .silke-drawer_sidebar_9946634841 {
1229
1229
  position: fixed;
1230
1230
  top: 0;
@@ -1980,34 +1980,6 @@ img.silke-icon_icon_84f9e9d6b3 {
1980
1980
  right: 0;
1981
1981
  height: 1px;
1982
1982
  }
1983
- /**********************
1984
- * SOME MATH
1985
- ************************/
1986
- /**********************
1987
- * FONT
1988
- ************************/
1989
- /**********************
1990
- * SPACING
1991
- ************************/
1992
- /**********************
1993
- * SIZES
1994
- ************************/
1995
- /**
1996
- * Get font size base on base font size
1997
- * scaling = round(size * 1.200) (Minor Third)
1998
- */
1999
- .silke-steps_number_e3e97b6c1a {
2000
- width: 24px;
2001
- height: 24px;
2002
- outline: 1px solid #fff;
2003
- border-radius: 50%;
2004
- text-align: center;
2005
- transition: 500ms outline;
2006
- }
2007
-
2008
- .silke-steps_number_e3e97b6c1a.silke-steps_done_e3e97b6c1a {
2009
- outline: 1px solid var(--color-success-30);
2010
- }
2011
1983
  body {
2012
1984
  --silke-card-border-radius: 8px;
2013
1985
  --silke-card-aspect-ratio: 16/10;
@@ -2201,6 +2173,34 @@ body {
2201
2173
  * Get font size base on base font size
2202
2174
  * scaling = round(size * 1.200) (Minor Third)
2203
2175
  */
2176
+ .silke-steps_number_e3e97b6c1a {
2177
+ width: 24px;
2178
+ height: 24px;
2179
+ outline: 1px solid #fff;
2180
+ border-radius: 50%;
2181
+ text-align: center;
2182
+ transition: 500ms outline;
2183
+ }
2184
+
2185
+ .silke-steps_number_e3e97b6c1a.silke-steps_done_e3e97b6c1a {
2186
+ outline: 1px solid var(--color-success-30);
2187
+ }
2188
+ /**********************
2189
+ * SOME MATH
2190
+ ************************/
2191
+ /**********************
2192
+ * FONT
2193
+ ************************/
2194
+ /**********************
2195
+ * SPACING
2196
+ ************************/
2197
+ /**********************
2198
+ * SIZES
2199
+ ************************/
2200
+ /**
2201
+ * Get font size base on base font size
2202
+ * scaling = round(size * 1.200) (Minor Third)
2203
+ */
2204
2204
  .silke-breadcrumb_breadbrumbs_4495c248fa {
2205
2205
  padding: 0;
2206
2206
  margin: 0;
@@ -2599,6 +2599,83 @@ body {
2599
2599
  * Get font size base on base font size
2600
2600
  * scaling = round(size * 1.200) (Minor Third)
2601
2601
  */
2602
+ body {
2603
+ --tile-background: var(--color-neutral-5);
2604
+ --tile-background-hover: rgba(var(--color-neutral-5-rgb), 0.32);
2605
+ --tile-background-active: rgba(var(--color-neutral-5-rgb), 0.08);
2606
+ }
2607
+
2608
+ .silke-tile_tile_47b57b749d {
2609
+ position: relative;
2610
+ background: var(--tile-background);
2611
+ }
2612
+ .silke-tile_tile_47b57b749d:focus {
2613
+ outline: none;
2614
+ }
2615
+ .silke-tile_tile_47b57b749d:focus-visible, .silke-tile_tile_47b57b749d.silke-tile_selected_47b57b749d {
2616
+ box-shadow: 0 0 0 1px var(--color-neutral-100);
2617
+ border-color: var(--color-neutral-100);
2618
+ }
2619
+
2620
+ .silke-tile_clickable_47b57b749d {
2621
+ cursor: pointer;
2622
+ transition: background ease-in-out 100ms;
2623
+ }
2624
+ .silke-tile_clickable_47b57b749d:hover {
2625
+ background-color: var(--tile-background-hover);
2626
+ }
2627
+ .silke-tile_clickable_47b57b749d:active {
2628
+ background: var(--tile-background-active);
2629
+ }
2630
+
2631
+ .silke-tile_icon_47b57b749d {
2632
+ font-size: 16px;
2633
+ }
2634
+
2635
+ .silke-tile_tags_47b57b749d {
2636
+ position: absolute;
2637
+ top: 0;
2638
+ right: 0;
2639
+ }
2640
+ .silke-tile_tags_47b57b749d > *:not(:last-child) {
2641
+ margin-right: 8px;
2642
+ }
2643
+
2644
+ .silke-tile_tiny_47b57b749d {
2645
+ max-width: 256px;
2646
+ width: 100%;
2647
+ }
2648
+
2649
+ .silke-tile_small_47b57b749d {
2650
+ max-width: 512px;
2651
+ width: 100%;
2652
+ }
2653
+
2654
+ .silke-tile_medium_47b57b749d {
2655
+ max-width: 768px;
2656
+ width: 100%;
2657
+ }
2658
+
2659
+ .silke-tile_large_47b57b749d {
2660
+ max-width: 1024px;
2661
+ width: 100%;
2662
+ }
2663
+ /**********************
2664
+ * SOME MATH
2665
+ ************************/
2666
+ /**********************
2667
+ * FONT
2668
+ ************************/
2669
+ /**********************
2670
+ * SPACING
2671
+ ************************/
2672
+ /**********************
2673
+ * SIZES
2674
+ ************************/
2675
+ /**
2676
+ * Get font size base on base font size
2677
+ * scaling = round(size * 1.200) (Minor Third)
2678
+ */
2602
2679
  .silke-table_toolbar_b5946502de {
2603
2680
  border-radius: var(--border-radius-medium);
2604
2681
  border-bottom-left-radius: var(--border-radius-tiny);
@@ -2678,83 +2755,6 @@ body {
2678
2755
  * Get font size base on base font size
2679
2756
  * scaling = round(size * 1.200) (Minor Third)
2680
2757
  */
2681
- body {
2682
- --tile-background: var(--color-neutral-5);
2683
- --tile-background-hover: rgba(var(--color-neutral-5-rgb), 0.32);
2684
- --tile-background-active: rgba(var(--color-neutral-5-rgb), 0.08);
2685
- }
2686
-
2687
- .silke-tile_tile_47b57b749d {
2688
- position: relative;
2689
- background: var(--tile-background);
2690
- }
2691
- .silke-tile_tile_47b57b749d:focus {
2692
- outline: none;
2693
- }
2694
- .silke-tile_tile_47b57b749d:focus-visible, .silke-tile_tile_47b57b749d.silke-tile_selected_47b57b749d {
2695
- box-shadow: 0 0 0 1px var(--color-neutral-100);
2696
- border-color: var(--color-neutral-100);
2697
- }
2698
-
2699
- .silke-tile_clickable_47b57b749d {
2700
- cursor: pointer;
2701
- transition: background ease-in-out 100ms;
2702
- }
2703
- .silke-tile_clickable_47b57b749d:hover {
2704
- background-color: var(--tile-background-hover);
2705
- }
2706
- .silke-tile_clickable_47b57b749d:active {
2707
- background: var(--tile-background-active);
2708
- }
2709
-
2710
- .silke-tile_icon_47b57b749d {
2711
- font-size: 16px;
2712
- }
2713
-
2714
- .silke-tile_tags_47b57b749d {
2715
- position: absolute;
2716
- top: 0;
2717
- right: 0;
2718
- }
2719
- .silke-tile_tags_47b57b749d > *:not(:last-child) {
2720
- margin-right: 8px;
2721
- }
2722
-
2723
- .silke-tile_tiny_47b57b749d {
2724
- max-width: 256px;
2725
- width: 100%;
2726
- }
2727
-
2728
- .silke-tile_small_47b57b749d {
2729
- max-width: 512px;
2730
- width: 100%;
2731
- }
2732
-
2733
- .silke-tile_medium_47b57b749d {
2734
- max-width: 768px;
2735
- width: 100%;
2736
- }
2737
-
2738
- .silke-tile_large_47b57b749d {
2739
- max-width: 1024px;
2740
- width: 100%;
2741
- }
2742
- /**********************
2743
- * SOME MATH
2744
- ************************/
2745
- /**********************
2746
- * FONT
2747
- ************************/
2748
- /**********************
2749
- * SPACING
2750
- ************************/
2751
- /**********************
2752
- * SIZES
2753
- ************************/
2754
- /**
2755
- * Get font size base on base font size
2756
- * scaling = round(size * 1.200) (Minor Third)
2757
- */
2758
2758
  .silke-toggle_container_5fdf33c914 {
2759
2759
  position: relative;
2760
2760
  cursor: pointer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vev/silke",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/silke/src/index.d.ts",
@@ -8,10 +8,12 @@ import { SilkeTextField, SilkeTextFieldItem } from '../../silke-text-field';
8
8
 
9
9
  import { getTitle } from './utils/schema-util';
10
10
  import { SilkeIconTooltip } from '../../silke-tooltip';
11
+ import { useTextFieldContext } from '../../silke-text-field/text-field-context';
11
12
 
12
13
  const NumberField = (
13
14
  props: SchemaFieldProps<Omit<NumberFieldType, 'format'>> & {
14
15
  format?: string;
16
+ noLabel?: boolean;
15
17
  },
16
18
  ) => {
17
19
  const [errorMessage, setErrorMessage] = useState<string>();
@@ -28,6 +30,7 @@ const NumberField = (
28
30
  } = {},
29
31
  ...rest
30
32
  } = props || {};
33
+ const context = useTextFieldContext();
31
34
 
32
35
  useEffect(() => {
33
36
  if (value) {
@@ -40,27 +43,39 @@ const NumberField = (
40
43
  const scale = props.schema?.options?.scale || 1;
41
44
  const format = props.schema?.options?.format || '';
42
45
 
46
+ const round = (value: number) => {
47
+ if (value < 1) return +value.toFixed(2);
48
+ if (value > 99) return Math.round(value);
49
+ return +value.toFixed(1);
50
+ };
51
+
43
52
  if (display === 'slider') {
44
53
  const sliderValue = value ?? 0;
45
54
  return (
46
- <SilkeBox column flex>
47
- <SilkeBox vAlign="center" flex>
55
+ <SilkeBox column={!context.inline} flex>
56
+ <SilkeBox vAlign="center" width={context.inline ? 'xxl' : 'base'} flex={!context.inline}>
48
57
  <SilkeTextSmall>{getTitle(schema)}</SilkeTextSmall>
49
58
  {schema.description && <SilkeIconTooltip tooltip={schema.description} icon="tooltip" />}
50
59
  </SilkeBox>
51
- <SilkeBox vPad="s" gap="s">
60
+ <SilkeBox gap="s" flex>
52
61
  <SilkeSlider
53
62
  value={(sliderValue - min) / (max - min)}
54
63
  onChange={(percentage) => {
55
64
  const value = (percentage * (max - min) + min) / scale;
56
- onChange(value);
65
+ onChange(round(value));
57
66
  }}
58
67
  />
59
68
  <SilkeBox width="l">
60
- <SilkeTextField
61
- value={(sliderValue * scale).toFixed(0).toString() + format}
62
- onChange={(value: string) => onChange(parseFloat(value) / scale)}
63
- size="xs"
69
+ <NumberField
70
+ {...props}
71
+ noLabel
72
+ schema={{
73
+ ...props.schema,
74
+ options: {
75
+ ...props?.schema?.options,
76
+ display: 'input',
77
+ },
78
+ }}
64
79
  />
65
80
  </SilkeBox>
66
81
  </SilkeBox>
@@ -86,7 +101,8 @@ const NumberField = (
86
101
  <SilkeTextField
87
102
  type="number"
88
103
  size="xs"
89
- label={getTitle(schema)}
104
+ label={props?.noLabel ? '' : getTitle(schema)}
105
+ inline={!!props.noLabel}
90
106
  tooltip={schema.description}
91
107
  value={scaledValue}
92
108
  error={errorMessage}
@@ -106,9 +122,9 @@ const NumberField = (
106
122
  flex
107
123
  >
108
124
  {format && (
109
- <SilkeTextFieldItem hPad="s">
125
+ <SilkeBox vAlign="center" style={{ right: '8px' }}>
110
126
  <SilkeTextSmall color="neutral-60">{format}</SilkeTextSmall>
111
- </SilkeTextFieldItem>
127
+ </SilkeBox>
112
128
  )}
113
129
  </SilkeTextField>
114
130
  </SilkeBox>
@@ -4,10 +4,13 @@ import { SilkeForm, SilkeFormProps } from '../silke-form';
4
4
  import TextFieldContext from '../silke-text-field/text-field-context';
5
5
  import { SilkeSchemaContext } from './silke-schema-context';
6
6
  import { SilkeSchemaFields } from './silke-schema-fields';
7
+ import { SilkeTextFieldOutlineProps } from '../silke-text-field/silke-text-field-outline';
7
8
 
8
9
  type SilkeFormSchemaProps<T extends { [key: string]: any }> = {
9
10
  schema: Schema;
10
11
  context: SchemaContextModel;
12
+ leftLabel?: boolean;
13
+ inline?: SilkeTextFieldOutlineProps['inline'];
11
14
  } & SilkeFormProps<T>;
12
15
 
13
16
  // pages?: { title: string; key: string; path?: string }[];
@@ -17,12 +20,13 @@ export function SilkeFormSchema<T extends { [key: string]: any }>({
17
20
  schema,
18
21
  value,
19
22
  context,
23
+ inline = false,
20
24
  ...rest
21
25
  }: SilkeFormSchemaProps<T>) {
22
26
  return (
23
27
  <SilkeSchemaContext context={context}>
24
28
  <SilkeForm {...rest} value={value}>
25
- <TextFieldContext size="xs" kind="default" inline={false}>
29
+ <TextFieldContext size="xs" kind="default" inline={inline}>
26
30
  <SilkeSchemaFields schema={schema} value={value} {...rest} />
27
31
  </TextFieldContext>
28
32
  </SilkeForm>
@@ -38,7 +38,7 @@ export type SilkeTextFieldOutlineProps = {
38
38
  hAlign?: BoxProps['hAlign'];
39
39
  vAlign?: BoxProps['vAlign'];
40
40
  /** Inline will add the label before the input field */
41
- inline?: boolean | 'label-inside';
41
+ inline?: boolean | 'label-inside' | 'label-left';
42
42
 
43
43
  /** Field required input (if string the string will be used as error msg) */
44
44
  /** Helpful tip or explanation of function of the field */
@@ -104,7 +104,11 @@ export const SilkeTextFieldOutline = React.forwardRef<HTMLDivElement, SilkeTextF
104
104
  const boxSize: BoxSize = size === 'xs' ? 's' : size === 's' ? 'base' : 'm';
105
105
 
106
106
  const labelComponent = label && (
107
- <SilkeBox vAlign="center" flex>
107
+ <SilkeBox
108
+ vAlign="center"
109
+ flex={inline !== 'label-left'}
110
+ width={inline === 'label-left' ? 'xxl' : undefined}
111
+ >
108
112
  <SilkeText
109
113
  className={styles.label}
110
114
  tag="label"
package/src/icons.tsx CHANGED
@@ -23,6 +23,7 @@ export const SilkeIconDefinitions = {
23
23
  'cloud.check': 'fal fa-cloud-check',
24
24
  'cloud.slash': 'fal fa-cloud-slash',
25
25
  ai: 'fa-light fa-sparkles',
26
+ sparkles: 'fa-solid fa-sparkles',
26
27
  compare: 'fal fa-shuffle',
27
28
  menuMore: 'fal fa-ellipsis-v',
28
29
  menu: 'fal fa-bars',
@@ -308,6 +309,7 @@ export const SilkeIconDefinitions = {
308
309
  // Brands
309
310
  adobe: 'fab fa-adobe',
310
311
  facebook: 'fab fa-facebook-square',
312
+ 'x.twitter': 'fab fa-square-x-twitter',
311
313
  instagram: 'fab fa-instagram',
312
314
  youtube: 'fab fa-youtube',
313
315
  microsoft: 'fab fa-microsoft',