@scaleflex/ui-tw 0.0.25 → 0.0.26
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.
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import { Label } from '@scaleflex/ui-tw/label';
|
|
3
2
|
import { Switch } from '@scaleflex/ui-tw/switch';
|
|
4
3
|
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
5
4
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
6
5
|
import { cva } from 'class-variance-authority';
|
|
7
6
|
import React from 'react';
|
|
8
|
-
import { FormControl, FormDescription, FormField, FormItem, FormMessage } from '../form.component';
|
|
7
|
+
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../form.component';
|
|
9
8
|
import { SwitchLayout, formSwitchFieldSizeOptions } from '../form.constants';
|
|
10
9
|
var formSwitchFieldVariants = cva('', {
|
|
11
10
|
variants: {
|
|
@@ -32,6 +31,7 @@ function FormSwitchField(_ref) {
|
|
|
32
31
|
control: control,
|
|
33
32
|
name: name,
|
|
34
33
|
render: function render(_ref2) {
|
|
34
|
+
var _switchProps$id, _switchProps$id2;
|
|
35
35
|
var field = _ref2.field;
|
|
36
36
|
return /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement("div", {
|
|
37
37
|
className: cn('group flex items-center', isInlineLayout ? formSwitchFieldVariants({
|
|
@@ -44,14 +44,14 @@ function FormSwitchField(_ref) {
|
|
|
44
44
|
onCheckedChange: field.onChange,
|
|
45
45
|
disabled: disabled,
|
|
46
46
|
size: size
|
|
47
|
-
}, switchProps))), /*#__PURE__*/React.createElement(
|
|
47
|
+
}, switchProps))), /*#__PURE__*/React.createElement(FormLabel, {
|
|
48
48
|
className: "text-foreground",
|
|
49
|
-
htmlFor: field.name,
|
|
49
|
+
htmlFor: (_switchProps$id = switchProps === null || switchProps === void 0 ? void 0 : switchProps.id) !== null && _switchProps$id !== void 0 ? _switchProps$id : field.name,
|
|
50
50
|
tooltip: tooltip,
|
|
51
51
|
size: size
|
|
52
|
-
}, label)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
52
|
+
}, label)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormLabel, {
|
|
53
53
|
className: "text-foreground",
|
|
54
|
-
htmlFor: field.name,
|
|
54
|
+
htmlFor: (_switchProps$id2 = switchProps === null || switchProps === void 0 ? void 0 : switchProps.id) !== null && _switchProps$id2 !== void 0 ? _switchProps$id2 : field.name,
|
|
55
55
|
tooltip: tooltip,
|
|
56
56
|
size: size
|
|
57
57
|
}, label), /*#__PURE__*/React.createElement(FormControl, null, /*#__PURE__*/React.createElement(Switch, _extends({
|
package/form/form.component.js
CHANGED
|
@@ -75,7 +75,7 @@ function FormLabel(_ref3) {
|
|
|
75
75
|
return /*#__PURE__*/React.createElement(Label, _extends({
|
|
76
76
|
"data-slot": "form-label",
|
|
77
77
|
"data-error": !!error,
|
|
78
|
-
className: cn('
|
|
78
|
+
className: cn('data-[error=true]:text-destructive-foreground truncate', className),
|
|
79
79
|
htmlFor: formItemId
|
|
80
80
|
}, props));
|
|
81
81
|
}
|
package/label/label.component.js
CHANGED
|
@@ -26,7 +26,7 @@ function Label(_ref) {
|
|
|
26
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
27
|
return /*#__PURE__*/React.createElement(LabelPrimitive.Root, _extends({
|
|
28
28
|
"data-slot": "label",
|
|
29
|
-
className: cn('text-secondary-foreground flex items-center leading-none font-normal select-none', 'peer-disabled:cursor-not-allowed peer-disabled:opacity-50', 'group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50', 'group-data-[highlight=true]:text-warning-foreground', labelVariants({
|
|
29
|
+
className: cn('text-secondary-foreground flex cursor-pointer items-center leading-none font-normal select-none', 'peer-disabled:cursor-not-allowed peer-disabled:opacity-50', 'group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50', 'group-data-[highlight=true]:text-warning-foreground', labelVariants({
|
|
30
30
|
size: size,
|
|
31
31
|
className: className
|
|
32
32
|
}))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@radix-ui/react-slot": "^1.1.2",
|
|
19
19
|
"@radix-ui/react-switch": "^1.0.1",
|
|
20
20
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
21
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
21
|
+
"@scaleflex/icons-tw": "^0.0.26",
|
|
22
22
|
"@types/lodash.merge": "^4.6.9",
|
|
23
23
|
"class-variance-authority": "^0.7.1",
|
|
24
24
|
"lodash.merge": "^4.6.2",
|