@vev/silke 1.1.9 → 1.1.10

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/styles.css CHANGED
@@ -2514,6 +2514,51 @@ img.silke-icon_icon_84f9e9d6b3 {
2514
2514
  * Get font size base on base font size
2515
2515
  * scaling = round(size * 1.200) (Minor Third)
2516
2516
  */
2517
+ .silke-overflow-menu_btnOpen_9d7478ea25 {
2518
+ background-color: var(--color-neutral-20) !important;
2519
+ border: none !important;
2520
+ }
2521
+ .silke-overflow-menu_btnOpen_9d7478ea25::before {
2522
+ display: none !important;
2523
+ }
2524
+
2525
+ .silke-overflow-menu_menu_9d7478ea25 {
2526
+ overflow: hidden;
2527
+ min-width: 70px;
2528
+ background: var(--color-neutral-20);
2529
+ border-radius: var(--border-radius-small);
2530
+ filter: var(--shadow-level-4);
2531
+ }
2532
+ .silke-overflow-menu_menu_9d7478ea25 hr {
2533
+ margin: 8px 0;
2534
+ background: var(--color-neutral-60);
2535
+ }
2536
+ .silke-overflow-menu_menu_9d7478ea25:focus {
2537
+ outline: none;
2538
+ }
2539
+ .silke-overflow-menu_menu_9d7478ea25:focus-visible {
2540
+ box-shadow: 0 0 0 4px var(--color-neutral-100);
2541
+ }
2542
+ .silke-overflow-menu_menu_9d7478ea25 button,
2543
+ .silke-overflow-menu_menu_9d7478ea25 a {
2544
+ justify-content: start !important;
2545
+ }
2546
+ /**********************
2547
+ * SOME MATH
2548
+ ************************/
2549
+ /**********************
2550
+ * FONT
2551
+ ************************/
2552
+ /**********************
2553
+ * SPACING
2554
+ ************************/
2555
+ /**********************
2556
+ * SIZES
2557
+ ************************/
2558
+ /**
2559
+ * Get font size base on base font size
2560
+ * scaling = round(size * 1.200) (Minor Third)
2561
+ */
2517
2562
  .silke-image_img_45cd7ad714 {
2518
2563
  -o-object-position: center center;
2519
2564
  object-position: center center;
@@ -2559,34 +2604,38 @@ img.silke-icon_icon_84f9e9d6b3 {
2559
2604
  * Get font size base on base font size
2560
2605
  * scaling = round(size * 1.200) (Minor Third)
2561
2606
  */
2562
- .silke-overflow-menu_btnOpen_9d7478ea25 {
2563
- background-color: var(--color-neutral-20) !important;
2564
- border: none !important;
2565
- }
2566
- .silke-overflow-menu_btnOpen_9d7478ea25::before {
2567
- display: none !important;
2568
- }
2569
-
2570
- .silke-overflow-menu_menu_9d7478ea25 {
2571
- overflow: hidden;
2572
- min-width: 70px;
2573
- background: var(--color-neutral-20);
2574
- border-radius: var(--border-radius-small);
2575
- filter: var(--shadow-level-4);
2607
+ .silke-code-snippet_main_4e986d6b6d {
2608
+ position: relative;
2609
+ flex-direction: column;
2610
+ background: var(--color-neutral-0);
2576
2611
  }
2577
- .silke-overflow-menu_menu_9d7478ea25 hr {
2578
- margin: 8px 0;
2579
- background: var(--color-neutral-60);
2612
+ .silke-code-snippet_main_4e986d6b6d pre {
2613
+ width: 100%;
2614
+ margin: 0;
2615
+ padding: 8px;
2616
+ word-break: break-word;
2580
2617
  }
2581
- .silke-overflow-menu_menu_9d7478ea25:focus {
2582
- outline: none;
2618
+ .silke-code-snippet_main_4e986d6b6d:hover .silke-code-snippet_buttons_4e986d6b6d {
2619
+ opacity: 1;
2583
2620
  }
2584
- .silke-overflow-menu_menu_9d7478ea25:focus-visible {
2585
- box-shadow: 0 0 0 4px var(--color-neutral-100);
2621
+
2622
+ .silke-code-snippet_buttons_4e986d6b6d {
2623
+ position: absolute;
2624
+ bottom: 8px;
2625
+ right: 8px;
2626
+ opacity: 0.5;
2627
+ align-items: flex-end;
2586
2628
  }
2587
- .silke-overflow-menu_menu_9d7478ea25 button,
2588
- .silke-overflow-menu_menu_9d7478ea25 a {
2589
- justify-content: start !important;
2629
+
2630
+ .silke-code-snippet_lineNumber_4e986d6b6d {
2631
+ display: inline-block;
2632
+ color: gray;
2633
+ width: 30px;
2634
+ font-size: 14px;
2635
+ padding: 0 5px;
2636
+ -webkit-user-select: none;
2637
+ -moz-user-select: none;
2638
+ user-select: none;
2590
2639
  }
2591
2640
  /**********************
2592
2641
  * SOME MATH
@@ -2654,55 +2703,6 @@ button.silke-link {
2654
2703
  * Get font size base on base font size
2655
2704
  * scaling = round(size * 1.200) (Minor Third)
2656
2705
  */
2657
- .silke-code-snippet_main_4e986d6b6d {
2658
- position: relative;
2659
- flex-direction: column;
2660
- background: var(--color-neutral-0);
2661
- }
2662
- .silke-code-snippet_main_4e986d6b6d pre {
2663
- width: 100%;
2664
- margin: 0;
2665
- padding: 8px;
2666
- word-break: break-word;
2667
- }
2668
- .silke-code-snippet_main_4e986d6b6d:hover .silke-code-snippet_buttons_4e986d6b6d {
2669
- opacity: 1;
2670
- }
2671
-
2672
- .silke-code-snippet_buttons_4e986d6b6d {
2673
- position: absolute;
2674
- bottom: 8px;
2675
- right: 8px;
2676
- opacity: 0.5;
2677
- align-items: flex-end;
2678
- }
2679
-
2680
- .silke-code-snippet_lineNumber_4e986d6b6d {
2681
- display: inline-block;
2682
- color: gray;
2683
- width: 30px;
2684
- font-size: 14px;
2685
- padding: 0 5px;
2686
- -webkit-user-select: none;
2687
- -moz-user-select: none;
2688
- user-select: none;
2689
- }
2690
- /**********************
2691
- * SOME MATH
2692
- ************************/
2693
- /**********************
2694
- * FONT
2695
- ************************/
2696
- /**********************
2697
- * SPACING
2698
- ************************/
2699
- /**********************
2700
- * SIZES
2701
- ************************/
2702
- /**
2703
- * Get font size base on base font size
2704
- * scaling = round(size * 1.200) (Minor Third)
2705
- */
2706
2706
  .silke-sortable-list_item_cdeed952d0 [data-drag-handle] {
2707
2707
  cursor: grab;
2708
2708
  }
@@ -33,6 +33,7 @@ export declare const SilkeIconDefinitions: {
33
33
  'ai.component.flat': string;
34
34
  'ai.text': string;
35
35
  'ai.file': string;
36
+ 'ai.clone.edit': typeof AiGradientCloneEdit;
36
37
  sparkles: string;
37
38
  compare: string;
38
39
  menuMore: string;
@@ -498,5 +499,6 @@ declare function AnimationFillForwards(): import("react/jsx-runtime").JSX.Elemen
498
499
  declare function AnimationFillBoth(): import("react/jsx-runtime").JSX.Element;
499
500
  declare function AiGradientIcon(): import("react/jsx-runtime").JSX.Element;
500
501
  declare function AiGradientPage(): import("react/jsx-runtime").JSX.Element;
502
+ declare function AiGradientCloneEdit(): import("react/jsx-runtime").JSX.Element;
501
503
  declare function AiGradientComponent(): import("react/jsx-runtime").JSX.Element;
502
504
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vev/silke",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "@uiw/codemirror-theme-dracula": "^4.25.4",
27
27
  "prism-react-renderer": "^2.4.1",
28
28
  "@vev/interactions": "1.0.2",
29
- "@vev/react": "0.3.4",
30
- "@vev/utils": "1.2.17"
29
+ "@vev/react": "0.3.5",
30
+ "@vev/utils": "1.2.18"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@mdx-js/react": "^3.1.0",
@@ -1,8 +1,13 @@
1
- import { NumberField as NumberFieldType, SchemaFieldProps } from '@vev/utils';
2
- import React, { useEffect, useState } from 'react';
1
+ import { NumberField as NumberFieldType, SchemaFieldProps, Suggestion } from '@vev/utils';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
3
  import { SilkeCssNumberField } from '../../silke-css-number-field';
4
4
  import { SilkeBox } from '../../silke-box';
5
5
  import { SilkeSlider } from '../../silke-slider';
6
+ import { SilkeText, SilkeTextSmall } from '../../silke-text';
7
+ import { SilkeIconTooltip } from '../../silke-tooltip';
8
+ import { SilkeIcon } from '../../silke-icon';
9
+ import { SilkeButton } from '../../silke-button';
10
+ import { SilkePopover } from '../../silke-popover';
6
11
 
7
12
  import { getTitle } from './utils/schema-util';
8
13
  import { SilkeTextFieldOutline } from '../../silke-text-field/silke-text-field-outline';
@@ -16,6 +21,9 @@ const NumberField = (
16
21
  noLabel?: boolean;
17
22
  },
18
23
  ) => {
24
+ const textFieldRef = useRef(null);
25
+ const dropdownRef = useRef<HTMLDivElement>(null);
26
+ const [showSuggestions, setShowSuggestions] = useState(false);
19
27
  const [errorMessage, setErrorMessage] = useState<string>();
20
28
  const {
21
29
  value,
@@ -57,6 +65,110 @@ const NumberField = (
57
65
  return +value.toFixed(1);
58
66
  };
59
67
 
68
+ const displayValue = scale !== 1 ? `${scaledValue ?? 0}${format}` : `${value ?? '0'}${format}`;
69
+
70
+ const suggestion = schema.options?.suggestions?.find((s: Suggestion) => {
71
+ return s.value === `${value}`;
72
+ });
73
+
74
+ if (schema.options?.suggestions && schema.options?.suggestions.length) {
75
+ if (suggestion) {
76
+ return (
77
+ <SilkeBox column>
78
+ <SilkeBox vAlign="center" style={{ fontSize: '12px' }}>
79
+ <SilkeTextSmall>{getTitle(schema)}</SilkeTextSmall>
80
+ {schema.description && <SilkeIconTooltip tooltip={schema.description} icon="tooltip" />}
81
+ </SilkeBox>
82
+ <SilkeBox gap="s" hPad="s" vPad="xs" align bg="surface-2" flex rounded="tiny">
83
+ <SilkeIcon icon="interaction.icon" />
84
+ <SilkeText size="small">{suggestion.label}</SilkeText>
85
+ <SilkeButton
86
+ icon="close"
87
+ kind="ghost"
88
+ size="s"
89
+ onClick={() => {
90
+ onChange(null);
91
+ }}
92
+ />
93
+ </SilkeBox>
94
+ </SilkeBox>
95
+ );
96
+ }
97
+
98
+ return (
99
+ <SilkeBox flex ref={textFieldRef}>
100
+ <SilkeCssNumberField
101
+ {...rest}
102
+ formats={formats}
103
+ precision={precision}
104
+ value={displayValue}
105
+ error={errorMessage}
106
+ disabled={disabled}
107
+ size="s"
108
+ label={props?.noLabel ? '' : getTitle(schema)}
109
+ inline={!!props.noLabel}
110
+ tooltip={schema.description}
111
+ min={min === Number.NEGATIVE_INFINITY ? undefined : min}
112
+ max={max === Number.POSITIVE_INFINITY ? undefined : max}
113
+ onFocus={() => {
114
+ setShowSuggestions(true);
115
+ }}
116
+ onBlur={(e) => {
117
+ if (!dropdownRef.current?.contains(e.relatedTarget as Node)) {
118
+ setShowSuggestions(false);
119
+ }
120
+ }}
121
+ onChange={(v: string) => {
122
+ const num = parseFloat(v);
123
+ if (!isNaN(num)) {
124
+ onChange(scale !== 1 ? num / scale : num);
125
+ }
126
+ }}
127
+ />
128
+ {showSuggestions && (
129
+ <SilkePopover
130
+ anchorOrigin="bottom-center"
131
+ targetOrigin="top-center"
132
+ offsetY={1}
133
+ anchor={textFieldRef}
134
+ matchAnchorWidth
135
+ >
136
+ <SilkeBox
137
+ ref={dropdownRef}
138
+ rounded="tiny"
139
+ cursor="pointer"
140
+ column
141
+ pad="xs"
142
+ bg="neutral-20"
143
+ >
144
+ {schema.options?.suggestions.map((suggestion: Suggestion) => {
145
+ return (
146
+ <SilkeBox
147
+ pad="xs"
148
+ rounded="tiny"
149
+ bgHover="neutral-30"
150
+ flex
151
+ gap="s"
152
+ height="s"
153
+ vAlign
154
+ tabIndex={-1}
155
+ onClick={() => {
156
+ setShowSuggestions(false);
157
+ (onChange as unknown as (v: string) => void)(suggestion.value);
158
+ }}
159
+ >
160
+ {suggestion.icon && (suggestion.icon as React.ReactNode)}
161
+ <SilkeTextSmall>{suggestion.label}</SilkeTextSmall>
162
+ </SilkeBox>
163
+ );
164
+ })}
165
+ </SilkeBox>
166
+ </SilkePopover>
167
+ )}
168
+ </SilkeBox>
169
+ );
170
+ }
171
+
60
172
  if (display === 'slider') {
61
173
  const sliderValue = scaledValue ?? 0;
62
174
  const sliderFormats = schema.options?.formats || (format ? [format] : ['None']);
@@ -189,8 +301,6 @@ const NumberField = (
189
301
  );
190
302
  }
191
303
 
192
- const displayValue = scale !== 1 ? `${scaledValue ?? 0}${format}` : `${value ?? '0'}${format}`;
193
-
194
304
  return (
195
305
  <SilkeBox flex>
196
306
  <SilkeCssNumberField
package/src/icons.tsx CHANGED
@@ -36,6 +36,7 @@ export const SilkeIconDefinitions = {
36
36
  'ai.component.flat': 'fa-kit fa-light-cube-sparkle-tr',
37
37
  'ai.text': 'fa-kit fa-light-text-sparkle-tr',
38
38
  'ai.file': 'fa-kit fa-light-file-lines-sparkle',
39
+ 'ai.clone.edit': AiGradientCloneEdit,
39
40
  sparkles: 'fa-solid fa-sparkles',
40
41
  compare: 'fal fa-shuffle',
41
42
  menuMore: 'fal fa-ellipsis-v',
@@ -891,6 +892,20 @@ function AiGradientPage() {
891
892
  );
892
893
  }
893
894
 
895
+ function AiGradientCloneEdit() {
896
+ return (
897
+ <i
898
+ className="fa-light fa-clone-plus"
899
+ style={{
900
+ background: 'linear-gradient(208deg, #B38FFF 31.76%, #2AEEE1 123.33%)',
901
+ backgroundClip: 'text',
902
+ WebkitTextFillColor: 'transparent',
903
+ lineHeight: 'inherit',
904
+ }}
905
+ />
906
+ );
907
+ }
908
+
894
909
  function AiGradientComponent() {
895
910
  return (
896
911
  <i