This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 310532a jewel-switch: Rename SwitchCheckBox to just "Switch" and
SwitchRadioButton to "SwitchRadio". Also make Switch more square while
SwitchRadio is more rounded as suggested by Andrew Wetmore.
310532a is described below
commit 310532a946327e036ed77784fe6dfc178b49e595
Author: Carlos Rovira <[email protected]>
AuthorDate: Tue Jan 5 15:48:58 2021 +0100
jewel-switch: Rename SwitchCheckBox to just "Switch" and SwitchRadioButton
to "SwitchRadio". Also make Switch more square while SwitchRadio is more
rounded as suggested by Andrew Wetmore.
---
.../TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml | 14 +++++++-------
.../src/main/royale/RadioButtonPlayGround.mxml | 16 ++++++++--------
.../projects/Jewel/src/main/resources/jewel-manifest.xml | 4 ++--
.../apache/royale/jewel/{SwitchCheckBox.as => Switch.as} | 10 +++++-----
.../jewel/{SwitchRadioButton.as => SwitchRadio.as} | 14 +++++++-------
.../themes/JewelTheme/src/main/resources/defaults.css | 10 ++++++++--
.../src/main/sass/components-primary/_checkbox.sass | 13 ++++++++++---
7 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/examples/jewel/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
b/examples/jewel/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
index df85d32..3fa1f31 100644
--- a/examples/jewel/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
+++ b/examples/jewel/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
@@ -72,24 +72,24 @@ limitations under the License.
<j:CardPrimaryContent>
<j:Label multiline="true">
-
<j:html><![CDATA[<p>SwitchCheckBox is s Switch representation of CheckBox with
same capabilities.</p>]]></j:html>
+ <j:html><![CDATA[<p>Switch is s
switch representation of CheckBox with same capabilities.</p>]]></j:html>
</j:Label>
- <j:SwitchCheckBox text="Not Checked"/>
+ <j:Switch text="Not Checked"/>
- <j:SwitchCheckBox text="Checked"
selected="true"/>
+ <j:Switch text="Checked"
selected="true"/>
- <j:SwitchCheckBox text="Disabled">
+ <j:Switch text="Disabled">
<j:beads>
<j:Disabled/>
</j:beads>
- </j:SwitchCheckBox>
+ </j:Switch>
- <j:SwitchCheckBox text="Checked And
Disabled" selected="true">
+ <j:Switch text="Checked And Disabled"
selected="true">
<j:beads>
<j:Disabled/>
</j:beads>
- </j:SwitchCheckBox>
+ </j:Switch>
</j:CardPrimaryContent>
</j:Card>
</j:GridCell>
diff --git
a/examples/jewel/TourDeJewel/src/main/royale/RadioButtonPlayGround.mxml
b/examples/jewel/TourDeJewel/src/main/royale/RadioButtonPlayGround.mxml
index f022e82..f4dc152 100644
--- a/examples/jewel/TourDeJewel/src/main/royale/RadioButtonPlayGround.mxml
+++ b/examples/jewel/TourDeJewel/src/main/royale/RadioButtonPlayGround.mxml
@@ -72,24 +72,24 @@ limitations under the License.
<j:CardPrimaryContent>
<j:Label multiline="true">
-
<j:html><![CDATA[<p>SwitchRadioButton is s Switch representation of RadioButton
with same capabilities.</p>]]></j:html>
+ <j:html><![CDATA[<p>SwitchRadio
is s Switch representation of RadioButton with same
capabilities.</p>]]></j:html>
</j:Label>
- <j:SwitchRadioButton
text="SwitchRadioButton 1" groupName="radios2" value="Test 1"/>
- <j:SwitchRadioButton
text="SwitchRadioButton 2" groupName="radios2" value="Test 2" selected="true"/>
- <j:SwitchRadioButton
text="SwitchRadioButton 3" groupName="radios2" value="Test 3"/>
+ <j:SwitchRadio text="SwitchRadio 1"
groupName="radios2" value="Test 1"/>
+ <j:SwitchRadio text="SwitchRadio 2"
groupName="radios2" value="Test 2" selected="true"/>
+ <j:SwitchRadio text="SwitchRadio 3"
groupName="radios2" value="Test 3"/>
- <j:SwitchRadioButton text="Disabled">
+ <j:SwitchRadio text="Disabled">
<j:beads>
<j:Disabled/>
</j:beads>
- </j:SwitchRadioButton>
+ </j:SwitchRadio>
- <j:SwitchRadioButton text="Set and
Disabled" selected="true">
+ <j:SwitchRadio text="Set and Disabled"
selected="true">
<j:beads>
<j:Disabled/>
</j:beads>
- </j:SwitchRadioButton>
+ </j:SwitchRadio>
</j:CardPrimaryContent>
</j:Card>
</j:GridCell>
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 88ef7a9..edf0e4d 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -79,9 +79,9 @@
<component id="HSlider" class="org.apache.royale.jewel.HSlider"/>
<component id="VSlider" class="org.apache.royale.jewel.VSlider"/>
<component id="RadioButton" class="org.apache.royale.jewel.RadioButton"/>
- <component id="SwitchRadioButton"
class="org.apache.royale.jewel.SwitchRadioButton"/>
+ <component id="SwitchRadio" class="org.apache.royale.jewel.SwitchRadio"/>
<component id="CheckBox" class="org.apache.royale.jewel.CheckBox"/>
- <component id="SwitchCheckBox"
class="org.apache.royale.jewel.SwitchCheckBox"/>
+ <component id="Switch" class="org.apache.royale.jewel.Switch"/>
<component id="Alert" class="org.apache.royale.jewel.Alert"/>
<component id="TitleBar" class="org.apache.royale.jewel.TitleBar"/>
<component id="List" class="org.apache.royale.jewel.List"/>
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchCheckBox.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Switch.as
similarity index 92%
rename from
frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchCheckBox.as
rename to
frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Switch.as
index cb37524..5a87d23 100644
---
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchCheckBox.as
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Switch.as
@@ -25,14 +25,14 @@ package org.apache.royale.jewel
}
/**
- * The Jewel SwitchCheckBox consists of a lever that can be moved back
and forth indicating a binary condition
+ * The Jewel Switch consists of a lever that can be moved back and forth
indicating a binary condition
* that will be set or unset when the user clicks or touches it. It can
contain an optional label.
*
- * When a user clicks or touches this control or its associated text, the
SwitchCheckBox changes
+ * When a user clicks or touches this control or its associated text, the
Switch changes
* its state from `active` to `inactive` or from `inactive` to `active`,
communicating
* clearly the binary condition.
*
- * SwitchCheckBox can appear in groups (but not necesarily), and can be
+ * Switch can appear in groups (but not necesarily), and can be
* selected and deselected individually.
*
* @langversion 3.0
@@ -40,7 +40,7 @@ package org.apache.royale.jewel
* @playerversion AIR 2.6
* @productversion Royale 0.9.8
*/
- public class SwitchCheckBox extends CheckBox
+ public class Switch extends CheckBox
{
/**
* Constructor.
@@ -50,7 +50,7 @@ package org.apache.royale.jewel
* @playerversion AIR 2.6
* @productversion Royale 0.9.8
*/
- public function SwitchCheckBox()
+ public function Switch()
{
super();
typeNames = "jewel switch";
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchRadioButton.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchRadio.as
similarity index 89%
rename from
frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchRadioButton.as
rename to
frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchRadio.as
index 9cbd29a..f76af1b 100644
---
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchRadioButton.as
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SwitchRadio.as
@@ -25,21 +25,21 @@ package org.apache.royale.jewel
}
/**
- * The Jewel SwitchRadioButton control lets the user make a single choice
within a set of mutually exclusive choices.
+ * The Jewel SwitchRadio control lets the user make a single choice
within a set of mutually exclusive choices.
*
- * A SwitchRadioButton of a lever that can be moved back and forth
indicating a binary condition
- * that will be set or unset when the user clicks or touches it.
SwitchRadioButtons
+ * A SwitchRadio of a lever that can be moved back and forth indicating a
binary condition
+ * that will be set or unset when the user clicks or touches it.
SwitchRadios
* always appear in groups of two or more with the same
<code>groupName</code> property.
*
* While they can be individually selected, can only be deselected by
selecting
- * a different SwitchRadioButton in the same group (which deselects the
rest of SwitchRadioButton).
+ * a different SwitchRadio in the same group (which deselects the rest of
SwitchRadio).
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.8
*/
- public class SwitchRadioButton extends RadioButton
+ public class SwitchRadio extends RadioButton
{
/**
* Constructor.
@@ -49,10 +49,10 @@ package org.apache.royale.jewel
* @playerversion AIR 2.6
* @productversion Royale 0.9.8
*/
- public function SwitchRadioButton()
+ public function SwitchRadio()
{
super();
- typeNames = "jewel switch";
+ typeNames = "jewel switch radio";
}
COMPILE::JS
diff --git a/frameworks/themes/JewelTheme/src/main/resources/defaults.css
b/frameworks/themes/JewelTheme/src/main/resources/defaults.css
index d172a54..7eb658f 100644
--- a/frameworks/themes/JewelTheme/src/main/resources/defaults.css
+++ b/frameworks/themes/JewelTheme/src/main/resources/defaults.css
@@ -462,18 +462,24 @@ j|CardActions {
.jewel.switch .switch {
background: linear-gradient(#d9d9d9, #f3f3f3);
box-shadow: 0px 0px 0px 1px #cccccc;
- border-radius: 20px;
transition: 0.4s;
+ border-radius: 3px;
}
.jewel.switch .switch::before {
background: white;
box-shadow: 1px 0px 1px 0px rgba(0, 0, 0, 0.1);
transition: 0.4s;
- border-radius: 50%;
+ border-radius: 3px;
}
.jewel.switch .label {
padding-left: 8px;
}
+.jewel.switch.radio .switch {
+ border-radius: 20px;
+}
+.jewel.switch.radio .switch::before {
+ border-radius: 50%;
+}
.jewel.combobox .jewel.textinput input {
border-radius: 0.25rem 0px 0px 0.25rem;
diff --git
a/frameworks/themes/JewelTheme/src/main/sass/components-primary/_checkbox.sass
b/frameworks/themes/JewelTheme/src/main/sass/components-primary/_checkbox.sass
index 0297f32..21f141e 100644
---
a/frameworks/themes/JewelTheme/src/main/sass/components-primary/_checkbox.sass
+++
b/frameworks/themes/JewelTheme/src/main/sass/components-primary/_checkbox.sass
@@ -149,8 +149,8 @@ $switch-label-separation: 8px
@else
background: linear-gradient(lighten($default-color, 0%),
lighten($default-color, 10%))
box-shadow: 0px 0px 0px 1px darken($default-color, 5%)
- border-radius: $switch-inner-size
transition: $switch-transition-delay
+ border-radius: $checkbox-border-radius
&::before
@if $flat
@@ -160,7 +160,14 @@ $switch-label-separation: 8px
background: lighten($primary-color, 45%)
box-shadow: 1px 0px 1px 0px rgba(0, 0, 0, .1)
transition: $switch-transition-delay
- border-radius: $switch-button-border-radius
+ border-radius: $checkbox-border-radius
.label
- padding-left: $switch-label-separation
\ No newline at end of file
+ padding-left: $switch-label-separation
+
+ &.radio
+ .switch
+ border-radius: $switch-inner-size
+
+ &::before
+ border-radius: $switch-button-border-radius